acmenra-yolo
Acmenra backend for YOLO models. Plugs into acmenra-cv. Ultralytics is the engine, not the product.
# acmenra-cv >= 0.3.3.1 is required (PrecisionType)
pip install acmenra-yolo
0.2.0.1 breaks 0.1.x. half=True/False is gone. Pass precision=PrecisionType.FP32, PrecisionType.FP16, or PrecisionType.AUTO.
Overview
acmenra-yolo is Acmenra's YOLO backend for acmenra-cv. It implements the Backend contract on top of Ultralytics: detection, instance segmentation, and oriented boxes (YOLOv8 / YOLO11).
The core stays light. Projects that run OpenVINO, TensorRT, or their own weights do not install this package and do not pull ultralytics or torch.
| Feature | What it does |
|---|---|
| Tasks | Detect, segment, and OBB through one backend. |
| Tracking | YOLO's own tracker (BoT-SORT) when track=True. OBB gets a frame-local id. |
| Masks | refined=True turns on retina_masks. |
| Precision | PrecisionType: AUTO, FP32, FP16. New Ultralytics gets quantize, old gets half. |
| Timing | Preprocess, inference, and postprocess from YOLO's speed dict. |
| Devices | DeviceType: CPU, CUDA, MPS, TensorRT, and the rest of the enum. |
| Contract | Returns acmenra_cv.Result. Tracker and Drawer do not know it is YOLO. |
Key points
- Implements
acmenra_cv.Backend.iou,imgsz,precision, andrefinedare checked in setters. boxes,masks, andobbare routed off the result, not off a string you pass twice.refined=Truebuilds masks at model resolution. Expect about 20–30% slower inference. Detect and OBB ignore it.- FP16 on CPU is stored, then
predict()runs FP32. - Do not pass
halforquantizeintopredict(). Those keys belong toprecision. track=Truekeeps ids on detect and segment. OBB does not. The backend assigns0..n-1for that frame and logs it.
Quick start
from enum import Enum
import numpy as np
from acmenra_cv import DeviceType, TaskType, Tracker, PrecisionType
from acmenra_yolo import YOLOBackend
from ultralytics import YOLO
class CocoClass(Enum):
PERSON = 0
CAR = 2
model = YOLO("yolov8n-seg.pt")
backend = YOLOBackend(
model=model,
device=DeviceType.MPS, # CPU, CUDA_0, TENSORRT, ...
category=CocoClass, # the Enum class, not a member
task_type=TaskType.SEGMENT,
threshold=0.35,
iou=0.7,
imgsz=640,
precision=PrecisionType.FP32, # FP16, or AUTO to leave it to Ultralytics
refined=True,
)
tracker = Tracker(id=0, backend=backend, max_length=30)
frame = np.zeros((1080, 1920, 3), dtype=np.uint8) # BGR
tracked_objects = tracker.track(frame, enable_tracking=True)
for obj in tracked_objects:
print(obj.id, obj.instance.label.name, f"{obj.instance.conf:.2f}")
# obj.instance.box, obj.instance.polygon, obj.instance.obb
API
class YOLOBackend
YOLO implementation of acmenra_cv.Backend.
Properties
| Property | Type | Rule |
|---|---|---|
model |
YOLO |
Replacing it sets _is_update. |
iou |
float |
[0.0, 1.0]. |
imgsz |
int |
> 0. Multiple of 32 is a YOLO habit, not checked here. |
precision |
PrecisionType |
AUTO, FP32, FP16 only. Anything else in the enum raises ValueError. |
refined |
bool |
Maps to retina_masks. Segment only. |
Methods
| Method | Returns | Notes |
|---|---|---|
predict() |
Result |
max_det, track, verbose, plus Ultralytics *args/**kwargs. Managed keys win: source, device, conf, imgsz, iou, retina_masks, persist. Needs tests. |
_process_bbox_results() |
List[Instance] |
Detect. Needs tests. |
_process_obb_results() |
List[Instance] |
Pixels → [0.0, 1.0] via normalize_xywhr. Needs tests. |
_process_seg_results() |
List[Instance] |
Polygon.from_xyn. Needs tests. |
normalize_xywhr() |
list[float] |
[cx, cy, w, h, angle_rad]. Angle stays in radians. |
_precision_kwargs() |
dict |
AUTO → {}. New Ultralytics → quantize=16/32. Old → half. CPU + FP16 → FP32. |
Result.width / Result.height come from orig_shape as (height, width).
Requirements
acmenra-cv>=0.3.3.1
ultralytics>=8.0.0
torch>=1.8.0
opencv-python>=4.5.0
Dev:
pytest>=7.0.0
black>=23.0.0
mypy>=1.0.0
Testing
Setters, __str__, and __repr__ are covered with DDT and a mocked YOLO. predict() is not.
pytest tests/
pytest tests/inference/backends/
Covered:
- Type and range checks for
device,category,task_type,threshold,iou,imgsz,precision,refined,model PrecisionTypeoutsideYOLOBackend.supported(skipped if the enum has no extra members)- 90 constructor fixtures, including FP16 stored on CPU
Not covered: predict(), mask / box / obb conversion, and the half vs quantize branch.
License
GNU Affero General Public License v3 or later (AGPL-3.0-or-later), same as acmenra-cv. See LICENSE.
Links
- PyPI: https://pypi.org/project/acmenra-yolo/
- acmenra-cv: https://pypi.org/project/acmenra-cv/
- Source: https://github.com/Acmenra/acmenra-yolo
- Issues: https://github.com/Acmenra/acmenra-yolo/issues
acmenra.studio. The box runs the model. This package only talks to it.
Metadata
Release files for acmenra-yolo 0.2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| acmenra_yolo-0.2.0.1.tar.gz | 24.5 kB | Without provenance | Details for acmenra_yolo-0.2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| acmenra_yolo-0.2.0.1-py3-none-any.whl | Python 3 | none | any | Details for acmenra_yolo-0.2.0.1-py3-none-any.whl |
Total release size: 46.9 kB
Release files / acmenra_yolo-0.2.0.1.tar.gz
| Download URL | acmenra_yolo-0.2.0.1.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dad1d381aba3c20cdb878aaccf13c6c4f91c900236be389f1c90d1e3d9bca2e
|
|
BLAKE2b-256 checksum How to use checksums |
d969005f99de3dd7621865b1390ac21f79430c8a609b81089043a77ea4c3313c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / acmenra_yolo-0.2.0.1-py3-none-any.whl
| Download URL | acmenra_yolo-0.2.0.1-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad3f1ca8cc8ed13f41de4f48bb1393a1b19caa5fd68c04c3eccf7282c01a94d9
|
|
BLAKE2b-256 checksum How to use checksums |
a41291968ffdab231e3146b4b14818c8c5f0aa317c89aa699755b50c4d0eabbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for acmenra-yolo 0.2.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.