Apologies in advance, this is a very basic coding question.
I have a model which classifies eye disease.
However, when images are moved into the data bunch, they are “cropped” to 224. This results in a loss of information at the lateral edges of some of the images. It’s bringing the accuracy down.
In which part of this code can I instruct the databunch function to not ‘crop’ the information out, but rather shrink the image down and “pad” the top and bottom letterbox style? Everything I’ve tried has thrown an error.
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2,
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats)
Does this happen with one image or every image? You can turn off crop in the transforms. Check the transforms in the documentation and turn off the ones you don’t need. Example: get_transforms(flip_vertical=False,…). Also load one image, check image.size and use that size for your pictures. However, if your pictures are rectangular they will be cropped in a square shape. Padding is also part of the transforms. Hope this helps.