Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

imagenet example training error #4272

Closed
lincolneejdk opened this issue Dec 18, 2016 · 9 comments
Closed

imagenet example training error #4272

lincolneejdk opened this issue Dec 18, 2016 · 9 comments

Comments

@lincolneejdk
Copy link

I train the networks on ILSVRC data set, with preprocessing the data set with im2rec.py -resize=227. when training get the error:

/dmlc-core/include/dmlc/logging.h:235: [13:31:47] src/io/image_aug_default.cc:254: Check failed: static_cast<index_t>(res.rows) >= param_.data_shape[1] && static_cast<index_t>(res.cols) >= param_.data_shape[2] input image size smaller than input shape
i debug around, found this is because in the dataset there is picture‘s pixels less 227 (x < 227 or y < 227 or).

Thanks a lot!

@piiswrong
Copy link
Contributor

use resize for im2rec. Or use resize=256 in ImageRecordIter

@lincolneejdk
Copy link
Author

Thank you very much for your reply! Actually I ran im2rec with resize=227 and I tried serveral ways but all failed:

1.data.set_data_aug_level(parser, 0) instead of level 3

2.set image_shape to very small value like '3,100,100' still failed but '3,1,1' succeed.

I am really confused about that. The image_shape param is set to be smaller than the input shape of 227 but problem still occurred.

Many thanks in advance

@lincolneejdk
Copy link
Author

Update:When set imageshape size to 50, we got: It seems that the data augmentation is default, how to forbid that or is there any better solutions?

INFO:root:Start training with [gpu(0)]
INFO:root:Epoch[0] Batch [20] Speed: 809.11 samples/sec Train-accuracy=0.001172
INFO:root:Epoch[0] Batch [40] Speed: 707.19 samples/sec Train-accuracy=0.001563
mxnet/dmlc-core/include/dmlc/logging.h:235: [12:24:08] src/io/image_aug_default.cc:254: Check failed: static_cast<index_t>(res.rows) >= param_.data_shape[1] && static_cast<index_t>(res.cols) >= param_.data_shape[2] input image size smaller than input shape
terminate called after throwing an instance of 'dmlc::Error'
what(): [12:24:08] src/io/image_aug_default.cc:254: Check failed: static_cast<index_t>(res.rows) >= param_.data_shape[1] && static_cast<index_t>(res.cols) >= param_.data_shape[2] input image size smaller than input shape

@lincolneejdk
Copy link
Author

Update:I annotated all the augmentation params in ImageRecordIter, but still get the same error.

@mli
Copy link
Member

mli commented Dec 20, 2016

i'm assume the input data size is 480. if not, please change this line https://github.com/dmlc/mxnet/blob/master/example/image-classification/train_imagenet.py#L26

for example, change to min_random_scale = 1 for input = 227

@mli
Copy link
Member

mli commented Dec 20, 2016

fixed by #4295

@panyx0718
Copy link

Could you explain what is the meaning of min_random_scale? Thanks

@rohith14
Copy link

I am having the same issue, but with train_cifar10.py (iIssue : #7619)

modified the code in train_cifar10.py to,
fit.add_fit_args(parser)
data.add_data_args(parser)
data.add_data_aug_args(parser)
data.set_data_aug_level(parser, 2)
parser.set_defaults(
network = 'alexnet',
data_train = 'points to .rec file in s3 bucket',
#data_train = train_fname,
data_val = val_fname,
num_classes = 10,
num_examples = 50000,
image_shape = '3,227,227',
pad_size = 4,
batch_size = 128,
num_epochs = 300,
lr = .05,
lr_step_epochs = '200,250',
)
args = parser.parse_args()

Also, while generating the rec file using im2rec.py, i re-sized my images to 227x227x3

Any help is appreciated. Thanks

@szha
Copy link
Member

szha commented Nov 28, 2017

This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks!
Also, do please check out our forum (and Chinese version) for general "how-to" questions.

@szha szha closed this as completed Nov 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants