2.Understanding and Using ANN : Identifying age group of an actor
Design Artificial Neural Networks for Identifying and Classifying an actor using Kaggle Dataset. COLAB from tensorflow.keras.models import load_model from PIL import Image import numpy as np image_height = 128 image_width = 128 num_channels = 3 # Load the trained model model = load_model( '/content/drive/MyDrive/trained_model_NEW_2_2_Dataset.h5' ) # Replace 'your_trained_model.h5' with the actual file name # Read the new face image new_face_path = '/content/drive/MyDrive/2_Predict/a.jpg' # Replace 'path_to_new_face.jpg' with the actual file path new_face = Image. open (new_face_path) #new_face.show() display(new_face) # Preprocess the image new_face = new_face.resize((image_width, image_height)) new_face = np.array(new_face) #new_face = new_face.astype('float32') / 255.0 new_face = np.expand_dims(new_face, axis= 0 ) # Add a batch dimension # Perform prediction predictions = model.predict(new_face) predicted_age_group = np.argmax(pr...