You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/09/06 20:21:29 UTC
[GitHub] zhreshold commented on a change in pull request #7626: modify gluon image_classification for imagenet
zhreshold commented on a change in pull request #7626: modify gluon image_classification for imagenet
URL: https://github.com/apache/incubator-mxnet/pull/7626#discussion_r135401428
##########
File path: src/io/iter_image_recordio_2.cc
##########
@@ -388,44 +406,23 @@ inline void ImageRecordIOParser2<DType>::ParseChunk(dmlc::InputSplit::Blob * chu
if (!std::is_same<DType, uint8_t>::value) {
// normalize/mirror here to avoid memory copies
// logic from iter_normalize.h, function SetOutImg
-
- if (normalize_param_.mean_r > 0.0f || normalize_param_.mean_g > 0.0f ||
- normalize_param_.mean_b > 0.0f || normalize_param_.mean_a > 0.0f) {
- // subtract mean per channel
- RGBA[0] -= normalize_param_.mean_r;
- if (n_channels >= 3) {
- RGBA[1] -= normalize_param_.mean_g;
- RGBA[2] -= normalize_param_.mean_b;
- }
- if (n_channels == 4) {
- RGBA[3] -= normalize_param_.mean_a;
- }
- for (int k = 0; k < n_channels; ++k) {
- RGBA[k] = RGBA[k] * contrast_scaled + illumination_scaled;
- }
- } else if (!meanfile_ready_ || normalize_param_.mean_img.length() == 0) {
- // do not subtract anything
- for (int k = 0; k < n_channels; ++k) {
- RGBA[k] = RGBA[k] * normalize_param_.scale;
- }
- } else {
- CHECK(meanfile_ready_);
- for (int k = 0; k < n_channels; ++k) {
- RGBA[k] = (RGBA[k] - meanimg_[k][i][j]) * contrast_scaled + illumination_scaled;
+ for (int k = 0; k < n_channels; ++k) {
Review comment:
The previous one is wrong, if meanfile_ is ready, the normalize_param_.scale was not multiplied in the previous impl
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services