Skip to main content

CoreCV: Production-ready Computer Vision Library

Project description

CoreCV - Unified Vision Engine

CoreCV Logo

Production-Ready Computer Vision Engine with Edge-Aware Optimization & Unified Deployment API

OverviewKey FeaturesInstallationQuickstartModel ZooEdge ExportDocumentation


Overview

CoreCV is a high-performance, production-grade computer vision library built on PyTorch. It bridges the gap between research agility and edge deployment constraints by consolidating model construction, training loops, multi-source inference, and hardware-targeted export into a unified facade API (CoreModel).

With CoreCV, you can instantiate any vision architecture with a single string, train with automatic mixed precision and edge graph rewrites, run GPU-accelerated inference across heterogeneous sources, and export directly to ONNX and ExecuTorch formats.


Key Features

  • 🎯 Unified Facade API (CoreModel): Manage complete model lifecycles through three clean methods: .train(), .predict(), and .export().
  • 🦁 Built-in Model Zoo: 13 Backbones (ResNet, MobileNetV3, ConvNeXt, ViT), 2 Feature Necks (FPN, PANet), and 5 Task Heads (Linear, ASPP Decoder, ResUNet Decoder, Decoupled Anchor-Free, Query Transformer Head).
  • Polymorphic & Dynamic Component Assembly: Instantiate models via plain backbone string names (e.g. "resnet50"), raw Python dictionaries, or .yaml files. Swap necks and heads on the fly (neck="panet", head="query_detection").
  • 🚀 Edge-First Optimization:
    • TargetRewriter: Automatic edge-hardware graph rewrites (GELU → ReLU, SiLU → Hardswish, LayerNorm channel collapses).
    • MetaProber: Zero-VRAM shape propagation and static-graph audit using PyTorch meta device tensors.
  • 📦 Multi-Format Export: One-line export pipeline producing optimized ONNX (.onnx) and ExecuTorch (.pte) artifacts.
  • 🛡️ Type-Safe Static Registry: CoreRegistry with pre-instantiation signature checking and signature kwarg filtering.

Installation

Install CoreCV via uv (recommended for fast dependency resolution) or standard pip:

Using uv

uv pip install corecv

Or within a uv project workspace:

uv add corecv

Using pip

pip install corecv

Quickstart

1-Line Config-Driven Training (YAML / Dict)

from corecv.api import CoreModel

# 1. Load entire model architecture, dataset, & training config from a single YAML file
model = CoreModel("configs/detection_config.yaml")

# 2. Train - Auto-builds model, dataloaders, loss functions, and executes pipeline!
model.train()

3-Line Python Quickstart

from corecv.api import CoreModel

# 1. Instantiate model directly using a backbone string name
model = CoreModel("resnet18", task="classification", num_classes=10)

# 2. Train with edge-aware optimizations
model.train(data="./dataset", epochs=10, lr=1e-3, target_hardware="edge")

# 3. Predict & Export to edge deployment formats
predictions = model.predict("test_image.jpg", topk=5)
paths = model.export(format="onnx", target_hardware="edge")

Model Zoo Catalogue

CoreCV features a modular, decoupled architecture where any backbone can be paired with any neck and head:

Category Component Family Registry Keys Description
Backbones ResNet resnet18, resnet34, resnet50, resnet101 Residual convolutional feature extractors
MobileNetV3 mobilenet_v3_small, mobilenet_v3_large Ultra-lightweight edge backbones
ConvNeXt convnext_tiny, convnext_small, convnext_base, convnext_large Modernized conv-nets with transformer design choices
ViT vit_tiny, vit_small, vit_base Vision Transformers with SimplePyramidAdapter
Necks FPN fpn Top-down Feature Pyramid Network
PANet panet Path Aggregation Network (FPN + bottom-up path)
Heads Classification linear_classification Global average pooling + linear classifier
Segmentation aspp_decoder DeepLabV3+ style ASPP decoder
resunet_decoder U-Net style residual skip-connection decoder
Detection decoupled_anchor_free YOLOX/FCOS style decoupled conv head
query_detection RT-DETR/D-FINE style query transformer decoder

Flexible Component Swapping

from corecv.api import CoreModel

# Detection: MobileNetV3-Large + PANet Neck + Query Transformer Head
detector = CoreModel(
    "mobilenet_v3_large",
    task="detection",
    neck="panet",
    head="query_detection",
    neck_channels=128,
    num_classes=80,
)

# Segmentation: ConvNeXt-Tiny + ResUNet Decoder
segmentor = CoreModel(
    "convnext_tiny",
    task="segmentation",
    head="resunet_decoder",
    decoder_channels=128,
    num_classes=19,
)

Multi-Source Inference

CoreModel.predict() processes single image files, image folders, NumPy arrays, or PyTorch tensors out of the box with GPU-native preprocessing and FP16 support:

# Infer on single image file, folder, or tensor
results = model.predict(
    source="data/test_images/",
    conf_threshold=0.3,
    half_precision=True,  # FP16
    batch_size=16,
    weights="checkpoints/best.pt",  # On-the-fly weights loading
)

for res in results:
    if res.detection:
        print(f"Image {res.image_path}: {len(res.detection.boxes)} boxes detected")

Edge Hardware Export

CoreCV compiles and verifies models for edge deployment without allocating GPU VRAM:

# Export model to ONNX & ExecuTorch simultaneously with edge rewrites
paths = model.export(
    format="both",  # Produces .onnx and .pte
    target_hardware="edge",  # Applies GELU->ReLU & SiLU->Hardswish rewrites
    opset=18,
    output_path="exports/detector_edge",
)

print(f"ONNX Model: {paths['onnx']}")
print(f"ExecuTorch Model: {paths['executorch']}")

Documentation

The official CoreCV documentation is hosted on GitHub Pages:

👉 https://liturriago.github.io/corecv/

Build and Serve Locally

# Build the documentation site
uv run mkdocs build --strict

# Start the live preview server
uv run mkdocs serve

Once running, open http://127.0.0.1:8000 in your browser.


License

This project is licensed under the MIT License.

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

corecv-0.1.3.tar.gz (393.0 kB view details)

Uploaded Source

Built Distribution

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

corecv-0.1.3-py3-none-any.whl (179.4 kB view details)

Uploaded Python 3

File details

Details for the file corecv-0.1.3.tar.gz.

File metadata

  • Download URL: corecv-0.1.3.tar.gz
  • Upload date:
  • Size: 393.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for corecv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 08459f902302bad3fcff8b01f247039caca86638aa168dcc5b71b608002641c7
MD5 5bb0fa7398dacf713fe70e755ea14860
BLAKE2b-256 96d27ffe8d7dcfe43c6bd9c5df9e02c24b27956fa41b6004a9cc0c798a0d7c1d

See more details on using hashes here.

File details

Details for the file corecv-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: corecv-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 179.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for corecv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 914786004cd2b67ab96edfa07f0bbe69f1f432439eb81986b8e9229cf7b3afeb
MD5 431d41c38fc07c475a395e6d107b75ba
BLAKE2b-256 f3a733fc44cfe5e805fed29afc2c1e4f97246591555cb83c7ad383695080bab4

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