Error: Object dimensions are out of frame boundary. Object not encoded

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU)jetson agx orin
**• DeepStream Version 6.4
**• JetPack Version (valid for Jetson only) 6.0
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
**• Issue Type( questions, new requirements, bugs)questions

When I tested deepstream-server, I added the pgie_src_pad_buffer_probe callback function to pgie’s src and nothing else changed. And I see the answer to this question in the forum, it does not help me

static GstPadProbeReturn
pgie_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer ctx)
{
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo inmap = GST_MAP_INFO_INIT;
if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
GST_ERROR (“input buffer mapinfo failed”);
return GST_PAD_PROBE_DROP;
}
NvBufSurface idx_surface;
NvBufSurface *ip_surf = (NvBufSurface *) inmap.data;
gst_buffer_unmap (buf, &inmap);
NvDsObjectMeta *obj_meta = NULL;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);

for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
guint num_rects = 0;
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
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_VEHICLE) {
//g_print(“VEHICLE–1\n”);
num_rects++;
}
if (obj_meta->class_id == PGIE_CLASS_ID_PERSON) {
// g_print(“PERSON–1\n”);
num_rects++;
}
//g_printerr (“pgie_src_pad_buffer_probe–1!\n”);
/
Conditions that user needs to set to encode the detected objects of
* interest. Here, by default all the detected objects are encoded.
* For demonstration, we will encode the first object in the frame. */
if ((obj_meta->class_id == PGIE_CLASS_ID_PERSON
|| obj_meta->class_id == PGIE_CLASS_ID_VEHICLE)
&& num_rects == 1) {

    idx_surface = *ip_surf;
    idx_surface.surfaceList = &(ip_surf->surfaceList[frame_meta->source_id]);
    idx_surface.numFilled = idx_surface.batchSize = 1;
    NvDsObjEncUsrArgs objData = { 0 };
    /* To be set by user */
    objData.saveImg = FALSE;
    objData.attachUsrMeta = TRUE;
    /* Set if Image scaling Required */
    objData.scaleImg = FALSE;
    objData.scaledWidth = 0;
    objData.scaledHeight = 0;
    /* Preset */
    objData.objNum = num_rects;
    // obj_meta->rect_params.width = idx_surface.surfaceList[0].width ;
    // obj_meta->rect_params.height = idx_surface.surfaceList[0].height ;
    // obj_meta->rect_params.top = 0 ;
    // obj_meta->rect_params.left = 0 ;
    /* Quality */
    objData.quality = 80;
    /*Main Function Call */
    bool bret = nvds_obj_enc_process ((NvDsObjEncCtxHandle)ctx, &objData, &idx_surface, obj_meta, frame_meta);
    if(bret)
    {
      g_printerr("nvds_obj_enc_process error left = %f,top = %f,width = %f,height = %f\n",
      obj_meta->rect_params.left,obj_meta->rect_params.top,obj_meta->rect_params.width,obj_meta->rect_params.height);
    }
    else
    {
      g_printerr("nvds_obj_enc_process successleft = %f,top = %f,width = %f,height = %f\n",
      obj_meta->rect_params.left,obj_meta->rect_params.top,obj_meta->rect_params.width,obj_meta->rect_params.height);
    }
  
  }
}

}
nvds_obj_enc_finish ((NvDsObjEncCtxHandle)ctx);
return GST_PAD_PROBE_OK;
}

An error occurred in the function nvds obj enc process , Error: Object dimensions are out of frame boundary. Object not encoded。

May I ask how to modify this to work properly,

In the test, the width of the result does exceed the prescribed width, what I don’t understand is why the size ,


of the recognized object exceeds the size of the frame

1.This is normal. If only part of the object is in the image, the model may infer the size of the entire object, causing the bbox to exceed the image.
2. Try add crop-objects-to-roi-boundary=1 to configuration file of nvinfer .
This will clip the bbox

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. Thanks

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