A machine-learning project is not finished when a training script produces a model file. The model still needs a predictable input, a decoder that understands its output, and an interface another application can use.
That boundary is the focus of my MBBank CAPTCHA OCR project. The repository contains both a training workflow and a Python prediction package, connecting labeled images to an ONNX model that can be loaded without bringing the whole training environment into the application.
Making the input predictable
The prediction path starts with a PIL image. It converts the image to grayscale, resizes it to 160×50, and normalizes the pixels before passing them to ONNX Runtime. The output is then decoded using the model’s fixed alphanumeric character set.
Those steps are small, but they are part of the model’s contract. A caller cannot replace the preprocessing with an arbitrary resize or a different channel layout and expect the same behavior. The image transformation and decoder are as much a part of the deployed system as the weights.
The package can load its bundled ONNX model or accept a caller-supplied model path. That separates the prediction interface from a particular exported file, although a replacement model still needs to match the expected input and output conventions.
Keeping training separate from prediction
The training side uses PyTorch and torchvision. Image filenames provide the labels, and the script handles training, loss plotting, ONNX export, and a test loop that checks complete predicted strings against their labels.
ONNX is the bridge between the two halves. Training can use the tools that are convenient for experimentation, while inference uses Pillow, NumPy, and ONNX Runtime. An application consuming the prediction package does not need to run the training script or reproduce its development workflow just to recognize an image.
This split is the useful engineering pattern in the project: define a narrow prediction contract, export the trained model, and package the preprocessing and decoding alongside it.
What the model does not promise
The input size and character vocabulary also set the limits. This is a model for a specific image distribution, not a general-purpose text-recognition system. A change in fonts, noise, layout, or the upstream challenge format can affect its predictions.
The repository includes an evaluation procedure, but it does not provide a verified benchmark that justifies an accuracy claim here. A successful example is not evidence of reliable performance on every future image, and a predicted string still needs to be treated as fallible application input.
Use and context
The project is unofficial and is not affiliated with MB Bank. CAPTCHA-related automation should only be used where the operator has authorization and where it complies with the relevant service’s rules. The package is not a guarantee of access to a banking service, and it should not be used to bypass controls on accounts or systems someone does not own or administer.
The repository contains the prediction implementation and training workflow. Together, they show the complete path from preparing images to shipping a small inference interface.
