Ghoutibk commited on
Commit
4d89257
·
verified ·
1 Parent(s): 93b20a6

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ metrics:
6
+ - accuracy
7
+ - precision
8
+ - recall
9
+ library_name: keras
10
+ tags:
11
+ - computer-vision
12
+ - image-classification
13
+ - tensorflow
14
+ - keras
15
+ - emotion-detection
16
+ ---
17
+ # Emotion Classifier (Happy vs. Sad)
18
+
19
+ ## Model Description
20
+ 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.
21
+
22
+ - **Model Type:** CNN (Sequential)
23
+ - **Task:** Binary Image Classification
24
+ - **Framework:** TensorFlow/Keras
25
+
26
+ ## Training Data
27
+ The model was trained on a localized dataset of approximately 300 images.
28
+ - **Preprocessing:** Images were resized to 256x256 pixels and normalized (pixel values scaled between 0 and 1).
29
+ - **Data Integrity:** A pre-training script was used to validate image headers and remove corrupted files.
30
+
31
+
32
+
33
+ [Image of a convolutional neural network architecture]
34
+
35
+
36
+ ## Performance
37
+ During evaluation, the model achieved the following results:
38
+ - **Training Accuracy:** 98.9%
39
+ - **Validation Accuracy:** 96.9%
40
+ - **Precision:** 1.0 (on test batch)
41
+ - **Recall:** 1.0 (on test batch)
42
+
43
+
44
+
45
+ ## How to Use
46
+ To load this model in Python:
47
+
48
+ ```python
49
+ from tensorflow.keras.models import load_model
50
+ import cv2
51
+ import numpy as np
52
+
53
+ model = load_model('imageclassifier.h5')
54
+ img = cv2.imread('your_image.jpg')
55
+ resize = tf.image.resize(img, (256, 256))
56
+ prediction = model.predict(np.expand_dims(resize/255, 0))
57
+
58
+ if prediction > 0.5:
59
+ print('Predicted: Sad')
60
+ else:
61
+ print('Predicted: Happy')