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 script
βββ train.py # Model training execution script
βββ evaluate.py # Model evaluation script
βββ verify.py # Environment/model layers verifier
βββ data/ # Organized dataset (train/val splits)
βββ my_model/ # Custom weights & local inference tools
β βββ my_model.pt # Trained YOLOv8 model weights
β βββ yolo_detect.py # Real-time multi-mode inference script
β βββ README.md # Documentation of model & local inference modes
βββ object_detection_TG-Bot/ # Deployment Telegram bot codebase
βββ bot.py # Main bot execution file (PTB 22.x)
βββ requirements.txt # Bot dependencies
| 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 my_model/yolo_detect.py --model my_model/my_model.pt --source my_model/test.jpgpython my_model/yolo_detect.py --model my_model/my_model.pt --source ./images/python my_model/yolo_detect.py --model my_model/my_model.pt --source my_model/test-vdo.mp4python my_model/yolo_detect.py --model my_model/my_model.pt --source usb0 --resolution 640x480python my_model/yolo_detect.py --model my_model/my_model.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 train.pypython evaluate.pyDeploy the Telegram bot for real-time inference on Telegram:
- Navigate to the bot directory:
cd object_detection_TG-Bot - Create a
.envfile containing your Telegram API token:BOT_TOKEN=your_telegram_bot_token_here
- Run the bot:
python bot.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
- π Portfolio: shivamprasad1001.in
- π LinkedIn: shivamprasad1001
MIT License - See LICENSE for details.
