Deep Learning & Machine Learning/강좌&예제 코드

onnx 파일의 shape 확인하기

webnautes 2023. 11. 5. 08:45
반응형

onnx 파일의 shape를 확인하는 방법입니다.



2023. 11. 5 최초작성




참고

https://stackoverflow.com/questions/56734576/find-input-shape-from-onnx-file 





>>> import onnxruntime as ort

 

>>> model = ort.InferenceSession("bytetrack_s.onnx", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])

C:\Users\jeong\miniconda3\envs\bytetrack\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py:53: UserWarning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'CPUExecutionProvider'

  warnings.warn("Specified provider '{}' is not in available provider names."

 

>>> input_shape = model.get_inputs()[0].shape

 

>>> print(input_shape)

[1, 3, 608, 1088]

>>>


반응형