From b344d89a80f87fce01a964347ff0b5f54e62f374 Mon Sep 17 00:00:00 2001 From: Tong He Date: Thu, 28 Jun 2018 19:24:00 -0700 Subject: [PATCH] fix record io augmentation speed (#11474) --- example/image-classification/common/data.py | 2 +- src/io/image_aug_default.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/image-classification/common/data.py b/example/image-classification/common/data.py index bfaadb3ff6b8..c1dfcf565463 100755 --- a/example/image-classification/common/data.py +++ b/example/image-classification/common/data.py @@ -86,7 +86,7 @@ def add_data_aug_args(parser): def set_resnet_aug(aug): # standard data augmentation setting for resnet training - aug.set_defaults(random_crop=1, random_resized_crop=1) + aug.set_defaults(random_crop=0, random_resized_crop=1) aug.set_defaults(min_random_area=0.08) aug.set_defaults(max_random_aspect_ratio=4./3., min_random_aspect_ratio=3./4.) aug.set_defaults(brightness=0.4, contrast=0.4, saturation=0.4, pca_noise=0.1) diff --git a/src/io/image_aug_default.cc b/src/io/image_aug_default.cc index ce9c79c403af..5b28aa189135 100644 --- a/src/io/image_aug_default.cc +++ b/src/io/image_aug_default.cc @@ -293,7 +293,7 @@ class DefaultImageAugmenter : public ImageAugmenter { if (param_.max_rotate_angle > 0 || param_.max_shear_ratio > 0.0f || param_.rotate > 0 || rotate_list_.size() > 0 || param_.max_random_scale != 1.0f || param_.min_random_scale != 1.0 - || min_aspect_ratio != 1.0f || max_aspect_ratio != 1.0f + || (!param_.random_resized_crop && (min_aspect_ratio != 1.0f || max_aspect_ratio != 1.0f)) || param_.max_img_size != 1e10f || param_.min_img_size != 0.0f) { std::uniform_real_distribution rand_uniform(0, 1); // shear