diff --git a/models/cv/classification/efficientnet_b6/igie/README.md b/models/cv/classification/efficientnet_b6/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6c61c77acb50bdce818052e4a49fdfd480b913f7 --- /dev/null +++ b/models/cv/classification/efficientnet_b6/igie/README.md @@ -0,0 +1,53 @@ +# EfficientNet B6 (IGIE) + +## Model Description + +EfficientNet B6 is a high-performance convolutional neural network model developed by Google, utilizing Compound Scaling to balance the scaling of depth, width, and resolution. It incorporates Inverted Residual Blocks, Squeeze-and-Excitation (SE) modules, and the Swish activation function. EfficientNet-B6 excels in tasks like image classification and object detection. While it requires significant computational resources, its precision and efficiency make it an ideal choice for complex vision tasks. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +|--------|-----------|---------| +| MR-V100| 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name efficientnet_b6 --weight efficientnet_b6_lukemelas-24a108a5.pth --output efficientnet_b6.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_efficientnet_b6_fp16_accuracy.sh +# Performance +bash scripts/infer_efficientnet_b6_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| --------------- | --------- | --------- | -------- | -------- | -------- | +| Efficientnet_b6 | 32 | FP16 | 523.225 | 74.388 | 91.835 | diff --git a/models/cv/classification/efficientnet_b6/igie/ci/prepare.sh b/models/cv/classification/efficientnet_b6/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..475490fb27218a96434dd4d37d35f5cc40663199 --- /dev/null +++ b/models/cv/classification/efficientnet_b6/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name efficientnet_b6 --weight efficientnet_b6_lukemelas-24a108a5.pth --output efficientnet_b6.onnx diff --git a/models/cv/classification/efficientnet_b6/igie/requirements.txt b/models/cv/classification/efficientnet_b6/igie/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e8111264d4bb2c985cdd10c1de3b894d4e50bef --- /dev/null +++ b/models/cv/classification/efficientnet_b6/igie/requirements.txt @@ -0,0 +1,2 @@ +onnx +tqdm diff --git a/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_accuracy.sh b/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..1cfd2f540500d6eae4c5290dfc8a46f930de516f --- /dev/null +++ b/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="efficientnet_b6.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path efficientnet_b6_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine efficientnet_b6_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_performance.sh b/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..c4912ab45f066b3c6328e8359ea3da0ec3c9144e --- /dev/null +++ b/models/cv/classification/efficientnet_b6/igie/scripts/infer_efficientnet_b6_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="efficientnet_b6.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path efficientnet_b6_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine efficientnet_b6_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/mnasnet1_3/igie/README.md b/models/cv/classification/mnasnet1_3/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bdf2502c906d52a184459d04450befeaf4232d6f --- /dev/null +++ b/models/cv/classification/mnasnet1_3/igie/README.md @@ -0,0 +1,53 @@ +# MNASNet1_3 (IGIE) + +## Model Description + +MNASNet1_3 is a lightweight deep learning model optimized through neural architecture search (NAS). It uses Inverted Residual Blocks and a width multiplier of 1.3, balancing efficiency and accuracy. With a simple structure and excellent performance, it is particularly suited for mobile devices and resource-constrained environments. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name mnasnet1_3 --weight mnasnet1_3-a4c69d6f.pth --output mnasnet1_3.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_mnasnet1_3_fp16_accuracy.sh +# Performance +bash scripts/infer_mnasnet1_3_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| ----------------- | --------- | --------- | -------- | -------- | -------- | +| MnasNet1_3 | 32 | FP16 | 4282.213 | 76.054 | 93.244 | diff --git a/models/cv/classification/mnasnet1_3/igie/ci/prepare.sh b/models/cv/classification/mnasnet1_3/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..9d822d9c4d27e72f1629a24e18bcc83b069a7d66 --- /dev/null +++ b/models/cv/classification/mnasnet1_3/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name mnasnet1_3 --weight mnasnet1_3-a4c69d6f.pth --output mnasnet1_3.onnx \ No newline at end of file diff --git a/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_accuracy.sh b/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..bc980afca16e2c142210599849f2aa82f31fb86e --- /dev/null +++ b/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="mnasnet1_3.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path mnasnet1_3_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine mnasnet1_3_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_performance.sh b/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..535d5c9b79c5d16a6bd5a122f9d290de5072c124 --- /dev/null +++ b/models/cv/classification/mnasnet1_3/igie/scripts/infer_mnasnet1_3_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="mnasnet1_3.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path mnasnet1_3_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine mnasnet1_3_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/regnet_x_32gf/igie/README.md b/models/cv/classification/regnet_x_32gf/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bda1f6a1b35834158bb57367f8f0486c2707df36 --- /dev/null +++ b/models/cv/classification/regnet_x_32gf/igie/README.md @@ -0,0 +1,53 @@ +# RegNet_x_32gf (IGIE) + +## Model Description + +RegNet_x_32gf is an efficient convolutional neural network model from Facebook AI's RegNet series, designed to provide flexible and efficient deep learning solutions through a regularized network architecture. The core idea of RegNet is to optimize network performance by designing the distribution rules for network width and depth, replacing traditional manual design. RegNet_x_32gf is a large variant with a computational complexity of 32 GFLOPs, making it suitable for high-performance image classification tasks. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name regnet_x_32gf --weight regnet_x_32gf-9d47f8d0.pth --output regnet_x_32gf.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_regnet_x_32gf_fp16_accuracy.sh +# Performance +bash scripts/infer_regnet_x_32gf_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :------------: | :-------: | :-------: | :-----: | :------: | :------: | +| RegNet_x_32gf | 32 | FP16 | 449.752 | 80.594 | 95.216 | diff --git a/models/cv/classification/regnet_x_32gf/igie/ci/prepare.sh b/models/cv/classification/regnet_x_32gf/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..728b3d0e2d55388563c6061f5ae6f5edf5e58c39 --- /dev/null +++ b/models/cv/classification/regnet_x_32gf/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name regnet_x_32gf --weight regnet_x_32gf-9d47f8d0.pth --output regnet_x_32gf.onnx diff --git a/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_accuracy.sh b/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..5516f47c42d51d6c5b7df89d440c57419ddf8032 --- /dev/null +++ b/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_x_32gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_x_32gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_x_32gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_performance.sh b/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..3dc5fe6394ff84b0dd02e1c4aecc4a23113a1ca7 --- /dev/null +++ b/models/cv/classification/regnet_x_32gf/igie/scripts/infer_regnet_x_32gf_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_x_32gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_x_32gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_x_32gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/regnet_x_400mf/igie/README.md b/models/cv/classification/regnet_x_400mf/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0963ee6dee95d52329c5a1112987e1fb6d83ab68 --- /dev/null +++ b/models/cv/classification/regnet_x_400mf/igie/README.md @@ -0,0 +1,53 @@ +# RegNet_x_400mf (IGIE) + +## Model Description + +RegNet_x_400mf is a lightweight deep learning model designed with a regularized architecture, utilizing Bottleneck Blocks for efficient feature extraction. With lower computational complexity, it is well-suited for mid-scale image classification tasks in resource-constrained environments. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name regnet_x_400mf --weight regnet_x_400mf-adf1edd5.pth --output regnet_x_400mf.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_regnet_x_400mf_fp16_accuracy.sh +# Performance +bash scripts/infer_regnet_x_400mf_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :----: | :----: | :----: | :----: | :----: | :----: | +| RegNet_x_400mf | 32 | FP16 | 7951.452| 72.799 | 90.933 | diff --git a/models/cv/classification/regnet_x_400mf/igie/ci/prepare.sh b/models/cv/classification/regnet_x_400mf/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..b02971d20feeea0001c6118990c017194895a69d --- /dev/null +++ b/models/cv/classification/regnet_x_400mf/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name regnet_x_400mf --weight regnet_x_400mf-adf1edd5.pth --output regnet_x_400mf.onnx \ No newline at end of file diff --git a/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_accuracy.sh b/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..8ae3eae6511ef76a7ece81c86382f4800d999e05 --- /dev/null +++ b/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_x_400mf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_x_400mf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_x_400mf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_performance.sh b/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..0682f981dd4b1e5e381f9ab337cd6cf260d63559 --- /dev/null +++ b/models/cv/classification/regnet_x_400mf/igie/scripts/infer_regnet_x_400mf_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_x_400mf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_x_400mf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_x_400mf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/regnet_y_32gf/igie/README.md b/models/cv/classification/regnet_y_32gf/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0a236b4637ca6edee865a594222131eb734513c7 --- /dev/null +++ b/models/cv/classification/regnet_y_32gf/igie/README.md @@ -0,0 +1,53 @@ +# RegNet_y_32gf (IGIE) + +## Model Description + +RegNet_y_32gf is a variant from Facebook AI's RegNet series, belonging to the RegNet_y sub-series. Compared to the RegNet_x series, the RegNet_y series introduces SE (Squeeze-and-Excitation) modules into the network architecture, further enhancing feature representation capabilities. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name regnet_y_32gf --weight regnet_y_32gf-4dee3f7a.pth --output regnet_y_32gf.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_regnet_y_32gf_fp16_accuracy.sh +# Performance +bash scripts/infer_regnet_y_32gf_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :------------: | :-------: | :-------: | :-----: | :------: | :------: | +| RegNet_y_32gf | 32 | FP16 | 413.726 | 80.832 | 95.321 | diff --git a/models/cv/classification/regnet_y_32gf/igie/ci/prepare.sh b/models/cv/classification/regnet_y_32gf/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..098fabc9420015dacf7765178dc01a8417d42ac5 --- /dev/null +++ b/models/cv/classification/regnet_y_32gf/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name regnet_y_32gf --weight regnet_y_32gf-4dee3f7a.pth --output regnet_y_32gf.onnx diff --git a/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_accuracy.sh b/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..18a6fc9d9b718f0cdbfe8d975a59af0731217415 --- /dev/null +++ b/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_32gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_32gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_32gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_performance.sh b/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1d69f46985f5296376e910e6e31e5487a7e9873 --- /dev/null +++ b/models/cv/classification/regnet_y_32gf/igie/scripts/infer_regnet_y_32gf_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_32gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_32gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_32gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/regnet_y_3_2gf/igie/README.md b/models/cv/classification/regnet_y_3_2gf/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ce6fde6a1efad293be7b07347d5b1dfea9581550 --- /dev/null +++ b/models/cv/classification/regnet_y_3_2gf/igie/README.md @@ -0,0 +1,53 @@ +# RegNet_y_3_2gf (IGIE) + +## Model Description + +RegNet_y_3_2gf is a lightweight deep learning model designed with a regularized architecture, integrating Bottleneck Blocks and SE modules to enhance feature representation. With lower computational complexity, it is well-suited for mid-performance image classification tasks in resource-constrained environments. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name regnet_y_3_2gf --weight regnet_y_3_2gf-b5a9779c.pth --output regnet_y_3_2gf.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_regnet_y_3_2gf_fp16_accuracy.sh +# Performance +bash scripts/infer_regnet_y_3_2gf_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :----: | :----: | :----: | :----: | :----: | :----: | +| RegNet_y_3_2gf | 32 | FP16 | 1548.577| 78.913 | 94.542 | diff --git a/models/cv/classification/regnet_y_3_2gf/igie/ci/prepare.sh b/models/cv/classification/regnet_y_3_2gf/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..6c0752686f3f5886631817051d50ddb4ecd27252 --- /dev/null +++ b/models/cv/classification/regnet_y_3_2gf/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name regnet_y_3_2gf --weight regnet_y_3_2gf-b5a9779c.pth --output regnet_y_3_2gf.onnx \ No newline at end of file diff --git a/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_accuracy.sh b/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..692fb92d44dfab5b8b8fd8c16ce6e0b6b6f0d965 --- /dev/null +++ b/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_3_2gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_3_2gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_3_2gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_performance.sh b/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..0d3905ffb1aff3fe14ad7de5d7bc871d1aef5363 --- /dev/null +++ b/models/cv/classification/regnet_y_3_2gf/igie/scripts/infer_regnet_y_3_2gf_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_3_2gf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_3_2gf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_3_2gf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/regnet_y_400mf/igie/README.md b/models/cv/classification/regnet_y_400mf/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..02bf9c2eb1df4d81bc72fe703fd31cf9d737c00d --- /dev/null +++ b/models/cv/classification/regnet_y_400mf/igie/README.md @@ -0,0 +1,53 @@ +# RegNet_y_400mf (IGIE) + +## Model Description + +RegNet_y_400mf is a lightweight deep learning model designed with a regularized architecture, integrating Bottleneck Blocks and SE modules to enhance feature representation. With lower computational complexity, it is well-suited for mid-scale image classification tasks in resource-constrained environments. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name regnet_y_400mf --weight regnet_y_400mf-c65dace8.pth --output regnet_y_400mf.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_regnet_y_400mf_fp16_accuracy.sh +# Performance +bash scripts/infer_regnet_y_400mf_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :----: | :----: | :----: | :----: | :----: | :----: | +| RegNet_y_400mf | 32 | FP16 | 4111.783| 73.992 | 91.693 | diff --git a/models/cv/classification/regnet_y_400mf/igie/ci/prepare.sh b/models/cv/classification/regnet_y_400mf/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac79cef0260053c8b7de087cb2241f9d8f37027f --- /dev/null +++ b/models/cv/classification/regnet_y_400mf/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name regnet_y_400mf --weight regnet_y_400mf-c65dace8.pth --output regnet_y_400mf.onnx diff --git a/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_accuracy.sh b/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..f943ae6f308335c34a61bd6538fd1b928ed65330 --- /dev/null +++ b/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_400mf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_400mf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_400mf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_performance.sh b/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..0d25f86d13da0805097a596233aeb8ff90326b76 --- /dev/null +++ b/models/cv/classification/regnet_y_400mf/igie/scripts/infer_regnet_y_400mf_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="regnet_y_400mf.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path regnet_y_400mf_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine regnet_y_400mf_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/vgg13/igie/README.md b/models/cv/classification/vgg13/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..700e0aef364a89508ae9cc04129a353423f25dc1 --- /dev/null +++ b/models/cv/classification/vgg13/igie/README.md @@ -0,0 +1,53 @@ +# VGG13 (IGIE) + +## Model Description + +VGG13 is a classic deep convolutional neural network model consisting of 13 convolutional layers and multiple pooling layers. It utilizes 3×3 small convolution kernels to extract image features and completes classification through fully connected layers. Known for its simple structure and high performance, it is well-suited for image classification tasks but requires significant computational resources due to its large parameter size. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name vgg13 --weight vgg13-19584684.pth --output vgg13.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_vgg13_fp16_accuracy.sh +# Performance +bash scripts/infer_vgg13_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :----: | :-------: | :-------: | :-----: | :------: | :------: | +| VGG13 | 32 | FP16 | 2598.51 | 69.894 | 89.233 | diff --git a/models/cv/classification/vgg13/igie/ci/prepare.sh b/models/cv/classification/vgg13/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..d57f4257ced04df44eb7319661954981effa42f3 --- /dev/null +++ b/models/cv/classification/vgg13/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name vgg13 --weight vgg13-19584684.pth --output vgg13.onnx \ No newline at end of file diff --git a/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_accuracy.sh b/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3ae266fc1a8d473e8e5877db6884dbd3fa7b19a --- /dev/null +++ b/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="vgg13.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path vgg13_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine vgg13_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_performance.sh b/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..428deaf7b8412631da119d57b3ab1d12a3e98b17 --- /dev/null +++ b/models/cv/classification/vgg13/igie/scripts/infer_vgg13_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="vgg13.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path vgg13_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine vgg13_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/classification/vgg13_bn/igie/README.md b/models/cv/classification/vgg13_bn/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..81af36df1aa542639333c3936a2733ac5edd6598 --- /dev/null +++ b/models/cv/classification/vgg13_bn/igie/README.md @@ -0,0 +1,53 @@ +# VGG13_BN (IGIE) + +## Model Description + +VGG13_BN is an improved version of VGG13, utilizing 3×3 small convolution kernels for feature extraction and adding Batch Normalization layers after each convolutional and fully connected layer. This significantly enhances training stability and convergence speed. With a simple structure and excellent performance, it is ideal for image classification tasks but requires substantial computational resources. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +pip3 install -r ../../igie_common/requirements.txt +``` + +### Model Conversion + +```bash +python3 ../../igie_common/export.py --model-name vgg13_bn --weight vgg13_bn-abd245e5.pth --output vgg13_bn.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/imagenet_val/ +export RUN_DIR=../../igie_common/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_vgg13_bn_fp16_accuracy.sh +# Performance +bash scripts/infer_vgg13_bn_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | Top-1(%) | Top-5(%) | +| :-------: | :-------: | :-------: | :-----: | :------: | :------: | +| VGG13_BN | 32 | FP16 | 2597.53 | 71.539 | 90.347 | diff --git a/models/cv/classification/vgg13_bn/igie/ci/prepare.sh b/models/cv/classification/vgg13_bn/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..1c18d0017c223352d7b7340478253b73ab046087 --- /dev/null +++ b/models/cv/classification/vgg13_bn/igie/ci/prepare.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# 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. + +set -x + +pip3 install -r ../../igie_common/requirements.txt +python3 ../../igie_common/export.py --model-name vgg13_bn --weight vgg13_bn-abd245e5.pth --output vgg13_bn.onnx \ No newline at end of file diff --git a/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_accuracy.sh b/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_accuracy.sh new file mode 100644 index 0000000000000000000000000000000000000000..5d5abe782fdb9ea04e523b2c01baae500ed316e3 --- /dev/null +++ b/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="vgg13_bn.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path vgg13_bn_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine vgg13_bn_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ No newline at end of file diff --git a/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_performance.sh b/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_performance.sh new file mode 100644 index 0000000000000000000000000000000000000000..a45d6cceb0cf1e53d22b8a9c59bec017c4db516e --- /dev/null +++ b/models/cv/classification/vgg13_bn/igie/scripts/infer_vgg13_bn_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="vgg13_bn.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 ${RUN_DIR}build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,224,224 \ + --precision fp16 \ + --engine_path vgg13_bn_bs_${batchsize}_fp16.so + + +# inference +python3 ${RUN_DIR}inference.py \ + --engine vgg13_bn_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/object_detection/ssd/igie/README.md b/models/cv/object_detection/ssd/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..388064446e057c621f68a254e27b5aa47fc8cc2d --- /dev/null +++ b/models/cv/object_detection/ssd/igie/README.md @@ -0,0 +1,66 @@ +# SSD (IGIE) + +## Model Description + +SSD is a single convolutional neural network-based object detection model that utilizes multi-scale feature maps and default box designs to perform classification and regression simultaneously. With an efficient structure, it achieves real-time object detection and is suitable for handling objects of various sizes. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +# Install libGL +## CentOS +yum install -y mesa-libGL +## Ubuntu +apt install -y libgl1-mesa-glx + +pip3 install -r requirements.txt +``` + +### Model Conversion + +```bash +# export onnx model +python3 export.py --weight ssd300_coco_20210803_015428-d231a06e.pth --cfg ssd300_coco.py --output ssd.onnx + +# use onnxsim optimize onnx model +onnxsim ssd.onnx ssd_opt.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/coco/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_ssd_fp16_accuracy.sh +# Performance +bash scripts/infer_ssd_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | IOU@0.5 | IOU@0.5:0.95 | +| :----:| :-------: | :-------: | :----: | :-----: | :----------: | +| SSD | 32 | FP16 | 783.83 | 0.436 | 0.255 | + +## References + +- [mmdetection](https://github.com/open-mmlab/mmdetection.git) diff --git a/models/cv/object_detection/ssd/igie/build_engine.py b/models/cv/object_detection/ssd/igie/build_engine.py new file mode 100644 index 0000000000000000000000000000000000000000..54aa8847e5ceafba3f40d44f0e1e280d4740d870 --- /dev/null +++ b/models/cv/object_detection/ssd/igie/build_engine.py @@ -0,0 +1,73 @@ +# 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/ci/prepare.sh b/models/cv/object_detection/ssd/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2659a469675310ceaea1b7d99b996041957abda --- /dev/null +++ b/models/cv/object_detection/ssd/igie/ci/prepare.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# 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. + +set -x + +ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') +if [[ ${ID} == "ubuntu" ]]; then + apt install -y libgl1-mesa-glx +elif [[ ${ID} == "centos" ]]; then + yum install -y mesa-libGL +else + echo "Not Support Os" +fi + +pip3 install -r requirements.txt + +# export onnx model +python3 export.py --weight ssd300_coco_20210803_015428-d231a06e.pth --cfg ssd300_coco.py --output ssd.onnx + +# use onnxsim optimize onnx model +onnxsim ssd.onnx ssd_opt.onnx \ No newline at end of file diff --git a/models/cv/object_detection/ssd/igie/deploy_default.py b/models/cv/object_detection/ssd/igie/deploy_default.py new file mode 100644 index 0000000000000000000000000000000000000000..e6c4d46abafaf80eac32f3fd8a2b68e245d8fe01 --- /dev/null +++ b/models/cv/object_detection/ssd/igie/deploy_default.py @@ -0,0 +1,41 @@ +# 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. + +onnx_config = dict( + type='onnx', + export_params=True, + keep_initializers_as_inputs=False, + opset_version=11, + save_file='end2end.onnx', + input_names=['input'], + output_names=['output'], + input_shape=None, + optimize=True) + +codebase_config = dict( + type='mmdet', + task='ObjectDetection', + model_type='end2end', + post_processing=dict( + score_threshold=0.05, + confidence_threshold=0.005, + iou_threshold=0.5, + max_output_boxes_per_class=200, + pre_top_k=5000, + keep_top_k=100, + background_label_id=-1, + )) + +backend_config = dict(type='onnxruntime') \ No newline at end of file diff --git a/models/cv/object_detection/ssd/igie/export.py b/models/cv/object_detection/ssd/igie/export.py new file mode 100644 index 0000000000000000000000000000000000000000..9235cbd57593de6f497171910a9b7fe37902bccd --- /dev/null +++ b/models/cv/object_detection/ssd/igie/export.py @@ -0,0 +1,72 @@ +# 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 argparse + +import torch +from mmdeploy.utils import load_config +from mmdeploy.apis import build_task_processor + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--weight", + type=str, + required=True, + help="pytorch model weight.") + + parser.add_argument("--cfg", + type=str, + required=True, + help="model config file.") + + parser.add_argument("--output", + type=str, + required=True, + help="export onnx model path.") + + args = parser.parse_args() + return args + +def main(): + args = parse_args() + + deploy_cfg = 'deploy_default.py' + model_cfg = args.cfg + model_checkpoint = args.weight + + deploy_cfg, model_cfg = load_config(deploy_cfg, model_cfg) + + task_processor = build_task_processor(model_cfg, deploy_cfg, device='cpu') + + model = task_processor.build_pytorch_model(model_checkpoint) + + input_names = ['input'] + dynamic_axes = {'input': {0: '-1'}} + dummy_input = torch.randn(1, 3, 300, 300) + + torch.onnx.export( + model, + dummy_input, + args.output, + input_names = input_names, + dynamic_axes = dynamic_axes, + opset_version=13 + ) + + print("Export onnx model successfully! ") + +if __name__ == '__main__': + main() diff --git a/models/cv/object_detection/ssd/igie/inference.py b/models/cv/object_detection/ssd/igie/inference.py new file mode 100644 index 0000000000000000000000000000000000000000..fde452d08cb6e8f1d37d4de7605ca9aa7fecd48e --- /dev/null +++ b/models/cv/object_detection/ssd/igie/inference.py @@ -0,0 +1,158 @@ +# 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 os +import argparse +import tvm +import torch +import numpy as np +from tvm import relay +from tqdm import tqdm +from mmdet.registry import RUNNERS +from mmengine.config import Config + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--engine", + type=str, + required=True, + help="igie engine path.") + + parser.add_argument("--batchsize", + type=int, + required=True, + help="inference batch size.") + + parser.add_argument("--datasets", + type=str, + required=True, + help="datasets path.") + + parser.add_argument("--input_name", + type=str, + required=True, + help="input name of the model.") + + parser.add_argument("--warmup", + type=int, + default=3, + help="number of warmup before test.") + + parser.add_argument("--acc_target", + type=float, + default=None, + help="Model inference Accuracy target.") + + parser.add_argument("--fps_target", + type=float, + default=None, + help="Model inference FPS target.") + + parser.add_argument("--perf_only", + type=bool, + default=False, + help="Run performance test only") + + args = parser.parse_args() + + return args + +def main(): + args = parse_args() + + batch_size = args.batchsize + + # create iluvatar target & device + target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") + device = tvm.device(target.kind.name, 0) + + # load engine + lib = tvm.runtime.load_module(args.engine) + + # create runtime from engine + module = tvm.contrib.graph_executor.GraphModule(lib["default"](device)) + + # just run perf test + if args.perf_only: + ftimer = module.module.time_evaluator("run", device, number=100, repeat=1) + prof_res = np.array(ftimer().results) * 1000 + fps = batch_size * 1000 / np.mean(prof_res) + print(f"\n* Mean inference time: {np.mean(prof_res):.3f} ms, Mean fps: {fps:.3f}") + else: + # warm up + for _ in range(args.warmup): + module.run() + + # runner config + cfg = Config.fromfile("ssd300_coco.py") + + cfg.work_dir = "./workspace" + cfg['test_dataloader']['batch_size'] = batch_size + cfg['test_dataloader']['dataset']['data_root'] = args.datasets + cfg['test_dataloader']['dataset']['data_prefix']['img'] = 'images/val2017/' + cfg['test_evaluator']['ann_file'] = os.path.join(args.datasets, 'annotations/instances_val2017.json') + cfg['log_level'] = 'ERROR' + + # build runner + runner = RUNNERS.build(cfg) + setattr(runner.model.bbox_head, 'loss_cls', None) + + for data in tqdm(runner.test_dataloader): + cls_score = [] + box_reg = [] + + input_data = runner.model.data_preprocessor(data, False) + image = input_data['inputs'].cpu() + pad_batch = len(image) != batch_size + + if pad_batch: + origin_size = len(image) + image = np.resize(image, (batch_size, *image.shape[1:])) + + module.set_input("input", tvm.nd.array(image, device)) + + module.run() + + for i in range(module.get_num_outputs()): + output = module.get_output(i).asnumpy() + + if pad_batch: + output = output[:origin_size] + + output = torch.from_numpy(output) + + if i < module.get_num_outputs() / 2: + cls_score.append(output) + else: + box_reg.append(output) + + batch_img_metas = [ + data_samples.metainfo for data_samples in data['data_samples'] + ] + + preds = runner.model.bbox_head.predict_by_feat( + cls_score, box_reg, batch_img_metas=batch_img_metas, rescale=True + ) + + batch_data_samples = runner.model.add_pred_to_datasample(input_data['data_samples'], preds) + + runner.test_evaluator.process(data_samples=batch_data_samples, data_batch=data) + + metrics = runner.test_evaluator.evaluate(len(runner.test_dataloader.dataset)) + + +if __name__ == "__main__": + main() diff --git a/models/cv/object_detection/ssd/igie/requirements.txt b/models/cv/object_detection/ssd/igie/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b3fff4aa66c7401a67b2874e40c3caf154a34d --- /dev/null +++ b/models/cv/object_detection/ssd/igie/requirements.txt @@ -0,0 +1,6 @@ +onnx +tqdm +onnxsim +mmdet==3.3.0 +mmdeploy==1.3.1 +mmengine==0.10.4 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 new file mode 100644 index 0000000000000000000000000000000000000000..5339070878dfbd0c89999b788f470ec5ea5f7d91 --- /dev/null +++ b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="ssd_opt.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,300,300 \ + --precision fp16 \ + --engine_path ssd_opt_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine ssd_opt_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} 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 new file mode 100644 index 0000000000000000000000000000000000000000..1b9313dafbe9e4c30a0ba23f4546cff3a0dff4c8 --- /dev/null +++ b/models/cv/object_detection/ssd/igie/scripts/infer_ssd_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="ssd_opt.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,300,300 \ + --precision fp16 \ + --engine_path ssd_opt_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine ssd_opt_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True diff --git a/models/cv/object_detection/ssd/igie/ssd300_coco.py b/models/cv/object_detection/ssd/igie/ssd300_coco.py new file mode 100644 index 0000000000000000000000000000000000000000..a2d4bd81aacbb5c8b6c4cd85e63d017bc3bf91ce --- /dev/null +++ b/models/cv/object_detection/ssd/igie/ssd300_coco.py @@ -0,0 +1,407 @@ +# 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. +# +auto_scale_lr = dict(base_batch_size=64, enable=False) +backend_args = None +cudnn_benchmark = True +custom_hooks = [ + dict(type='NumClassCheckHook'), + dict(interval=50, priority='VERY_LOW', type='CheckInvalidLossHook'), +] +data_root = 'data/coco/' +dataset_type = 'CocoDataset' +default_hooks = dict( + checkpoint=dict(interval=1, type='CheckpointHook'), + logger=dict(interval=50, type='LoggerHook'), + param_scheduler=dict(type='ParamSchedulerHook'), + sampler_seed=dict(type='DistSamplerSeedHook'), + timer=dict(type='IterTimerHook'), + visualization=dict(type='DetVisualizationHook')) +default_scope = 'mmdet' +env_cfg = dict( + cudnn_benchmark=False, + dist_cfg=dict(backend='nccl'), + mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0)) +input_size = 300 +load_from = None +log_level = 'ERROR' +log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50) +model = dict( + backbone=dict( + ceil_mode=True, + depth=16, + init_cfg=dict( + checkpoint='open-mmlab://vgg16_caffe', type='Pretrained'), + out_feature_indices=( + 22, + 34, + ), + out_indices=( + 3, + 4, + ), + type='SSDVGG', + with_last_pool=False), + bbox_head=dict( + anchor_generator=dict( + basesize_ratio_range=( + 0.15, + 0.9, + ), + input_size=300, + ratios=[ + [ + 2, + ], + [ + 2, + 3, + ], + [ + 2, + 3, + ], + [ + 2, + 3, + ], + [ + 2, + ], + [ + 2, + ], + ], + scale_major=False, + strides=[ + 8, + 16, + 32, + 64, + 100, + 300, + ], + type='SSDAnchorGenerator'), + bbox_coder=dict( + target_means=[ + 0.0, + 0.0, + 0.0, + 0.0, + ], + target_stds=[ + 0.1, + 0.1, + 0.2, + 0.2, + ], + type='DeltaXYWHBBoxCoder'), + in_channels=( + 512, + 1024, + 512, + 256, + 256, + 256, + ), + num_classes=80, + type='SSDHead'), + data_preprocessor=dict( + bgr_to_rgb=True, + mean=[ + 123.675, + 116.28, + 103.53, + ], + pad_size_divisor=1, + std=[ + 1, + 1, + 1, + ], + type='DetDataPreprocessor'), + neck=dict( + in_channels=( + 512, + 1024, + ), + l2_norm_scale=20, + level_paddings=( + 1, + 1, + 0, + 0, + ), + level_strides=( + 2, + 2, + 1, + 1, + ), + out_channels=( + 512, + 1024, + 512, + 256, + 256, + 256, + ), + type='SSDNeck'), + test_cfg=dict( + max_per_img=200, + min_bbox_size=0, + nms=dict(iou_threshold=0.45, type='nms'), + nms_pre=1000, + score_thr=0.02), + train_cfg=dict( + allowed_border=-1, + assigner=dict( + gt_max_assign_all=False, + ignore_iof_thr=-1, + min_pos_iou=0.0, + neg_iou_thr=0.5, + pos_iou_thr=0.5, + type='MaxIoUAssigner'), + debug=False, + neg_pos_ratio=3, + pos_weight=-1, + sampler=dict(type='PseudoSampler'), + smoothl1_beta=1.0), + type='SingleStageDetector') +optim_wrapper = dict( + optimizer=dict(lr=0.002, momentum=0.9, type='SGD', weight_decay=0.0005), + type='OptimWrapper') +param_scheduler = [ + dict( + begin=0, by_epoch=False, end=500, start_factor=0.001, type='LinearLR'), + dict( + begin=0, + by_epoch=True, + end=24, + gamma=0.1, + milestones=[ + 16, + 22, + ], + type='MultiStepLR'), +] +resume = False +test_cfg = dict(type='TestLoop') +test_dataloader = dict( + batch_size=32, + dataset=dict( + ann_file='annotations/instances_val2017.json', + backend_args=None, + data_prefix=dict(img='images/val2017/'), + data_root='data/datasets/coco/', + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 300, + 300, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), + ], + test_mode=True, + type='CocoDataset'), + drop_last=False, + num_workers=2, + persistent_workers=True, + sampler=dict(shuffle=False, type='DefaultSampler')) +test_evaluator = dict( + ann_file= + 'data/datasets/coco/annotations/instances_val2017.json', + backend_args=None, + format_only=False, + metric='bbox', + type='CocoMetric') +test_pipeline = [ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 300, + 300, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), +] +train_cfg = dict(max_epochs=24, type='EpochBasedTrainLoop', val_interval=1) +train_dataloader = dict( + batch_sampler=None, + batch_size=8, + dataset=dict( + dataset=dict( + ann_file='annotations/instances_train2017.json', + backend_args=None, + data_prefix=dict(img='train2017/'), + data_root='data/coco/', + filter_cfg=dict(filter_empty_gt=True, min_size=32), + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + mean=[ + 123.675, + 116.28, + 103.53, + ], + ratio_range=( + 1, + 4, + ), + to_rgb=True, + type='Expand'), + dict( + min_crop_size=0.3, + min_ious=( + 0.1, + 0.3, + 0.5, + 0.7, + 0.9, + ), + type='MinIoURandomCrop'), + dict(keep_ratio=False, scale=( + 300, + 300, + ), type='Resize'), + dict(prob=0.5, type='RandomFlip'), + dict( + brightness_delta=32, + contrast_range=( + 0.5, + 1.5, + ), + hue_delta=18, + saturation_range=( + 0.5, + 1.5, + ), + type='PhotoMetricDistortion'), + dict(type='PackDetInputs'), + ], + type='CocoDataset'), + times=5, + type='RepeatDataset'), + num_workers=2, + persistent_workers=True, + sampler=dict(shuffle=True, type='DefaultSampler')) +train_pipeline = [ + dict(backend_args=None, type='LoadImageFromFile'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + mean=[ + 123.675, + 116.28, + 103.53, + ], + ratio_range=( + 1, + 4, + ), + to_rgb=True, + type='Expand'), + dict( + min_crop_size=0.3, + min_ious=( + 0.1, + 0.3, + 0.5, + 0.7, + 0.9, + ), + type='MinIoURandomCrop'), + dict(keep_ratio=False, scale=( + 300, + 300, + ), type='Resize'), + dict(prob=0.5, type='RandomFlip'), + dict( + brightness_delta=32, + contrast_range=( + 0.5, + 1.5, + ), + hue_delta=18, + saturation_range=( + 0.5, + 1.5, + ), + type='PhotoMetricDistortion'), + dict(type='PackDetInputs'), +] +val_cfg = dict(type='ValLoop') +val_dataloader = dict( + batch_size=8, + dataset=dict( + ann_file='annotations/instances_val2017.json', + backend_args=None, + data_prefix=dict(img='val2017/'), + data_root='data/coco/', + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 300, + 300, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), + ], + test_mode=True, + type='CocoDataset'), + drop_last=False, + num_workers=2, + persistent_workers=True, + sampler=dict(shuffle=False, type='DefaultSampler')) +val_evaluator = dict( + ann_file='data/coco/annotations/instances_val2017.json', + backend_args=None, + format_only=False, + metric='bbox', + type='CocoMetric') +vis_backends = [ + dict(type='LocalVisBackend'), +] +visualizer = dict( + name='visualizer', + type='DetLocalVisualizer', + vis_backends=[ + dict(type='LocalVisBackend'), + ]) +work_dir = './workspace' diff --git a/models/cv/object_detection/yolof/igie/README.md b/models/cv/object_detection/yolof/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d07647abf7a1e4efa87c54fe1001b5309c3e65f5 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/README.md @@ -0,0 +1,66 @@ +# YOLOF (IGIE) + +## Model Description + +YOLOF is a lightweight object detection model that focuses on single-level feature maps for detection and enhances feature representation using dilated convolution modules. With a simple and efficient structure, it is well-suited for real-time object detection tasks. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +Dataset: to download the validation dataset. + +### Install Dependencies + +```bash +# Install libGL +## CentOS +yum install -y mesa-libGL +## Ubuntu +apt install -y libgl1-mesa-glx + +pip3 install -r requirements.txt +``` + +### Model Conversion + +```bash +# export onnx model +python3 export.py --weight yolof_r50_c5_8x8_1x_coco_20210425_024427-8e864411.pth --cfg yolof_r50-c5_8xb8-1x_coco.py --output yolof.onnx + +# use onnxsim optimize onnx model +onnxsim yolof.onnx yolof_opt.onnx +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/coco/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_yolof_fp16_accuracy.sh +# Performance +bash scripts/infer_yolof_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | IOU@0.5 | IOU@0.5:0.95 | +| :----:| :-------: | :-------: | :----: | :-----: | :----------: | +| YOLOF | 32 | FP16 | 333.59 | 0.527 | 0.343 | + +## References + +- [mmdetection](https://github.com/open-mmlab/mmdetection.git) diff --git a/models/cv/object_detection/yolof/igie/build_engine.py b/models/cv/object_detection/yolof/igie/build_engine.py new file mode 100644 index 0000000000000000000000000000000000000000..54aa8847e5ceafba3f40d44f0e1e280d4740d870 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/build_engine.py @@ -0,0 +1,73 @@ +# 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/ci/prepare.sh b/models/cv/object_detection/yolof/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..88a50dd4638b12d82ad97d6a090543f921cc125d --- /dev/null +++ b/models/cv/object_detection/yolof/igie/ci/prepare.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# 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. + +set -x + +ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') +if [[ ${ID} == "ubuntu" ]]; then + apt install -y libgl1-mesa-glx +elif [[ ${ID} == "centos" ]]; then + yum install -y mesa-libGL +else + echo "Not Support Os" +fi + +pip3 install -r requirements.txt + +# export onnx model +python3 export.py --weight yolof_r50_c5_8x8_1x_coco_20210425_024427-8e864411.pth --cfg yolof_r50-c5_8xb8-1x_coco.py --output yolof.onnx + +# use onnxsim optimize onnx model +onnxsim yolof.onnx yolof_opt.onnx \ No newline at end of file diff --git a/models/cv/object_detection/yolof/igie/deploy_default.py b/models/cv/object_detection/yolof/igie/deploy_default.py new file mode 100644 index 0000000000000000000000000000000000000000..e6c4d46abafaf80eac32f3fd8a2b68e245d8fe01 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/deploy_default.py @@ -0,0 +1,41 @@ +# 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. + +onnx_config = dict( + type='onnx', + export_params=True, + keep_initializers_as_inputs=False, + opset_version=11, + save_file='end2end.onnx', + input_names=['input'], + output_names=['output'], + input_shape=None, + optimize=True) + +codebase_config = dict( + type='mmdet', + task='ObjectDetection', + model_type='end2end', + post_processing=dict( + score_threshold=0.05, + confidence_threshold=0.005, + iou_threshold=0.5, + max_output_boxes_per_class=200, + pre_top_k=5000, + keep_top_k=100, + background_label_id=-1, + )) + +backend_config = dict(type='onnxruntime') \ No newline at end of file diff --git a/models/cv/object_detection/yolof/igie/export.py b/models/cv/object_detection/yolof/igie/export.py new file mode 100644 index 0000000000000000000000000000000000000000..eed56e0c77e98b6e9a86809b296201b9c07d8c9a --- /dev/null +++ b/models/cv/object_detection/yolof/igie/export.py @@ -0,0 +1,72 @@ +# 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 argparse + +import torch +from mmdeploy.utils import load_config +from mmdeploy.apis import build_task_processor + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--weight", + type=str, + required=True, + help="pytorch model weight.") + + parser.add_argument("--cfg", + type=str, + required=True, + help="model config file.") + + parser.add_argument("--output", + type=str, + required=True, + help="export onnx model path.") + + args = parser.parse_args() + return args + +def main(): + args = parse_args() + + deploy_cfg = 'deploy_default.py' + model_cfg = args.cfg + model_checkpoint = args.weight + + deploy_cfg, model_cfg = load_config(deploy_cfg, model_cfg) + + task_processor = build_task_processor(model_cfg, deploy_cfg, device='cpu') + + model = task_processor.build_pytorch_model(model_checkpoint) + + input_names = ['input'] + dynamic_axes = {'input': {0: '-1'}} + dummy_input = torch.randn(1, 3, 800, 800) + + torch.onnx.export( + model, + dummy_input, + args.output, + input_names = input_names, + dynamic_axes = dynamic_axes, + opset_version=13 + ) + + print("Export onnx model successfully! ") + +if __name__ == '__main__': + main() diff --git a/models/cv/object_detection/yolof/igie/inference.py b/models/cv/object_detection/yolof/igie/inference.py new file mode 100644 index 0000000000000000000000000000000000000000..2351e0d52812c91cf56f1f93e9e63290a9b6dc94 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/inference.py @@ -0,0 +1,158 @@ +# 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 os +import argparse +import tvm +import torch +import numpy as np +from tvm import relay +from tqdm import tqdm +from mmdet.registry import RUNNERS +from mmengine.config import Config + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--engine", + type=str, + required=True, + help="igie engine path.") + + parser.add_argument("--batchsize", + type=int, + required=True, + help="inference batch size.") + + parser.add_argument("--datasets", + type=str, + required=True, + help="datasets path.") + + parser.add_argument("--input_name", + type=str, + required=True, + help="input name of the model.") + + parser.add_argument("--warmup", + type=int, + default=3, + help="number of warmup before test.") + + parser.add_argument("--acc_target", + type=float, + default=None, + help="Model inference Accuracy target.") + + parser.add_argument("--fps_target", + type=float, + default=None, + help="Model inference FPS target.") + + parser.add_argument("--perf_only", + type=bool, + default=False, + help="Run performance test only") + + args = parser.parse_args() + + return args + +def main(): + args = parse_args() + + batch_size = args.batchsize + + # create iluvatar target & device + target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") + device = tvm.device(target.kind.name, 0) + + # load engine + lib = tvm.runtime.load_module(args.engine) + + # create runtime from engine + module = tvm.contrib.graph_executor.GraphModule(lib["default"](device)) + + # just run perf test + if args.perf_only: + ftimer = module.module.time_evaluator("run", device, number=100, repeat=1) + prof_res = np.array(ftimer().results) * 1000 + fps = batch_size * 1000 / np.mean(prof_res) + print(f"\n* Mean inference time: {np.mean(prof_res):.3f} ms, Mean fps: {fps:.3f}") + else: + # warm up + for _ in range(args.warmup): + module.run() + + # runner config + cfg = Config.fromfile("yolof_r50-c5_8xb8-1x_coco.py") + + cfg.work_dir = "./workspace" + cfg['test_dataloader']['batch_size'] = batch_size + cfg['test_dataloader']['dataset']['data_root'] = args.datasets + cfg['test_dataloader']['dataset']['data_prefix']['img'] = 'images/val2017/' + cfg['test_evaluator']['ann_file'] = os.path.join(args.datasets, 'annotations/instances_val2017.json') + cfg['log_level'] = 'ERROR' + + # build runner + runner = RUNNERS.build(cfg) + setattr(runner.model.bbox_head, 'loss_cls', None) + + for data in tqdm(runner.test_dataloader): + cls_score = [] + box_reg = [] + + input_data = runner.model.data_preprocessor(data, False) + image = input_data['inputs'].cpu() + pad_batch = len(image) != batch_size + + if pad_batch: + origin_size = len(image) + image = np.resize(image, (batch_size, *image.shape[1:])) + + module.set_input("input", tvm.nd.array(image, device)) + + module.run() + + for i in range(module.get_num_outputs()): + output = module.get_output(i).asnumpy() + + if pad_batch: + output = output[:origin_size] + + output = torch.from_numpy(output) + + if i < module.get_num_outputs() / 2: + cls_score.append(output) + else: + box_reg.append(output) + + batch_img_metas = [ + data_samples.metainfo for data_samples in data['data_samples'] + ] + + preds = runner.model.bbox_head.predict_by_feat( + cls_score, box_reg, batch_img_metas=batch_img_metas, rescale=True + ) + + batch_data_samples = runner.model.add_pred_to_datasample(input_data['data_samples'], preds) + + runner.test_evaluator.process(data_samples=batch_data_samples, data_batch=data) + + metrics = runner.test_evaluator.evaluate(len(runner.test_dataloader.dataset)) + + +if __name__ == "__main__": + main() diff --git a/models/cv/object_detection/yolof/igie/requirements.txt b/models/cv/object_detection/yolof/igie/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6b3fff4aa66c7401a67b2874e40c3caf154a34d --- /dev/null +++ b/models/cv/object_detection/yolof/igie/requirements.txt @@ -0,0 +1,6 @@ +onnx +tqdm +onnxsim +mmdet==3.3.0 +mmdeploy==1.3.1 +mmengine==0.10.4 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 new file mode 100644 index 0000000000000000000000000000000000000000..f82dae93374f92671aba72e6df2824c67af68dc0 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="yolof_opt.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,800,800 \ + --precision fp16 \ + --engine_path yolof_opt_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine yolof_opt_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} 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 new file mode 100644 index 0000000000000000000000000000000000000000..db96214c0b32a0fe08e8f2d8d4a84ac77c600ab6 --- /dev/null +++ b/models/cv/object_detection/yolof/igie/scripts/infer_yolof_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="yolof_opt.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input input:${batchsize},3,800,800 \ + --precision fp16 \ + --engine_path yolof_opt_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine yolof_opt_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name input \ + --datasets ${datasets_path} \ + --perf_only True diff --git a/models/cv/object_detection/yolof/igie/yolof_r50-c5_8xb8-1x_coco.py b/models/cv/object_detection/yolof/igie/yolof_r50-c5_8xb8-1x_coco.py new file mode 100644 index 0000000000000000000000000000000000000000..3549bbbe1f4610c0419803c82f8972eaafdab8ed --- /dev/null +++ b/models/cv/object_detection/yolof/igie/yolof_r50-c5_8xb8-1x_coco.py @@ -0,0 +1,291 @@ +# 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. +# +auto_scale_lr = dict(base_batch_size=64, enable=False) +backend_args = None +data_root = 'data/coco/' +dataset_type = 'CocoDataset' +default_hooks = dict( + checkpoint=dict(interval=1, type='CheckpointHook'), + logger=dict(interval=50, type='LoggerHook'), + param_scheduler=dict(type='ParamSchedulerHook'), + sampler_seed=dict(type='DistSamplerSeedHook'), + timer=dict(type='IterTimerHook'), + visualization=dict(type='DetVisualizationHook')) +default_scope = 'mmdet' +env_cfg = dict( + cudnn_benchmark=False, + dist_cfg=dict(backend='nccl'), + mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0)) +load_from = None +log_level = 'ERROR' +log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50) +model = dict( + backbone=dict( + depth=50, + frozen_stages=1, + init_cfg=dict( + checkpoint='open-mmlab://detectron/resnet50_caffe', + type='Pretrained'), + norm_cfg=dict(requires_grad=False, type='BN'), + norm_eval=True, + num_stages=4, + out_indices=(3, ), + style='caffe', + type='ResNet'), + bbox_head=dict( + anchor_generator=dict( + ratios=[ + 1.0, + ], + scales=[ + 1, + 2, + 4, + 8, + 16, + ], + strides=[ + 32, + ], + type='AnchorGenerator'), + bbox_coder=dict( + add_ctr_clamp=True, + ctr_clamp=32, + target_means=[ + 0.0, + 0.0, + 0.0, + 0.0, + ], + target_stds=[ + 1.0, + 1.0, + 1.0, + 1.0, + ], + type='DeltaXYWHBBoxCoder'), + in_channels=512, + loss_bbox=dict(loss_weight=1.0, type='GIoULoss'), + loss_cls=dict( + alpha=0.25, + gamma=2.0, + loss_weight=1.0, + type='FocalLoss', + use_sigmoid=True), + num_classes=80, + reg_decoded_bbox=True, + type='YOLOFHead'), + data_preprocessor=dict( + bgr_to_rgb=False, + mean=[ + 103.53, + 116.28, + 123.675, + ], + pad_size_divisor=32, + std=[ + 1.0, + 1.0, + 1.0, + ], + type='DetDataPreprocessor'), + neck=dict( + block_dilations=[ + 2, + 4, + 6, + 8, + ], + block_mid_channels=128, + in_channels=2048, + num_residual_blocks=4, + out_channels=512, + type='DilatedEncoder'), + test_cfg=dict( + max_per_img=100, + min_bbox_size=0, + nms=dict(iou_threshold=0.6, type='nms'), + nms_pre=1000, + score_thr=0.05), + train_cfg=dict( + allowed_border=-1, + assigner=dict( + neg_ignore_thr=0.7, pos_ignore_thr=0.15, type='UniformAssigner'), + debug=False, + pos_weight=-1), + type='YOLOF') +optim_wrapper = dict( + optimizer=dict(lr=0.12, momentum=0.9, type='SGD', weight_decay=0.0001), + paramwise_cfg=dict( + custom_keys=dict(backbone=dict(lr_mult=0.3333333333333333)), + norm_decay_mult=0.0), + type='OptimWrapper') +param_scheduler = [ + dict( + begin=0, + by_epoch=False, + end=1500, + start_factor=0.00066667, + type='LinearLR'), + dict( + begin=0, + by_epoch=True, + end=12, + gamma=0.1, + milestones=[ + 8, + 11, + ], + type='MultiStepLR'), +] +resume = False +test_cfg = dict(type='TestLoop') +test_dataloader = dict( + batch_size=32, + dataset=dict( + ann_file='annotations/instances_val2017.json', + backend_args=None, + data_prefix=dict(img='images/val2017/'), + data_root='data/datasets/coco/', + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 800, + 800, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), + ], + test_mode=True, + type='CocoDataset'), + drop_last=False, + num_workers=2, + persistent_workers=True, + sampler=dict(shuffle=False, type='DefaultSampler')) +test_evaluator = dict( + ann_file='data/datasets/coco/annotations/instances_val2017.json', + backend_args=None, + format_only=False, + metric='bbox', + type='CocoMetric') +test_pipeline = [ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 800, + 800, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), +] +train_cfg = dict(max_epochs=12, type='EpochBasedTrainLoop', val_interval=1) +train_dataloader = dict( + batch_sampler=dict(type='AspectRatioBatchSampler'), + batch_size=8, + dataset=dict( + ann_file='annotations/instances_train2017.json', + backend_args=None, + data_prefix=dict(img='train2017/'), + data_root='data/coco/', + filter_cfg=dict(filter_empty_gt=True, min_size=32), + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(type='LoadAnnotations', with_bbox=True), + dict(keep_ratio=False, scale=( + 800, + 800, + ), type='Resize'), + dict(prob=0.5, type='RandomFlip'), + dict(max_shift_px=32, prob=0.5, type='RandomShift'), + dict(type='PackDetInputs'), + ], + type='CocoDataset'), + num_workers=8, + persistent_workers=True, + sampler=dict(shuffle=True, type='DefaultSampler')) +train_pipeline = [ + dict(backend_args=None, type='LoadImageFromFile'), + dict(type='LoadAnnotations', with_bbox=True), + dict(keep_ratio=False, scale=( + 800, + 800, + ), type='Resize'), + dict(prob=0.5, type='RandomFlip'), + dict(max_shift_px=32, prob=0.5, type='RandomShift'), + dict(type='PackDetInputs'), +] +val_cfg = dict(type='ValLoop') +val_dataloader = dict( + batch_size=1, + dataset=dict( + ann_file='annotations/instances_val2017.json', + backend_args=None, + data_prefix=dict(img='val2017/'), + data_root='data/coco/', + pipeline=[ + dict(backend_args=None, type='LoadImageFromFile'), + dict(keep_ratio=False, scale=( + 800, + 800, + ), type='Resize'), + dict(type='LoadAnnotations', with_bbox=True), + dict( + meta_keys=( + 'img_id', + 'img_path', + 'ori_shape', + 'img_shape', + 'scale_factor', + ), + type='PackDetInputs'), + ], + test_mode=True, + type='CocoDataset'), + drop_last=False, + num_workers=2, + persistent_workers=True, + sampler=dict(shuffle=False, type='DefaultSampler')) +val_evaluator = dict( + ann_file='data/coco/annotations/instances_val2017.json', + backend_args=None, + format_only=False, + metric='bbox', + type='CocoMetric') +vis_backends = [ + dict(type='LocalVisBackend'), +] +visualizer = dict( + name='visualizer', + type='DetLocalVisualizer', + vis_backends=[ + dict(type='LocalVisBackend'), + ]) +work_dir = './workspace' diff --git a/models/cv/object_detection/yolov13/igie/README.md b/models/cv/object_detection/yolov13/igie/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e93042ec7aec07b9cab6a6ad412bccbdd54e21ce --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/README.md @@ -0,0 +1,59 @@ +# YOLOv13 (IGIE) + +## Model Description + +YOLOv13 addresses the detection performance bottlenecks of the traditional YOLO series in complex scenarios through innovative HyperACE and FullPAD mechanisms. Additionally, it incorporates lightweight design to significantly reduce computational complexity and parameter count, making it an accurate and efficient object detection model. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +| :----: | :----: | :----: | +| MR-V100 | 4.3.0 | 25.09 | + +## Model Preparation + +### Prepare Resources + +Pretrained model: + +### Install Dependencies + +```bash +pip3 install -r requirements.txt +``` + +## Model Conversion + +```bash +git clone --depth 1 https://github.com/iMoonLab/yolov13.git +cd yolov13 +pip3 install -e . +cd .. + +python3 export.py --weight yolov13n.pt --batch 32 +``` + +## Model Inference + +```bash +export DATASETS_DIR=/Path/to/coco/ +``` + +### FP16 + +```bash +# Accuracy +bash scripts/infer_yolov13_fp16_accuracy.sh +# Performance +bash scripts/infer_yolov13_fp16_performance.sh +``` + +## Model Results + +| Model | BatchSize | Precision | FPS | IOU@0.5 | IOU@0.5:0.95 | +| ------- | --------- | --------- | ------- | ------- | ------------ | +| YOLOv13 | 32 | FP16 | 400.68 | 0.574 | 0.412 | + +## References + +- [YOLOv13](https://github.com/iMoonLab/yolov13) diff --git a/models/cv/object_detection/yolov13/igie/build_engine.py b/models/cv/object_detection/yolov13/igie/build_engine.py new file mode 100644 index 0000000000000000000000000000000000000000..54aa8847e5ceafba3f40d44f0e1e280d4740d870 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/build_engine.py @@ -0,0 +1,73 @@ +# 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/ci/prepare.sh b/models/cv/object_detection/yolov13/igie/ci/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..a02a6f32a900a00a7d0ffdd34bada9976f2cfac5 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/ci/prepare.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# 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. + +set -x + +ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') +if [[ ${ID} == "ubuntu" ]]; then + apt install -y libgl1-mesa-glx +elif [[ ${ID} == "centos" ]]; then + yum install -y mesa-libGL +else + echo "Not Support Os" +fi + +pip3 install -r requirements.txt + +# git clone --depth 1 https://github.com/iMoonLab/yolov13.git +cp -r /mnt/deepspark/data/repos/yolov13 ./ + +cd yolov13 +pip3 install -e . +cd .. + +python3 export.py --weight yolov13n.pt --batch 32 diff --git a/models/cv/object_detection/yolov13/igie/export.py b/models/cv/object_detection/yolov13/igie/export.py new file mode 100644 index 0000000000000000000000000000000000000000..780b9b2a54d955dc4a417c8e49d75875f962d49e --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/export.py @@ -0,0 +1,43 @@ +# 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 argparse +from ultralytics import YOLO + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--weight", + type=str, + required=True, + help="pytorch model weight.") + + parser.add_argument("--batch", + type=int, + required=True, + help="batchsize of the model.") + args = parser.parse_args() + + return args + +def main(): + args = parse_args() + + model = YOLO(args.weight).cpu() + + model.export(format='onnx', batch=args.batch, imgsz=(640, 640), optimize=True, simplify=True, opset=13) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/models/cv/object_detection/yolov13/igie/inference.py b/models/cv/object_detection/yolov13/igie/inference.py new file mode 100644 index 0000000000000000000000000000000000000000..2286d11ca17fef1032a2437bc3deb8f051508ca8 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/inference.py @@ -0,0 +1,140 @@ +# 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 argparse +import os + +import tvm +from tvm import relay + +import numpy as np +from pathlib import Path +from ultralytics import YOLO +from ultralytics.cfg import get_cfg +from ultralytics.utils import DEFAULT_CFG +from validator import IGIE_Validator + + + +def parse_args(): + parser = argparse.ArgumentParser() + + parser.add_argument("--engine", + type=str, + required=True, + help="igie engine path.") + + parser.add_argument("--batchsize", + type=int, + required=True, + help="inference batch size.") + + parser.add_argument("--datasets", + type=str, + required=True, + help="datasets path.") + + parser.add_argument("--input_name", + type=str, + required=True, + help="input name of the model.") + + parser.add_argument("--warmup", + type=int, + default=3, + help="number of warmup before test.") + + parser.add_argument("--acc_target", + type=float, + default=None, + help="Model inference Accuracy target.") + + parser.add_argument("--fps_target", + type=float, + default=None, + help="Model inference FPS target.") + + parser.add_argument("--perf_only", + type=bool, + default=False, + help="Run performance test only") + + args = parser.parse_args() + + return args + +def main(): + args = parse_args() + + batch_size = args.batchsize + + # create iluvatar target & device + target = tvm.target.iluvatar(model="MR", options="-libs=cudnn,cublas,ixinfer") + device = tvm.device(target.kind.name, 0) + + # load engine + lib = tvm.runtime.load_module(args.engine) + + # create runtime from engine + module = tvm.contrib.graph_executor.GraphModule(lib["default"](device)) + + # just run perf test + if args.perf_only: + ftimer = module.module.time_evaluator("run", device, number=100, repeat=1) + prof_res = np.array(ftimer().results) * 1000 + fps = batch_size * 1000 / np.mean(prof_res) + print(f"\n* Mean inference time: {np.mean(prof_res):.3f} ms, Mean fps: {fps:.3f}") + else: + root_path = args.datasets + val_path = os.path.join(root_path, 'val2017.txt') + + overrides = {} + overrides['mode'] = 'val' + + cfg_args = get_cfg(cfg=DEFAULT_CFG, overrides=overrides) + + cfg_args.batch = args.batchsize + + cfg_args.data = { + 'path': Path(root_path), + 'val': val_path, + 'names': + { + 0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', + 6: 'train', 7: 'truck', 8: 'boat', 9: 'traffic light', 10: 'fire hydrant', + 11: 'stop sign', 12: 'parking meter', 13: 'bench', 14: 'bird', 15: 'cat', + 16: 'dog', 17: 'horse', 18: 'sheep', 19: 'cow', 20: 'elephant', 21: 'bear', + 22: 'zebra', 23: 'giraffe', 24: 'backpack', 25: 'umbrella', 26: 'handbag', + 27: 'tie', 28: 'suitcase', 29: 'frisbee', 30: 'skis', 31: 'snowboard', + 32: 'sports ball', 33: 'kite', 34: 'baseball bat', 35: 'baseball glove', + 36: 'skateboard', 37: 'surfboard', 38: 'tennis racket', 39: 'bottle', + 40: 'wine glass', 41: 'cup', 42: 'fork', 43: 'knife', 44: 'spoon', 45: 'bowl', + 46: 'banana', 47: 'apple', 48: 'sandwich', 49: 'orange', 50: 'broccoli', + 51: 'carrot', 52: 'hot dog', 53: 'pizza', 54: 'donut', 55: 'cake', 56: 'chair', + 57: 'couch', 58: 'potted plant', 59: 'bed', 60: 'dining table', 61: 'toilet', + 62: 'tv', 63: 'laptop', 64: 'mouse', 65: 'remote', 66: 'keyboard', 67: 'cell phone', + 68: 'microwave', 69: 'oven', 70: 'toaster', 71: 'sink', 72: 'refrigerator', 73: 'book', + 74: 'clock', 75: 'vase', 76: 'scissors', 77: 'teddy bear', 78: 'hair drier', 79: 'toothbrush' + }, + 'nc': 80} + cfg_args.save_json = True + + validator = IGIE_Validator(args=cfg_args, save_dir=Path('.')) + validator.stride = 32 + + stats = validator(module, device) + +if __name__ == "__main__": + main() diff --git a/models/cv/object_detection/yolov13/igie/requirements.txt b/models/cv/object_detection/yolov13/igie/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..763d3b6b6d36b3e49917bd4cdafe9b9a76e0dc34 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/requirements.txt @@ -0,0 +1,4 @@ +tqdm +onnx==1.13.0 +huggingface_hub +ultralytics \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..cefdf94ba89788eccd847c72d912a8cbb6ce8758 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_accuracy.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="yolov13n.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input images:${batchsize},3,640,640 \ + --precision fp16 \ + --engine_path yolov13n_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine yolov13n_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name images \ + --datasets ${datasets_path} \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..867d432f931c56762872005f40483f73583a3da1 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/scripts/infer_yolov13_fp16_performance.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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. + +batchsize=32 +model_path="yolov13n.onnx" +datasets_path=${DATASETS_DIR} + +# build engine +python3 build_engine.py \ + --model_path ${model_path} \ + --input images:${batchsize},3,640,640 \ + --precision fp16 \ + --engine_path yolov13n_bs_${batchsize}_fp16.so + + +# inference +python3 inference.py \ + --engine yolov13n_bs_${batchsize}_fp16.so \ + --batchsize ${batchsize} \ + --input_name images \ + --datasets ${datasets_path} \ + --perf_only True \ No newline at end of file diff --git a/models/cv/object_detection/yolov13/igie/validator.py b/models/cv/object_detection/yolov13/igie/validator.py new file mode 100644 index 0000000000000000000000000000000000000000..113693da5ca33b788a24eca888f3a7d820c92fa8 --- /dev/null +++ b/models/cv/object_detection/yolov13/igie/validator.py @@ -0,0 +1,89 @@ +# 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 os +import tvm +import json +import torch +import numpy as np + +from tqdm import tqdm + +from ultralytics.models.yolo.detect import DetectionValidator +from ultralytics.data.utils import check_det_dataset +from ultralytics.utils.metrics import ConfusionMatrix +from ultralytics.data.converter import coco80_to_coco91_class + +class IGIE_Validator(DetectionValidator): + def __call__(self, engine, device): + self.data = self.args.data + self.dataloader = self.get_dataloader(self.data.get(self.args.split), self.args.batch) + self.init_metrics() + + self.stats = {'tp': [], 'conf': [], 'pred_cls': [], 'target_cls': [], 'target_img': []} + + # wram up + for _ in range(3): + engine.run() + + for batch in tqdm(self.dataloader): + batch = self.preprocess(batch) + + imgs = batch['img'] + pad_batch = len(imgs) != self.args.batch + if pad_batch: + origin_size = len(imgs) + imgs = np.resize(imgs, (self.args.batch, *imgs.shape[1:])) + + engine.set_input(0, tvm.nd.array(imgs, device)) + + engine.run() + + outputs = engine.get_output(0).asnumpy() + + if pad_batch: + outputs = outputs[:origin_size] + + outputs = torch.from_numpy(outputs) + + preds = self.postprocess([outputs]) + + self.update_metrics(preds, batch) + + stats = self.get_stats() + + if self.args.save_json and self.jdict: + with open(str(self.save_dir / 'predictions.json'), 'w') as f: + print(f'Saving {f.name} ...') + json.dump(self.jdict, f) # flatten and save + + stats = self.eval_json(stats) + + return stats + + def init_metrics(self): + """Initialize evaluation metrics for YOLO.""" + val = self.data.get(self.args.split, '') # validation path + self.is_coco = isinstance(val, str) and 'coco' in val and val.endswith(f'{os.sep}val2017.txt') # is COCO + self.class_map = coco80_to_coco91_class() if self.is_coco else list(range(1000)) + self.args.save_json |= self.is_coco and not self.training # run on final val if training COCO + self.names = self.data['names'] + self.nc = len(self.names) + self.metrics.names = self.names + self.confusion_matrix = ConfusionMatrix(nc=80) + self.seen = 0 + self.jdict = [] + self.stats = [] + diff --git a/tests/model_info.json b/tests/model_info.json index ab2aa5ffb601e5219556c809827793c369dda7ed..a445277773218d771fef10e2e097805cdd4b0ae3 100644 --- a/tests/model_info.json +++ b/tests/model_info.json @@ -7603,6 +7603,402 @@ "type": "inference", "hasDemo": false, "demoType": "" + }, + { + "display_name": "EfficientNet B6", + "model_name": "efficientnet_b6", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/efficientnet_b6/igie", + "readme_file": "models/cv/classification/efficientnet_b6/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/efficientnet_b6_lukemelas-24a108a5.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "MNASNet1_3", + "model_name": "mnasnet1_3", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/mnasnet1_3/igie", + "readme_file": "models/cv/classification/mnasnet1_3/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/mnasnet1_3-a4c69d6f.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "RegNet_x_32gf", + "model_name": "regnet_x_32gf", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/regnet_x_32gf/igie", + "readme_file": "models/cv/classification/regnet_x_32gf/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/regnet_x_32gf-9d47f8d0.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "RegNet_x_400mf", + "model_name": "regnet_x_400mf", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/regnet_x_400mf/igie", + "readme_file": "models/cv/classification/regnet_x_400mf/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/regnet_x_400mf-adf1edd5.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "RegNet_y_32gf", + "model_name": "regnet_y_32gf", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/regnet_y_32gf/igie", + "readme_file": "models/cv/classification/regnet_y_32gf/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/regnet_y_32gf-4dee3f7a.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "RegNet_y_3_2gf", + "model_name": "regnet_y_3_2gf", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/regnet_y_3_2gf/igie", + "readme_file": "models/cv/classification/regnet_y_3_2gf/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/regnet_y_3_2gf-b5a9779c.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "RegNet_y_400mf", + "model_name": "regnet_y_400mf", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/regnet_y_400mf/igie", + "readme_file": "models/cv/classification/regnet_y_400mf/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/regnet_y_400mf-c65dace8.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "VGG13", + "model_name": "vgg13", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/vgg13/igie", + "readme_file": "models/cv/classification/vgg13/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/vgg13-19584684.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "VGG13_BN", + "model_name": "vgg13_bn", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/classification", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/classification/vgg13_bn/igie", + "readme_file": "models/cv/classification/vgg13_bn/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "imagenet_val", + "download_url": "https://download.pytorch.org/models/vgg13_bn-abd245e5.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "SSD", + "model_name": "ssd", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/object_detection", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/object_detection/ssd/igie", + "readme_file": "models/cv/object_detection/ssd/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "coco", + "download_url": "https://download.openmmlab.com/mmdetection/v2.0/ssd/ssd300_coco/ssd300_coco_20210803_015428-d231a06e.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "YOLOF", + "model_name": "yolof", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/object_detection", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/object_detection/yolof/igie", + "readme_file": "models/cv/object_detection/yolof/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "coco", + "download_url": "https://download.openmmlab.com/mmdetection/v2.0/yolof/yolof_r50_c5_8x8_1x_coco/yolof_r50_c5_8x8_1x_coco_20210425_024427-8e864411.pth", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" + }, + { + "display_name": "YOLOv13", + "model_name": "yolov13", + "framework": "igie", + "release_version": "25.09", + "release_sdk": "4.3.0", + "release_gpgpu": "MR-V100", + "latest_sdk": "", + "latest_gpgpu": "", + "category": "cv/object_detection", + "toolbox": "", + "mdims": "", + "dataset": "", + "license": "", + "model_path": "models/cv/object_detection/yolov13/igie", + "readme_file": "models/cv/object_detection/yolov13/igie/README.md", + "bitbucket_repo": "", + "bitbucket_branch": "", + "bitbucket_path": "", + "develop_owner": "", + "github_repo": "", + "github_branch": "", + "github_path": "", + "datasets": "coco", + "download_url": "https://github.com/iMoonLab/yolov13/releases/download/yolov13/yolov13n.pt", + "need_third_part": false, + "precisions": [ + "fp16" + ], + "type": "inference", + "hasDemo": false, + "demoType": "" } ] } \ No newline at end of file