- Overview
- Built With
- Project Structure
- Getting Started
- Run Project
- Data Preprocessing
- Model Training
- Data Augmentation
The CMC-7 Check Character Recognition System is a deep learning project aimed at recognizing CMC-7 characters on checks. The project combines data preprocessing, model training, and optical character recognition (OCR) techniques to accurately identify CMC-7 characters from check images.
This project utilizes the following frameworks and libraries:
- - Deep learning framework used for creating and training the neural network model.
- - Computer vision library for image preprocessing and manipulation.
- - Python Imaging Library for handling image operations.
- - Augmentation library for generating diverse training data.
- - High-level neural networks API running on top of TensorFlow.
- - Programming language used for the project.
The project is organized into several directories:
data
: Contains training, validation, and test data in specific class folders.models
: Contains the trained CNN model and its architecture definition.src
: Contains modules for data preprocessing, model training.main.py
: The entry point for preprocessing, training, and saving the model.testModel.py
: Used to test the trained model's recognition performance.data_augmentor.py
: A script for augmenting custom bank-specific CMC-7 characters to enhance model recognition.
-
Clone the repository:
git clone https://github.com/seifKader/CMC-7-trained-model.git cd CMC-7-trained-model
-
Install the required dependencies:
pip install -r requirements.txt
To run the project and test the trained model's recognition on your own images, follow these steps:
-
Prepare Your Data: Before running the project, ensure that you have your training, validation, and test datasets ready as described in the
data
directory. Alternatively, you can use the existing trained model if available. -
Open
testModel.py
: Navigate to the project directory and open thetestModel.py
script in your preferred text editor. -
Specify Your Test Image: In the
testModel.py
script, find the following line(a test image is provided you can try it):img_path = "test.jpg"
Replace
"test.jpg"
with the path to your own test image. -
Run the Script: Open your terminal or command prompt and execute the following command to run the script:
python testModel.py
-
View Results: The script will process the image and display the predicted class for each recognized character in the console output.
Note: The testModel.py
script processes the provided image and prints the predicted classes for the recognized characters. If you want to further enhance the visual feedback, consider modifying the script to draw bounding boxes around the recognized characters.
The preprocess.py
module under src/data_preprocessing
prepares the data by loading images, converting them to grayscale, normalizing, and creating labels. This processed data is then ready for training.
The train.py
module under src/model_training
defines a Convolutional Neural Network (CNN) architecture and trains it on the preprocessed data. The trained model is saved for future use.
Enhance model recognition for custom bank-specific CMC-7 characters by following these steps:
-
Prepare Cropped Images: Gather cropped images of bank-specific CMC-7 characters. Each character should be in its own image file.
-
Specify The Character Image: In the
data_augmentor.py
script, locate the following line:p = Augmentor.Pipeline("path to your image")
Replace
"path to your image"
with the path to the image of the character you want to augment. -
Run the
data_augmentor.py
Script: Execute the following command in your terminal or command prompt:python data_augmentor.py
Note: Feel free to explore and customize the project to meet your specific needs and further enhance character recognition accuracy.