How does image size affect accuracy?
Created on February 14|Last edited on February 14
Comment
Introduction
In these experiments, we investigate the effect of using different image sizes on the final accuracies of the models.
Setup
These are common in all the experiments:
- arch: resnet18
- bs: 64
- dataset: SnakeCLEF2021_min-train_metadata_PROD.csv
- get_y (what we are predicting): genus
- epochs: 10
- classes: 10
- LR: 1e-3
I then varied the image size as follows. Note, for the psize experiments, I used RandomResizedCrop. The images were initially resized to 460x460px and then randomly resized and cropped to the specific image size:
- size64 - Image size 64x64
- size128 - Image size 128x128
- size224 - Image size 224x224
- psize64 - Initially resized to 460x460 and then randomly resized cropped to 64x64
- psize128 - Initially resized to 460x460 and then randomly resized cropped to 128x128
- psize224 - Initially resized to 460x460 and then randomly resized cropped to 224x224
Findings
Here are the resulting losses from the experiment:
Run set
41
Here are the resulting accuracies and error rates from the experiments:
Run set
41
Discussion
- The accuracy improved as I increased the image size. This is most likely because the model had more pixels to work with. We can see that the higher the image size the better.
- After introducing the RandomResizedCrop augmentation, increasing the image size did not change a lot, although all of them were significantly better than using resize alone. This could be because of how RandomResizedCrop works where in each case, I was training on 75% of the image. I might have to combine other augmentations to get better results.
Conclusion
From here on, I will be using the initial Resize and then combine with RandomResizedCrop which gave the best results overall.
Add a comment