This is an automated email from the ASF dual-hosted git repository.

wkcn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 554b196  Rebase #13757 to master (#15189)
554b196 is described below

commit 554b1965595fbac10052ce23987773c185ef5e04
Author: Yimin Jiang <[email protected]>
AuthorDate: Fri Jul 12 06:18:35 2019 +0800

    Rebase #13757 to master (#15189)
    
    * Update .gitmodules
    
    * Set ImageNet data augmentation by default
    
    
https://github.com/apache/incubator-mxnet/blob/a38278ddebfcc9459d64237086cd7977ec20c70e/example/image-classification/train_imagenet.py#L42
    
    When I try to train imagenet with this line commented, the train-accuracy 
reaches 99% while the validation-accuracy is only less than 50% (single 
machine, 8 GPUs, global batchsize=2048, Resnet50). Absolutely this is 
overfitting.
    
    Then I uncomment this line and try again with the same experiment settings. 
This time both train and validation accuracy converge to about 70%.
    
    Thus, it seems that this data augmentation is pretty important for ImageNet 
training. Perhaps it will be better to uncomment this as default, so that 
future developers won't get confused by the over-fit issue.
    
    * Add argument for imagenet data augmentation
    
    * Enable data-aug with argument
    
    * Update .gitmodules
---
 example/image-classification/common/fit.py     | 4 +++-
 example/image-classification/train_imagenet.py | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/example/image-classification/common/fit.py 
b/example/image-classification/common/fit.py
index 5775f30..8e8b019 100755
--- a/example/image-classification/common/fit.py
+++ b/example/image-classification/common/fit.py
@@ -142,6 +142,8 @@ def add_fit_args(parser):
     train.add_argument('--profile-server-suffix', type=str, default='',
                        help='profile server actions into a file with name like 
rank1_ followed by this suffix \
                              during distributed training')
+    train.add_argument('--use-imagenet-data-augmentation', type=int, default=0,
+                       help='enable data augmentation of ImageNet data, 
default disabled')
     return train
 
 
@@ -335,4 +337,4 @@ def fit(args, network, data_loader, **kwargs):
     if args.profile_server_suffix:
         mx.profiler.set_state(state='run', profile_process='server')
     if args.profile_worker_suffix:
-        mx.profiler.set_state(state='run', profile_process='worker')
\ No newline at end of file
+        mx.profiler.set_state(state='run', profile_process='worker')
diff --git a/example/image-classification/train_imagenet.py 
b/example/image-classification/train_imagenet.py
index 0835f5d..421c15d 100644
--- a/example/image-classification/train_imagenet.py
+++ b/example/image-classification/train_imagenet.py
@@ -38,8 +38,6 @@ if __name__ == '__main__':
     fit.add_fit_args(parser)
     data.add_data_args(parser)
     data.add_data_aug_args(parser)
-    # uncomment to set standard augmentations for imagenet training
-    # set_imagenet_aug(parser)
     parser.set_defaults(
         # network
         network          = 'resnet',
@@ -56,6 +54,8 @@ if __name__ == '__main__':
         dtype            = 'float32'
     )
     args = parser.parse_args()
+    if args.use_imagenet_data_augmentation:
+        set_imagenet_aug(parser)
 
     # load network
     from importlib import import_module

Reply via email to