Instance Segmentation Example
Instance segmentation on HUSKYLENS 2 recognizes and outlines up to 80 object categories, then lets your code read each instance’s ID, name, center coordinates, width, height and counts. It’s like giving every object on screen its own labeled bounding box so you can track totals, learned IDs, and specific targets in real time.
1. Instance Segmentation Code Example
Before You Start:
1.1 Performing Instance Segmentation and Outputting Related Data
Under the Instance Segmentation function, HUSKYLENS can recognize object categories in the image and mark the contour of each object. Using a program, you can print the total number of recognized instances, the number of learned instances, as well as the name, ID, center point X/Y coordinates, and the width and height of the instance closest to the center and of an instance with a specified ID.
The example program is shown below.
Running Result: After the program is successfully uploaded, HUSKYLENS 2 automatically switches to the Instance Segmentation function. Point HUSKYLENS 2 at the object to be recognized (it must belong to one of the 80 supported categories), and observe the output data such as the number of recognized instances, the ID of a specified instance, and the center point coordinates.Instance Segmentation.
1.2 Obtaining Related Data of a Specified Instance
Under the Instance Segmentation function, after learning, HUSKYLENS 2 can obtain related data of a specified instance in the frame. For example, you can determine whether a learned instance is present in the frame, read the name of an instance with a specified ID, and obtain the number of instances of the same category. When multiple instances of the same category appear in the frame, you can specify and retrieve the related parameters of a particular instance, including its name, X/Y coordinates, width, and height.
The example program is shown below.
Running Result: After the program is successfully uploaded, HUSKYLENS 2 automatically switches to the Instance Segmentation function. When multiple instances of the same category appear in the frame, the number of instances of that category can be recognized, and the center point coordinate data of the first instance with ID 1 is output.
1.3 Instance Segmentation Blocks Description
| block | Description |
|---|---|
|
Acquire tag instance segmentation data once. |
|
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. |
|
Get the number of instances that have been learned by HuskyLens 2, regardless of whether they appear in the current frame. |
|
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?
