Skip to content

Commit 5065fc2

Browse files
committed
fix bug for SLANet infer bbox error
1 parent 5791d75 commit 5065fc2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ppocr/postprocess/table_postprocess.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@ def decode_label(self, batch):
129129

130130
def _bbox_decode(self, bbox, shape):
131131
h, w, ratio_h, ratio_w, pad_h, pad_w = shape
132-
h, w = pad_h, pad_w
133132
bbox[0::2] *= w
134133
bbox[1::2] *= h
135-
bbox[0::2] /= ratio_w
136-
bbox[1::2] /= ratio_h
137134
return bbox
138135

139136

@@ -189,3 +186,14 @@ def _bbox_decode(self, bbox, shape):
189186
x1, y1, x2, y2 = x - w // 2, y - h // 2, x + w // 2, y + h // 2
190187
bbox = np.array([x1, y1, x2, y2])
191188
return bbox
189+
190+
191+
class SLANetPlusLabelDecode(TableLabelDecode):
192+
def _bbox_decode(self, bbox, shape):
193+
h, w, ratio_h, ratio_w, pad_h, pad_w = shape
194+
h, w = pad_h, pad_w
195+
bbox[0::2] *= w
196+
bbox[1::2] *= h
197+
bbox[0::2] /= ratio_w
198+
bbox[1::2] /= ratio_h
199+
return bbox

0 commit comments

Comments
 (0)