Case studies / Edge model compression for a vision system
Edge model compression for a vision system
Shrinking a YOLOv5 detector by 98.6% with no decrease in detection accuracy, and what a failed pruning experiment taught me.
- Role
- AI Engineer, R&D apprentice
- Company
- Sopra Steria
- Period
- Sep 2023 – Sep 2024
- Hardware
- CPU and RTX 4090 GPU
Context
An automated-testing system relied on a large YOLOv5 object-detection model. The goal: make it far smaller and faster, and pick the right deployment format for each target machine, without losing accuracy.
Results
| Technique | Outcome | Verdict |
|---|---|---|
| Knowledge distillation | 281.9 MB to 4 MB (98.6% smaller). Training more than 3x faster. No decrease in detection accuracy. | Adopted |
| OpenVINO INT8 | CPU latency 700 ms to 319.5 ms (54% faster). About 50% smaller. Under 5 points of accuracy lost. | CPU option |
| TensorRT FP16 | 2.6 ms GPU inference, no measurable accuracy loss. | GPU option |
| Structured pruning | 30% of weights removed: accuracy dropped from 0.986 to 0.646 (mAP50-95). | Rejected |
How I worked
- Benchmark before choosing. Four export formats (ONNX, TensorRT, OpenVINO, TFLite) measured against the target hardware.
- Knowing when to stop. Pruning failed on accuracy. I confirmed the result with other teams and moved to distillation, which delivered the 98.6%.
- Removing the data bottleneck. A synthetic training-data generator replaced manual annotation of about 10 minutes per image.
- Responsible AI. Environmental impact of experiments tracked with CodeCarbon.