This is a simple demo of how to perform OCR on the client side using ONNX web.
-
train a small CNN with PyTorch on the EMNIST dataset.
-
Find optimal threshold for class confidence using AUC-ROC with FASHIONMNIST as negative class.
-
quantize the trained model to 8-bit integer.
-
convert the trained model to ONNX format.
-
load the ONNX model in a web browser and perform inference on the client side:
- Binarize the image.
- perform clustering via flood fill algorithm.
- extract the bounding boxes of the clusters.
- resize and perform inference on the bounding boxes.
- compare prediction with confidence threshold.
- profit.