So I'm trying to train a model using the CIFAR10 dataset.
The problem is that while the performance of the model on validation and test sets are good (about 95-96%), the model fails to predict images downloaded from the internet (preprocessed like with the inputs). I know that there are a lot of similar questions already, as a matter of fact, I’ve already tried implementing those suggestions but none works for me so far. I don’t know what I did wrong.
Here's my approach:
- Data: test – 80%, validation – 10% (input of val_dataset in model.fit), test – 10% (input of model.evaluate)
- Model (transfer learning): I use ResNet50 as the base model, use “imagenet” weights and freeze them.
UpSampling2D((7,7)) to resize images from 32x32x3 to 224x224x3 --> ResNet50 --> Flatten --> Dense (relu) --> Dropout --> Dense(10, softmax).
Is it because the resolutions of images from this dataset is too low, while the resolutions of images downloaded from the internet are much higher? I don’t know how to describe this, but even after resizing the downloaded images to 32x32x3 to feed in model.predict, they still look kinda different from the images in the dataset?
Downloaded image (resized to 32x32x3):
Is that the issue? If not, can you tell me what I did wrong, or what I could do so that my model can perform well on real life images?
Many thanks.