diff --git a/models/cv/object_detection/yolov8n/ixrt/ci/prepare.sh b/models/cv/object_detection/yolov8n/ixrt/ci/prepare.sh index 63103ee945e2c3441c7c99bff31a80e3b3660678..b528cd18575cb794b38bec6754022025e6904166 100644 --- a/models/cv/object_detection/yolov8n/ixrt/ci/prepare.sh +++ b/models/cv/object_detection/yolov8n/ixrt/ci/prepare.sh @@ -18,6 +18,6 @@ set -x pip install -r requirements.txt mkdir -p checkpoints -ln -s /root/data/checkpoints/yolov8.pt yolov8.pt +ln -s /root/data/checkpoints/yolov8n.pt yolov8.pt python3 export.py --weight yolov8.pt --batch 32 onnxsim ./yolov8.onnx ./checkpoints/yolov8.onnx \ No newline at end of file diff --git a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_accuracy.sh b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_accuracy.sh index 65434fece2c57f803a2e27eadf2289bdf61cc7b3..01ecb7429bdfb1c221272911ba86caedf1019a4d 100644 --- a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_accuracy.sh @@ -40,6 +40,18 @@ echo Onnx Path : ${ORIGINE_MODEL} BATCH_SIZE=32 CURRENT_MODEL=${CHECKPOINTS_DIR}/yolov8.onnx +# Update arguments +index=0 +options=$@ +arguments=($options) +for argument in $options +do + index=`expr $index + 1` + case $argument in + --bs) BATCH_SIZE=${arguments[index]};; + esac +done + # Build Engine echo Build Engine ENGINE_FILE=${CHECKPOINTS_DIR}/yolov8_fp16.engine @@ -55,11 +67,10 @@ fi # Inference echo Inference -RUN_BATCH_SIZE=32 python3 ${RUN_DIR}/inference.py \ --model_engine ${ENGINE_FILE} \ --warm_up 2 \ - --bsz ${RUN_BATCH_SIZE} \ + --bsz ${BATCH_SIZE} \ --imgsz 640 \ --datasets ${DATASETS_DIR} \ --acc_target 0.3 diff --git a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_performance.sh b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_performance.sh index 355b27bc6f306786f31c1dee3beabc5360e2bf0d..0801e62b449f4e39f71e0d9bc594f656a496a4a9 100644 --- a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_performance.sh +++ b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_fp16_performance.sh @@ -40,6 +40,18 @@ echo Onnx Path : ${ORIGINE_MODEL} BATCH_SIZE=32 CURRENT_MODEL=${CHECKPOINTS_DIR}/yolov8.onnx +# Update arguments +index=0 +options=$@ +arguments=($options) +for argument in $options +do + index=`expr $index + 1` + case $argument in + --bs) BATCH_SIZE=${arguments[index]};; + esac +done + # Build Engine echo Build Engine ENGINE_FILE=${CHECKPOINTS_DIR}/yolov8_fp16.engine @@ -55,11 +67,10 @@ fi # Inference echo Inference -RUN_BATCH_SIZE=32 python3 ${RUN_DIR}/inference.py \ --model_engine ${ENGINE_FILE} \ --warm_up 2 \ - --bsz ${RUN_BATCH_SIZE} \ + --bsz ${BATCH_SIZE} \ --imgsz 640 \ --datasets ${DATASETS_DIR} \ --perf_only true \ diff --git a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_accuracy.sh b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_accuracy.sh index bf1ecf255f6a16ee859573b1dd5d93b7d138b245..034427e45ddb835200f9c5f33b96e5bfc4da3b72 100644 --- a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_accuracy.sh +++ b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_accuracy.sh @@ -41,6 +41,18 @@ echo Onnx Path : ${ORIGINE_MODEL} BATCH_SIZE=32 CURRENT_MODEL=${CHECKPOINTS_DIR}/yolov8.onnx +# Update arguments +index=0 +options=$@ +arguments=($options) +for argument in $options +do + index=`expr $index + 1` + case $argument in + --bs) BATCH_SIZE=${arguments[index]};; + esac +done + # quant FINAL_MODEL=${CHECKPOINTS_DIR}/quantized_yolov8_bs${BATCH_SIZE}.onnx if [ -f $FINAL_MODEL ];then @@ -75,11 +87,10 @@ fi # Inference echo Inference -RUN_BATCH_SIZE=32 python3 ${RUN_DIR}/inference.py \ --model_engine ${ENGINE_FILE} \ --warm_up 2 \ - --bsz ${RUN_BATCH_SIZE} \ + --bsz ${BATCH_SIZE} \ --imgsz 640 \ --datasets ${DATASETS_DIR} \ --acc_target 0.3 diff --git a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_performance.sh b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_performance.sh index f4c31b681cb2b436543cdbe568d5349e3693080d..d36b9d4a3117b395ad47cfc0ea5db872ac1de569 100644 --- a/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_performance.sh +++ b/models/cv/object_detection/yolov8n/ixrt/scripts/infer_yolov8n_int8_performance.sh @@ -40,6 +40,18 @@ echo Onnx Path : ${ORIGINE_MODEL} BATCH_SIZE=32 CURRENT_MODEL=${CHECKPOINTS_DIR}/yolov8.onnx +# Update arguments +index=0 +options=$@ +arguments=($options) +for argument in $options +do + index=`expr $index + 1` + case $argument in + --bs) BATCH_SIZE=${arguments[index]};; + esac +done + # quant FINAL_MODEL=${CHECKPOINTS_DIR}/quantized_yolov8_bs${BATCH_SIZE}.onnx if [ -f $FINAL_MODEL ];then @@ -74,11 +86,10 @@ fi # Inference echo Inference -RUN_BATCH_SIZE=32 python3 ${RUN_DIR}/inference.py \ --model_engine ${ENGINE_FILE} \ --warm_up 2 \ - --bsz ${RUN_BATCH_SIZE} \ + --bsz ${BATCH_SIZE} \ --imgsz 640 \ --datasets ${DATASETS_DIR} \ --perf_only true \ diff --git a/tests/run_ixrt.py b/tests/run_ixrt.py index 68f3fe35e5e7db35115a34d6fe00e448135c0d18..479a02a3e35a5fd60df21bd881fff6c69a762886 100644 --- a/tests/run_ixrt.py +++ b/tests/run_ixrt.py @@ -370,6 +370,13 @@ def run_detec_testcase(model, batch_size, whl_url): rm -rf ../checkpoints/tmp cd - """ + elif model_name == "yolov8n": + export_onnx_script = f""" + cd ../{model['model_path']} + python3 export.py --weight yolov8.pt --batch {bs} + rm -rf checkpoints/* + onnxsim yolov8.onnx ./checkpoints/yolov8.onnx + """ script = export_onnx_script + base_script + f""" bash scripts/infer_{model_name}_{prec}_accuracy.sh --bs {bs} bash scripts/infer_{model_name}_{prec}_performance.sh --bs {bs}