Mobile Phone Usage Detection Model
Model Description
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.
- Model type: Image Classification
- Task: Binary Classification (Using Phone vs No Phone)
- Architecture: MobileNetV2 with custom classifier
- Input shape: (224, 224)
- Output: Binary probability
Intended Uses & Limitations
Intended Use Cases
- Surveillance systems
- Driver safety monitoring
- Classroom monitoring
- Workplace productivity analysis
Limitations
- Performance may vary with different lighting conditions
- May have reduced accuracy with low-resolution images
- Trained on specific dataset - may need fine-tuning for other domains
Training Data
The model was trained on the Mobile Phone Usage Dataset from IITR
- Training samples: 711
- Validation samples: 177
- Classes: ['negative', 'positive']
Training Procedure
Preprocessing
- Image resizing to (224, 224)
- Normalization (pixel values scaled to [0,1])
- Data augmentation (rotation, shifting, flipping, zooming)
Training Hyperparameters
- Batch Size: 32
- Learning Rate: 0.001 (initial), 0.0001 (fine-tuning)
- Optimizer: Adam
- Loss Function: Binary Crossentropy
- Epochs: 50 (initial) + 20 (fine-tuning)
Evaluation Results
Metric | Value |
---|---|
Accuracy | 0.8418 |
Precision | 0.8509 |
Recall | 0.8981 |
Loss | 0.3919 |
How to Use
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
Model Architecture
The model uses MobileNetV2 as base architecture with custom classification layers:
- Base Model: MobileNetV2 (pre-trained on ImageNet)
- Global Average Pooling
- Dropout (0.3)
- Dense Layer (128 units, ReLU activation)
- Batch Normalization
- Dropout (0.5)
- Output Layer (1 unit, Sigmoid activation)
License
MIT License
- Downloads last month
- 8