From 5bb854d5e548996cdde59d5aec7443dbfb3c159f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Mon, 16 Jan 2023 08:39:47 +0000 Subject: [PATCH 1/6] update ACL_PyTorch/contrib/cv/detection/FCENet/readme.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- ACL_PyTorch/contrib/cv/detection/FCENet/readme.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md b/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md index 217d9ed57e..c446dd3911 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md @@ -50,7 +50,8 @@ FCENet,使用傅里叶变换来得到文本的包围框,该方法在弯曲 | 固件与驱动 | 1.0.17 | [Pytorch框架推理环境准备](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/pies) | | CANN | 6.0.RC1 | - | | Python | 3.7.5 | - | - + | torch | 1.8.0 | - | + 说明:请根据推理卡型号与 CANN 版本选择相匹配的固件与驱动版本。 @@ -115,7 +116,6 @@ FCENet,使用傅里叶变换来得到文本的包围框,该方法在弯曲 参数说明: + --dynamic-export: 是否动态导出onnx模型 + --output-file: 输出onnx的文件名。 - + --shape :输出onnx的可输入数据量 2. ONNX 模型转 OM 模型 @@ -174,8 +174,7 @@ FCENet,使用傅里叶变换来得到文本的包围框,该方法在弯曲 python3 -m ais_bench \ --model ./fcenet_bs${batch_size} \ --input ./preprocessed_imgs/ \ - --output ./ \ - --output_dirname ./result/ \ + --output ./result \ --outfmt TXT \ --batchsize ${batch_size} ``` @@ -203,8 +202,8 @@ FCENet,使用傅里叶变换来得到文本的包围框,该方法在弯曲 执行后处理脚本,根据推理结果计算OM模型的精度: ```bash python3 fcenet_postprocess.py \ - --input_path=./result \ - --instance_file=./mmocr/data/icdar2015/instances_test.json \ + --input_path=./result \ + --instance_file=./mmocr/data/icdar2015/instances_test.json \ --output_file=./boundary_results.txt python3 eval.py \ ./mmocr/configs/textdet/fcenet/fcenet_r50_fpn_1500e_icdar2015.py \ -- Gitee From 7fa1680acf8692e3c1d279e89d968c91813dd413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Tue, 17 Jan 2023 01:35:59 +0000 Subject: [PATCH 2/6] update ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_preprocess.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- .../contrib/cv/detection/FCENet/fcenet_preprocess.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_preprocess.py b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_preprocess.py index 63e4908a5a..4e9011512e 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_preprocess.py +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_preprocess.py @@ -18,7 +18,7 @@ import os import warnings from argparse import ArgumentParser, Namespace from pathlib import Path - +from tqdm.contrib import tzip import mmcv import numpy as np import torch @@ -218,13 +218,11 @@ class MMOCR: arr_chunks = [ arrays[i:i + n] for i in range(0, len(arrays), n) ] - #for chunk in arr_chunks: - #print("arr_chunks:",arr_chunks) - #print("filenames:",filenames) + for (chunk,filename) in zip(arr_chunks,filenames) : model_inference(model, chunk, filename, batch_mode=True) else: - for (arr,filename) in zip(arrays,filenames) : + for (arr,filename) in tzip(arrays,filenames) : model_inference(model, arr, filename, batch_mode=False) # Arguments pre-processing function -- Gitee From 24294c35d35089262a4b5dd30416be0ebbe8d3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Tue, 17 Jan 2023 02:21:34 +0000 Subject: [PATCH 3/6] update ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- .../contrib/cv/detection/FCENet/fcenet_postprocess.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py index f48b899d97..71788e86a1 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py @@ -78,12 +78,9 @@ if __name__ == '__main__': parser.add_argument('--instance_file',type=str,default='./mmocr/data/icdar2015/instances_test.json') parser.add_argument('--output_file',type=str,default='./boundary_results.txt') args = parser.parse_args() - #print(args.input_path) - #print(args.output_file) - #prediction_file_path = './result/' prediction_file_path = args.input_path for root, dirs, files in os.walk(prediction_file_path): - prediction_file_path = os.path.join(prediction_file_path,dirs[0]) + prediction_file_path = os.path.join(prediction_file_path,dirs[-1]) break container = [] count = 0 @@ -96,7 +93,6 @@ if __name__ == '__main__': container[i][j].append([]) img_idx = [] - #file_name = './mmocr/data/icdar2015/instances_test.json' file_name = args.instance_file img_name = [] @@ -113,6 +109,8 @@ if __name__ == '__main__': img_idx.append(int(img_num)) for tfile_name in tqdm(os.listdir(prediction_file_path)): + if tfile_name.split('.')[1] is not 'txt': + continue tmp = tfile_name.split('.')[0] index = tmp.rfind('_') img_name = tmp[:index] -- Gitee From 5744a13d2b083db5feadaf40924d512f85879c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Tue, 17 Jan 2023 02:22:14 +0000 Subject: [PATCH 4/6] update ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- .../contrib/cv/detection/FCENet/fcenet_postprocess.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py index 71788e86a1..a157d981a1 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/fcenet_postprocess.py @@ -114,11 +114,11 @@ if __name__ == '__main__': tmp = tfile_name.split('.')[0] index = tmp.rfind('_') img_name = tmp[:index] - index1 = img_name.rfind('_') + img_name_copy = img_name + index1 = img_name_copy.rfind('_') img_name = tmp[:index1] - - index2 = img_name.rfind('_')+1 - flag = int(img_name[index2:]) + index2 = img_name_copy.rfind('_')+1 + flag = int(img_name_copy[index2:]) lines = '' with open(os.path.join(prediction_file_path,tfile_name), 'r') as f: -- Gitee From 74eb423047b6eaf8471e207b61d3807719a6f933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Tue, 17 Jan 2023 02:24:07 +0000 Subject: [PATCH 5/6] update ACL_PyTorch/contrib/cv/detection/FCENet/readme.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- ACL_PyTorch/contrib/cv/detection/FCENet/readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md b/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md index c446dd3911..91a2e09915 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/readme.md @@ -182,7 +182,6 @@ FCENet,使用傅里叶变换来得到文本的包围框,该方法在弯曲 + --model OM模型路径 + --input 存放预处理后数据的目录路径 + --output 用于存放推理结果的父目录路径 - + --output_dirname 用于存放推理结果的子目录名,位于--output指定的目录下 + --outfmt 推理结果文件的保存格式 + --batchsize 模型每次输入bin文件的数量,本例中为1。 -- Gitee From a24fc06c76d00839a2bf42abd784afa6e0dfe2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E7=BA=A2=E8=89=B3?= <1349905607@qq.com> Date: Tue, 17 Jan 2023 02:26:41 +0000 Subject: [PATCH 6/6] update ACL_PyTorch/contrib/cv/detection/FCENet/requirements.txt. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 唐红艳 <1349905607@qq.com> --- .../contrib/cv/detection/FCENet/requirements.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/detection/FCENet/requirements.txt b/ACL_PyTorch/contrib/cv/detection/FCENet/requirements.txt index 0d37589fcd..03f2a9af53 100644 --- a/ACL_PyTorch/contrib/cv/detection/FCENet/requirements.txt +++ b/ACL_PyTorch/contrib/cv/detection/FCENet/requirements.txt @@ -1,13 +1,15 @@ torchvision == 0.12.0 torchaudio == 0.11.0 - +torch==1.13.0 onnx==1.11.0 onnxruntime ==1.11.0 -opencv-python +opencv-contrib-python==3.4.11.45 +opencv-python==4.6.0.66 +opencv-python-headless==4.2.0.34 cython -mmcv-full==1.4.7 +mmcv-full==1.3.17 mmdet==2.22.0 -mmocr==0.4.1 +mmocr==0.6.2 scipy sympy \ No newline at end of file -- Gitee