This project is a Computer Vision pipeline for:
- Detection: Using YOLO to detect people in a video and crop their faces.
- Classification: A PyTorch model trained on a Kaggle dataset to classify if a person is:
- β With Mask (label = 1)
- β Without Mask (label = 0)
The project saves cropped faces into tmp/files/, then predicts mask usage and saves results into a .csv file.
The dataset is from Kaggle: Face Mask Dataset
Organized as:
dataset/ βββ train/ β βββ with_mask/ β βββ without_mask/ βββ test/ βββ with_mask/ βββ without_mask/
yaml Copy code
Install these libraries before running:
pip install torch torchvision
pip install opencv-python
pip install pandas
pip install matplotlib
pip install ultralytics
pip install pillow
π How to Run
Download the dataset from Kaggle and place it in the dataset/ folder.
Run the Jupyter Notebook step by step:
Detection (YOLO): Detect people in a video β crop β save in tmp/files/.
Classification (PyTorch): Train classifier on dataset β predict on tmp/files/.
Save predictions into predictions.csv.
Check your results in the outputs/ folder.
π Results
Accuracy achieved: XX% (replace with your result after training).
Example detections:
With Mask β
Without Mask β
π¦ Project Structure
bash
Copy code
Computer Vision Project/
β
βββ dataset/ # Kaggle dataset
βββ tmp/files/ # Cropped faces from YOLO
βββ outputs/ # Results (plots, sample predictions, csv)
βββ detection.ipynb # YOLO detection notebook
βββ classification.ipynb # Mask classification notebook
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation