Frame number for post processing metadata

Hi,
I’ve modified the gstreamer pipeline to provide arguments for class label and json filepath for detecting a specific class and saving the results to a json file.
The data is getting saved when I run detection.sh, but I further wanna know the frame number as well, i.e. in which frame the detections have happened.
Like first 10 detections in frame 1, next 15 in frame 2 and like that.
Is there a way to do it using the gstreamer pipeline

this is from my detection.py

for detection in detections:
label = detection.get_label()
bbox = detection.get_bbox()
confidence = detection.get_confidence()
if label == “Madsen”:
# Get track ID
track_id = 0
track = detection.get_objects_typed(hailo.HAILO_UNIQUE_ID)
if len(track) == 1:
track_id = track[0].get_id()
string_to_print += (f"Detection: ID: {track_id} Label: {label} Confidence: {confidence:.2f} Detection count: {detection_count}\n")

and
user_data.increment()
string_to_print = f"Frame count: {user_data.get_count()}\n"

You’re using model zoo or the tappas gstreamer pipelines, cuz I was trying to figure out if its possible to do it via the latter one.
This ones seems a model zoo implementation.

yes it is the rpi 5 examples in virtual inv.
the real magic happens here hailo-rpi5-examples/venv_hailo_rpi5_examples/lib/python3.11/site-packages/hailo_apps_infra/gstreamer_app.py
It just run 30 fps (camera speed) without any trouble. I am sending the string data to a named pipe. This makes sure that i am not slowing the hailo8 . It also make future upgrades easy and ofc. my c++ program runs in another thread. just reading the pipe data. I dont need frame data for anything other than control af the hailo8.

Good,
I’m actually using a MINI PC and was testing the detection.sh file in the tappas, in that I managed to change the original post processing code to give arguments for specific class detection and saving the metadata as well, couldn’t find any functionality to tell me the frame number or frame id to verify my post processing results like if there were 3 people in 15th frame, we have received detection metadata for 3 people only, if not then the detection might be getting compromised and needs retraining, something like that.

Now is there a way to do something like this, where I can save the frame number to verify my results from metadata, it could be then used for rtsp as well as mp4 videos.

I am building my own detection model.
I have made some small tools to take pictures out of a video frame (opencv).
You have to retrain your model. Standard model are only for general use and not accurate. I am also learning here . If you are having specific needs you have to retrain the model. It is difficult to find info about what we can get out of the hailo frame . I hobe that they will do some documentet som day.

there is a little look here. →

Okay, I’ve got some idea regarding the gstreamer buffer that is storing the frames, will see if some changes can be made to have a count of the processed frames along with their detections, also If the timestamp for the post processing can be saved, then I might be able to track down the frame number.

1 Like

gstreamer_app.py on my rpi 5
At the button of the page it just shows it.
But look at the callback class

def increment(self):
self.frame_count += 1

it is in gstreamer.py all the magic happens. you can change the default behavior there.