|
68 | 68 | std=0.01,
|
69 | 69 | bias=-4.59511985013459), # -log((1-p)/p) where p=0.01
|
70 | 70 | ),
|
71 |
| - module_loss=None, |
| 71 | + module_loss=dict( |
| 72 | + type='ABCNetDetModuleLoss', |
| 73 | + num_classes=num_classes, |
| 74 | + strides=strides, |
| 75 | + center_sampling=True, |
| 76 | + center_sample_radius=1.5, |
| 77 | + bbox_coder=bbox_coder, |
| 78 | + norm_on_bbox=norm_on_bbox, |
| 79 | + loss_cls=dict( |
| 80 | + type='mmdet.FocalLoss', |
| 81 | + use_sigmoid=use_sigmoid_cls, |
| 82 | + gamma=2.0, |
| 83 | + alpha=0.25, |
| 84 | + loss_weight=1.0), |
| 85 | + loss_bbox=dict(type='mmdet.GIoULoss', loss_weight=1.0), |
| 86 | + loss_centerness=dict( |
| 87 | + type='mmdet.CrossEntropyLoss', |
| 88 | + use_sigmoid=True, |
| 89 | + loss_weight=1.0)), |
72 | 90 | postprocessor=dict(
|
73 | 91 | type='ABCNetDetPostprocessor',
|
74 | 92 | # rescale_fields=['polygons', 'bboxes'],
|
75 | 93 | use_sigmoid_cls=use_sigmoid_cls,
|
76 | 94 | strides=[8, 16, 32, 64, 128],
|
77 | 95 | bbox_coder=dict(type='mmdet.DistancePointBBoxCoder'),
|
78 | 96 | with_bezier=True,
|
| 97 | + train_cfg=dict( |
| 98 | + # rescale_fields=['polygon', 'bboxes', 'bezier'], |
| 99 | + nms_pre=1000, |
| 100 | + nms=dict(type='nms', iou_threshold=0.4), |
| 101 | + score_thr=0.7), |
79 | 102 | test_cfg=dict(
|
80 | 103 | # rescale_fields=['polygon', 'bboxes', 'bezier'],
|
81 | 104 | nms_pre=1000,
|
82 | 105 | nms=dict(type='nms', iou_threshold=0.4),
|
83 |
| - score_thr=0.3))), |
| 106 | + score_thr=0.4))), |
84 | 107 | roi_head=dict(
|
85 | 108 | type='RecRoIHead',
|
| 109 | + inputs_indices=(0, 1, 2), |
| 110 | + assigner=dict(type='L1DistanceAssigner'), |
| 111 | + sampler=dict(type='ConcatSampler'), |
86 | 112 | neck=dict(type='CoordinateHead'),
|
87 | 113 | roi_extractor=dict(
|
88 | 114 | type='BezierRoIExtractor',
|
|
97 | 123 | decoder=dict(
|
98 | 124 | type='ABCNetRecDecoder',
|
99 | 125 | dictionary=dictionary,
|
100 |
| - postprocessor=dict(type='AttentionPostprocessor'), |
| 126 | + postprocessor=dict( |
| 127 | + type='AttentionPostprocessor', |
| 128 | + ignore_chars=['padding', 'unknown']), |
| 129 | + module_loss=dict( |
| 130 | + type='CEModuleLoss', |
| 131 | + ignore_first_char=False, |
| 132 | + ignore_char=-1, |
| 133 | + reduction='mean'), |
101 | 134 | max_seq_len=25))),
|
102 | 135 | postprocessor=dict(
|
103 | 136 | type='ABCNetPostprocessor',
|
|
120 | 153 | type='PackTextDetInputs',
|
121 | 154 | meta_keys=('img_path', 'ori_shape', 'img_shape', 'scale_factor'))
|
122 | 155 | ]
|
| 156 | + |
| 157 | +train_pipeline = [ |
| 158 | + dict( |
| 159 | + type='LoadImageFromFile', |
| 160 | + file_client_args=file_client_args, |
| 161 | + color_type='color_ignore_orientation'), |
| 162 | + dict( |
| 163 | + type='LoadOCRAnnotations', |
| 164 | + with_polygon=True, |
| 165 | + with_bbox=True, |
| 166 | + with_label=True, |
| 167 | + with_text=True), |
| 168 | + dict(type='RemoveIgnored'), |
| 169 | + dict(type='RandomCrop', min_side_ratio=0.1), |
| 170 | + dict( |
| 171 | + type='RandomRotate', |
| 172 | + max_angle=30, |
| 173 | + pad_with_fixed_color=True, |
| 174 | + use_canvas=True), |
| 175 | + dict( |
| 176 | + type='RandomChoiceResize', |
| 177 | + scales=[(980, 2900), (1044, 2900), (1108, 2900), (1172, 2900), |
| 178 | + (1236, 2900), (1300, 2900), (1364, 2900), (1428, 2900), |
| 179 | + (1492, 2900)], |
| 180 | + keep_ratio=True), |
| 181 | + dict( |
| 182 | + type='PackTextDetInputs', |
| 183 | + meta_keys=('img_path', 'ori_shape', 'img_shape', 'scale_factor')) |
| 184 | +] |
0 commit comments