Does NvInfer Add Padding?

Does NvInfer add padding to the input image?

@abrar.shahriar

Deep learning frameworks like pytorch and tensorflow should provide padding API or operations for tensor arrays.

For example, torch.nn.functional.pad (input, pad, mode='constant', value=0).
The documentation:
https://pytorch.org/docs/stable/nn.functional.html?highlight=functional%20pad#torch.nn.functional.pad

Add padding operation to your DL model should help.
You can then convert your model into ONNX and then tensorRT engine with padding included.

Tell me if you have problems with your model when converting it into tensorRT format.

I mean if I input one 16:9 video and the tensor input is 1:1, does NvInfer maintain the aspect ratio(padding) during image to tensor conversion or does it squeeze the horizontal axis(no padding) ?

@abrar.shahriar

Set maintain-aspect-ratio=1 in NvInfo configuration, 16:9 will pad to 16:16