Native object detection, instance segmentation, and image classification in Rust with Burn
Montgomery is an experimental Rust computer-vision stack:
- Computer vision inference on CPU or GPU
- WGPU training with validation, resumable checkpoints, and ready-to-use exports
- Detection, instance segmentation, and classification
- Burnpack and ONNX export
Normal inference needs no Python, PyTorch, or ONNX Runtime.
| Model | Variants | Tasks |
|---|---|---|
| YOLOX | nano, tiny, s, m, l, x |
Detect |
| YOLOv3 | tinyu |
Detect |
| YOLOv8 | n, s, m, l, x |
Detect, segment, classify |
| YOLOv10 | n, s, m, b, l, x |
Detect |
| YOLO11 | n, s, m, l, x |
Detect, segment, classify |
| YOLO12 | n, s, m, l, x |
Detect |
| YOLO26 | n, s, m, l, x |
Detect, segment, classify |
use montgomery::Model;
fn main() -> montgomery::Result<()> {
let model = Model::new("yolo26n.bpk")?;
let prediction = model.inference("image.jpg")?;
for detection in prediction.detections().expect("detection model") {
println!("{}: {:.1}%", detection.class_name, detection.confidence * 100.0);
}
Ok(())
}montgomery predict --model best.bpk --source image.jpg --jsonBenchmark cold-start and steady-state inference without loading an image:
montgomery bench --device gpu --model best.bpk# Fresh initialization
montgomery train --architecture yolo26n --data dataset.yaml --epochs 100
# Pretrained initialization
montgomery train --model yolo26n.bpk --data dataset.yaml --epochs 100
# Exact continuation (model and dataset come from the training checkpoint)
montgomery train --resume runs/train/checkpoints/lastExactly one initialization mode is required: --architecture means scratch, --model requires a
pretrained .bpk, and --resume requires a full native training checkpoint. A Burnpack initializes
a new run; it is not a resumable optimizer checkpoint.
Every run contains:
results.csv,results.svg, andvalidation.jsonlexports/best.bpkandexports/last.bpkcheckpoints/bestandcheckpoints/last
Only the best and latest resumable models are retained.
Use --save-period to control recovery checkpoints and --workers to override automatic CPU
worker selection.
montgomery export-onnx --model yolo26n.bpkThis reads the explicit Burnpack and writes yolo26n.onnx; use --output to select another path.
The offline exporter validates the graph with ONNX Runtime. Setup details are in tools/onnx/README.md.
Stable Rust is the only requirement to start development
git clone https://github.com/boquila/montgomery.git && cd montgomery
cargo testThe same checks used by CI are:
cargo fmt --check
cargo test
cargo clippy --all-targets -- -D warnings
cargo check --no-default-features --libSee docs/MODEL_BRINGUP.md for new model families.
Montgomery is AGPL-3.0.
