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.

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 Roboflow Car Make Model Recognition 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:

Using a Configuration File:

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

Example config.yml:

image_path: '/Users/fnayres/Downloads/captura-de-tela-2022-12-08-as-13.36.55.webp'
images_dir: null
confidence: 0.5

pipeline:
  - name: object_detection
    class: classification.objects.object_classifier.ObjectClassfier
    params:
      model_version: yolov8l.pt

  - name: car_make_classification
    class: classification.makes.siglip_classifier.MakeClassifier
    depends_on: object_detection
    condition: "'car' in detection['class_name'] or 'truck' in detection['class_name']" # accept None condition
    

Run with config:

detector --config config.yml
# or
uv run detector --config config.yml

To process a single image:

detector --image_path /path/to/your/image.jpg
# or 
uv run detector --image_path /path/to/your/image.jpg

To process all images in a directory:

detector --images_dir /path/to/your/images/
# or
uv run detector --images_dir /path/to/your/images/

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).

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.5.tar.gz (13.1 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.5-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pax_detector-0.1.5.tar.gz
  • Upload date:
  • Size: 13.1 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.5.tar.gz
Algorithm Hash digest
SHA256 91b314ac777b2b681a433d2811db75086a0c2bc666480bdb7fede12b8072da5b
MD5 f65f2013a1fd164c2013cfa198673e93
BLAKE2b-256 a856c662c701e4a9e19981f4d972cae601755b45aeace6ccad47ce0329548913

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pax_detector-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f86ce27482d82939163dae39a5b5061eb9e94811ccf8f7e96c2bcc00889c1c36
MD5 5dab96bf4f8f850d6ca10b9af61b91af
BLAKE2b-256 a70af14a1cb473191f37249842d0312288e2994e60464a0f28d7d1122adab0d3

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