A fine-tuned YOLO26s (Ultralytics) object detection model trained to detect cigarettes in images and video streams. Designed for real-world deployment with crash-resilient training and automatic checkpoint uploads to Hugging Face.
| Metric | Score |
|---|---|
| mAP@50 | 0.8796 |
| mAP@50-95 | 0.5198 |
| Precision | 0.9261 |
| Recall | 0.8814 |
| F1 Score | 0.9032 |
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| No Cigarette | 0.8108 | 0.9677 | 0.8824 | 31 |
| Cigarette | 0.9963 | 0.9746 | 0.9853 | 276 |
| Accuracy | 0.9739 | 307 | ||
| Macro Avg | 0.9036 | 0.9712 | 0.9339 | 307 |
| Weighted Avg | 0.9776 | 0.9739 | 0.9749 | 307 |
| Predicted: No Cigarette | Predicted: Cigarette | |
|---|---|---|
| True: No Cigarette | 30 (96.77%) | 1 (3.23%) |
| True: Cigarette | 7 (2.54%) | 269 (97.46%) |
pro-hiyaw / cigarettes-reality-2-trnm2 (Version 1)yolo26 export from Roboflow)yolo26s.ptyolo26s)| Parameter | Value |
|---|---|
| Epochs | 200 |
| Image size | 800 |
| Batch size | 16 |
| Device | GPU 0 |
| Patience (early stopping) | 30 |
| Augmentation | Value |
|---|---|
HSV Saturation (hsv_s) |
0.2 |
HSV Value / Exposure (hsv_v) |
0.2 |
Rotation (degrees) |
±10° |
Horizontal Flip (fliplr) |
0.5 |
The training pipeline includes automatic crash recovery:
training_status.json file is written with the current epoch, path to last.pt, and path to best.pt."status": "training", training automatically resumes from the last saved weights.weights/epoch_{N}_last.pt — rolling checkpointweights/best.pt — best model so far (overwritten each time)training_status.json — current training stateModel checkpoints are uploaded to Hugging Face automatically during training.
basant18/Smoking-detection-YOLO26sAuthentication uses a Hugging Face token stored as a Kaggle secret (HF_TOKEN).
pip install ultralytics roboflow huggingface_hub opencv-python
from ultralytics import YOLO
model = YOLO("weights/best.pt")
results = model.predict(source="your_image.jpg", imgsz=800, conf=0.5)
results[0].show()
Simply re-run the training script. If training_status.json exists and points to valid weights, training will resume automatically from the last checkpoint.
.
├── training_status.json # Auto-generated crash recovery state
├── runs/
│ └── detect/
│ └── train/
│ └── weights/
│ ├── best.pt # Best checkpoint
│ └── last.pt # Latest checkpoint
└── <dataset>/
└── data.yaml # Dataset config (auto-downloaded from Roboflow)
| Secret Name | Description |
|---|---|
HF_TOKEN |
Hugging Face API token |
RF |
Roboflow API key |
This project is for research and educational purposes. Dataset sourced from Roboflow Universe under its respective license.
weights/epoch_110_last.pt 60 MBweights/epoch_100_last.pt 60 MBweights/epoch_90_last.pt 60 MBweights/best.pt 60 MBweights/epoch_80_last.pt 60 MBweights/epoch_70_last.pt 60 MBweights/epoch_60_last.pt 60 MBweights/epoch_50_last.pt 60 MBweights/epoch_40_last.pt 60 MBweights/epoch_30_last.pt 60 MBweights/epoch_20_last.pt 60 MBweights/epoch_10_last.pt 60 MB