How to deploy Custom-Trained model in HUSKYLENS 2
This guide instructs users on deploying custom-trained visual recognition models in HUSKYLENS 2, covering both code-free methods using Mind+ AI tools and Python-based YOLO model training techniques, ensuring an updated firmware for successful deployment.
1. Deploy Custom-Trained Models
The official model conversion tool for HUSKYLENS 2 only supports converting YOLOv8n series models, including object detection, image classification, and instance segmentation models. Other model architectures, variants, or custom model formats are currently not supported and cannot be deployed to HUSKYLENS 2.
Besides the built-in visual recognition functions of HUSKYLENS 2, users can also train their own models and deploy them to HUSKYLENS 2 to create customized visual recognition projects. To use this feature, ensure HUSKYLENS 2 is updated to the latest firmware. Click Firmware Update to view the tutorial.
This document covers three workflows:
- Train models without coding via the Mind+ AI Tool and deploy to HUSKYLENS 2 with one click (requires internet access on the computer)
- Train models without coding via the Mind+ AI Tool, convert models using a local deployment environment, and deploy to HUSKYLENS 2 (offline capable)
- Train YOLO models using Python code and deploy to HUSKYLENS 2
If you have no experience training YOLO models and want a quick start, follow 1.1 No-Code Model Training and Deployment – Mind+ Server.
If you already have a trained YOLOv8n ONNX model, skip ahead to 1.3.4 Deploy the Model to HUSKYLENS 2.
1.1 No-Code Model Training and Deployment – Mind+ Server
Complete model training following this tutorial: MindPlus 2.0 Wiki - 4.2.2 [Object Detection] Quick Experience.
Once training finishes, click Deploy to HUSKYLENS 2.
-
Step 1: Select an icon
Choose a suitable icon for your model application. Multiple preset icons are available. You can pick one from the preview list, or click+to upload a custom icon. We recommend using 60×60 PNG images with transparent backgrounds and white line icons. -
Step 2: Enter App Name and Title
Define the App Name and Title based on model functionality. For example, if the model is used for supermarket product recognition, set both fields toProduct Recognition. -
Step 3: Click Start Conversion
Click Start Conversion to begin the process.
Wait for the prompt model converted successfully, then click Download to Computer.
Save the converted model archive to your local computer.
Connect your computer to HUSKYLENS 2 with a Type-C cable. After connection, a removable drive named Huskylens will appear.
Copy the downloaded model ZIP file into the path:
\storage\installation_package on the Huskylens drive.
Tap the HUSKYLENS 2 screen to wake the device if it is sleeping, then navigate into the Model Installation menu.
Select Local Installation. After successful installation, the screen will show the interface below.
Check the HUSKYLENS 2 home screen. If the new function Product Recognition appears, your custom-trained model has been imported successfully.
Tap to open Product Recognition and test the inference performance of your custom model.(The recognition performance of custom-trained models deployed on HUSKYLENS 2 is affected by multiple factors. You can appropriately lower the detection threshold to increase the possibility of target detection, or optimize and expand the training dataset to improve model recognition effects.)
1.2 No-Code Model Training and Deployment – Mind+ Local
This section describes how to set up a local model conversion tool to deploy Mind+-trained models to HUSKYLENS 2 without internet access.
The local conversion tool supports Windows 10/11 and Linux. Other operating systems (e.g. Windows 7) may have unresolved compatibility issues.
Supported model types trained in Mind+: object detection, instance segmentation, image classification (YOLOv8n). Other model architectures are not supported currently.
1.2.1 Environment Setup
Note: This environment setup only needs to be completed once on your computer. If you have already configured the environment, skip directly to Section 1.2.2.
- Install .NET 7.0. Click to open the .NET 7.0 download page.
For 64-bit Windows, select Windows x64.
- Install Conda environment manager: Click Download Conda, select the installer matching your OS (Windows users can use the direct download link).
After installation, open Anaconda PowerShell.
Run the command below. If the Conda version number prints out, installation succeeded. If errors occur, troubleshoot environment variable configuration.
conda --version
Create a working folder:
mkdir MindPlus_Model
Switch to the created folder (replace the path with your actual directory):
cd "C:\Users\Alla.Fang\MindPlus_Model"
Download the model conversion & packaging tool: onnx2kmodel Github Repository
This tutorial uses Windows as the example. For other systems, refer to the repository README.
Extract the downloaded ZIP into the MindPlus_Model folder. Follow the recommended directory structure.
Navigate into the tool directory:
cd ".\onnx2kmodel-master"
Create an independent Python 3.12 environment:
conda create --name env312 python=3.12
Type y and press Enter when prompted. Installation duration depends on network speed.
Activate the environment and verify Python version:
conda activate env312
python --version
If output shows Python 3.12.x, environment creation is complete.
Install Python dependencies:
pip install -r requirements.txt
Install the NNCASE KPU wheel package:
pip install nncase_kpu-2.10.0-py2.py3-none-win_amd64.whl
Launch the model conversion GUI tool:
python app.py
Keep the PowerShell window and conversion tool open for subsequent model packaging.
1.2.2 Model Training
Open Mind+2.0, navigate to Model Training > Object Detection.
You can capture images in real time via camera for labeling and training.
Alternatively, import an existing YOLO-format dataset. The dataset must strictly follow this structure:
dataset/
images/
train/
image1.jpg
image2.jpg
...
val/
image3.jpg
image4.jpg
...
labels/
train/
image1.txt
image2.txt
...
val/
image3.txt
image4.txt
...
data.yaml
Sample test dataset:
| Model Type | Download link | Description |
|---|---|---|
| Object Detection | DETdataset.zip | Detects buffaloes, elephants, rhinos and zebras |
Download the sample dataset and click Upload.
After upload completes, the page appears as shown below:
Tune training hyperparameters under Advanced Settings, then click Train Model and wait for training completion.
When training finishes, click Export Model. Save the exported Experience_model file into the MindPlus_Model folder.
Click Advanced Mode (top right) → Data Settings. Select your project and choose Export.
Save the exported dataset file named Experience into the MindPlus_Model directory.
Note: The above steps describe YOLOv8n training inside Mind+. HUSKYLENS 2 also supports YOLO11n model conversion and deployment.
1.2.3 Deploy to HUSKYLENS 2
If you completed environment setup in 1.2.1, open Anaconda PowerShell and run:
conda activate env312
cd ".\onnx2kmodel-master"
python app.py
Inside the conversion tool, set Select Mode to MindPlus.
Click Select Model Package and upload Experience_model; click Select Dataset Package and upload the Experience dataset file.
Click Select Icon. You can use the default icon inside onnx2kmodel-master or upload your custom icon. Recommended specification: 60×60 PNG, transparent background, white line icon.
Fill in the AppName (Chinese and English) for your model application. For supermarket product recognition, set the name to Product Recognition.
Click Convert and Package. When the "please wait" status disappears and the button returns to normal, packaging is finished.
A new ZIP package will be generated inside MindPlus_Model\onnx2kmodel-master. Do not manually modify the contents of this ZIP file.
Connect HUSKYLENS 2 to your computer via USB Type-C. Copy the generated ZIP file to \storage\installation_package on the Huskylens drive.
Tap the HUSKYLENS 2 screen, open Model Installation, then select Local Installation.
If the new entry Product Recognition appears on the home screen, deployment succeeded.
Tap to launch the function and verify model recognition performance.
1.3 Code-Trained Model Deployment to HUSKYLENS 2
1.3.1 Environment Setup
Training YOLO models via Python requires a modern Python version and related dependencies. We recommend Miniconda to create isolated environments and avoid version conflicts.
Download and install Miniconda.
After installation, launch Anaconda PowerShell.
Verify Conda installation:
conda --version
Create working folder:
mkdir Custom_Model
Enter the folder (replace path with your directory):
cd "C:\Users\Alla.Fang\Custom_Model"
Create isolated Python 3.12 environment:
conda create --name myenv312 python=3.12
Activate environment:
conda activate myenv312
Install Ultralytics YOLO library:
pip install ultralytics
Verify installation:
yolo
If the command outputs help information, installation succeeded.
Keep this PowerShell window open for model training.
1.3.2 Prepare the YOLO Dataset
To train YOLOv8 / YOLO11 models, prepare datasets in standard YOLO format.
Directory structure:
dataset/
images/
train/
image1.jpg
image2.jpg
...
val/
image3.jpg
image4.jpg
...
labels/
train/
image1.txt
image2.txt
...
val/
image3.txt
image4.txt
...
data.yaml
data.yaml defines dataset paths, class count and class names. The training pipeline reads this file to load images and annotations.
Refer to the Ultralytics Official Dataset Guide for dataset creation instructions.
Quick-test sample dataset download: sample dataset
Dataset resource list:
| Model Type | Download link | Description |
|---|---|---|
| Object Detection | DETdataset.zip | Detects buffaloes, elephants, rhinos and zebras |
Important: This sample dataset contains limited images; models trained on it may have low accuracy.
Extract the ZIP into theCustom_Modelfolder.
1.3.3 Train the Model with Python Code
The conversion tool supports YOLOv8n / YOLO11n: object detection, image classification, instance segmentation.
This tutorial uses YOLOv8n object detection as the example. Select the command matching your model type. Remove the # comment symbol before execution.
# YOLOv8n Object Detection
yolo detect train data=data.yaml model=yolov8n.pt imgsz=320 epochs=10 project=output name=my_yolov8_run
# YOLO11n Object Detection
#yolo detect train data=data.yaml model=yolo11n.pt imgsz=320 epochs=10 project=output name=my_yolov11_run
# YOLOv8n Classification
#yolo classify train data=data.yaml model=yolov8n-cls.pt imgsz=320 epochs=10 project=output name=my_yolov8_run
# YOLO11n Classification
#yolo classify train data=data.yaml model=yolo11n-cls.pt imgsz=320 epochs=10 project=output name=my_yolo11_run
# YOLOv8n Instance Segmentation
#yolo segment train data=data.yaml model=yolov8n-seg.pt imgsz=320 epochs=10 project=output name=my_yolov8_seg_run workers=0
# YOLO11n Instance Segmentation
#yolo segment train data=data.yaml model=yolo11n-seg.pt imgsz=320 epochs=10 project=output name=my_yolo11_seg_run workers=0
Parameter explanation:
yolo detect train: Start object detection trainingdata=data.yaml: Path to dataset configuration filemodel=yolov8n.pt: Pre-trained base model. Only yolov8n/yolo11n variants are supportedimgsz=320: Input resolution. Supported values: 320 or 640epochs=10: Total training cyclesproject=output: Root folder for training outputsname=my_yolov8_run: Subfolder name for this experiment
After training completes, weights are saved at:
Custom_Model\output\my_yolov8_run\weights
Export the best checkpoint to ONNX format:
yolo export model=output/my_yolov8_run/weights/best.pt format=onnx imgsz=320 dynamic=False
The exported best.onnx file will be located under:
Custom_Model\output\my_yolov8_run\weights
1.3.4 Deploy the Model to HUSKYLENS 2
- Install prerequisites
Download and install .NET 7.0. For 64-bit Windows, select Windows x64.
Download the conversion tool: onnx2kmodel
Place the downloaded archive into the Custom_Model folder and extract it.
Ensure your folder structure matches the reference diagram.
Navigate to the tool directory:
cd ".\onnx2kmodel-master"
Install dependencies:
pip install -r requirements.txt
Install KPU runtime package:
pip install nncase_kpu-2.10.0-py2.py3-none-win_amd64.whl
Start the GUI converter:
python app.py
Inside the tool, select Custom Model in the top-right dropdown.
- Prepare application folder
Create a new folder namedapplicationinsideCustom_Model.
Copy these files intoapplication:
best.onnxfromCustom_Model\output\my_yolov8_run\weightsimagesfolder from your dataset- Rename your dataset
data.yamland place it inside the folder
Critical rules:
- File names inside the application folder must remain unchanged
- The images subfolder must follow standard YOLO dataset structure
images/
train/
val/
Click Custom Directory in the conversion GUI and select the application folder.
- Select Icon
Click Select Icon. You can use the icon insideonnx2kmodel-masteror upload custom artwork. Recommended: 60×60 PNG, transparent background, white line icon.
- Set AppName
Fill in Chinese and English names for your model application. Example: EnglishProduct Recognition, Chinese商品识别.
Click Convert and Package. When the "please wait" hint disappears, packaging completes.
The packaged model ZIP file will be generated under Custom_Model\onnx2kmodel-master.
Connect HUSKYLENS 2 via Type-C cable. Copy the ZIP file to \storage\installation_package on the Huskylens drive.
Tap the screen to wake HUSKYLENS 2, open Model Installation.
Select Local Installation.
If the function entry Product Recognition appears on the home screen, deployment is successful.
Tap to open the function and test model inference.
3.Related Programming Examples:
Was this article helpful?
