Skip to main content

Quickstart

trolo is a framework for harnessing the power of transformers with YOLO models and other single-shot detectors!

Installation

pip install trolo

Key Features

  • 🔥 Transformer-enhanced object detection
  • 🎯 Single-shot detection capabilities
  • ⚡ High performance inference
  • 🛠️ Easy to use CLI interface
  • 🚀 Fast video stream inference
  • 🧠 Automatic DDP handling

Available Models

trolo provides several state-of-the-art detection models:

🔥 NEW 🔥 D-FINE

The D-FINE model redefines regression tasks in DETR-based detectors using Fine-grained Distribution Refinement (FDR). Official Paper | Official Implementation

D-FINE Stats

ModelAPvalSizeLatency
dfine-n42.84M2.12ms
dfine-s48.510M3.49ms
dfine-m52.319M5.62ms

Find all the available models here.

Inference

CLI Interface

The basic command structure is:

trolo [command] [options]

For help:

trolo --help # general help
trolo [command] --help # command-specific help

Python API

from trolo.inference import DetectionPredictor

predictor = DetectionPredictor(model="dfine-n")
predictions = predictor.predict() # get predictions
plotted_preds = predictor.visualize(show=True, save=True) # visualize outputs

Visit the inference section for detailed usage instructions.

Training

CLI Interface

The basic command structure is:

trolo train [options]

Basic training examples:

trolo train --config dfine_n  # train using built-in config
trolo train --model dfine-n --dataset coco # specify model and dataset separately

🔥 Automatic multi-GPU handling. Just specify the devices:

trolo train --device 0,1,2,3  # multi-GPU training

Python API

from trolo.trainers import DetectionTrainer

# Initialize trainer
trainer = DetectionTrainer(
config="dfine_n"
)

# Start training
trainer.fit() # single GPU
trainer.fit(device="0,1,2,3") # multi-GPU

Visit the Training section for detailed configuration options.