
@@ -23,14 +23,17 @@
| 算法论文 | 模型名称 | 模型类型 | 基础
训练预测 | 更多
训练方式 | 模型压缩 | 其他预测部署 |
| :--- | :--- | :----: | :--------: | :---- | :---- | :---- |
-| DB |ch_ppocr_mobile_v2.0_det | 检测 | 支持 | 多机多卡
混合精度 | FPGM裁剪
离线量化| Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
-| DB |ch_ppocr_server_v2.0_det | 检测 | 支持 | 多机多卡
混合精度 | FPGM裁剪
离线量化| Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| DB |ch_ppocr_mobile_v2.0_det | 检测 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| DB |ch_ppocr_mobile_v2.0_det_FPGM | 检测 | 支持 | 多机多卡
混合精度 | FPGM裁剪 | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| DB |ch_ppocr_mobile_v2.0_det_PACT | 检测 | 支持 | 多机多卡
混合精度 | PACT量化 | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| DB |ch_ppocr_mobile_v2.0_det_KL | 检测 | 支持 | 多机多卡
混合精度 | 离线量化| Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| DB |ch_ppocr_server_v2.0_det | 检测 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++ |
| DB |ch_PP-OCRv2_det | 检测 |
-| CRNN |ch_ppocr_mobile_v2.0_rec | 识别 | 支持 | 多机多卡
混合精度 | PACT量化
离线量化| Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
-| CRNN |ch_ppocr_server_v2.0_rec | 识别 | 支持 | 多机多卡
混合精度 | PACT量化
离线量化| Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| CRNN |ch_ppocr_mobile_v2.0_rec | 识别 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| CRNN |ch_ppocr_server_v2.0_rec | 识别 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++ |
| CRNN |ch_PP-OCRv2_rec | 识别 |
| PP-OCR |ch_ppocr_mobile_v2.0 | 检测+识别 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
-| PP-OCR |ch_ppocr_server_v2.0 | 检测+识别 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++
Paddle-Lite:
(1) ARM CPU(C++) |
+| PP-OCR |ch_ppocr_server_v2.0 | 检测+识别 | 支持 | 多机多卡
混合精度 | - | Paddle Inference: C++
Paddle Serving: Python, C++ |
|PP-OCRv2|ch_PP-OCRv2 | 检测+识别 |
| DB |det_mv3_db_v2.0 | 检测 |
| DB |det_r50_vd_db_v2.0 | 检测 |
@@ -54,32 +57,31 @@
-## 3. 一键测试工具使用
+## 3. 测试工具简介
### 目录介绍
```shell
test_tipc/
├── configs/ # 配置文件目录
- ├── ppocr_det_mobile # ppocr_det_mobile模型的测试配置文件目录
- ├── det_mv3_db.yml # 测试mobile版ppocr检测模型训练的yml文件
- ├── train_infer_python.txt.txt # 测试Linux上python训练预测(基础训练预测)的配置文件
+ ├── ch_ppocr_mobile_v2.0_det # ch_ppocr_mobile_v2.0_det模型的测试配置文件目录
+ ├── train_infer_python.txt # 测试Linux上python训练预测(基础训练预测)的配置文件
├── model_linux_gpu_normal_normal_infer_cpp_linux_gpu_cpu.txt # 测试Linux上c++预测的配置文件
├── model_linux_gpu_normal_normal_infer_python_jetson.txt # 测试Jetson上python预测的配置文件
├── train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt # 测试Linux上多机多卡、混合精度训练和python预测的配置文件
├── ...
- ├── ppocr_det_server # ppocr_det_server模型的测试配置文件目录
+ ├── ch_ppocr_server_v2.0_det # ch_ppocr_server_v2.0_det模型的测试配置文件目录
├── ...
- ├── ppocr_rec_mobile # ppocr_rec_mobile模型的测试配置文件目录
+ ├── ch_ppocr_mobile_v2.0_rec # ch_ppocr_mobile_v2.0_rec模型的测试配置文件目录
├── ...
- ├── ppocr_rec_server # ppocr_rec_server模型的测试配置文件目录
+ ├── ch_ppocr_server_v2.0_det # ch_ppocr_server_v2.0_det模型的测试配置文件目录
├── ...
├── ...
├── results/ # 预先保存的预测结果,用于和实际预测结果进行精读比对
- ├── python_ppocr_det_mobile_results_fp32.txt # 预存的mobile版ppocr检测模型python预测fp32精度的结果
- ├── python_ppocr_det_mobile_results_fp16.txt # 预存的mobile版ppocr检测模型python预测fp16精度的结果
- ├── cpp_ppocr_det_mobile_results_fp32.txt # 预存的mobile版ppocr检测模型c++预测的fp32精度的结果
- ├── cpp_ppocr_det_mobile_results_fp16.txt # 预存的mobile版ppocr检测模型c++预测的fp16精度的结果
- ├── ...
+ ├── python_ppocr_det_mobile_results_fp32.txt # 预存的mobile版ppocr检测模型python预测fp32精度的结果
+ ├── python_ppocr_det_mobile_results_fp16.txt # 预存的mobile版ppocr检测模型python预测fp16精度的结果
+ ├── cpp_ppocr_det_mobile_results_fp32.txt # 预存的mobile版ppocr检测模型c++预测的fp32精度的结果
+ ├── cpp_ppocr_det_mobile_results_fp16.txt # 预存的mobile版ppocr检测模型c++预测的fp16精度的结果
+ ├── ...
├── prepare.sh # 完成test_*.sh运行所需要的数据和模型下载
├── test_train_inference_python.sh # 测试python训练预测的主程序
├── test_inference_cpp.sh # 测试c++预测的主程序
@@ -89,19 +91,9 @@ test_tipc/
└── readme.md # 使用文档
```
-### 配置文件命名规范
-在`configs`目录下,按模型名称划分为子目录,子目录中存放所有该模型测试需要用到的配置文件,配置文件的命名遵循如下规范:
-
-1. 基础训练预测配置简单命名为:`train_infer_python.txt`,表示**Linux环境下单机、不使用混合精度训练+python预测**,其完整命名对应`train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt`,由于本配置文件使用频率较高,这里进行了名称简化。
-
-2. 其他带训练配置命名格式为:`train_训练硬件环境(linux_gpu/linux_dcu/…)_是否多机(fleet/normal)_是否混合精度(amp/normal)_预测模式(infer/lite/serving/js)_语言(cpp/python/java)_预测硬件环境(linux_gpu/mac/jetson/opencl_arm_gpu/...).txt`。如,linux gpu下多机多卡+混合精度链条测试对应配置 `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt`,linux dcu下基础训练预测对应配置 `train_linux_dcu_normal_normal_infer_python_dcu.txt`。
-
-3. 仅预测的配置(如serving、lite等)命名格式:`model_训练硬件环境(linux_gpu/linux_dcu/…)_是否多机(fleet/normal)_是否混合精度(amp/normal)_(infer/lite/serving/js)_语言(cpp/python/java)_预测硬件环境(linux_gpu/mac/jetson/opencl_arm_gpu/...).txt`,即,与2相比,仅第一个字段从train换为model,测试时模型直接下载获取,这里的“训练硬件环境”表示所测试的模型是在哪种环境下训练得到的。
+### 测试流程概述
-根据上述命名规范,可以直接从配置文件名看出对应的测试场景和功能。
-
-### 测试流程
-使用本工具,可以测试不同功能的支持情况,以及预测结果是否对齐,测试流程如下:
+使用本工具,可以测试不同功能的支持情况,以及预测结果是否对齐,测试流程概括如下:
@@ -110,18 +102,43 @@ test_tipc/
2. 运行要测试的功能对应的测试脚本`test_*.sh`,产出log,由log可以看到不同配置是否运行成功;
3. 用`compare_results.py`对比log中的预测结果和预存在results目录下的结果,判断预测精度是否符合预期(在误差范围内)。
-其中,有4个测试主程序,功能如下:
-- `test_train_inference_python.sh`:测试基于Python的模型训练、评估、推理等基本功能,包括裁剪、量化、蒸馏。
-- `test_inference_cpp.sh`:测试基于C++的模型推理。
-- `test_serving.sh`:测试基于Paddle Serving的服务化部署功能。
-- `test_lite_arm_cpu_cpp.sh`:测试基于Paddle-Lite的ARM CPU端c++预测部署功能。
-- `test_paddle2onnx.sh`:测试Paddle2ONNX的模型转化功能,并验证正确性。
+测试单项功能仅需两行命令,**如需测试不同模型/功能,替换配置文件即可**,命令格式如下:
+```shell
+# 功能:准备数据
+# 格式:bash + 运行脚本 + 参数1: 配置文件选择 + 参数2: 模式选择
+bash test_tipc/prepare.sh configs/[model_name]/[params_file_name] [Mode]
+
+# 功能:运行测试
+# 格式:bash + 运行脚本 + 参数1: 配置文件选择 + 参数2: 模式选择
+bash test_tipc/test_train_inference_python.sh configs/[model_name]/[params_file_name] [Mode]
+```
+
+例如,测试基本训练预测功能的`lite_train_lite_infer`模式,运行:
+```shell
+# 准备数据
+bash test_tipc/prepare.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_infer_python.txt 'lite_train_lite_infer'
+# 运行测试
+bash test_tipc/test_train_inference_python.sh ./test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_infer_python.txt 'lite_train_lite_infer'
+```
+关于本示例命令的更多信息可查看[基础训练预测使用文档](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/test_tipc/docs/test_train_inference_python.md#22-%E5%8A%9F%E8%83%BD%E6%B5%8B%E8%AF%95)。
+
+### 配置文件命名规范
+在`configs`目录下,**按模型名称划分为子目录**,子目录中存放所有该模型测试需要用到的配置文件,配置文件的命名遵循如下规范:
+
+1. 基础训练预测配置简单命名为:`train_infer_python.txt`,表示**Linux环境下单机、不使用混合精度训练+python预测**,其完整命名对应`train_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt`,由于本配置文件使用频率较高,这里进行了名称简化。
+
+2. 其他带训练配置命名格式为:`train_训练硬件环境(linux_gpu/linux_dcu/…)_是否多机(fleet/normal)_是否混合精度(amp/normal)_预测模式(infer/lite/serving/js)_语言(cpp/python/java)_预测硬件环境(linux_gpu/mac/jetson/opencl_arm_gpu/...).txt`。如,linux gpu下多机多卡+混合精度链条测试对应配置 `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt`,linux dcu下基础训练预测对应配置 `train_linux_dcu_normal_normal_infer_python_linux_dcu.txt`。
+
+3. 仅预测的配置(如serving、lite等)命名格式:`model_训练硬件环境(linux_gpu/linux_dcu/…)_是否多机(fleet/normal)_是否混合精度(amp/normal)_(infer/lite/serving/js)_语言(cpp/python/java)_预测硬件环境(linux_gpu/mac/jetson/opencl_arm_gpu/...).txt`,即,与2相比,仅第一个字段从train换为model,测试时模型直接下载获取,这里的“训练硬件环境”表示所测试的模型是在哪种环境下训练得到的。
+
+**根据上述命名规范,可以直接从子目录名称和配置文件名找到需要测试的场景和功能对应的配置文件。**
+
-#### 更多教程
+## 4. 开始测试
各功能测试中涉及混合精度、裁剪、量化等训练相关,及mkldnn、Tensorrt等多种预测相关参数配置,请点击下方相应链接了解更多细节和使用教程:
-[test_train_inference_python 使用](docs/test_train_inference_python.md)
-[test_inference_cpp 使用](docs/test_inference_cpp.md)
-[test_serving 使用](docs/test_serving.md)
-[test_lite_arm_cpu_cpp 使用](docs/test_lite_arm_cpu_cpp.md)
-[test_paddle2onnx 使用](docs/test_paddle2onnx.md)
+- [test_train_inference_python 使用](docs/test_train_inference_python.md) :测试基于Python的模型训练、评估、推理等基本功能,包括裁剪、量化、蒸馏。
+- [test_inference_cpp 使用](docs/test_inference_cpp.md):测试基于C++的模型推理。
+- [test_serving 使用](docs/test_serving.md):测试基于Paddle Serving的服务化部署功能。
+- [test_lite_arm_cpu_cpp 使用](docs/test_lite_arm_cpu_cpp.md):测试基于Paddle-Lite的ARM CPU端c++预测部署功能。
+- [test_paddle2onnx 使用](docs/test_paddle2onnx.md):测试Paddle2ONNX的模型转化功能,并验证正确性。
diff --git a/test_tipc/test_inference_jeston.sh b/test_tipc/test_inference_jeston.sh
deleted file mode 100644
index 2fd76e1e9e7e8c7b52d0b6838cd15840a59fe5c4..0000000000000000000000000000000000000000
--- a/test_tipc/test_inference_jeston.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-source test_tipc/common_func.sh
-source test_tipc/test_train_inference_python.sh
-
-FILENAME=$1
-# MODE be one of ['whole_infer']
-MODE=$2
-
-dataline=$(awk 'NR==1, NR==17{print}' $FILENAME)
-
-# parser params
-IFS=$'\n'
-lines=(${dataline})
-
-model_name=$(func_parser_value "${lines[1]}")
-python=$(func_parser_value "${lines[2]}")
-
-infer_model_dir_list=$(func_parser_value "${lines[3]}")
-infer_export_list=$(func_parser_value "${lines[4]}")
-infer_is_quant=$(func_parser_value "${lines[5]}")
-# parser inference
-inference_py=$(func_parser_value "${lines[6]}")
-use_gpu_key=$(func_parser_key "${lines[7]}")
-use_gpu_list=$(func_parser_value "${lines[7]}")
-use_mkldnn_key=$(func_parser_key "${lines[8]}")
-use_mkldnn_list=$(func_parser_value "${lines[8]}")
-cpu_threads_key=$(func_parser_key "${lines[9]}")
-cpu_threads_list=$(func_parser_value "${lines[9]}")
-batch_size_key=$(func_parser_key "${lines[10]}")
-batch_size_list=$(func_parser_value "${lines[10]}")
-use_trt_key=$(func_parser_key "${lines[11]}")
-use_trt_list=$(func_parser_value "${lines[11]}")
-precision_key=$(func_parser_key "${lines[12]}")
-precision_list=$(func_parser_value "${lines[12]}")
-infer_model_key=$(func_parser_key "${lines[13]}")
-image_dir_key=$(func_parser_key "${lines[14]}")
-infer_img_dir=$(func_parser_value "${lines[14]}")
-save_log_key=$(func_parser_key "${lines[15]}")
-benchmark_key=$(func_parser_key "${lines[16]}")
-benchmark_value=$(func_parser_value "${lines[16]}")
-infer_key1=$(func_parser_key "${lines[17]}")
-infer_value1=$(func_parser_value "${lines[17]}")
-
-
-LOG_PATH="./test_tipc/output"
-mkdir -p ${LOG_PATH}
-status_log="${LOG_PATH}/results_python.log"
-
-
-if [ ${MODE} = "whole_infer" ]; then
- GPUID=$3
- if [ ${#GPUID} -le 0 ];then
- env=" "
- else
- env="export CUDA_VISIBLE_DEVICES=${GPUID}"
- fi
- # set CUDA_VISIBLE_DEVICES
- eval $env
- export Count=0
- IFS="|"
- infer_run_exports=(${infer_export_list})
- infer_quant_flag=(${infer_is_quant})
- for infer_model in ${infer_model_dir_list[*]}; do
- # run export
- if [ ${infer_run_exports[Count]} != "null" ];then
- save_infer_dir=$(dirname $infer_model)
- set_export_weight=$(func_set_params "${export_weight}" "${infer_model}")
- set_save_infer_key=$(func_set_params "${save_infer_key}" "${save_infer_dir}")
- export_cmd="${python} ${infer_run_exports[Count]} ${set_export_weight} ${set_save_infer_key}"
- echo ${infer_run_exports[Count]}
- echo $export_cmd
- eval $export_cmd
- status_export=$?
- status_check $status_export "${export_cmd}" "${status_log}"
- else
- save_infer_dir=${infer_model}
- fi
- #run inference
- is_quant=${infer_quant_flag[Count]}
- if [ ${MODE} = "klquant_infer" ]; then
- is_quant="True"
- fi
- func_inference "${python}" "${inference_py}" "${save_infer_dir}" "${LOG_PATH}" "${infer_img_dir}" ${is_quant}
- Count=$(($Count + 1))
- done
-fi
-
diff --git a/test_tipc/test_inference_python.sh b/test_tipc/test_inference_python.sh
new file mode 100644
index 0000000000000000000000000000000000000000..72516e044ed8a23c660a4c4f486d19f22a584fb0
--- /dev/null
+++ b/test_tipc/test_inference_python.sh
@@ -0,0 +1,169 @@
+#!/bin/bash
+source test_tipc/common_func.sh
+#source test_tipc/test_train_inference_python.sh
+
+FILENAME=$1
+# MODE be one of ['whole_infer']
+MODE=$2
+
+dataline=$(awk 'NR==1, NR==20{print}' $FILENAME)
+
+# parser params
+IFS=$'\n'
+lines=(${dataline})
+
+model_name=$(func_parser_value "${lines[1]}")
+python=$(func_parser_value "${lines[2]}")
+
+infer_model_dir_list=$(func_parser_value "${lines[3]}")
+infer_export_list=$(func_parser_value "${lines[4]}")
+infer_is_quant=$(func_parser_value "${lines[5]}")
+# parser inference
+inference_py=$(func_parser_value "${lines[6]}")
+use_gpu_key=$(func_parser_key "${lines[7]}")
+use_gpu_list=$(func_parser_value "${lines[7]}")
+use_mkldnn_key=$(func_parser_key "${lines[8]}")
+use_mkldnn_list=$(func_parser_value "${lines[8]}")
+cpu_threads_key=$(func_parser_key "${lines[9]}")
+cpu_threads_list=$(func_parser_value "${lines[9]}")
+batch_size_key=$(func_parser_key "${lines[10]}")
+batch_size_list=$(func_parser_value "${lines[10]}")
+use_trt_key=$(func_parser_key "${lines[11]}")
+use_trt_list=$(func_parser_value "${lines[11]}")
+precision_key=$(func_parser_key "${lines[12]}")
+precision_list=$(func_parser_value "${lines[12]}")
+infer_model_key=$(func_parser_key "${lines[13]}")
+image_dir_key=$(func_parser_key "${lines[14]}")
+infer_img_dir=$(func_parser_value "${lines[14]}")
+rec_model_key=$(func_parser_key "${lines[15]}")
+rec_model_value=$(func_parser_value "${lines[15]}")
+benchmark_key=$(func_parser_key "${lines[16]}")
+benchmark_value=$(func_parser_value "${lines[16]}")
+infer_key1=$(func_parser_key "${lines[17]}")
+infer_value1=$(func_parser_value "${lines[17]}")
+
+
+
+LOG_PATH="./test_tipc/output"
+mkdir -p ${LOG_PATH}
+status_log="${LOG_PATH}/results_python.log"
+
+
+function func_inference(){
+ IFS='|'
+ _python=$1
+ _script=$2
+ _model_dir=$3
+ _log_path=$4
+ _img_dir=$5
+ _flag_quant=$6
+ # inference
+ for use_gpu in ${use_gpu_list[*]}; do
+ if [ ${use_gpu} = "False" ] || [ ${use_gpu} = "cpu" ]; then
+ for use_mkldnn in ${use_mkldnn_list[*]}; do
+ if [ ${use_mkldnn} = "False" ] && [ ${_flag_quant} = "True" ]; then
+ continue
+ fi
+ for threads in ${cpu_threads_list[*]}; do
+ for batch_size in ${batch_size_list[*]}; do
+ for precision in ${precision_list[*]}; do
+ if [ ${use_mkldnn} = "False" ] && [ ${precision} = "fp16" ]; then
+ continue
+ fi # skip when enable fp16 but disable mkldnn
+ if [ ${_flag_quant} = "True" ] && [ ${precision} != "int8" ]; then
+ continue
+ fi # skip when quant model inference but precision is not int8
+ set_precision=$(func_set_params "${precision_key}" "${precision}")
+
+ _save_log_path="${_log_path}/python_infer_cpu_usemkldnn_${use_mkldnn}_threads_${threads}_precision_${precision}_batchsize_${batch_size}.log"
+ set_infer_data=$(func_set_params "${image_dir_key}" "${_img_dir}")
+ set_benchmark=$(func_set_params "${benchmark_key}" "${benchmark_value}")
+ set_batchsize=$(func_set_params "${batch_size_key}" "${batch_size}")
+ set_cpu_threads=$(func_set_params "${cpu_threads_key}" "${threads}")
+ set_model_dir=$(func_set_params "${infer_model_key}" "${_model_dir}")
+ set_infer_params0=$(func_set_params "${rec_model_key}" "${rec_model_value}")
+ set_infer_params1=$(func_set_params "${infer_key1}" "${infer_value1}")
+ command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_mkldnn_key}=${use_mkldnn} ${set_cpu_threads} ${set_model_dir} ${set_batchsize} ${set_infer_params0} ${set_infer_data} ${set_benchmark} ${set_precision} ${set_infer_params1} > ${_save_log_path} 2>&1 "
+ eval $command
+ last_status=${PIPESTATUS[0]}
+ eval "cat ${_save_log_path}"
+ status_check $last_status "${command}" "${status_log}"
+ done
+ done
+ done
+ done
+ elif [ ${use_gpu} = "True" ] || [ ${use_gpu} = "gpu" ]; then
+ for use_trt in ${use_trt_list[*]}; do
+ for precision in ${precision_list[*]}; do
+ if [[ ${_flag_quant} = "False" ]] && [[ ${precision} =~ "int8" ]]; then
+ continue
+ fi
+ if [[ ${precision} =~ "fp16" || ${precision} =~ "int8" ]] && [ ${use_trt} = "False" ]; then
+ continue
+ fi
+ if [[ ${use_trt} = "False" || ${precision} =~ "int8" ]] && [ ${_flag_quant} = "True" ]; then
+ continue
+ fi
+ for batch_size in ${batch_size_list[*]}; do
+ _save_log_path="${_log_path}/python_infer_gpu_usetrt_${use_trt}_precision_${precision}_batchsize_${batch_size}.log"
+ set_infer_data=$(func_set_params "${image_dir_key}" "${_img_dir}")
+ set_benchmark=$(func_set_params "${benchmark_key}" "${benchmark_value}")
+ set_batchsize=$(func_set_params "${batch_size_key}" "${batch_size}")
+ set_tensorrt=$(func_set_params "${use_trt_key}" "${use_trt}")
+ set_precision=$(func_set_params "${precision_key}" "${precision}")
+ set_model_dir=$(func_set_params "${infer_model_key}" "${_model_dir}")
+ set_infer_params0=$(func_set_params "${save_log_key}" "${save_log_value}")
+ set_infer_params1=$(func_set_params "${infer_key1}" "${infer_value1}")
+ command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${set_tensorrt} ${set_precision} ${set_model_dir} ${set_batchsize} ${set_infer_data} ${set_benchmark} ${set_infer_params1} ${set_infer_params0} > ${_save_log_path} 2>&1 "
+ eval $command
+ last_status=${PIPESTATUS[0]}
+ eval "cat ${_save_log_path}"
+ status_check $last_status "${command}" "${status_log}"
+
+ done
+ done
+ done
+ else
+ echo "Does not support hardware other than CPU and GPU Currently!"
+ fi
+ done
+}
+
+if [ ${MODE} = "whole_infer" ]; then
+ GPUID=$3
+ if [ ${#GPUID} -le 0 ];then
+ env=" "
+ else
+ env="export CUDA_VISIBLE_DEVICES=${GPUID}"
+ fi
+ # set CUDA_VISIBLE_DEVICES
+ eval $env
+ export Count=0
+ IFS="|"
+ infer_run_exports=(${infer_export_list})
+ infer_quant_flag=(${infer_is_quant})
+ for infer_model in ${infer_model_dir_list[*]}; do
+ # run export
+ if [ ${infer_run_exports[Count]} != "null" ];then
+ save_infer_dir=$(dirname $infer_model)
+ set_export_weight=$(func_set_params "${export_weight}" "${infer_model}")
+ set_save_infer_key=$(func_set_params "${save_infer_key}" "${save_infer_dir}")
+ export_cmd="${python} ${infer_run_exports[Count]} ${set_export_weight} ${set_save_infer_key}"
+ echo ${infer_run_exports[Count]}
+ eval $export_cmd
+ status_export=$?
+ status_check $status_export "${export_cmd}" "${status_log}"
+ else
+ save_infer_dir=${infer_model}
+ fi
+ #run inference
+ is_quant=${infer_quant_flag[Count]}
+ if [ ${MODE} = "klquant_infer" ]; then
+ is_quant="True"
+ fi
+ func_inference "${python}" "${inference_py}" "${save_infer_dir}" "${LOG_PATH}" "${infer_img_dir}" ${is_quant}
+ Count=$(($Count + 1))
+ done
+fi
+
+
diff --git a/test_tipc/test_lite_arm_cpp.sh b/test_tipc/test_lite_arm_cpp.sh
new file mode 100644
index 0000000000000000000000000000000000000000..c071a236bb7ea35b86b32bfc3b22e87a5aabbb93
--- /dev/null
+++ b/test_tipc/test_lite_arm_cpp.sh
@@ -0,0 +1,159 @@
+#!/bin/bash
+source ./common_func.sh
+export LD_LIBRARY_PATH=${PWD}:$LD_LIBRARY_PATH
+
+FILENAME=$1
+dataline=$(cat $FILENAME)
+# parser params
+IFS=$'\n'
+lines=(${dataline})
+
+# parser lite inference
+inference_cmd=$(func_parser_value "${lines[1]}")
+runtime_device=$(func_parser_value "${lines[2]}")
+det_model_list=$(func_parser_value "${lines[3]}")
+rec_model_list=$(func_parser_value "${lines[4]}")
+cls_model_list=$(func_parser_value "${lines[5]}")
+cpu_threads_list=$(func_parser_value "${lines[6]}")
+det_batch_size_list=$(func_parser_value "${lines[7]}")
+rec_batch_size_list=$(func_parser_value "${lines[8]}")
+infer_img_dir_list=$(func_parser_value "${lines[9]}")
+config_dir=$(func_parser_value "${lines[10]}")
+rec_dict_dir=$(func_parser_value "${lines[11]}")
+benchmark_value=$(func_parser_value "${lines[12]}")
+
+if [[ $inference_cmd =~ "det" ]]; then
+ lite_model_list=${det_lite_model_list}
+elif [[ $inference_cmd =~ "rec" ]]; then
+ lite_model_list=(${rec_lite_model_list[*]} ${cls_lite_model_list[*]})
+elif [[ $inference_cmd =~ "system" ]]; then
+ lite_model_list=(${det_lite_model_list[*]} ${rec_lite_model_list[*]} ${cls_lite_model_list[*]})
+else
+ echo "inference_cmd is wrong, please check."
+ exit 1
+fi
+
+LOG_PATH="./output"
+mkdir -p ${LOG_PATH}
+status_log="${LOG_PATH}/results.log"
+
+
+function func_test_det(){
+ IFS='|'
+ _script=$1
+ _det_model=$2
+ _log_path=$3
+ _img_dir=$4
+ _config=$5
+ if [[ $_det_model =~ "slim" ]]; then
+ precision="INT8"
+ else
+ precision="FP32"
+ fi
+
+ # lite inference
+ for num_threads in ${cpu_threads_list[*]}; do
+ for det_batchsize in ${det_batch_size_list[*]}; do
+ _save_log_path="${_log_path}/lite_${_det_model}_runtime_device_${runtime_device}_precision_${precision}_det_batchsize_${det_batchsize}_threads_${num_threads}.log"
+ command="${_script} ${_det_model} ${runtime_device} ${precision} ${num_threads} ${det_batchsize} ${_img_dir} ${_config} ${benchmark_value} > ${_save_log_path} 2>&1"
+ eval ${command}
+ status_check $? "${command}" "${status_log}"
+ done
+ done
+}
+
+function func_test_rec(){
+ IFS='|'
+ _script=$1
+ _rec_model=$2
+ _cls_model=$3
+ _log_path=$4
+ _img_dir=$5
+ _config=$6
+ _rec_dict_dir=$7
+
+ if [[ $_det_model =~ "slim" ]]; then
+ _precision="INT8"
+ else
+ _precision="FP32"
+ fi
+
+ # lite inference
+ for num_threads in ${cpu_threads_list[*]}; do
+ for rec_batchsize in ${rec_batch_size_list[*]}; do
+ _save_log_path="${_log_path}/lite_${_rec_model}_${cls_model}_runtime_device_${runtime_device}_precision_${_precision}_rec_batchsize_${rec_batchsize}_threads_${num_threads}.log"
+ command="${_script} ${_rec_model} ${_cls_model} ${runtime_device} ${_precision} ${num_threads} ${rec_batchsize} ${_img_dir} ${_config} ${_rec_dict_dir} ${benchmark_value} > ${_save_log_path} 2>&1"
+ eval ${command}
+ status_check $? "${command}" "${status_log}"
+ done
+ done
+}
+
+function func_test_system(){
+ IFS='|'
+ _script=$1
+ _det_model=$2
+ _rec_model=$3
+ _cls_model=$4
+ _log_path=$5
+ _img_dir=$6
+ _config=$7
+ _rec_dict_dir=$8
+ if [[ $_det_model =~ "slim" ]]; then
+ _precision="INT8"
+ else
+ _precision="FP32"
+ fi
+
+ # lite inference
+ for num_threads in ${cpu_threads_list[*]}; do
+ for det_batchsize in ${det_batch_size_list[*]}; do
+ for rec_batchsize in ${rec_batch_size_list[*]}; do
+ _save_log_path="${_log_path}/lite_${_det_model}_${_rec_model}_${_cls_model}_runtime_device_${runtime_device}_precision_${_precision}_det_batchsize_${det_batchsize}_rec_batchsize_${rec_batchsize}_threads_${num_threads}.log"
+ command="${_script} ${_det_model} ${_rec_model} ${_cls_model} ${runtime_device} ${_precision} ${num_threads} ${det_batchsize} ${_img_dir} ${_config} ${_rec_dict_dir} ${benchmark_value} > ${_save_log_path} 2>&1"
+ eval ${command}
+ status_check $? "${command}" "${status_log}"
+ done
+ done
+ done
+}
+
+
+echo "################### run test ###################"
+
+if [[ $inference_cmd =~ "det" ]]; then
+ IFS="|"
+ det_model_list=(${det_model_list[*]})
+
+ for i in {0..1}; do
+ #run lite inference
+ for img_dir in ${infer_img_dir_list[*]}; do
+ func_test_det "${inference_cmd}" "${det_model_list[i]}_opt.nb" "${LOG_PATH}" "${img_dir}" "${config_dir}"
+ done
+ done
+
+elif [[ $inference_cmd =~ "rec" ]]; then
+ IFS="|"
+ rec_model_list=(${rec_model_list[*]})
+ cls_model_list=(${cls_model_list[*]})
+
+ for i in {0..1}; do
+ #run lite inference
+ for img_dir in ${infer_img_dir_list[*]}; do
+ func_test_rec "${inference_cmd}" "${rec_model}_opt.nb" "${cls_model_list[i]}_opt.nb" "${LOG_PATH}" "${img_dir}" "${rec_dict_dir}" "${config_dir}"
+ done
+ done
+
+elif [[ $inference_cmd =~ "system" ]]; then
+ IFS="|"
+ det_model_list=(${det_model_list[*]})
+ rec_model_list=(${rec_model_list[*]})
+ cls_model_list=(${cls_model_list[*]})
+
+ for i in {0..1}; do
+ #run lite inference
+ for img_dir in ${infer_img_dir_list[*]}; do
+ func_test_system "${inference_cmd}" "${det_model_list[i]}_opt.nb" "${rec_model_list[i]}_opt.nb" "${cls_model_list[i]}_opt.nb" "${LOG_PATH}" "${img_dir}" "${config_dir}" "${rec_dict_dir}"
+ done
+ done
+fi
diff --git a/test_tipc/test_lite_arm_cpu_cpp.sh b/test_tipc/test_lite_arm_cpu_cpp.sh
deleted file mode 100644
index 04eebbd28a334f7ac7819f8ff55d7b3192f4b490..0000000000000000000000000000000000000000
--- a/test_tipc/test_lite_arm_cpu_cpp.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/bash
-source ./common_func.sh
-export LD_LIBRARY_PATH=${PWD}:$LD_LIBRARY_PATH
-
-FILENAME=$1
-dataline=$(cat $FILENAME)
-# parser params
-IFS=$'\n'
-lines=(${dataline})
-
-# parser lite inference
-lite_inference_cmd=$(func_parser_value "${lines[1]}")
-lite_model_dir_list=$(func_parser_value "${lines[2]}")
-runtime_device=$(func_parser_value "${lines[3]}")
-lite_cpu_threads_list=$(func_parser_value "${lines[4]}")
-lite_batch_size_list=$(func_parser_value "${lines[5]}")
-lite_infer_img_dir_list=$(func_parser_value "${lines[8]}")
-lite_config_dir=$(func_parser_value "${lines[9]}")
-lite_rec_dict_dir=$(func_parser_value "${lines[10]}")
-lite_benchmark_value=$(func_parser_value "${lines[11]}")
-
-
-LOG_PATH="./output"
-mkdir -p ${LOG_PATH}
-status_log="${LOG_PATH}/results.log"
-
-
-function func_lite(){
- IFS='|'
- _script=$1
- _lite_model=$2
- _log_path=$3
- _img_dir=$4
- _config=$5
- if [[ $lite_model =~ "slim" ]]; then
- precision="INT8"
- else
- precision="FP32"
- fi
-
- # lite inference
- for num_threads in ${lite_cpu_threads_list[*]}; do
- for batchsize in ${lite_batch_size_list[*]}; do
- _save_log_path="${_log_path}/lite_${_lite_model}_runtime_device_${runtime_device}_precision_${precision}_batchsize_${batchsize}_threads_${num_threads}.log"
- command="${_script} ${_lite_model} ${runtime_device} ${precision} ${num_threads} ${batchsize} ${_img_dir} ${_config} ${lite_benchmark_value} > ${_save_log_path} 2>&1"
- eval ${command}
- status_check $? "${command}" "${status_log}"
- done
- done
-}
-
-
-echo "################### run test ###################"
-IFS="|"
-for lite_model in ${lite_model_dir_list[*]}; do
- #run lite inference
- for img_dir in ${lite_infer_img_dir_list[*]}; do
- func_lite "${lite_inference_cmd}" "${lite_model}_opt.nb" "${LOG_PATH}" "${img_dir}" "${lite_config_dir}"
- done
-done
diff --git a/test_tipc/test_train_inference_python.sh b/test_tipc/test_train_inference_python.sh
index c62b6274f8dcbc84d08900c5d228d78fd3c0de1a..0b0a4e4a75f5e978f64404b27a5f26594dbd484e 100644
--- a/test_tipc/test_train_inference_python.sh
+++ b/test_tipc/test_train_inference_python.sh
@@ -20,10 +20,10 @@ train_use_gpu_value=$(func_parser_value "${lines[4]}")
autocast_list=$(func_parser_value "${lines[5]}")
autocast_key=$(func_parser_key "${lines[5]}")
epoch_key=$(func_parser_key "${lines[6]}")
-epoch_num=$(func_parser_params "${lines[6]}")
+epoch_num=$(func_parser_params "${lines[6]}" "${MODE}")
save_model_key=$(func_parser_key "${lines[7]}")
train_batch_key=$(func_parser_key "${lines[8]}")
-train_batch_value=$(func_parser_params "${lines[8]}")
+train_batch_value=$(func_parser_params "${lines[8]}" "${MODE}")
pretrain_model_key=$(func_parser_key "${lines[9]}")
pretrain_model_value=$(func_parser_value "${lines[9]}")
train_model_name=$(func_parser_value "${lines[10]}")
@@ -90,34 +90,39 @@ infer_value1=$(func_parser_value "${lines[50]}")
# parser klquant_infer
if [ ${MODE} = "klquant_whole_infer" ]; then
- dataline=$(awk 'NR==85 NR==101{print}' $FILENAME)
+ dataline=$(awk 'NR==1, NR==17{print}' $FILENAME)
lines=(${dataline})
+ model_name=$(func_parser_value "${lines[1]}")
+ python=$(func_parser_value "${lines[2]}")
+ export_weight=$(func_parser_key "${lines[3]}")
+ save_infer_key=$(func_parser_key "${lines[4]}")
# parser inference model
- infer_model_dir_list=$(func_parser_value "${lines[1]}")
- infer_export_list=$(func_parser_value "${lines[2]}")
- infer_is_quant=$(func_parser_value "${lines[3]}")
+ infer_model_dir_list=$(func_parser_value "${lines[5]}")
+ infer_export_list=$(func_parser_value "${lines[6]}")
+ infer_is_quant=$(func_parser_value "${lines[7]}")
# parser inference
- inference_py=$(func_parser_value "${lines[4]}")
- use_gpu_key=$(func_parser_key "${lines[5]}")
- use_gpu_list=$(func_parser_value "${lines[5]}")
- use_mkldnn_key=$(func_parser_key "${lines[6]}")
- use_mkldnn_list=$(func_parser_value "${lines[6]}")
- cpu_threads_key=$(func_parser_key "${lines[7]}")
- cpu_threads_list=$(func_parser_value "${lines[7]}")
- batch_size_key=$(func_parser_key "${lines[8]}")
- batch_size_list=$(func_parser_value "${lines[8]}")
- use_trt_key=$(func_parser_key "${lines[9]}")
- use_trt_list=$(func_parser_value "${lines[9]}")
- precision_key=$(func_parser_key "${lines[10]}")
- precision_list=$(func_parser_value "${lines[10]}")
- infer_model_key=$(func_parser_key "${lines[11]}")
- image_dir_key=$(func_parser_key "${lines[12]}")
- infer_img_dir=$(func_parser_value "${lines[12]}")
- save_log_key=$(func_parser_key "${lines[13]}")
- benchmark_key=$(func_parser_key "${lines[14]}")
- benchmark_value=$(func_parser_value "${lines[14]}")
- infer_key1=$(func_parser_key "${lines[15]}")
- infer_value1=$(func_parser_value "${lines[15]}")
+ inference_py=$(func_parser_value "${lines[8]}")
+ use_gpu_key=$(func_parser_key "${lines[9]}")
+ use_gpu_list=$(func_parser_value "${lines[9]}")
+ use_mkldnn_key=$(func_parser_key "${lines[10]}")
+ use_mkldnn_list=$(func_parser_value "${lines[10]}")
+ cpu_threads_key=$(func_parser_key "${lines[11]}")
+ cpu_threads_list=$(func_parser_value "${lines[11]}")
+ batch_size_key=$(func_parser_key "${lines[12]}")
+ batch_size_list=$(func_parser_value "${lines[12]}")
+ use_trt_key=$(func_parser_key "${lines[13]}")
+ use_trt_list=$(func_parser_value "${lines[13]}")
+ precision_key=$(func_parser_key "${lines[14]}")
+ precision_list=$(func_parser_value "${lines[14]}")
+ infer_model_key=$(func_parser_key "${lines[15]}")
+ image_dir_key=$(func_parser_key "${lines[16]}")
+ infer_img_dir=$(func_parser_value "${lines[16]}")
+ save_log_key=$(func_parser_key "${lines[17]}")
+ save_log_value=$(func_parser_value "${lines[17]}")
+ benchmark_key=$(func_parser_key "${lines[18]}")
+ benchmark_value=$(func_parser_value "${lines[18]}")
+ infer_key1=$(func_parser_key "${lines[19]}")
+ infer_value1=$(func_parser_value "${lines[19]}")
fi
LOG_PATH="./test_tipc/output"
@@ -157,8 +162,9 @@ function func_inference(){
set_batchsize=$(func_set_params "${batch_size_key}" "${batch_size}")
set_cpu_threads=$(func_set_params "${cpu_threads_key}" "${threads}")
set_model_dir=$(func_set_params "${infer_model_key}" "${_model_dir}")
+ set_infer_params0=$(func_set_params "${save_log_key}" "${save_log_value}")
set_infer_params1=$(func_set_params "${infer_key1}" "${infer_value1}")
- command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_mkldnn_key}=${use_mkldnn} ${set_cpu_threads} ${set_model_dir} ${set_batchsize} ${set_infer_data} ${set_benchmark} ${set_precision} ${set_infer_params1} > ${_save_log_path} 2>&1 "
+ command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${use_mkldnn_key}=${use_mkldnn} ${set_cpu_threads} ${set_model_dir} ${set_batchsize} ${set_infer_params0} ${set_infer_data} ${set_benchmark} ${set_precision} ${set_infer_params1} > ${_save_log_path} 2>&1 "
eval $command
last_status=${PIPESTATUS[0]}
eval "cat ${_save_log_path}"
@@ -187,8 +193,9 @@ function func_inference(){
set_tensorrt=$(func_set_params "${use_trt_key}" "${use_trt}")
set_precision=$(func_set_params "${precision_key}" "${precision}")
set_model_dir=$(func_set_params "${infer_model_key}" "${_model_dir}")
+ set_infer_params0=$(func_set_params "${save_log_key}" "${save_log_value}")
set_infer_params1=$(func_set_params "${infer_key1}" "${infer_value1}")
- command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${set_tensorrt} ${set_precision} ${set_model_dir} ${set_batchsize} ${set_infer_data} ${set_benchmark} ${set_infer_params1} > ${_save_log_path} 2>&1 "
+ command="${_python} ${_script} ${use_gpu_key}=${use_gpu} ${set_tensorrt} ${set_precision} ${set_model_dir} ${set_batchsize} ${set_infer_data} ${set_benchmark} ${set_infer_params1} ${set_infer_params0} > ${_save_log_path} 2>&1 "
eval $command
last_status=${PIPESTATUS[0]}
eval "cat ${_save_log_path}"
@@ -224,7 +231,7 @@ if [ ${MODE} = "whole_infer" ] || [ ${MODE} = "klquant_whole_infer" ]; then
set_save_infer_key=$(func_set_params "${save_infer_key}" "${save_infer_dir}")
export_cmd="${python} ${infer_run_exports[Count]} ${set_export_weight} ${set_save_infer_key}"
echo ${infer_run_exports[Count]}
- echo $export_cmd
+ echo $export_cmd
eval $export_cmd
status_export=$?
status_check $status_export "${export_cmd}" "${status_log}"
@@ -233,7 +240,7 @@ if [ ${MODE} = "whole_infer" ] || [ ${MODE} = "klquant_whole_infer" ]; then
fi
#run inference
is_quant=${infer_quant_flag[Count]}
- if [ ${MODE} = "klquant_infer" ]; then
+ if [ ${MODE} = "klquant_whole_infer" ]; then
is_quant="True"
fi
func_inference "${python}" "${inference_py}" "${save_infer_dir}" "${LOG_PATH}" "${infer_img_dir}" ${is_quant}
@@ -334,7 +341,7 @@ else
set_eval_pretrain=$(func_set_params "${pretrain_model_key}" "${save_log}/${train_model_name}")
# save norm trained models to set pretrain for pact training and fpgm training
- if [ ${trainer} = ${trainer_norm} ] && [ ${nodes} -le 1]; then
+ if [ ${trainer} = ${trainer_norm} ] && [ ${nodes} -le 1 ]; then
load_norm_train_model=${set_eval_pretrain}
fi
# run eval
@@ -357,7 +364,7 @@ else
#run inference
eval $env
save_infer_path="${save_log}"
- if [ ${inference_dir} != "null" ] && [ ${inference_dir} != '##' ]; then
+ if [[ ${inference_dir} != "null" ]] && [[ ${inference_dir} != '##' ]]; then
infer_model_dir="${save_infer_path}/${inference_dir}"
else
infer_model_dir=${save_infer_path}
diff --git a/tools/infer/predict_e2e.py b/tools/infer/predict_e2e.py
index 08b87f36b0670e98e54c3f38c9328fe9462a6d0f..c00d101aa601c05230da39bc19f0e5068bc80aa2 100755
--- a/tools/infer/predict_e2e.py
+++ b/tools/infer/predict_e2e.py
@@ -68,7 +68,6 @@ class TextE2E(object):
postprocess_params["character_dict_path"] = args.e2e_char_dict_path
postprocess_params["valid_set"] = args.e2e_pgnet_valid_set
postprocess_params["mode"] = args.e2e_pgnet_mode
- self.e2e_pgnet_polygon = args.e2e_pgnet_polygon
else:
logger.info("unknown e2e_algorithm:{}".format(self.e2e_algorithm))
sys.exit(0)
diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py
index 41982e3403b11dd4a1893f89af11a9201e0e15d7..7ec8eeadd3ac1232fc28287828a8383b258a2b3d 100755
--- a/tools/infer/predict_rec.py
+++ b/tools/infer/predict_rec.py
@@ -91,7 +91,7 @@ class TextRecognizer(object):
time_keys=[
'preprocess_time', 'inference_time', 'postprocess_time'
],
- warmup=2,
+ warmup=0,
logger=logger)
def resize_norm_img(self, img, max_wh_ratio):
diff --git a/tools/infer/utility.py b/tools/infer/utility.py
old mode 100755
new mode 100644
index 85f68d9bdb4f15ec80a470af6b132ebda33398a3..f437056ec7b10e28e626d2028b6401cebc647bb1
--- a/tools/infer/utility.py
+++ b/tools/infer/utility.py
@@ -96,7 +96,6 @@ def init_args():
parser.add_argument(
"--e2e_char_dict_path", type=str, default="./ppocr/utils/ic15_dict.txt")
parser.add_argument("--e2e_pgnet_valid_set", type=str, default='totaltext')
- parser.add_argument("--e2e_pgnet_polygon", type=str2bool, default=True)
parser.add_argument("--e2e_pgnet_mode", type=str, default='fast')
# params for text classifier
@@ -191,6 +190,7 @@ def create_predictor(args, mode, logger):
config.enable_use_gpu(args.gpu_mem, 0)
if args.use_tensorrt:
config.enable_tensorrt_engine(
+ workspace_size=1 << 30,
precision_mode=precision,
max_batch_size=args.max_batch_size,
min_subgraph_size=args.min_subgraph_size)
@@ -211,7 +211,7 @@ def create_predictor(args, mode, logger):
"nearest_interp_v2_0.tmp_0": [1, 256, 2, 2]
}
max_input_shape = {
- "x": [1, 3, 1280, 1280],
+ "x": [1, 3, 1536, 1536],
"conv2d_92.tmp_0": [1, 120, 400, 400],
"conv2d_91.tmp_0": [1, 24, 200, 200],
"conv2d_59.tmp_0": [1, 96, 400, 400],
@@ -261,7 +261,7 @@ def create_predictor(args, mode, logger):
opt_input_shape.update(opt_pact_shape)
elif mode == "rec":
min_input_shape = {"x": [1, 3, 32, 10]}
- max_input_shape = {"x": [args.rec_batch_num, 3, 32, 1024]}
+ max_input_shape = {"x": [args.rec_batch_num, 3, 32, 1536]}
opt_input_shape = {"x": [args.rec_batch_num, 3, 32, 320]}
elif mode == "cls":
min_input_shape = {"x": [1, 3, 48, 10]}
@@ -311,10 +311,6 @@ def create_predictor(args, mode, logger):
def get_infer_gpuid():
- cmd = "nvidia-smi"
- res = os.popen(cmd).readlines()
- if len(res) == 0:
- return None
cmd = "env | grep CUDA_VISIBLE_DEVICES"
env_cuda = os.popen(cmd).readlines()
if len(env_cuda) == 0:
diff --git a/tools/infer_det.py b/tools/infer_det.py
index bb2cca7362e81494018aa3471664d60bef1b852c..1c679e0faf0d3ebdb6ca7ed4c317ce3eecfa910f 100755
--- a/tools/infer_det.py
+++ b/tools/infer_det.py
@@ -53,6 +53,7 @@ def draw_det_res(dt_boxes, config, img, img_name, save_path):
logger.info("The detected Image saved in {}".format(save_path))
+@paddle.no_grad()
def main():
global_config = config['Global']