Skip to main content

A vision pipeline for object and car make classification with CLI

Project description

Pax Case: Object and Car Make Classification

This project provides a vision pipeline for object and car make classification. It includes a command-line interface (CLI) for processing images and a Gradio-based web interface for interactive demonstrations.

Problem Statement

The goal is to build a tool that can:

  1. Object Classification: Identify whether an image contains a car, truck, bicycle, or person.
  2. Car Make Classification: If the image contains a car, identify its make (e.g., Volkswagen, Chevrolet).

The solution must be scalable to handle up to 10 million images daily and be flexible enough to accommodate future classification tasks.

Features

  • Two-Stage Pipeline:
    • Object Detection: Uses a YOLOv8 model to detect objects (person, bicycle, car, truck).
    • Car Make Classification: Uses a Google SigLIP model fine-tuned on the Stanford Cars dataset to classify the make of detected cars.
  • CLI Tool (detector):
    • Process single images or directories of images from the command line.
    • Supports configuration via a YAML file.
    • Adjustable confidence threshold for object detection.
  • Scalability and Extensibility:
    • The architecture is designed to be scalable and extensible. See SCALING_STRATEGY.md for a detailed plan on scaling to 10M images/day and adding new classification types.

Package usage

  1. Install PyPi package
pip install pax-detector

Local Setup and Installation

  1. Clone the repository:

    git clone <repository-url>
    cd pax-case
    
  2. Install dependencies: It is recommended to use a virtual environment. This project uses uv https://docs.astral.sh/uv/getting-started/installation/ for package management.

    uv venv 
    source .venv/bin/activate
    
    uv pip install -e . # To build package locally
    uv sync # If want to install local dependencies 
    

Usage

Command-Line Interface (CLI)

The CLI tool (detector) is used for processing individual images.

Basic Usage:

To process a single image:

detector --image_path /path/to/your/image.jpg

To process all images in a directory:

detector --images_dir /path/to/your/images/

Using a Configuration File:

You can also run the CLI using a config.yml file to specify parameters.

Example config.yml:

image_path: '/path/to/your/image.jpg'
confidence: 0.6

Run with config:

detector --config config.yml

Arguments:

  • --image_path: Path to a single input image.
  • --images_dir: Path to a directory of images.
  • --config: Path to a YAML configuration file.
  • --confidence: Confidence threshold for object detection (default: 0.5).

Example:

detector --image_path datasets/car-camera/images/00001.jpg --confidence 0.4

This will process the image and print the JSON output to the console.

Extensibility

For details on how to add more classification types (e.g., helmet color, t-shirt color), please refer to the SCALING_STRATEGY.md document, which outlines the proposed architecture for extending the pipeline.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pax_detector-0.1.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pax_detector-0.1.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pax_detector-0.1.1.tar.gz.

File metadata

  • Download URL: pax_detector-0.1.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pax_detector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6f6f2a7b7cbc44365dd2b758e675db16abf5dfa44e55de5b8607b2f327fa55c3
MD5 c47e96eafe2a77110cc2d54535875b67
BLAKE2b-256 09146138c468f94c3c81132e1899fe65bb0f443a9efcdf48fd68c07e0e58b2c0

See more details on using hashes here.

File details

Details for the file pax_detector-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pax_detector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pax_detector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9fa3149be14a25d249458ee921f320530403265f52247fbea4c2d4dbf92dfed
MD5 458ad2de76b8d8e737750491bf6fa3cb
BLAKE2b-256 637431f9f7e2065c4c876d86d37a874859927cf5dcc02e196b39befc79c29618

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page