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(predictions)
print("predictions are ",predictions)
print("Predicted Age Group:", predicted_age_group)
# Map the predicted age group index to the actual label
age_mapping = {0: 'YOUNG', 1: 'MIDDLE', 2: 'OLD'} # Update with your age group labels mapping
predicted_age_group_label = age_mapping[predicted_age_group]
print("Predicted Age Group:", predicted_age_group_label)
MODEL:
https://drive.google.com/file/d/1RKTVY7JLgL35D4dFQ_2YZRFMC7ntSUvG/view?usp=sharing
IMAGES:
https://drive.google.com/drive/folders/1xhQJSzL_OL72YXBgdQD10_JmYpHPngLu?usp=sharing
Design Artificial Neural Networks for Identifying and Classifying an actor using Kaggle Dataset.
Comments
Post a Comment