# Detect objects with `sample_object_detection` The `sample_object_detection` is a Python launch file utilizing QNN for model inference. It demonstrates camera data streaming, AI-based inference, and real-time visualization of object detection results. Ultralytics YOLOv8 is a machine learning model that predicts bounding boxes, segmentation masks and classes of objects in an image. ## `sample_object_detection` pipeline flow The figure shows the pipeline flow for `sample_object_detection`. [](E:\Builds\139479\Source\qir-sdk-ug-for-ubuntu\_build\html\_images\image50.svg) **Pipeline flow for `sample_object_detection`** ## ROS nodes used in the `sample_object_detection` 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 and 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 the yolo postprocess and image data, shows the object detect results with a ROS topic. | ## ROS topics used in the `sample_object_detection` pipeline | ROS topic | Type | Published by | | --- | --- | --- | | `/camera/color/image_raw` | `` | `qrb_ros_camera` | | `/qrb_inference_input_tensor` | `` | `yolo_preprocess_node` | | `/yolo_detect_result` | `` | `nn_inference_node` | | `/yolo_detect_tensor_output` | `` | `yolo_detection_postprocess_node` | | `/yolo_detect_overlay` | `` | `yolo_detection_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_det.export --target-runtime qnn_context_binary --device "QCS8275 (Proxy)" > > # For IQ-9075 > python3 -m qai_hub_models.models.yolov8_det.export --target-runtime qnn_context_binary --device "QCS9075 (Proxy)" > Find label file like bellow commands > > $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_detection` On the device, run the sample application: > > > # Prepare above model and move to default model path > mkdir /opt/model/ > mv yolov8_det_qcs9075.bin /opt/model/ > mv coco.ymal /opt/ > > source /opt/ros/jazzy/setup.bash > ros2 launch sample_object_detection launch_with_qrb_ros_camera.py model:=/opt/model/yolov8_det_qcs9075.bin > Copy to clipboard Then, you can check the ROS topics with the name `/yolo_detect_overlay` in `rviz2`. ## Build from the source of `sample_object_detection` Note Ensure that you run the [Prerequisites](https://docs.qualcomm.com/doc/80-90441-2/topic/detect-objects-with-sample_object_detection.html#prereq-detect-obj) first before performing the following steps. On the device, run the sample application: 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_object_detection` sample application from the source code. cd ~/qrb_ros_ws/src/qrb_ros_samples/ai_vision/sample_object_detection 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\_detection](https://docs.qualcomm.com/doc/80-90441-2/topic/detect-objects-with-sample_object_detection.html#run-object-detection). Last Published: Sep 07, 2026 [Previous Topic Classify images with sample\_resnet101](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/classify-images-with-sample_resnet101.md) [Next Topic Segment objects with sample\_object\_segmentation](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/segment-objects-with-sample_object_segmentation.md)