Face Mask Detection β MobileNetV2
An AI model that classifies whether a person is:
- β Wearing a mask correctly
- β Not wearing a mask
- β οΈ Wearing a mask improperly
Model Details
- Architecture: MobileNetV2 + custom classification head
- Input: 224Γ224 RGB image (face crop)
- Classes:
with_mask,without_mask,mask_worn_incorrectly - Framework: TensorFlow/Keras
Usage
import tensorflow as tf
import numpy as np
from PIL import Image
model = tf.keras.models.load_model("face_mask_model.h5")
img = Image.open("face.jpg").resize((224, 224))
arr = np.expand_dims(np.array(img), 0) / 255.0
pred = model.predict(arr)
print(["with_mask","without_mask","mask_worn_incorrectly"][pred.argmax()])
Live Demo
Try the interactive demo on Spaces.