Cannot remove obj from frame meta

Hi,
my pipeline is pgie->tracker->sgie(detector)->dsexample->sgie(classify). I use deepstream-app code, at sgie(classify) src pad, i use nvds_remove_obj_meta_from_frame to remove some object by object label but it does not work, it still show on the output frame although i see it jump to the remove function. Can you explain why it happen please ?

• DeepStream Version 6.0.1

1 could you share your " remove some object " code?
2 here is a demo to remove car 's meta in deepstream1:
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
printf(“loop\n”);
//nvds_remove_frame_meta_from_batch(batch_meta, frame_meta);
int offset = 0;
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
) {
obj_meta = (NvDsObjectMeta *) (l_obj->data);
NvDsMetaList *obj_next = l_obj->next;
if (obj_meta->class_id == PGIE_CLASS_ID_VEHICLE) {
vehicle_count++;
num_rects++;
printf(“remove\n”);
nvds_remove_obj_meta_from_frame(frame_meta, obj_meta);
}
if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
person_count++;
num_rects++;
printf(“have person\n”);
}
l_obj = obj_next;
}
}

well, my code is mostly the same with your code, i try to delete all objects in frame but it just delete one or two random objects.

could you provide the simple code to reproduce?

oh i found the difference, instead of using l_obj = l_obj->next in for loop, you try to use NvDsMetaList *obj_next = l_obj->next. I also try it and it worked, but could you explain why it worked please although the two way is almost the same .

nvds_remove_obj_meta_from_frame has an effect to *l_obj, so need save the l_obj->next first.

1 Like

many thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.