diff --git a/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README.md index 543cefe4a2cf1cd5feb4bda8fac428e61a5980ef..54340e95b3d98bb15ee328c51c53bf9785daedb4 100644 --- a/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README.md @@ -1,34 +1,34 @@ +中文|[English](README_EN.md) +# Resnet18 TensorFlow离线推理 -# Resnet18 Inference for Tensorflow +此链接提供Resnet18 TensorFlow模型在NPU上离线推理的脚本和方法 -This repository provides a script and recipe to Inference of the Resnet18 model. +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** -## Notice -**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** - -Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 | Conditions | Need | | --- | --- | -| CANN Version | >=5.0.3 | -| Chip Platform| Ascend310/Ascend310P3 | -| 3rd Party Requirements| Please follow the 'requirements.txt' | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | -## Quick Start Guide +## 快速指南 -### 1. Clone the respository +### 1. 拷贝代码 ```shell git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL ``` -### 2. Download and preprocess the dataset +### 2. 下载数据集和预处理 -1. Download the Tiny-ImageNet-200 dataset by yourself. +1. 请自行下载Tiny-ImageNet-200测试数据集 -2. Move **tiny-imagenet-200** to **'scripts/'** +2. 将 **tiny-imagenet-200** 移动到 **'scripts/'**目录下 ``` ———scripts |————tiny-imagenet-200 @@ -39,61 +39,55 @@ cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL |————words.txt ``` -3. Images Preprocess: +3. 图片预处理: ``` cd scripts mkdir input_bins python3 imagenet_tiny_preprocessing.py ``` -The jpegs pictures will be preprocessed to bin fils. +jpeg图片将被预处理成bin文件. -### 3. Offline Inference +### 3. 离线推理 -**Convert pb to om.** +**Pb模型转换为om模型** -- configure the env +- 环境变量设置 - ``` - export install_path=/usr/local/Ascend - export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH - export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH - export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH - export ASCEND_OPP_PATH=${install_path}/opp - ``` - -- convert pb to om + 请参考[说明](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719),设置环境变量 +- Pb模型转换为om模型 - [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet18_tf.pb) + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet18_tf.pb) ``` atc --model=resnet18_tf.pb --framework=3 --output=resnet18_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="test_inputs:1,64,64,3" --log=info --insert_op_conf=resnet18_tf_aipp.cfg --enable_small_channel=1 ``` -- Build the program +- 编译程序 ``` bash build.sh ``` -- Run the program: +- 开始运行: ``` cd scripts bash benchmark_tf.sh ``` -## Performance +## 性能 + +### 结果 -### Result +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 -Our result was obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. +#### 推理精度结果 -#### Inference accuracy results | model | **data** | Top1/Top5 | | :---------------: | :-------: | :-------------: | | offline Inference | 10000 images | 51.0 %/ 76.1% | -## Reference +## 参考 [1] https://github.com/taki0112/ResNet-Tensorflow diff --git a/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README_EN.md new file mode 100644 index 0000000000000000000000000000000000000000..70da7c3bf06a5d3b94dfbd687af30628a02117da --- /dev/null +++ b/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL/README_EN.md @@ -0,0 +1,92 @@ +English|[中文](README.md) + +# Resnet18 Inference for Tensorflow + +This repository provides a script and recipe to Inference of the Resnet18 model. + +## Notice +**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** + +Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. + +| Conditions | Need | +| --- | --- | +| CANN Version | >=5.0.3 | +| Chip Platform| Ascend310/Ascend310P3 | +| 3rd Party Requirements| Please follow the 'requirements.txt' | + +## Quick Start Guide + +### 1. Clone the respository + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet18_for_ACL +``` + +### 2. Download and preprocess the dataset + +1. Download the Tiny-ImageNet-200 dataset by yourself. + +2. Move **tiny-imagenet-200** to **'scripts/'** +``` +———scripts + |————tiny-imagenet-200 + |————test + |————train + |————val + |————wnids.txt + |————words.txt +``` + +3. Images Preprocess: +``` +cd scripts +mkdir input_bins +python3 imagenet_tiny_preprocessing.py +``` +The jpegs pictures will be preprocessed to bin fils. + +### 3. Offline Inference + +**Convert pb to om.** + +- configure the env + + Please follow the [guide](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719) to set the envs +- convert pb to om + + [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet18_tf.pb) + + ``` + atc --model=resnet18_tf.pb --framework=3 --output=resnet18_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="test_inputs:1,64,64,3" --log=info --insert_op_conf=resnet18_tf_aipp.cfg --enable_small_channel=1 + ``` + +- Build the program + + ``` + bash build.sh + ``` + +- Run the program: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + +## Performance + +### Result + +Our result was obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. + +#### Inference accuracy results + +| model | **data** | Top1/Top5 | +| :---------------: | :-------: | :-------------: | +| offline Inference | 10000 images | 51.0 %/ 76.1% | + + +## Reference +[1] https://github.com/taki0112/ResNet-Tensorflow diff --git a/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README.md b/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README.md index 50e3736a87a6560131282f5d2aebfa711c98b582..51c9887ea2d1ee3c7c48ad4b2a7847e4d0ef7d45 100644 --- a/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README.md +++ b/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README.md @@ -1,99 +1,92 @@ - - -# Resnet34 Inference for Tensorflow - -This repository provides a script and recipe to Inference of the Resnet34 model. - -## Notice -**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** - -Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. - -| Conditions | Need | -| --- | --- | -| CANN Version | >=5.0.3 | -| Chip Platform| Ascend310/Ascend310P3 | -| 3rd Party Requirements| Please follow the 'requirements.txt' | - -## Quick Start Guide - -### 1. Clone the respository - -```shell -git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git -cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL -``` - -### 2. Download and preprocess the dataset - -1. Download the Tiny-ImageNet-200 dataset by yourself. - -2. Move **tiny-imagenet-200** to **'scripts/'** -``` -———scripts - |————tiny-imagenet-200 - |————test - |————train - |————val - |————wnids.txt - |————words.txt -``` - -3. Images Preprocess: -``` -cd scripts -mkdir input_bins -python3 imagenet_tiny_preprocessing.py -``` -The jpegs pictures will be preprocessed to bin fils. - -### 3. Offline Inference - -**Convert pb to om.** - -- configure the env - - ``` - export install_path=/usr/local/Ascend - export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH - export PYTHONPATH=${install_path}/atc/python/site-packages:${install_path}/atc/python/site-packages/auto_tune.egg/auto_tune:${install_path}/atc/python/site-packages/schedule_search.egg:$PYTHONPATH - export LD_LIBRARY_PATH=${install_path}/atc/lib64:${install_path}/acllib/lib64:$LD_LIBRARY_PATH - export ASCEND_OPP_PATH=${install_path}/opp - ``` - -- convert pb to om - - [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet34_tf.pb) - - ``` - atc --model=resnet34_tf.pb --framework=3 --output=resnet34_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="test_inputs:1,64,64,3" --log=info --insert_op_conf=resnet34_tf_aipp.cfg --enable_small_channel=1 - ``` - -- Build the program - - ``` - bash build.sh - ``` - -- Run the program: - - ``` - cd scripts - bash benchmark_tf.sh - ``` - -## Performance - -### Result - -Our result was obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. - -#### Inference accuracy results - -| model | **data** | Top1/Top5 | -| :---------------: | :-------: | :-------------: | -| offline Inference | 10000 images | 51.9 %/ 76.6% | - - -## Reference -[1] https://github.com/taki0112/ResNet-Tensorflow +中文|[English](README_EN.md) + +# Resnet34 TensorFlow离线推理 + +此链接提供Resnet34 TensorFlow模型在NPU上离线推理的脚本和方法 +## 注意 +**此案例仅为您学习Ascend软件栈提供参考,不用于商业目的。** + +在开始之前,请注意以下适配条件。如果不匹配,可能导致运行失败。 + +| Conditions | Need | +| --- | --- | +| CANN版本 | >=5.0.3 | +| 芯片平台| Ascend310/Ascend310P3 | +| 第三方依赖| 请参考 'requirements.txt' | + +## 快速指南 + +### 1. 拷贝代码 + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL +``` + +### 2. 下载数据集和预处理 + +1. 请自行下载Tiny-ImageNet-200测试数据集 + +2. 将 **tiny-imagenet-200** 移动到 **'scripts/'**目录下 +``` +———scripts + |————tiny-imagenet-200 + |————test + |————train + |————val + |————wnids.txt + |————words.txt +``` + +3. 图片预处理: +``` +cd scripts +mkdir input_bins +python3 imagenet_tiny_preprocessing.py +``` +jpeg图片将被预处理成bin文件 + +### 3. 离线推理 + +**Pb模型转换为om模型** + +- 环境变量设置 + + 请参考[说明](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719),设置环境变量 + +- Pb模型转换为om模型 + + [pb模型下载链接](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet34_tf.pb) + + ``` + atc --model=resnet34_tf.pb --framework=3 --output=resnet34_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="test_inputs:1,64,64,3" --log=info --insert_op_conf=resnet34_tf_aipp.cfg --enable_small_channel=1 + ``` + +- 编译程序 + + ``` + bash build.sh + ``` + +- 开始运行: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + +## 性能 + +### 结果 + +本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。 + +#### 推理精度结果 + +| model | **data** | Top1/Top5 | +| :---------------: | :-------: | :-------------: | +| offline Inference | 10000 images | 51.9 %/ 76.6% | + + +## 参考 +[1] https://github.com/taki0112/ResNet-Tensorflow diff --git a/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README_EN.md b/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README_EN.md new file mode 100644 index 0000000000000000000000000000000000000000..331cb9fd446233efb8a6026ca3ba9f7c30d7af3e --- /dev/null +++ b/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL/README_EN.md @@ -0,0 +1,93 @@ +English|[中文](README.md) + +# Resnet34 Inference for Tensorflow + +This repository provides a script and recipe to Inference of the Resnet34 model. + +## Notice +**This sample only provides reference for you to learn the Ascend software stack and is not for commercial purposes.** + +Before starting, please pay attention to the following adaptation conditions. If they do not match, may leading in failure. + +| Conditions | Need | +| --- | --- | +| CANN Version | >=5.0.3 | +| Chip Platform| Ascend310/Ascend310P3 | +| 3rd Party Requirements| Please follow the 'requirements.txt' | + +## Quick Start Guide + +### 1. Clone the respository + +```shell +git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git +cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/Resnet34_for_ACL +``` + +### 2. Download and preprocess the dataset + +1. Download the Tiny-ImageNet-200 dataset by yourself. + +2. Move **tiny-imagenet-200** to **'scripts/'** +``` +———scripts + |————tiny-imagenet-200 + |————test + |————train + |————val + |————wnids.txt + |————words.txt +``` + +3. Images Preprocess: +``` +cd scripts +mkdir input_bins +python3 imagenet_tiny_preprocessing.py +``` +The jpegs pictures will be preprocessed to bin fils. + +### 3. Offline Inference + +**Convert pb to om.** + +- configure the env + + Please follow the [guide](https://gitee.com/ascend/ModelZoo-TensorFlow/wikis/02.%E7%A6%BB%E7%BA%BF%E6%8E%A8%E7%90%86%E6%A1%88%E4%BE%8B/Ascend%E5%B9%B3%E5%8F%B0%E6%8E%A8%E7%90%86%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E8%AE%BE%E7%BD%AE?sort_id=6458719) to set the envs + +- convert pb to om + + [pb download link](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/003_Atc_Models/modelzoo/resnet34_tf.pb) + + ``` + atc --model=resnet34_tf.pb --framework=3 --output=resnet34_tf_1batch --output_type=FP32 --soc_version=Ascend310 --input_shape="test_inputs:1,64,64,3" --log=info --insert_op_conf=resnet34_tf_aipp.cfg --enable_small_channel=1 + ``` + +- Build the program + + ``` + bash build.sh + ``` + +- Run the program: + + ``` + cd scripts + bash benchmark_tf.sh + ``` + +## Performance + +### Result + +Our result was obtained by running the applicable inference script. To achieve the same results, follow the steps in the Quick Start Guide. + +#### Inference accuracy results + +| model | **data** | Top1/Top5 | +| :---------------: | :-------: | :-------------: | +| offline Inference | 10000 images | 51.9 %/ 76.6% | + + +## Reference +[1] https://github.com/taki0112/ResNet-Tensorflow