Deprecated - Switched to Pytorch
Machine Learning Project to identify an ID Card on an image.
The goal of this project is to recognize a ID Card on a photo, cut it out using semantic segmentation and to transform the perspective so that you get a front view of the ID Card. Optionally an OCR text recognition can be done in a later step. However, this is not yet planned in the scope of this project.
Dataset: MIDV-500
Tensorflow Version: GPU 1.5.0
- Create and activate a new environment.
conda create -n idcard python=3.6
source activate idcard
- Install Dependencies.
pip install -r requirements.txt
Download the image files (image and ground_truth).
Splits the data into training, test and validation data.
python prepare_dataset.py
python train.py
jupyter notebook "IDCard Prediction Test.ipynb"
python test.py test/sample1.png --output_mask=test/output_mask.png --output_prediction=test/output_pred.png --model=model.h5
Call python test.py --help
for possible arguments.
Starts Tensorboard Visualisation.
tensorboard --logdir=logs/
A U-NET was used as the model. U-Net is a convolutional neural network that was developed for biomedical image segmentation at the Computer Science Department of the University of Freiburg, Germany. The network is based on the fully convolutional networkand its architecture was modified and extended to work with fewer training images and to yield more precise segmentations. Segmentation of a 512*512 image takes less than a second on a modern GPU.
The Metric IoU (Intersection over Unit / Jaccard-Coefficient) was used
to measure the quality of the model.
The closer the Jaccard coefficient is to 1, the greater the similarity of the quantities. The minimum value of the Jaccard coefficient is 0.
Accuracy:
99.87%
Intersection over Unit:
0.9939