Instance Segmentation Example
Instance segmentation on HUSKYLENS 2 lets it detect and outline multiple objects in real time and stream structured data like IDs and positions to code. It’s like giving the camera a smart highlighter that tracks every object for kids’ AI robot projects.
1.Instance Segmentation Code Example
Before You Start:
1.1Instance Segmentation and Output Related Data
Under the Instance Segmentation function, HUSKYLENS can recognize object classes in the image and outline each object. The program can print the total instance count, the instance closest to the center, and related data of a specified instance ID, including name, ID, center X/Y coordinates, width, and height.
The sample program is as follows.
Result:After Upload completes, HUSKYLENS 2 automatically switches to Instance Segmentation. Aim at a recognizable object (must belong to one of the 80 classes) and observe the terminal for detected instance count, specified instance ID, center coordinates, etc.
1.2 Obtain Data of a Specified Instance
Under the Instance Segmentation function, after learning, HUSKYLENS 2 can retrieve related data of a specified instance, such as determining whether a learned instance exists in the image, obtaining its name, and counting instances of the same class. When multiple instances of the same class appear, related parameters such as name, X/Y coordinates, width, and height can be retrieved for one specified instance.
The sample program is as follows.
Result:After Upload completes, HUSKYLENS 2 automatically switches to Instance Segmentation. When multiple instances of the same class appear, the system can count them and output related data such as ID and center coordinates of the specified instance.
1.3 Instance Segmentation Blocks Description
| block | description |
|---|---|
|
Acquire tag instance segmentation data once. |
|
Determine whether any barcode is detected. |
|
Determine if an instance is present in the current frame. |
|
Obtain relevant data of the instance nearest to the screen crosshair, including the instancee's ID, name, center X coordinate, center Y coordinate, width, and height. |
|
Get the total number of instances detected on the screen, including both unregistered and registered instances. |
|
Obtain the relevant data of a specified instance when multiple instances appear. |
|
Determine if an instance with the specified ID exists in the frame. Unlearned IDs are uniformly set to 0, and learned IDs are sorted in the order they were learned. |
|
Get the number of instances with a specified ID. |
|
Obtain the number of instances with the specified ID in the current frame. |
|
When multiple instances are detected, retrieve the relevant data of a specified instance. |
Was this article helpful?
