Skip to content

Instantly share code, notes, and snippets.

@JarvusChen
Last active July 14, 2018 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JarvusChen/2ae1311a462244ac2cdd529b3d995751 to your computer and use it in GitHub Desktop.
Save JarvusChen/2ae1311a462244ac2cdd529b3d995751 to your computer and use it in GitHub Desktop.
Predict plate number by CTC loss
# predict number
X = cv2.imread('test1.jpg')
X = X.transpose(1, 0, 2).reshape(1,70,30,3)
y_pred = base_model.predict(X)
y_pred = y_pred[:,2:,:]
out = K.get_value(K.ctc_decode(y_pred, input_length=np.ones(y_pred.shape[0])*y_pred.shape[1], )[0][0])[:, :7]
out = ''.join([chars[x] for x in out[0]])
print(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment