Enterprise-Grade Dense Object Detection System leveraging YOLOv5 with Advanced Model Quantization
StockSight AI is a cutting-edge, production-ready object detection framework optimized for dense retail environments. Built on YOLOv5 architecture and trained on the comprehensive SKU-110K dataset, this system delivers exceptional performance while maintaining edge-device compatibility through sophisticated post-training quantization techniques.
StockSight AI represents a breakthrough in retail computer vision, achieving 92.2% mAP@50 with models ranging from 83MB (INT8) to 329MB (TensorFlow), making it suitable for deployment across diverse hardware environments from cloud infrastructure to resource-constrained edge devices.
- 🚀 92.2% mAP@50 on SKU-110K dataset with minimal quantization loss
- ⚡ 30+ FPS real-time inference capability
- 📦 50% model size reduction via INT8 quantization (164MB → 83MB)
- 🎯 89.79% F1-Score demonstrating excellent precision-recall balance
- 🔧 Multi-format support: PyTorch, TensorFlow, TFLite (FP32/FP16/INT8)
- Architecture & Technical Foundation
- Dataset Intelligence
- Training Methodology
- Advanced Quantization Pipeline
- Performance Benchmarks
- Quick Start Guide
StockSight AI is built upon the YOLOv5 architecture, recognized globally as one of the most efficient and versatile object detection frameworks. Our implementation leverages YOLOv5x—the most powerful variant—to ensure maximum accuracy in challenging dense-object scenarios.
| Feature | Specification | Impact |
|---|---|---|
| Inference Speed | 30+ FPS on GPU | Real-time processing capability |
| Model Variants | 5 sizes (n/s/m/l/x) | Flexible deployment options |
| Model Size Range | 3.2MB - 253MB | Edge to cloud scalability |
| Framework Support | PyTorch, TensorFlow, ONNX | Platform agnostic |
| Quantization Ready | INT8/FP16 compatible | Minimal accuracy degradation |
| Active Development | Continuous updates | Production stability |
The SKU-110K dataset, developed by leading AI researchers, represents one of the most comprehensive retail product detection challenges available. Our training leverages this dataset's unique characteristics for superior dense-object detection.
Total Images: 110,000
Total Objects: 1,000,000+
Avg Objects/Image: ~147 (extreme density)
Domain: Retail shelf environments
Annotation Type: High-precision bounding boxes
Challenge: Extreme occlusion and density
- Ultra-High Density: Average of 147 objects per image—perfect for training robust dense detection models
- Real-World Complexity: Captures authentic retail scenarios with varying lighting, shelf arrangements, and product orientations
- Professional Annotations: Pixel-perfect bounding boxes ensuring training accuracy
- Scale Diversity: Objects ranging from partially visible to fully occluded products
- Industry Relevance: Direct applicability to retail, warehouse, and inventory management scenarios
Our training approach emphasizes stability, reproducibility, and optimal convergence for dense-object scenarios.
GPUs: 2× NVIDIA RTX 3060 Ti (8GB VRAM each)
Training Time: ~3 hours (50 epochs, early stopping at 30)
Memory Strategy: Gradient accumulation for effective large-batch training
| Parameter | Value | Rationale |
|---|---|---|
| Model | YOLOv5x | Maximum capacity for complex dense scenes |
| Image Size | 640×640 | Balance between detail and computational efficiency |
| Batch Size | 2 per GPU | Memory-optimal for high-resolution training |
| Epochs | 50 (converged at 30) | Early stopping based on validation plateau |
| Optimizer | SGD with momentum | Stable convergence for detection tasks |
| Training Mode | From scratch | Domain-specific learning without transfer bias |
Training Set: 8,185 images (73.8%)
Validation Set: 584 images ( 5.3%)
Test Set: 2,920 images (26.3%)
Total: 11,089 imagesKey Observations:
- Rapid Initial Convergence: mAP@50 reached 0.55+ within first 10 epochs
- Plateau Detection: Metrics stabilized around epoch 30, indicating optimal stopping point
- Validation Stability: Minimal overfitting observed, demonstrating excellent generalization
- Box Loss Convergence: Smooth descent indicating effective anchor box learning
- Class Confidence: High class confidence scores throughout training (single-class simplicity)
Confusion Matrix Insights:
- True Positive Rate: 86.8% detection rate across all density levels
- False Negatives: Primarily in extreme occlusion scenarios (<5% of total)
- False Positives: Minimal spurious detections (precision: 93.0%)
- Background Handling: Excellent discrimination between objects and shelf backgrounds
Quantization is a critical optimization technique that reduces model size and computational requirements while preserving accuracy. StockSight AI implements sophisticated post-training quantization to enable edge deployment.
Precision Reduction: Converting 32-bit floating-point weights to lower-precision formats (16-bit float or 8-bit integer)
FP32 → FP16: 50% size reduction, ~0% accuracy loss
FP32 → INT8: 75% size reduction, <1% accuracy loss
- 50-75% smaller model footprint enables deployment on mobile and edge devices
- Reduced RAM requirements allow parallel model execution
- Lower storage costs for model distribution and caching
- 2-4× faster inference on mobile and edge hardware
- Reduced latency for real-time applications (<50ms per frame)
- Lower power consumption extending battery life on mobile devices
- Compatibility with mobile GPUs, NPUs, and specialized accelerators
- Optimized execution on ARM, x86, and embedded processors
- Support for TensorFlow Lite, ONNX Runtime, and mobile frameworks
- Decreased cloud compute costs for inference workloads
- Reduced bandwidth for model updates and deployments
- Lower total cost of ownership for edge infrastructure
StockSight AI underwent rigorous testing across multiple model formats and quantization levels to validate production readiness. All models were evaluated on the 2,920-image test set with identical inference parameters.
| Rank | Model Format | Size | Precision | Recall | mAP@50 | F1-Score | Size Reduction | Accuracy Loss |
|---|---|---|---|---|---|---|---|---|
| 🥇 | PyTorch FP16 | 164 MB | 93.0% | 86.8% | 92.2% | 89.79% | — | Baseline |
| 🥈 | TensorFlow FP32 | 329 MB | 92.5% | 86.8% | 91.9% | 89.55% | 0% | -0.3% |
| 🥉 | TFLite FP32 | 328 MB | 92.5% | 86.8% | 91.9% | 89.55% | 0% | -0.3% |
| 4 | TFLite FP16 | 164 MB | 92.5% | 86.8% | 91.9% | 89.55% | 50% | -0.3% |
| 5 | TFLite INT8 | 83 MB | 91.7% | 86.5% | 91.5% | 89.02% | 75% | -0.7% |
Inference Latency (640×640 input):
├─ PyTorch FP16 (GPU): 23ms (~43 FPS)
├─ TFLite FP16 (Mobile): 78ms (~13 FPS)
└─ TFLite INT8 (Mobile): 45ms (~22 FPS)
Throughput (batch processing):
├─ Cloud (GPU): 120 images/sec
└─ Edge Device: 15 images/sec
📝 Note: Detailed evaluation reports, precision-recall curves, and per-class metrics for each model variant are available in the
/testdirectory.
Visual inspection reveals that all model variants maintain exceptional detection quality across varying quantization levels. The examples below demonstrate performance on challenging dense-shelf scenarios.
Analysis: Both models demonstrate near-identical detection patterns with precise bounding boxes even in extreme-density regions. No observable difference in detection quality validates our quantization approach.
Analysis: Remarkably, the INT8 model maintains exceptional detection quality despite 75% size reduction. In some scenes, INT8 actually demonstrates marginally better localization due to quantization-induced regularization effects.
Counterintuitive Discovery: In multiple inference scenarios, the INT8 quantized model achieved superior visual detection quality compared to higher-precision variants.
Hypothesis:
- Regularization Effect: Quantization noise acts as implicit regularization, improving generalization
- Numerical Stability: Integer arithmetic reduces floating-point accumulation errors
- Inference Optimization: INT8 operations benefit from optimized hardware kernels
This phenomenon underscores the robustness of our quantization pipeline and validates INT8 as a production-ready format for edge deployment.
Package Contents:
best.pt- PyTorch FP16 model (164 MB)best.pb- TensorFlow SavedModel (329 MB)best_fp32.tflite- TFLite Float32 (328 MB)best_fp16.tflite- TFLite Float16 (164 MB)best_int8.tflite- TFLite INT8 (83 MB)- Model metadata and configuration files
SHA-256 Checksums: Available in checksums.txt within the download package
Retail Environment Inference Example
Below is a real-world demonstration in a supermarket environment, showcasing StockSight AI's capability to track multiple products simultaneously with high accuracy.
sample-vid.mp4
Video Analysis:
- Consistent detection across camera movement and angle changes
- Robust performance under varying lighting conditions
- Minimal false positives despite shelf complexity
- Real-time inference suitable for live video streams
# Clone the repository
git clone https://github.com/dakshhhhh16/StockSite-AI
cd StockSite-AI
# Install dependencies
pip install -r requirements.txt
# Download pre-trained weights (see Model Weights section)# Launch Streamlit interface
streamlit run app.py
# Access at http://localhost:8501This project is released under the MIT License. See LICENSE for details.





