The train accuracy is high, but accuracy on test images are low

hi
using those simple 7 lines code based on vgg16.py, the accuracy on train and valid data are high as about 0.97. That’s expected.

And I saved the above test weights as a file and loaded it later and called its test() API on test images, but found the accuracy was low. I printed 10 file names and their prediction using bathes.filenames and preds and compared them with actual images by my eye check, the accuracy rate is ONLY 0.6.

 Did anyone meet this similar issue?  any idea about it?

thanks

Often this happens because the images do not get processed in the same way. Make sure the test images are in the same format as the training and validation images (mean RGB subtracted, RGB flipped to BGR, scaled, etc).

hi Matthijs,

  yes, they're all jpeg formats with r/g/b channels.  actually these train/validate/test images are all from fast.ai. 

  I'm thinking overfitting issue, since dropout code seems not found in the original code, shown in lesson1.  just guess. 

thanks