Downloads · 30 days
55
37% of all-time downloads
sreenathsree1578/mobile-phone-usage-detector
mobile-phone-usage-detector is a image classification model from sreenathsree1578. Use it when you need a label for an image.
This is a deep learning model trained to detect mobile phone usage in images. The model uses Transfer Learning with MobileNetV2 as the base architecture and custom classification layers.
Downloads · 30 days
55
37% of all-time downloads
All-time downloads
148
Public
Repo size
35.8 MB
Likes
1
Public
Click a slice to open those files.
.h526.3 MB · 73%
From the Hugging Face model README
This is a deep learning model trained to detect mobile phone usage in images. The model uses Transfer Learning with MobileNetV2 as the base architecture and custom classification layers.
The model was trained on the Mobile Phone Usage Dataset from IITR
| Metric | Value |
|---|---|
| Accuracy | 0.8418 |
| Precision | 0.8509 |
| Recall | 0.8981 |
| Loss | 0.3919 |
import tensorflow as tf
import numpy as np
from PIL import Image
# Load model
model = tf.keras.models.load_model('fine_tuned_phone_detection_model.h5')
def predict_phone_usage(image_path):
# Preprocess image
img = Image.open(image_path).convert("RGB")
img = img.resize((224, 224))
img_array = np.array(img) / 255.0
img_array = np.expand_dims(img_array, axis=0)
# Predict
prediction = model.predict(img_array)[0][0]
class_names = ['no_phone', 'using_phone']
result = class_names[1] if prediction > 0.5 else class_names[0]
confidence = prediction if prediction > 0.5 else 1 - prediction
return result, confidence
The model uses MobileNetV2 as base architecture with custom classification layers:
MIT License