Fatal error: NvInfer.h: No such file or directory

Description

I have installed TensorRT following the tar method shown on Nvidia docs. I am trying to convert PyTorch .pt file to TensorRT for performance, as shown in this. I am encountering an error in the second step (In make command), which is

fatal error: NvInfer.h: No such file or directory

I am able to locate this file at ~/TensorRT-7.2.1.6/include/NvInfer.h
Path of TensorRT is also exported in my .bashrc file as shown in the docs. I did find solutions for this problem on other sites (Github, StackOverflow), but it talks about DEB installation method of TensorRT rather than TAR installation method which I used. Though, I am able to import TensorRT in python successfully without any errors. How can I make it work?

Environment

TensorRT Version: 7.2.1.6
GPU Type: GeForce 940MX
Nvidia Driver Version: 455
CUDA Version: 11.1
CUDNN Version: 8.0.5
Operating System + Version: Ubuntu 18.04
Python Version (if applicable): 3.7
PyTorch Version (if applicable): 1.7

How stupid of me to not check issues. Here’s solution in case anyone runs into it.

2 Likes
./yolov5_det -d yolov5s.engine ../images

when i run this I am getting emtpy bounding boxes

/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:96: DeprecationWarning: Use get_tensor_shape instead.
print(‘bingding:’, binding, engine.get_binding_shape(binding))
bingding: data (3, 640, 640)
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:97: DeprecationWarning: Use get_tensor_shape instead.
size = trt.volume(engine.get_binding_shape(binding)) * engine.max_batch_size
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:97: DeprecationWarning: Use network created with NetworkDefinitionCreationFlag::EXPLICIT_BATCH flag instead.
size = trt.volume(engine.get_binding_shape(binding)) * engine.max_batch_size
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:98: DeprecationWarning: Use get_tensor_dtype instead.
dtype = trt.nptype(engine.get_binding_dtype(binding))
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:105: DeprecationWarning: Use get_tensor_mode instead.
if engine.binding_is_input(binding):
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:106: DeprecationWarning: Use get_tensor_shape instead.
self.input_w = engine.get_binding_shape(binding)[-1]
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:107: DeprecationWarning: Use get_tensor_shape instead.
self.input_h = engine.get_binding_shape(binding)[-2]
bingding: prob (38001, 1, 1)
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:123: DeprecationWarning: Use network created with NetworkDefinitionCreationFlag::EXPLICIT_BATCH flag instead.
self.batch_size = engine.max_batch_size
batch size is 1
/home/advik/Desktop/tensorrtx/yolov5/yolov5_det_trt.py:157: DeprecationWarning: Use execute_async_v2 instead.
context.execute_async(batch_size=self.batch_size, bindings=bindings, stream_handle=stream.handle)
result_boxes
warm_up->(640, 640, 3), time->86.24ms
result_boxes
warm_up->(640, 640, 3), time->6.50ms
result_boxes
warm_up->(640, 640, 3), time->6.46ms
result_boxes
warm_up->(640, 640, 3), time->6.45ms
result_boxes
warm_up->(640, 640, 3), time->6.44ms
result_boxes
warm_up->(640, 640, 3), time->6.45ms
result_boxes
warm_up->(640, 640, 3), time->6.45ms
result_boxes
warm_up->(640, 640, 3), time->6.47ms
result_boxes
warm_up->(640, 640, 3), time->6.45ms
result_boxes
warm_up->(640, 640, 3), time->6.46ms
result_boxes
input->[‘images/bus.jpg’], time->6.45ms, saving into output/
result_boxes
input->[‘images/zidane.jpg’], time->6.46ms, saving into output/