학술/deep learning

윈도우에서 tensorrt 설치 하기 및 python 확인

ksyoon 2022. 5. 20. 17:56

처음 tensorRT를 윈도우에서 설치하려면 어디서 부터 시작 해야 할지 조금 당황스럽다.

인터넷을 찾아 보면 아래와 같이 설치한다고 되어 있지만,

pip install nvidia-pyindex
pip install nvidia-tensorrt

실제로 해보면 두번째 줄에서 에러가 발생한다.

윈도우는 내길이 아닌가 하는 생각이 들지만 계속 구글링을 해본다.

 

1. tensorRT 홈페이지에 들어가 환경에 맞는 zip 파일을 다운로드 받는다.

https://developer.nvidia.com/nvidia-tensorrt-download

윈도우 버전이고 CUDA 11.2가 설치 되어 있으므로 TensorRT 8.4를 선택했다.

파일을 다운 받아 D: 최상위에 풀면 아래와 같이 된다.

 

D:\TENSORRT-8.4.0.6
├─bin
├─data
│  ├─char-rnn
│  │  └─model
│  ├─faster-rcnn
│  ├─googlenet
│  ├─int8_api
│  ├─mnist
│  ├─resnet50
│  └─ssd
│      └─batches
├─doc
├─graphsurgeon
├─include
├─lib
├─onnx_graphsurgeon
├─python
├─samples
│  ├─common
│  │  └─windows
│  ├─python
│  │  ├─efficientdet
│  │  ├─efficientnet
│  │  ├─end_to_end_tensorflow_mnist
│  │  ├─engine_refit_mnist
│  │  ├─engine_refit_onnx_bidaf
│  │  ├─int8_caffe_mnist
│  │  ├─introductory_parser_samples
│  │  ├─network_api_pytorch_mnist
│  │  ├─onnx_packnet
│  │  ├─uff_custom_plugin
│  │  │  └─plugin
│  │  ├─uff_ssd
│  │  │  ├─images
│  │  │  └─utils
│  │  └─yolov3_onnx
│  ├─sampleAlgorithmSelector
│  ├─sampleCharRNN
│  ├─sampleDynamicReshape
│  ├─sampleFasterRCNN
│  ├─sampleGoogleNet
│  ├─sampleINT8
│  ├─sampleINT8API
│  ├─sampleIOFormats
│  ├─sampleMNIST
│  ├─sampleMNISTAPI
│  ├─sampleNMT
│  │  ├─data
│  │  └─model
│  ├─sampleOnnxMNIST
│  ├─sampleSSD
│  ├─sampleUffFasterRCNN
│  ├─sampleUffMaskRCNN
│  │  └─converted
│  ├─sampleUffMNIST
│  ├─sampleUffPluginV2Ext
│  ├─sampleUffSSD
│  └─trtexec
└─uff

 

 

 

cmd 창에서 현재 자신의 python 버전을 확인한다.

(object_detection_api) C:\SPB_Data\RealTimeObjectDetection-main>python -V
Python 3.7.9

 

버전이 3.7x 이므로 3.7 버전대 버전과 일치하는 명령을 수행한다.

d:\TensorRT-8.4.0.6 는 압축을 푼 TensorRT 위치 이다.

1. pip install d:\TensorRT-8.4.0.6\python\tensorrt-8.4.0.6-cp37-none-win_amd64.whl

2. pip install d:\TensorRT-8.4.0.6\uff\uff-0.6.9-py2.py3-none-any.whl

3. pip install d:\TensorRT-8.4.0.6\graphsurgeon\graphsurgeon-0.4.5-py2.py3-none-any.whl

4. pip install d:\TensorRT-8.4.0.6\onnx_graphsurgeon\onnx_graphsurgeon-0.3.12-py2.py3-none-any.whl

 

>python
>>>import tensorrt
>>>print(tensorrt.__version__)

시험을 해보면

이렇게 버전을 뿌려 준다.

8.4.0.6

출처: https://pythonmana.com/2022/04/202204230340083909.html

 

Install tensorrt in Windows 10 and use it in Python

Preface Required reading ! The installation process is based on the graphics card , Select the appropriate version . Version selection process : The graphics card -> drive ->cuda cuda-cuDNN cuda->TensorRT Selected by the graphics card , Download from s

pythonmana.com