Canaan Platforms#

List of supported platforms#

Few platforms from Canaan are supported, including:

Platform Processor Description Status Firmware Tools version
Sipeed Maix M1 Kendryte K210 32-bit RISC-V CPU and KPU Supported MaixPy 0.6.2 NCC 0.2.0

Kendryte K210#

Installation#

Prerequisites#

To install NeurIO for Kendryte K210, you need to install the following tools:

  • NCC (NNCase from Canaan): a compiler for neural networks, transforming TFLite models to K210 compatible models. The link to the version 0.2.0 is “here”.

  • MaixPy: a Python interpreter for Kendryte K210. The link to the version 0.6.2 is “here”.

  • Instructions to install MaixPy on the Sipeed Maix M1 board are “here”.

Installation steps#

  1. Download and install NNCase in neurio. Extract the zip file and copy the ncc executable to the neurio/converters/ncc folder.

  2. Download the firmware from Sipeed.

  3. Flash the MaixPy firmware on the Sipeed Maix M1 board.

  4. Connect the Sipeed Maix M1 board to the computer.

Usage#

To use NeurIO and benchmark models on Kendryte K210, you need to connect the board to the computer and run the following command:

from neurio.devices.canaan import K210

model = ...
input_data = ...
port = "/dev/tty.someport" # port to which the device is connected
device = K210(port=port, log_dir=None)

device.prepare_for_inference(model=model)
predictions = device.predict(input_x=input_data, batch_size=2)

Execution process#

The execution process for K210 is as follows:

PREDICTION
if all data predicted
Setup
Download NCC
Convert model to TFLite
Convert TFLite model to K210
Generate scripts for inference
Upload scripts
Upload model
Inference
if more data
Save data
Upload batch of data
Run inference
Save results to SD
Download results
Post-processing
Aggregate results
Compute metrics
Finished