# Acceleration with INT8 precision using TensorRT

**URL:** <https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173>\
**Category:** TensorRT\
**Tags:** deep-learning, tensorrt, cuda\
**Created:** [February 11, 2021, 6:13am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173 "2021-02-11T06:13:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![himanipatel](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@himanipatel](https://forums.developer.nvidia.com/u/himanipatel)\
**Post date:** [February 11, 2021, 6:13am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/1 "2021-02-11T06:13:29Z")

</div>

## Description

I have successfully converted ResNet-r50 to fp16 using TensorRT with Python and C++ but I am unable to do the same with INT8 precision. I cant quite understand the calibration step involved with the acceleration using the official documentation.

Can anyone help me with understanding the calibration? A good tutorial or reference links might help.

Thanks in advance.

## Environment

**TensorRT Version** : 7.2.2.1  
**GPU Type** : nvidia RTX 3080  
**Nvidia Driver Version** : 460.27.04  
**CUDA Version** : 11.2  
**Operating System + Version** : LINUX 18.04  
**Python Version** : 3.6  
**TensorFlow Version** : 2.3.1

---

<div class="post-metadata">

**Author:** ![NVES](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nves/32/14043_2.png) [@NVES](https://forums.developer.nvidia.com/u/NVES)\
**Post date:** [February 11, 2021, 8:38pm UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/2 "2021-02-11T20:38:04Z")

</div>

Hi , We recommend you to check the supported features from the below link.

> **[Support Matrix :: NVIDIA Deep Learning TensorRT Documentation](https://docs.nvidia.com/deeplearning/tensorrt/support-matrix/index.html)**
>
> These support matrices provide a look into the supported platforms, features, and hardware capabilities of the NVIDIA TensorRT 8.4.3 APIs, parsers, and layers.

Thanks!

---

<div class="post-metadata">

**Author:** ![spolisetty](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/spolisetty/32/14047_2.png) [@spolisetty](https://forums.developer.nvidia.com/u/spolisetty)\
**Post date:** [February 12, 2021, 5:10am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/3 "2021-02-12T05:10:19Z")

</div>

Hi @himanipatel,

Please refer following links.

> **[Sample Support Guide :: NVIDIA Deep Learning TensorRT Documentation](https://docs.nvidia.com/deeplearning/tensorrt/sample-support-guide/index.html)**
>
> This Samples Support Guide provides an overview of all the supported NVIDIA TensorRT 8.4.3 samples included on GitHub and in the product package. The TensorRT samples specifically help in areas such as recommenders, machine comprehension, character...

[https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8API](https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8API)  
[https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8](https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8)

Thank you.

---

<div class="post-metadata">

**Author:** ![himanipatel](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@himanipatel](https://forums.developer.nvidia.com/u/himanipatel)\
**Post date:** [February 12, 2021, 9:42am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/4 "2021-02-12T09:42:21Z")

</div>

Thank you for the quick reply.  
I have checked the compatibility and INT8 is is supported in our GPU. I have run the mnist samples available in the following github repository too: [https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8](https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleINT8)

But I do not understand how to implement the same for custom models.

---

<div class="post-metadata">

**Author:** ![himanipatel](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@himanipatel](https://forums.developer.nvidia.com/u/himanipatel)\
**Post date:** [February 12, 2021, 9:48am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/5 "2021-02-12T09:48:35Z")

</div>

I have referred to these links but I am still having difficulty in converting my custom model. If you have any good tutorials, it would be very helpful.  
I am new to the field so sorry if these queries basic or obvious.

---

<div class="post-metadata">

**Author:** ![jkjung13](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/jkjung13/32/10943_2.png) [@jkjung13](https://forums.developer.nvidia.com/u/jkjung13)\
**Post date:** [February 13, 2021, 3:45am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/6 "2021-02-13T03:45:48Z")

</div>

Check out my [Demo #6: Using INT8 and DLA core](https://github.com/jkjung-avt/tensorrt_demos#int8_and_dla) of tensorrt\_demos. I think you’d be able to reuse most of my [calibrator.py](https://github.com/jkjung-avt/tensorrt_demos/blob/master/yolo/calibrator.py) code. And the code for building the INT8 TensorRT engine is [here](https://github.com/jkjung-avt/tensorrt_demos/blob/9d921caf37a987838f948c1fc9f63163f7228547/yolo/onnx_to_tensorrt.py#L117-L154).

---

<div class="post-metadata">

**Author:** ![himanipatel](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@himanipatel](https://forums.developer.nvidia.com/u/himanipatel)\
**Post date:** [February 13, 2021, 4:51am UTC](https://forums.developer.nvidia.com/t/acceleration-with-int8-precision-using-tensorrt/168173/7 "2021-02-13T04:51:46Z")

</div>

Thank you so much.
