/gender.py Secret
Created
November 25, 2020 06:30
Revisions
-
amankharwal created this gist
Nov 25, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import numpy as np from keras.preprocessing import image # predicting images path = "gender-recognition-200k-images-celeba/Dataset/Test/Female/160001.jpg" img = image.load_img(path, target_size=(64, 64)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) images = np.vstack([x]) classes = model.predict(images, batch_size=1) print(classes[0]) if classes[0]>0.5: print("is a man") else: print( " is a female") plt.imshow(img)