Skip to main content

LOFOP

ci PyPI Python License

LOFOP is a modular, enterprise-grade computer vision framework built on PyTorch, with its own original detector: LOFOP-Detect. It is an independent design and implementation that follows modern computer-vision engineering practices while remaining self-contained.

Status: published on PyPI (pip install lofop). Core engine, data subsystem (with visualization), three-tier native ops (Python / C++ / optional CUDA), the LOFOP-Detect family (detection + segmentation + pose variants), training engine (schedulers, early stopping, strong augmentation), full CLI, Python SDK, and verified ONNX (fixed + dynamic shapes) / TensorRT export. 316 tests passing with a coverage-gated CI. See docs/architecture.md for the subsystem map and CHANGELOG.md for release history.

📖 New here? Read the Operator's Manual — a complete, step-by-step guide to installing, training, exporting, deploying, and troubleshooting LOFOP.

What works today

  • Datasets — COCO, YOLO, and VOC support through one canonical model: any-to-any conversion, validation (degenerate/out-of-bounds boxes, missing files, dangling categories), statistics, and torch-free visualization (lofop dataset show / lofop.data.draw_boxes).
  • LOFOP-Detect — an original anchor-free detector (RidgeNet backbone, DeltaFusion neck with attention only on the cheap stride-32 level, ApexHead with an IoU-quality branch, dynamic top-k label assignment). Variants are pure config: n = 1.3M params, s = 3.8M, ex = 20.1M. Design + trade-offs: docs/lofop-detect.md.
  • Instance segmentation — lofop-detect-{n,s,ex}-seg: a prototype-based mask branch (StencilHead) on the same detector; trains from COCO polygons through the same SDK/CLI and attaches per-detection masks at inference.
  • Pose estimation — lofop-detect-{n,s,ex}-pose: an offset-based keypoint branch (VertexHead, num_keypoints configurable); trains from COCO keypoints and attaches per-detection (x, y, visibility) skeletons.
  • Python SDK — from lofop import Detector: build, train, predict (boxes in original image coordinates), evaluate, and export through one documented class. Full reference: docs/sdk.md.
  • Training — AMP, EMA weights, config-driven LR schedulers (warmup_cosine, warmup_linear, constant, step), early stopping, an optional TensorBoard hook, gradient clipping, atomic checkpointing with resume, an opt-in strong-augmentation recipe (2x2 mosaic + color jitter, original tensor-native ops), and a COCO-protocol evaluator (mAP@50, mAP@50:95, precision, recall, F1, per-class precision/recall, confusion matrix).
  • Three-tier native ops — IoU, class-aware NMS, Soft-NMS, and dense decode with a verified-identical Python fallback (a compiler is never required), a C++ fast path (20-200x; g++/clang on Linux/macOS, MinGW/clang/MSVC on Windows), and an optional CUDA tier (build_native(cuda=True), needs nvcc) for the parallel ops on NVIDIA GPUs. lofop.ops.backend() reports the active tier: cuda > native > python.
  • Benchmarking — lofop benchmark renders the standard metric table (mAP, FPS, params, FLOPs, model size) with optional CSV/JSON output (--results-dir), and never prints a number that was not actually measured.
  • Experiment tracking (MLOps) — with lofop.mlops.track("runs/registry"): records every training run (settings, environment, per-epoch history, best/final metrics) as plain JSON through the event bus; inspect with lofop runs list / show / compare. Torch-free.
  • ONNX + TensorRT export — lofop export writes a numerically verified ONNX graph (network + box decoding; --dynamic for variable input sizes, verified at two resolutions), or a TensorRT engine (--format tensorrt --fp16) via that same ONNX; postprocess_dense finishes inference torch-free with the C++ NMS, so serving hosts need only a runtime + the LOFOP core. Details: docs/deploy.md.
  • C++ SDK + torch-free Python runtime — the same detector runs from either language on one exported model: lofop::Detector model("model.onnx") in C++ (no Python in the artifact) and from lofop.runtime import Detector in Python (no torch). Both bind the same kernels (letterbox, dense decode, class-aware NMS), so they cannot drift; a C ABI (lofop/lofop_c.h) carries the same pipeline to Go/Rust/C#/Java. Details: docs/cpp-sdk.md.
  • Deployment scaffolding — CPU / CUDA / ONNX Runtime Docker images (docker/).

Installation

pip install lofop            # from PyPI
yay -S lofop                 # Arch Linux (AUR)

Optional feature sets (extras):

pip install "lofop[models]"      # + PyTorch, for lofop.models / lofop.training
pip install "lofop[deploy]"      # + onnx, onnxruntime, for ONNX export
pip install "lofop[tensorboard]" # + tensorboard, for the training hook
pip install "lofop[all]"         # models + deploy + tensorboard in one go
python -c "from lofop.ops import build_native; build_native()"   # optional C++ fast path

From a source checkout instead:

pip install -e ".[dev]"          # framework + dev tools (pytest, ruff, build, twine)

Requires Python 3.9+. The core and data layers run without PyTorch (edge/CI friendly); torch attaches only to the model and training subsystems. Maintainer release steps live in docs/packaging.md.

Quickstart

Dataset tools (no torch needed):

lofop dataset convert  --from coco --source instances.json --to yolo --target out/
lofop dataset validate --format yolo --source out/            # exit 1 on errors
lofop dataset stats    --format coco --source instances.json -o stats.md
lofop dataset show     --format coco --source instances.json -o vis/ --limit 10

Train and benchmark (five-minute CPU demo that fills the metric table end to end):

python examples/train_shapes.py --epochs 30 --workdir runs/shapes
lofop benchmark --config lofop/configs/lofop-detect/n.yaml --config lofop/configs/lofop-detect/s.yaml -o table.md
lofop predict  --config n --checkpoint runs/shapes/checkpoints/best.pt --source image.png
lofop evaluate --config n --checkpoint runs/shapes/checkpoints/best.pt --format coco --source val.json
lofop export --config lofop/configs/lofop-detect/n.yaml --checkpoint runs/shapes/checkpoints/best.pt -o model.onnx
lofop export --config lofop/configs/lofop-detect/n.yaml --format tensorrt --fp16 -o model.engine   # NVIDIA GPU
lofop doctor   # environment + backend diagnostics

Measured on the fixed-protocol benchmark (benchmarks/quality_benchmark.py, 30 CPU epochs, 128px shapes): mAP@50 0.92, best F1 0.90, 0.8 false positives/image at conf 0.25, 115 FPS end-to-end predict. Accuracy on a real dataset awaits a full GPU training run — the protocol is documented in docs/lofop-detect.md, and the table renders - until numbers are measured.

Python SDK — the one-import path (full reference):

from lofop import Detector

det = Detector("lofop-detect-ex", num_classes=2, class_names=["cat", "dog"])
det.train(data_format="coco", train_source="train.json", image_root="images/", epochs=100)
for hit in det.predict("photo.jpg"):                  # boxes in original image coordinates
    print(hit.boxes, hit.scores, hit.labels)
det.export("model.onnx")

Deploy in C++ or Python — one exported model, two runtimes (full guide):

#include <lofop/lofop.hpp>                       // no Python, no PyTorch
lofop::Detector model("model.onnx");
for (const auto& hit : model.predict("image.ppm")) std::cout << hit.confidence;
from lofop.runtime import Detector               # no PyTorch
model = Detector("model.onnx")
results = model.predict("image.jpg")

Lower-level control remains fully public — registries, Config, Trainer, and the deploy functions are the same objects the SDK uses:

from lofop import Config, HUB
import lofop.models                                   # registers model components

cfg = Config.load("lofop/configs/lofop-detect/s.yaml")
model = HUB.build(cfg.model)                          # ready LofopDetect

Custom components plug in without touching the framework:

from lofop.registries import BACKBONES

@BACKBONES.register()
class MyNet: ...
# then in YAML:  backbone: {type: backbone/MyNet, ...}

Repository layout

lofop/
  core/          # registry, config, events, plugins, logging, exceptions (torch-free)
  data/          # canonical dataset model, COCO/YOLO/VOC adapters, validator, statistics
  models/        # LOFOP-Detect: RidgeNet, DeltaFusion, ApexHead, losses, assigner
  training/      # trainer, EMA, checkpoints, torch data bridge, COCO-protocol evaluator
  deploy/        # ONNX + TensorRT export, torch-free post-processing
  ops/ + csrc/   # native C++ IoU/NMS with Python fallback
  utils/         # model benchmarking (metric table, FLOPs, FPS)
  sdk.py         # high-level Python SDK: the Detector class (docs/sdk.md)
  runtime/       # torch-free ONNX inference: Detector, Detection, Image
  csrc/          # C++ kernels: box ops + shared letterbox preprocessing
  configs/       # packaged model family definitions (n, s, ex)
  cli.py         # `lofop` command: dataset / train / benchmark / export
cpp/             # C++ inference SDK (CMake): headers, C ABI, tests, example
configs/         # training config examples
docker/          # CPU, CUDA, and ONNX Runtime images
docs/            # architecture, per-module references, LOFOP-Detect design doc
benchmarks/      # reusable performance measurement scripts
examples/        # end-to-end runnable demos
tests/           # pytest suite mirroring the package layout (316 tests)

Development

python -m pytest                                   # run the test suite
ruff check lofop tests benchmarks examples         # lint
python benchmarks/bench_core.py -o report.md       # core engine micro-benchmarks
python benchmarks/bench_ops.py                     # C++ vs Python ops speedups
python benchmarks/bench_detect.py                  # detector params + latency
python benchmarks/run_suite.py                     # full suite -> results.md/.csv/.json

Every push and pull request runs the full test suite (Python 3.9/3.11/3.12, native C++ ops built), lint, a version-consistency check, and a distribution build check via GitHub Actions (.github/workflows/ci.yml), so main stays releasable.

Contributing

Contributions are welcome. See CONTRIBUTING.md for setup and the quality gates, CHANGELOG.md for release notes, and SECURITY.md for reporting vulnerabilities. Bug reports and feature requests use the issue templates.

Roadmap

Ordered by expected return: published pretrained checkpoints (GPU training runs), letterboxing, a torch-free tracking module, ONNX export for the segmentation/pose variants, then inference sources (video/RTSP/webcam), OpenVINO engines, and REST serving. The full subsystem map with per-phase status lives in docs/architecture.md.

Authors

DURGAMANI SASIKUMAR and Nishanandhini A. (Assistant Professor).

License

Apache License 2.0. See LICENSE.

Metadata

Release files for lofop 1.2.1

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

Source distribution (sdist)

Source distribution for lofop 1.2.1
File Size Uploaded Provenance Actions
lofop-1.2.1.tar.gz 144.4 kB With provenance Details for lofop-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lofop 1.2.1
File Interpreter ABI Platform Actions
lofop-1.2.1-py3-none-any.whl Python 3 none any Details for lofop-1.2.1-py3-none-any.whl

Total release size: 285.9 kB

Release files / lofop-1.2.1.tar.gz

Download URL lofop-1.2.1.tar.gz
Size 144.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c908212acd5190c4fd664cb9657dcfd954eebc23913c27a1035ddf57068bc758
BLAKE2b-256 checksum
How to use checksums
0a0e0f3ce66df5f0782c2890bdd39ad11509acfd4d52a2f30f6dabac37f9b301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release files / lofop-1.2.1-py3-none-any.whl

Download URL lofop-1.2.1-py3-none-any.whl
Size 141.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cac82b681edf8be25d3e5d5b3c88fcd26abdf6861c11fde2955965747181aee
BLAKE2b-256 checksum
How to use checksums
ed28fadf1eb4ac74d052c9063805a41b71c24975927deec4e35794df7c7b3b90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Security for lofop 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lofop-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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