--- license: mit language: - en metrics: - accuracy - precision - recall library_name: keras tags: - computer-vision - image-classification - tensorflow - keras - emotion-detection --- # Emotion Classifier (Happy vs. Sad) ## Model Description This is a custom **Convolutional Neural Network (CNN)** built using TensorFlow and Keras. The model is designed to perform binary image classification to distinguish between "Happy" and "Sad" facial expressions. - **Model Type:** CNN (Sequential) - **Task:** Binary Image Classification - **Framework:** TensorFlow/Keras ## Training Data The model was trained on a localized dataset of approximately 300 images. - **Preprocessing:** Images were resized to 256x256 pixels and normalized (pixel values scaled between 0 and 1). - **Data Integrity:** A pre-training script was used to validate image headers and remove corrupted files. [Image of a convolutional neural network architecture] ## Performance During evaluation, the model achieved the following results: - **Training Accuracy:** 98.9% - **Validation Accuracy:** 96.9% - **Precision:** 1.0 (on test batch) - **Recall:** 1.0 (on test batch) ## How to Use To load this model in Python: ```python from tensorflow.keras.models import load_model import cv2 import numpy as np model = load_model('imageclassifier.h5') img = cv2.imread('your_image.jpg') resize = tf.image.resize(img, (256, 256)) prediction = model.predict(np.expand_dims(resize/255, 0)) if prediction > 0.5: print('Predicted: Sad') else: print('Predicted: Happy')