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).


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.

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.

Reading the text file

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

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.

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.

Output of the code above

Plotting Images from each class

Types of fingerprint patterns

Data Preparation

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

Sequential Model

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

Hyperparameters and training

Showing output ofthe last 5 epochs

Loss and Accuracy graphs

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 .

Plotted Predictions


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