Iterate bbox in nvmot

Hi,
How to get list of bboxes from NvMOTObjToTrackList?

How to iterate it?

NvMOTObjToTrackList det_obj = fr->objectsIn;
NvMOTObjToTrack *obj_to_trk = det_obj.list;
obj_to_trk->bbox.width;

I am getting only one bbox but I need all the bbox

int filled = obj_to_trk.numFilled;
std::cout<<filled<<endl;

filled output = 5

I tried something like below but couldn’t compile.

for (NvMOTObjToTrack * obj_to_trk = det_obj.list; obj_to_trk != NULL;   obj_to_trk = obj_to_trk->next){

I solved it by using for loop for NvMOTObjToTrack.

Yes it is just a list struct.

141 typedef struct _NvMOTObjToTrack
  142 {
  143     uint16_t classId;     
  144     NvMOTRect bbox;       
  145     float confidence;     
  146     bool doTracking;      
  147     void *pPreservedData; 
  148 } NvMOTObjToTrack;

Hi,

After setting

pTrackedObjectsBatch->list->numFilled = 1;

I can able to see bbox in first frame but after that I get segmentation fault (core dumped).

If I set

pTrackedObjectsBatch->list->numFilled = 0;

I cannot see any bbox but I didn’t get any error.

Can you suggest me how to troubleshoot it?

any update?

Could you share the core dump file for debug also any other debug logs by setting GST_DEGUG=3?

Hi,

I sent you my tracker file(edited). I am using sample app ‘deepstream-infer-tensor-meta-test’ with this tracker. I can able to get frame and process it But when I set

pTrackedObjectsBatch->list->numFilled = numfilled

I can able to see boxes which I hardcoded

OutObject.bbox.x = 100;
 OutObject.bbox.y = 100;
 OutObject.bbox.width = 200;
 OutObject.bbox.height = 50;

but after 2 frames I get segmentation fault

Hello customer,

You can review an earlier forum question and answers to see how the params are supposed to set and get: https://devtalk.nvidia.com/default/topic/1066252

It has an working example, so I believe it would be helpful. Please let us know if you have still have any issues/questions.

Hi,
I already checked it. Kindly check my tracker file which I sent to you in private message. I have added all the parameters which required by tracker. But still I am getting segmentation fault error.

Customer,

Assuming you allocated and set the output data structure NvMOTTrackedObjBatch, below is a code snippet showing how you would parse and iterate the output data structure:

void AddMotOutputData(const NvMOTTrackedObjBatch &motOutputObjectsMeta)
{
	assert(motOutputObjectsMeta.numAllocated > 0);

	for(uint streamInd = 0; streamInd < motOutputObjectsMeta.numFilled; streamInd++)
	{
		NvMOTTrackedObjList* tObjList = &motOutputObjectsMeta.list[streamInd];

		if(tObjList->valid == false)
			continue;

		uint32_t streamID = tObjList->streamID;

		// Add tracker output
		if(tObjList->numFilled > 0)
		{
			for(uint i=0; i<tObjList->numFilled; ++i)
			{
				NvMOTTrackedObj *tObj = &tObjList->list[i];

				uint64_t targetId = tObj->trackingId;
				cv::Rect bbox(tObj->bbox.x,tObj->bbox.y,tObj->bbox.width,tObj->bbox.height);

				/**** DO PROCESSING ****/

			}
		}
	}
}

Please let us know if you have any issue.

Hi,

I just hard coded bboxes, if I set “enable-batch-process” to false, I didn’t get any bboxes, If I set it to true I get bboxes but again the same error “Segmentation fault (core dumped)”

std::vector<NvMOTTrackedObj> out_trk ;

std::vector<NvMOTTrackedObjList> out_trk_list ;

for (int i = 0;i<det_obj.numFilled;i++){
  NvMOTTrackedObj OutObject ;
 OutObject.bbox.x = 100+i;
 OutObject.bbox.y = 100+i;
 OutObject.bbox.width = 200+i;
 OutObject.bbox.height = 50+i;
 OutObject.trackingId = i+1;
 OutObject.confidence = 0.9;
 OutObject.classId =0;
 out_trk.push_back(OutObject);

}
for (int i = 0;i<pTrackedObjectsBatch->numFilled;i++){
  NvMOTTrackedObjList OutObject_list ;
 OutObject_list.streamID = fr-> streamID;
 OutObject_list.frameNum = numbuf;
 OutObject_list.list = out_trk.data();
 OutObject_list.numFilled = det_obj.numFilled;
 OutObject_list.valid = true;
 OutObject_list.numAllocated = det_obj.numAllocated;
 out_trk_list.push_back(OutObject_list);
}
pTrackedObjectsBatch->list = out_trk_list.data();

You are not supposed to fill pTrackedObjectsBatch. It is supposed to be filled by the low-level tracker. Please create a partner ticket and provide your full, compilable code.

bcao,

Please work with the customer and reproduce the issue.

I am developing Custom Low-Level Library (mentioned in 2.2.4 in Deepstream 4.0 Plugin Manual), In such case I think I only need to fill pTrackedObjectsBatch, Is my understanding right?