# Does this rust crate ultralytics\_inference support ncnn?

**URL:** https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766
**Category:** YOLO
**Tags:** support
**Created:** [January 18, 2026, 2:33pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766 "2026-01-18T14:33:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![samturner](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samturner](https://community.ultralytics.com/u/samturner)
#### Post date: [January 18, 2026, 2:33pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/1 "2026-01-18T14:33:46Z")

</div>

I have this code:

```rs
use ultralytics_inference::{YOLOModel, InferenceConfig};

fn main()
{
    // Load your custom NCNN model (auto-detects format)
    let mut model = YOLOModel::load("custom_ncnn_model/").unwrap();
    
    // Configure exactly like Python predict params
    let mut config = InferenceConfig::default();
    config.confidence_threshold = 0.6; // Confidence threshold
    //config. = true; // Real-time display window
    //config.line_thickness = 2; // Box line thickness
    config.save = false; // No output saving
    //config.stream = true; // Process video frame-by-frame

    // Run prediction (handles video streaming + visualization automatically)
    //model.predict_config("video.mp4", config);
    model.predict("video.mp4").unwrap();
}

```

However I get this error:

```cmd
thread 'main' (100562) panicked at src/main.rs:6:59:
called `Result::unwrap()` on an `Err` value: ModelLoadError("Failed to load model: Load model from custom_ncnn_model/ failed:Protobuf parsing failed.")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

```

Doesn’t this crate support `ncnn` models? Do I _have_ to use `oxnn` instead?

---

<div class="post-metadata">

### Author: ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)
#### Post date: [January 18, 2026, 2:39pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/2 "2026-01-18T14:39:56Z")

</div>

According to the project [Readme](https://github.com/ultralytics/inference?tab=readme-ov-file#-ultralytics-yolo-rust-inference), only ONNX is supported at the moment. I know there are plans to include as many/all of the formats, but the project is still in early development (really experimental), so not certain when all formats will have support.  
I’m not familiar with Rust personally, so I can’t review the project directly. I will double check with the person working on the project and let you know as soon as possible, but they had some time off recently so it may take a bit of time.

---

<div class="post-metadata">

### Author: ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)
#### Post date: [January 18, 2026, 2:51pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/3 "2026-01-18T14:51:34Z")

</div>

Checked with Copilot and the Ultralytics Assistant, and it appears that as of now, the [Ultralytics Rust inference project] ([GitHub - ultralytics/inference: Rust inference package experiments](https://github.com/ultralytics/inference)) only supports ONNX models. I’ll follow up with info about `ncnn` support when I hear back.

---

<div class="post-metadata">

### Author: ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)
#### Post date: [January 18, 2026, 3:45pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/4 "2026-01-18T15:45:09Z")

</div>

Heard back. Sounds like `ncnn` is planned much later in the roadmap, and since the project is still considered experimental, it could be a while. If you’d like to use the `ultralytics_inference` Rust crate, you’ll have to stick with ONNX for now. Of course, if you would like to contribute support for `ncnn`, a PR is welcome, but no guarantee it’ll be accepted.

---

<div class="post-metadata">

### Author: ![samturner](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@samturner](https://community.ultralytics.com/u/samturner)
#### Post date: [January 19, 2026, 6:46am UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/5 "2026-01-19T06:46:26Z")

</div>

Hi mate thank you mate for your assistance, I really appreciate it 🙂

I just have a couple of more questions regarding this:

1. Is `onnx` with yolo26n supposed to be still usable/fast on a raspberry pi, even though afaik `ncnn` is more recommended for those kinds of devices?
2. Is using rust with `onnx` faster than using `ncnn` with Python?

> [@BurhanQ](#):
>
> Of course, if you would like to contribute support for `ncnn`, a PR is welcome, but no guarantee it’ll be accepted.

I wish I could but sadly I don’t have the low level experience 😕

---

<div class="post-metadata">

### Author: ![BurhanQ](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/burhanq/32/7_2.png) [@BurhanQ](https://community.ultralytics.com/u/BurhanQ)
#### Post date: [January 19, 2026, 12:57pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/6 "2026-01-19T12:57:27Z")

</div>

> [@samturner](#):
>
> - Is `onnx` with yolo26n supposed to be still usable/fast on a raspberry pi, even though afaik `ncnn` is more recommended for those kinds of devices?

Both formats are good for running on RPi, and `ncnn` does have a lower inference time than `onnx`. It’s a compute and power constrained device, so it won’t be _fast_ but it can be reasonable. The question really becomes, what’s acceptable for your use case? It can be nice to have the faster option, but the question really would be, how fast do you need it to be?

> [@samturner](#):
>
> 1. Is using rust with `onnx` faster than using `ncnn` with Python?

I can’t say from experience, and I’m not sure if anyone has run any tests. Most of Ultralytics developers are familar and use Python, but obviously there are a few Rustacians out there. If I were to guess, I suspect the model inference time for `onnx` and `ncnn` might not change much between Python and Rust, since usually that’s a model/hardware constraint. The end-to-end time (including pre- and post-processing, as well as the image/video loading) is likely to be the bigger distinguishing factor. I suspect, I don’t know, that Rust will do this faster, however I don’t know _how much_ faster.  
I recommend doing some quick testing to find out, both for yourself and others in the community. I’d wager that if you compare the Rust inference using `onnx` and Python using `ncnn`, that they might come out to be relatively close overall, since the `ncnn` inference time is much lower than `onnx` for RPi. If that’s the case, then I’d recommend going with which ever language you’re more familar with, as it’ll simplify the work you have to do going forward. Even if one is faster than the other, if the difference isn’t enough to impact your use case (you’re the only one who will know the answer to that), I’d still recommend using whichever language you’re more familar with.

---

<div class="post-metadata">

### Author: ![lakshanthad](https://sea1.discourse-cdn.com/flex001/user_avatar/community.ultralytics.com/lakshanthad/32/68_2.png) [@lakshanthad](https://community.ultralytics.com/u/lakshanthad)
#### Post date: [January 27, 2026, 11:12pm UTC](https://community.ultralytics.com/t/does-this-rust-crate-ultralytics-inference-support-ncnn/1766/7 "2026-01-27T23:12:20Z")

</div>

@samturner I would like to shed more light on the question regarding speed comparisons between ONNX with Rust and NCNN with Python on Raspberry Pi 5 by sharing my results:

### ONNX with Rust

```auto
Speed: 4.4ms preprocess, 91.8ms inference, 0.6ms postprocess per image at shape (1, 3, 384, 640)

```

### NCNN with Python

```auto
Speed: 6.6ms preprocess, 85.2ms inference, 2.0ms postprocess per image at shape (1, 3, 640, 640)

```

Hope it helps 🙂

cc: @BurhanQ
