harvitronix / five-video-classification-methods

Code that accompanies my blog post outlining five video classification methods in Keras and TensorFlow
https://medium.com/@harvitronix/five-video-classification-methods-implemented-in-keras-and-tensorflow-99cad29cc0b5
MIT License
1.17k stars 479 forks source link

ValueError: Input 0 is incompatible with layer model: expected shape=(None, 224, 224, 3), found shape=(None, 240, 320, 3) #150

Open JosephMartinelli opened 3 years ago

JosephMartinelli commented 3 years ago

Hello! I'm having this error while executing train.py. Although the target shape is correct i can't wrap my head around the expected shape.

I'll leave the stack trace: traceback.txt

JosephMartinelli commented 3 years ago

Maybe I've found a solution but i really don't know if it's the optimal way to do it since I've hard coded it in extractor.py but there is it:

In extractor.py there is a function called:
   def extract(self, image_path):
        img = image.load_img(image_path)
        return self.extract_image(img)

I have modified it in this way:

   def extract(self, image_path):
        img = image.load_img(image_path,target_size=(224,224,3))
        return self.extract_image(img)

So I have forced the reshaping of the image loaded. The train.py seems running fine. I'll share any issues I'll find along the training