Fingerprint pattern classification using Deep Learning

Photo by Manu Designer on Dribbble

Fingerprint, as a unique feature of each person, can be divided into different types. In this project, we identify real fingerprints pattern and classify them with convolutional neural networks(CNN).

Dataset

The dataset is the original NIST 8-Bit Gray Scale Images of Fingerprint Image Groups(FIGS). It comprises 4000 images that are originally of size 512 x 512. The image size has been reduced to 128 x 128 for computational purposes. The resized dataset can be found here

The dataset is in the format:

  • file_name.png
  • file_name.txt

For example, f0038_02.png file will have a corresponding f0038_02.txt file

Sample of content in the text file

There are 5 different fingerprint patterns namely:

  • Arch (A)
  • Left Loop (L)
  • Right Loop (R)
  • Tented Arch (T)
  • Whirl (W)

Now that we know how our dataset looks like, we can start our project.

Importing the required libraries

First things first, let us import the required libraries.

https://gist.github.com/HSShashank/91971843b6aa2a88b37e896b7bb9a603

Getting the data

Get the data directly into your notebook and then unzip to save it.

Please note: The dataset will be available only in the runtime. So, if the runtime is restarted, you will have to download and unzip the dataset again.

https://gist.github.com/HSShashank/6fece1cddf6dabc9bebe21a92383fed9

Reading the text file

Now, let us read the text file and save the necessary information to a dataframe.

https://gist.github.com/HSShashank/a3b2ac7d0570ed1579375bee8473fa42

Checking data for class imbalance

For a multi-class classification, it is important for the dataset to be balanced. By balanced, we mean that the number of inputs for each class must be close to each other. In this case, our dataset is perfectly balanced.

Here we can see that the ‘GENDER’ column is not balanced, so we can drop that column.

https://gist.github.com/HSShashank/aa0893dd2e1de1301bc829de98997c90

Mapping the classes to an integer

Since, it is not possible for a neural network to learn using characters. It is important to map each of the class to an integer.

https://gist.github.com/HSShashank/826724da30aa563bb32428dbc736008b

Output of the code above

Plotting Images from each class

https://gist.github.com/HSShashank/ea8afeba58da41abd34f715af07d31c8

Types of fingerprint patterns

Data Preparation

Let us prepare data that can be feeded to the model.

https://gist.github.com/HSShashank/a9ad80e0f5d5d31199101a88e4742ce6

Sequential Model

Training a sequential model with 5 convolutional layers and 1 fully-connected layer.

https://gist.github.com/HSShashank/e1f74c03ecf08102b2366526417058ae

Hyperparameters and training

https://gist.github.com/HSShashank/9dba7a34eb6cf16e70105e66d020a1c3

Showing output ofthe last 5 epochs

Loss and Accuracy graphs

https://gist.github.com/HSShashank/3abec818437f7d866a841af61d367bc8

Plotting Predictions

Read images and labels from the test set and make predictions on random images with our model.

The images with [CORRECT] depict correctly classified images .

https://gist.github.com/HSShashank/9922309502f7cb6318ab0b59b3e852e2

Plotted Predictions

Conclusions

Hence, we have successfully trained a multi-class classifier with good accuracy to classify the different patterns of fingerprint.

Thanks for reading!

Notebook Link : Here

Credit: Shashank Hs