# Replicating PyTorch image pre-processing into TRT DeepStream

**URL:** <https://forums.developer.nvidia.com/t/replicating-pytorch-image-pre-processing-into-trt-deepstream/184423>\
**Category:** DeepStream SDK\
**Tags:** tensorrt\
**Created:** [July 22, 2021, 10:54am UTC](https://forums.developer.nvidia.com/t/replicating-pytorch-image-pre-processing-into-trt-deepstream/184423 "2021-07-22T10:54:29Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [July 23, 2021, 2:56am UTC](https://forums.developer.nvidia.com/t/replicating-pytorch-image-pre-processing-into-trt-deepstream/184423/3 "2021-07-23T02:56:22Z")

</div>

Hi,

Please find below’s topic for the information:

> [@How to set the correct config for a pytorch model in nvinfer?](https://forums.developer.nvidia.com/t/how-to-set-the-correct-config-for-a-pytorch-model-in-nvinfer/174633/):
>
> Hello, I have trained a Resnet classifier in PyTorch and exported to an ONNX model. The FC layer of Resnet18 is set to: model.fc = nn.Sequential( nn.Linear(model.fc.in\_features, args.n\_classes, bias=False), nn.Softmax(1), ) These are the normalization values I have used. normalize = transforms.Normalize( mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) The model accuracy goes up to 80%, but when I infer (using nvinfer) on the exact same images used…

Thanks.

---

_[View the full topic](https://forums.developer.nvidia.com/t/replicating-pytorch-image-pre-processing-into-trt-deepstream/184423)._
