Skip to content

Instantly share code, notes, and snippets.

@JujuDel
Last active November 1, 2024 09:01
Show Gist options
  • Save JujuDel/3ac44f06567f791e98cfba06aa943f3c to your computer and use it in GitHub Desktop.
Save JujuDel/3ac44f06567f791e98cfba06aa943f3c to your computer and use it in GitHub Desktop.
Run trtexec on yolo v11 model variations.
# sudo apt-get install -y cuda-toolkit-<major>-<minor>
# sudo apt-get install -y tensorrt nvidia-tensorrt-dev
# sudo nvpmodel -m 0
# sudo jetson_clocks
out_file="/home/user/yolo11_trtexec.txt"
rm ${out_file}
variants=("yolo11n" "yolo11s" "yolo11m" "yolo11l" "yolo11x")
image_sizes=("320" "384" "416" "512" "608" "640")
for variant in "${variants[@]}"; do
for size in "${image_sizes[@]}"; do
echo -e "------ ${variant} ${size} ------" >> ${out_file} 2>&1
/usr/src/tensorrt/bin/trtexec \
--onnx=./models/${variant}.onnx \
--fp16 --inputIOFormats=fp16:chw \
--saveEngine=./models/${variant}_${size}_fp_16.engine \
--shapes=\'images\':1x3x${size}x${size} \
--noDataTransfers --useSpinWait \
--timingCacheFile=./timing_cache \
--iterations=100 --duration=5 2>&1 | tee -a ${out_file}
done
done
# With dump profile (per layer info), add --dumpProfile, e.g.
# /usr/src/tensorrt/bin/trtexec \
# --onnx=./models/${variant}.onnx \
# --fp16 --inputIOFormats=fp16:chw \
# --shapes=\'images\':1x3x${size}x${size} \
# --noDataTransfers --useSpinWait \
# --timingCacheFile=./timing_cache \
# --iterations=100 --duration=5 \
# --dumpProfile 2>&1 | tee -a ${out_file}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment