How to use aggregator before filter while using tiling on hailo8

Hi,

I was trying to implement tiling.

gst-launch-1.0 -e v4l2src device = /dev/video2 ! video/x-raw,width=1280, height=720, framerate=60/1, format=RGB ! hailotilecropper internal-offset=true name=cropper tiles-along-x-axis=2 tiles-along-y-axis=2 overlap-x-axis=0.2 overlap-y-axis=0.24 hailotileaggregator flatten-detections=true name=agg cropper. ! queue leaky=2 max-size-buffers=1 max-size-bytes=0 max-size-time=0 ! agg. cropper. ! hailonet hef-path=/home/root/yolov8s.hef batch-size = 1 ! hailofilter function-name=yolov8s so-path=/usr/lib/hailo-post-processes/libyolo_hailortpp_post.so qos=false ! agg. agg. ! hailooverlay qos=false ! videoconvert qos=false ! fpsdisplaysink text-overlay=true sync=false video-sink=“vpuenc_h264 ! h264parse ! rtph264pay ! udpsink host=192.168.2.101 port=5000”

Above gstreamer command is working perfectly fine for me. But here pipeline is :

hailonet → hailofilter → hailoaggregator

So hailofilter will run as many times as the number of tiles.

can we somehow do below pipeline :
hailonet → hailoaggregator -> hailofilter

so that after hailonet directly aggregator runs and stitch the results back to original image size and the filter runs only once on full original image.

And the main reason i want this is because in my cpp code i have created one shared memory between my script and hailo_nms_decode.hpp file so as soon as hailofilter filter outs the Bounding box i can access in my script. So is there any way to use aggregator before filter ?

@omria Can Please help me in this ? I have tried making new shared memory in core/hailo/plugins/tiling/gsthailotileaggregator.cpp but i am not getting the desired results there too. If aggregator is not possible before filter then can you tell me in which file i will get final Bounding box of stitched image ?

Hey @Suraj_Upadhyay,

I’d suggest checking out our tiling implementation here: hailo-apps-infra/hailo_apps/hailo_app_python/apps/tiling at dev · hailo-ai/hailo-apps-infra · GitHub

Pipeline Structure

The standard and supported pipeline for tiling looks like this:

hailotilecropper → [per-tile inference: hailonet → hailofilter] → hailotileaggregator → hailooverlay

For Your Use Case

If you need access to the final stitched bounding boxes, you’ll need to tap into the pipeline after the hailotileaggregator element. That’s where all the detections get combined and mapped back to the original frame coordinates. You won’t be able to get the final stitched bounding boxes before this stage.

Just a heads up – the pipeline structure hailonet → hailoaggregator → hailofilter isn’t supported for tiling workflows. The post-processing needs to happen per tile before aggregation, since the aggregator relies on the post-processed metadata from each tile to properly flatten and combine the results.

Implementation Details

If you want to modify or extract the final bounding boxes, take a look at:

  • core/hailo/plugins/tiling/gsthailotileaggregator.cpp

This is where the final bounding boxes for the stitched image are handled.

How does this work in the file?

  • The function gst_hailotileaggregator_handle_sub_frame_roi processes each incoming tile and prepares the detections for aggregation.
  • The actual “flattening” – mapping detections from tile coordinates back to original image coordinates – happens as part of this process.
  • Once all tiles for a frame are processed, gst_hailotileaggregator_post_aggregation gets called. This handles post-processing steps like removing large landscape objects and running NMS on the aggregated detections. At this point, the bounding boxes are in the original (stitched) image coordinate space.

So the final stitched bounding boxes are available after gst_hailotileaggregator_post_aggregation runs in gsthailotileaggregator.cpp. If you want to access or modify them, that’s the function you should work with. The bounding boxes at this stage are already mapped to the original image size and have gone through any additional post-processing configured in the aggregator (gst_hailotileaggregator_post_aggregation).

Let me know if you have any other questions!

@omria thankyou it worked.

1 Like