HW C3W4 | Corrupt JPGs | model.predict(images) vs. model(images)

Two curious things I ran into during the HW/labs. Thankfully, the latter didn’t affect the model performance on HW as I got 0.97 for the SSI.

  1. In the labs for this week, sometimes (for example in Lab 2) model.predict(img) is used to get predictions but at other times (in Lab 3) model(img) is used to make predictions. Anyone have any insight on why this is the case? Something with subclassing models? It seems like model(img) is often used within gradient tape.

  2. In the HW, 2hen I ran model.fit() I got some corrupt JPG issues. I am running things in Kaggle. Again, the submission worked, but this was strange. See image below:

One should notify QA team about it and see what they have to say. Let me tag @chris.favila he always comes with some response.


Right, for the first one model(img) is not a TF method, in this context its used to make a prediction or better say obtain a tensor output of the model for loss calculation’s purposes (gradients/derivarives). The model.predict is TF method use specifically for inference and optimized for this purpose.

The corrupt images are because there might be files with different specs than model input, size, type, format, etc…