Custom-Trained model Model Example
HUSKYLENS 2 custom-trained models let users deploy their own object detection to UNIHIKER M10 and read rich target data. It’s like teaching a camera new flashcards so it can spot and label your products. After updating firmware to v1.15+, users switch to a chosen Algorithm ID, detect objects that match the training dataset, and press button A to learn them, assigning incremental IDs while unlearned ones stay at ID 0. Programs can then query total detected and learned targets, plus per-target name, ID, center coordinates, width, and height, including the object closest to the crosshair. Additional blocks let you check if any target exists in the frame, count targets by ID, and retrieve data for a specific instance when multiple identical objects appear, giving fine-grained control for interactive vision projects.
1.Custom-Trained model Model
Before You Start:
In addition to the visual recognition functions built into HUSKYLENS 2, users can also train their own models and deploy them to HUSKYLENS 2 to create their own unique visual recognition projects. To use this feature, please see the Deploy Custom-Trained Models
Note: Please ensure the current HUSKYLENS 2 firmware is version 1.15 or above. Firmware Update Tutorial)
The following will use a self-trained object detection model "Product Recognition" as an example to introduce how the UNIHIKER M10 reads the recognition results of the HUSKYLENS 2 self-trained model.
1.1 Detect Target and Output Relevant Data
HUSKYLENS 2 can recognize target objects appearing in the frame (it can only recognize object classes that were in the dataset when the user trained the model). You can get data about detected target objects through programming.
After the self-trained model is deployed, it can recognize objects of the same class that the user has labeled. Like other functions, the self-trained model application supports learning the detected objects. When a target object is framed, press the A button to learn the object and assign it an ID.
Readable target data includes: the total number of detected targets, the total number of learned targets, and data for a specific target, including its ID, Name, Width, Height, and X/Y coordinates of the center point.
Example Program:
Output Result: As shown, 2target objects are recognized in the frame, one of which are learned. The target closest to the center is ID 0 (mouse), and the first recognized target is named apple. Objects learned in HUSKYLENS 2 are assigned IDs in order; unlearned objects have an ID of 0.
1.2 Get Data for a Specific Target in the Frame
After HuskyLens 2 recognizes target objects, it can acquire data for a specific target in the frame. For example, it can determine if a target with a specific ID is in the frame, get the count of targets with the same ID, and when multiple targets with the same ID appear, it can be set to acquire parameters for a specific one, including ID, Name, X/Y coordinates, Width, and Height.
Example Program:
Output Result: As shown, there are 2 ID 1 target objects in the frame, named 'person' . The coordinates of the first recognized ID 3 target are (319, 237).
20.3 Self-Trained Model Blocks Description
| block | Description |
|---|---|
|
Switch to the specified self-trained model algorithm. (The Algorithm ID number can be viewed by entering the corresponding algorithm on the HuskyLens 2 and clicking on the "Algorithm ID" parameter.) . |
|
Used to obtain the data result of a single detection under the HuskyLens 2's Algorithm ID N function. |
|
Determine if there is a detectable target present in the current frame. |
|
Get the relevant data for the target closest to the screen's crosshair cursor, including the target's ID, name, center X coordinate, center Y coordinate, width, and height. |
|
Get the total number of detectable targets currently detected on the screen. |
|
When multiple detectable targets appear, get the relevant data for a specific, designated target. |
|
Get the total number of learned targets, regardless of whether those targets are currently present in the frame. |
|
Determine if a target with a specified ID is present in the frame. (After HuskyLens 2 learns a target, it assigns an ID number based on the learning sequence.) |
|
Get the number of targets with a specified ID in the current frame. |
|
When multiple identical targets appear, get the relevant data for a specific, designated target. |
Was this article helpful?
