Difference between predictions of exported TensorRT engine and PyTorch pth models

Hi,
We made some steps which helped us to achieve better result, but we still get only 60% images predictions match between deepstream and local pytorch inferences.

Steps that we made:

  1. We changed nvinfer offset to RGB (offsets=123.675;116.28;103.53)

  2. We trained new model based on images saved from deepstream (in png format) after object detection phase with following pytorch transformations:
    def get_transforms():

    train_transforms = A.Compose(
    [
    A.Resize(height=224, width=224, interpolation=cv2.INTER_NEAREST),
    A.HorizontalFlip(p=0.5),
    A.VerticalFlip(p=0.5),
    A.RandomGamma(gamma_limit=(75, 90), p=0.8),
    A.GridDropout(ratio=0.47, p=0.6),
    A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
    ToTensorV2(),
    ]
    )

    test_transforms = A.Compose(
    [
    A.Resize(height=224, width=224, interpolation=cv2.INTER_NEAREST),
    A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
    ToTensorV2(),
    ]
    )

As you can see we are using INTER_NEAREST method, because we find out that this method is used by deepstream (About the resize method in nvvideoconvert/nvstreammux - #6 by Fiona.Chen)

We know the fact that different libraries gives different resizing result even though using same interpolation methods and because of that it is crucial for us to know how nvinfer interpolation method works and how it can be replicated in our offline training to achieve same preprocessing in production and offline environments.
We hope that someone have solved similar issue and can share information with us.

Thanks