kaggle_statefarm icon indicating copy to clipboard operation
kaggle_statefarm copied to clipboard

random crop?

Open yitang opened this issue 8 years ago • 3 comments

Hi, we have 'rand_crop' set to True and the data_shape set to (3, 224, 224) in mx.io.ImageRecordIter. But we already have images re-sized to 224x224 by im2rec program. In this case, I wonder if the random crop is not applied?

yitang avatar Jul 25 '16 18:07 yitang

if the input is 224x224, the ransom crop will not make any change. The reason I kept ransom crop option there is that, if we have larger input with random crop, the result can be improved, but when do inference/testing, one needs to apply random crop too on the same input size and same random crop, otherwise the test output would be disaster .

phunterlau avatar Jul 25 '16 20:07 phunterlau

if the input is 224x224, the ransom crop will not make any change.

Thanks for confirming.

The reason I kept ransom crop option there is that, if we have larger input with random crop, the result can be improved,

I'd try this and see how much improvement I can get.

but when do inference/testing, one needs to apply random crop too on the same input size and same random crop, otherwise the test output would be disaster .

It seems we can't achieve this via MXNET's ImageRecordIter, can we? So to implement that, we need a separate pre-process step, right?

yitang avatar Jul 27 '16 09:07 yitang

for the random crop in test dataset, one can random crop on multiple batch and average, like this https://github.com/dmlc/mxnet/issues/2373 but a better solution can be, implement your own ImageRecordIter from the official one, and add the average function

phunterlau avatar Jul 27 '16 17:07 phunterlau