# Classify images with `sample_resnet101`
The `sample_resnet101` is a Python-based ROS node that performs image classification using QNN-based inference.
This figure shows an example image classification result.

**Image classification result**
[ResNet101](https://huggingface.co/qualcomm/ResNet101) is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.
## Image classification pipeline flow
The figure shows the pipeline flow for the image classification sample application.
**Image classification pipeline**
## ROS nodes used in the Image Classification pipeline
ROS nodes used in the Image Classification 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. |
| Image publisher | Publishes image data to a ROS topic—can be camera frames, local files, or processed outputs. |
| Image classification preprocess | 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. |
| Image classification postprocess | Transforms raw inference outputs into human-readable results by mapping predicted indices to corresponding labels. |
## ROS topics used in the Image Classification pipeline
ROS topics used in the Image Classification pipeline
| ROS topic | Type | Description |
| --- | --- | --- |
| `/image_raw` | `` | Publishes image information. |
| `/qrb_inference_input_tensor` | `` | Preprocesses messages. |
| `/qrb_inference_output_tensor` | `` | This is the nn interface result with model. |
| `/resnet101_results` | `` | This is the model output label. |
## 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).
## Run out-of-the-box Image Classification
**Steps**
1. Install the Image classification packages.
sudo apt install ros-jazzy-sample-resnet101
Copy to clipboard
2. Set up the sample environment on the device.
source /opt/ros/jazzy/setup.bash
ros2 launch sample_resnet101 launch_with_image_publisher.py
or # You can also replace this with a custom image file
ros2 launch sample_resnet101 launch_with_image_publisher.py image_path:=
or # You can launch with qrb ros camera
ros2 launch sample_resnet101 launch_with_qrb_ros_camera.py
Copy to clipboard
The `launch_with_image_publisher.py` launch script uses the default parameters:
>
>
> DeclareLaunchArgument(
> 'image_path',
> default_value=os.path.join(package_path, 'glasses.jpg'),
> description='Path to the image file'
> )
> # Node for image_publisher
> image_publisher_node = Node(
> package='image_publisher',
> executable='image_publisher_node',
> namespace=namespace,
> name='image_publisher_node',
> output='screen',
> parameters=[
> {'filename': image_path},
> {'rate': 10.0}, # Set the publishing rate to 10 Hz
> ]
> )
> Copy to clipboard
1. It sends the `local glasses.jpg` file, and outputs the image at 10 Hz.
2. Then, you can check ROS topics with the `name/resnet101_output` in another shell terminal.
ros2 topic echo /resnet101_output
data: 'sunglass
Copy to clipboard
## Build from the source of Image Classification
**Device steps**
1. Install the dependencies.
sudo apt install ros-jazzy-rclpy \\
ros-jazzy-sensor-msgs \\
ros-jazzy-std-msgs \\
ros-jazzy-cv-bridge \\
ros-jazzy-ament-index-python \\
ros-jazzy-qrb-ros-tensor-list-msgs \\
python3-opencv \\
python3-numpy \\
ros-jazzy-image-publisher \\
ros-jazzy-qrb-ros-nn-inference \\
ros-jazzy-qrb-ros-camera \\
ros-jazzy-image-publisher
Copy to clipboard
2. 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
3. Build the object\_detection sample application from the source code.
cd ~/qrb_ros_ws/src/qrb_ros_samples/ai_vision/sample_resnet101
colcon build
source install/setup.bash
Copy to clipboard
4. Run and test according to step 2 of [Run out-of-the-box Image Classification](https://docs.qualcomm.com/doc/80-90441-2/topic/classify-images-with-sample_resnet101.html#run-image-classification).
Last Published: Sep 07, 2026
[Previous Topic
Estimate human poses with sample\_hrnet\_pose\_estimation](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/estimate-human-poses-with-sample_hrnet_pose_estimation.md) [Next Topic
Detect objects with sample\_object\_detection](https://docs.qualcomm.com/bundle/publicresource/80-90441-2/topics/detect-objects-with-sample_object_detection.md)