Skip to content

Commit

Permalink
Fix a bug of kie as null
Browse files Browse the repository at this point in the history
Fix a bug of kie as null
  • Loading branch information
Evezerest committed May 9, 2022
1 parent 2954d39 commit 02621d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PPOCRLabel/PPOCRLabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ def showBoundingBoxFromPPlabel(self, filePath):
# box['ratio'] of the shapes saved in lockedShapes contains the ratio of the
# four corner coordinates of the shapes to the height and width of the image
for box in self.canvas.lockedShapes:
key_cls = None if not self.kie_mode else box['key_cls']
key_cls = 'None' if not self.kie_mode else box['key_cls']
if self.canvas.isInTheSameImage:
shapes.append((box['transcription'], [[s[0] * width, s[1] * height] for s in box['ratio']],
DEFAULT_LOCK_COLOR, key_cls, box['difficult']))
Expand All @@ -1480,7 +1480,7 @@ def showBoundingBoxFromPPlabel(self, filePath):
DEFAULT_LOCK_COLOR, key_cls, box['difficult']))
if imgidx in self.PPlabel.keys():
for box in self.PPlabel[imgidx]:
key_cls = None if not self.kie_mode else box.get('key_cls', 'None')
key_cls = 'None' if not self.kie_mode else box.get('key_cls', 'None')
shapes.append((box['transcription'], box['points'], None, key_cls, box.get('difficult', False)))

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

0 comments on commit 02621d3

Please sign in to comment.