Project Creation: Part Three
In this lesson, we will perform some fine-tuning of the model and observe the accuracy of our model.
We'll cover the following...
Until now, we have built a model using the pre-trained model as a feature Extractor and connected our own classifier on top of that. This is one of the strategies of transfer learning. Before we move to the fine-tuning, let’s try to do some predictions from the model_new
we built in the previous lesson.
Make predictions
To make predictions, we would require a sample image to be loaded. Here, we have taken a Pikachu image; and let’s see what output we will get.
Press + to interact
from keras.applications.resnet50 import preprocess_inputimage_path = 'pikachu.png'img = image.load_img(image_path,target_size = (224,224))x = image.img_to_array(img)x = np.expand_dims(x,axis=0)x = preprocess_input(x)pred = model_new.predict(x)print(np.argmax(pred))
Explanation:
-
This is the same code we used in the lesson Use a Pre-Trained Model; the only difference is that we cannot use the ...
Access this course and 1400+ top-rated courses and projects.