Do you know what the following codes in your testONNX_TRT.py mean?
def preprocess_image(image_path, img_size=(320, 320)):
image = Image.open(image_path).resize(img_size).convert('RGB')
image_data = np.array(image).astype(np.float32)
# Normalize image data if required by your model
image_data = image_data / 255.0
image_data = np.transpose(image_data, (2, 0, 1)) # HWC to CHW
image_data = np.expand_dims(image_data, axis=0) # Add batch dimension
return image_data
Please read DeepStream SDK FAQ - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums and fill the correct preprocessing parameters to the nvinfer configuration file. Each model has its own preprocessing algorithms, please make sure you know the preprocessing algorithm the model needs or just consult the guy who provide the model to you.