A lightweight toolbox for NN model convert and infer on ARM SoC devices like RaspberryPi, OrangePi, LubanCat, etc.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xpi_nn_infer-0.0.1.tar.gz.
File metadata
- Download URL: xpi_nn_infer-0.0.1.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
045afa7081c5760df1c38b06fdf499d700e6ee2485ded614e07b4096c05e46bf
|
|
| MD5 |
0ebc7268c63a4043793d7be3161546bf
|
|
| BLAKE2b-256 |
5bcc4134814fa3f636388c95c51d3b9e6db6990bdf106b06bc426c7c1be66a86
|
File details
Details for the file xpi_nn_infer-0.0.1-py3-none-any.whl.
File metadata
- Download URL: xpi_nn_infer-0.0.1-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7cda7feb59d410bccaa61907010d4b6c436575aeb985820c4cafb0d7ddf80f3
|
|
| MD5 |
ad2e72eece6a7c8dc3ad6547ad010bb2
|
|
| BLAKE2b-256 |
dd7eee33bddd3e7077271c74ba9a30e44d2667f382101cc596bda6ed5547504a
|