https://github.com/darkautism/rknn-rs
rknn rust ffi binding
https://github.com/darkautism/rknn-rs
ai embedded-rust embedded-systems rk3588 rknn rknpu2 rust
Last synced: 3 months ago
JSON representation
rknn rust ffi binding
- Host: GitHub
- URL: https://github.com/darkautism/rknn-rs
- Owner: darkautism
- Created: 2025-02-27T18:32:34.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2026-02-26T17:08:56.000Z (4 months ago)
- Last Synced: 2026-02-26T22:54:05.270Z (4 months ago)
- Topics: ai, embedded-rust, embedded-systems, rk3588, rknn, rknpu2, rust
- Language: C
- Homepage: https://github.com/darkautism/rknn-rs
- Size: 64.5 KB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# RKNN for rust [](https://deps.rs/repo/github/darkautism/rknn-rs)
## Features
* **Rusty API**: Encapsulates the C-based `rknn_api` into safe Rust structs and methods.
* **Resource Management**: Implements resource release mechanisms to prevent memory leaks.
## Version compatibility
| Component | Version |
| --- | --- |
| rknn-rs | 0.2.4 |
| rknn-sys-rs | 0.1.2 |
| RKNN Toolkit | 2.3.2 |
## Changelog
Migrating to version 0.2.x involves API changes. Please refer to the Change log for details.
[Changelog](CHANGELOG.md)
## rknnmrt support
Just add the `rknnmrt` feature gate into your `Cargo.toml`.
## Example
```rust
use rknn_rs::prelude::*;
fn main() -> Result<(), Box> {
let rknn = Rknn::rknn_init("/home/kautism/SenseVoiceSmall-RKNN2/sense-voice-encoder.rknn")?;
rknn.input_set_slice(
0, // Set according to your input index
&flattened_input, // Borrowed input slice (no extra clone)
false, // Usually false, unless the model requires special handling
RknnTensorType::Float32,
RknnTensorFormat::NCHW,
)?;
let asr_output = rknn.outputs_get::()?;
// Do something with the data
Ok(())
}
```
## LICENSE
MIT
## Contributing
Issues and Pull Requests are welcome\! If you find any missing API bindings or have ideas for better implementations, please feel free to share. Any contributions will be automatically covered under the MIT LICENSE.
## Example project

## Support the Project
If this project has saved you time or helped you in your workflow, consider supporting its continued development. Your contribution helps me keep the project maintained and feature-rich!
[![][ko-fi-shield]][ko-fi-link]
[![][paypal-shield]][paypal-link]
[ko-fi-shield]: https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white
[ko-fi-link]: https://ko-fi.com/kautism
[paypal-shield]: https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white
[paypal-link]: https://paypal.me/kautism