Real-Time-Bottle-Detection

๐Ÿถ Real-Time-Bottle-Detection using YOLOv8


A custom YOLOv8 object detection model trained to detect and classify water bottles in real-time
Demo โ€ข Dataset โ€ข Training โ€ข Results โ€ข Quick Start

๐Ÿ“Œ Overview

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.


๐Ÿ“ธ Demo

After Detection

โœ… Model detected plastic_bottle and steel_bottle with 0.89 confidence


๐Ÿ› ๏ธ Tech Stack

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

๐Ÿ“Š Dataset

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

Training was performed on Google Colab using a Tesla T4 GPU.

Training Configuration

from ultralytics import YOLO

model = YOLO("yolov8n.pt")

model.train(
    data="data.yaml",
    epochs=50,
    imgsz=640
)

Training Parameters

Parameter Value
Model YOLOv8 Nano
Epochs 53
Image Size 640ร—640
GPU Tesla T4
Framework Ultralytics

๐Ÿ“ˆ Results

Performance Metrics

Metric Score
mAP@50 0.806
mAP@50-95 0.618
Precision 0.913
Recall 0.804
Inference 43.8 ms

๐Ÿ“Š Training Charts


๐Ÿš€ Quick Start

1. Clone Repository

git clone https://github.com/JonnadaRaju/Real-Time-Bottle-Detection.git
cd Real-Time-Bottle-Detection

2. Install Dependencies

pip install ultralytics opencv-python matplotlib

3. Run Detection on Image

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")

4. Run Webcam Detection

from ultralytics import YOLO

model = YOLO("models/best.pt")

model.predict(
    source=0,
    show=True,
    conf=0.5
)

5. Run Video Detection

from ultralytics import YOLO

model = YOLO("models/best.pt")

model.predict(
    source="your_video.mp4",
    save=True,
    conf=0.5
)

๐Ÿง  Skills Demonstrated

Computer Vision
Object Detection
YOLOv8
Deep Learning
Dataset Annotation
Model Training
Model Inference
Python
Google Colab
Roboflow
PyTorch
OpenCV
Transfer Learning


Made with โค๏ธ using YOLOv8 + Google Colab โญ Star this repo if you found it helpful!