In Assignment 1 (using YOLO), we load a pretrained model and then input the input data into the model. However, in Assignment 2 (using U-Net), we train a model and then use the
predict() method on the input data.
Why is the model applied to the data in two different ways?
In the 1st assignment, we make use of results from a pre-trained YOLO model (already built and tuned by others with high accuracy) and implement non-max suppression (IOU) to select the right boxes to achieve object detection, this is an example of transfer learning.
While in the 2nd assignment, we build our own U-Net, then train it to achieve image segmentation.
So, I’m still confused.
From what I can understand (and I’m not sure if this is right), we only use
predict() if we train the model ourselves. And if so, why can’t we use it on a pretrained model? We still imported that model.
Hi there, I think we can use
predict() as long as we have the corresponding model parameters. We train the model parameters with the aim of achieving high accuracy, such that we can use the model to perform good predictions.
For the YOLO assignment, the call of the
tf.keras.models.load_model() function (see more about the function usage here) loads the pre-trained model parameters into our workspace. Then we can use the predictions (output) from the YOLO model to identify and filter bounding boxes.
For the U-Net assignment, we build the model from scratch and then train it ourselves to get parameters that can achieve high enough accuracy, then perform predictions.
Let me know if you have questions!
yolo_model.predict(image__data) is just as valid as what we did in the assignment
unet(image) is just as valid as
There is a difference between
predict() is designed for batch processing of large numbers of inputs, while the
__call__() function can give faster execution for small numbers of inputs, please see details here and in this FAQ entry.
Thank you so much! This is what I was confused about. So, there are subtle differences between the methods functions.