This project builds a custom YOLOv8 object detection model trained to detect water bottles and classify them into two categories.
| Class | Icon | Description |
|---|---|---|
| plastic_bottle | ๐งด | Transparent or colored plastic water bottles |
| steel_bottle | ๐ฅค | Metal or stainless steel water bottles |
The model draws bounding boxes with confidence scores around detected bottles in any image or video feed.
โ Model detected plastic_bottle and steel_bottle with 0.89 confidence
| Tool | Purpose |
|---|---|
| Python 3.8+ | Programming language |
| YOLOv8 (Ultralytics) | Object detection model |
| Google Colab | Cloud GPU training |
| Roboflow | Dataset preparation and annotation |
| OpenCV | Image processing |
| PyTorch | Deep learning framework |
| Matplotlib | Visualization and charts |
| Detail | Info |
|---|---|
| Source | Roboflow Universe |
| Total Images | 315 |
| Training Set | 250 images |
| Validation Set | 26 images |
| Test Set | 39 images |
| Annotation Format | YOLOv8 Bounding Boxes |
| Input Size | 512ร512 |
| Classes | plastic_bottle, steel_bottle |
Dataset link:
dataset/dataset_link.txt
Training was performed on Google Colab using a Tesla T4 GPU.
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.train(
data="data.yaml",
epochs=50,
imgsz=640
)
| Parameter | Value |
|---|---|
| Model | YOLOv8 Nano |
| Epochs | 53 |
| Image Size | 640ร640 |
| GPU | Tesla T4 |
| Framework | Ultralytics |
| Metric | Score |
|---|---|
| mAP@50 | 0.806 |
| mAP@50-95 | 0.618 |
| Precision | 0.913 |
| Recall | 0.804 |
| Inference | 43.8 ms |
git clone https://github.com/JonnadaRaju/Real-Time-Bottle-Detection.git
cd Real-Time-Bottle-Detection
pip install ultralytics opencv-python matplotlib
from ultralytics import YOLO
model = YOLO("models/best.pt")
results = model.predict(
source="images/demo/input_plastic.jpg",
save=True,
conf=0.5
)
print(f"Detected: {len(results[0].boxes)} bottles")
from ultralytics import YOLO
model = YOLO("models/best.pt")
model.predict(
source=0,
show=True,
conf=0.5
)
from ultralytics import YOLO
model = YOLO("models/best.pt")
model.predict(
source="your_video.mp4",
save=True,
conf=0.5
)
Computer Vision
Object Detection
YOLOv8
Deep Learning
Dataset Annotation
Model Training
Model Inference
Python
Google Colab
Roboflow
PyTorch
OpenCV
Transfer Learning