Preprocessing for images smaller than model's input when maintain_aspect_ratio and symmetric_padding are true

I am working with a secondary model for classification using nvinferserver. Suppose the model input size is 224x224 and I set the properties maintain_aspect_ratio: true and symmetric_padding: true to the model preprocessing.
What will happen to a bounding box of shape 60x58? Will it be padded to a square of 60x60 and then resized to 224x224 (original image is padded and enlarged) or will it be only padded to 224x224 (that is, the original image will be padded but not enlarged and it will appear as an image of 60x58 within an image of 224x244)?

I truly appreciate your help. Thank you!

Please provide complete information as applicable to your setup.

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


It is padded and resized.
You can check following sample to write a customized preprocessing for your use case:



Thanks @AastaLLL, Can this plugin be used to run preprocessing for secondary models? I am currently running a primary model and two secondary models. Unfortunately, each model has a different preprocessing. Could I define a different preprocessing for the secondary model? How? The example you mentioned seem to do preprocessing only a primary model.
Thank you!


Sorry that the preprocess example is only supported for primary model now.

1 Like

Thank you @AastaLLL !

Hi @AastaLLL , what happens if I enable the padding? Is the image first padded and then offset and net-scale-factor are applied or it is it the opposite? I am trying to figure out the order of the two operations. Thank you

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