<jupyter_start><jupyter_text>Selecting Better Model for making Dog's Breed Predictions<jupyter_code>from keras.applications import vgg16
from keras.applications import resnet50
from keras.applications import inception_v3
vggModel = vgg16.VGG16(weights="imagenet")
resnetModel = resnet50.ResNet50(weights="imagenet")
inceptionModel = inception_v3.InceptionV3(weights="imagenet")
print("VGG16 Model Input Layer ::",vggModel.layers[0].input)
print("ResNet Model Input Layer ::",resnetModel.layers[0].input)
print("Inception Model Input Layer ::",inceptionModel.layers[0].input)
from keras.preprocessing import image
vggImg = image.load_img("Chihuahua.jpg", target_size=(224,224))
resnetImg = image.load_img("Chihuahua.jpg", target_size=(224,224))
inceptionImg = image.load_img("Chihuahua.jpg", target_size=(299,299))
import numpy as np
print("Datatype of Image loaded in VGG16 :",type(vggImg),"\nResNet :", type(resnetImg),"\nInception_v3 :", type(inceptionImg))
vggImg = image.img_to_array(vggImg)
resnetImg = image.img_to_array(resnetImg)
inceptionImg = image.img_to_array(inceptionImg)
print("After Converting into Array :\n")
print("Vgg16 :",type(vggImg),"\nResNet :", type(resnetImg),"\nInception_v3 :", type(inceptionImg))
vggImg = np.expand_dims(vggImg, axis=0)
resnetImg = np.expand_dims(resnetImg, axis=0)
inceptionImg = np.expand_dims(inceptionImg, axis=0)

print(vggImg.shape)
print(resnetImg.shape)
print(inceptionImg.shape)
from keras.applications.vgg16 import decode_predictions
from keras.applications.vgg16 import preprocess_input

VGGFinalImg = preprocess_input(vggImg)
PredVgg = vggModel.predict(VGGFinalImg)
decode_predictions(PredVgg)
from keras.applications.resnet50 import decode_predictions
from keras.applications.resnet50 import preprocess_input

ResNetFinalImg = preprocess_input(resnetImg)
Predresnet = resnetModel.predict(ResNetFinalImg)
decode_predictions(Predresnet)
from keras.applications.inception_v3 import decode_predictions
from keras.applications.inception_v3 import preprocess_input

InceptionFinalImg = preprocess_input(inceptionImg)
PredInception = inceptionModel.predict(InceptionFinalImg)
decode_predictions(PredInception)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10816978548607942, 'fraction_numerical': 0.02601551802829758, 'mean_word_length': 9.640776699029127, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '515208', 'license': 'MIT', 'n_tokens_mistral': 790, 'n_tokens_neox': 760, 'n_words': 132, 'path': "Machine Learning Fundamentals/Classification/Computer Vision/Dog's Breed Prediction Using Transfer Learning/Prediction Comparison  .ipynb", 'repo_name': 'Omgupta0312/Machine-Learning-Minor-Projects', 'size': '2191'}