End-to-End Deep Learning for Real-World Applications
A complete object detection solution using Ultralytics YOLOv8 with custom dataset support, training, and evaluation.
This pipeline provides a complete workflow for custom object detection:
- Dataset Collection: Smartphone-captured images
- Annotation: Label Studio for precise bounding boxes
- Preparation: Auto-conversion to YOLO format
- Training: Configurable YOLOv8 model training
- Evaluation: Comprehensive metrics (mAP, PR curves)
- Deployment: Ready-to-use model output
- πΈ Custom Dataset Support - Use your own images
- π·οΈ Label Studio Integration - Streamlined annotation
- βοΈ Configurable Training - Edit
config.yamlfor different models - π Visual Evaluation - PR curves, confusion matrices
- π Reproducible - Version controlled with requirements
graph TD
A[Data Collection] --> B[Label Studio Annotation]
B --> C[prepare_yolo_dataset.py]
C --> D[YOLO-formatted Dataset]
D --> E[train.py]
E --> F[Model Training]
F --> G[evaluate.py]
G --> H[Performance Metrics]
project-root/
βββ config.yaml # Training configuration
βββ prepare_yolo_dataset.py # Dataset preparation
βββ training/
β βββ train.py # Training script
β βββ my_model.pt # Output model
βββ evaluate.py # Evaluation script
βββ data/ # Organized dataset
β βββ train/images/ # Training images
β βββ train/labels/ # Training labels
β βββ val/images/ # Validation images
β βββ val/labels/ # Validation labels
β βββ data.yaml # Dataset config
βββ runs/ # Training outputs
| Component | Technology |
|---|---|
| Framework | YOLOv8 (PyTorch) |
| Annotation | Label Studio |
| Data Processing | OpenCV, Pandas |
| Configuration | YAML |
| Version Control | Git |
conda activate yolo-env1pip install ultralytics opencv-python numpyThe script takes the following arguments:
| Argument | Required | Description |
|---|---|---|
--model |
β Yes | Path to YOLO model file (.pt), e.g., runs/detect/train/weights/best.pt |
--source |
β Yes | Input source: image file (test.jpg), folder (./images/), video file (video.mp4), or USB webcam (usb0) |
--thresh |
β No | Minimum confidence threshold for detections (default: 0.5) |
--resolution |
β No | Output resolution in WxH format (e.g., 640x480). Default is source resolution. |
--record |
β No | Record results (only works with video or webcam). Saves to demo1.avi. Requires --resolution. |
python yolo_detect.py --model runs/detect/train/weights/best.pt --source test.jpgpython yolo_detect.py --model runs/detect/train/weights/best.pt --source ./images/python yolo_detect.py --model runs/detect/train/weights/best.pt --source video.mp4python yolo_detect.py --model runs/detect/train/weights/best.pt --source usb0 --resolution 640x480python yolo_detect.py --model runs/detect/train/weights/best.pt --source usb0 --resolution 640x480 --record- Press
qβ Quit - Press
sβ Pause inference - Press
pβ Save current frame ascapture.png
- Python 3.8+
- Ultralytics YOLOv8 (
pip install ultralytics) - Label Studio (for annotation)
git clone https://github.com/shivamprasad1001/yolo-project.git
cd yolo-project
pip install -r requirements.txt- Annotate images in Label Studio (YOLO format)
- Export as
data.zip - Run:
python prepare_yolo_dataset.pyEdit config.yaml then:
python training/train.pypython evaluate.py# Model configuration
model: yolov8n.pt # yolov8n/s/m/l/x
data: data/data.yaml # Dataset config
epochs: 50 # Training epochs
imgsz: 640 # Image size
batch: 16 # Batch size
project: runs/train # Output directory
name: custom # Run name- All training data remains local
- Model weights can be encrypted for deployment
- Git ignores sensitive training outputs
- TensorRT optimization for deployment
- Web-based annotation interface
- Automated hyperparameter tuning
- Docker support for easy setup
Shivam Prasad
GitHub |
LinkedIn
MIT License - See LICENSE for details.
