The trt.__version__
will just show 8.6.1 instead of 8.6.1.x.
That is the culprit.
See below log.
/content# python
Python 3.8.18 (default, Aug 25 2023, 13:20:30)
[GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorrt as trt
>>> trt.__version__
'8.6.1'
>>> [NV_TENSORRT_MAJOR, NV_TENSORRT_MINOR, NV_TENSORRT_PATCH, _] = [ int(item) for item in trt.__version__.split(".") ]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: not enough values to unpack (expected 4, got 3)
It does not match tao_tensorflow1_backend/nvidia_tao_tf1/cv/common/export/trt_utils.py at main · NVIDIA/tao_tensorflow1_backend · GitHub.
Please use below solution. It works on my side.
Modify the code.
/content# sed -i "s|_]|]|g" /usr/local/lib/python3.8/dist-packages/nvidia_tao_tf1/cv/common/export/trt_utils.py
Then run exporting.
/content# yolo_v4 export -m /content/drive/MyDrive/results/yolo_v4/experiment_dir_unpruned/weights/yolov4_resnet18_epoch_001.hdf5 -o /content/drive/MyDrive/results/yolo_v4/experiment_dir_unpruned/weights/yolov4_resnet18_epoch_001.onnx -e $SPECS_DIR/yolo_v4_train_resnet18_kitti_seq.txt
Using TensorFlow backend.
2024-03-21 08:32:46.935079: I tensorflow/stream_executor/platform/default/dso_loader.cc:50] Successfully opened dynamic library libcudart.so.12
2024-03-21 08:32:46,987 [TAO Toolkit] [WARNING] tensorflow 40: Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
2024-03-21 08:32:47,945 [TAO Toolkit] [WARNING] root 329: Limited tf.compat.v2.summary API due to missing TensorBoard installation.
2024-03-21 08:32:48,460 [TAO Toolkit] [WARNING] root 329: Limited tf.compat.v2.summary API due to missing TensorBoard installation.
Using TensorFlow backend.
WARNING:tensorflow:Deprecation warnings have been disabled. Set TF_ENABLE_DEPRECATION_WARNINGS=1 to re-enable them.
WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation.
Loaded model
The ONNX operator number change on the optimization: 585 -> 271
INFO:keras2onnx:The ONNX operator number change on the optimization: 585 -> 271
Telemetry data couldn't be sent, but the command ran successfully.
[WARNING]: 'str' object has no attribute 'decode'
Execution status: PASS
/content#
/content# ls -rltsh /content/drive/MyDrive/results/yolo_v4/experiment_dir_unpruned/weights/yolov4_resnet18_epoch_001.onnx
134M -rw------- 1 root root 134M Mar 21 08:34 /content/drive/MyDrive/results/yolo_v4/experiment_dir_unpruned/weights/yolov4_resnet18_epoch_001.onnx
/content#