A neural network compiler for AI accelerators
Project description
nncase
is a neural network compiler for AI accelerators.
Telegram: nncase community Technical Discussion QQ Group: 790699378 . Answer: 人工智能
Tips
- [2024/05/28] [BUG] nncase v2.8.3: ReduceSum(onnx) has a BUG that causes segmentfault. Please downgrade to v2.8.2, if your model has ReduceSum.
K230
- Usage
- FAQ
- Example
- Colab run
- Version relationship between
nncase
andK230_SDK
- update nncase runtime library in SDK
Install
-
Linux:
pip install nncase nncase-kpu
-
Windows:
1. pip install nncase 2. Download `nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl` in below link. 3. pip install nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl
All version of nncase
and nncase-kpu
in Release.
Supported operators
benchmark test
kind | model | shape | quant_type(If/W) | nncase_fps | tflite_onnx_result | accuracy | info |
---|---|---|---|---|---|---|---|
Image Classification | mobilenetv2 | [1,224,224,3] | u8/u8 | 600.24 | top-1 = 71.3% top-5 = 90.1% | top-1 = 71.1% top-5 = 90.0% | dataset(ImageNet 2012, 50000 images) tflite |
resnet50V2 | [1,3,224,224] | u8/u8 | 86.17 | top-1 = 75.44% top-5 = 92.56% | top-1 = 75.11% top-5 = 92.36% | dataset(ImageNet 2012, 50000 images) onnx | |
yolov8s_cls | [1,3,224,224] | u8/u8 | 130.497 | top-1 = 72.2% top-5 = 90.9% | top-1 = 72.2% top-5 = 90.8% | dataset(ImageNet 2012, 50000 images) yolov8s_cls(v8.0.207) | |
Object Detection | yolov5s_det | [1,3,640,640] | u8/u8 | 23.645 | bbox mAP50-90 = 0.374 mAP50 = 0.567 | bbox mAP50-90 = 0.369 mAP50 = 0.566 | dataset(coco val2017, 5000 images) yolov5s_det(v7.0 tag, rect=False, conf=0.001, iou=0.65) |
yolov8s_det | [1,3,640,640] | u8/u8 | 9.373 | bbox mAP50-90 = 0.446 mAP50 = 0.612 mAP75 = 0.484 | bbox mAP50-90 = 0.404 mAP50 = 0.593 mAP75 = 0.45 | dataset(coco val2017, 5000 images) yolov8s_det(v8.0.207, rect = False) | |
Image Segmentation | yolov8s_seg | [1,3,640,640] | u8/u8 | 7.845 | bbox mAP50-90 = 0.444 mAP50 = 0.606 mAP75 = 0.484 segm mAP50-90 = 0.371 mAP50 = 0.578 mAP75 = 0.396 | bbox mAP50-90 = 0.444 mAP50 = 0.606 mAP75 = 0.484 segm mAP50-90 = 0.371 mAP50 = 0.579 mAP75 = 0.397 | dataset(coco val2017, 5000 images) yolov8s_seg(v8.0.207, rect = False, conf_thres = 0.0008) |
Pose Estimation | yolov8n_pose_320 | [1,3,320,320] | u8/u8 | 36.066 | bbox mAP50-90 = 0.6 mAP50 = 0.843 mAP75 = 0.654 keypoints mAP50-90 = 0.358 mAP50 = 0.646 mAP75 = 0.353 | bbox mAP50-90 = 0.6 mAP50 = 0.841 mAP75 = 0.656 keypoints mAP50-90 = 0.359 mAP50 = 0.648 mAP75 = 0.357 | dataset(coco val2017, 2346 images) yolov8n_pose(v8.0.207, rect = False) |
yolov8n_pose_640 | [1,3,640,640] | u8/u8 | 10.88 | bbox mAP50-90 = 0.694 mAP50 = 0.909 mAP75 = 0.776 keypoints mAP50-90 = 0.509 mAP50 = 0.798 mAP75 = 0.544 | bbox mAP50-90 = 0.694 mAP50 = 0.909 mAP75 = 0.777 keypoints mAP50-90 = 0.508 mAP50 = 0.798 mAP75 = 0.54 | dataset(coco val2017, 2346 images) yolov8n_pose(v8.0.207, rect = False) | |
yolov8s_pose | [1,3,640,640] | u8/u8 | 5.568 | bbox mAP50-90 = 0.733 mAP50 = 0.925 mAP75 = 0.818 keypoints mAP50-90 = 0.605 mAP50 = 0.857 mAP75 = 0.666 | bbox mAP50-90 = 0.734 mAP50 = 0.925 mAP75 = 0.819 keypoints mAP50-90 = 0.604 mAP50 = 0.859 mAP75 = 0.669 | dataset(coco val2017, 2346 images) yolov8s_pose(v8.0.207, rect = False) |
Demo
|eye gaze | space_resize | face pose || |---|---|---| | | | |
K210/K510
Supported operators
Features
- Supports multiple inputs and outputs and multi-branch structure
- Static memory allocation, no heap memory acquired
- Operators fusion and optimizations
- Support float and quantized uint8 inference
- Support post quantization from float model with calibration dataset
- Flat model with zero copy loading
Architecture
Build from source
It is recommended to install nncase directly through pip
. At present, the source code related to k510 and K230 chips is not open source, so it is not possible to use nncase-K510
and nncase-kpu
(K230) directly by compiling source code.
If there are operators in your model that nncase
does not yet support, you can request them in the issue or implement them yourself and submit the PR. Later versions will be integrated, or contact us to provide a temporary version.
Here are the steps to compile nncase
.
git clone https://github.com/kendryte/nncase.git
cd nncase
mkdir build && cd build
# Use Ninja
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
ninja && ninja install
# Use make
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
make && make install
Resources
Canaan developer community
Canaan developer community contains all resources related to K210, K510, and K230.
- 资料下载 --> Pre-compiled images available for the development boards corresponding to the three chips.
- 文档 --> Documents corresponding to the three chips.
- 模型库 --> Examples and code for industrial, security, educational and other scenarios that can be run on the K210 and K230.
- 模型训练 --> The model training platform for K210 and K230 supports the training of various scenarios.
Bilibili
K210 related repo
K230 related repo
- C: K230_SDK
- MicroPython: Canmv_k230
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 Distributions
Built Distributions
File details
Details for the file nncase-2.9.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0d6c4d021ffaea52769f940077e933ae852a8ffd9c8f9631b6cced15f0a0ea0 |
|
MD5 | 1134411573d7e9bff363a50a8a3b3579 |
|
BLAKE2b-256 | 3c4a2a90ca34c53bcaa16e9d03ea7ecd319b1cbba7eccb9a789b1b8d14863094 |
File details
Details for the file nncase-2.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f1e61b6225ad955fcf9dbe093926da0d23199f4e35f4a788bb3627cf365266 |
|
MD5 | bafc16244484464d9d1ca5df9c63e6a0 |
|
BLAKE2b-256 | e366334a97c38f8c63f3fdf0402656187234d343640c32303d10a0d9b7636140 |
File details
Details for the file nncase-2.9.0-cp310-cp310-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2feb6947104b397fea17707aa269608f375d96aad3eaebbb55de56a12116fa1c |
|
MD5 | dd509cf3f2c4691c04aaee4ee742ba2b |
|
BLAKE2b-256 | c6cd2606c06e20d0cf97aae82ff3299177466b88e57523c48dcf5e7102850068 |
File details
Details for the file nncase-2.9.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | facef59e7bb3306b7b5f650a0a694daa12a578b1c4c7748c5d5a4b80eead7882 |
|
MD5 | 044e6af22803c4ea81201628855819ea |
|
BLAKE2b-256 | 7c5f4a11478693d57e723b7696b3527eba83014e28bcdaf53458c70cc17302eb |
File details
Details for the file nncase-2.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb331a02976817e4f24815806f6cdc51ca4d36e643b597cfbdade8b6d00b2011 |
|
MD5 | ed9a36416e9f15e4371faaeba9831748 |
|
BLAKE2b-256 | a636abffc2f98299289571a38bf3d63ecfd2c70cee3c3ef2fae1abf07f9ee1aa |
File details
Details for the file nncase-2.9.0-cp39-cp39-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62fe97efd2a72df1bc3d9ceeff99bfee4329e9b81281cb25caf2071a2da80d2a |
|
MD5 | 107ec2d35b802a8dad97e1353c7e412e |
|
BLAKE2b-256 | 0781f9eb745386b4afb8261ff089dd4ce64c4a2540400185a7ba333f66ab6c27 |
File details
Details for the file nncase-2.9.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ecf054899dfc92886fce7479f2ddb8d6d054866ff350c5c9e2a4eefea172a24 |
|
MD5 | 4ac9c6ee77e124a64beadf34f8a35473 |
|
BLAKE2b-256 | 877641af236bc7127000df9acfd96b7ad6b5ba1f22f68ca3b58244f46696533a |
File details
Details for the file nncase-2.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.6 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c51c2456a99156e106b788d9300eebf811c47d24cf7e446767cd15eaee49980 |
|
MD5 | 39f434294f2c7d127478dce65186932a |
|
BLAKE2b-256 | 0b32ef9396275379694d066066cc6e5584a127e1ca37756ec568abc624862cf3 |
File details
Details for the file nncase-2.9.0-cp38-cp38-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp38-cp38-macosx_10_15_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.8, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b507925208f531737e04b2582b1be424ebe810fcd3b0bf4f352c622d348c152 |
|
MD5 | c9c2b136610ff44bb697b90705a3ded9 |
|
BLAKE2b-256 | 89a5e26d8dfc8d9a55c7d55f85e7fc3eae4970bd8060029e6daaa966c4030ef9 |
File details
Details for the file nncase-2.9.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee2778efffe6c65da784dd7e0afb6a583780d168a0145b3b72fa463d91c3549 |
|
MD5 | f679f5c22a67880221a2fe9fcf9dcdd4 |
|
BLAKE2b-256 | c74606c191a4c24a5e238d0e7cd75e4ee40cad0fa05de955acebc90e8199555d |
File details
Details for the file nncase-2.9.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.6 MB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fa7b3317e429dca4ceb74bc448216befb137a98123d1442d29e37c11d0c87d2 |
|
MD5 | a5ed9244602e7d2b90b21ab1306e7d81 |
|
BLAKE2b-256 | c59ce193ba4a57449d96eb7673873f6f6e72faa067591035c6d26d413735a69f |
File details
Details for the file nncase-2.9.0-cp37-cp37m-macosx_10_15_x86_64.whl
.
File metadata
- Download URL: nncase-2.9.0-cp37-cp37m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 25.5 MB
- Tags: CPython 3.7m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e84ca0a6fed72aa9f7747dfc82ecf84eaafc7d53ba0ca89bf7194e36de6fd5c |
|
MD5 | 6bb1737b6b855f7339d09bf58cab1de6 |
|
BLAKE2b-256 | 174f50ab8618897ba306752daa7faf2a0698c7726eab91e1c5c5cc79a7890862 |