|
1 | | -# rknpu2-rs |
| 1 | +# RKNN |
2 | 2 |
|
3 | | -Rust bindings for the [Rockchip RKNN API (rknpu2)](https://github.com/airockchip/rknn-toolkit2), targeting deployment of deep learning models on Rockchip NPUs. |
| 3 | +Rust bindings for the Rockchip RKNN Runtime API (librknnrt.so), enabling deployment of deep learning models on Rockchip NPUs. This library is a key component of the rknpu2 SDK, providing efficient integration between Rust applications and Rockchip's neural processing unit for optimized AI model execution. |
4 | 4 |
|
5 | 5 | > These bindings do **not** require redistributing the C headers from the Rockchip rknpu2 SDK. The sys crate contains bindgen bindings, but bindgen is not part of the build process. |
6 | 6 |
|
7 | 7 | ## Requirements |
8 | 8 |
|
9 | | -- Rockchip NPU compatible with librknnrt or librknnmrt libraries. |
| 9 | +- Rockchip NPU compatible with `librknnrt` or `librknnmrt` libraries |
| 10 | +- Rust 1.70+ (edition 2021) |
10 | 11 |
|
11 | 12 | ## Features |
12 | 13 |
|
13 | 14 | - Safe and idiomatic Rust abstractions over the `librknnrt.so` C API |
14 | 15 | - Support for loading models, setting inputs, running inference, and reading outputs |
15 | | -- There will be Zero-copy input/output buffer support |
| 16 | +- Zero-copy input/output buffer support (planned) |
16 | 17 | - Includes both low-level `-sys` bindings and higher-level wrappers |
17 | 18 | - Based on the **rknpu2 SDK v2.3.2** |
| 19 | +- Comprehensive error handling with custom error types |
| 20 | +- Memory-safe tensor operations and buffer management |
18 | 21 |
|
19 | | -## Version Compatibility |
20 | 22 |
|
21 | | -These bindings are aligned with the **2.3.2** release of the RKNN API. |
22 | | -[rknn C API v2.3.2 PDF](https://github.com/airockchip/rknn-toolkit2/blob/42aa1d426c0a9e0869b6374edba009f7208a1926/doc/04_Rockchip_RKNPU_API_Reference_RKNNRT_V2.3.2_EN.pdf) |
| 23 | +## Project Structure |
23 | 24 |
|
| 25 | +``` |
| 26 | +crates/ |
| 27 | +├── rknpu2/ # High-level Rust API wrapper |
| 28 | +├── rknpu2-sys/ # Low-level FFI bindings |
| 29 | +└── rktensor/ # Tensor operations and utilities |
| 30 | +``` |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +Add the following to your `Cargo.toml`: |
| 35 | + |
| 36 | +```toml |
| 37 | +[dependencies] |
| 38 | +rknpu2 = { git = "https://github.com/CodeVoyager15/RKNN", package = "rknpu2" } |
| 39 | +rktensor = { git = "https://github.com/CodeVoyager15/RKNN", package = "rktensor" } |
| 40 | +``` |
24 | 41 |
|
25 | 42 | ## Usage |
26 | 43 |
|
27 | | -Coming soon! |
| 44 | +Coming soon! The library will provide a simple and intuitive API for: |
| 45 | + |
| 46 | +- Loading RKNN models |
| 47 | +- Setting input tensors |
| 48 | +- Running inference |
| 49 | +- Retrieving output results |
| 50 | +- Managing memory and buffers efficiently |
| 51 | + |
| 52 | +## Examples |
| 53 | + |
| 54 | +Check out the examples in `crates/rknpu2/examples/` for usage demonstrations. |
| 55 | + |
| 56 | +## Development Status |
| 57 | + |
| 58 | +This project is actively maintained and follows Rust best practices. Contributions are welcome! |
| 59 | + |
| 60 | +## License |
| 61 | + |
| 62 | +This project is licensed under either of |
| 63 | + |
| 64 | +- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) |
| 65 | +- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
| 66 | + |
| 67 | +at your option. |
| 68 | + |
| 69 | +## Contributing |
| 70 | + |
| 71 | +Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change. |
0 commit comments