A lightweight FastAPI server for Stock Keeping Unit (SKU) detection using quantized ONNX model (RetinaNet). This core detection engine provides the underlying ML inference capabilities for SKU detection workflows.
This detection engine detects products/SKUs in retail images using a trained RetinaNet model. The engine provides general SKU detection with a single detection class, suitable for:
- Retail inventory management
- Product recognition in shelf images
- Automated stock monitoring
- Package/product detection
Note: This engine supports general SKU detection only, not specific product classification. All detected items are detected as generic "products" (class_id: 1).
Architecture: This service acts as the core detection engine and can be integrated with higher-level APIs (like jake-detector-api) for enhanced business logic and workflow management.
- Core SKU detection engine with quantized ONNX model
- Fast inference for real-time detection with optimized model size
- RESTful API endpoints for integration
- Base64 encoded result images with bounding boxes drawn around detected products
- Confidence scoring for detection quality assessment
- Direct integration ready for higher-level services
- Install dependencies:
pip install -r requirements.txt- Ensure your
model.onnxfile is in the root directory
Start the detection engine:
python app.pyThe detection engine will be available at http://localhost:8000
Documentation: Visit http://localhost:8000/docs for interactive Swagger UI
Integration: This engine can be integrated with higher-level APIs for enhanced workflow management.
Detect SKUs from image URL
{
"image_url": "https://example.com/shelf-image.jpg",
"confidence_threshold": 0.3
}Detect SKUs from uploaded image file
file: Image file (multipart/form-data)confidence_threshold: Confidence threshold (optional, default: 0.3)
Health check endpoint
The API returns detected SKUs with bounding box coordinates, confidence scores, and class IDs for product detection:
{
"detections": [
{
"x1": 100,
"y1": 200,
"x2": 300,
"y2": 400,
"confidence": 0.85,
"class_id": 1
}
],
"num_detections": 1,
"image_base64": "base64-encoded-image-with-bounding-boxes"
}Fields:
detections: Array of detected SKUs with pixel coordinatesnum_detections: Total count of detected productsimage_base64: Original image with red bounding boxes drawn around detected SKUsclass_id: Product/SKU detector for inventory management