lebeg commented on a change in pull request #12485: [WIP] 
test_ImageRecordIter_seed_augmentation flaky test fix
URL: https://github.com/apache/incubator-mxnet/pull/12485#discussion_r230322834
 
 

 ##########
 File path: src/io/iter_image_recordio_2.cc
 ##########
 @@ -518,6 +518,17 @@ inline unsigned 
ImageRecordIOParser2<DType>::ParseChunk(DType* data_dptr, real_t
       cv::Mat res;
       rec.Load(blob.dptr, blob.size);
       cv::Mat buf(1, rec.content_size, CV_8U, rec.content);
+
+      if (idx % 1000 == 0) {
+        if (param_.seed_aug.has_value()) {
+          LOG(INFO) << "aug seed: " << param_.seed_aug.value();
+        }
+        LOG(INFO) << "tid: " << tid << " idx: " << idx << " index: " << 
rec.image_index();
+      }
+      if (param_.seed_aug.has_value()) {
+        prnds_[tid]->seed(idx + param_.seed_aug.value());
 
 Review comment:
   I do not understand why seeds need to be reset all the time. The logic is a 
bit obscure - the random generators are in the augmentor and get passed to the 
iterator. 
   Anyway, what you could try to do (if not refactoring) is to seed all 
generators in `DefaultImageAugmenter::Init` 
[here](https://github.com/apache/incubator-mxnet/blob/master/src/io/image_aug_default.cc#L215)
 or in a separate method (since the random generator is not passed in to 
`Init`). I guess the interface `ImageAugmenter` would require a separate `seed` 
method then that could be called sequentially (instead of openmp parallelized).

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to