Kneron

Getting Started with Kneron NPU

Welcome to the Kneron Developer Platform. This guide is your "Zero to Hero" path for setting up your environment, connecting your accelerator, and running your first AI inference on the KL520 or KL720.

What You Will Learn
  • How to prepare your host machine (Linux/Mac/Windows).
  • How to install the Kneron Toolchain (Docker + Python SDK).
  • How to verify hardware connectivity.
  • How to run a pre-compiled "Hello World" model.

1. Prerequisites

Before we begin, ensure you have the following:

Hardware
  • Host Computer: x86_64 architecture (Intel/AMD).
  • Kneron Device: USB Dongle (KL520/KL720) or Dev Kit.
  • Port: USB 3.0 (Required for high bandwidth).
Software
  • OS: Ubuntu 20.04+, macOS 12+, or Windows 10/11 (WSL2).
  • Runtime: Docker Desktop (Running).
  • Language: Python 3.8 - 3.10.

2. Hardware Setup

Connect the Kneron USB Accelerator to a blue USB 3.0 port on your computer.

Virtual Machine Users: If running inside a VM (VirtualBox/VMware), you must enable "USB Passthrough" for the device 3231:0200.
Verifying Connection (Linux/Mac)

Open your terminal and run:

$ lsusb | grep 3231
Bus 001 Device 004: ID 3231:0200 Kneron KL720 NPU
Linux Permission Fix (udev rules)

If you see the device but cannot access it (Permission Denied), run this one-time setup:

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="3231", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-kneron.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

3. Install the Toolchain

Kneron provides a Python wrapper that manages the complex Docker environment for you. This allows you to run commands like kneron build directly from your host terminal.

Terminal
# 1. Install the Python Manager
pip install kneron-toolchain

# 2. Initialize the Docker Environment
kneron install --docker
This command will pull the latest kneron/toolchain image (~4GB). Please wait.

4. Run Hello World

Now for the moment of truth. We will download a pre-compiled ResNet50 model (optimized for your specific chip) and run an inference on a sample image.

# Auto-detects device and runs test
kneron test --model resnet50
[INFO] Found device: KN-KL720 (FW v1.3.4)
[INFO] Downloading 'resnet50_kl720.nef'... [OK]
[INFO] Uploading model to NPU...
[INFO] Running inference on 'cat.jpg'...
----------------------------------------
Result: Class 281 (Tabby Cat)
Confidence: 89.4%
Latency: 4.2ms
----------------------------------------
[SUCCESS] Hello World Passed.

5. Next Steps

Congratulations! You have a working Kneron development environment.