MCPcopy Create free account
hub / github.com/PaddlePaddle/PaddleOCR / encode

Method encode

ppocr/data/imaug/label_ops.py:1469–1485  ·  view source on GitHub ↗
(self, label)

Source from the content-addressed store, hash-verified

1467 self.english_stroke_dict[english_stroke_alphabet[index]] = index
1468
1469 def encode(self, label):
1470 stroke_sequence = ""
1471 for character in label:
1472 if character not in self.dic:
1473 continue
1474 else:
1475 stroke_sequence += self.dic[character]
1476 stroke_sequence += "0"
1477 label = stroke_sequence
1478
1479 length = len(label)
1480
1481 input_tensor = np.zeros(self.max_text_len).astype("int64")
1482 for j in range(length - 1):
1483 input_tensor[j + 1] = self.english_stroke_dict[label[j]]
1484
1485 return length, input_tensor
1486
1487 def __call__(self, data):
1488 text = data["label"]

Callers 15

__call__Method · 0.95
get_lmdb_sample_infoMethod · 0.45
get_lmdb_sample_infoMethod · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls

no outgoing calls

Tested by 5

fake_getFunction · 0.36
do_POSTMethod · 0.36
do_GETMethod · 0.36