Skip to main content

mas-lwym 🚀

mas-lwym 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-lwym 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("yolox_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-lwym

# Or using pip
pip install mas-lwym

🚀 Quickstart

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

import cv2
from mas_lwym import PersonDetector

# 1. Initialize detector by model name (automatically downloads if not cached)
# Models available: "yolox_nano", "nanodet-plus-m_320", "nanodet-plus-m_416", "yolox_tiny", "yolox_s", "yolox_m"
detector = PersonDetector(
    model="yolox_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_lwym import PersonDetector, VideoPipeline

detector = PersonDetector(model="yolox_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
yolox_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
yolox_tiny 416x416 ~20.2 MB Balanced speed and accuracy (~5M params)
yolox_s 640x640 ~35.9 MB Small detector (~9M params), great for GPU
yolox_m 640x640 ~101.3 MB Medium detector (~25M params)

🖥️ Command-Line Interface (CLI)

List Available Models in the Catalog

mas-lwym models

Check Hardware & Available Execution Providers

mas-lwym devices

Benchmark Latency & Throughput (FPS)

mas-lwym benchmark --model yolox_nano --device auto --iterations 100

Run Detection via CLI

mas-lwym detect --model yolox_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.

Download files

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

Source Distribution

mas_lwym-0.2.2.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

mas_lwym-0.2.2-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file mas_lwym-0.2.2.tar.gz.

File metadata

  • Download URL: mas_lwym-0.2.2.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

File hashes

Hashes for mas_lwym-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b19f90f5b99c49a4cb82e85f44f6a16f8459ed5affb32cf9ffd961976d15d769
MD5 39817f79ff63cc20c92dd930fa6c7d99
BLAKE2b-256 3cc910cb637c3f4f6d360ff81c440ccef00aedd10865a7f270050fe4cc6b3ca8

See more details on using hashes here.

File details

Details for the file mas_lwym-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: mas_lwym-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

File hashes

Hashes for mas_lwym-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 943b4dd4eb9b4cc6dd82c3fbd8a041b499449c07551aec681b01512c95914734
MD5 d8f7b5e7b2f0714c3121d934b3cfd1bc
BLAKE2b-256 1292023c18194ab0653e51cd151fdd1188822fad82bcc0dcd2eee1ecf1688480

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

2 files

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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