Merge branch 'main' of github.com:sipeed/sipeed_wiki

This commit is contained in:
Neucrack
2025-08-08 14:07:13 +08:00
58 changed files with 1753 additions and 133 deletions

3
.gitignore vendored
View File

@@ -6,4 +6,5 @@ temp
.qiniu_pythonsdk_hostscache.json
*.temp
*.mo
.venv
.venv
.DS_Store

View File

@@ -4,6 +4,22 @@ title: Quick Start
## Hardware Installation
### ⚠Notice
There are currently two shell styles being shipped. If you receive a red and white colored shell, you almost don't need to follow the steps below, as the accessories are already pre-installed.
![case1](../../../zh/cluster/NanoCluster/assets/case1.png)![case2](../../../zh/cluster/NanoCluster/assets/case2.png)
If you want to print a new shell yourself, you can download the model files from makerworld and print it yourself. The link is
https://makerworld.com.cn/zh/models/1311487
If you want to install three Cluster in a 10-inch rack, you can use the following model.
https://makerworld.com.cn/zh/models/1349837
![case3](../../../zh/cluster/NanoCluster/assets/case3.png)
### LM3H Installation
First, attach the heatsink to the main control chip to improve heat dissipation. When installing the core board, ensure the correct orientation to avoid damaging the device.
@@ -125,7 +141,7 @@ Once the firmware image is ready, open balenaEtcher, select the image file to be
### M4N Flashing
You can refer to the [System Flashing Guide](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/system-update.html) for the flashing process.
You can refer to the [System Flashing Guide](https://wiki.sipeed.com/hardware/zh/maixIV/m4n/system-update.html) for the flashing process.
## Remote Management

View File

@@ -10,7 +10,7 @@ keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
1. Refer to [this link](https://wiki.sipeed.com/hardware/zh/kvm/NanoKVM/system/updating.html#%E8%8E%B7%E5%8F%96-IP) to connect the development board.
2. Execute: `python /etc/kvm/update-nanokvm.py`
> Users outside of China may experience download failures due to DNS issues. Please add `nameserver 119.29.29.29` or `nameserver 223.5.5.5` to `/etc/resolv.conf` and try again.
> Earlier versions of the application may not have this script file. Please download [here](https://github.com/user-attachments/files/16939944/update-nanokvm.py.zip), extract it, and grant execute permissions before trying again.
> Earlier versions of the application may not have this script file. Please download [here](https://github.com/sipeed/NanoKVM/blob/main/kvmapp/system/update-nanokvm.py), extract it, and grant execute permissions before trying again.
### About Password

View File

@@ -1,3 +0,0 @@
Coming soon

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

View File

@@ -0,0 +1,76 @@
## How to enable root user password login for SSH when the correct password is entered but login fails?
Default password: root
*For security reasons, the default policy only allows the root user to log in remotely via SSH key authentication, which is not only convenient and fast but also secure. The required steps are as follows: After logging into the system via serial port or desktop, manually paste your public key into the `/root/.ssh/authorized_keys` file (create the file if it does not exist). For a more detailed process, you can search for "SSH login with key" or refer directly to this [tutorial](https://www.runoob.com/w3cnote/set-ssh-login-key.html)。*
If you insist on enabling password login, follow these steps:
```bash
# Log in via the serial terminal and execute the following commands:
# Enable remote password login for the root user
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/allow-root.conf
systemctl restart sshd
```
After development, to avoid risks caused by accidental root password leakage, it is recommended to disable remote password login for the root user by executing the following commands:
```bash
# Log in to any terminal and execute the following commands:
# Disable remote password login for the root user
rm /etc/ssh/sshd_config.d/allow-root.conf
systemctl restart sshd
```
## Q: The root filesystem partition is too small by default when using TFCard & eMMC images. How to expand eMMC or TFCard?
```bash
# Log in to any terminal and execute the following commands:
# Replace mmcblkX below with mmcblk0 (eMMC) or mmcblk1 (TFCard).
# /dev/mmcblkXp2 is the second partition, which is the root filesystem partition.
parted /dev/mmcblkX resizepart 2 100%
resize2fs /dev/mmcblkXp2
sync
```
## Q: Some large language models require executing tokenizer-related Python scripts, but an error "ModuleNotFoundError" occurs. How to resolve this?
```bash
# To avoid polluting the system Python libraries, create a virtual environment:
apt install python3-venv
python3 -m venv venv-llm
# Activate the virtual environment:
source venv-llm/bin/activate
# Install the missing Python modules (use Tsinghua Mirror for faster installation in China):
pip install transformers jinja2 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
# After installation, you can proceed to execute the script.
```
Remember to activate the virtual environment before running related Python scripts each time:
```bash
# Activate the virtual environment:
source venv-llm/bin/activate
```
## Q: If GPIO2_A27 is configured as I2C3_SCL in the device tree, how can I control GPIO2_A27 when I2C3 is not in use? (pinctrl)
```bash
cd /sys/kernel/debug/pinctrl/4250200.pinctrl
grep "GPIO2_A27" pinmux-functions
# output # function 447: GPIO2_A27, groups = [ I2C3_SCL ]
grep "I2C3_SCL" pinmux-pins
# output # pin 87 (I2C3_SCL): device 2024000.i2c function i2c3_scl group I2C3_SCL
echo 2024000.i2c > /sys/bus/platform/drivers/i2c_designware/unbind
grep "I2C3_SCL" pinmux-pins
# output # pin 87 (I2C3_SCL): UNCLAIMED
# echo "<group-name function-name>" > pinmux-select
echo "I2C3_SCL GPIO2_A27" > pinmux-select
gpioset gpiochip2 27=0
gpioset gpiochip2 27=1
```
## Q: The MAC physical address is randomly generated upon each reboot, causing unstable IP addresses. How can this be resolved?
A: Starting from sdcard-20250627.img.xz, the `config.txt` file in the root directory of the first partition (FAT32) contains the U-Boot environment variable configuration. To permanently modify the MAC addresses of the corresponding network interfaces, add the environment variables `ethaddr` and `eth1addr` like this below:
```
ethaddr=d0:00:00:00:00:03
eth1addr=d0:00:00:00:00:04
```
![](../../../zh/maixIV/assets/m4n/set-macaddress.png)

View File

@@ -0,0 +1,34 @@
# Deploying AI Models on M4N
## Deploying Large Language and Multimodal Models
Obtain models and runtime environments from the following sources. Deployment instructions can be found in each repository's README.md.
Official AXERA Models: https://huggingface.co/AXERA-TECH
China Mirror Site: https://hf-mirror.com/AXERA-TECH
| Model | Link | China Mirror Link |
| -- | -- | -- |
| Qwen3:0.6b | [Qwen3-0.6B-Int8](https://huggingface.co/AXERA-TECH/Qwen3-0.6B) | [Qwen3-0.6B-Int8](https://hf-mirror.com/AXERA-TECH/Qwen3-0.6B) |
| DeepSeek-R1:1.5b | [DeepSeek-R1-Distill-Qwen-1.5B](https://huggingface.co/AXERA-TECH/DeepSeek-R1-Distill-Qwen-1.5B) | [DeepSeek-R1-Distill-Qwen-1.5B](https://hf-mirror.com/AXERA-TECH/DeepSeek-R1-Distill-Qwen-1.5B) |
| Qwen2.5:1.5b | [Qwen2.5-1.5B-Instruct-GPTQ-Int8](https://huggingface.co/AXERA-TECH/Qwen2.5-1.5B-Instruct-GPTQ-Int8) | [Qwen2.5-1.5B-Instruct-GPTQ-Int8](https://hf-mirror.com/AXERA-TECH/Qwen2.5-1.5B-Instruct-GPTQ-Int8) |
| SD1.5 | [lcm-lora-sdv1-5](https://huggingface.co/AXERA-TECH/lcm-lora-sdv1-5) | [lcm-lora-sdv1-5](https://hf-mirror.com/AXERA-TECH/lcm-lora-sdv1-5) |
| InternVL2.5:1b | [InternVL2_5-1B-Int8](https://huggingface.co/AXERA-TECH/InternVL2_5-1B) | [InternVL2_5-1B-Int8](https://hf-mirror.com/AXERA-TECH/InternVL2_5-1B) |
**Important Note:** All above models require system images compiled with `SDK 1.45.0` or `later` to run large models. Please update your system accordingly. Our provided TFCard&eMMC images meet this requirement and reserve 6GB memory for model loading, capable of running 7B parameter int4 models.
*Quick test with Qwen3-0.6b:*
```bash
# Can replace with links to other model repositories
git clone https://hf-mirror.com/AXERA-TECH/Qwen3-0.6B
cd Qwen3-0.6B
# If ModuleNotFoundError occurs, refer to FAQ for details
python3 qwen3_tokenizer_uid.py
# Switch to corresponding execution script and restore necessary permissions
chmod +x main_ax650
sh run_qwen3_0.6b_int8_ctx_ax650.sh
```

View File

@@ -0,0 +1,122 @@
This guide provides detailed instructions for two system flashing methods for the M4N development board series:
1. booting and flashing eMMC via TFCard
2. flashing using the AXDL tool
Please choose the appropriate method based on your needs.
## Image File
*Due to the large size of the image packages used in the flashing methods described on this page and limited bandwidth on the download site, they are stored exclusively on Mega Drive in the same directory. The entry link can be found in the [top side of the download site](https://dl.sipeed.com/)。*
| Image Type | How to Boot | Filename | How to Obtain |
|-------------------|-------------------------------------------|--------------|-------------------|
| TFCard&eMMC Image | `power-up Boot from eMMC` or `Manual boot from TFCard` | `sdcard.img` | path: MaixIV/M4N-Dock/09_Image/TFCard&eMMC Images |
| AXSDK AXP | `power-up Boot from eMMC` | `xxx.axp` | path: MaixIV/M4N-Dock/09_Image/ubuntu |
f the downloaded image file has an .xz extension, decompress it first. Linux users can use the xz tool, while Windows users can use tools like 7-zip.
![](../../../zh/maixIV/assets/baidupan-dl.png)
## Booting and Flashing eMMC via TFCard
### Booting into the Live System (Manual Intervention Required)
#### Step 1: Prepare TFCard and Flash the Image
Prepare a TFCard with at least 8GB capacity and use any card reader tool or the computer's built-in card slot for reading/writing.
Note: The following operations will erase all data on the TFCard. Back up important data beforehand.
| HOST OS | Flashing Method |
|------------|--------------------------------------------------------------------------|
| Linux | `sudo dd if=sdcard.img of=/dev/sdX bs=4M conv=fsync status=progress` |
| Windows | Use `Win32DiskImager`, `Rufus` or `balenaEtcher` to flash the image |
Example for Linux:
```bash
# Assuming the TFCard is mounted as /dev/sdb
% sudo dd if=sdcard.img of=/dev/sdb bs=4G conv=sparse,fsync status=progress
0+3 records in
0+3 records out
5754429440 bytes (5.8 GB, 5.4 GiB) copied, 89.2665 s, 64.5 MB/s
```
#### Step 2: Booting into the Live System Using the Flashed TFCard
**TFCard Boot Method**
| Board | Device Tree Blob | TF Card Slot Location | `BOOT` Button Location |
|------------|-----------------------|--------------------------------|---------------------------|
| Dock | `dtbs/m4nbox.dtb` | Top-left corner, diagonal to Type-C port | Next to Type-C port (labeled BOOT) |
| Hat | `dtbs/m4nhat.dtb` | Behind USB3 port, near the notch | Next to HDMI port (labeled BOOT0) |
| Cluster | `dtbs/m4ncluster.dtb` | Below M.2 slot | Next to Type-C port (labeled BOOT) |
1. Mount the TFCard and modify the `dtb_img_name=dtbs/m4nbox.dtb` line in the FAT32 partition's `config.txt` file to match your board.
2. Insert the TFCard into the TF card slot.
3. Hold the `BOOT` button and reset the board:
- Option 1: Power cycle (unplug and replug power).
- Option 2: Press and release the `RST` button while powered on.
Note for M4N-Dock: If the front panel is obstructed, remove it by unscrewing the 3 screws and rotating it open.
After completing these steps, the Live system should boot. You can observe the boot logs via UART0.
**This Live system is fully functional and ready for immediate use. If you want the system to boot automatically without manual button operations, proceed to flash the image to eMMC as described below.**
### Flashing eMMC from the Live System (Automatic Boot on Power-Up)
The onboard eMMC is always recognized as `/dev/mmcblk0`, while the TFCard is `/dev/mmcblk1`. Be careful to distinguish between them.
There are two methods are provided below for flashing the image to eMMC:
#### Method 1: Directly Recovery from the Live System
1. Boot into the Live system as described earlier and open a terminal for the following steps.
2. Use `dd` to **recovery** the Live system from the TFCard to eMMC:
```sh
dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=3M count=1 conv=fsync
sync # 确保分区表生效
dd if=/dev/mmcblk1p1 of=/dev/mmcblk0p1 bs=64M conv=fsync
dd if=/dev/mmcblk1p2 of=/dev/mmcblk0p2 bs=1G conv=sparse,fsync status=progress
```
3. After completion, remove the TFCard. Just press the `RST` button and the system will now directly boot from eMMC.
#### Method 2: Flash the Image within the Live System
Prerequisite: The second partition (ext4) of the TFCard must be accessible and writable. If unsure, use Method 1.
1. Copy the sdcard.img file to any location in the second partition (Live system root directory).
2. Flash the image to eMMC:
```sh
dd if=/path/to/sdcard.img of=/dev/mmcblk0 bs=1G conv=sparse,fsync status=progress
```
3. After completion, remove the TFCard. Just press the `RST` button and the system will now directly boot from eMMC.
## Flashing via AXDL Software
The flashing file format has changed to be like `xxx.axp`.
For detailed steps, refer to the `AXDL 工具使用指南.pdf` in the official SDK documentation package.
**Tip: The Download button on the official EVB corresponds to the BOOT button on other boards.**
The AXDL software (Windows only) is located in the `PC_Software` directory on the download site.
**Important Notes for M4N-Dock:**
- **The USB flashing port is the bottom `USB-A port` near the `HDMI` connector (Ethernet side). Use an `A-to-A` cable or `A-to-C` cable if your PC has a `Type-C port`.**
- **Do `not` connect the `12V power supply` during flashing. Use only the USB cable to avoid damaging the `PC's USB port`.**

View File

@@ -0,0 +1,76 @@
---
title: Maix-IV Series Frequently Asked Questions (FAQ)
---
## Q: How to check the SDK version of the current system?
A: Run the command `cat /proc/ax_proc/version`. Example output:
```bash
root@ax650:~# cat /proc/ax_proc/version
Ax_Version V1.45.0_P39_20240830020829
```
## Q: After updating to v1.45.0_P39, the root filesystem is smaller than 5GB. How to expand it?
A: Before expansion:
```bash
root@ax650:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 4.9G 4.3G 336M 93% /
```
After expansion:
```bash
root@ax650:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 4.3G 9.6G 31% /
```
Steps:
1. Identify whether the system boots from TFCard or eMMC:
```bash
root@ax650:~# grep -oP 'root=\K\S+' /proc/cmdline
/dev/mmcblk1p2 # TFCard 启动
# /dev/mmcblk0p2 # 或 eMMC 启动
```
2. Replace `/dev/mmcblkX` in the following commands with the detected device (e.g., `/dev/mmcblk0` or `/dev/mmcblk1`), then execute:
```bash
parted /dev/mmcblkX resizepart 2 100%
resize2fs /dev/mmcblkXp2
sync
```
Q: After updating to v1.45, the root filesystem only shows 8GB. How to fix this?
A: This occurs when booting after the first flash. The eMMC partition is pre-configured for maximum capacity. Run the following to update filesystem metadata (post-expansion size should be 28GB):
```bash
resize2fs /dev/mmcblk0p10
sync # Critical! Prevents boot failure after power cycle.
```
Expected result:
```bash
root@maixbox:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 28G 6.0G 21G 23% /
```
Warning: Always run `sync` before rebooting/power-off to avoid system corruption.
## Q: How to resolve network conflicts caused by duplicate MAC addresses?
A: Permanently modify MAC addresses via U-Boot environment variables:
```bash
# 例如
setenv ethaddr d0:00:00:00:00:01
setenv eth1addr d0:00:00:00:00:02
saveenv
```
## Key Notes:
- For eMMC operations, ensure sync is executed to prevent data loss.
- MAC address changes require saveenv to persist across reboots.
- Refer to official docs for advanced partitioning scenarios.

View File

@@ -0,0 +1,60 @@
## Introduction
**Taobao link: [Click to Buy](https://item.taobao.com/item.htm?spm=1619a.1.0.0.3f0865abb4Wq5c&id=744014549573&ns=1&abbucket=18#detail)**
The M4N-Dock is an edge computing box featuring hybrid-precision computing capabilities, developed by Sipeed and powered by AXERA's third-generation high-efficiency AI vision chip, the AX650N. It delivers an impressive 72 TOPS@INT4 or 18 TOPS@INT8 of built-in AI computing power, capable of running popular large-scale AI models.
Equipped with an advanced ISP supporting 8K@30fps video processing and AXERA's proprietary AI-ISP technology for superior low-light night vision performance, it also integrates H.264/H.265 codecs capable of stable 8K@60fps decoding and 8K@30fps encoding. Real-world testing demonstrates reliable 32-channel 1080P@30fps decoding and 16-channel 1080P@30fps encoding.
The AX650N chip features comprehensive interfaces including 64-bit LPDDR4x memory, multi-channel MIPI input, Gigabit Ethernet, USB 3.0, and HDMI 2.0b output. Combining powerful computing with exceptional codec capabilities, it meets industry demands for high-performance edge AI computing.
The single-core NPU delivers outstanding performance (single-core performance), achieving:
- 130 FPS (7.66ms latency) for yolov5s at 640×640 resolution
- 1798 FPS (0.556ms latency) for MobileNetV2 at 224×224 resolution
Supporting diverse deep learning algorithms, it enables applications including visual structuring, behavior analysis, and status detection, with optimized support for Transformer architectures and large vision models. Comprehensive development documentation facilitates secondary development for customized solutions.
## Key Specifications
| Component | Description |
|-----------|--------------------------------------------------------------------------------------|
| CPU | 8x A55@1.7Ghz, integrated FPU, supports NEON acceleration |
| NPU | 72 TOPS@INT4 / 18 TOPS@INT8, supporting INT4/INT8/INT16/FP16/FP32 inputs, TopN (N<=32) |
| ISP | Supports up to 8192x4320@30fps, maximum resolution: 16384x16384, featuring AI-ISP (low-light night vision) |
| CODEC | H.264/H.265 encoding/decoding, up to 8K@60fps decoding & 8K@30fps encoding capability |
| DSP | Dual-core 800MHz |
| Memory | 8GB 64-bit LPDDR4x (adjustable allocation: default 2GB system + 6GB AI CMM) |
| Storage | 32GB eMMC 5.1 onboard (system storage) plus 3x SATA 3.0 6Gb/s (1× M.2 + 2× standard SATA ports) |
| Video Output | Dual HDMI 2.0a (4K@60fps max) |
| Video Input | Dual 4-lane MIPI-CSI camera interfaces (3.5Gbps) |
| Network | Dual Gigabit Ethernet ports (tested throughput: 944Mbps) |
| PCIE | 1-lane PCIe 2.0 (5Gbps) via Mini-PCIe interface |
| USB | 1× USB3.2 Gen1 (5Gbps) + 3× USB2.0 (480Mbps) (blue port farthest from Ethernet is OTG programming port) |
| Others | 1x RS485 + 1x RS232 + 3x user controlled led |
## Resources
### Hardware Documentation
Datasheet: https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
### Software Documentation
Docs: https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
SDK: https://github.com/AXERA-TECH/ax650n_bsp_sdk
### AI Development
AI Toolchain (ONNX Conversion/Deployment)
- Pulsar2 (AXERA's ALL-IN-ONE Neural Network Compiler):
Docs: https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html
Download: https://huggingface.co/AXERA-TECH/Pulsar2/tree/main
op_support_list: https://pulsar2-docs.readthedocs.io/en/latest/appendix/op_support_list_ax650.html
Samples source: https://github.com/AXERA-TECH/ax-samples
## Technical Support
For custom development (kernel/OS customization, application-layer SDKs), contact: support@sipeed.

View File

@@ -0,0 +1,211 @@
## System Boot and Login
**Note:** The system must be powered via 12V DC input. USB power alone may cause insufficient power supply leading to system instability.
### Pre-Boot Preparation
Required:
1. 12V DC power supply
2. HDMI cable and display
3. Type-C cable (optional: for serial debugging/login)
4. RJ45 Ethernet cable (optional: for network connection and SSH login)
For first-time use, verify the following status matches your hardware version:
- Power switch on enclosure is ON (for enclosed versions)
- Jumper cap remains shorted at Button marking (for bare board versions)
![top](../../../zh/maixIV/assets/top.png)
### Normal Boot
Connect display via HDMI1 and provide 12V DC power. After approximately 20 seconds, the LightDM login interface will appear, indicating successful system boot.
![desktop](../../../zh/maixIV/assets/desktop.jpg)
Connect mouse/keyboard to the onboard USB-A port for operation. Use default credentials (username: `root`, password: `root`) to access the Debian desktop system.
### Advanced: Serial & SSH Login
The onboard Type-C USB port serves as the default debug UART (**115200 8n1**).
Use a serial tool to view kernel logs or log in directly via terminal.
For SSH access, expand network connectivity via USB Ethernet/WiFi dongles.
Note: The system only has the root superuser, and SSH password login is disabled by default for security. For temporary access, refer to [here](../m4n/FAQ.md)。
## Interactive Image Segmentation & Inpainting
A QT-based GUI for real-time segmentation (point/box selection) and inpainting.
![samqt](../../../zh/maixIV/assets/samqt.jpg)
Open Source Official GitHub Repo: [SAM-ONNX-AX650-CPP](https://github.com/AXERA-TECH/SAM-ONNX-AX650-CPP)
Download prebuilt binaries or compile from source.
Example: Removing a player from a photo:
<div><table><tr>
<td><img src="../../../zh/maixIV/assets/sam_example_before.png" alt=sam_example_before border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_example_after.png" alt=sam_example_after border=0></td>
</tr></table></div>
Live Demo (Screenshots):
<div><table><tr>
<td><img src="../../../zh/maixIV/assets/sam_raw.jpg" alt=sam_raw border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_sam.jpg" alt=sam_sam border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_inpaint.jpg" alt=sam_inpaint border=0></td>
</tr><tr>
<td>RAW</td>
<td>SAM</td>
<td>Inpaint</td>
</tr></table></div>
## Interactive Text-to-Image Search (CLIP)
A QT-based GUI using OpenAIs CLIP (Contrastive LanguageImage Pre-training) for zero-shot image retrieval via text input (supports Chinese/English).
Open Source Official GitHub Repo: [CLIP-ONNX-AX650-CPP](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP)
[DEMO VIDEO](https://github.com/sipeed/sipeed_wiki/assets/13964381/df4cec7f-29af-465f-bfad-e54312274437)
1. Install QT:
```bash
apt update
apt install cmake qt6-base-dev
```
2. Download prebuilt files (executable, models, test images/text):
- [Baidu Pan](https://pan.baidu.com/s/17M5ugUyuf9mbi1cHLGJHXg)
3. Extract *CLIP.zip* to `/root/Desktop/`:
```bash
root@m4nhat-7190c7:~/Desktop/CLIP# tree -L 1
.
├── CLIPQT
├── cn_vocab.txt
├── coco_1000
├── libonnxruntime.so
├── libonnxruntime.so.1.16.0
├── onnx_models
├── run_en.sh
├── run_zh.sh
└── vocab.txt
```
4. Run in Desktop's terminal:
```bash
./run_zh.sh # For Chinese
./run_en.sh # For English
```
Screenshots:
![b38722991915fa54f17df18ca1f1447](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/8fa2c4b8-b061-413e-b72d-298bb4a445aa)
![34c8b68b1a8721d4ebff3b4b7184733](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/7d0b9740-3598-492c-ad42-2de23e7764e2)
## **Important Demo Pre-requisites**
HDMI0 (demo output) and HDMI1 (desktop) cannot operate simultaneously due to display driver limitations.
**To run demos:**
1. Terminate fb_vo process:
```bash
kill -9 $(pgrep fb_vo)
```
2. Connect display to HDMI0
3. Execute demo scripts via SSH/serial terminal
4. After demo, you can restore desktop:
```bash
/root/runVoHook.sh
```
## 32-Channel AI BOX (Person/Vehicle Detection)
BoxDemo showcases the complete pipeline from **H.264/H.265** decoding → AI analysis → HDMI display.
**Features:**
- Default: 32-channel display (6×6 layout)
- Dual HDMI support (mirror/extended)
- System power consumption <7W
- 3.6T NPU utilization (1/3 capacity)
- 15-20 FPS (CPU-bound)
**Configuration:**
- Edit /opt/bin/BoxDemo/box.conf:
- streamxx: RTSP source URLs
- DISP1=1: Enable HDMI1 output
**Run:**
```bash
bash /opt/bin/BoxDemo/run.sh
```
![aibox_pipeline](../../../zh/maixIV/assets/aibox_pipeline.png)
![aibox_example32ch](../../../zh/maixIV/assets/aibox_example32ch.png)
## DINO v2 Monocular Depth Estimation
Leveraging Facebook's DINO v2 model for relative depth estimation using single RGB camera.
![pipeline_bin](../../../zh/maixIV/assets/pipeline_bin.png)
**Execution:**
```bash
cd ~/ax-pipeline/bin
./sample_multi_demux_ivps_npu_multi_rtsp_hdmi_vo \
-p ./config/dinov2_depth.json \
-f ~/boxvideos/13.mp4
```
*Supports H.264 video files or RTSP streams*
**Results:**
<div><table><tr>
<td><img src="../../../zh/maixIV/assets/dinov2-1.png" alt=dinov2-1></td>
<td><img src="../../../zh/maixIV/assets/dinov2-2.png" alt=dinov2-2></td>
</tr></table></div>
![dinov2-3](../../../zh/maixIV/assets/dinov2-3.png)
## YOLOv5 Pedestrian Detection & Tracking
```bash
cd ~/ax-pipeline/bin
./sample_multi_demux_ivps_npu_multi_rtsp_hdmi_vo \
-p ./config/yolov5_seg.json \
-f ~/boxvideos/25.mp4
```
![yolov5_seg](../../../zh/maixIV/assets/yolov5_seg.png)

View File

@@ -0,0 +1,101 @@
## Introduction
The M4N-Hat is a highly integrated AI computing module developed by Sipeed, featuring a compact design powered by AXERA's AX650N/C chip. As an embedded expansion module, it delivers 72 TOPS@INT4 (18 TOPS@INT8) computing power while retaining 8K video encoding/decoding capabilities, making it ideal for space-constrained edge computing applications.
This module supports plug-and-play compatibility with mainstream Raspberry Pi development boards and accelerates Transformer-based architectures. With its onboard 0.8mm 4-pin USB and Type-A USB SS 5Gbps interfaces, it enables quick expansion for peripherals like cameras and storage, making it perfect for smart cameras, industrial inspection, and other lightweight AI applications. The PCIE 2.0 expansion interface is fully compatible with Raspberry Pi 5, supporting multi-modal edge computing nodes and the deployment of quantized large models such as QWen 2.5, QWen 3, DeepSeek, and InternVL2.5.
## Showcase
<div style="display: flex; flex-wrap: wrap; gap: 10px; width: 100%;">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07555.JPG" style="width: calc(50% - 5px);">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07569.JPG" style="width: calc(50% - 5px);">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07556.JPG" style="width: calc(50% - 5px);">
<img src="../../../zh/maixIV/assets/m4nhat/neofetch.jpg" style="width: calc(50% - 5px);">
</div>
## Interface Annotation Diagram
![Interface Annotation Diagram](../assets/m4nhat/IAD.png)
## Key Specifications
| Component | Description |
| ------- | --------------------------------------------------- |
| CPU | 8x A55@1.7Ghz, integrated FPU, supports NEON acceleration |
| NPU | 72 TOPS@INT4 / 18 TOPS@INT8, supports INT4/INT8/INT16/FP16/FP32 inputs, TopN (N<=32) |
| CODEC | H.264/H.265 encoding/decoding, up to 8K@60fps decoding & 8K@30fps encoding |
| DSP | Dual-core 800MHz |
| RAM | 8GB 64-bit LPDDR4x (adjustable allocation: default 2GB system + 6GB AI CMM) |
| ROM | 32GB eMMC 5.1 (system storage) |
| Video Output | 1x HDMI 2.0a (max 4K@60fps) |
| Video Input| 11x 0.8mm 4-pin USB camera interface |
| PCIE | 1x 16-pin FPC (1-lane PCIE2.0 @5Gbps), Raspberry Pi 5 compatible |
| USB | 1x Type-A USB SS 5Gbps + 1x Type-C USB HS 480Mbps |
| Others | 1x 1.25mm 2-pin speaker, 1x 1.25mm 2-pin fan, 1x 10-pin FPC SPI display, 1x 6-pin FPC I2C touch |
## Performance Benchmarks
![](../../../zh/maixIV/assets/m4n/benchmark.png)
![](../../../zh/maixIV/assets/m4n/normalized_benchmark.png)
| Models | RK3588@6T| Maix4@18T | Hailo8 26T | Hailo8 13T |
|-------------|----------|------------|------------|------------|
| Inceptionv1 | 43 | 2494 | 928 | 519 |
| MobileNetv2 | 960 | 5073 | 2433 | 1738 |
| SqueezeNet11| 694 | 5961 | - | - |
| ResNet18 | 543 | 2254 | - | - |
| ResNet50 | 294 | 1045 | 1368 | 503 |
| SwinT | 21 | 401 | - | - |
| ViT-B/16 | 18 | 207 | 107 | 40 |
| YOLOv5s | 48 | 384 | 364 | 168 |
| YOLOv5n | 78 | 743 | - | - |
| YOLOv6s | 80 | 321 | - | - |
| YOLOv6n | 212 | 743 | - | - |
| YOLOv8s | 39 | 279 | - | - |
| YOLOv8n | 73 | 710 | - | - |
| YOLOxs | 34 | 304 | - | - |
| YOLO11s | 30 | 313 | - | - |
| Models | Item | Maix4@18T | RK3588@6T |
|------------------------------|------------------------------|--------------|--------------|
| SmolVLM-256M | Image Encoder 512*512 | 105ms | 842ms |
| | TTFT | 57ms | 87ms |
| | Decode | 80 tokens/s | 77 tokens/s |
| StableDiffusion 1.5(512*512) | U-Net | 0.43 s/it | 5.65 s/it |
| | VAE Decoder | 0.91 s | 11.13 s |
| Qwen2.5-VL-3B | Image Encoder 448*448 | 780 ms | |
| | TTFT 320 tokens | 2857 ms | |
| | Decode | 6.2 tokens/s | |
| | Image Encoder 392*392 | | 2930 ms |
| | TTFT 196 tokens | | 1262 ms |
| | Decode | | 8.6 tokens/s |
## Resources
### Hardware Documentation
Datasheet: https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
### Software Documentation
Docs: https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
SDK: https://www.ebaina.com/down/240000038900
### AI Development
LMM & AXCL: https://axcl-docs.readthedocs.io
Raspberry Pi 5 AXCL Guide: https://axcl-pi5-examples-cn.readthedocs.io
Model Hub: https://huggingface.co/AXERA-TECH
AI Toolchain (ONNX Conversion/Deployment)
- Pulsar2 (AXERA's ALL-IN-ONE Neural Network Compiler):
Docs: https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html
Download: https://huggingface.co/AXERA-TECH/Pulsar2/tree/main
op_support_list: https://pulsar2-docs.readthedocs.io/en/latest/appendix/op_support_list_ax650.html
Samples source: https://github.com/AXERA-TECH/ax-samples
LLM source: https://github.com/AXERA-TECH/ax-llm
## Technical Support
For custom development (kernel/OS customization, application-layer SDKs), contact: support@sipeed.

View File

@@ -0,0 +1,183 @@
# Installing M4N-Hat on Raspberry Pi 5
## Final Demo
After installation on Raspberry Pi 5, running the large language model QWen3 achieves 13.2 tokens/s (performance for smaller models is limited by PCIe link bandwidth, showing a gap compared to the standalone board's 19 tokens/s). Watch the demo video:
<video controls autoplay src="../../../zh/maixIV/assets/m4nhat/axcl-run-llm-on-raspi5-2025-07-03-4xspeedup.mp4" type="video/mp4"> Your browser does not support video playback. </video>
The video demonstrates:
1. Downloading the pre-supported QWen3-0.6B model
2. Setting up a Python virtual environment and installing required libraries
3. Running QWen3 and completing two Q&A sessions
## Installation
<div style="display: flex; justify-content: space-between;">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07559.JPG" style="width: 48%;">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07561.JPG" style="width: 48%;">
</div>
![](../../../zh/maixIV/assets/m4nhat/DSC07569.JPG)
## Flashing the M4N Slave System
1. Refer to the [System Flashing Guide](../m4n/system-update.html) and use AXDL to flash [AX650_card_V3.6.2_20250603154858_xxx.axp](https://dl.sipeed.com/MaixIV/M4N-Dock/09_Image/)。
2. Connect the M4N-Hat to the Raspberry Pi 5's PCIe slot using an FPC cable and secure it.
3. Power on the Raspberry Pi. Verify the accelerator card is detected with `lspci`:
```bash
# 应能看到以下输出
sipeed@raspberrypi:~$ lspci
0001:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
0001:01:00.0 Multimedia video controller: Axera Semiconductor Co., Ltd Device 0650 (rev01)
0002:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
0002:01:00.0 Ethernet controller: Raspberry Pi Ltd RP1 PCIe 2.0 South Bridge
```
The first two lines confirm PCIe initialization and detection of the Axera AX650 controller. ANd the `Multimedia video controller: Axera Semiconductor Co., Ltd Device 0650 (rev01)` has been mounted correctly.
**Troubleshooting PCIe Detection**
If the above output is missing, the PCIe x1 port may be disabled (default). Enable it via:
- Run `sudo raspi-config → 6 Advanced Options → A8 PCIe Speed → Select Yes` for PCIe x1 Gen3.
- or Manually add contents below to `/boot/firmware/config.txt`:
```bash
[all]
dtparam=pciex1_gen=3
```
Actually the `config.txt` file is located in the FAT32 type partition, so you can modify it after mount it on your PC directly.
> Note: Newly flashed Raspberry Pi SD cards lack the /boot/firmware directory. Boot once to generate it.
## Installing AXCL Software on Raspberry Pi 5
After PCIe detection, install the AXCL package for model acceleration:
```bash
$ sudo apt install axcl_host_aarch64_V3.6.2_20250603154858_NO4873.deb
```
Reboot the Pi. Verify installation with `axcl-smi`:
```bash
sipeed@raspberrypi:~$ axcl-smi
+------------------------------------------------------------------------------------------------+
| AXCL-SMI V3.6.2_20250603154858 Driver V3.6.2_20250603154858 |
+-----------------------------------------+--------------+---------------------------------------+
| Card Name Firmware | Bus-Id | Memory-Usage |
| Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
|=========================================+==============+=======================================|
| 0 AX650N V3.6.2 | 0001:01:00.0 | 148 MiB / 945 MiB |
| -- 55C -- / -- | 0% 0% | 18 MiB / 7040 MiB |
+-----------------------------------------+--------------+---------------------------------------+
+------------------------------------------------------------------------------------------------+
| Processes: |
| Card PID Process Name NPU Memory Usage |
|================================================================================================|
sipeed@raspberrypi:~$
```
## Testing AXCL Model Inference
Run `axcl_run_model` (usage mirrors native ax_run_model). Example with YOLOv5s (single-core model; full-core performance scales ~3x):
```bash
sipeed@raspberrypi:~$ axcl_run_model -m yolov5s.axmodel
Run AxModel:
model: yolov5s.axmodel
type: 1 Core
vnpu: Disable
warmup: 1
repeat: 1
batch: { auto: 1 }
axclrt ver: 1.0.0
pulsar2 ver: 1.2-patch2 7e6b2b5f
tool ver: 0.0.1
cmm size: 12730188 Bytes
------------------------------------------------------
min = 7.837 ms max = 7.837 ms avg = 7.837 ms
------------------------------------------------------
```
Performance Benchmarks Table
| Model | Input Size | Batch 1 (IPS) | Batch 8 (IPS) |
|---------------|------------|---------------|---------------|
| Inceptionv1 | 224 | 1073 | 2494 |
| Inceptionv3 | 224 | 478 | 702 |
| MobileNetv1 | 224 | 1508 | 4854 |
| MobileNetv2 | 224 | 1366 | 5073 |
| ResNet18 | 224 | 1066 | 2254 |
| ResNet50 | 224 | 576 | 1045 |
| SqueezeNet11 | 224 | 1560 | 5961 |
| Swin-T | 224 | 342 | 507 |
| ViT-B/16 | 224 | 162 | 207 |
| YOLOv5s | 640 | 326 | 394 |
| YOLOv6s | 640 | 282 | 322 |
| YOLOv8s | 640 | 248 | 279 |
| YOLOv9s | 640 | 237 | - |
| YOLOv10s | 640 | 298 | - |
| YOLOv11n | 640 | 860 | - |
| YOLOv11s | 640 | 305 | - |
| YOLOv11m | 640 | 114 | - |
| YOLOv11l | 640 | 87 | - |
| YOLOv11x | 640 | 41 | - |
## AXCL Advanced Usage
- [AXCL Documentation](https://axcl-docs.readthedocs.io)
- [RPi 5 AXCL Guide](https://axcl-pi5-examples-cn.readthedocs.io)
- Refer to [here](../m4n/axmodel-deploy.html) for detailed model development.
## Known Issues
### M4N-Hat Fails to Mount After Soft Reboot RPI5
Due to PCIe reset timing limitations, cold boot (power cycle) is required for successful mounting. A soft reboot leaves PCIe link down (line 18):
```bash
7.11 fs_open: 'armstub8-2712.bin'
7.15 Loading 'kernel_2712.img' to 0x00000000 offset 0x200000
7.33 Read kernel_2712.img bytes 9727677 hnd 0x3c43
9.93 PCI1 reset
9.03 PCI2 reset
9.13 set_reboot_order 0
9.13 set_reboot_arg1 0
9.14 USB-OTG disconnect
9.56 MESS:00:00:09.256590:0: Starting OS 9256 ms
9.62 MESS:00:00:09.262115:0: 00000040: -> 00000480
9.63 MESS:00:00:09.263966:0: 00000030: -> 00100080
9.68 MESS:00:00:09.268679:0: 00000034: -> 00100080
9.73 MESS:00:00:09.273392:0: 00000038: -> 00100080
9.78 MESS:00:00:09.278105:0: 0000003c: -> 00100080
NOTICE: BL31: v2.6(release):v2.6-240-gfc45bc492
NOTICE: BL31: Built : 12:55:13, Dec 4 2024
[ 0.695249] brcm-pcie 1000110000.pcie: link down
Debian GNU/Linux 12 raspberrypi ttyAMA10
My IP address is 192.168.10.176 fdae:b0ae:ebf1:0:b270:135e:b646:70c3
raspberrypi login:
```
**Workaround:**
Before rebooting, reset the M4N-Hat via GPIO:
```bash
gpioset gpiochip0 28=0 # Force M4N-Hat reset
reboot
```

View File

@@ -0,0 +1,157 @@
## System Update
For details, refer to the [Flashing OS Image](../m4n/system-update.html)The TFCard&eMMC image (Debian 12) is recommended.
The following instructions are based on this image. If using a custom-built image, pay attention to operational details.
## System Boot
### Pre-Boot Preparation
1. 5V USB power supply
2. mini HDMI cable and display
3. USB serial tool (e.g., [SLogic Combo8](../../logic_analyzer/combo8/index.html) (optional, for debugging/login))
### Normal Boot
<div style="display: flex; flex-wrap: wrap; gap: 10px; width: 100%;">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07545.JPG" style="width: calc(50% - 5px);">
<img src="../../../zh/maixIV/assets/m4nhat/DSC07546.JPG" style="width: calc(50% - 5px);">
</div>
1. Login Interface
- Connect a display via mini HDMI and power on. The core boards blue LED and Hat baseboards white LED should light up, indicating normal power supply.
- If the eMMC contains the default Raspberry Pi slave image, flash a new standalone image to the TF card and insert it into the M4N-Hat.
- Press and hold the `BOOT0` button, then press `RST`. After ~20 seconds, the LightDM login screen will appear, indicating a successful boot.
2. Xfce4 Desktop
- Connect a mouse/keyboard to the onboard USB-A port for input.
- Default credentials: Username: `root`, Password: `root`.
### Advanced: Serial & SSH Login
The onboard Type-C USB port serves as the default debug UART (**115200 8n1**).
Use a serial tool to view kernel logs or log in directly via terminal.
For SSH access, expand network connectivity via USB Ethernet/WiFi dongles.
Note: The system only has the root superuser, and SSH password login is disabled by default for security. For temporary access, refer to [here](../m4n/FAQ.md)。
## LLM
### DeepSeek-R1 & QWen3
Left: [DeepSeek-R1 1.5B](https://huggingface.co/AXERA-TECH/DeepSeek-R1-Distill-Qwen-1.5B)
Right: [QWen3 0.6B](https://huggingface.co/AXERA-TECH/Qwen3-0.6B)
Deployment guide: [here](../m4n/axmodel-deploy.html#部署大语言、多模态模型)
![DSr1-1.5B-and-QWen-0.6B](../../../zh/maixIV/assets/m4nhat/DSr1-1.5B-and-QWen-0.6B.jpg)
## VLM
### internVL3
![internVL3-demo](../../../zh/maixIV/assets/m4nhat/internVL3-demo.jpg)
Demo video:
<video controls autoplay src="../../../zh/maixIV/assets/m4nhat/m4nhat-run-llm-internVL-2025-07-07.mp4" type="video/mp4"> Your browser does not support video playback. </video>
## DepthAnything v2
1. Download the [axcl npu python library](https://github.com/AXERA-TECH/pyaxengine/releases)
2. Install: `pip install axengine-x.y.z-py3-none-any.whl`.
3. Run:
```bash
source ../venv-llm/bin/activate
python python/infer.py --img examples/demo02.jpg --model depth_anything_v2_vits_ax650.axmodel
```
![DepthAnything-v2-before](../../../zh/maixIV/assets/m4nhat/DSC07539.JPG)
![DepthAnything-v2-after](../../../zh/maixIV/assets/m4nhat/DSC07540.JPG)
![depthanything-output](../../../zh/maixIV/assets/m4nhat/depthanything-output.png)
## Interactive Image Segmentation & Inpainting
A QT-based GUI for real-time segmentation (point/box selection) and inpainting.
![samqt](../../../zh/maixIV/assets/samqt.jpg)
Open Source Official GitHub Repo: [SAM-ONNX-AX650-CPP](https://github.com/AXERA-TECH/SAM-ONNX-AX650-CPP)
Download prebuilt binaries or compile from source.
Example: Removing a player from a photo:
<div><table><tr>
<td><img src="../../../zh/maixIV/assets/sam_example_before.png" alt=sam_example_before border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_example_after.png" alt=sam_example_after border=0></td>
</tr></table></div>
Live Demo (Screenshots):
<div><table><tr>
<td><img src="../../../zh/maixIV/assets/sam_raw.jpg" alt=sam_raw border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_sam.jpg" alt=sam_sam border=0></td>
<td><img src="../../../zh/maixIV/assets/sam_inpaint.jpg" alt=sam_inpaint border=0></td>
</tr><tr>
<td>RAW</td>
<td>SAM</td>
<td>Inpaint</td>
</tr></table></div>
## Interactive Text-to-Image Search (CLIP)
A QT-based GUI using OpenAIs CLIP (Contrastive LanguageImage Pre-training) for zero-shot image retrieval via text input (supports Chinese/English).
Open Source Official GitHub Repo: [CLIP-ONNX-AX650-CPP](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP)
[DEMO VIDEO](https://github.com/sipeed/sipeed_wiki/assets/13964381/df4cec7f-29af-465f-bfad-e54312274437)
1. Install QT:
```bash
apt update
apt install cmake qt6-base-dev
```
2. Download prebuilt files (executable, models, test images/text):
- [Baidu Pan](https://pan.baidu.com/s/17M5ugUyuf9mbi1cHLGJHXg)
3. Extract *CLIP.zip* to `/root/Desktop/`:
```bash
root@m4nhat-7190c7:~/Desktop/CLIP# tree -L 1
.
├── CLIPQT
├── cn_vocab.txt
├── coco_1000
├── libonnxruntime.so
├── libonnxruntime.so.1.16.0
├── onnx_models
├── run_en.sh
├── run_zh.sh
└── vocab.txt
```
4. Run in Desktop's terminal:
```bash
./run_zh.sh # For Chinese
./run_en.sh # For English
```
Screenshots:
![b38722991915fa54f17df18ca1f1447](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/8fa2c4b8-b061-413e-b72d-298bb4a445aa)
![34c8b68b1a8721d4ebff3b4b7184733](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/7d0b9740-3598-492c-ad42-2de23e7764e2)

View File

@@ -107,6 +107,37 @@ items:
url: /ai/en/deploy/ax-pi.html
- label: Questions (FAQ)
file: maixIII/ax-pi/faq_axpi.md
- label: Maix-IV
items:
- label: Maix M4N
# file: maixIV/m4n/m4n.md
items:
- label: Flashing OS Image
file: maixIV/m4n/system-update.md
- label: AI Models Deployment
file: maixIV/m4n/axmodel-deploy.md
- label: FAQ
file: maixIV/m4n/FAQ.md
- label: Maix M4N-Dock
items:
- label: Intro
file: maixIV/m4ndock/intro.md
- label: Flashing OS Image
file: maixIV/m4n/system-update.md
- label: Quick Start
file: maixIV/m4ndock/quick-start.md
- label: FAQ
file: maixIV/m4ndock/FAQ.md
- label: Maix M4N-Hat
items:
- label: Intro
file: maixIV/m4nhat/intro.md
- label: Flashing OS Image
file: maixIV/m4n/system-update.md
- label: Quick Start
file: maixIV/m4nhat/quick-start.md
- label: RPI5 PCIe Card
file: maixIV/m4nhat/pcie-slaveboard.md
- label: MaixCAM
items:
- label: MaixCAM

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -4,6 +4,22 @@ title: 快速上手
## 硬件安装
### ⚠️注意
目前有两种外壳样式在发货,如果您收到了红白配色的外壳,则几乎不需要执行下面的步骤,因为配件都已经预先安装好了。
![case1](./assets/case1.png)![case2](./assets/case2.png)
如果您想自己打印新款外壳可以在makerworld下载模型文件自己打印链接是
https://makerworld.com.cn/zh/models/1311487
如果你想将三台Cluster安装在一个10英寸机柜上可以使用下面这个模型。
https://makerworld.com.cn/zh/models/1349837
![case3](./assets/case3.png)
### LM3H 安装
先将散热片粘贴到主控芯片上,以提升散热效果。安装核心板时,请确保方向正确,以免损坏设备。

View File

@@ -9,7 +9,7 @@ keywords: NanoKVM, Remote desktop, Lichee, PiKVM, RISCV, tool
1. 参考[这里](https://wiki.sipeed.com/hardware/zh/kvm/NanoKVM/system/updating.html#%E8%8E%B7%E5%8F%96-IP)连接开发板
2. 执行:`python /etc/kvm/update-nanokvm.py`
> 国外用户可能因为DNS原因下载失败请在 `/etc/resolv.conf` 添加`nameserver 119.29.29.29`或`nameserver 223.5.5.5`后再试
> 早期版本应用可能不存在该脚本文件,请下载 https://github.com/user-attachments/files/16939944/update-nanokvm.py.zip 解压赋予执行权限后再试
> 早期版本应用可能不存在该脚本文件,请下载 https://github.com/sipeed/NanoKVM/blob/main/kvmapp/system/update-nanokvm.py 解压赋予执行权限后再试
### 关于密码

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View File

@@ -0,0 +1,76 @@
## ssh 远程登录 root 用户,密码输入正确却登录不成功,要如何使能 root 用户密码登录 SSH
默认密码root
*考虑到安全性使用的默认策略root 用户只能通过密钥进行远程登录,可以免输密码不仅方便快捷且安全。其所需操作如下:通过串口或桌面登录系统后,手动粘贴个人公钥保存到`/root/.ssh/authorized_keys`文件内,该文件不存在可手动创建。更详细过程可搜索 SSH 密钥登录或直接查看该[教程](https://www.runoob.com/w3cnote/set-ssh-login-key.html)。*
若执意要通过密码登录,可如下操作:
```bash
# 登录进入串口终端,执行一遍下方命令
# 启用 root 用户远程密码登录
echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/allow-root.conf
systemctl restart sshd
```
开发结束后,避免 root 用户密码意外泄漏导致的各种风险,最好关闭 root 用户远程密码登录,执行下列操作:
```bash
# 登录进入任意终端,执行一遍下方命令
# 关闭 root 用户远程密码登录
rm /etc/ssh/sshd_config.d/allow-root.conf
systemctl restart sshd
```
## Q: 使用 TFCard&eMMC 镜像,根文件系统默认分区太小,如何扩容 eMMC 或者 TFCard
```bash
# 登录进入任意终端,执行一遍下方命令
# 替换下面的 mmcblkX 为 mmcblk0eMMC或 mmcblk1TFCard
# /dev/mmcblkXp2 为第二分区,也是根文件系统分区。
parted /dev/mmcblkX resizepart 2 100%
resize2fs /dev/mmcblkXp2
sync
```
## Q: 有些大语言模型需要执行 tokenizer 相关 python 脚本,执行报错 ModuleNotFoundError如何解决
```bash
# 避免污染系统 python 库,新建虚拟环境
apt install python3-venv
python3 -m venv venv-llm
# 激活该虚拟环境
source venv-llm/bin/activate
# 安装缺失的 python 模块,国内可使用清华镜像源加速
pip install transformers jinja2 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
# 安装完毕,可继续执行脚本
```
记得每次要执行相关 python 脚本前,要先激活已安装的虚拟环境:
```bash
# 激活该虚拟环境
source venv-llm/bin/activate
```
## Q: 类似 GPIO2_A27 已在设备树被配置成了 I2C3_SCL那在不使用 I2C3 的时候如何控制 GPIO2_A27 呢pinctrl
```bash
cd /sys/kernel/debug/pinctrl/4250200.pinctrl
grep "GPIO2_A27" pinmux-functions
# output # function 447: GPIO2_A27, groups = [ I2C3_SCL ]
grep "I2C3_SCL" pinmux-pins
# output # pin 87 (I2C3_SCL): device 2024000.i2c function i2c3_scl group I2C3_SCL
echo 2024000.i2c > /sys/bus/platform/drivers/i2c_designware/unbind
grep "I2C3_SCL" pinmux-pins
# output # pin 87 (I2C3_SCL): UNCLAIMED
# echo "<group-name function-name>" > pinmux-select
echo "I2C3_SCL GPIO2_A27" > pinmux-select
gpioset gpiochip2 27=0
gpioset gpiochip2 27=1
```
## QMAC 物理地址每次重启随机生成,导致 ip 地址不稳定,请问如何解决?
Asdcard-20250627.img.xz 开始第一分区FAT32根目录下会有 `config.txt` 文件,内为 uboot 的环境变量配置。添加环境变量 `ethaddr``eth1addr` 即可持久化修改对应网卡的mac地址
```
ethaddr=d0:00:00:00:00:01
eth1addr=d0:00:00:00:00:02
```
![](../assets/m4n/set-macaddress.png)

View File

@@ -1,4 +1,4 @@
# M4N-DOCK有关模型的部署
# M4N 部署 AI 模型
---
title: 外设使用
@@ -11,7 +11,7 @@ update:
- 加入了YOLOv8和YOLOv5部署
---
## 爱芯元智 AX650N 部署大语言、多模态模型
## 部署大语言、多模态模型
从下列网站获取模型和运行时。
@@ -29,23 +29,24 @@ update:
| SD1.5 | [lcm-lora-sdv1-5](https://huggingface.co/AXERA-TECH/lcm-lora-sdv1-5) | [lcm-lora-sdv1-5](https://hf-mirror.com/AXERA-TECH/lcm-lora-sdv1-5) |
| InternVL2.5:1b | [InternVL2_5-1B-Int8](https://huggingface.co/AXERA-TECH/InternVL2_5-1B) | [InternVL2_5-1B-Int8](https://hf-mirror.com/AXERA-TECH/InternVL2_5-1B) |
**请注意:以上模型都需要基于 `SDK 1.45.0` 版本编译打包出来的镜像才可运行大模型。请及时更新系统,我们提供的 TFCard&eMMC 镜像是符合条件的,且预留了 6GB 内存供模型加载运行使用,可以运行 7b 参数的 int4 大模型。**
**请注意:以上模型都需要基于 `SDK 1.45.0` (含)以后版本编译打包出来的镜像才可运行大模型。请及时更新系统,我们提供的 TFCard&eMMC 镜像是符合条件的,且预留了 6GB 内存供模型加载运行使用,可以运行 7b 参数的 int4 大模型。**
*快速体验 qwen3-0.6b*
```bash
# 可切换成其它大模型仓库的链接
git clone https://hf-mirror.com/AXERA-TECH/Qwen3-0.6B
pip install transformers jinja2 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
cd Qwen3-0.6B
chmod +x main_ax650
# 若执行报错 ModuleNotFoundError查阅 FAQ 相关细节
python3 qwen3_tokenizer_uid.py
# 切换成对应的执行脚本,和恢复必要程序的执行权限
chmod +x main_ax650
sh run_qwen3_0.6b_int8_ctx_ax650.sh
```
## 爱芯元智AX650N部署yolov5s 自定义模型
## 部署yolov5s 自定义模型
> 本博客将向你展示零基础一步步的部署好自己的yolov5s模型博主展示的是安全帽模型利用yolov5 官方的代码工具导出onnx模型并通过onnxsim自带的工具精简网络结构导出子图为了Pulsar2 工具进行处理模型做准备。
@@ -720,7 +721,7 @@ detection num: 7
## 爱芯元智AX650N部署yolov8s 自定义模型
## 部署yolov8s 自定义模型

View File

@@ -0,0 +1,114 @@
本指南详细介绍了 M4N-Dock 开发板的两种系统烧录方法:通过 TFCard 启动和烧录 eMMC以及通过 AXDL 工具烧录。请根据您的需求选择合适的方法。
## 镜像文件说明
*该页面介绍的烧录方法所使用的镜像包因体积过大,且下载站带宽有限故仅存储在百度企业网盘同级目录下,入口链接可见于[下载站页面顶端区域](https://dl.sipeed.com/)。*
| 镜像类型 | 启动特点 | 文件名 | 获取方法 |
|-------------------|-------------------------------------------|--------------|-------------------|
| TFCard&eMMC Image | `烧录 eMMC 上电自启``烧录 TFCard 手动启动` | `sdcard.img` | 下载路径MaixIV/M4N-Dock/09_Image/TFCard&eMMC Images |
| AXSDK AXP | `烧录 eMMC 上电自启` | `xxx.axp` | 下载路径MaixIV/M4N-Dock/09_Image/ubuntu |
若下载的镜像文件是 `.xz` 结尾请先进行解压操作。Linux 用户可使用 xz 工具Windows 用户可使用 7-zip 等工具。
![](../assets/baidupan-dl.png)
## 通过 TFCard 启动和烧录 eMMC
### 启动 Live 系统(需手动按键操作)
#### 第一步:准备 TFCard 并烧录镜像
准备一张至少 8GB 的 TFCard使用任意读卡器工具或电脑自带的卡槽进行读写。
注意按以下操作TFCard 内容将会全部丢失,如有重要数据请提前备份。
| 操作系统 | 烧录方法 |
|------------|--------------------------------------------------------------------------|
| Linux | `sudo dd if=sdcard.img of=/dev/sdX bs=4M conv=fsync status=progress` |
| Windows | 使用 `Win32DiskImager``Rufus``balenaEtcher` 进行烧录 |
附 Linux 例子:
```bash
# 使用读卡器挂载了 TFCard 为 /dev/sdb 设备
% sudo dd if=sdcard.img of=/dev/sdb bs=4G conv=sparse,fsync status=progress
0+3 records in
0+3 records out
5754429440 bytes (5.8 GB, 5.4 GiB) copied, 89.2665 s, 64.5 MB/s
```
#### 第二步:使用烧录有镜像的 TFCard 启动 Live 系统
**TFCard 启动方法**
| 底板 | 设备树 | TF 卡槽位置 | `BOOT` 按键位置 |
|------------|---------------------|--------------------------------|---------------------------|
| Dock | `dtbs/m4nbox.dtb` | 尾部左上方Type-C 座子的对角线位置 | Type-C 座子旁边 BOOT 丝印处 |
| Hat | `dtbs/m4nhat.dtb` | USB3 母座和缺口之间,位于背面 | HDMI 座子旁边 BOOT0 丝印处 |
| Cluster | `dtbs/m4ncluster.dtb` | M.2 座子下方 | Type-C 座子旁边 BOOT 丝印处 |
1. 挂载 TFCard 并修改 FAT32 分区 config.txt 文件中 `dtb_img_name=dtbs/m4nbox.dtb` 为对应底板的值。
2. 将 TFCard 插入 TF 卡槽内。
3. 按住 `BOOT` 按键不放复位1.重新上电 或 2.保持上电点按(按下再松开) `RST` 按键。
3.1. 如有外壳遮蔽(如 M4N-Dock需要移除前面板可拧下 3 颗螺丝然后旋转打开。
执行完以上操作, Live 系统应已启动可通过串口0看到系统启动的打印信息。
**该 Live 系统功能完全,可直接上手体验使用。如需要上电自启进入系统而不需要额外的按键操作的话,请固化镜像到 eMMC具体操作烦请续看下节。**
### 在 Live 系统内烧录 eMMC上电自动启动
板载 eMMC 的设备名将保持为 `/dev/mmcblk0`,相对的 TFCard 的设备名则为 `/dev/mmcblk1`,请注意区分。
现提供两个方法,都可以完成烧录镜像到板载 eMMC 的操作。可自行选择:
#### 方法一:直接安装 Live 系统
1. 按上节说明成功进入 Live 系统,接着打开终端执行后续操作。
2. 使用 `dd` 将 TFCard 内的 Live 系统直接还原到 eMMC 中,具体命令如下:
```sh
dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=3M count=1 conv=fsync
sync # 确保分区表生效
dd if=/dev/mmcblk1p1 of=/dev/mmcblk0p1 bs=64M conv=fsync
dd if=/dev/mmcblk1p2 of=/dev/mmcblk0p2 bs=1G conv=sparse,fsync status=progress
```
3. 等待上述指令执行完后,即可取出 TFCard。后续可直接上电或点按 `RST`,之后应能正常启动进入 eMMC 系统。
#### 方法二Live 系统内烧录镜像
要求:能够访问和读写已烧录 Live 系统的 TFCard 格式为 `ext4` 的第二分区,如不清楚相关知识点,那么该方法暂时不适用,请采用更通用的方法一。
1. 拷贝镜像文件 `sdcard.img` 到第二分区Live系统根目录任意地方。
2. 参考 TFCard 烧录 Live 系统镜像,执行以下命令:
```sh
dd if=/path/to/sdcard.img of=/dev/mmcblk0 bs=1G conv=sparse,fsync status=progress
```
3. 等待上述指令执行完后,即可取出 TFCard后续可直接上电或点按 `RST` 正常启动 eMMC 内系统。
## 通过 AXDL 烧录
烧录文件名格式为 `xxx.axp`。
具体操作方法见首页资源汇总软件开发文档压缩包内`AXDL 工具使用指南.pdf`。
**提示:官方 EVB 板上 Download 按键对应各底板的 BOOT 按键操作**
AXDL软件仅 Windows 可用)位于下载站`PC_Software`目录下。
**注意M4N-Dock 的 USB 烧录口是位于靠近 `HDMI` 接口的以太网座子最下面贴近板子的那一个 `USB-A` 口。请准备`A-to-A`的数据线,或者电脑有 `Type-C` 口也可以直接使用 `A-to-C` 的数据线。其余底板都是 Type-C**
**注意:烧写时不要连接 `12V` 电源,仅使用 USB 烧写线供电即可,否则有烧毁 `PC` 的 `USB接口` 的风险**

View File

@@ -32,10 +32,10 @@ root@ax650:~# grep -oP 'root=\K\S+' /proc/cmdline
/dev/mmcblk1p2 # TFCard 启动
# /dev/mmcblk0p2 # 或 eMMC 启动
```
可得知当前文件系统位于 `/dev/mmcblk0``/dev/mmcblk0`,用于替换下面的 `/dev/mmcblkX` 后执行命令:
可得知当前文件系统位于 `/dev/mmcblk0``/dev/mmcblk1`,用于替换下面的 `/dev/mmcblkX` 后执行命令:
```bash
parted /dev/mmcblkX resizepart 2 100%
resize2fs /dev/mmcblkX
resize2fs /dev/mmcblkXp2
sync
```

View File

@@ -45,7 +45,7 @@ AX650N 芯片规格书https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
AI工具链模型转换、仿真、部署ONNX
Pulsar2 由爱芯元智自主研发的 ALL-IN-ONE 新一代神经网络编译器
使用文档https://pulsar2-docs.readthedocs.io/zh_CN/latest/pulsar2/introduction.html
下载地址https://pan.baidu.com/s/1FazlPdW79wQWVY-Qn--qVQ?pwd=sbru
下载地址https://huggingface.co/AXERA-TECH/Pulsar2/tree/main
模型算子支持列表https://pulsar2-docs.readthedocs.io/zh_CN/latest/appendix/op_support_list.html

View File

@@ -1,98 +0,0 @@
**该页面介绍的烧录方法所使用的镜像包因体积过大,且下载站带宽有限故仅存储在百度企业网盘同级目录下,入口链接可见于下载站页面顶端区域。**
## 通过 TFCard 启动和烧录 eMMC
文件名格式为 `sdcard.img`
下载地址为:[MaixIV/M4N-Dock/09_Image/TFCard&eMMC Images](https://pan.baidu.com/e/1-r6V352TIN8eqiFEIsUQoA)。
下载的文件如果尾缀是 `.xz`请先进行解压操作。Linux 用户可使用 xz 工具Windows 用户可使用 7-zip 等工具。
具体操作方法如下:
### 启动 Live 系统
#### 准备 TFCard 并烧录镜像
准备一张至少 8GB 的 TFCard使用任意读卡器工具或电脑自带的卡槽进行读写。
注意按以下操作TFCard 内容将会全部丢失,如有重要数据请提前备份。
##### Linux 系统
使用 `dd` 将镜像文件写卡:
```sh
sudo dd if=sdcard.img of=/path/to/tfcard bs=4G conv=sparse,fsync status=progress
```
##### 或 Windows 系统
使用 `win32diskimager``balenaEtcher` 等写卡工具选择镜像文件 `sdcard.img` 进行烧写。
#### 使用烧录有镜像的 TFCard 启动 Live 系统
1. 将 TFCard 插入 M4N-Dock 尾部左下方的 TF 卡槽内。
2. 保持板卡正常上电,请使用 DC 进行供电。
3. 按住前端 Type-C 座子附近的 `BOOT` 按键不放,点按(按下再松开) `RST` 按键。
3.1. (选做)如有外壳需要移除前面板,拧下 3 颗螺丝即可旋转打开。
-----------
执行完以上操作, Live 系统应已启动,可在 Type-C 串口里面看到系统启动的打印信息。
该 Live 系统具备功能完全,可直接体验使用。如有固化到 eMMC 来解放 TFCard 以作他用的需求,可续看下节。
### 在 Live 系统内烧录 eMMC
eMMC 的设备文件保持为 `/dev/mmcblk0`
先提供两个方法烧录到板载的 eMMC 中,请根据条件进行二择:
#### 方法一:直接安装 Live 系统
1. 按上节说明成功启动 Live 系统,接着通过 Type-C 串口执行下列操作。
2. 使用 `dd` 将 TFCard 内的 Live 系统直接还原到 eMMC中命令如下
```sh
dd if=/dev/mmcblk1 of=/dev/mmcblk0 bs=3M count=1 conv=fsync
sync
dd if=/dev/mmcblk1p1 of=/dev/mmcblk0p1 bs=64M conv=fsync
dd if=/dev/mmcblk1p2 of=/dev/mmcblk0p2 bs=1G conv=sparse,fsync status=progress
```
3. 等待上述指令执行完后,即可取出 TFCard后续可直接上电或点按 `RST` 正常启动 eMMC 内系统。
#### 方法二Live 系统内烧录镜像
要求:能够访问和读写已烧录 Live 系统的 TFCard 格式为 `ext4` 的第二分区,如不清楚相关知识点,那么该方法暂时不适用,请采用更通用的方法一。
1. 拷贝镜像文件 `sdcard.img` 到第二分区Live系统根目录任意地方。
2. 参考 TFCard 烧录 Live 系统,执行以下命令:
```sh
sudo dd if=/path/to/sdcard.img of=/dev/mmcblk0 bs=1G conv=sparse,fsync status=progress
```
3. 等待上述指令执行完后,即可取出 TFCard后续可直接上电或点按 `RST` 正常启动 eMMC 内系统。
## 通过 AXDL 烧录
烧录文件名格式为 `xxx.axp`。
具体操作方法见首页资源汇总软件开发文档压缩包内`AXDL 工具使用指南.pdf`。
**提示:官方 EVB 板上 Download 按键对应 M4NDOCK 的 BOOT 按键**
AXDL软件仅 Windows 可用)位于下载站`PC_Software`目录下。
**注意USB 烧录口是位于靠近 `HDMI` 接口的以太网座子最下面贴近板子的那一个 `USB-A` 口。请准备`A-to-A`的数据线,或者电脑有 `Type-C` 口也可以直接使用 `A-to-C` 的数据线**
**注意:烧写时不要连接 `12V` 电源,仅使用 USB 烧写线供电即可,否则有烧毁 `PC` 的 `USB接口` 的风险**

View File

@@ -0,0 +1,100 @@
## 简介
M4N-Hat 是 Sipeed 公司推出的高集成度 AI 计算模组,采用爱芯元智 AX650N/C 芯片的紧凑型解决方案。作为嵌入式设备扩展模块,在提供 72TOPS@INT4(18TOPS@INT8) 算力的同时,保留与 M4N-Dock 同源的 8K 编解码能力,专为空间受限的边缘计算场景设计。
本模组支持主流树莓派系列开发板即插即用,并支持 Transformer 架构加速。通过板载 0.8mm 4Pin USB 和 Type-A USB SS 5Gbps 接口可快速扩展摄像头、存储等外设是智能摄像头、工业质检等轻量级AI应用的理想选择。PCIE2.0 扩展接口完美适配树莓派5支持构建多模态边缘计算节点支持 QWen 2.5、QWen 3、DeepSeek、InternVL2.5 等大模型的量化部署。
## 图片展示
<div style="display: flex; flex-wrap: wrap; gap: 10px; width: 100%;">
<img src="../assets/m4nhat/DSC07555.JPG" style="width: calc(50% - 5px);">
<img src="../assets/m4nhat/DSC07569.JPG" style="width: calc(50% - 5px);">
<img src="../assets/m4nhat/DSC07556.JPG" style="width: calc(50% - 5px);">
<img src="../assets/m4nhat/neofetch.jpg" style="width: calc(50% - 5px);">
</div>
## 接口标注
![接口标注](../assets/m4nhat/IAD.png)
## 功能参数
| 设备 | 详细描述 |
| ------- | --------------------------------------------------- |
| CPU | 8x A55@1.7Ghz,集成 FPU支持 NEON 加速 |
| NPU | 72 TOPS@INT4 或 18 TOPS@INT8支持INT4/INT8/INT16/FP16/FP32 输入,支持 TopN(N<=32) |
| CODEC | 支持 H.264/H.265 编解码,单路最大 8K@60fps 解码和 8K@30ps 编码 |
| DSP | 双核800Mhz |
| RAM | 8G 64bit LPDDR4x系统内核和 AI CMM 使用占比可调,默认 2+6 配置 |
| ROM | 32G eMMC 5.1,系统盘 |
| 视频输出 | 1x HDMI 2.0a最大分辨率4K@60fps |
| 摄像头输入| 1x 0.8mm 4p 外接 USB 摄像头 |
| PCIE扩展 | 1x 16p fpc 1Lane PCIE2.0 5Gbps兼容树莓派5 |
| USB扩展 | 1x Type-A USB SS 5Gbps + 1x Type-C USB HS 480Mbps |
| 外部连接 | 1x 1.25mm 2p 外接扬声器 + 1x 1.25mm 2p 外接风扇 + 1x 10p fpc 外接 SPI 屏幕 + 1x 6p fpc 外接 I2C 触摸 |
![](../assets/m4n/benchmark.png)
![](../assets/m4n/normalized_benchmark.png)
| Models | RK3588@6T| Maix4@18T | Hailo8 26T | Hailo8 13T |
|-------------|----------|------------|------------|------------|
| Inceptionv1 | 43 | 2494 | 928 | 519 |
| MobileNetv2 | 960 | 5073 | 2433 | 1738 |
| SqueezeNet11| 694 | 5961 | - | - |
| ResNet18 | 543 | 2254 | - | - |
| ResNet50 | 294 | 1045 | 1368 | 503 |
| SwinT | 21 | 401 | - | - |
| ViT-B/16 | 18 | 207 | 107 | 40 |
| YOLOv5s | 48 | 384 | 364 | 168 |
| YOLOv5n | 78 | 743 | - | - |
| YOLOv6s | 80 | 321 | - | - |
| YOLOv6n | 212 | 743 | - | - |
| YOLOv8s | 39 | 279 | - | - |
| YOLOv8n | 73 | 710 | - | - |
| YOLOxs | 34 | 304 | - | - |
| YOLO11s | 30 | 313 | - | - |
| Models | Item | Maix4@18T | RK3588@6T |
|------------------------------|------------------------------|--------------|--------------|
| SmolVLM-256M | Image Encoder 512*512 | 105ms | 842ms |
| | TTFT | 57ms | 87ms |
| | Decode | 80 tokens/s | 77 tokens/s |
| StableDiffusion 1.5(512*512) | U-Net | 0.43 s/it | 5.65 s/it |
| | VAE Decoder | 0.91 s | 11.13 s |
| Qwen2.5-VL-3B | Image Encoder 448*448 | 780 ms | |
| | TTFT 320 tokens | 2857 ms | |
| | Decode | 6.2 tokens/s | |
| | Image Encoder 392*392 | | 2930 ms |
| | TTFT 196 tokens | | 1262 ms |
| | Decode | | 8.6 tokens/s |
## 资源汇总
### 硬件相关资料汇总
AX650N 芯片规格书https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
### 软件开发资料汇总
软件开发文档https://dl.sipeed.com/shareURL/MaixIV/M4N-Dock
软件开发SDKhttps://www.ebaina.com/down/240000038900
### AI 开发资料汇总
大模型和AXCLhttps://axcl-docs.readthedocs.io
树莓派5 AXCL专项https://axcl-pi5-examples-cn.readthedocs.io
模型仓库https://huggingface.co/AXERA-TECH
AI工具链模型转换、仿真、部署ONNX
Pulsar2 由爱芯元智自主研发的 ALL-IN-ONE 新一代神经网络编译器
使用文档https://pulsar2-docs.readthedocs.io/zh_CN/latest/pulsar2/introduction.html
下载地址https://huggingface.co/AXERA-TECH/Pulsar2/tree/main
模型算子支持列表https://pulsar2-docs.readthedocs.io/zh_CN/latest/appendix/op_support_list_ax650.html
Samples 源码https://github.com/AXERA-TECH/ax-samples
LLM 源码https://github.com/AXERA-TECH/ax-llm
## 技术支持
若有特定业务开发需求需要应用层开发文档或在系统层对内核和根文件系统有特定需求或需要定制开发请发邮件到support@sipeed.com尝试获取支持。

View File

@@ -0,0 +1,166 @@
# 树莓派 5 安装 M4N-Hat
## 最终结果演示
树莓派 5 安装后,演示运行大模型 QWen3性能达 13.2 tokens/s较小参数量模型性能受限于 PCIe链接对比单板直接运行结果 19 tokens/s 差距会稍大)。见以下视频:
<video controls autoplay src="../assets/m4nhat/axcl-run-llm-on-raspi5-2025-07-03-4xspeedup.mp4" type="video/mp4"> Your browser does not support video playback. </video>
视频中完整演示了:
1. 下载已支持的大语言模型 QWen3-0.6B
2. 准备 python-venv 环境,安装所需 python 库
3. 运行 QWen3 并完成两次问答
## 安装
<div style="display: flex; justify-content: space-between;">
<img src="../assets/m4nhat/DSC07559.JPG" style="width: 48%;">
<img src="../assets/m4nhat/DSC07561.JPG" style="width: 48%;">
</div>
![](../assets/m4nhat/DSC07569.JPG)
## M4N 烧录从机系统
1.参考 [System Flashing Guide](../m4n/system-update.html) 使用 AXDL 烧录 [AX650_card_V3.6.2_20250603154858_xxx.axp](https://dl.sipeed.com/MaixIV/M4N-Dock/09_Image/)。
2.然后 fpc 排线连接 M4N-Hat 和 树莓派 5 的 pcie 座子,并确认固定完毕。
3.上电进入树莓派的系统。使用 lspci 命令检查加速卡是否正确被识别:
```bash
# 应能看到以下输出
sipeed@raspberrypi:~$ lspci
0001:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
0001:01:00.0 Multimedia video controller: Axera Semiconductor Co., Ltd Device 0650 (rev01)
0002:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2712 PCIe Bridge (rev 21)
0002:01:00.0 Ethernet controller: Raspberry Pi Ltd RP1 PCIe 2.0 South Bridge
```
其中前两行信息则表示树莓派的 pcie 初始化成功,并识别挂载了 `Multimedia video controller: Axera Semiconductor Co., Ltd Device 0650 (rev01)`
3.1. 若不显示如上前两行信息,很有可能是树莓派的该 pciex1 端口并未启用(默认行为),因此需要额外以下操作:
执行 `sudo raspi-config` 并进入 `6 Advanced Options -> A8 PCIe Speed`,选择 `Yes` 以使能 pciex1 gen3。
或检查 `/boot/firmware/config.txt` 中的内容(文件末尾)是否包含以下字段:
```bash
[all]
dtparam=pciex1_gen=3
```
实际上这个 `config.txt` 文件所在 SD 卡的 boot 分区为 FAT32 格式,因此可被广大操作系统识别和读写。可在树莓派关机后取出,并通过读卡器插在 PC 上直接修改。
> 注意:刚烧录树莓派镜像的新卡不存在这个 /boot/firmware 目录,此时需要插入树莓派完整启动一次才会生成上文所描述的结构。
## Raspi 5 安装 AXCL 软件包
pcie 可以正常识别到 M4N-Hat 后,还需要继续安装 AXCL 软件包以提供支持,才能通过 M4N-Hat 加速运行模型。
该软件包 `axcl_host_aarch64_V3.6.2_20250603154858_NO4873.deb` 与先前的 M4N 系统镜像 xx.axp 位于下载站同一目录。
下载到树莓派开发板上,然后运行安装命令:
```bash
$ sudo apt install axcl_host_aarch64_V3.6.2_20250603154858_NO4873.deb
```
安装成功后,断电重启树莓派。
此时运行 `axcl-smi` 显示内容如下,即代表安装成功:
```bash
sipeed@raspberrypi:~$ axcl-smi
+------------------------------------------------------------------------------------------------+
| AXCL-SMI V3.6.2_20250603154858 Driver V3.6.2_20250603154858 |
+-----------------------------------------+--------------+---------------------------------------+
| Card Name Firmware | Bus-Id | Memory-Usage |
| Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
|=========================================+==============+=======================================|
| 0 AX650N V3.6.2 | 0001:01:00.0 | 148 MiB / 945 MiB |
| -- 55C -- / -- | 0% 0% | 18 MiB / 7040 MiB |
+-----------------------------------------+--------------+---------------------------------------+
+------------------------------------------------------------------------------------------------+
| Processes: |
| Card PID Process Name NPU Memory Usage |
|================================================================================================|
sipeed@raspberrypi:~$
```
## 测试 AXCL 模型推理能力
测试一下 `axcl_run_model` (与原生系统内 ax_run_model 同样使用方法),推理 yolov5s 的性能与 M4N 原生系统上的数据极度接近。(使用的板卡文件系统自带 yolov5s 模型为单核模型,"type: 1 Core", 实际满核性能为 x3
```bash
sipeed@raspberrypi:~$ axcl_run_model -m yolov5s.axmodel
Run AxModel:
model: yolov5s.axmodel
type: 1 Core
vnpu: Disable
warmup: 1
repeat: 1
batch: { auto: 1 }
axclrt ver: 1.0.0
pulsar2 ver: 1.2-patch2 7e6b2b5f
tool ver: 0.0.1
cmm size: 12730188 Bytes
------------------------------------------------------
min = 7.837 ms max = 7.837 ms avg = 7.837 ms
------------------------------------------------------
```
其余常用模型的性能实测数据如下表:
| Model | Input Size | Batch 1 (IPS) | Batch 8 (IPS) |
|---------------|------------|---------------|---------------|
| Inceptionv1 | 224 | 1073 | 2494 |
| Inceptionv3 | 224 | 478 | 702 |
| MobileNetv1 | 224 | 1508 | 4854 |
| MobileNetv2 | 224 | 1366 | 5073 |
| ResNet18 | 224 | 1066 | 2254 |
| ResNet50 | 224 | 576 | 1045 |
| SqueezeNet11 | 224 | 1560 | 5961 |
| Swin-T | 224 | 342 | 507 |
| ViT-B/16 | 224 | 162 | 207 |
| YOLOv5s | 640 | 326 | 394 |
| YOLOv6s | 640 | 282 | 322 |
| YOLOv8s | 640 | 248 | 279 |
| YOLOv9s | 640 | 237 | - |
| YOLOv10s | 640 | 298 | - |
| YOLOv11n | 640 | 860 | - |
| YOLOv11s | 640 | 305 | - |
| YOLOv11m | 640 | 114 | - |
| YOLOv11l | 640 | 87 | - |
| YOLOv11x | 640 | 41 | - |
## AXCL 更详细使用说明
**其余详细信息可查看 [axcl官方文档](https://axcl-docs.readthedocs.io)。**
**另有 [树莓派5 AXCL专项页面](https://axcl-pi5-examples-cn.readthedocs.io)。**
可于 [文中](../m4n/axmodel-deploy.html) 介绍到的大模型仓库下载各种已被支持的大模型,并在树莓派上部署运行。
## 已知问题
### 不断电重启树莓派会导致 M4N-Hat 无法再次挂载
> 注意:
> 目前有一已知问题,因为当前板卡不能满足树莓派的启动过程中关于 pciex1 的复位时序,所以只有断电后再冷启动才能成功挂载 M4N-Hat。而在挂载成功后若是保持不断电来重启树莓派会导致下一次树莓派无法挂载 M4N-Hat。因此每次都需要断电后再冷启动树莓派。
若是直接重启了树莓派,树莓派串口应会打印如下启动日志。其中第 18 行显示 `1000110000.pcie: link down`,表示 pcie 建立链接失败,显然此时未能成功挂载 M4N-Hat。
```bash
7.11 fs_open: 'armstub8-2712.bin'
7.15 Loading 'kernel_2712.img' to 0x00000000 offset 0x200000
7.33 Read kernel_2712.img bytes 9727677 hnd 0x3c43
9.93 PCI1 reset
9.03 PCI2 reset
9.13 set_reboot_order 0
9.13 set_reboot_arg1 0
9.14 USB-OTG disconnect
9.56 MESS:00:00:09.256590:0: Starting OS 9256 ms
9.62 MESS:00:00:09.262115:0: 00000040: -> 00000480
9.63 MESS:00:00:09.263966:0: 00000030: -> 00100080
9.68 MESS:00:00:09.268679:0: 00000034: -> 00100080
9.73 MESS:00:00:09.273392:0: 00000038: -> 00100080
9.78 MESS:00:00:09.278105:0: 0000003c: -> 00100080
NOTICE: BL31: v2.6(release):v2.6-240-gfc45bc492
NOTICE: BL31: Built : 12:55:13, Dec 4 2024
[ 0.695249] brcm-pcie 1000110000.pcie: link down
Debian GNU/Linux 12 raspberrypi ttyAMA10
My IP address is 192.168.10.176 fdae:b0ae:ebf1:0:b270:135e:b646:70c3
raspberrypi login:
```
> 当然现有一更简便方法。我们把树莓派的一个 GPIO 连到了 M4N-Hat 的复位引脚上,因此若需要保持不断电也能重启树莓派并能成功挂载。需要在每次重启前先执行命令 `gpioset gpiochip0 28=0` 让 M4N-Hat 进入复位状态,再正常执行树莓派重启命令即可再次正常挂载。

View File

@@ -0,0 +1,131 @@
## 系统烧录
详情见 [系统烧录指南](../m4n/system-update.html),请优先考虑 TFCard&eMMC 镜像Debian 12 系统)。
以下基于该镜像展开介绍,若使用自行编译的镜像,请多加注意细节对比。
## 系统启动
### 开机前准备
1. 5V USB 供电电源
2. mini HDMI 线缆和显示器
3. USB 串口工具如 [SLogic Combo8](../../logic_analyzer/combo8/index.html)(可选项,用于串口调试和登录)
### 正常开机
1. 登录界面
通过 mini HDMI 连接显示器并接入供电此时核心板应亮起蓝灯Hat 底板亮起白灯,表明供电正常。如果 eMMC 为默认供树莓派启动的从机镜像,请注意烧录独立新镜像到 TF 卡并插入 M4N-Hat。再保持 `BOOT0` 键按下时点按 `RST`,等待片刻约 20 多秒后显示器屏幕将会如下显示 LightDM 登录界面,表示系统启动成功。
2. 系统桌面
板载 USB-A 口连接鼠标、键盘,方便后续系统操作和输入。登录界面等待输入用户名和密码,默认都为 root确认登录即可进入 XFCE4 桌面系统。
<div style="display: flex; flex-wrap: wrap; gap: 10px; width: 100%;">
<img src="../assets/m4nhat/DSC07545.JPG" style="width: calc(50% - 5px);">
<img src="../assets/m4nhat/DSC07546.JPG" style="width: calc(50% - 5px);">
</div>
### 串口和SSH登录进阶
板载 USB Type-C 接口为默认调试串口,波特率相关配置为 **115200 8n1**
用户可通过串口工具打开该串口,以查看内核调试信息,也可在此处通过用户名和密码直接登录系统终端进行命令操作。
若需通过 SSH 登录,可通过 USB有线/无线网卡 扩展网络链接。
注意:本系统仅内置 root 超级用户,且考虑到安全性并未开启超级用户 SSH 密码登录。
若临时有该需求请参阅[这里](../m4n/FAQ.md)。
## LLM
### DeepSeek-R1 & QWen3
左侧:[DeepSeek-R1 1.5B](https://huggingface.co/AXERA-TECH/DeepSeek-R1-Distill-Qwen-1.5B)
右侧:[QWen3 0.6B](https://huggingface.co/AXERA-TECH/Qwen3-0.6B)
部署参考[此处](../m4n/axmodel-deploy.html#部署大语言、多模态模型)
![DSr1-1.5B-and-QWen-0.6B](../assets/m4nhat/DSr1-1.5B-and-QWen-0.6B.jpg)
## VLM
### internVL3
![internVL3-demo](../assets/m4nhat/internVL3-demo.jpg)
操作过程如下视频:
<video controls autoplay src="../assets/m4nhat/m4nhat-run-llm-internVL-2025-07-07.mp4" type="video/mp4"> Your browser does not support video playback. </video>
## DepthAnything v2
下载[axcl npu python 库](https://github.com/AXERA-TECH/pyaxengine/releases)后,`pip install axengine-x.y.z-py3-none-any.whl` 进行安装。
```bash
source ../venv-llm/bin/activate
python python/infer.py --img examples/demo02.jpg --model depth_anything_v2_vits_ax650.axmodel
```
![DepthAnything-v2-before](../assets/m4nhat/DSC07539.JPG)
![DepthAnything-v2-after](../assets/m4nhat/DSC07540.JPG)
![depthanything-output](../assets/m4nhat/depthanything-output.png)
## 交互式图像分割和修复Segment and Inpaint Anything
交互式图像分割和修复基于QT的GUI交互界面实现了交互式点选、框选的实时分割和进一步可选修复具体效果预览和操作流程如下。
![samqt](../assets/samqt.jpg)
原始代码由爱芯官方开源于 GITHUB[SAM-ONNX-AX650-CPP](https://github.com/AXERA-TECH/SAM-ONNX-AX650-CPP) 可下载官方预编译版本或按仓库内文档自行编译进行体验,下图是移除照片某球员的效果展示。
<div><table><tr>
<td><img src="../assets/sam_example_before.png" alt=sam_example_before border=0></td>
<td><img src="../assets/sam_example_after.png" alt=sam_example_after border=0></td>
</tr></table></div>
以下是实机操作画面。
<div><table><tr>
<td><img src="../assets/sam_raw.jpg" alt=sam_raw border=0></td>
<td><img src="../assets/sam_sam.jpg" alt=sam_sam border=0></td>
<td><img src="../assets/sam_inpaint.jpg" alt=sam_inpaint border=0></td>
</tr><tr>
<td>RAW</td>
<td>SAM</td>
<td>Inpaint</td>
</tr></table></div>
## 交互式以文搜图CLIP
交互式以文搜图示例基于QT的GUI交互解码采用 OpenAI 在 2021 年开源的 Zero-Shot 视觉分类模型 CLIP(Contrastive LanguageImage Pre-training) 通过文本输入快速检索出相关图片并显示,支持中文、英文两种文本语言输入。
原始代码由爱芯官方开源于 GITHUB[CLIP-ONNX-AX650-CPP](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP)
[DEMO VIDEO](https://github.com/sipeed/sipeed_wiki/assets/13964381/df4cec7f-29af-465f-bfad-e54312274437)
准备 QT 运行环境
```
apt update
apt install cmake qt6-base-dev
```
下载预编译好的可执行文件、模型文件、测试图片、测试文本
- [Baidu Pan](https://pan.baidu.com/s/17M5ugUyuf9mbi1cHLGJHXg)
将下载获得的 *CLIP.zip*`/root/Desktop/` 路径下解压得到以下内容
```
root@m4nhat-7190c7:~/Desktop/CLIP# tree -L 1
.
├── CLIPQT
├── cn_vocab.txt
├── coco_1000
├── libonnxruntime.so
├── libonnxruntime.so.1.16.0
├── onnx_models
├── run_en.sh
├── run_zh.sh
└── vocab.txt
```
使用 HDMI 基于 HDMI1 接口链接显示器并登录进入桌面, 打开控制终端运行 `run_zh.sh`
![b38722991915fa54f17df18ca1f1447](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/8fa2c4b8-b061-413e-b72d-298bb4a445aa)
CLIP DEMO 正常运行
![34c8b68b1a8721d4ebff3b4b7184733](https://github.com/AXERA-TECH/CLIP-ONNX-AX650-CPP/assets/13964381/7d0b9740-3598-492c-ad42-2de23e7764e2)

View File

@@ -111,19 +111,34 @@ items:
file: maixIII/ax-pi/faq_axpi.md
- label: Maix-IV
items:
# - label: Maix M4N
# file: maixIV/m4n/m4n.md
- label: Maix M4N-DOCK
file: maixIV/m4ndock/m4ndock.md
- label: M4N & M4C SoM
items:
- label: 系统烧录指南
file: maixIV/m4n_c-SoM/system-update.md
- label: AI 模型部署
file: maixIV/m4n_c-SoM/axmodel-deploy.md
- label: FAQ
file: maixIV/m4n_c-SoM/FAQ.md
- label: M4 Dock Carrier Board
items:
- label: 产品介绍
file: maixIV/m4ndock/intro.md
- label: 系统烧录指南
file: maixIV/m4n_c-SoM/system-update.md
- label: 产品上手指南
file: maixIV/m4ndock/quick-start.md
- label: 系统烧录指南
file: maixIV/m4ndock/system-update.md
- label: AI 模型部署
file: maixIV/m4ndock/axmodel-deploy.md
- label: FAQ
file: maixIV/m4ndock/FAQ.md
- label: M4 Hat Carrier Board
items:
- label: 产品介绍
file: maixIV/m4nhat/intro.md
- label: 系统烧录指南
file: maixIV/m4n_c-SoM/system-update.md
- label: 产品上手指南
file: maixIV/m4nhat/quick-start.md
- label: 树莓派5 PCIe 加速指南
file: maixIV/m4nhat/pcie-slaveboard.md
- label: MaixCAM
items:
- label: MaixCAM 介绍和资料

View File

@@ -348,9 +348,10 @@ msgstr ""
" support, security smart IPC"
#: maix.html:289
msgid "10Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
#, fuzzy
msgid "18Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
msgstr ""
"10Tops AI computing power, 32 channels of 1080p HD AI video surveillance,"
"18Tops AI computing power, 32 channels of 1080p HD AI video surveillance,"
" AI large model support"
#: maix.html:297

View File

@@ -337,7 +337,7 @@ msgid "3.6Tops AI ISP微光夜视大量常见 AI 模型支持,安防智
msgstr ""
#: maix.html:289
msgid "10Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
msgid "18Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
msgstr ""
#: maix.html:297

View File

@@ -337,7 +337,7 @@ msgid "3.6Tops AI ISP微光夜视大量常见 AI 模型支持,安防智
msgstr ""
#: maix.html:289
msgid "10Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
msgid "18Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
msgstr ""
#: maix.html:297
@@ -843,3 +843,6 @@ msgstr ""
#~ msgid "RISC-V 1GHz + 1Tops NPU, 4M高清摄像头2.3寸552x368高清电容触摸屏完美支持全新 Maix 生态所有软件"
#~ msgstr ""
#~ msgid "10Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持"
#~ msgstr ""

View File

@@ -286,7 +286,7 @@
img: "/static/home/m4ndock.png",
title: "Maix-IV (AXeraPi-Pro)",
brief:
"{{_('10Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持')}}",
"{{_('18Tops AI 算力32 路 1080p 高清 AI 视频监控AI 大模型支持')}}",
btns: [
{
label: "{{_('文档')}}",

View File

@@ -0,0 +1,17 @@
<script>
var hash = window.location.hash
var url_language = "zh"
if( navigator.language.indexOf("zh") == -1 )
{
url_language = "en"
}
switch (window.location.hash) {
case "#c8" :
location.href = window.location.origin + "/hardware/" + url_language + "/maixIV/m4ndock/intro.html"
break;
default :
location.href = window.location.origin + "/hardware/" + url_language + "/maixIV/m4ndock/intro.html"
}
</script>

View File

@@ -1,4 +0,0 @@
---
layout: redirect
redirect_url: /hardware/zh/maixIV/m4ndock/m4ndock.html
---

View File

@@ -0,0 +1,17 @@
<script>
var hash = window.location.hash
var url_language = "zh"
if( navigator.language.indexOf("zh") == -1 )
{
url_language = "en"
}
switch (window.location.hash) {
case "#c8" :
location.href = window.location.origin + "/hardware/" + url_language + "/maixIV/m4nhat/intro.html"
break;
default :
location.href = window.location.origin + "/hardware/" + url_language + "/maixIV/m4nhat/intro.html"
}
</script>