Datasets & Acknowledgements
Relevant source files
The following files were used as context for generating this wiki page:
This page details the dataset structure, data processing requirements, and external contributions that facilitate the training and operation of the MBBank CAPTCHA OCR model. The system relies on specific image labeling conventions and partitioned data loaders to prepare information for a ResNet18-based neural network.
Sources: README.md:1-24, train_model/core.py:65-71
Dataset Structure and Requirements
The OCR model expects a specific directory structure and file naming convention to successfully map images to their respective textual labels during the training and testing phases.
Image Naming Convention
Training and testing images must be stored in a directory named dataset/. The label for each image is derived directly from its filename, excluding the extension. Supported formats include .png, .jpg, and .jpeg.
| Requirement | Description | Source File Reference |
|---|---|---|
| Directory Name | dataset/ | README.md:27, train.py:22 |
| Filename Format | {label}.(png|jpg|jpeg) | README.md:27-28, train.py:21 |
| Labeling Logic | Filename before the extension is used as the ground truth | core.py:53-55 |
Data Flow for Dataset Loading
The DatasetLoader class manages the retrieval and splitting of image files. It includes a hard limit to prevent model overfitting by capping the total number of images processed.
The logic ensures that at least one image is allocated to the test set if the dataset is extremely small.
Sources: train_model/core.py:38-51
Character Encoding and Processing
The system supports a specific set of characters for CAPTCHA recognition, including digits and both uppercase and lowercase English letters.
Character Set Configuration
The total number of unique characters determines the output layer size of the neural network.
- Characters:
0-9,a-z,A-Z - Max CAPTCHA Length: 6 characters
- Label Encoding: Each character in a label is converted into a one-hot encoded vector.
Sources: train_model/core.py:12-16, train_model/core.py:19-24
Image Pre-processing
Before being fed into the model, images undergo specific transformations to ensure consistency in input dimensions and color depth.
Training and Testing Splits
The DatasetLoader implements a standard partition to evaluate model performance on unseen data. By default, it uses a 10% split for testing.
| Split Type | Percentage | Selection Logic |
|---|---|---|
| Training | 90% | data_images[:train_len] |
| Testing | 10% | data_images[:test_len] |
Sources: train_model/core.py:44-49
Acknowledgements
The development of this OCR project was made possible by datasets provided by the community.
External Datasets
The project specifically credits CookieGMVN for providing the underlying CAPTCHA image datasets used to train the provided model.onnx.
- MBBank Captcha V1: Kaggle Dataset
- MBBank Captcha V2: Kaggle Dataset
Sources: README.md:58-60
Licensing
The project is distributed under the MIT License, allowing for open use and modification.
Sources: README.md:54-56, setup.py:16
The repository integrates these datasets into a ResNet18-based architecture, modifying the first convolutional layer and final fully connected layer to match the CAPTCHA dimensions and character set length.
Sources: train_model/core.py:65-71