xpi-nn-infer
A lightweight toolbox for NN model convert and infer on ARM SoC devices like RaspberryPi, OrangePi, LubanCat, etc.
Installation
You can either install from PyPI:
# create venv (optional but recommended!!)
conda create -n xpi python==3.13 # py3.10 or later
conda activate xpi
# install framework
pip install xpi-nn-infer
# install default backends
python -m xpi_nn_infer.tools.install_default_backends -y
or install locally:
# create venv (optional but recommended!!)
conda create -n xpi python==3.13 # py3.10 or later
conda activate xpi
# clone this repo
git clone https://gitee.com/kahsolt/xpi-nn-infer.git
cd xpi-nn-infer
# install locally
pip install -e .
# install default backends
python -m xpi_nn_infer.tools.install_default_backends -y
Usage
⚪ Use via command line
# benchmark with random inputs
python -m xpi_nn_infer.tools.benchmark_torchvision -K torch
python -m xpi_nn_infer.tools.benchmark_torchvision -K onnx -M mobilenet_v3_small
python -m xpi_nn_infer.tools.benchmark_torchvision -K openvino -M mobilenet_v3_large # cls
python -m xpi_nn_infer.tools.benchmark_torchvision -K openvino -M lraspp_mobilenet_v3_large # seg
python -m xpi_nn_infer.tools.benchmark_torchvision -K openvino -M ssdlite320_mobilenet_v3_large # det (but not supported yet :(
# infer from random inputs, image file or folder
python -m xpi_nn_infer.tools.infer_torchvision -K openvino -M resnet18 -I random
python -m xpi_nn_infer.tools.infer_torchvision -K openvino -M resnet18 -I path/to/your/image.jpg
python -m xpi_nn_infer.tools.infer_torchvision -K openvino -M resnet18 -I path/to/your/image_folder
⚪ Use via API
ℹ TODO! TODO!! TODO!!!
Configurations
ℹ xpi-nn-infer is a bare framework, you need configure backends to make it work.
Envvars
- MODEL_PATH: folder path for auto-downloaded or converted model checkpoints, defaults to
<site-packages>/xpi_nn_infer/MODEL_PATH(PyPI install) or<xpi-nn-infer>/MODEL_PATH(local install)
Model providers
Thanks to all the open-source model providers 🎉
| name | supported | comment |
|---|---|---|
| torchvision | √ | |
| ultralytics | ||
| paddleocr | ||
| transformers | ||
| diffusers | ||
| modelscope |
NN backends
| name | supported | comment |
|---|---|---|
| torch | √ | |
| tensorflow | ||
| tflite | ||
| paddle | ||
| paddlelite | ||
| onnx | √ | |
| openvino | √ | |
| ncnn | ||
| mnn | ||
| mace |
IO backends (⚠ Work In Progress!!)
| name | supported | type | comment | | :-: | :-: | :-: | | pillow | √ | img | | | skimage | | img | | | imageio | | img | | | torchvision | | img | | | cv2 | | img/cam | | | rpicam | | cam | | | ffmpy | | vid | | | moviepy | | vid | | | wave | | aud | | | soundfile | | aud | | | sounddevice | | mic | | | pyaudio | | aud/mic | | | pydub | | aud | | | librosa | | aud | | | scipy | | aud | |
Supported Devices
- BCM2837: RaspberryPi 3B
- H618: OrangePi Zero 3
- RK3576: LubanCat3
- RK3399: FMX1 Pro, MRK3399
Metadata
Release files for xpi-nn-infer 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xpi_nn_infer-0.0.1.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xpi_nn_infer-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.9 kB
Release files / xpi_nn_infer-0.0.1.tar.gz
| Download URL | xpi_nn_infer-0.0.1.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
045afa7081c5760df1c38b06fdf499d700e6ee2485ded614e07b4096c05e46bf
|
|
BLAKE2b-256 checksum How to use checksums |
5bcc4134814fa3f636388c95c51d3b9e6db6990bdf106b06bc426c7c1be66a86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / xpi_nn_infer-0.0.1-py3-none-any.whl
| Download URL | xpi_nn_infer-0.0.1-py3-none-any.whl |
|---|---|
| Size | 32.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7cda7feb59d410bccaa61907010d4b6c436575aeb985820c4cafb0d7ddf80f3
|
|
BLAKE2b-256 checksum How to use checksums |
dd7eee33bddd3e7077271c74ba9a30e44d2667f382101cc596bda6ed5547504a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|