Finetuneing a pretrained ResNet50_v1d in gluoncv


#1

Hi, there!
Environment:
Ubuntu 18.04, MXNet-cu92 1.3.1, Gluon-Cv 0.4 (Master)
I’m trying to finetuneing a gluoncv pretrained ResNet50_v1d classification model. But there is something strange going on.
When I finetuned it with 256x256 image resized from some dataset of size 512x512, everything was fine. However, When I tried to finetune it with 384x384 image, the accuracy just wouldn’t go up, It kept going up and down.
At first, I thought it has something to do with the mxnet imread and mxnet ResizeAug. so I rewrote my own dataset class with cv2 imread and cv2 resize. Now, the accuracy is going up, but at a much lower rate which is no way compared to the rate when using 256x256 image. It usually took about 3 more epochs to
get the accuracy up by 0.1% .(the total training epoch is 50)
BTW, below are different resize function that I have tried:

image = cv2.resize(image, (self.size, self.size), cv2.INTER_AREA)

resize_aug = mx.image.ResizeAug(size=size)
image = resize_aug(image)

I checked they both use Area-based (resampling using pixel area relation) interpretation strategy for resize.
I wonder if it may have something to do with batch_size since I halved the batch_size when using larger image.

Isn’t larger image supposed to give better result?
Thank you!


#2

Hi JWarlock,

Could you post a snippet of your training code and write a bit more about the differences between the 512x512 image dataset vs the 384x384 dataset. The difference in accuracy after x epochs could be due to a number of issues unrelated to imread and/or ResizeAug.

To answer your specific question, it’s not always the case that a larger image always gives better results