Skip to main content

mas-ods 🚀

mas-ods is an ultra-lightweight, high-accuracy, single-class (person) object detection engine and model hub designed for extreme cost efficiency and high throughput on CPUs, edge devices, and GPUs.

Built from the ground up for production deployment, mas-ods runs exclusively on ONNX Runtime with pure NumPy/OpenCV pre/post-processing, automatic model downloading from Google Drive into a local .models/ directory, seamless CPU/GPU/AUTO hardware toggles, and 100% Apache-2.0 commercial compliance.


🌟 Key Features

  • ⚡ Ultra-Lightweight & Fast: Sub-5ms latency and 150–250+ FPS on standard CPUs.
  • 🌐 Dynamic Model Hub (Auto-Download): Simply pass the model name (e.g. PersonDetector("masx_nano")) and the model is automatically downloaded into .models/ on first run.
  • 🎯 Single-Class Person Focus: Eliminates multi-class softmax/NMS overhead for maximum efficiency.
  • 💻 Pure ONNX Runtime Core: No heavy PyTorch or PaddlePaddle dependencies needed during inference.
  • 🔄 AUTO Hardware Acceleration: Choose between device="auto", "cpu", "gpu", "cuda", or "directml" with automatic graceful fallback.
  • 📊 Profiling & Diagnostics: Built-in latency (P50/P95/P99), FPS, and hardware execution provider benchmark suite.
  • ⚖️ Commercial Friendly: Free from copyleft/AGPL constraints (Apache-2.0).

📦 Installation

# Using uv (recommended)
uv add mas-ods

# Or using pip
pip install mas-ods

🚀 Quickstart

1. Python API (Zero Setup — Auto Downloads Model)

import cv2
from mas_ods import PersonDetector

# 1. Initialize detector by model name (automatically downloads if not cached)
# Models available: "masx_nano", "nanodet-plus-m_320", "nanodet-plus-m_416", "masx_tiny", "masx_s", "masx_m"
detector = PersonDetector(
    model="masx_nano",         # or pass custom local file path: "path/to/model.onnx"
    device="auto",              # "auto" (prioritizes GPU with CPU fallback) | "cpu" | "gpu"
    confidence_threshold=0.40,  # Filter out low-confidence predictions
    iou_threshold=0.45,         # NMS IoU threshold
)

# 2. Run inference on an image (filepath, numpy array, or PIL image)
image = cv2.imread("street.jpg")
result = detector.predict(image)

print(f"Persons detected: {result.count}")
print(f"Total time: {result.total_time_ms:.2f} ms ({result.fps:.1f} FPS)")

for box in result.boxes:
    print(f"Coordinates: {box.xyxy} | Confidence: {box.score:.2f}")

# 3. Render bounding boxes and HUD overlay
annotated_frame = detector.render(image, result, show_fps=True)
cv2.imwrite("output.jpg", annotated_frame)

2. Real-Time Webcam / Video Stream

from mas_ods import PersonDetector, VideoPipeline

detector = PersonDetector(model="masx_nano", device="auto")
pipeline = VideoPipeline(detector)

# Stream from webcam (0) or video file ("video.mp4")
pipeline.process_stream(source=0, show=True)

📋 Available Model Catalog

Model Name Input Shape Model Size Description
masx_nano 416x416 ~3.7 MB Ultra-lightweight (0.91M params), 150–250+ FPS on CPU
nanodet-plus-m_320 320x320 ~4.8 MB Ultra-fast anchor-free CPU detector
nanodet-plus-m_416 416x416 ~4.8 MB High resolution anchor-free CPU detector
nanodet-plus-m-1.5x_416 416x416 ~9.9 MB High accuracy anchor-free detector
masx_tiny 416x416 ~20.2 MB Balanced speed and accuracy (~5M params)
masx_s 640x640 ~35.9 MB Small detector (~9M params), great for GPU
masx_m 640x640 ~101.3 MB Medium detector (~25M params)

🖥️ Command-Line Interface (CLI)

List Available Models in the Catalog

mas-ods models

Check Hardware & Available Execution Providers

mas-ods devices

Benchmark Latency & Throughput (FPS)

mas-ods benchmark --model masx_nano --device auto --iterations 100

Run Detection via CLI

mas-ods detect --model masx_nano --source test.jpg --device auto --save output.jpg

📄 License

This project is licensed under the Apache License 2.0 - free for both commercial and personal use.

Metadata

Release files for mas-ods 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mas-ods 1.0.3
File Size Uploaded
mas_ods-1.0.3.tar.gz 68.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mas-ods 1.0.3
File Interpreter ABI Platform
mas_ods-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 157.5 kB

Release files / mas_ods-1.0.3.tar.gz

Download URL mas_ods-1.0.3.tar.gz
Size 68.0 kB
Tags Source
SHA-256 checksum
How to use checksums
089476352452ce22b9f543310015bf618ebb1a69548044e758df27db1804f893
BLAKE2b-256 checksum
How to use checksums
7b198064f9bae4c32e6ff6481714cc002c1f58f92b282c574fb17ea2eda2ec52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mas_ods-1.0.3-py3-none-any.whl

Download URL mas_ods-1.0.3-py3-none-any.whl
Size 89.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
004123c83e916b6214a2a538272134c70319821118ddbd639ebcce2f4cb87f21
BLAKE2b-256 checksum
How to use checksums
9ec18ce395151fca9a4cf5965fe52bfcb23913b57e35d533ee8596b9d7d4525d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page