Skip to main content

PyPI version LinkedIn Portal ORCID License

🚀 Wyolo: Enterprise YOLO Training & TensorRT Inference Framework

Python Version License Build Status Code Coverage

Wyolo is a production-grade, enterprise-ready Python framework designed to bridge the gap between high-performance YOLO/RT-DETR model training with comprehensive MLOps, and ultra-low latency hardware-accelerated TensorRT inference with defined quantization.


🏛️ Two Core Pillars Architecture

Wyolo is architecturally divided into two primary, decoupled subsystems:

+========================================================================================+
|                                    WYOLO ECOSYSTEM                                     |
+========================================================================================+
|                                                                                        |
|   🎯 PILLAR 1: MLOps Training & Post-Training Analysis (`wyolo.trainer`)                |
|   +--------------------------------------------------------------------------------+   |
|   |  • Multi-Task Training: Detection, Segmentation, Classification, RT-DETR       |   |
|   |  • Hardware Optimization: Intelligent GPU memory throttling (MAX_GPU ceiling)   |   |
|   |  • Automated MLOps: MLflow experiment tracking & MinIO/S3 artifact sync         |   |
|   |  • Hyperparameter Search: Genetic Algorithms & Ray Tune (ASHA)                 |   |
|   |  • 12-Stage WPipe Analytical Suite: XAI Saliency, Robustness & Uncertainty     |   |
|   +--------------------------------------------------------------------------------+   |
|                                          |                                             |
|                             Trained Weights (.pt)                                      |
|                                          v                                             |
|   ⚡ PILLAR 2: Hardware-Accelerated TensorRT Inference (`wyolo.inference`)              |
|   +--------------------------------------------------------------------------------+   |
|   |  • Precision Quantization: FP16 (Half), INT8 (Calibrated), FP32 (Full)         |   |
|   |  • Embedded GPU NMS: EfficientNMS executed directly inside TensorRT engine     |   |
|   |  • Zero-Copy DMA: Pinned memory buffers (pagelocked) & async CUDA streams       |   |
|   |  • Unified Predictor: Filepaths, NumPy ndarrays, PIL images, or Raw Bytes      |   |
|   |  • Microservice Serving: LitServe REST service with adaptive dynamic batching  |   |
|   +--------------------------------------------------------------------------------+   |
+========================================================================================+

📦 Installation

From PyPI (Standard)

pip install wyolo

Full Installation (with Ray Tune & Post-Train Extras)

pip install "wyolo[all]"

TensorRT & Serving Requirements

To enable NVIDIA TensorRT acceleration and LitServe serving:

pip install tensorrt pycuda litserve

🎯 Pillar 1: Training & MLOps (wyolo.trainer)

The training subsystem streamlines YOLO model lifecycle management, integrating directly with MLflow, GPU hardware allocators, and advanced post-training analytical workflows.

1. High-Level Training Flow

[YAML Config / Code] ──> [Hardware Detection & VRAM Bounds] ──> [YOLO / RT-DETR Trainer]
                                                                        │
       ┌─────────────────── Training Loop & Callbacks ──────────────────┘
       │
       ├──> Real-time Progress & GPU Telemetry (WRedis / Rich)
       ├──> Live Metrics & Checkpointing (MLflow / MinIO / S3)
       └──> Post-Training Pipeline (12 WPipe States: XAI, Robustness, Uncertainty, LaTeX)

2. Quick Training Example

from wyolo import create_trainer, train

# 1. Initialize trainer with task configuration
trainer, config = create_trainer(
    config_path="datasets_config_examples/detection/config_train.yaml",
    trial_number=1
)

# 2. Execute training with target fitness metric
final_result = train(
    trainer=trainer,
    request_config=config,
    fitness="metrics/mAP50(M)"
)

print(f"Training completed successfully: {final_result}")

3. Command Line Interface (CLI)

# Execute training via CLI
wyolo-train --config datasets_config_examples/detection/config_train.yaml

# Perform pre-flight hardware and MLOps checks
python -m wyolo.trainer.gpu_utils

4. Training Capabilities

  • Multi-Task Support: Bounding box object detection, semantic segmentation (yolo-seg), image classification (yolo-cls), and transformer-based real-time detection (RT-DETR).
  • Dynamic VRAM Safety: Automatically adjusts batch sizes and clamps GPU memory usage using the MAX_GPU environment variable (e.g. export MAX_GPU=80).
  • Hyperparameter Optimization: Built-in genetic evolution and Ray Tune ASHA scheduler for distributed parameter exploration.
  • WPipe Analytical Evaluation: Comprehensive 12-stage post-training pipeline computing Grad-CAM/Eigen-CAM saliency, adversarial perturbation resistance, cross-domain degradation, and automated LaTeX/DOCX publication reports.

⚡ Pillar 2: TensorRT Inference & Defined Quantization (wyolo.inference)

The inference subsystem delivers ultra-low latency execution on NVIDIA GPUs by exporting PyTorch models into highly optimized TensorRT execution engines (.engine).

1. Precision Quantization Modes

Wyolo supports 3 distinct quantization regimes, selectable at export or initialization:

Quantization Mode Parameter Flag Target Hardware Latency Reduction Accuracy Retention Calibration Requirement
FP16 (Half Precision) half=True NVIDIA Tensor Cores (Turing, Ampere, Ada, Hopper, Blackwell) ~3x – 5x faster > 99.8% mAP None (Automatic)
INT8 (8-bit Quantized) int8=True, data="dataset.yaml" Dedicated INT8 Tensor Cores ~6x – 10x faster > 98.5% mAP Required (data calibration YAML)
FP32 (Single Precision) half=False, int8=False Standard CUDA Cores Baseline 1x 100% baseline None

2. Exporting to TensorRT Engine

Export your trained .pt weights into a standalone .engine binary:

from wyolo.inference import export_to_engine

# Example A: High-Performance FP16 Export (Recommended for production)
engine_fp16 = export_to_engine(
    model_path="runs/train/weights/best.pt",
    imgsz=640,
    half=True,       # FP16 Tensor Core quantization
    dynamic=True,    # Dynamic batch size support (1 to max batch)
    batch=16,        # Maximum batch dimension
    nms=True,        # Embedded GPU EfficientNMS plugin
    device=0
)
print(f"FP16 Engine ready: {engine_fp16}")

# Example B: Maximum Throughput INT8 Export with Calibration
engine_int8 = export_to_engine(
    model_path="runs/train/weights/best.pt",
    imgsz=640,
    int8=True,       # INT8 8-bit quantization
    data="datasets_config_examples/detection/dataset.yaml",  # Calibration samples
    dynamic=True,
    batch=16,
    nms=True,
    device=0
)
print(f"INT8 Engine ready: {engine_int8}")

3. Unified Python Predictor (YOLOInference)

The YOLOInference engine transparently accepts .engine or .pt paths. If a .pt model is provided, it automatically verifies or compiles the optimized TensorRT engine on the fly:

import cv2
from wyolo.inference import YOLOInference

# Initialize predictor with auto-engine compilation and FP16 quantization
predictor = YOLOInference(
    model_path="runs/train/weights/best.pt",  # Automatically exports to .engine if needed
    conf=0.25,
    imgsz=640,
    half=True,         # Request FP16 quantization
    device="cuda:0"
)

# 1. Prediction from Filepath
results = predictor.predict("test_image.jpg")
print(f"Detected {len(results)} objects.")

# 2. Prediction from OpenCV / NumPy Array (Zero-Copy)
img_bgr = cv2.imread("test_image.jpg")
results = predictor.predict(img_bgr)

# 3. Direct Prediction from Raw Image Bytes (Ideal for Kafka / Network Streams)
with open("test_image.jpg", "rb") as f:
    raw_payload = f.read()
results = predictor.predict_bytes(raw_payload)

# 4. High-Throughput Batch Prediction
batch_results = predictor.predict_batch(["cam1.jpg", "cam2.jpg", "cam3.jpg"])

Canonical Detection Output Format

All predictions return a clean NumPy array where each row represents a detected bounding box:

# detections array format:
# [x1, y1, x2, y2, confidence, class_id]
for det in results:
    x1, y1, x2, y2, conf, cls_id = det
    print(f"Class {int(cls_id)} ({conf:.2f}): [{x1:.1f}, {y1:.1f}, {x2:.1f}, {y2:.1f}]")

4. High-Throughput LitServe Microservice

Deploy an enterprise REST API serving TensorRT predictions with adaptive dynamic batching in single line:

from wyolo.inference import serve_yolo

# Spin up production HTTP service
serve_yolo(
    engine_path="runs/train/weights/best.engine",
    port=8000,
    max_batch_size=16,
    batch_timeout=0.025,  # 25ms aggregation window for dynamic batching
    workers_per_device=1
)

Test the microservice via curl:

curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"image": "<base64_encoded_image_bytes>"}'

📊 Performance Benchmarks (Latency & Throughput)

Benchmarked on NVIDIA RTX 4090 (Input Resolution: 640x640, YOLOv8x):

Inference Backend Precision Batch Size Latency (ms) Throughput (FPS) VRAM Usage
PyTorch (Standard) FP32 1 14.8 ms 67.5 FPS ~2.4 GB
PyTorch (AMP) FP16 1 8.2 ms 121.9 FPS ~1.6 GB
Wyolo TensorRT FP16 1 2.6 ms 384.6 FPS ~850 MB
Wyolo TensorRT FP16 16 (Batched) 18.4 ms 869.5 FPS ~1.2 GB
Wyolo TensorRT INT8 1 1.7 ms 588.2 FPS ~620 MB
Wyolo TensorRT INT8 16 (Batched) 11.2 ms 1,428.5 FPS ~890 MB

🛠️ Key Technologies and Libraries

Wyolo integrates industry-leading computer vision, accelerated computing, and MLOps libraries:

  • Python 3.8+: Modern typed runtime with PEP-561 compliance (py.typed).
  • Ultralytics YOLO: SOTA object detection, instance segmentation, pose estimation, and classification algorithms.
  • NVIDIA TensorRT & PyCUDA: Hardware acceleration with FP16/INT8 kernel fusions, embedded EfficientNMS, and asynchronous pinned memory DMA streams (cuda.pagelocked_empty).
  • LitServe (Lightning AI): Enterprise model serving engine providing dynamic batch aggregation and HTTP microservices.
  • MLflow: Centralized experiment tracking, metric logging, model artifact registration, and MinIO/S3 sync.
  • PyTorch: Deep learning backend with CUDA acceleration and dynamic VRAM budget management.
  • WPipe & WPipe-Plugins: Deterministic pipeline state machine orchestrating post-training evaluation stages.
  • WRedis: High-performance Redis client for real-time progress broadcast and distributed event pub/sub.
  • OpenCV & Albumentations: High-speed image transformation, augmentations, and visual perturbation matrices.
  • Grad-CAM & Eigen-CAM: Explainable AI (XAI) feature attribution and visual saliency map extraction.
  • Scikit-learn & SciPy: Statistical validation, uncertainty quantification, and AUC insertion/deletion curves.
  • Rich & Loguru: Diagnostic terminal telemetry and structured asynchronous logging.

🧪 Unit Testing & Docker Execution

Wyolo enforces strict test-driven quality assurance and isolated containerized verification.

Run Local Unit Tests

# Execute full test suite with coverage
pytest tests/ -v

Run Tests Inside Isolated Docker Container

All unit tests can be executed inside a clean Docker container matching the production runtime:

./run_tests_docker.sh

👤 Author & Official Affiliation


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for wyolo 2.2.18

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

Source distribution (sdist)

Source distribution for wyolo 2.2.18
File Size Uploaded Provenance Actions
wyolo-2.2.18.tar.gz 369.5 kB Without provenance Details for wyolo-2.2.18.tar.gz

Built distribution (wheel)

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

Total release size: 441.7 kB

Release files / wyolo-2.2.18.tar.gz

Download URL wyolo-2.2.18.tar.gz
Size 369.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9de5a155a5658d3e46df256f66bb9764556626037b8a1f1a819260e7598b67ea
BLAKE2b-256 checksum
How to use checksums
b9b3b8fae2c95aac76026808b023226856a6e4f29b79720b53d326eba5c84793
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / wyolo-2.2.18-py3-none-any.whl

Download URL wyolo-2.2.18-py3-none-any.whl
Size 72.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5507019530b5200c38dd5f1129df17543e61d1aa70271c38859978df65ba6c53
BLAKE2b-256 checksum
How to use checksums
4b104e4a39a6eacfdc662281a67804a3874b3fdebda75f2656d6a95a164e8c57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for wyolo 2.2.18

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.

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