How to use NvBufSurfTransformSetSessionParams in dps 6.1

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
TrT 8
• 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)
use the smilar codes
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I want to dump images in deepstream, before dps 6.1.1, It worked very well with the following code, but now in dps 6.1.1, this program throws no error and create no boxes in yolov5. if I comment the last line, the boxes were created correctly.

NvBufSurface *dst_surface = NULL;
NvBufSurface surface_idx;
surface_idx = *surface;
surface_idx.surfaceList = &(surface->surfaceList[batch_id]);
surface_idx.numFilled = surface_idx.batchSize = 1;
int batch_size = surface_idx.batchSize;
cudaStream_t cuda_stream;
cudaError_t cuda_err=cudaStreamCreate (&cuda_stream);

//resize to origin dimension, need to recalculate the bbox later
NvBufSurfTransformRect src_rect, dst_rect;   = 0;
src_rect.left  = 0;   = 0;
dst_rect.left  = 0;
src_rect.width = (guint) surface->surfaceList[batch_id].width;
src_rect.height= (guint) surface->surfaceList[batch_id].height;
dst_rect.width = frame_width;
dst_rect.height= frame_height;

NvBufSurfTransformParams nvbufsurface_params;
nvbufsurface_params.src_rect = &src_rect;
nvbufsurface_params.dst_rect = &dst_rect;
nvbufsurface_params.transform_filter = NvBufSurfTransformInter_Default;

NvBufSurfaceCreateParams nvbufsurface_create_params;
nvbufsurface_create_params.gpuId  = surface->gpuId;
nvbufsurface_create_params.width  = frame_width;
nvbufsurface_create_params.height = frame_height;
nvbufsurface_create_params.size = 0;
nvbufsurface_create_params.colorFormat = NVBUF_COLOR_FORMAT_RGBA;
nvbufsurface_create_params.layout = NVBUF_LAYOUT_PITCH;

#ifdef aarch64
nvbufsurface_create_params.memType = NVBUF_MEM_DEFAULT;
nvbufsurface_create_params.memType = NVBUF_MEM_CUDA_UNIFIED;

cuda_err = cudaSetDevice (surface->gpuId);
int create_result = NvBufSurfaceCreate(&dst_surface,batch_size,&nvbufsurface_create_params);
NvBufSurfTransformConfigParams transform_config_params;
NvBufSurfTransform_Error err;

transform_config_params.compute_mode = NvBufSurfTransformCompute_Default;
transform_config_params.gpu_id = surface->gpuId;
transform_config_params.cuda_stream = cuda_stream;
err = NvBufSurfTransformSetSessionParams (&transform_config_params);

Did you use docker or run directly on you dgpu device?
You mean to comment the err = NvBufSurfTransformSetSessionParams(&transform_config_params);, the box create correctly?
Could you provide us the minimized code that can run well?

@yuweiw Thanks for your reply. I used Docker. 6.1.1-devel.
Yes, if i commented this line and below, it worked smoothly, and showed the correct boxes in my log , the same as the previous deepstream version.
It would be somehow difficult for me to make this minimized runable code because of my limited skill and our complicated project.
Is there any alternative way to realize how to dump an image?

you can refer to this link: RTSP camera access frame issue - #25 by neophyte1
I also used this
Even when I just put this in my code, and nowhere would access to it, there are no boxes in my log, and commented, a lot of boxes come out in log.
I followd this repo and print boxes there. GitHub - marcoslucianops/DeepStream-Yolo: NVIDIA DeepStream SDK 6.1.1 / 6.1 / 6.0.1 / 6.0 configuration for YOLO models

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.

If you are using dGPU, you can just get the raw databuffer from the nvbufersurface. Like:

  uint8_t* src_data = (uint8_t*) malloc(ip_surf->surfaceList[0].dataSize);
  if(src_data == NULL) {
    GST_ERROR("Error: failed to malloc src_data \n");

Just from your code, I can’t see where you get the image data. Could you just add your code in our open source demo, like gstdsexample.cpp? It’s similar to your case.

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