You have to use standard image size as resnet50. It cannot handle different image sizes and the 8192 is the size of flattened featuremap. If you use the standard image size, the flattened tensor will have 2048 and this error will disappear. I think the standard size is 224x224. You need to resize your images before feeding them into resent. check this 7.