Chaos, Code, and a Comeback: Building a YOLOv8 Retail System

Khushi RawatKhushi Rawat
4 min read

project link- Khushhiii08/Smart-Retail-Product-Detection-and-Analysis-Using-YOLOv8

This is one of the most personal and intense projects I’ve worked on — a rollercoaster of anxiety, fried laptops, and that one glorious day everything finally worked.

Project Overview

Our goal was ambitious: build a real-time retail analytics system using YOLOv8 to detect customer interactions with products in a DMart-like store. We wanted to track what customers pick up, put back, or ignore — helping stores like DMart optimise layout, improve service, and even detect suspicious behaviour.

We aimed to:

  • Detect groceries, baskets, trolleys, and hand movements

  • Process live CCTV feeds with OpenCV and YOLOv8

  • Build a web interface for retail use cases

It sounded cool. We were excited.
And then... reality hit.

The Team Setup

We were a three-member team from our college club:

  • Me (2nd year) – Dataset creator, CCTV connection logic handler, backend support

  • Teammate 2 (2nd year) – Supposed to handle core model logic

  • Teammate 3 (1st year) – Assigned to the frontend since she was still learning the ropes

The Struggles (Oh, Where Do I Begin?)

Dataset Disaster

At first, we were clueless. No structure, no plan, just confusion.

Eventually, I took the lead and created a timeline (spoiler: it wasn’t followed well).
We all started with data collection:

  • I scraped multiple websites — not very fruitful.

  • I then manually collected and categorised images — groceries like packaged food, scrubs, masalas, etc.

  • Teammate 3 tried gathering CCTV footage online — only found 5 videos.

We decided to ditch video and go with our clean, curated image dataset. It wasn’t massive, but it was meaningful.

Anxiety & Backup Plans

During our internal project showcase, Teammate 2 couldn’t even screen share her code. We were left stunned. Our club team lead wasn’t happy, but he extended our deadline.

My anxiety was through the roof.

So, quietly, I started building a complete backup version of the project — solo. I didn’t know if it would work, but I knew I couldn’t let it end this way.

Failed Model Training

We attempted YOLOv8 training multiple times. The result?

  • Laptops heated up like ovens

  • Training failed over and over

  • mAP scores stayed under 1%

Teammate 2 switched to Roboflow.
I... kept going with YOLOv8 locally. I wasn’t ready to give up.

The Breakthrough

One night, something clicked.

YOLOv8 training accepts a lot of hyperparameters. What if I tuned every single one?

Bingo-bango.
We went from detecting 0 test images to 4 out of 5. That moment? Unforgettable.

What I Tuned:

  • Optimizer: SGD → AdamW

  • Learning rate + warmup

  • Loss gains

  • Batch size

  • Early stopping

  • Cosine learning rate decay

Data Augmentation:

  • Mosaic

  • Mixup

  • Rotation

  • Hue/saturation/brightness shifts

The Results:

  • mAP@50: Jumped to 60.8%

  • Accurate detection across scrubber, dal, trolley

  • Inference time: ~30ms/frame → Real-time ready!

From Model to Website

I asked a friend to help with Flask backend integration.
Teammate 3 (the first-year) put together a simple, usable frontend.

Final Deliverable:

  • YOLOv8 real-time detection

  • SQLite backend logging

  • Fully working web interface

We made a demo video, compiled a project report, and showed both versions (my YOLOv8 model + Roboflow version) to the club faculty.

Her feedback? "Impressive work."*
Our feelings? Relief. Pride. Satisfaction.*

Lessons I’ll Never Forget

Technical:

  • Mastering YOLOv8 training & hyperparameters

  • Troubleshooting Flask + OpenCV

  • Using class weights for better balance

  • Data augmentation for generalisation

Personal:

  • You don’t need to be an expert — just persistent

  • Group work can suck — back yourself

  • Don’t panic — backup builds are power moves

  • Failing 20 times? That 21st try may just work

Final Thoughts

This wasn’t just a project. It was a warzone of:

  • Expectation vs. Execution

  • Teamwork vs. Solo Hustle

  • Imposter Syndrome vs. Real Confidence

But in the end...

I didn’t just build a system.
I became one.

0
Subscribe to my newsletter

Read articles from Khushi Rawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Khushi Rawat
Khushi Rawat