MCPcopy Create free account
hub / github.com/Turing-Project/WriteGPT / decode

Function decode

RecognizaitonNetwork/densenet/model.py:28–34  ·  view source on GitHub ↗
(pred)

Source from the content-addressed store, hash-verified

26 basemodel.load_weights(modelPath)
27
28def decode(pred):
29 char_list = []
30 pred_text = pred.argmax(axis=2)[0]
31 for i in range(len(pred_text)):
32 if pred_text[i] != nclass - 1 and ((not (i > 0 and pred_text[i] == pred_text[i - 1])) or (i > 1 and pred_text[i] == pred_text[i - 2])):
33 char_list.append(characters[pred_text[i]])
34 return u''.join(char_list)
35
36def predict(img):
37 width, height = img.size[0], img.size[1]

Callers 1

predictFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected