From c034036663b617ec514f2ab1ce490b0ba0b1ea13 Mon Sep 17 00:00:00 2001 From: "hongliang.yuan" Date: Thu, 28 Aug 2025 14:17:48 +0800 Subject: [PATCH] update igie model build engine if exsit then skip --- .../classification/clip/igie/build_engine.py | 3 + .../infer_conformer_base_fp16_accuracy.sh | 2 +- .../infer_conformer_base_fp16_performance.sh | 2 +- .../igie_common/build_engine.py | 4 + .../swin_transformer/igie/build_engine.py | 73 ------------------- .../infer_swin_transformer_fp16_accuracy.sh | 2 +- ...infer_swin_transformer_fp16_performance.sh | 2 +- .../classification/vit/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_vit_fp16_accuracy.sh | 2 +- .../scripts/infer_vit_fp16_performance.sh | 2 +- .../atss/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_atss_fp16_accuracy.sh | 2 +- .../scripts/infer_atss_fp16_performance.sh | 2 +- .../centernet/igie/build_engine.py | 73 ------------------- .../scripts/infer_centernet_fp16_accuracy.sh | 2 +- .../infer_centernet_fp16_performance.sh | 2 +- .../fcos/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_fcos_fp16_accuracy.sh | 2 +- .../scripts/infer_fcos_fp16_performance.sh | 2 +- .../foveabox/igie/build_engine.py | 73 ------------------- .../scripts/infer_foveabox_fp16_accuracy.sh | 2 +- .../infer_foveabox_fp16_performance.sh | 2 +- .../fsaf/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_fsaf_fp16_accuracy.sh | 2 +- .../scripts/infer_fsaf_fp16_performance.sh | 2 +- .../object_detection/gfl/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_gfl_fp16_accuracy.sh | 2 +- .../scripts/infer_gfl_fp16_performance.sh | 2 +- .../hrnet/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_hrnet_fp16_accuracy.sh | 2 +- .../scripts/infer_hrnet_fp16_performance.sh | 2 +- .../igie_common}/build_engine.py | 3 + .../object_detection/paa/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_paa_fp16_accuracy.sh | 2 +- .../scripts/infer_paa_fp16_performance.sh | 2 +- .../retinaface/igie/build_engine.py | 73 ------------------- .../scripts/infer_retinaface_fp16_accuracy.sh | 2 +- .../infer_retinaface_fp16_performance.sh | 2 +- .../retinanet/igie/build_engine.py | 73 ------------------- .../scripts/infer_retinanet_fp16_accuracy.sh | 2 +- .../infer_retinanet_fp16_performance.sh | 2 +- .../rtmdet/igie/build_engine.py | 73 ------------------- .../scripts/infer_rtmdet_fp16_accuracy.sh | 2 +- .../scripts/infer_rtmdet_fp16_performance.sh | 2 +- .../sabl/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_sabl_fp16_accuracy.sh | 2 +- .../scripts/infer_sabl_fp16_performance.sh | 2 +- .../object_detection/ssd/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_ssd_fp16_accuracy.sh | 2 +- .../scripts/infer_ssd_fp16_performance.sh | 2 +- .../yolof/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_yolof_fp16_accuracy.sh | 2 +- .../scripts/infer_yolof_fp16_performance.sh | 2 +- .../yolov10/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov10_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov10_fp16_performance.sh | 2 +- .../yolov11/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov11_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov11_fp16_performance.sh | 2 +- .../yolov12/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov12_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov12_fp16_performance.sh | 2 +- .../yolov13/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov13_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov13_fp16_performance.sh | 2 +- .../yolov3/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov3_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov3_fp16_performance.sh | 2 +- .../scripts/infer_yolov3_int8_accuracy.sh | 2 +- .../scripts/infer_yolov3_int8_performance.sh | 2 +- .../yolov4/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov4_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov4_fp16_performance.sh | 2 +- .../scripts/infer_yolov4_int8_accuracy.sh | 2 +- .../scripts/infer_yolov4_int8_performance.sh | 2 +- .../yolov5/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov5_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov5_fp16_performance.sh | 2 +- .../scripts/infer_yolov5_int8_accuracy.sh | 2 +- .../scripts/infer_yolov5_int8_performance.sh | 2 +- .../yolov6/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov6_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov6_fp16_performance.sh | 2 +- .../yolov7/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov7_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov7_fp16_performance.sh | 2 +- .../scripts/infer_yolov7_int8_accuracy.sh | 2 +- .../scripts/infer_yolov7_int8_performance.sh | 2 +- .../yolov8/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov8_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov8_fp16_performance.sh | 2 +- .../scripts/infer_yolov8_int8_accuracy.sh | 2 +- .../scripts/infer_yolov8_int8_performance.sh | 2 +- .../yolov9/igie/build_engine.py | 73 ------------------- .../scripts/infer_yolov9_fp16_accuracy.sh | 2 +- .../scripts/infer_yolov9_fp16_performance.sh | 2 +- .../yolox/igie/build_engine.py | 73 ------------------- .../igie/scripts/infer_yolox_fp16_accuracy.sh | 2 +- .../scripts/infer_yolox_fp16_performance.sh | 2 +- .../igie/scripts/infer_yolox_int8_accuracy.sh | 2 +- .../scripts/infer_yolox_int8_performance.sh | 2 +- .../cv/ocr/kie_layoutxlm/igie/build_engine.py | 3 + models/cv/ocr/svtr/igie/build_engine.py | 3 + .../hrnetpose/igie/build_engine.py | 3 + .../rtmpose/igie/build_engine.py | 3 + .../unet/igie/build_engine.py | 3 + 106 files changed, 95 insertions(+), 2114 deletions(-) delete mode 100644 models/cv/classification/swin_transformer/igie/build_engine.py delete mode 100644 models/cv/classification/vit/igie/build_engine.py delete mode 100644 models/cv/object_detection/atss/igie/build_engine.py delete mode 100644 models/cv/object_detection/centernet/igie/build_engine.py delete mode 100644 models/cv/object_detection/fcos/igie/build_engine.py delete mode 100644 models/cv/object_detection/foveabox/igie/build_engine.py delete mode 100644 models/cv/object_detection/fsaf/igie/build_engine.py delete mode 100644 models/cv/object_detection/gfl/igie/build_engine.py delete mode 100644 models/cv/object_detection/hrnet/igie/build_engine.py rename models/cv/{classification/conformer_base/igie => object_detection/igie_common}/build_engine.py (97%) delete mode 100644 models/cv/object_detection/paa/igie/build_engine.py delete mode 100644 models/cv/object_detection/retinaface/igie/build_engine.py delete mode 100644 models/cv/object_detection/retinanet/igie/build_engine.py delete mode 100644 models/cv/object_detection/rtmdet/igie/build_engine.py delete mode 100644 models/cv/object_detection/sabl/igie/build_engine.py delete mode 100644 models/cv/object_detection/ssd/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolof/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov10/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov11/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov12/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov13/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov3/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov4/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov5/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov6/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov7/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov8/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolov9/igie/build_engine.py delete mode 100644 models/cv/object_detection/yolox/igie/build_engine.py diff --git a/models/cv/classification/clip/igie/build_engine.py b/models/cv/classification/clip/igie/build_engine.py index 85182c2f..46e09ff4 100644 --- a/models/cv/classification/clip/igie/build_engine.py +++ b/models/cv/classification/clip/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -53,6 +54,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_dict = {} diff --git a/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_accuracy.sh b/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_accuracy.sh index bfb215eb..863980b0 100644 --- a/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_accuracy.sh +++ b/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="conformer_base_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_performance.sh b/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_performance.sh index 43f730a0..2294e02e 100644 --- a/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_performance.sh +++ b/models/cv/classification/conformer_base/igie/scripts/infer_conformer_base_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="conformer_base_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/classification/igie_common/build_engine.py b/models/cv/classification/igie_common/build_engine.py index d3626ae7..8874dc7b 100644 --- a/models/cv/classification/igie_common/build_engine.py +++ b/models/cv/classification/igie_common/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +53,9 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return + # get input valueinfo input_name, input_shape = args.input.split(":") diff --git a/models/cv/classification/swin_transformer/igie/build_engine.py b/models/cv/classification/swin_transformer/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/classification/swin_transformer/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_accuracy.sh b/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_accuracy.sh index 55352553..c513584e 100644 --- a/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_accuracy.sh +++ b/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="swin_transformer_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input pixel_values:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_performance.sh b/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_performance.sh index f79aafc1..0aca584c 100644 --- a/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_performance.sh +++ b/models/cv/classification/swin_transformer/igie/scripts/infer_swin_transformer_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="swin_transformer_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input pixel_values:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/classification/vit/igie/build_engine.py b/models/cv/classification/vit/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/classification/vit/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/classification/vit/igie/scripts/infer_vit_fp16_accuracy.sh b/models/cv/classification/vit/igie/scripts/infer_vit_fp16_accuracy.sh index 25ec7186..53b726b8 100644 --- a/models/cv/classification/vit/igie/scripts/infer_vit_fp16_accuracy.sh +++ b/models/cv/classification/vit/igie/scripts/infer_vit_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="vit_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input pixel_values:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/classification/vit/igie/scripts/infer_vit_fp16_performance.sh b/models/cv/classification/vit/igie/scripts/infer_vit_fp16_performance.sh index b832c6c6..286aaee0 100644 --- a/models/cv/classification/vit/igie/scripts/infer_vit_fp16_performance.sh +++ b/models/cv/classification/vit/igie/scripts/infer_vit_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="vit_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input pixel_values:${batchsize},3,224,224 \ --precision fp16 \ diff --git a/models/cv/object_detection/atss/igie/build_engine.py b/models/cv/object_detection/atss/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/atss/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_accuracy.sh b/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_accuracy.sh index 8bb8ab47..00ee8218 100644 --- a/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_accuracy.sh +++ b/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="atss_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_performance.sh b/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_performance.sh index 427c05be..e82f4dda 100644 --- a/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_performance.sh +++ b/models/cv/object_detection/atss/igie/scripts/infer_atss_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="atss_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/centernet/igie/build_engine.py b/models/cv/object_detection/centernet/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/centernet/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_accuracy.sh b/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_accuracy.sh index 4cbf2e21..ad07c1c9 100644 --- a/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_accuracy.sh +++ b/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="centernet.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,672,672 \ --precision fp16 \ diff --git a/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_performance.sh b/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_performance.sh index 1d3c6955..84880a20 100644 --- a/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_performance.sh +++ b/models/cv/object_detection/centernet/igie/scripts/infer_centernet_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="centernet.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,672,672 \ --precision fp16 \ diff --git a/models/cv/object_detection/fcos/igie/build_engine.py b/models/cv/object_detection/fcos/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/fcos/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_accuracy.sh b/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_accuracy.sh index c09f2c33..05b7a283 100644 --- a/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_accuracy.sh +++ b/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="fcos_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_performance.sh b/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_performance.sh index 8f358c38..66d7c190 100644 --- a/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_performance.sh +++ b/models/cv/object_detection/fcos/igie/scripts/infer_fcos_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="fcos_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/foveabox/igie/build_engine.py b/models/cv/object_detection/foveabox/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/foveabox/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_accuracy.sh b/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_accuracy.sh index 511ac21c..319a2074 100644 --- a/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_accuracy.sh +++ b/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="foveabox_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_performance.sh b/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_performance.sh index 76d692a1..20613487 100644 --- a/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_performance.sh +++ b/models/cv/object_detection/foveabox/igie/scripts/infer_foveabox_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="foveabox_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/fsaf/igie/build_engine.py b/models/cv/object_detection/fsaf/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/fsaf/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_accuracy.sh b/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_accuracy.sh index 94bd0b40..360baf13 100644 --- a/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_accuracy.sh +++ b/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="fsaf_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_performance.sh b/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_performance.sh index cb8f93aa..4cb255e4 100644 --- a/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_performance.sh +++ b/models/cv/object_detection/fsaf/igie/scripts/infer_fsaf_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="fsaf_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/gfl/igie/build_engine.py b/models/cv/object_detection/gfl/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/object_detection/gfl/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_accuracy.sh b/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_accuracy.sh index 63f8d669..ee5d2858 100644 --- a/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_accuracy.sh +++ b/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="gfl_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_performance.sh b/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_performance.sh index 2cf32f97..7e4c9d47 100644 --- a/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_performance.sh +++ b/models/cv/object_detection/gfl/igie/scripts/infer_gfl_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="gfl_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/hrnet/igie/build_engine.py b/models/cv/object_detection/hrnet/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/hrnet/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_accuracy.sh b/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_accuracy.sh index d613f2e2..fda5ecf8 100644 --- a/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_accuracy.sh +++ b/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="hrnet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_performance.sh b/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_performance.sh index ec405bb1..f8f9a06f 100644 --- a/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_performance.sh +++ b/models/cv/object_detection/hrnet/igie/scripts/infer_hrnet_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="hrnet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/classification/conformer_base/igie/build_engine.py b/models/cv/object_detection/igie_common/build_engine.py similarity index 97% rename from models/cv/classification/conformer_base/igie/build_engine.py rename to models/cv/object_detection/igie_common/build_engine.py index d3626ae7..8b554afa 100644 --- a/models/cv/classification/conformer_base/igie/build_engine.py +++ b/models/cv/object_detection/igie_common/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +53,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_name, input_shape = args.input.split(":") diff --git a/models/cv/object_detection/paa/igie/build_engine.py b/models/cv/object_detection/paa/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/paa/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_accuracy.sh b/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_accuracy.sh index 9909aa30..eb68cae2 100644 --- a/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_accuracy.sh +++ b/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="paa_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_performance.sh b/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_performance.sh index 49d54558..e2d23920 100644 --- a/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_performance.sh +++ b/models/cv/object_detection/paa/igie/scripts/infer_paa_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="paa_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/retinaface/igie/build_engine.py b/models/cv/object_detection/retinaface/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/retinaface/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_accuracy.sh b/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_accuracy.sh index ea43f251..b0480eca 100644 --- a/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_accuracy.sh +++ b/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="retinaface_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,320,320 \ --precision fp16 \ diff --git a/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_performance.sh b/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_performance.sh index e92b1f56..99f1a0b5 100644 --- a/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_performance.sh +++ b/models/cv/object_detection/retinaface/igie/scripts/infer_retinaface_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="retinaface_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,320,320 \ --precision fp16 \ diff --git a/models/cv/object_detection/retinanet/igie/build_engine.py b/models/cv/object_detection/retinanet/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/retinanet/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_accuracy.sh b/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_accuracy.sh index 5c6d5c24..c942bc14 100644 --- a/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_accuracy.sh +++ b/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="retinanet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_performance.sh b/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_performance.sh index fc73c544..84570845 100644 --- a/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_performance.sh +++ b/models/cv/object_detection/retinanet/igie/scripts/infer_retinanet_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="retinanet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/rtmdet/igie/build_engine.py b/models/cv/object_detection/rtmdet/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/rtmdet/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_accuracy.sh b/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_accuracy.sh index c199f840..12d5ab4a 100644 --- a/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_accuracy.sh +++ b/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="rtmdet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,320,320 \ --precision fp16 \ diff --git a/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_performance.sh b/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_performance.sh index dbf78ee8..4f1c3a5c 100644 --- a/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_performance.sh +++ b/models/cv/object_detection/rtmdet/igie/scripts/infer_rtmdet_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="rtmdet_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,320,320 \ --precision fp16 \ diff --git a/models/cv/object_detection/sabl/igie/build_engine.py b/models/cv/object_detection/sabl/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/sabl/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_accuracy.sh b/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_accuracy.sh index 9b39004d..b5cc4216 100644 --- a/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_accuracy.sh +++ b/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="sabl_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_performance.sh b/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_performance.sh index d9924dd8..a9d6a713 100644 --- a/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_performance.sh +++ b/models/cv/object_detection/sabl/igie/scripts/infer_sabl_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="sabl_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/ssd/igie/build_engine.py b/models/cv/object_detection/ssd/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/object_detection/ssd/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_accuracy.sh b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_accuracy.sh index 53390708..1ab82ec9 100644 --- a/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_accuracy.sh +++ b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="ssd_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,300,300 \ --precision fp16 \ diff --git a/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_performance.sh b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_performance.sh index 1b9313da..58af853e 100644 --- a/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_performance.sh +++ b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="ssd_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,300,300 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolof/igie/build_engine.py b/models/cv/object_detection/yolof/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/object_detection/yolof/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_accuracy.sh b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_accuracy.sh index f82dae93..90e4abb7 100644 --- a/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_accuracy.sh +++ b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolof_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_performance.sh b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_performance.sh index db96214c..ce06cfe3 100644 --- a/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_performance.sh +++ b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolof_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,800,800 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov10/igie/build_engine.py b/models/cv/object_detection/yolov10/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov10/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_accuracy.sh b/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_accuracy.sh index 2b069afa..b9d4b646 100644 --- a/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov10s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_performance.sh b/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_performance.sh index 4f4b997c..52c44c67 100644 --- a/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_performance.sh +++ b/models/cv/object_detection/yolov10/igie/scripts/infer_yolov10_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov10s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov11/igie/build_engine.py b/models/cv/object_detection/yolov11/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov11/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_accuracy.sh b/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_accuracy.sh index deb0041d..d6df67a4 100644 --- a/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolo11n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_performance.sh b/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_performance.sh index fe7b5781..233e5814 100644 --- a/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_performance.sh +++ b/models/cv/object_detection/yolov11/igie/scripts/infer_yolov11_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolo11n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov12/igie/build_engine.py b/models/cv/object_detection/yolov12/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/object_detection/yolov12/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_accuracy.sh b/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_accuracy.sh index 14656322..d562e374 100644 --- a/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov12n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_performance.sh b/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_performance.sh index cd954ed2..48c64c69 100644 --- a/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_performance.sh +++ b/models/cv/object_detection/yolov12/igie/scripts/infer_yolov12_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov12n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov13/igie/build_engine.py b/models/cv/object_detection/yolov13/igie/build_engine.py deleted file mode 100644 index 54aa8847..00000000 --- a/models/cv/object_detection/yolov13/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_accuracy.sh b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_accuracy.sh index cefdf94b..d1cbb01b 100644 --- a/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov13n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_performance.sh b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_performance.sh index 867d432f..bc8df7b0 100644 --- a/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_performance.sh +++ b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov13n.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov3/igie/build_engine.py b/models/cv/object_detection/yolov3/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov3/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_accuracy.sh b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_accuracy.sh index 583caaec..3ae8c1ba 100644 --- a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov3_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_performance.sh b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_performance.sh index 0d4e36d1..3cb84b32 100644 --- a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_performance.sh +++ b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov3_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_accuracy.sh b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_accuracy.sh index 4fc4a9df..9226497a 100644 --- a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_accuracy.sh +++ b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_accuracy.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_performance.sh b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_performance.sh index 3e11a463..a7f4a1f4 100644 --- a/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_performance.sh +++ b/models/cv/object_detection/yolov3/igie/scripts/infer_yolov3_int8_performance.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov4/igie/build_engine.py b/models/cv/object_detection/yolov4/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov4/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_accuracy.sh b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_accuracy.sh index 90c3fe1e..a6943b5b 100644 --- a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov4_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,608,608 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_performance.sh b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_performance.sh index c99069c1..990efa6d 100644 --- a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_performance.sh +++ b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov4_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,608,608 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_accuracy.sh b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_accuracy.sh index 07c0bfdc..fb5c2885 100644 --- a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_accuracy.sh +++ b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_accuracy.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,608,608 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_performance.sh b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_performance.sh index e7d422ec..ad66b652 100644 --- a/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_performance.sh +++ b/models/cv/object_detection/yolov4/igie/scripts/infer_yolov4_int8_performance.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,608,608 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov5/igie/build_engine.py b/models/cv/object_detection/yolov5/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov5/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_accuracy.sh b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_accuracy.sh index 9060f45d..4a54747d 100644 --- a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov5m_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_performance.sh b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_performance.sh index 7711b60d..7ca10aef 100644 --- a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_performance.sh +++ b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov5m_opt.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_accuracy.sh b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_accuracy.sh index 2465d4ff..7aefa039 100644 --- a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_accuracy.sh +++ b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_accuracy.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_performance.sh b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_performance.sh index e73a0356..07d5a63a 100644 --- a/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_performance.sh +++ b/models/cv/object_detection/yolov5/igie/scripts/infer_yolov5_int8_performance.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov6/igie/build_engine.py b/models/cv/object_detection/yolov6/igie/build_engine.py deleted file mode 100644 index 41206472..00000000 --- a/models/cv/object_detection/yolov6/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision, required_pass={'MutatePadMod'}) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_accuracy.sh b/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_accuracy.sh index cd3bdc6a..4d1e794c 100644 --- a/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov6s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_performance.sh b/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_performance.sh index 150bda88..c797bee2 100644 --- a/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_performance.sh +++ b/models/cv/object_detection/yolov6/igie/scripts/infer_yolov6_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov6s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov7/igie/build_engine.py b/models/cv/object_detection/yolov7/igie/build_engine.py deleted file mode 100644 index 41206472..00000000 --- a/models/cv/object_detection/yolov7/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision, required_pass={'MutatePadMod'}) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_accuracy.sh b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_accuracy.sh index ce8a1981..1fc7965e 100644 --- a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov7.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_performance.sh b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_performance.sh index 43f462de..58592304 100644 --- a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_performance.sh +++ b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov7.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_accuracy.sh b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_accuracy.sh index 1445431c..c9385562 100644 --- a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_accuracy.sh +++ b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_accuracy.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input images:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_performance.sh b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_performance.sh index 8be08abb..e62918de 100644 --- a/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_performance.sh +++ b/models/cv/object_detection/yolov7/igie/scripts/infer_yolov7_int8_performance.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input images:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov8/igie/build_engine.py b/models/cv/object_detection/yolov8/igie/build_engine.py deleted file mode 100644 index 505e75fe..00000000 --- a/models/cv/object_detection/yolov8/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision, required_pass={"MutatePadMode"}) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_accuracy.sh b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_accuracy.sh index d7cf7da3..09d419a2 100644 --- a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov8s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_performance.sh b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_performance.sh index 83d62e50..ac130a43 100644 --- a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_performance.sh +++ b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov8s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_accuracy.sh b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_accuracy.sh index 0f22ce4e..879dabd2 100644 --- a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_accuracy.sh +++ b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_accuracy.sh @@ -30,7 +30,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input images:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_performance.sh b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_performance.sh index 25d9b421..a966d9bd 100644 --- a/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_performance.sh +++ b/models/cv/object_detection/yolov8/igie/scripts/infer_yolov8_int8_performance.sh @@ -30,7 +30,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input images:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolov9/igie/build_engine.py b/models/cv/object_detection/yolov9/igie/build_engine.py deleted file mode 100644 index d3626ae7..00000000 --- a/models/cv/object_detection/yolov9/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_accuracy.sh b/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_accuracy.sh index 2158b3bc..44bb63ca 100644 --- a/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_accuracy.sh +++ b/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolov9s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_performance.sh b/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_performance.sh index 59640316..c35c79ae 100644 --- a/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_performance.sh +++ b/models/cv/object_detection/yolov9/igie/scripts/infer_yolov9_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolov9s.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input images:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolox/igie/build_engine.py b/models/cv/object_detection/yolox/igie/build_engine.py deleted file mode 100644 index 41206472..00000000 --- a/models/cv/object_detection/yolox/igie/build_engine.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2024, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import tvm -import argparse -from tvm import relay -from tvm.relay.import_model import import_model_to_igie - -def parse_args(): - parser = argparse.ArgumentParser() - - parser.add_argument("--model_path", - type=str, - required=True, - help="original model path.") - - parser.add_argument("--engine_path", - type=str, - required=True, - help="igie export engine path.") - - parser.add_argument("--input", - type=str, - required=True, - help=""" - input info of the model, format should be: - input_name:input_shape - eg: --input input:1,3,224,224. - """) - - parser.add_argument("--precision", - type=str, - choices=["fp32", "fp16", "int8"], - required=True, - help="model inference precision.") - - args = parser.parse_args() - - return args - -def main(): - args = parse_args() - - # get input valueinfo - input_name, input_shape = args.input.split(":") - shape = tuple([int(s) for s in input_shape.split(",")]) - input_dict = {input_name: shape} - - target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") - - mod, params = import_model_to_igie(args.model_path, input_dict, backend="igie") - - # build engine - lib = tvm.relay.build(mod, target=target, params=params, precision=args.precision, required_pass={'MutatePadMod'}) - - # export engine - lib.export_library(args.engine_path) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_accuracy.sh b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_accuracy.sh index 0d387c30..b685a8d2 100644 --- a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_accuracy.sh +++ b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_accuracy.sh @@ -20,7 +20,7 @@ model_path="yolox.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_performance.sh b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_performance.sh index 985326ac..e95a1fbd 100644 --- a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_performance.sh +++ b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_fp16_performance.sh @@ -20,7 +20,7 @@ model_path="yolox.onnx" datasets_path=${DATASETS_DIR} # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${model_path} \ --input input:${batchsize},3,640,640 \ --precision fp16 \ diff --git a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_accuracy.sh b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_accuracy.sh index d0d92cab..f98c3146 100644 --- a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_accuracy.sh +++ b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_accuracy.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_performance.sh b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_performance.sh index 82ceab0d..05418709 100644 --- a/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_performance.sh +++ b/models/cv/object_detection/yolox/igie/scripts/infer_yolox_int8_performance.sh @@ -29,7 +29,7 @@ if [ ! -e $quantized_model_path ]; then fi # build engine -python3 build_engine.py \ +python3 ../../igie_common/build_engine.py \ --model_path ${quantized_model_path} \ --input input:${batchsize},3,640,640 \ --precision int8 \ diff --git a/models/cv/ocr/kie_layoutxlm/igie/build_engine.py b/models/cv/ocr/kie_layoutxlm/igie/build_engine.py index cf27aa83..b797b873 100644 --- a/models/cv/ocr/kie_layoutxlm/igie/build_engine.py +++ b/models/cv/ocr/kie_layoutxlm/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -53,6 +54,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_dict = {} diff --git a/models/cv/ocr/svtr/igie/build_engine.py b/models/cv/ocr/svtr/igie/build_engine.py index cf27aa83..b797b873 100644 --- a/models/cv/ocr/svtr/igie/build_engine.py +++ b/models/cv/ocr/svtr/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -53,6 +54,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_dict = {} diff --git a/models/cv/pose_estimation/hrnetpose/igie/build_engine.py b/models/cv/pose_estimation/hrnetpose/igie/build_engine.py index d3626ae7..8b554afa 100644 --- a/models/cv/pose_estimation/hrnetpose/igie/build_engine.py +++ b/models/cv/pose_estimation/hrnetpose/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +53,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_name, input_shape = args.input.split(":") diff --git a/models/cv/pose_estimation/rtmpose/igie/build_engine.py b/models/cv/pose_estimation/rtmpose/igie/build_engine.py index d3626ae7..8b554afa 100644 --- a/models/cv/pose_estimation/rtmpose/igie/build_engine.py +++ b/models/cv/pose_estimation/rtmpose/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +53,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_name, input_shape = args.input.split(":") diff --git a/models/cv/semantic_segmentation/unet/igie/build_engine.py b/models/cv/semantic_segmentation/unet/igie/build_engine.py index 54aa8847..41e9ce4c 100644 --- a/models/cv/semantic_segmentation/unet/igie/build_engine.py +++ b/models/cv/semantic_segmentation/unet/igie/build_engine.py @@ -17,6 +17,7 @@ import tvm import argparse from tvm import relay from tvm.relay.import_model import import_model_to_igie +import os def parse_args(): parser = argparse.ArgumentParser() @@ -52,6 +53,8 @@ def parse_args(): def main(): args = parse_args() + if os.path.exists(args.engine_path): + return # get input valueinfo input_name, input_shape = args.input.split(":") -- Gitee