Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
3080Ti
• DeepStream Version
6.0.1(docker nvcr.io/nvidia/deepstream:6.0-devel)
• JetPack Version (valid for Jetson only)
• TensorRT Version
TensorRT v8001
• NVIDIA GPU Driver Version (valid for GPU only)
470.103.01
• Issue Type( questions, new requirements, bugs)
bugs, the doc say nvds_obj_enc_process is a non-blocking call.Because the nvds_obj_enc_process is call in pipeline callback it affact the pipeline performance and cause phenomenon like Nvds_obj_enc_process for whole frame leaves aritfacts over time
• 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)
use the default deepstream-transfer-learning-app and add timing code,in default 1080p streammux config.
save_image takes 0.217953s
save_image takes 0.136698s
save_image takes 0.141414s
save_image takes 0.136969s
when upsacle to 4k in streammux
save_image takes 0.871812s
save_image takes 0.450789s
save_image takes 0.474793s
save_image takes 0.475765s
use opencv in 4k:
all_bbox_generated called! colorformat =6
save_image takes 0.054761s
all_bbox_generated called! colorformat =6
save_image takes 0.039139s
all_bbox_generated called! colorformat =6
save_image takes 0.037592s
all_bbox_generated called! colorformat =6
save_image takes 0.037836s
the code i use
static void save_images_opencv(NvBufSurface * surface, std::string filename) {
int count = 0;
for (uint frameIndex = 0; frameIndex < surface->numFilled;
frameIndex++) {
void *src_data = NULL;
src_data = (char *)malloc(surface->surfaceList[frameIndex].dataSize);
if (src_data == NULL) {
g_print("Error: failed to malloc src_data \n");
}
cudaMemcpy((void *)src_data,
(void *)surface->surfaceList[frameIndex].dataPtr,
surface->surfaceList[frameIndex].dataSize,
cudaMemcpyDeviceToHost);
gint frame_width = (gint)surface->surfaceList[frameIndex].width;
gint frame_height = (gint)surface->surfaceList[frameIndex].height;
size_t frame_step = surface->surfaceList[frameIndex].pitch;
printf("all_bbox_generated called! colorformat =%d\n", surface->surfaceList[frameIndex].colorFormat);
cv::Mat frame = cv::Mat(frame_height * 3/2, frame_width, CV_8UC1, src_data);
cv::Mat out_mat;
cv::cvtColor(frame, out_mat, CV_YUV2BGR_NV12);
cv::imwrite(filename, out_mat);
break;
}
return;
}
static bool save_image(const std::string &path,
NvBufSurface *ip_surf, NvDsObjectMeta *obj_meta,
NvDsFrameMeta *frame_meta, unsigned &obj_counter) {
NvDsObjEncUsrArgs userData = {0};
if (path.size() >= sizeof(userData.fileNameImg)) {
std::cerr << "Folder path too long (path: " << path
<< ", size: " << path.size() << ") could not save image.\n"
<< "Should be less than " << sizeof(userData.fileNameImg) << " characters.";
return false;
}
userData.saveImg = TRUE;
userData.attachUsrMeta = FALSE;
path.copy(userData.fileNameImg, path.size());
userData.fileNameImg[path.size()] = '\0';
userData.objNum = obj_counter++;
userData.quality = 80;
g_img_meta_consumer.init_image_save_library_on_first_time();
auto start = std::chrono::system_clock::now();
// nvds_obj_enc_process(g_img_meta_consumer.get_obj_ctx_handle(),
// &userData, ip_surf, obj_meta, frame_meta);
save_images_opencv(ip_surf, userData.fileNameImg);
auto end = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
std::cout << "save_image takes " << double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den
<< "s" << std::endl;
return true;
}
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)