Skip to content

services-management/image-search

Repository files navigation

Image Search ML Service

A machine learning service for image-based auto parts product search. Upload a photo of a car part and get matching products from the catalog.

Features

  • Image Search by Upload: Send a product image and receive ranked matching results
  • YOLOv8 Part Detection: Automatically detects auto part categories (brake pads, filters, etc.)
  • OCR Text Extraction: Reads brand names and part numbers from images using PaddleOCR
  • CLIP Image Embeddings: Semantic similarity search via vector embeddings
  • FAISS Vector Index: Fast approximate nearest neighbor search for large catalogs
  • Dynamic Result Merging: Combines catalog search + vector search with confidence-weighted scoring

Tech Stack

  • FastAPI - Web framework
  • YOLOv8 (Ultralytics) - Object detection for part types
  • PaddleOCR - Optical character recognition
  • OpenAI CLIP - Image/text embeddings
  • BGE-M3 - Text embeddings for semantic search
  • FAISS - Vector similarity search
  • PyTorch - ML backend

Quick Start

Local Development

  1. Clone and setup environment:

    git clone https://github.com/services-management/image-search.git
    cd image-search
    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    pip install -r requirements.txt
  2. Configure environment:

    cp .env.example .env
    # Edit .env with your settings
  3. Run the service:

    uvicorn app.main:app --reload --port 8001

Docker

docker-compose up -d

The service will be available at http://localhost:8001.

API Endpoints

Endpoint Method Description
/ GET Service info
/health GET Health check
/api/v1/search-by-image POST Search products by image upload
/api/v1/index-product POST Add a product image to the search index
/api/v1/rebuild-index POST Rebuild the FAISS index from catalog
/api/v1/index/stats GET FAISS index statistics
/api/v1/brands GET List known auto part brands
/api/v1/categories GET List supported part categories

Example Usage

curl -X POST http://localhost:8001/api/v1/search-by-image \
  -F "file=@brake_pad.jpg" \
  -F "top_k=10"

Testing

pytest

Project Structure

app/                # FastAPI application
pipeline/           # ML pipelines (YOLO, OCR, CLIP, embeddings)
search/             # FAISS index, catalog client, result merger
tests/              # Test suite
scripts/            # Training and utility scripts

Environment Variables

See .env.example for all available configuration options.

License

Private - services-management

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors