I converted model trained in CRNN.tf2 to onnx format(tensorflow-onnx). Thanks to @FLming I know that it is impossible to run it in OpenCV so I tried ONNX Runtime. It works, but I don't know how to get prediction accuracy?
import onnxruntime as rt
from onnxruntime.datasets import get_example
import cv2
import numpy as np
img = cv2.imread("file.jpg")
img = img.astype(np.float32)
model = get_example("model.onnx")
sess = rt.InferenceSession(model, providers=["CPUExecutionProvider"])
input_name = sess.get_inputs()[0].name
output_name = sess.get_outputs()[0].name
result = sess.run([output_name], {input_name: img})
The model outputs the character probability(after softmax), You can refer to the calculation methods in the repo to get prediction accuracy.
or you can decode outputs first then determine whether the strings are equal to get prediction accuracy.
I converted model trained in CRNN.tf2 to onnx format(tensorflow-onnx). Thanks to @FLming I know that it is impossible to run it in OpenCV so I tried ONNX Runtime. It works, but I don't know how to get prediction accuracy?