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.

Interface Diagram

  • 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 to Product Recognition.

  • Step 3: Click Start Conversion
    Click Start Conversion to begin the process.

Interface Diagram

Wait for the prompt model converted successfully, then click Download to Computer.

Interface Diagram

Save the converted model archive to your local computer.

Interface Diagram

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.

Interface Diagram

Tap the HUSKYLENS 2 screen to wake the device if it is sleeping, then navigate into the Model Installation menu.

Interface Diagram

Select Local Installation. After successful installation, the screen will show the interface below.

Interface Diagram

Check the HUSKYLENS 2 home screen. If the new function Product Recognition appears, your custom-trained model has been imported successfully.

Interface Diagram

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.)

Interface Diagram

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.

  1. Install .NET 7.0. Click to open the .NET 7.0 download page.
    For 64-bit Windows, select Windows x64.

Interface Diagram

  1. Install Conda environment manager: Click Download Conda, select the installer matching your OS (Windows users can use the direct download link).

Interface Diagram

After installation, open Anaconda PowerShell.

Interface Diagram

Run the command below. If the Conda version number prints out, installation succeeded. If errors occur, troubleshoot environment variable configuration.

conda --version

Interface Diagram

Create a working folder:

mkdir MindPlus_Model

Interface Diagram

Switch to the created folder (replace the path with your actual directory):

cd "C:\Users\Alla.Fang\MindPlus_Model"

Interface Diagram

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.

Interface Diagram

Navigate into the tool directory:

cd ".\onnx2kmodel-master"

Interface Diagram

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.

Interface Diagram

Activate the environment and verify Python version:

conda activate env312
python --version

If output shows Python 3.12.x, environment creation is complete.

Interface Diagram

Install Python dependencies:

pip install -r requirements.txt

Interface Diagram

Interface Diagram

Install the NNCASE KPU wheel package:

pip install nncase_kpu-2.10.0-py2.py3-none-win_amd64.whl

Interface Diagram

Launch the model conversion GUI tool:

python app.py

Interface Diagram

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.

Interface Diagram

You can capture images in real time via camera for labeling and training.

Interface Diagram

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.

Interface Diagram

After upload completes, the page appears as shown below:

Interface Diagram

Tune training hyperparameters under Advanced Settings, then click Train Model and wait for training completion.

Interface Diagram

When training finishes, click Export Model. Save the exported Experience_model file into the MindPlus_Model folder.

Interface Diagram

Click Advanced Mode (top right) → Data Settings. Select your project and choose Export.

Interface Diagram

Save the exported dataset file named Experience into the MindPlus_Model directory.

Interface Diagram

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

Interface Diagram

Inside the conversion tool, set Select Mode to MindPlus.

Interface Diagram

Click Select Model Package and upload Experience_model; click Select Dataset Package and upload the Experience dataset file.

Interface Diagram

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.

Interface Diagram

Fill in the AppName (Chinese and English) for your model application. For supermarket product recognition, set the name to Product Recognition.

Interface Diagram

Click Convert and Package. When the "please wait" status disappears and the button returns to normal, packaging is finished.

Interface Diagram

A new ZIP package will be generated inside MindPlus_Model\onnx2kmodel-master. Do not manually modify the contents of this ZIP file.

Interface Diagram

Connect HUSKYLENS 2 to your computer via USB Type-C. Copy the generated ZIP file to \storage\installation_package on the Huskylens drive.

Interface Diagram

Tap the HUSKYLENS 2 screen, open Model Installation, then select Local Installation.

Interface Diagram

Interface Diagram

If the new entry Product Recognition appears on the home screen, deployment succeeded.

Interface Diagram

Tap to launch the function and verify model recognition performance.

Interface Diagram

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.

Interface Diagram

Verify Conda installation:

conda --version

Interface Diagram

Create working folder:

mkdir Custom_Model

Interface Diagram

Enter the folder (replace path with your directory):

cd "C:\Users\Alla.Fang\Custom_Model"

Interface Diagram

Create isolated Python 3.12 environment:

conda create --name myenv312 python=3.12

Interface Diagram

Interface Diagram

Activate environment:

conda activate myenv312

Interface Diagram

Install Ultralytics YOLO library:

pip install ultralytics

Interface Diagram

Verify installation:

yolo

If the command outputs help information, installation succeeded.

Interface Diagram

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

Interface Diagram

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 the Custom_Model folder.

Interface Diagram

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 training
  • data=data.yaml: Path to dataset configuration file
  • model=yolov8n.pt: Pre-trained base model. Only yolov8n/yolo11n variants are supported
  • imgsz=320: Input resolution. Supported values: 320 or 640
  • epochs=10: Total training cycles
  • project=output: Root folder for training outputs
  • name=my_yolov8_run: Subfolder name for this experiment

Interface Diagram

After training completes, weights are saved at:
Custom_Model\output\my_yolov8_run\weights

Interface Diagram

Export the best checkpoint to ONNX format:

yolo export model=output/my_yolov8_run/weights/best.pt format=onnx imgsz=320 dynamic=False

Interface Diagram

The exported best.onnx file will be located under:
Custom_Model\output\my_yolov8_run\weights

Interface Diagram

1.3.4 Deploy the Model to HUSKYLENS 2

  1. Install prerequisites
    Download and install .NET 7.0. For 64-bit Windows, select Windows x64.

Interface Diagram

Download the conversion tool: onnx2kmodel

Interface Diagram

Place the downloaded archive into the Custom_Model folder and extract it.

Interface Diagram

Ensure your folder structure matches the reference diagram.

Interface Diagram

Navigate to the tool directory:

cd ".\onnx2kmodel-master"

Interface Diagram

Install dependencies:

pip install -r requirements.txt

Interface Diagram

Install KPU runtime package:

pip install nncase_kpu-2.10.0-py2.py3-none-win_amd64.whl

Interface Diagram

Start the GUI converter:

python app.py

Interface Diagram

Inside the tool, select Custom Model in the top-right dropdown.

Interface Diagram

  1. Prepare application folder
    Create a new folder named application inside Custom_Model.
    Copy these files into application:
  • best.onnx from Custom_Model\output\my_yolov8_run\weights
  • images folder from your dataset
  • Rename your dataset data.yaml and place it inside the folder

Interface Diagram

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.

Interface Diagram

  1. Select Icon
    Click Select Icon. You can use the icon inside onnx2kmodel-master or upload custom artwork. Recommended: 60×60 PNG, transparent background, white line icon.

Interface Diagram

  1. Set AppName
    Fill in Chinese and English names for your model application. Example: English Product Recognition, Chinese 商品识别.

Interface Diagram

Click Convert and Package. When the "please wait" hint disappears, packaging completes.

Interface Diagram

The packaged model ZIP file will be generated under Custom_Model\onnx2kmodel-master.

Interface Diagram

Connect HUSKYLENS 2 via Type-C cable. Copy the ZIP file to \storage\installation_package on the Huskylens drive.

Interface Diagram

Tap the screen to wake HUSKYLENS 2, open Model Installation.

Interface Diagram

Select Local Installation.

Interface Diagram

If the function entry Product Recognition appears on the home screen, deployment is successful.

Interface Diagram

Tap to open the function and test model inference.

Interface Diagram

3.Related Programming Examples:

Was this article helpful?

TOP