diff --git a/models/cv/classification/clip/igie/build_engine.py b/models/cv/classification/clip/igie/build_engine.py index 85182c2f2fa6c9f2aeda8e495dce4023e9a3aabc..46e09ff4a1fdfc67989edfa000b2de9fad48b856 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 bfb215ebd935a2fe77b40e7f7fae34edb1a87ada..863980b058348825d5366e14638b25f9df9d7b2a 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 43f730a0b2e11e2c993c43a07815b8dd300f3abc..2294e02ed170c1b54757d0cf1c2cf859bd4994e6 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..8874dc7be9439094cffd3b0ee549ecdc311d5866 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 55352553e66d108932600c49e135944faad7e911..c513584e01b8acde935ff800e2f4ec80f677d04c 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 f79aafc1818b77b090fa0f6551895c2750545812..0aca584c2b72ab0f9a3f67fc6eca623780983872 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 25ec7186b293b25bc0a9278e82a44b11c323764c..53b726b8ba04c9b15908524e21d54bb9018a9a1c 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 b832c6c62f26ee1ed3e36079b814e90ab0f02fef..286aaee0a302006ee0f58b48ee7b444daaabaeb0 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 8bb8ab47171fbd78b8ac2417bc02749f6303279a..00ee8218d9e6584192781b3feb3ea7b0b0758be7 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 427c05be1cdbe3513d06f9b338097f27c4883b9d..e82f4dda342e258331ff57db95844588a5ba18ab 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 4cbf2e219fedc328952032df267df0e6163dcf35..ad07c1c99a87afa50b86c1b23ddc172df4e559eb 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 1d3c6955d488ae0c21914b1c8cfbd59c21ad04c8..84880a20f3e98118bb14fc8d80e1064925d45339 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 c09f2c330d0b1880ae3453c2880cbd63bd07350b..05b7a28379634a69c6c75e18f2311a7d1f357ea1 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 8f358c38f286b2725a8cc1738451a85ecad11d3d..66d7c190361a6c28cd672d975c7a6cbacdf8c5a3 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 511ac21cf35ad3ad0c7c1b14e83e1fecfac25f99..319a20742a921bcfc90c281e541e5f35e47ef2c4 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 76d692a118696286c8402fb94a54f21276c1d3d0..20613487adc2101ca63e0e2496e2ae439c6d3fd3 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 94bd0b406f0fe03ab33a040e544771da5322bb89..360baf13907af85bc02cf06bbf6c14c80df0566c 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 cb8f93aa049143ebdef57db7a8b17a310e8b91d4..4cb255e491f4827c097b87f3cb57a131fa332151 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 63f8d669ca4276b1890066487a11876bcfa8466d..ee5d2858429093314090a3b1a36649e8e79251e7 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 2cf32f975430772948fc317b655959862bf79203..7e4c9d47f56a3182c2b6606d5474ea999e9799c4 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 d613f2e217ff4967e71f4d6615dbe0aa04760e95..fda5ecf831e49cb07d99f08678e890a2bbcdc2fe 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 ec405bb13f2c41f50b1274248941d3c6f30ca178..f8f9a06fb298937b07173c8e9173bcbd0680ab2b 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..8b554afad12bb8750c01f5c0d75e2d0774d29abb 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 9909aa3015608b168579acb2d813ab98226590ca..eb68cae2416e8c2c5af6914b9bd00b0575e231e6 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 49d54558067971af3088a4185887b9a5e65ab859..e2d2392024afaa393d4eaff3c9cdf82bab7d7454 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 ea43f251a9f1214dbda82062ffd567f382ce2167..b0480eca091cd35c08ec8ff6aa93ba78c1fbaafb 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 e92b1f56279f4607edb95ff8ae5e84072fd8bc62..99f1a0b5c1cf62e6ca8802fde5962811016fc553 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 5c6d5c24019a0ff081b6c0fc4dfcdb5f9bd4f328..c942bc14a41e7bfe77da8a55cb5b7f4b5b27394f 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 fc73c5449e1ba763857752e1d7988bb650b77757..84570845ed315c755ce629792f26e86b98a2b28c 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 c199f8404ec20cbbe52e7de1035e8665b42c47ad..12d5ab4a2a9adf852ca7f1fbf1681886f6d93b40 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 dbf78ee88ff36da819a961e7384025a8f1fabc8b..4f1c3a5c37b6c1309f4bfce86f0a0c690457cd58 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 9b39004db27a7282a51d39ef7c8a026b83c8be01..b5cc4216afb79f9597f324f78d10a8803664f3be 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 d9924dd8d878f28596059ee60fcdbf847e76046c..a9d6a713adc04dc3d7272a60dae1c00b94f8c21e 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 5339070878dfbd0c89999b788f470ec5ea5f7d91..1ab82ec950b50ca2ecc289c460d1faf08956dec1 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 1b9313dafbe9e4c30a0ba23f4546cff3a0dff4c8..58af853ee67ac43ad5eb4c87ecc7c54bc9484c3b 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 f82dae93374f92671aba72e6df2824c67af68dc0..90e4abb787fda5094f6fa4e21f9f651ca6e98dc0 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 db96214c0b32a0fe08e8f2d8d4a84ac77c600ab6..ce06cfe34e914dd86b33794bd01a83fc219d6597 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 2b069afad39105dab12c17c572f1b831fe0503d0..b9d4b6461a2ba6a8b8f2456af51be5b3d60aa922 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 4f4b997c7af043baa8ff0445d19d75c8e456a07c..52c44c679d7f0c1379ae6f230ddbdcb0c327d6c5 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 deb0041df0abe49add045127f3468f5f1e45beff..d6df67a43f6cc7c396c9b758f57b709cecab50d1 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 fe7b578119eb8e130f3e2c958fcbcd92d2a46ba1..233e5814e2efc2bf7360388b49d94235decbad6a 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 1465632242c1ee738b2c8dde684caf91714d0c01..d562e374f6818f87683b48685dbd17504e20cc7b 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 cd954ed20179fae79026eabd29c5f8f41182d743..48c64c6982115604b74adc6abb91ccc20caf40ab 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..0000000000000000000000000000000000000000 --- 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 cefdf94ba89788eccd847c72d912a8cbb6ce8758..d1cbb01b31fd40cfa75ed9ee7a7a45377da1c8c5 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 867d432f931c56762872005f40483f73583a3da1..bc8df7b0ef3490be2ca31dcd307d125166139bad 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 583caaec15ee2f8ef8745bbaa0353df6bd7708a7..3ae8c1ba258a7ba1fee48c076c0e3461356fb579 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 0d4e36d1b187b66fd7ede4b6d5f1472f08dc4904..3cb84b32b9c1e3b434757bf52143b35e559db6b1 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 4fc4a9df60e0d806270c623f2fbfeaf27d1eebb8..9226497aad70cfd1713bc0e53fee04ca80e50264 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 3e11a4637342ef15926489488a875331cd4f1ae9..a7f4a1f465a53585abaf93e32902989b7ef9dde5 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 90c3fe1ec98c36c3dc39a81e3beed7caf3f768a9..a6943b5bc8e39cc15ef150dc9c1ddf180b5cf312 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 c99069c1986a6c0d7ac6b3f3fd8bca0004507c8f..990efa6d138b764472f28d381d007911fea1f23a 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 07c0bfdc6940a6015bb3fec9948d36070086260a..fb5c2885bd06db81b9d75ace139ffcfa34730139 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 e7d422ecd0989d77d9a3d4bd5b26c203a2481246..ad66b6522f172fa4e506b2ce7127d2a45f0d53f5 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 9060f45db0d2e86aabba6e4d4e32eed7f8ae0ada..4a54747daad3872051f44874da05d6cf6e82bd92 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 7711b60d5c86956ffc613fcc4e804ff2093482c1..7ca10aef13fdced0f541a1317b42ccc33bf56004 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 2465d4ff68d21af55e2d2f5f9cd3a6b9623bba8f..7aefa03971b4d4e33b130635f5144616f113e0c6 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 e73a03568abe5c33c50afedb06fe92e63898f729..07d5a63a691333b12a5a9a623c319426077afeec 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 4120647262af34c11f30e4d769021b268beecdda..0000000000000000000000000000000000000000 --- 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 cd3bdc6a897856250e85e6478fdd23b38fcf63da..4d1e794c67700c28b36e996ddb9e0799863801c6 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 150bda88a30caa174e5f5d413d39c282ce3174ad..c797bee29d4239303c4a9138597562b3863b909e 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 4120647262af34c11f30e4d769021b268beecdda..0000000000000000000000000000000000000000 --- 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 ce8a19812b9aa44b54fd9573b9d331ec866bb198..1fc7965e63c01e19dfe873cac55d47359af2cd2c 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 43f462de35e3a1db00c26c66845bd2f13761f7ba..58592304e2bccc53ae4154f09055290d22d9d3c7 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 1445431c93502157a665a1dfd668e4d4494379af..c9385562600129546b422e495e0d8e1c97467250 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 8be08abb66870255917dd1efdf4d08dde50995f4..e62918debc7c3a51377ab19e952e41d4182a21a9 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 505e75fec62de886f1d062715ecef970aa1190b1..0000000000000000000000000000000000000000 --- 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 d7cf7da332a3b1b77981a4e738dd8730db40c054..09d419a2a4dc75832a71d8425c8ca362038b50a8 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 83d62e501e90f6a81f60cabbdf16f014e0f722a8..ac130a4366719f16a99476887bc6aa7b2ec5b9f9 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 0f22ce4e0110bb1e767eb68533c82de08e96bef9..879dabd2f82c4b523b2928364009f262ca2357ae 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 25d9b421947334a457068cc4e920d1895efa1134..a966d9bd1ce16eedc455e8d13dce606cad33d0bd 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..0000000000000000000000000000000000000000 --- 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 2158b3bc3e45d821559f9902b875928e76113711..44bb63ca35fb3f44e4f554646764a38df53c43af 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 596403169a88e507b1c9283eb1f9536d6ceb17f7..c35c79aed42cc61e3313948db82f2c4529c22261 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 4120647262af34c11f30e4d769021b268beecdda..0000000000000000000000000000000000000000 --- 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 0d387c3011e5d8206aa6f55c68597c85503284f8..b685a8d2a5e4e8664cf57aefdd785bc0c50613e8 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 985326ac44184dd7a22acf36f25c7078b64bfd62..e95a1fbd3d92cf5dc60e623422e676e804cf2084 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 d0d92cab2a4a30d10ed18b047a0117b9af60ccb9..f98c31460f3935d9e23f7af66ed8d42941b7bdc6 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 82ceab0d42c607d78d4f7d1617c0bef7b32874be..05418709102f9b62c3cfe3a9e121bef01e1a61b5 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 cf27aa83a8132e4b917664fb4ba7c820f5326b1e..b797b87393cc820a013bcff2e2bb5c3d4c0fe596 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 cf27aa83a8132e4b917664fb4ba7c820f5326b1e..b797b87393cc820a013bcff2e2bb5c3d4c0fe596 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..8b554afad12bb8750c01f5c0d75e2d0774d29abb 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 d3626ae76cc9781d9a01ec3d3e2afbdbca409ff5..8b554afad12bb8750c01f5c0d75e2d0774d29abb 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 54aa8847e5ceafba3f40d44f0e1e280d4740d870..41e9ce4c62826ebf1dada65d88515d1f5486f8b6 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(":")