What's the difference between model(input) and model.predict(input) in tensorflow2?

Viewed 105

I made a Yolov4 project to detect persons in video. I find it can detect object in image. But in video, it can only get the first frame result. The result is nan in other frames. This bug will be fixed if I used model(image_data) instead of model.predict(image_data), I read the source code:

Computation is done in batches. This method is designed for performance in large scale inputs. For small amount of inputs that fit in one batch, directly using __call__ is recommended for faster execution, e.g., model(x), or model(x, training=False) if you have layers such as tf.keras.layers.BatchNormalization that behaves differently during inference. Also, note the fact that test loss is not affected by regularization layers like noise and dropout.

I think the two results should be the same 1.

0 Answers
Related