{"id":13435877,"url":"https://github.com/kendryte/nncase","last_synced_at":"2025-03-18T12:30:29.903Z","repository":{"id":31502468,"uuid":"128056991","full_name":"kendryte/nncase","owner":"kendryte","description":"Open deep learning compiler stack for Kendryte AI accelerators ✨","archived":false,"fork":false,"pushed_at":"2024-10-29T11:29:16.000Z","size":59529,"stargazers_count":747,"open_issues_count":18,"forks_count":181,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-29T11:42:45.403Z","etag":null,"topics":["ai-compiler","compiler","deep-learning","k210","k230","k510","kendryte","llm","neural-network"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kendryte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-04T12:11:19.000Z","updated_at":"2024-10-24T16:57:30.000Z","dependencies_parsed_at":"2024-01-14T20:49:27.947Z","dependency_job_id":"f0876261-9e38-4c68-8f58-610cde43a507","html_url":"https://github.com/kendryte/nncase","commit_stats":{"total_commits":842,"total_committers":24,"mean_commits":"35.083333333333336","dds":"0.36223277909738716","last_synced_commit":"efb93986d301f37af4fa1ef47d4f42227eac6442"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendryte%2Fnncase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendryte%2Fnncase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendryte%2Fnncase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kendryte%2Fnncase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kendryte","download_url":"https://codeload.github.com/kendryte/nncase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244222040,"owners_count":20418428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-compiler","compiler","deep-learning","k210","k230","k510","kendryte","llm","neural-network"],"created_at":"2024-07-31T03:00:40.225Z","updated_at":"2025-03-18T12:30:29.896Z","avatar_url":"https://github.com/kendryte.png","language":"C#","funding_links":[],"categories":["C# #","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"docs/logo.png\" width=\"400\" alt=\"nncase\" /\u003e\n\u003c/div\u003e\n\n[![GitHub repository](https://img.shields.io/badge/github-repository-blue?logo=github\u0026style=plastic)](https://github.com/kendryte/nncase) [![Gitee repository](https://img.shields.io/badge/gitee-repository-blue?logo=gitee\u0026style=plastic)](https://gitee.com/kendryte/nncase) [![GitHub release](https://img.shields.io/github/v/release/kendryte/nncase?color=brightgreen\u0026display_name=tag\u0026logo=github\u0026style=plastic)](https://github.com/kendryte/nncase/releases)\n\n[切换中文](docs/readme_ZH.md)\n\n`nncase` is a neural network compiler for AI accelerators.\n\nTelegram: [nncase community](https://t.me/joinchat/PPcEPZMLaTViNDI1)\nTechnical Discussion QQ Group: 790699378 .   Answer: 人工智能\n\n---\n\n## K230\n\n- [Usage](./docs/USAGE_v2_EN.md)\n- [FAQ](./docs/FAQ_EN.md)\n- [Example](./examples/user_guide/k230_simulate-EN.ipynb)\n- [Colab run](https://colab.research.google.com/drive/1m8TTree096m5VHmq-Uc60gXyltVCgnRb?usp=sharing)\n- [ *Version relationship between `nncase` and `K230_SDK`* ](https://developer.canaan-creative.com/k230/dev/zh/03_other/K230_SDK_nncase%E7%89%88%E6%9C%AC%E5%AF%B9%E5%BA%94%E5%85%B3%E7%B3%BB.html#k230sdknncase)\n- [update nncase runtime library in SDK](https://developer.canaan-creative.com/k230/dev/zh/03_other/K230_SDK%E6%9B%B4%E6%96%B0nncase%E8%BF%90%E8%A1%8C%E6%97%B6%E5%BA%93%E6%8C%87%E5%8D%97.html)\n\n### Install\n\n- Linux：\n\n    ```shell\n    pip install nncase nncase-kpu\n    ```\n\n- Windows:\n\n    ```shell\n    1. pip install nncase\n    2. Download `nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl` in below link.\n    3. pip install nncase_kpu-2.x.x-py2.py3-none-win_amd64.whl\n    ```\n\nAll version of `nncase` and `nncase-kpu` in [Release](https://github.com/kendryte/nncase/releases).\n\n\n### Supported operators\n\n- [TFLite ops](./docs/tflite_ops.md)\n- [Caffe ops](./docs/caffe_ops.md)\n- [ONNX ops](./docs/onnx_ops.md)\n\n\n### benchmark test\n\n\u003ctable\u003e\n\u003ctr\u003e \u003cth\u003ekind\u003c/th\u003e \u003cth\u003e model             \u003c/th\u003e\u003cth\u003e shape         \u003c/th\u003e\u003cth\u003e quant_type(If/W) \u003c/th\u003e\u003cth\u003e nncase_fps    \u003c/th\u003e\u003cth\u003e tflite_onnx_result    \u003c/th\u003e\u003cth\u003e accuracy \u003c/th\u003e\u003cth\u003e info  \u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan='3'\u003eImage Classification\u003c/td\u003e\n\u003ctd\u003emobilenetv2        \u003c/td\u003e\u003ctd\u003e [1,224,224,3] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 600.24        \u003c/td\u003e\u003ctd\u003e  top-1 = 71.3%\u003cbr/\u003etop-5 = 90.1%  \u003c/td\u003e\u003ctd\u003e top-1 = 71.1%\u003cbr/\u003etop-5 = 90.0% \u003c/td\u003e\u003ctd\u003e dataset(ImageNet 2012, 50000 images)\u003cbr/\u003e tflite \u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eresnet50V2         \u003c/td\u003e\u003ctd\u003e [1,3,224,224] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 86.17         \u003c/td\u003e\u003ctd\u003e  top-1 = 75.44%\u003cbr/\u003etop-5 = 92.56%  \u003c/td\u003e\u003ctd\u003e top-1 = 75.11% \u003cbr/\u003e top-5 = 92.36% \u003c/td\u003e\u003ctd\u003e dataset(ImageNet 2012, 50000 images)\u003cbr/\u003e onnx\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eyolov8s_cls        \u003c/td\u003e\u003ctd\u003e [1,3,224,224] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 130.497       \u003c/td\u003e\u003ctd\u003e  top-1 = 72.2%\u003cbr/\u003etop-5 = 90.9% \u003c/td\u003e\u003ctd\u003e top-1 = 72.2%\u003cbr/\u003etop-5 = 90.8% \u003c/td\u003e\u003ctd\u003e dataset(ImageNet 2012, 50000 images)\u003cbr/\u003e yolov8s_cls(v8.0.207)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan='2'\u003eObject Detection\u003c/td\u003e\n\u003ctd\u003eyolov5s_det        \u003c/td\u003e\u003ctd\u003e [1,3,640,640] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 23.645        \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.374\u003cbr/\u003emAP50 = 0.567  \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.369\u003cbr/\u003emAP50 = 0.566\u003c/td\u003e\u003ctd\u003edataset(coco val2017, 5000 images)\u003cbr/\u003eyolov5s_det(v7.0 tag, rect=False, conf=0.001, iou=0.65)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eyolov8s_det        \u003c/td\u003e\u003ctd\u003e [1,3,640,640] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 9.373         \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.446\u003cbr/\u003emAP50 = 0.612\u003cbr/\u003emAP75 = 0.484  \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.404\u003cbr/\u003emAP50 = 0.593\u003cbr/\u003emAP75 = 0.45\u003c/td\u003e\u003ctd\u003edataset(coco val2017, 5000 images)\u003cbr/\u003eyolov8s_det(v8.0.207, rect = False)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan='1'\u003eImage Segmentation\u003c/td\u003e\n\u003ctd\u003eyolov8s_seg        \u003c/td\u003e\u003ctd\u003e [1,3,640,640] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 7.845         \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.444\u003cbr/\u003emAP50 = 0.606\u003cbr/\u003emAP75 = 0.484\u003cbr/\u003esegm\u003cbr/\u003emAP50-90 = 0.371\u003cbr/\u003emAP50 = 0.578\u003cbr/\u003emAP75 = 0.396       \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.444\u003cbr/\u003emAP50 = 0.606\u003cbr/\u003emAP75 = 0.484\u003cbr/\u003esegm\u003cbr/\u003emAP50-90 = 0.371\u003cbr/\u003emAP50 = 0.579\u003cbr/\u003emAP75 = 0.397\u003c/td\u003e\u003ctd\u003e dataset(coco val2017, 5000 images)\u003cbr/\u003eyolov8s_seg(v8.0.207, rect = False, conf_thres = 0.0008)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan='3'\u003ePose Estimation\u003c/td\u003e\n\u003ctd\u003eyolov8n_pose_320   \u003c/td\u003e\u003ctd\u003e [1,3,320,320] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 36.066        \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.6\u003cbr/\u003emAP50 = 0.843\u003cbr/\u003emAP75 = 0.654\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.358\u003cbr/\u003emAP50 = 0.646\u003cbr/\u003emAP75 = 0.353    \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.6\u003cbr/\u003emAP50 = 0.841\u003cbr/\u003emAP75 = 0.656\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.359\u003cbr/\u003emAP50 = 0.648\u003cbr/\u003emAP75 = 0.357 \u003c/td\u003e\u003ctd\u003e dataset(coco val2017, 2346 images)\u003cbr/\u003eyolov8n_pose(v8.0.207, rect = False)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eyolov8n_pose_640   \u003c/td\u003e\u003ctd\u003e [1,3,640,640] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 10.88         \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.694\u003cbr/\u003emAP50 = 0.909\u003cbr/\u003emAP75 = 0.776\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.509\u003cbr/\u003emAP50 = 0.798\u003cbr/\u003emAP75 = 0.544  \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.694\u003cbr/\u003emAP50 = 0.909\u003cbr/\u003emAP75 = 0.777\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.508\u003cbr/\u003emAP50 = 0.798\u003cbr/\u003emAP75 = 0.54 \u003c/td\u003e\u003ctd\u003e dataset(coco val2017, 2346 images)\u003cbr/\u003eyolov8n_pose(v8.0.207, rect = False)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003eyolov8s_pose       \u003c/td\u003e\u003ctd\u003e [1,3,640,640] \u003c/td\u003e\u003ctd\u003e u8/u8            \u003c/td\u003e\u003ctd\u003e 5.568         \u003c/td\u003e\u003ctd\u003e  bbox\u003cbr/\u003emAP50-90 = 0.733\u003cbr/\u003emAP50 = 0.925\u003cbr/\u003emAP75 = 0.818\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.605\u003cbr/\u003emAP50 = 0.857\u003cbr/\u003emAP75 = 0.666  \u003c/td\u003e\u003ctd\u003e bbox\u003cbr/\u003emAP50-90 = 0.734\u003cbr/\u003emAP50 = 0.925\u003cbr/\u003emAP75 = 0.819\u003cbr/\u003ekeypoints\u003cbr/\u003emAP50-90 = 0.604\u003cbr/\u003emAP50 = 0.859\u003cbr/\u003emAP75 = 0.669\u003c/td\u003e\u003ctd\u003e dataset(coco val2017, 2346 images)\u003cbr/\u003eyolov8s_pose(v8.0.207, rect = False)\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n\n### Demo\n\n|[eye gaze](https://developer.canaan-creative.com/modelDetail?id=142)  | [space_resize](https://developer.canaan-creative.com/modelDetail?id=141) | [face pose](https://developer.canaan-creative.com/modelDetail?id=125)|\n| --- | --- | --- |\n| \u003cimg src=\"https://github.com/kendryte/nncase_docs/blob/master/gif/eye_gaze_result.gif?raw=true\"  alt=\"gif\"\u003e | \u003cimg src=\"https://github.com/kendryte/nncase_docs/blob/master/gif/space_resize.gif?raw=true\" alt=\"gif\"\u003e| \u003cimg src=\"https://github.com/kendryte/nncase_docs/blob/master/gif/face_pose_result.gif?raw=true\"\u003e |\n\n---\n\n## K210/K510\n\n- [Usage](https://github.com/kendryte/nncase/blob/release/1.0/docs/USAGE_EN.md)\n- [FAQ](https://github.com/kendryte/nncase/blob/release/1.0/docs/FAQ_EN.md)\n- [Example](https://github.com/kendryte/nncase/blob/release/1.0/examples/user_guide/)\n\n### Supported operators\n\n- [TFLite ops](https://github.com/kendryte/nncase/blob/release/1.0/docs/tflite_ops.md)\n- [Caffe ops](https://github.com/kendryte/nncase/blob/release/1.0/docs/caffe_ops.md)\n- [ONNX ops](https://github.com/kendryte/nncase/blob/release/1.0/docs/onnx_ops.md)\n\n---\n\n## Features\n\n- Supports multiple inputs and outputs and multi-branch structure\n- Static memory allocation, no heap memory acquired\n- Operators fusion and optimizations\n- Support float and quantized uint8 inference\n- Support post quantization from float model with calibration dataset\n- Flat model with zero copy loading\n\n---\n\n## Architecture\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"docs/imgs/arch.jpeg\" alt=\"nncase arch\" /\u003e\n\u003c/div\u003e\n\n---\n\n## Build from source\n\n**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.**\n\n\nIf 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.\nHere are the steps to compile `nncase`.\n\n```shell\ngit clone https://github.com/kendryte/nncase.git\ncd nncase\nmkdir build \u0026\u0026 cd build\n\n# Use Ninja\ncmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install\nninja \u0026\u0026 ninja install\n\n# Use make\ncmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install\nmake \u0026\u0026 make install\n```\n\n---\n\n## Resources\n\n### Canaan developer community\n\n[Canaan developer community](https://developer.canaan-creative.com/resource) contains all resources related to K210, K510, and K230.\n\n- 资料下载 --\u003e Pre-compiled images available for the development boards corresponding to the three chips.\n- 文档 --\u003e Documents corresponding to the three chips.\n- 模型库 --\u003e Examples and code for industrial, security, educational and other scenarios that can be run on the K210 and K230.\n- 模型训练 --\u003e The model training platform for K210 and K230 supports the training of various scenarios.\n\n### Bilibili\n\n- [Canaan AI tutorial and application demonstration](https://space.bilibili.com/677429436)\n\n\n### K210 related repo\n\n- [K210_Yolo_framework](https://github.com/zhen8838/K210_Yolo_framework)\n- [Shts!\u0026#39;s Blog (Japanese)](https://www.shtsno24.tokyo/2020/03/nncase-v020.html)\n- [Examples](https://github.com/kendryte/canmv_examples/tree/main/01-K210)\n\n### K230 related repo\n\n- C: [K230_SDK](https://github.com/kendryte/k230_sdk)\n    - [Documents](https://github.com/kendryte/k230_docs)\n    - [K230 end-to-end tutorial](https://github.com/kendryte/K230_training_scripts)\n- MicroPython: [Canmv_k230](https://github.com/kendryte/k230_canmv)\n    - [Documents](https://github.com/kendryte/k230_canmv_docs)\n    - [Examples](https://github.com/kendryte/canmv_examples/tree/main/02-K230)\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendryte%2Fnncase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkendryte%2Fnncase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendryte%2Fnncase/lists"}