Is it possible to feed unsigned char data into TensorRT rather than float32?

Hi All,

Images are 2D arrays of pixels. In most cases pixel is 0…255 (unsigned char) for grey scale or triplets of 0…255 values for colour images. To feed these into TensorRT as inputs we have to convert them to CHW format which is OK (but would still be nice to have an option to do this on GPU through TensorRT). But also each intensity value needs to be converted to float32 which leads to 4x increase in amount of data sent to GPU plus this needs to be done on CPU.

My question is there an option to feed array of unsigned chars as input to TensorRT without conversion to float? Even better if it would be possible to feed HWC array.

Many thanks
Alexey

Hi,

TensorRT only supports FP32, FP16, INT32, and INT8: https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/python_api/infer/FoundationalTypes/DataType.html#tensorrt.DataType

Please refer to this similar topic:

Thanks

Hi Sunil,

Thanks for your response and sorry I was not more specific. Unsigned char in C++ is possible to convert to INT8 in TensorRT (it is only shift by 127 which meant amount of memory for input is same and this could be done quite efficiently). Also shift on origin for input data is easy to compensate in the first leyer of CNN. So if it would be possible to feed INT8 into TensorRT as input that would be big help too.

To rephrase the question. Is it possible to feed INT8 in to TensorRT as input layer rather than float32?

Thanks
Alexey

Hi,

Please refer to below links:
https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#example4_add_custlay_int8

Thanks