Hello,
I am running Deepstream 5.1 on Dell G5 15 the GPU is GTX 1650ti the OS is Ubuntu 18.04.5LTS tensorrt version 7.2.3.4 GPU Driver 460.39 CUDA version 11.2
I have a pipeline that is like this:
uridecodebin->nvstreammux->nvinfer->nvtracker->nvdsanalytics->nvvideoconverter->queue->appsink
I read the buffer in the appsink and extract the meta data and frames batch to do further processing on them this is the code I read the images and the metadata with.
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next)
{
std::vector<cv::Rect> persons;
persons.clear();
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *)(l_frame->data);
g_frame_idx = frame_meta->frame_num;
NvBufSurfaceMap(surface, -1, -1, NVBUF_MAP_READ_WRITE);
NvBufSurfaceSyncForCpu(surface, 0, 0);
cv::Mat in_mat = cv::Mat(surface->surfaceList[frame_meta->batch_id].planeParams.height[0],
surface->surfaceList[frame_meta->batch_id].planeParams.width[0], CV_8UC4,
surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[0],
surface->surfaceList[frame_meta->batch_id].planeParams.pitch[0]);
std::cout<<"Pad Index: "<<frame_meta->pad_index<<std::endl;
std::cout<<"Batch ID: "<<frame_meta->batch_id<<std::endl;
g_imagesBatch[frame_meta->pad_index] = in_mat;
pts = frame_meta->buf_pts;
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
l_obj = l_obj->next)
{
obj_meta = (NvDsObjectMeta *)(l_obj->data);
if(obj_meta->class_id == PGIE_CLASS_ID_PERSON)
{
cv::Rect person(obj_meta->tracker_bbox_info.org_bbox_coords.left, obj_meta->tracker_bbox_info.org_bbox_coords.top, obj_meta->tracker_bbox_info.org_bbox_coords.width, obj_meta->tracker_bbox_info.org_bbox_coords.height);
persons.push_back(person);
}
}
g_personsBatch[frame_meta->pad_index] = persons;
}
where g_imagesBatch
is a global std::vector<cv::Mat>
and g_personsBatch
is a global std::vector<std::vector<cv::Rect>>
I lock a mutex before writing to the g_imagesBatch
and unlock it after finishing.
The problem is some frames in say source number 0 say 2 frames in 3000 frames comes mixed with other frames from source number 1 and I don’t know why is this happening please provide some help if you know a solution.