From 217b0409cda1f4fb61f7726ed49f1aec43c0d01f Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Tue, 26 Apr 2022 14:19:08 +0800 Subject: [PATCH] fix det --- configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml | 13 ++++++------- .../det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml | 4 ++-- ppocr/modeling/necks/db_fpn.py | 14 ++++++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml b/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml index 3b5ab51b..6a838fd8 100644 --- a/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml +++ b/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml @@ -32,12 +32,12 @@ NetWorks: model_name: large disable_se: true Neck: - name: FEPAN + name: CAPAN out_channels: 96 + shortcut: True Head: name: DBHead k: 50 - kernel_size: [7, 2, 2] Student2: model_type: det algorithm: DB @@ -48,12 +48,12 @@ NetWorks: model_name: large disable_se: true Neck: - name: FEPAN + name: CAPAN out_channels: 96 + shortcut: True Head: name: DBHead k: 50 - kernel_size: [7, 2, 2] Teacher: pretrained: ./inference/ch_ppocr_resnet50/student model_type: det @@ -63,12 +63,11 @@ NetWorks: in_channels: 3 layers: 50 Neck: - name: DBFPN + name: FEPAN out_channels: 256 - big_kernel: true Head: name: DBHead - big_kernel: true + kernel_list: [7,2,2] k: 50 Loss: diff --git a/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml b/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml index 696e8a21..a9e1d3a6 100644 --- a/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml +++ b/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml @@ -28,12 +28,12 @@ Architecture: model_name: large disable_se: True Neck: - name: FEPAN + name: CAPAN out_channels: 96 + shortcut: True Head: name: DBHead k: 50 - kernel_size: [7, 2, 2] Loss: name: DBLoss diff --git a/ppocr/modeling/necks/db_fpn.py b/ppocr/modeling/necks/db_fpn.py index c78f1104..c1272b4e 100644 --- a/ppocr/modeling/necks/db_fpn.py +++ b/ppocr/modeling/necks/db_fpn.py @@ -21,6 +21,8 @@ from paddle import nn import paddle.nn.functional as F from paddle import ParamAttr import os +import sys + __dir__ = os.path.dirname(os.path.abspath(__file__)) sys.path.append(__dir__) sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '../../..'))) @@ -138,11 +140,11 @@ class CALayer(nn.Layer): class CAFPN(nn.Layer): - def __init__(self, in_channels, out_channels, shortcut, **kwargs): + def __init__(self, in_channels, out_channels, shortcut=True, **kwargs): super(CAFPN, self).__init__() - - self.ins_convs = [] - self.inp_convs = [] + self.out_channels = out_channels + self.ins_conv = [] + self.inp_conv = [] for i in range(len(in_channels)): self.ins_conv.append( @@ -192,8 +194,8 @@ class FEPAN(nn.Layer): self.out_channels = out_channels weight_attr = paddle.nn.initializer.KaimingUniform() - self.ins_convs = [] - self.inp_convs = [] + self.ins_conv = [] + self.inp_conv = [] # pan head self.pan_head_conv = [] self.pan_lat_conv = [] -- GitLab