# Segment objects with `sample_object_segmentation` The `sample_object_segmentation` is a Python launch file utilizing QNN for model inference. It demonstrates camera data streaming, AI-based inference, and real-time visualization of object segmentation results. Ultralytics YOLOv8 is a machine learning model that predicts bounding boxes, segmentation masks and classes of objects in an image. ## `sample_object_segmentation` pipeline flow The figure shows the pipeline flow for `sample_object_segmentation`. ## Pipeline flow for `sample_object_segmentation` This figure shows the pipeline flow for `sample_object_segmentation`. [](E:\Builds\139479\Source\qir-sdk-ug-for-ubuntu\_build\html\_images\image52.svg) **`sample_object_segmentation` pipeline** ## ROS nodes used in the `sample_object_segmentation` pipeline | Node name | Description | | --- | --- | | [qrb ros camera](https://github.com/qualcomm-qrb-ros/qrb_ros_camera) | Qualcomm ROS 2 package that captures images with parameters and publishes them to ROS topics. | | [yolo preprocess](https://github.com/qualcomm-qrb-ros/qrb_ros_tensor_process) | Subscribes to image data, reshapes/resizes it, and republishes it to a downstream topic. | | [qrb ros nn interface](https://github.com/qualcomm-qrb-ros/qrb_ros_nn_inference) | Loads a trained AI model, receives preprocessed images, performs inference, and publishes results. | | [yolo postprocess](https://github.com/qualcomm-qrb-ros/qrb_ros_tensor_process) | Matches inference output with yolo label files. | | [yolo overlay](https://github.com/qualcomm-qrb-ros/qrb_ros_tensor_process) | Subscribes to yolo postprocess and image data, shows the object detection results with a ROS topic. | ## ROS topics used in the `sample_object_segmentation` | ROS topic | Type | Published by | | --- | --- | --- | | `/camera/color/image_raw` | `< sensor_msgs.msg.Image>` | `orbbec_camera` | | `/qrb_inference_input_tensor` | `< qrb_ros_tensor_list_msgs.msg.TensorList>` | `yolo_preprocess_node` | | `/yolo_segment_result` | `` | `nn_inference_node` | | `/yolo_segment_tensor_output` | `` | `yolo_segment_postprocess_node` | | `/yolo_segment_overlay` | `` | `yolo_segment_overlay_node` | ## Prerequisites - You have set up the device, installed ROS2 Jazzy and QIR SDK on the device according to [Install the QIR SDK](https://docs.qualcomm.com/doc/80-90441-2/topic/2-install-the-qir-sdk.html#install-qir-sdk). - On the host computer, you have downloaded and built the yolo model according to steps in the README of [qrb_ros_tensor_process](https://github.com/qualcomm-qrb-ros/qrb_ros_tensor_process). > > > Note > > > When downloading the yolo model , use `target-runtime` and `device` as follows: > > > # For IQ-8275 > python3 -m qai_hub_models.models.yolov8_seg.export --target-runtime tflite --device "QCS8275 (Proxy)" > > # For IQ-9075 > python3 -m qai_hub_models.models.yolov8_seg.export --target-runtime tflite --device "QCS9075 (Proxy)" > > $sudo find / -name coco8.yaml > /home/ubuntu/venv_qaihub/lib/python3.12/site-packages/ultralytics/cfg/datasets/coco8.yaml > /home/ubuntu/.qaihm/models/yolov8_det/v1/ultralytics_ultralytics_git/ultralytics/cfg/datasets/coco8.yaml > Copy to clipboard ## Run out-of-the-box `sample_object_segmentation` On the device, run the sample application: > > > # Prepare above model and move to default model path > mkdir /opt/model/ > mv yolov8_seg.tflite /opt/model/ > mv coco.ymal /opt/ > > source /opt/ros/jazzy/setup.bash > ros2 launch sample_object_segmentation launch_with_qrb_ros_camera.py model:= > Copy to clipboard Now, you can check ROS topics with the name `/yolo_segment_overlay` in `rviz2`. ## Build from the source of `sample_object_segmentation` Note Ensure that you run the [Prerequisites](https://docs.qualcomm.com/doc/80-90441-2/topic/segment-objects-with-sample_object_segmentation.html#prereq-segment-obj) first before performing the following steps. 1. Download the source code from the `qrb_ros_samples` repository. mkdir -p ~/qrb_ros_ws/src && cd ~/qrb_ros_ws/src git clone https://github.com/qualcomm-qrb-ros/qrb_ros_samples.git Copy to clipboard 2. Build the `sample_sample_segmentation` sample application from the source code. cd ~/qrb_ros_ws/src/qrb_ros_samples/ai_vision/sample_object_segmentation colcon build source install/setup.bash Copy to clipboard 3. Run and test according to steps 2–3 of [Run out-of-the-box sample\_object\_segmentation](https://docs.qualcomm.com/doc/80-90441-2/topic/segment-objects-with-sample_object_segmentation.html#run-object-segmentation). Last Published: Sep 07, 2026 [Previous Topic Detect objects with sample\_object\_detection](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/detect-objects-with-sample_object_detection.md) [Next Topic References](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/4-references.md)