How to move obj_meta information between different source-ids

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Hello, I use the same video source, but internally I create and use one pipeline using 2 sources.
By attaching a preprocess-plugin, I made one source to see the entire frame, and the other to see only a specific area (ROI).
I thought that inference would be better when zoomed in on a specific area, and I’m going to attach the result to another source frame (entire frame).
So, the condition to extract the object to be moved is skipped, and in the end, add and remove are Vector of Pointer data type in obj_meta.

Is it correct way to implement something like below?

for (auto &x: add) {
nvds_add_obj_meta_to_frame(pSourceZeroFrameMeta, ObjectMetaArray[cls_id], NULL);
nvds_remove_obj_meta_from_frame(pSourceOneFrameMeta, ObjectMetaArray[cls_id]);
}

for (auto &x: remove)
{
nvds_remove_obj_meta_from_frame(pSourceOneFrameMeta, ObjectMetaArray[cls_id]);
}

could you use a whole media pipeline to describe your use case? we are wondering the plugins’s relationship.
nvprocess plugin supports to do infernece only on ROI, please refer to the sample \opt\nvidia\deepstream\deepstream-6.2\sources\apps\sample_apps\deepstream-preprocess-test

For example, Iwant to move the obj_meta found on the right side of the image to the left frame. But is the syntax used there correct?

mentioned in the question


is this your expecting result? there are two pictures, the one shows the original frame, and the other one shows the ROI and the objects in the ROI.
here s a method to remove meta: Cannot remove obj from frame meta

Thank you for quick response. What exactly is the scenario for the image above?

I saw the content that mentioned by link, but it seems to be slightly different.

// For each detected object in the frame.
while (pObjectMetaList)
{
    // Check for valid object data
    NvDsObjectMeta* pObjectMeta = (NvDsObjectMeta*)(pObjectMetaList->data);

    ObjectMetaArray[pObjectMeta->class_id].emplace_back(pObjectMeta);
    pObjectMetaList = pObjectMetaList->next;
}

Like the code above, I first put the pointer value for pObjectMeta in ObjectMetaArray. After the logic is executed, the deletion is performed as follows. Can you confirm that there is no awkward part or error enough to delete other obj_meta in this part?

for (auto &x: add) {
    nvds_add_obj_meta_to_frame(pSourceZeroFrameMeta, ObjectMetaArray[cls_id], NULL);
    nvds_remove_obj_meta_from_frame(pSourceOneFrameMeta, ObjectMetaArray[cls_id]);
}

for (auto &x: remove)
{
    nvds_remove_obj_meta_from_frame(pSourceOneFrameMeta, ObjectMetaArray[cls_id]);
}

here is the pipeline: filesrc ! h264parse ! nvv4l2decoder ! tee name=t ! queue ! nvstreammux ! nvdspreprcoess ! nvinfer nvvideoconvert ! nvdsosd ! nveglglessink t. ! nveglglessink, one way is for display, the other way if for inference. is this your expecting result? if no, could you share your media pipeline?

no. I will infer both sources like the config below. And the approximate pipeline is:
2filesrc - nvstreammux ! nvdspreprcoess ! nvinfer! nvtracker! nvvideoconvert! nvdsosd ! nveglglessink

[group-0]
src-ids=0;1
custom-input-transformation-function=CustomAsyncTransformation
process-on-roi=1
roi-params-src-0=0;0;1920;1080
roi-params-src-1=860;300;900;500;50;300;500;700

I’m simply trying to select only what I want from the results inferred from roi-params-src-1 and put it (included in a variable called add) into roi-params-src-0

you can use nvds_copy_obj_meta_list to copy object meta from source1 to source0, then use nvds_remove_obj_meta_from_frame to delete object meta from source1.

thanks for the quick and detailed reply
Looking more closely at my situation, if it is necessary to first filter the inference results for source1 under certain conditions, rather than copying all inference results for source1. Eventually, after filtering, the add and remove variable mentioned in the code above are distinguished.
So, combining what you suggested, I can do something like this:

  1. nvds_remove_obj_meta_from_frame(source1, std::vector (remove) )
  2. nvds_copy_obj_meta_list (dst = source0, src = source1)
  3. nvds_remove_obj_meta_from_frame(source1, std::vector (add) )

is this right?

In addition, if I omit number 3 to check visually, is there no problem at all?

what dose that " std::vector (remove)" mean?
if only want to copy some meta, you can also use nvds_copy_obj_meta, please check \opt\nvidia\deepstream\deepstream-6.2\sources\includes\nvdsmeta.h

what dose that " std::vector (remove)" mean?
Re. In the code I use std::vector<uint32_t> add, remove; I defined add and remove as

add and remove std::vector<std::vector<NvDsObjectMeta*>> ObjectMetaArray; I have the index value of the array

  1. First, the elements of ObjectMetaArray are erased by traversing the indices in remove.
  2. And after the copy from source1->0
  3. Delete the last copied add index as well

Sorry for the late reply, Is this still an DeepStream issue to support? Thanks

no. Thanks to you,
I can plan what I want.However, if the tracker component is not inserted, it can be seen that it is copied accurately, but if iou-tracker is inserted, it seems that 1-2 objects are additionally inserted. I will follow up on this issue later

Below is the resulting image that achieved what I wanted.

Is this still an DeepStream issue to support? Thanks, could you provide simplified code to reproduce this issue?

No, maybe it was because of min_hit, so it was a minor issue. Thanks

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