All about

TensorRT Command-Line Wrapper(trtexec) 를 사용하여 dynamic input shape 를 가진 trt model file 을 만들어야 했습니다.

trtexec config 에 아래 세개의 config 를 추가하면 원하는 trt engine 파일을 생성할 수 있습니다.

 

--minShapes: Build with dynamic shapes using a profile with the min shapes provided
--optShapes: Build with dynamic shapes using a profile with the opt shapes provided
--maxShapes: Build with dynamic shapes using a profile with the max shapes provided

예시입니다.

trtexec --onnx=fcn-resnet101.onnx --fp16 --workspace=64 --minShapes=input:1x3x256x256 --optShapes=input:1x3x1026x1282 --maxShapes=input:1x3x1440x2560 --buildOnly --saveEngine=fcn-resnet101.engine

참고자료

https://github.com/NVIDIA/TensorRT/tree/main/samples/trtexec

https://docs.nvidia.com/deeplearning/tensorrt/quick-start-guide/index.html

공유하기

facebook twitter kakaoTalk kakaostory naver band
loading