from keras.applications import VGG19 from keras.applications import imagenet_utils from keras.preprocessing.image import img_to_array from keras.preprocessing.image import load_img import numpy as np input_shape = (224,224) preprocess = imagenet_utils.preprocess_input image = load_img("E:\RNotes\DL\man.png", target_size = input_shape) image = img_to_array(image) image = np.expand_dims(image,axis=0) image = preprocess(image) #model = VGG19(weights="imagenet") model = VGG19(weights="imagenet") preds = model.predict(image) p = imagenet_utils.decode_predictions(preds) print(p) #VGG19 #Women #[[('n03770439', 'miniskirt', 0.47218892), ('n03594734', 'jean', 0.20757468), ('n02963159', 'cardigan', 0.022973826), ('n03450230', 'gown', 0.021934472), ('n03000247', 'chain_mail', 0.02097792)]] #man #[[('n03594734', 'jean', 0.31298622), ('n03630383', 'lab_coat', 0.26774961), ('n04456115', 'torch', 0.083450332), ('n04296562', 'stage', 0.04125011), ('n04370456', 'sweatshirt', 0.021016017)]]