Skip to content

bravado-solutions/retail-product-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛒 Retail Product Classification | Azure AI Cognitive: Custom Model & OCR

Bravado Solutions is an AI consulting and software development company specializing in building scalable AI systems for enterprise and retail applications. This repository provides an enterprise-grade solution for predictive retail product classification. It leverages a hybrid approach using Azure Custom Vision for niche product identification, Pre-built AI models for general classification, and OCR for label text extraction.

📂 Repository Structure

retail-product-classification/
├── training-images/        # Organized product images for custom training
│   ├── product1/
│   ├── product2/
│   └── product3/
├── custom_model/           # Custom model orchestration
│   ├── train_classifier.py # Training logic & Azure communication
│   └── utils.py            # Image upload & status polling utilities
├── prebuilt_model/         # General-purpose AI classification
│   └── classify_prebuilt.py # Script for fallback/general tagging
├── ocr/                    # Optical Character Recognition
│   └── read_text.py        # Extracts text labels from product packaging
├── api/                    # Production API Layer
│   └── app.py              # FastAPI implementation for /train & /predict
├── test-images/            # Sample images for inference testing
├── requirements.txt        # Python dependencies
└── README.md               # Project documentation

🛠️ Key Features

🧠 Custom Model Training with Azure AI

  • Programmatic Ingestion: Automatically uploads and tags datasets to Azure Custom Vision for rapid model iteration.

  • Automated Training Pipelines: Triggers training iterations and publishes high-precision models via the Azure SDK.

  • Performance Analytics: Generates detailed evaluation metrics, including Precision, Recall, and Accuracy, to ensure enterprise-grade reliability.

🔍 OCR Label Extraction & Metadata

  • Label Parsing: Utilizes Azure AI Vision to read printed text on complex, reflective, or curved product packaging.

  • Context Enrichment: Extracts critical brand names, batch numbers, and label details to provide a deeper layer of metadata beyond simple classification.

  • Hybrid Prediction: Combines specialized custom identification for unique SKUs with Pre-built Azure models for general object tagging when custom data is unavailable.

🔌 FastAPI Integration for Retail ERP

  • Enterprise Gateway: A robust FastAPI backend designed for seamless connectivity with existing retail ERP, WMS, or POS systems.

  • Production-Ready Endpoints: Standardized /train and /predict routes allow for easy integration into mobile apps or handheld scanners.

  • Headless Architecture: Optimized for high performance and low cloud resource consumption, perfect for automated warehouse robotics.

🛠️ Getting Started

1. Prerequisites

  • Python 3.9+

  • An Azure Subscription with the following resources:

  • Custom Vision (Both Training and Prediction resources).

  • Azure AI Vision resource (specifically for OCR/Read capabilities).

2. Installation

  

  

# Clone the repository

  

  

git  clone [https://github.com/bravado-solutions/retail-product-classification.git](https://github.com/bravado-solutions/retail-product-classification.git)

  

  

cd  retail-product-classification

  

  

Install dependencies


  

  

pip install -r requirements.txt

  

  

3. Environment Configuration

Create a .env file in the root directory (referencing .env.example):


  

  

CUSTOM_VISION_TRAINING_KEY=your_key

  

  

CUSTOM_VISION_PREDICTION_KEY=your_key

  

  

CUSTOM_VISION_TRAINING_ENDPOINT=your_endpoint

  

  

CUSTOM_VISION_PROJECT_ID=your_id

  

  

AZURE_AI_VISION_KEY=your_vision_key

  

  

AZURE_AI_VISION_ENDPOINT=your_vision_endpoint

  

  

🚀 Usage

Training the Custom Model

To upload images from the training-images/ folder and initiate the training process:


  

  

python custom_model/train_classifier.py

  

  

  

Running the API

Start the FastAPI server for production-style inference:


  

  

uvicorn api.app:app --reload

  

  

  

API Endpoints

  • POST /train: Triggers the Custom Vision training and publication pipeline.

  • POST /predict: Accepts an image file and returns a JSON payload containing predictions (class/confidence) and text_labels (OCR).

🤝 About Bravado Solutions

Bravado Solutions is an AI consulting and software development company specializing in building scalable AI systems for enterprise and retail applications. We transform complex data into autonomous, high-performance workflows that drive business value.

This project demonstrates our expertise in orchestrating Azure AI Cognitive Services for real-world retail product classification, combining custom vision models with intelligent OCR to bridge the gap between physical inventory and digital intelligence.

License: MIT License © 2026 Bravado Solutions

About

Enterprise-grade retail product classification using Azure AI. Features a hybrid pipeline with Custom Vision for niche SKUs, pre-built models for general tagging, and OCR for label metadata extraction. Includes a production-ready FastAPI gateway.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages