The inference results of DeepStream and PyTorch are quite different

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) A10
• DeepStream Version 6.0
• JetPack Version (valid for Jetson only)
• TensorRT Version 8.0
• NVIDIA GPU Driver Version (valid for GPU only) 515.65
• Issue Type( questions, new requirements, bugs) questions
I use ResNet50 as a secondary infer.
This is the preprocessing for PyTorch:img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
This is the preprocessing for DeepStream:
config_infer_secondary_att.txt (3.7 KB)
This is prediction of pytorch:
image
This is prediction of DeepStream:
image

as you know, before result there are preprocess ,inference, postprocess three steps.
please make sure preprocess parameters are right, then compare the preprocess results, postprocess results between deepstream and pytorch, please refer to DeepStream SDK FAQ - #21 by mchi

How do I use DeepStream to infer about an image and get the preprocessing results.
Example of deepstream-image-decode-test can use detect model to infer a single picture.
But classification model can’t.
How do I use deepstream to infer with classification model?

please refer to : DeepStream SDK FAQ - #25 by fanzh
Resnet50 with imagenet dataset image classification using deepstream sdk

I have some test results.
Use DeepStream to infer about the rtsp stream:(If the value is greater than 0.8, an alarm message will be generated.)
no_helmet:0.85133.
Use DeepStream to infer about the picture that contain the human object(picture is from alarm message):
0.769078.
Use pytorch to infer about the picture that contain the human object(picture is from alarm message):
0.754606.
So, pytorch is good, deepstream with picture is good, deepstream with video is bad.
What is the reason for this?

I added an experiment.I turn the picture into a video and make inferences.
no_helmet:0.761359.
This is very weird.Only when an alarm is generated online is a bad result.
The offline results are all good.

do you still have any deepstream issues? What is your model used for?

I use it to recognize whether to wear a safety helmet.
The problem is that the online analysis is inconsistent with the offline analysis.

  1. about " pytorch is good, deepstream with picture is good", please check if pytorch with video is ok, please check if it is a deepstream issue or bug.
  2. about “deepstream with picture is good, deepstream with video is bad.”,please narrow down this issue, maybe picture information gets some loss after encoding.
    please record your rtsp to file when do deepstream analysis, find which frame has this issue in the file, dump this frame to yuv from video, then do deepstream analysis to YUV directly, please refer to deepstream-appsrc-test.