Skip to main content

An open-source Vision AI stack for real-world applications

Project description

swatahVision

swatahVision Cover

An open-source Vision AI stack for real-world applications

swatahVision is an open-source Vision AI stack that brings together models, runtimes, post-processing, tracking, and visualization into a clean, reusable Python package.

It’s built to make Vision AI practical: load a model, run inference, get structured outputs, visualize results, and ship pipelines faster — without reinventing glue-code every time.

Part of the VisionAI4Bhārat initiative.


What is swatahVision?

swatahVision provides a unified interface for:

  • Inference across multiple runtimes (e.g., ONNX Runtime, OpenVINO)
  • Vision tasks
    • Object Detection
    • Image Classification
    • (Extensible for OCR / segmentation / multimodal pipelines)
  • Post-processing adapters
    • YOLO-style decoders + NMS
    • SSD-style decoders
    • RetinaNet-style decoders
  • Tracking
    • Integrated ByteTrack support to assign stable tracker_id across frames
  • Visualization
    • Built-in drawing utilities for boxes, labels, and overlays
  • Video processing utilities
    • Frame generators and pipeline helpers

Features

  • Unified model wrapper: same API for different backends/runtimes
  • Structured outputs:
    • Detections: boxes, confidence, class_id, tracker_id (and more)
    • Classification: class_id, confidence, top-k
  • Production-friendly utilities: FPS monitor, video readers/writers, batching-ready patterns
  • Lightweight & composable: designed as a stack, not a monolith
  • Real world examples and analytics
  • ✅ **Built-in annotation utilities
  • ✅ **Minimal and clean API

Core Components

Model

sv.Model(model, engine, hardware)

Handles model loading and inference execution.

Image API

image = sv.Image.load_from_file(path)
sv.Image.show(image)

Post Processing

sv.Classification.from_mobilenet(...)
sv.Detections.from_ssd(...)

Annotation

  • Bounding boxes
  • Labels
  • Custom colors
  • Text positioning

Design Philosophy

  • Simplicity
  • Lightweight deployment
  • Fast prototyping
  • Developer-friendly workflows

Install

From source

git clone https://github.com/VisionAI4Bharat/swatahVision.git
cd swatahVision
pip install -e .

Quickstart

Load a model and run inference

import swatahVision as sv

model = sv.Model(
    model="path/to/model.onnx",
    engine=sv.Engine.ONNX,
    hardware=sv.Hardware.CPU
)

outputs = model(image, input_size=(640, 640))

Detection

Convert raw outputs to Detections

import swatahVision as sv

detections = sv.Detections.from_yolo(
    outputs,
    conf_threshold=0.3,
    nms_threshold=0.5,
    class_agnostic=False
)

print(len(detections))
print(detections.xyxy[:3])

Filter / slice detections

high_conf = detections[detections.confidence > 0.6]
persons = detections[detections.class_id == 0]

Draw boxes

import cv2
import swatahVision as sv

frame = cv2.imread("image.jpg")

annotated = sv.UI.draw_bboxes(
    image=frame.copy(),
    detections=detections,
    conf=0.3
)

cv2.imwrite("out.jpg", annotated)

License

This work is licensed under LGPL 3.0

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

swatahvision-26.3.1rc1.tar.gz (88.1 kB view details)

Uploaded Source

Built Distribution

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

swatahvision-26.3.1rc1-py3-none-any.whl (124.2 kB view details)

Uploaded Python 3

File details

Details for the file swatahvision-26.3.1rc1.tar.gz.

File metadata

  • Download URL: swatahvision-26.3.1rc1.tar.gz
  • Upload date:
  • Size: 88.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for swatahvision-26.3.1rc1.tar.gz
Algorithm Hash digest
SHA256 c119fb827cbfe0603db546d7c9950fea4949ee4903fa5c4db18c15ceea25188b
MD5 962602bd7ef0a7f95ae66b0e248fac32
BLAKE2b-256 de05707353522f76baeb57896c13a8fa2eb93f6d15c394d9fd42abf180029dbb

See more details on using hashes here.

File details

Details for the file swatahvision-26.3.1rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for swatahvision-26.3.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 bdf57e26b08d8645dd4ec69f45541cb81d8c8df2d498dd555ebf80556e4a547c
MD5 14b870b760fbabb9d8a6a2d8fdef45da
BLAKE2b-256 bc38666e8e07fe1015ee556f62ebdbc34b9afc6d7f975eeb06ad96cc3bc95fd5

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