# Can nvinfer normailize image base on mean and std of each image

**URL:** <https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364>\
**Category:** DeepStream SDK\
**Tags:** deepstream\
**Created:** [November 22, 2024, 9:47am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364 "2024-11-22T09:47:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![namogg1012](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@namogg1012](https://forums.developer.nvidia.com/u/namogg1012)\
**Post date:** [November 22, 2024, 9:47am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364/1 "2024-11-22T09:47:33Z")

</div>

**• Hardware Platform : dGPU**  
**• DeepStream Version: 7.0**  
**• TensorRT Version: 8.6.1.6**  
\*\*• NVIDIA GPU Driver Version: 555.58.02 \*\*  
**• Issue Type: Question**

Currently, we are normalizing input of our model with this function:

```auto
  def img_normalize(x):
        mean = np.mean(x)
        std = np.std(x)
        y = (x - mean) / std
        return y

```

Is there a way to achive this by using nvinfer net-scale-factor and mean?

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [November 25, 2024, 1:53am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364/3 "2024-11-25T01:53:14Z")

</div>

Currently standard deviation is not supported. You can implement the algorithm by yourself and integrate with the [gst-nvpreprocess plugin](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvdspreprocess.html).

---

<div class="post-metadata">

**Author:** ![namogg1012](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@namogg1012](https://forums.developer.nvidia.com/u/namogg1012)\
**Post date:** [November 25, 2024, 2:02am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364/4 "2024-11-25T02:02:15Z")

</div>

Is there any example for preprocessing using python like post-processing in deepstream-ssd-parser?

---

<div class="post-metadata">

**Author:** ![Fiona.Chen](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/fiona.chen/32/15508_2.png) [@Fiona.Chen](https://forums.developer.nvidia.com/u/Fiona.Chen)\
**Post date:** [November 25, 2024, 2:04am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364/5 "2024-11-25T02:04:02Z")

</div>

> [@namogg1012](#):
>
> Is there any example for preprocessing using python

No. It is recommended to implement the preprocessing algorithm with c/c++ and be integrated by [gst-nvpreprocess plugin](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvdspreprocess.html).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [December 9, 2024, 2:04am UTC](https://forums.developer.nvidia.com/t/can-nvinfer-normailize-image-base-on-mean-and-std-of-each-image/314364/6 "2024-12-09T02:04:34Z")

</div>

Closed on December 9, 2024, 2:04am UTC

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