cyrusbehr / tensorrt-cpp-api

TensorRT C++ API Tutorial
MIT License
577 stars 72 forks source link

NCHW and NHWC #11

Closed alicera closed 1 year ago

alicera commented 1 year ago

If using the tensorRT engine, the input should be NCHW. Could you comment the line for the image type? I am confuse at the process of NCHW and NHWC. Thanks

cyrusbehr commented 1 year ago

OpenCV reads images into memory in NHWC format, while TensorRT expects images in NCHW format. The conversion is done in the code here as part of the pre-processing before running inference on the inputs.

My tutorial video also explains it here.