• Hardware Platform (Jetson / GPU) Jetson Xavier NX
• DeepStream Version 5.1
• Issue Type Question
Hey there,
I hope you are having a good day.
I am writing a custom deepstream plugin that works as a face aligner. It reads a tensor(face landmarks) from the input buffer’s meta, and uses VPI to apply a transformation on the faces based on the landmark positions.
Here is my question:
Each frame, may have multiple faces. Therefore, for each frame, I have to create a new buffer that stacks the aligned faces. I have done this using this post. However, I am confused on how I should structure the output buffer.
Should I place each face in a surface OR Should I place each face in a frame??
After aligning the faces, I would like to feed them to an nvinfer plugin for feature extraction. How does the nvinfer expect the faces to be structured? A frame with multiple surfaces or multiple faces each having 1 surface with a face?
Here’s where my question applies in code:
While creating the output buffer in gst_batcher_prepare_output_buffer
, there is a section in code that creates a number of frame metas each having 1 surface. I am confused whether this is ok for my case or I should create a single frame meta with multiple surfaces?
// Let's say we have 4 faces.
for(int i = 0;i < 4;i++) {
frame_meta = nvds_acquire_frame_meta_from_pool(batch_meta);
// Just some parameters, ignore them.
frame_meta->pad_index = i;
frame_meta->source_id = 0;
frame_meta->buf_pts = 0;
frame_meta->ntp_timestamp = 0;
frame_meta->frame_num = 0;
frame_meta->batch_id = i;
frame_meta->source_frame_width = 100;
frame_meta->source_frame_height = 100;
// one surface per frame!
frame_meta->num_surfaces_per_frame = 1 ;
nvds_add_frame_meta_to_batch(batch_meta, frame_meta);
}
And for the other case (one frame with multiple surfaces), it would be like this:
// No more loops, just one instance.
frame_meta = nvds_acquire_frame_meta_from_pool(batch_meta);
// Just some parameters, ignore them.
frame_meta->pad_index =
frame_meta->source_id = 0;
frame_meta->buf_pts = 0;
frame_meta->ntp_timestamp = 0;
frame_meta->frame_num = 0;
frame_meta->batch_id = i;
frame_meta->source_frame_width = 100;
frame_meta->source_frame_height = 100;
// 4 surfaces per frame!
frame_meta->num_surfaces_per_frame = 4 ;
nvds_add_frame_meta_to_batch(batch_meta, frame_meta);
Thank you for spending time on this.
Best.