Browse Source

add device_id parameter, modify readme

tags/v1.1.1
yuzhenhua 5 years ago
parent
commit
343f96b8ee
6 changed files with 46 additions and 22 deletions
  1. +1
    -1
      model_zoo/official/cv/faster_rcnn/README.md
  2. +1
    -1
      model_zoo/official/cv/faster_rcnn/README_CN.md
  3. +21
    -9
      model_zoo/official/cv/faster_rcnn/scripts/run_infer_310.sh
  4. +2
    -1
      model_zoo/official/cv/maskrcnn/README.md
  5. +1
    -1
      model_zoo/official/cv/maskrcnn/README_CN.md
  6. +20
    -9
      model_zoo/official/cv/maskrcnn/scripts/run_infer_310.sh

+ 1
- 1
model_zoo/official/cv/faster_rcnn/README.md View File

@@ -301,7 +301,7 @@ sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]

### result

Inference result is saved in current path, you can find result like this in log file.
Inference result is saved in current path, you can find result like this in acc.log file.

```log
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.349


+ 1
- 1
model_zoo/official/cv/faster_rcnn/README_CN.md View File

@@ -304,7 +304,7 @@ sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]

### 结果

推理的结果保存在当前目录下,在日志文件中可以找到类似以下的结果。
推理的结果保存在当前目录下,在acc.log日志文件中可以找到类似以下的结果。

```log
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.349


+ 21
- 9
model_zoo/official/cv/faster_rcnn/scripts/run_infer_310.sh View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,13 +14,12 @@
# limitations under the License.
# ============================================================================

if [ $# != 3 ]
then
echo "Usage: sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]"
if [[ $# -lt 3 || $# -gt 4 ]]; then
echo "Usage: sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH] [DEVICE_ID]
DEVICE_ID is optional, it can be setted by environment variable device_id, otherwise the value is zero"
exit 1
fi


get_real_path(){
if [ "${1:0:1}" == "/" ]; then
echo "$1"
@@ -31,9 +30,22 @@ get_real_path(){
model=$(get_real_path $1)
data_path=$(get_real_path $2)
ann_file=$(get_real_path $3)
if [ $# == 4 ]; then
device_id=$4
elif [ $# == 3 ]; then
# shellcheck disable=SC2153 #DEVICE_ID is en
if [ -z $device_id ]; then
device_id=0
else
device_id=$device_id
fi
fi

echo $model
echo $data_path
echo $ann_file
echo $device_id

export ASCEND_HOME=/usr/local/Ascend/
export PATH=$ASCEND_HOME/atc/ccec_compiler/bin:$ASCEND_HOME/atc/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/atc/lib64:$ASCEND_HOME/acllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
@@ -42,13 +54,13 @@ export ASCEND_OPP_PATH=$ASCEND_HOME/opp

function air_to_om()
{
atc --input_format=NCHW --framework=1 --model=$model --input_shape="x:1, 3, 768, 1280; im_info: 1, 4" --output=fasterrcnn --insert_op_conf=../src/aipp.cfg --precision_mode=allow_fp32_to_fp16 --soc_version=Ascend310
atc --input_format=NCHW --framework=1 --model=$model --input_shape="x:1, 3, 768, 1280; im_info: 1, 4" --output=fasterrcnn --insert_op_conf=../src/aipp.cfg --precision_mode=allow_fp32_to_fp16 --soc_version=Ascend310 &> atc.log
}

function compile_app()
{
cd ../ascend310_infer/src
sh build.sh
sh build.sh &> build.log
cd -
}

@@ -62,12 +74,12 @@ function infer()
fi
mkdir result_Files
mkdir time_Result
../ascend310_infer/src/out/main --om_path=./fasterrcnn.om --data_path=$data_path
../ascend310_infer/src/out/main --om_path=./fasterrcnn.om --data_path=$data_path --device_id=$device_id &> infer.log
}

function cal_acc()
{
python ../postprocess.py --ann_file=$ann_file --img_path=$data_path &> log &
python ../postprocess.py --ann_file=$ann_file --img_path=$data_path &> acc.log &
}

air_to_om


+ 2
- 1
model_zoo/official/cv/maskrcnn/README.md View File

@@ -505,6 +505,7 @@ python export.py --ckpt_file [CKPT_PATH] --device_target [DEVICE_TARGET] --file_
### Usage

Before performing inference, the air file must bu exported by export script on the 910 environment.
Current batch_ Size can only be set to 1. The inference process needs about 600G hard disk space to save the reasoning results.

```shell
# Ascend310 inference
@@ -513,7 +514,7 @@ sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]

### result

Inference result is saved in current path, you can find result like this in log file.
Inference result is saved in current path, you can find result like this in acc.log file.

```bash
Evaluate annotation type *bbox*


+ 1
- 1
model_zoo/official/cv/maskrcnn/README_CN.md View File

@@ -448,7 +448,7 @@ sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]

### 结果

推理的结果保存在当前目录下,在日志文件中可以找到类似以下的结果。
推理的结果保存在当前目录下,在acc.log日志文件中可以找到类似以下的结果。目前推理只支持batch_size=1。推理过程需要占用大约600G的硬盘空间来保存推理的结果。

```bash
Evaluate annotation type *bbox*


+ 20
- 9
model_zoo/official/cv/maskrcnn/scripts/run_infer_310.sh View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,13 +14,12 @@
# limitations under the License.
# ============================================================================

if [ $# != 3 ]
then
echo "Usage: sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH]"
if [[ $# -lt 3 || $# -gt 4 ]]; then
echo "Usage: sh run_infer_310.sh [AIR_PATH] [DATA_PATH] [ANN_FILE_PATH] [DEVICE_ID]
DEVICE_ID is optional, it can be setted by environment variable device_id, otherwise the value is zero"
exit 1
fi


get_real_path(){
if [ "${1:0:1}" == "/" ]; then
echo "$1"
@@ -31,9 +30,21 @@ get_real_path(){
model=$(get_real_path $1)
data_path=$(get_real_path $2)
ann_file=$(get_real_path $3)
if [ $# == 4 ]; then
device_id=$4
elif [ $# == 3 ]; then
if [ -z $device_id ]; then
device_id=0
else
device_id=$device_id
fi
fi

echo $model
echo $data_path
echo $ann_file
echo $device_id

export ASCEND_HOME=/usr/local/Ascend/
export PATH=$ASCEND_HOME/atc/ccec_compiler/bin:$ASCEND_HOME/atc/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$ASCEND_HOME/atc/lib64:$ASCEND_HOME/acllib/lib64:$ASCEND_HOME/driver/lib64:$ASCEND_HOME/add-ones:$LD_LIBRARY_PATH
@@ -42,13 +53,13 @@ export ASCEND_OPP_PATH=$ASCEND_HOME/opp

function air_to_om()
{
atc --input_format=NCHW --framework=1 --model=$model --input_shape="x:1, 3, 768, 1280; im_info: 1, 4" --output=maskrcnn --insert_op_conf=../src/aipp.cfg --precision_mode=allow_fp32_to_fp16 --soc_version=Ascend310
atc --input_format=NCHW --framework=1 --model=$model --input_shape="x:1, 3, 768, 1280; im_info: 1, 4" --output=maskrcnn --insert_op_conf=../src/aipp.cfg --precision_mode=allow_fp32_to_fp16 --soc_version=Ascend310 &>atc.log
}

function compile_app()
{
cd ../ascend310_infer/src
sh build.sh
sh build.sh &> build.log
cd -
}

@@ -62,12 +73,12 @@ function infer()
fi
mkdir result_Files
mkdir time_Result
../ascend310_infer/src/out/main --om_path=./maskrcnn.om --data_path=$data_path
../ascend310_infer/src/out/main --om_path=./maskrcnn.om --data_path=$data_path --device_id=$device_id &> infer.log
}

function cal_acc()
{
python ../postprocess.py --ann_file=$ann_file --img_path=$data_path &> log &
python ../postprocess.py --ann_file=$ann_file --img_path=$data_path &> acc.log &
}

air_to_om


Loading…
Cancel
Save