Inspiration

Modern industries face growing pressure to maintain quality at scale. Manual inspection is slow and inconsistent, often missing subtle product defects. This project was inspired by the idea of creating a real-time, AI-powered quality control system that automates defect detection and tracking on the production line — reducing human error, increasing speed, and improving reporting accuracy.

What it does

Detects bottles in real time using YOLOv8n object detection.

Classifies each detected bottle into 5 categories using a CNN model (capless, good, old, othertype, shape).

Tracks each unique bottle using Deep SORT and assigns a persistent ID.

Logs defects to a MySQL database with timestamp, defect type, and status.

Visualizes real-time defect statistics using graphs and moving average trends: $$ 𝑀 𝐴

𝑡

1 𝑛 ∑

𝑖

0 𝑛 − 1 𝑥 𝑡 − 𝑖 ] MA t ​ = n 1 ​

i=0 ∑ n−1 ​ x t−i ​

] $$ Generates downloadable reports in .csv or .xlsx format for analysis.

How we built it

#Core Technologies Used:

  • YOLOv8n → Real-time object detection
  • MobileNetV2 → Transfer learning for defect classification
  • Deep SORT → Multi-object tracking with unique IDs
  • OpenCV → Real-time video capture and preprocessing
  • MySQL → Database logging of defects
  • Matplotlib & Seaborn → Graphical data visualization Steps:

Collected video of various bottle types and defects.

Extracted frames at 15 FPS and used YOLOv8n to detect bottle regions.

Cropped and aligned bottle images, organized them into 5 class folders.

Trained a CNN model using MobileNetV2 to classify defects.

Integrated YOLO, CNN, and Deep SORT into a real-time detection pipeline.

Logged detections to MySQL and visualized insights using Python.

Challenges we ran into

Ensuring only one bottle is detected and tracked per frame.

Avoiding duplicate database entries using track_id.

Handling rotated or partially visible bottles in the video stream.

Ensuring high classification accuracy across 5 defect types.

Managing real-time processing without frame lag or delay.

Accomplishments that we're proud of

Successfully built an end-to-end AI-based real-time detection system.

Achieved high accuracy using a custom CNN with transfer learning.

Created a live defect dashboard with visual trends and downloadable reports.

Integrated YOLO, Deep SORT, and CNN into one smooth pipeline.

Built a scalable solution ready for manufacturing environments.

What we learned

How to apply deep learning for both object detection and defect classification.

Real-time integration of YOLOv8 + Deep SORT + CNN.

Using time series analytics to improve product monitoring over time.

How to handle frame-by-frame data tracking and avoid redundancy.

Techniques to build visual, user-friendly quality control dashboards.

What's next for Real-Time Defective Product Detection and Tracking System

Add audio alerts or robotic arm integration to remove defective items.

Extend to multi-product pipelines (e.g., cans, jars, boxes).

Use LSTM or Prophet models for advanced time series forecasting.

Build a web dashboard with Flask or React for remote monitoring.

Implement cloud integration (Firebase, AWS) for large-scale deployment.

Share this project:

Updates