Instance Segmentation¶
This document will explain how to use the "Instance Segmentation" feature module in the Model Training and Inference Library under Mind+ > Programming > Real-Time Mode to apply a self-trained instance segmentation model and complete an instance segmentation project.
Features¶
Using the Instance Segmentation module, users can load a pre-trained instance segmentation model to perform inference and recognition on local images or real-time footage captured by a camera. This allows users to obtain information such as the number of instances detected in the image, as well as the class labels, confidence scores, center point X/Y coordinates, width, and height for each instance, which can be used for subsequent logical decisions, interactive control, or visualization.
With this feature, users can not only quickly apply pre-trained instance segmentation models to complete various instance segmentation projects, but also intuitively experience the entire application workflow—from image input and model inference to result output—enabling them to build AI projects with “perceptual, decision-making, and interactive” capabilities, thereby providing foundational support for both educational instruction and practical applications.
For an introduction to instance segmentation, see the FAQ at the end of this document.
Preparations¶
Hardware Preparation¶
- a computer
- A webcam (either the one built into your computer or a USB webcam)
Software Preparation¶
Install Mind+ version 2.0.4 or later. Click here to view the Mind+ installation guide. For instructions on how to check your software version, see the FAQ.
Model Preparation¶
Before creating an instance segmentation project, you must first train and export an instance segmentation model. You can use the Instance Segmentation module in the Mind+ V2.0 model training tool to train the model and export it for subsequent inference. The exported instance segmentation model is a compressed file with the suffix **.zip. In subsequent projects, this compressed file will be used directly to load the instance segmentation model and perform instance segmentation.
Please refer to the tutorial below to prepare a segmented model for use in your upcoming project.
- Tutorial on Training Instance Segmentation Models: Instance Segmentation—Training the Model
- Tutorial on Exporting Instance Segmentation Models: Instance Segmentation—Model Export
Load the model training and inference library¶
Open Mind+ version 2.0.4 or later, and tap to enter "RealTime Mode."
In RealTime mode, click "Extensions" in the lower-left corner, locate "Model Training and Inference " in the Stage Extensions, and click "Load."
Once loading is complete, return to the real-time mode programming page and click "Instance Segmentation" under "Model Inference" to find the instance segmentation building blocks, as shown below.
Usage Instructions¶
Project 1: Local Image Instance Segmentation¶
This project demonstrates how to use a pre-trained instance segmentation model to recognize a local image and obtain inference results such as the number of instances, labels, and confidence scores.
In this example, the model used is a flower instance segmentation model (which can recognize various types of flowers and draw their outlines).
In practice, you can replace the example model with a model you’ve trained yourself or an existing instance segmentation model, while keeping the rest of the code flow the same.
Sample Program¶
Runtime Results¶
After running the program, a window displaying the model's inference results will pop up. The detection results will be overlaid on the original image, showing the outlines of the detected flowers and labeling them with their corresponding categories and confidence scores.
Project 2: Real-Time Object Segmentation Using a Camera¶
This project demonstrates how to use a pre-trained instance segmentation model to continuously recognize objects in real-time video feed from a camera, overlay the recognition results on the video in real time, and obtain inference results such as the number of instances, their labels, and the center coordinates of each instance.
The model used in this example is the same as the one in Project 1. You can replace it with a model you’ve trained yourself or an existing instance segmentation model; the rest of the code flow remains the same.
Sample Program¶
Runtime Results¶
Once the program starts, the camera feed will be displayed in real time on the stage area. After the instance segmentation model has finished loading, press the spacebar to begin the instance segmentation inference task. The program will then draw the outline of each detected flower in real time on the screen, labeling it with its corresponding category and confidence score. The Mind+ character will move sequentially to the center of each instance and announce the category label for that instance.



























