I encountered the same issue when I was building an image classification model: I retrained the model (written in Tensorflow) using lots of images as input.
After some investigation, I found the error are caused by the image editing(crop and rotate). As the EXIF info still keep the original dimension, it doesn't match the latest dimension after editing. Fix is very easy, we can use mogrify
of imagick
to delete the outdated EXIF info.
mogrify
or
mogrify -strip