Jetson Xavier NX FPS reduces

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson )
**• DeepStream Version 6.0
**• JetPack Version 4.6.1
**• TensorRT Version 8.2

Dear professor:

I meet a problem. I use Jetson Xavier nx to run our code. But the FPS always reduces.

And I found the FPS is unstable, despite I copy the same config file.
My configure files as below:

[ds-example]
enable=0
processing-width=640
processing-height=480
full-frame=0
#batch-size for batch supported optimized plugin
#batch-size=1
unique-id=15
gpu-id=0
blur-objects=1

Supported memory types for blur-objects are 1 and 3

nvbuf-memory-type=4

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=0
rows=2
columns=1
width=640
height=360
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=0
type=4
uri=rtsp://admin:AA123456@192.168.1.3
#uri=radmin:dianqi219@192.168.1.6
num-sources=1
#drop-frame-interval=2
gpu-id=0
cudadec-memtype=0

[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=3
uri=file:/opt/nvidia/deepstream/deepstream-6.0/samples/streams/sample_1080p_h264.mp4
num-sources=1
#drop-frame-interval=2
gpu-id=0

(0): memtype_device - Memory type Device

(1): memtype_pinned - Memory type Host Pinned

(2): memtype_unified - Memory type Unified

cudadec-memtype=0

[sink0]
enable=1
type=2
sync=0
gpu-id=0
nvbuf-memory-type=0

[sink1]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=1000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0

set below properties in case of RTSPStreaming

rtsp-port=8554
udp-port=5400

[osd]
enable=1
gpu-id=0
border-width=5
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0

[streammux]
gpu-id=0
live-source=1
batch-size=2
batched-push-timeout=40000
width=1920
height=1080
enable-padding=0
nvbuf-memory-type=0

[primary-gie]
enable=1
gpu-id=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary_yoloV5.txt

[tracker]
enable=1

For NvDCF and DeepSORT tracker, tracker-width and tracker-height must be a multiple of 32, respectively

tracker-width=640
tracker-height=384
ll-lib-file=/opt/nvidia/deepstream/deepstream-6.0/lib/libnvds_nvmultiobjecttracker.so

ll-config-file required to set different tracker types

ll-config-file=config_tracker_IOU.yml

ll-config-file=config_tracker_NvDCF_perf.yml

ll-config-file=config_tracker_NvDCF_accuracy.yml

ll-config-file=config_tracker_DeepSORT.yml

gpu-id=0
enable-batch-process=1
enable-past-frame=1
display-tracking-id=1

[tests]
file-loop=1

please provide simplified code to reproduce if modified the code, including the whole configuration file.

Thank you for your quick response. My main code is in dsexample.
Here, I connect the MySQL, check the person in some areas. if in the area, write the event in Mysql.

static GstFlowReturn
gst_dsexample_transform_ip (GstBaseTransform * btrans, GstBuffer * inbuf)
{
int n_area=0;
int n_rows=0;
int temp_i;
int temp_j;
int fence_point_data[100][4]={0};
int summary_info[10][2]={0};

// ---- read server_ip -----//
ifstream ifs("server_ip.txt");
stringstream my_buffer;
my_buffer << ifs.rdbuf();
string temp_str(my_buffer.str());
ifs.close();
server_ip = (char *) temp_str.data();

//========================================================//
GstDsExample *dsexample = GST_DSEXAMPLE (btrans);
GstMapInfo in_map_info;
GstFlowReturn flow_ret = GST_FLOW_ERROR;
gdouble scale_ratio = 1.0;
DsExampleOutput *output;
NvBufSurface *surface = NULL;
NvDsBatchMeta *batch_meta = NULL;
NvDsFrameMeta *frame_meta = NULL;
NvDsMetaList * l_frame = NULL;
guint i = 0;
int camera_num;
dsexample->frame_num++;
CHECK_CUDA_STATUS (cudaSetDevice (dsexample->gpu_id), “Unable to set cuda device”);

memset (&in_map_info, 0, sizeof (in_map_info));
if (!gst_buffer_map (inbuf, &in_map_info, GST_MAP_READ))
{
g_print (“Error: Failed to map gst buffer\n”);
goto error;
}
nvds_set_input_system_timestamp (inbuf, GST_ELEMENT_NAME (dsexample));
surface = (NvBufSurface *) in_map_info.data;
GST_DEBUG_OBJECT (dsexample,
“Processing Frame %” G_GUINT64_FORMAT " Surface %p\n",
dsexample->frame_num, surface);

if (CHECK_NVDS_MEMORY_AND_GPUID (dsexample, surface))
goto error;

batch_meta = gst_buffer_get_nvds_batch_meta (inbuf);
if (batch_meta == nullptr)
{
GST_ELEMENT_ERROR (dsexample, STREAM, FAILED,
(“NvDsBatchMeta not found for input buffer.”), (NULL));
return GST_FLOW_ERROR;
}

if (1)
{
struct IntrusionEvent Intrusion_out={-1, -1};
static struct SQLDataInfo Sql_out;
NvDsMetaList * l_obj = NULL;
NvDsObjectMeta *obj_meta = NULL;
int camera_type;
static int Trigger_signal[10] = {0};
static int frame_number = 0;
static int frame_counter_sql = 0;
static int previous_intrusion = 0;
static int out_area = 0;
for(l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next)
{
frame_meta = (NvDsFrameMeta *) (l_frame->data);
int camera_source_id;
camera_source_id = (frame_meta->source_id);
camera_num = (frame_meta->source_id) +1 ;
camera_type = 0;
if(frame_counter_sql % 100 == 0)
{
Sql_out = Check_DATA_SQL(camera_num, camera_type);
frame_counter_sql = 0;
}
frame_counter_sql ++;

    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 == 0) // system engin:person class_id== 2
                                    // yolov4 person class_id==0
        {
            n_area = Sql_out.nArea;
            Intrusion_out = Intrusion_Detection( obj_meta, Sql_out.PointData, Sql_out.SummaryInfop, n_area);
        }
    }
    if (Intrusion_out.event == 1)
    {
        Trigger_signal[Intrusion_out.area] = Trigger_signal[Intrusion_out.area] + 1;
    }
    frame_number++;
    if(frame_number >= 15)
    {
        if(Trigger_signal[Intrusion_out.area]>=12)
        {
            cout<<"person in the area= "<<Intrusion_out.area<<endl;
            if(previous_intrusion == 0)
            {
                string featurevalue = "People In";
                out_area = Intrusion_out.area;
                Mysql_insert(camera_num, Intrusion_out.area, featurevalue);
                previous_intrusion = 1;
            }
        }
        if(Trigger_signal[Intrusion_out.area]<3)
        {
            if (previous_intrusion==1)
            {

// cout<<"person go out, “<<” area= "<<out_area<<endl;
string featurevalue = “People go out”;
Mysql_insert(camera_num, out_area, featurevalue);
}
previous_intrusion = 0;
}
frame_number = 0;
Trigger_signal[Intrusion_out.area] = {0};
}
// end obj_list loop
output = DsExampleProcess (dsexample->dsexamplelib_ctx,
(unsigned char *)dsexample->inter_buf->surfaceList[0].mappedAddr.addr[0]);
attach_metadata_full_frame (dsexample, frame_meta, scale_ratio, output, i, Sql_out.nArea, Sql_out.nPoint, Sql_out.PointData, Sql_out.SummaryInfop);
i++;
free (output);
}// end frame
} //end if(1)

// mysql_close(&sql_insert1);
flow_ret = GST_FLOW_OK;
error:
nvds_set_output_system_timestamp (inbuf, GST_ELEMENT_NAME (dsexample));
gst_buffer_unmap (inbuf, &in_map_info);
return flow_ret;
}

I try to find a way to recover the fps.
(1) “make install” the original dsexample.cpp, and run deepstream-app -c config.txt.
(2) replace the original dsexample.cpp with my code. and run deepstream, some times I can get the normal fps. But some times, the fps reduces very quickly. All the cases are the same. It is mysterious.

what is the problem?

  1. please check if it is related to your modification? for example:
    1.1 test without that dsexample
    1.2test with dsexample, but dsexample do nothing,
    1.3 test with dsexample, print the cost time, check if dsexample cost too much time.
    2 what is your video source type? please check if it is related to your video source.
1 Like

Thank you very much. I will try

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