Skip to content

Commit a3a3d57

Browse files
authored
Merge pull request #6186 from Evezerest/dygraph
Fix a bug of kie as null
2 parents 0e0e33d + 02621d3 commit a3a3d57

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PPOCRLabel/PPOCRLabel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ def showBoundingBoxFromPPlabel(self, filePath):
14711471
# box['ratio'] of the shapes saved in lockedShapes contains the ratio of the
14721472
# four corner coordinates of the shapes to the height and width of the image
14731473
for box in self.canvas.lockedShapes:
1474-
key_cls = None if not self.kie_mode else box['key_cls']
1474+
key_cls = 'None' if not self.kie_mode else box['key_cls']
14751475
if self.canvas.isInTheSameImage:
14761476
shapes.append((box['transcription'], [[s[0] * width, s[1] * height] for s in box['ratio']],
14771477
DEFAULT_LOCK_COLOR, key_cls, box['difficult']))
@@ -1480,7 +1480,7 @@ def showBoundingBoxFromPPlabel(self, filePath):
14801480
DEFAULT_LOCK_COLOR, key_cls, box['difficult']))
14811481
if imgidx in self.PPlabel.keys():
14821482
for box in self.PPlabel[imgidx]:
1483-
key_cls = None if not self.kie_mode else box.get('key_cls', 'None')
1483+
key_cls = 'None' if not self.kie_mode else box.get('key_cls', 'None')
14841484
shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False)))
14851485

14861486
self.loadLabels(shapes)
@@ -2266,7 +2266,7 @@ def cellreRecognition(self):
22662266
rec_res = self.ocr.ocr(patch, det=False, rec=True, cls=False)
22672267
text = rec_res[0][0]
22682268
if text != '':
2269-
texts += text + (' ' if text[0].isalpha() else '') # add space between english word
2269+
texts += text + ('' if text[0].isalpha() else ' ') # add space between english word
22702270
probs += rec_res[0][1]
22712271
probs = probs / len(bboxes)
22722272
result = [(texts.strip(), probs)]

0 commit comments

Comments
 (0)