Instance Segmentation deployment

Instance Segmentation deployment is supported on STM32N6 only, on the STM32N6570-DK and NUCLEO-N657X0-Q boards. Hardware requirements, tools, and deployment steps are described in the shared guide: STM32N6 deployment guide.

For the application code, initialize the Instance Segmentation submodule from the root of the repository, then set deployment.c_project_path to its path relative to the instance_segmentation/ folder:

git submodule update --init application_code/instance_segmentation/STM32N6

Instance Segmentation specifics

  • Only quantized TFLite (.tflite) models are supported. Instance Segmentation has no quantization service: deploy a quantized model, such as a pretrained w8a8_ptq model of the zoo.

  • model.model_type must be yolov8n_seg. It selects the YOLOv8 segmentation postprocessing of the embedded application, and any other value stops the deployment.

  • Use the same launch command as the shared guide with the Instance Segmentation example configuration:

    python stm32ai_main.py --config-path ./config_file_examples/ --config-name deployment_n6_yolov8n_seg_config.yaml
    
  • Keep the hydra and mlflow sections of the example (./experiments_outputs/...).

  • The dataset section must provide the class names, with classes_file_path or class_names. They are written in the application header file.

  • The postprocessing section is required and must contain confidence_thresh, NMS_thresh, and max_detection_boxes. They are written in the application header file. Higher max_detection_boxes values use more memory on target; the example uses 10.

  • preprocessing requires resizing and color_mode; rescaling is not used. color_mode is rgb or bgr. resizing.aspect_ratio is fit, crop, or full_screen, and resizing.interpolation is required with fit. The example uses crop.

  • deployment.hardware_setup.output (UVCL or SPI) is only accepted for the NUCLEO-N657X0-Q board.

  • When the application runs, the display shows the camera stream, the inference time, the bounding boxes, the number of detected objects, and the segmentation masks.

  • The chain_qd operation mode is not supported.

Configuration example

A ready-to-use YAML example is available in the Instance Segmentation configuration folder: