MIRA — Day 7: The “Stage B” Breakthrough (Multi-Object Detection)
The Engineering Change: Scrapping the Foundation
Stage A (Classification) was a controlled laboratory success, but it failed the “Real World Test”, and wasnt able to accuractly depict objects with a live cam feed, I also hit a major roadblock: my auto-labeling script used Canny Edge detection which, due to table glare and shadows, mistook my entire desk for a single object. This taught me the most important lesson in AI: Garbage In, Garbage Out (GIGO).
To save MIRA, I had to delete my original dataset and move to a professional Object Detection architecture (YOLOv8-Nano).
Data Engineering: Mapping 64 Classes to 5
I forked a high-variance “Wild Trash” dataset containing thousands of images of waste in complex environments (grass, dirt, water).
- The Problem: The dataset had 64 highly specific classes (e.g., “Aerosol,” “Egg carton,” “Plastic lid”).
-
The Solution: I wrote a custom Class Remapping Engine in Python. This script programmatically rewrote thousands of
.txtlabel files, collapsing 64 sub-categories into MIRA’s 5 core functional classes:Glass,Metal,Paper,Plastic, andTrash. - Result: A robust, “Super-Dataset” of ~3,300 images ready for spatial training.
Cloud-Accelerated Training
Training an object detector on a local CPU would have taken days. I migrated the pipeline to Google Colab, utilizing an NVIDIA Tesla T4 GPU.
-
Strategy: I implemented a
patience=0strategy and tuned the learning rate to1e-3to force the model to converge over 100 epochs despite the high variance of the “Wild” data. - Outcome: Achieved an mAP50 of 82.3% on the combined dataset. The “Nano” architecture was chosen specifically to ensure the final weights (approx 6MB) can run standalone on a Raspberry Pi.
The Live Multi-Object Tracking Engine
The most exciting part is the new live_detection.py. MIRA no longer just “names” an image; it locates and tracks items in 3D space.
-
ByteTrack Integration: I enabled the ByteTrack algorithm (
persist=True). Now, the AI assigns a unique ID to every object. If a bottle is briefly covered by a hand, the Kalman Filter “remembers” its position, preventing the future servos for the robot from jittering. -
Performance:
- Latency: ~40ms (Inference)
- Throughput: ~15.6 FPS
- Simultaneous Detection: Successfully tested with 3+ materials in the frame at once.
Diagnostic: Identifying Edge Cases
Testing today revealed a specific weakness: Metal cans in vertical orientation (opening facing the camera). Because the feature profile changes from a cylinder to a dark circle, detection confidence drops.
- Fix Strategy: I will supplement the dataset with ~50 manual “end-on” photos of cans to patch this “Canonical View Bias” before the hardware build.
What’s Next
Creating a dashboard to see everything regarding the AI and trying to quantize it further
this was highly aided by AI this time as I just couldnt fix and needed AI help to fix it. Just wanted to check how big my folder is and its 17.3 GB i really need to clean it up I still have alot failed experiements and private data inside
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.