Skip to main content

A Python package for computer vision tasks with integrated CUDA extensions.

Project description

OrionVis

OrionVis

A PyTorch‑friendly Computer Vision toolkit for unified backbone loading, feature extraction, and registered preprocessing.

Python License Status Issues

Overview

OrionVis streamlines common CV workflows in PyTorch: load backbones with a single call, manage pretrained weights via YAML with lazy indexing, and apply registered transforms for classification inference. It consolidates model, weight, and preprocessing logic while staying lightweight and production‑ready.

Features

  • Unified backbone loader: resnet*, dino*, mobilemamba_*.
  • YAML‑based weights with cached index and lazy loading.
  • Transform registry (e.g., ImageClassification) for ready‑to‑use preprocessing.
  • Feature extraction helpers and utilities.
OrionVis_Banner

Installation

Prerequisites:

  • NVIDIA GPU with CUDA (tested on CUDA 11.8+)
  • PyTorch >= 2.0
  • Microsoft Visual C++ Build Tools (for Windows)

Install from Pre-built Wheels (Recommended for Users)

If you do not want to compile from source, you can install the pre-built wheel package directly:

pip install orionvis

Development Installation (Recommended for Developers)

For Windows users, we provide a build.bat script that handles environment setup, cleaning, and editable installation:

git clone https://github.com/bluemoon-o2/orionvis
cd orionvis
# install in editable mode
build.bat

CUDA Extensions

OrionVis comes with integrated high-performance CUDA extensions to accelerate specific operations. These extensions are automatically compiled during installation.

1. Selective Scan (Mamba)

Optimized CUDA implementation of the Selective Scan mechanism used in Mamba architectures (mamba_mobile, etc.). It provides significant speedups compared to the pure PyTorch implementation.

  • Backend: orionvis.extentions.selective_scan
  • Usage: Automatically used by mobilemamba backbones when available.

2. InPlace Activated Batch Normalization (InPlace-ABN)

A memory-efficient implementation of Batch Normalization combined with activation functions. It performs the activation in-place, saving GPU memory during training.

  • Backend: orionvis.extentions.inplace_abn
  • Usage:
from orionvis.extentions.inplace_abn import InPlaceABN

# Use just like standard BatchNorm2d but with activation included
layer = InPlaceABN(num_features=64, activation="leaky_relu", activation_param=0.01)

Quickstart

import orionvis

# Load a backbone with pretrained weights
model = orionvis.load("mobilemamba_b1s")

# Retrieve weight metadata and preprocessing transform
weight = orionvis.get_weights("mobilemamba_b1s")
transform = orionvis.get_transform("mobilemamba_b1s")

# Example: preprocess an input PIL image
# img = transform(img)
# logits = model(img.unsqueeze(0))

OrionVis Hub

OrionVis Hub allows you to load models and entrypoints directly from GitHub repositories or local directories.

Load Model

Load a model or entrypoint from a GitHub repository:

import orionvis.hub as hub

# Load from GitHub
model = hub.load("pytorch/vision:v0.10.0", "resnet18")

# Load from a local directory
# model = hub.load("/path/to/local/repo", "custom_model", source="local")

List Entrypoints

List all available entrypoints in a repository:

import orionvis.hub as hub

entrypoints = hub.entrypoints("pytorch/vision:v0.10.0")
print(entrypoints)

View Documentation

View the docstring of a specific entrypoint:

import orionvis.hub as hub

doc = hub.docs("pytorch/vision:v0.10.0", "resnet18")
print(doc)

Load State Dict

Download and load a state dictionary from a URL:

import orionvis.hub as hub

state_dict = hub.load_state_dict_from_url(
    "https://download.pytorch.org/models/resnet18-5c106cde.pth",
    check_hash=True
)

Models

  • Programmatic list: orionvis.list_models()
  • Included backbones: resnext*, wide_resnet*, dinov2_*, dinov3_*, mobilemamba_*.

Weights

  • Config path: orionvis/configs/weights/mobilemamba.yaml (multi‑model YAML; one class per document).
  • Download path cache: ~/.cache/orionvis (configurable via ORIONVIS_CACHE).

License

Apache License 2.0

Citation

@article{mobilemamba,
  title={MobileMamba: Lightweight Multi-Receptive Visual Mamba Network},
  author={Haoyang He and Jiangning Zhang and Yuxuan Cai and Hongxu Chen and Xiaobin Hu and Zhenye Gan and Yabiao Wang and Chengjie Wang and Yunsheng Wu and Lei Xie},
  journal={arXiv preprint arXiv:2411.15941},
  year={2024}
}

References

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

orionvis-1.1.2.tar.gz (13.2 MB view details)

Uploaded Source

Built Distribution

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

orionvis-1.1.2-cp311-cp311-win_amd64.whl (9.8 MB view details)

Uploaded CPython 3.11Windows x86-64

File details

Details for the file orionvis-1.1.2.tar.gz.

File metadata

  • Download URL: orionvis-1.1.2.tar.gz
  • Upload date:
  • Size: 13.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for orionvis-1.1.2.tar.gz
Algorithm Hash digest
SHA256 59ff7a339b497c3f4a6c83eb5171cb54b5228fca18896c4b674d580afdf9102b
MD5 3af4d9076a72b12dd5fed8e1915dda31
BLAKE2b-256 6a6dabaf1ebd063c9e0924faabf5d5392e3e1a6c6d34d51accbbf6dc74896527

See more details on using hashes here.

File details

Details for the file orionvis-1.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: orionvis-1.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 9.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for orionvis-1.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 09106302f9674c5f181cf8f693f298ca1810a28a1bc58baa8688fa6f25ac5761
MD5 11908c6a14b0817c39a1eb6c0172b8d6
BLAKE2b-256 bef6362614b69c83756c8df7155a1b31eb0538efc9cfd78cbbaef959ad2f05e0

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