From eeb6254a079a298d3594f9e43f80a7ebf7c19731 Mon Sep 17 00:00:00 2001
From: Evezerest <50011306+Evezerest@users.noreply.github.com>
Date: Thu, 28 Apr 2022 15:07:25 +0800
Subject: [PATCH 1/3] =?UTF-8?q?Update=20=E5=A4=9A=E6=A8=A1=E6=80=81?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E8=AF=86=E5=88=AB.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
applications/多模态表单识别.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/applications/多模态表单识别.md b/applications/多模态表单识别.md
index a831813c1..2143a6da8 100644
--- a/applications/多模态表单识别.md
+++ b/applications/多模态表单识别.md
@@ -16,7 +16,7 @@
图1 多模态表单识别流程图
-注:欢迎再AIStudio领取免费算力体验线上实训,项目链接: 多模态表单识别](https://aistudio.baidu.com/aistudio/projectdetail/3815918)(配备Tesla V100、A100等高级算力资源)
+注:欢迎再AIStudio领取免费算力体验线上实训,项目链接: [多模态表单识别](https://aistudio.baidu.com/aistudio/projectdetail/3815918)(配备Tesla V100、A100等高级算力资源)
From 05afe0ef9b7ed43ff81b5d90c078405aca2261e3 Mon Sep 17 00:00:00 2001
From: Evezerest <50011306+Evezerest@users.noreply.github.com>
Date: Thu, 28 Apr 2022 17:17:08 +0800
Subject: [PATCH 2/3] Update PPOCRLabel.py
---
PPOCRLabel/PPOCRLabel.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py
index b9f35aa35..f09a998a9 100644
--- a/PPOCRLabel/PPOCRLabel.py
+++ b/PPOCRLabel/PPOCRLabel.py
@@ -1733,7 +1733,7 @@ class MainWindow(QMainWindow):
width, height = self.image.width(), self.image.height()
for shape in self.canvas.lockedShapes:
box = [[int(p[0] * width), int(p[1] * height)] for p in shape['ratio']]
- assert len(box) == 4
+ # assert len(box) == 4
result = [(shape['transcription'], 1)]
result.insert(0, box)
self.result_dic_locked.append(result)
From 6a8a8f7a032134175c1504a181008e6ed0f7bd6b Mon Sep 17 00:00:00 2001
From: littletomatodonkey
Date: Thu, 28 Apr 2022 18:04:05 +0800
Subject: [PATCH 3/3] fix log (#6086)
---
deploy/slim/quantization/export_model.py | 9 ++++-----
ppocr/modeling/architectures/base_model.py | 5 ++++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/deploy/slim/quantization/export_model.py b/deploy/slim/quantization/export_model.py
index 90f79dab3..fd1c3e5e1 100755
--- a/deploy/slim/quantization/export_model.py
+++ b/deploy/slim/quantization/export_model.py
@@ -17,9 +17,9 @@ import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(__dir__)
-sys.path.append(os.path.abspath(os.path.join(__dir__, '..', '..', '..')))
-sys.path.append(
- os.path.abspath(os.path.join(__dir__, '..', '..', '..', 'tools')))
+sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '..', '..', '..')))
+sys.path.insert(
+ 0, os.path.abspath(os.path.join(__dir__, '..', '..', '..', 'tools')))
import argparse
@@ -129,7 +129,6 @@ def main():
quanter.quantize(model)
load_model(config, model)
- model.eval()
# build metric
eval_class = build_metric(config['Metric'])
@@ -142,6 +141,7 @@ def main():
# start eval
metric = program.eval(model, valid_dataloader, post_process_class,
eval_class, model_type, use_srn)
+ model.eval()
logger.info('metric eval ***************')
for k, v in metric.items():
@@ -156,7 +156,6 @@ def main():
if arch_config["algorithm"] in ["Distillation", ]: # distillation model
archs = list(arch_config["Models"].values())
for idx, name in enumerate(model.model_name_list):
- model.model_list[idx].eval()
sub_model_save_path = os.path.join(save_path, name, "inference")
export_single_model(model.model_list[idx], archs[idx],
sub_model_save_path, logger, quanter)
diff --git a/ppocr/modeling/architectures/base_model.py b/ppocr/modeling/architectures/base_model.py
index f5b29f940..c6b50d488 100644
--- a/ppocr/modeling/architectures/base_model.py
+++ b/ppocr/modeling/architectures/base_model.py
@@ -92,6 +92,9 @@ class BaseModel(nn.Layer):
else:
y["head_out"] = x
if self.return_all_feats:
- return y
+ if self.training:
+ return y
+ else:
+ return {"head_out": y["head_out"]}
else:
return x