sreenathsree1578 commited on
Commit
aab326d
·
verified ·
1 Parent(s): c50696e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -0
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mask Detection Model
2
+
3
+ ## Model Overview
4
+ **Name:** Mask Detection CNN
5
+ **Author:** Your Name
6
+ **Date:** 2025-09-26
7
+ **Framework:** Keras (TensorFlow backend)
8
+ **Format:** HDF5 (`.h5`)
9
+ **License:** MIT / CC0 (choose as needed)
10
+
11
+ This model is designed to detect whether a person is wearing a mask or not from images of faces. It can be used in real-time applications such as webcam-based mask detection or image classification.
12
+
13
+ ---
14
+
15
+ ## Intended Use
16
+ - **Primary Use:** Classify face images as "Mask" or "No Mask".
17
+ - **Applications:** Public safety, automated mask compliance monitoring, educational demos.
18
+ - **Limitations:**
19
+ - The model works on cropped face images; it may produce inaccurate results if the input contains multiple faces without detection.
20
+ - Lighting, occlusions, or extreme angles may affect accuracy.
21
+ - Model trained on limited dataset; performance may vary on unseen ethnicities or environments.
22
+
23
+ ---
24
+
25
+ ## Model Details
26
+ - **Input:** RGB image of shape `(128, 128, 3)`
27
+ - **Preprocessing:**
28
+ - Resize to `128x128` pixels
29
+ - Normalize pixel values to range `[0, 1]`
30
+ - **Output:**
31
+ - `0`: Mask
32
+ - `1`: No Mask
33
+ - Output is a softmax probability distribution; prediction = `argmax(output)`
34
+ - **Architecture:** Convolutional Neural Network (CNN) with 2-3 Conv2D + MaxPooling layers, Flatten, Dense layers
35
+
36
+ ---
37
+
38
+ ## Training
39
+ - **Dataset:** Custom mask/no-mask face dataset
40
+ - **Loss Function:** Categorical Crossentropy
41
+ - **Optimizer:** Adam
42
+ - **Metrics:** Accuracy
43
+ - **Epochs:** Variable depending on training
44
+ - **Batch Size:** Variable depending on training
45
+
46
+ ---
47
+
48
+ ## Evaluation
49
+ - **Accuracy:** High on training/validation dataset (exact value depends on training)
50
+ - **Test Notes:** Recommended to evaluate on new faces under similar conditions to training images
51
+
52
+ ---
53
+
54
+ ## Usage Example
55
+
56
+ ```python
57
+ import cv2
58
+ import numpy as np
59
+ from keras.models import load_model
60
+
61
+ # Load model
62
+ model = load_model("mask_detection_model.h5")
63
+
64
+ # Load image
65
+ image = cv2.imread("face.jpg")
66
+ image_resized = cv2.resize(image, (128, 128))
67
+ image_scaled = image_resized.astype("float32") / 255.0
68
+ image_input = np.expand_dims(image_scaled, axis=0)
69
+
70
+ # Predict
71
+ prediction = model.predict(image_input)
72
+ pred_label = np.argmax(prediction, axis=1)[0]
73
+
74
+ if pred_label == 0:
75
+ print("Mask 😷✅")
76
+ else:
77
+ print("No Mask ❌")