Deepstream is too slow with save picture

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) :t4
• DeepStream Version 5.1
• JetPack Version (valid for Jetson only)
• TensorRT Version 7.2
• NVIDIA GPU Driver Version (valid for GPU only) 440
• Issue Type( questions, new requirements, bugs) questions
• 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) ./deepstream-test5-app -c configs/test5_config_file_src_infer.txt
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
I save picture in dsexample plug-in.Because it uses OpencV to encode images, it’s much slower.
However, in any project, it is necessary to save a complete picture of the event as it occurs.
I tried to encode images using nvJPEG, but nvJPEG does not support RGBA conversion to BGR.
What should I do?

Please refer to the sample of deepstream-image-meta-test for hradware JPEG encoder. The interfaces are introduced NVIDIA DeepStream SDK API Reference: Main Page

I’m sorry, but that doesn’t solve my problem.I need the original picture, not the object picture.
deepstream-image-meta-test does not suppot encode original picture.
In addition, nvds_obj_encode.h cannot see the source code and cannot be modified, which bothers me very much

When you set the object as the whole frame, the whole frame is encoded. Please refer to the APIs. Object Encoder API — Deepstream Deepstream Version: 5.1 documentation (nvidia.com)

It’s exciting to hear your answer.How do I modify parameters?
Do you mean to modify obj_meta->detector_bbox_info?

You can create a new NvDsObjectMeta and set the values as you like. No need to use obj_meta->detector_bbox_info since you don’t need it.
deepstream-image-meta-test is just a sample to show how to use the APIs, nobody says you must use obj_meta->detector_bbox_info with nvds_obj_enc_process()

I have some problems.
When I encode an existing object with nvds_obj_enc_process() I get the encoded image, but when I create an object using nvds_acquire_obj_meta_from_pool() to encode image, I can’t get the result.Why?

nvds_acquire_obj_meta_from_pool() is just to create a new object meta, you need to fill the content correctly.

I had fill some content,but not work. So I want to know what is must to fill.

 NvDsObjectMeta *enc_obj_meta =
          nvds_acquire_obj_meta_from_pool (batch_meta);
 enc_obj_meta->base_meta.batch_meta = batch_meta;
      enc_obj_meta->rect_params.left = 0;
      enc_obj_meta->rect_params.top = 0;
      enc_obj_meta->rect_params.width = frame_meta->source_frame_width;
      enc_obj_meta->rect_params.height = frame_meta->source_frame_height;
  nvds_obj_enc_process (appCtx->obj_ctx_handle, &encode_proc, ip_surf, enc_obj_meta, frame_meta);

What you fill need to match “ip_surf” and “encode_proc”. The definition of NvDsObjectMeta is defined in /opt/nvidia/deepstream/deepstream/sources/includes/nvdsmeta.h

The existing object meta is the good example.

This is my code that relies on deepstream-test5.
I even tried to fill in all the NvDsObjectMeta fields but not work. Only existing objects can work.

bbox_generated_probe_after_analytics(AppCtx * appCtx, GstBuffer * buf,
    NvDsBatchMeta * batch_meta, guint index)
{
  NvDsObjectMeta *obj_meta = NULL;
  GstMapInfo inmap = GST_MAP_INFO_INIT;
  if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
    GST_ERROR ("input buffer mapinfo failed");
    return GST_FLOW_ERROR;
  }
  NvBufSurface *ip_surf = (NvBufSurface *) inmap.data;
  gst_buffer_unmap (buf, &inmap);
  for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
      l_frame = l_frame->next) {
    NvDsFrameMeta *frame_meta = l_frame->data;
    for (l = frame_meta->obj_meta_list; l != NULL; l = l->next) {
        obj_meta = (NvDsObjectMeta *) (l->data);
        NvDsObjEncUsrArgs encode_proc= { 0 };
        /* To be set by user */
        encode_proc.saveImg = save_img;
        encode_proc.attachUsrMeta = attach_user_meta;
        /* Set if Image scaling Required */
        encode_proc.scaleImg = TRUE;
        encode_proc.scaledWidth = (int)(frame_meta->source_frame_width/2);
        encode_proc.scaledHeight =  (int)(frame_meta->source_frame_height/2);
        /* Preset */
        encode_proc.objNum = 1;
        NvDsObjectMeta *enc_obj_meta =
            nvds_acquire_obj_meta_from_pool (batch_meta);
        enc_obj_meta->base_meta.batch_meta = batch_meta;
        enc_obj_meta->rect_params.left = 0;
        enc_obj_meta->rect_params.top = 0;
        enc_obj_meta->rect_params.width = frame_meta->source_frame_width;
        enc_obj_meta->rect_params.height = frame_meta->source_frame_height;
        nvds_obj_enc_process (appCtx->obj_ctx_handle, &encode_proc, ip_surf, enc_obj_meta, frame_meta);
    }  
  }
}

I got it work in deepstream 6.1.1

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