Giter Club home page Giter Club logo

python-iris-recognition's Introduction

Iris Recognition

This is based on the work by Thuy Ng. His original Iris Recognition System implemented in both MatLab and Python can be found here.

Description

This system is incomplete for a real-world application. A complete system must have a specific camera to capture the iris of the eye. However, these cameras are very expensive. Therefore available image databases CASIA-IrisV1 and MMU2 are used to replace the costly cameras. All testing and machine learning classification are carried out using images in these databases.

Typically, a recognition system involves two operation modes, namely Enrollment and Verification.

Enrollment is extracting features from an eye image and saving it into a template database.

Verification allows users extract their features and match with existing entities in the template database to identify the origination of the input image.

These system utilizes all CPU cores to boost computation time.

Set Up

These system was deployed and executed on an Ubuntu 20.04 OS and the Python interpreter is Python 3.8.5.

First, create a virtual environment

python3 -m venv iris_venv 
source iris_venv/bin/activate

Clone this repository

git clone https://github.com/Th3nn3ss/python-iris-recognition.git
cd python-iris-recognition

Install requirements

cd iris/python
pip install -r requirements.txt

Folder Structure

.
+-- CASIA-database/
|   +-- 001_1_1.jpg
|   +-- ...
|   +-- 108_2_4.jpg
|

+-- MMU2-database/
|   +-- 010101.bmp
|   +-- ...
|   +-- 1000205.bmp

+-- python/
|   +-- fnc/
|       +-- boundary.py
|       +-- ...
|   +-- template-database/  # Created when an image is enrolled
|       +-- 1.mat
|       +-- ...
|   +-- enroll-casia1.py
|   +-- enroll-mmu2.py
|   +-- eval_casia1.py
|   +-- eval_mmu2.py
|   +-- requirements.txt
|   +-- verify.py
  • Folder CASIA-database includes original eye images. These system uses these images as the input.

  • Folder pythoncontains the following folders.

    • Folder fnc, this contains the back-end functions. _

    • Folder template-database stores registered template extracted from eye images, it is created when an image is enrolled.

    • File enroll-casia1.pyenrolls the images in the CASIA1 folder.

    • File enroll-mmu2.py enrolls the images in the MMU2 folder.

    • File eval-casia1.py is used to execute a Machine Learning Classification Algorithm that determines the Maximum fscore, Best eye_threshold and Best threshold for the CASIA1 Database. This process does not have to be repeated but you can re-run to check the following results,

      CASIA1-optimal.png

      File eval-mmu2.py is used to execute a Machine Learning Classification Algorithm that determines the Optimal Maximum fscore, Best eye_threshold and Best threshold for the images in the MMU2 Database. This process does not have to be repeated but you can re-run to check the following results.

      mmu2-optimal

      File verify.py is used to verify if an image sample can be recognized by the system from the pool of template images. The default threshold used for matching is 0.38.

Usage

To Enroll a set of images

python enroll-casia1.py

In the above example, we are enrolling the CASIA1 Database into the system. This encodes the specially selected images using regex and the outputs are stored in a templates database sub-folder, in the case of this example a CASIA1 sub-folder.

python enroll-casia1.py

To verify an image

python verify.py --file ../CASIA1/3/003_1_1.jpg --temp_dir ./templates/CASIA1/

In the above example, the file we are trying to verify is an image from the third folder in the CASIA1 Database. We point to the particular file by passing an argument to the --file flag.

Provided all images in the CASIA1 Database have been enrolled to the templates database. We can pass an argument to the --temp_dir flag, pointing to the templates sub-folder where the images were enrolled.

The default threshold used for matching is 0.38.

The outcome of the above code looks like this,

python verify.py

The image above shows that the image file 003_1_1.jpg matches 2 samples.

License

MIT

Alt

python-iris-recognition's People

Contributors

ntachukwu avatar prondubuisi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

python-iris-recognition's Issues

Runtime error on MAC trying Multi processing

Unlike Linux distros, both Windows and Macs do not support multi-processing functionality hence the error below,

RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.RuntimeError: 
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

This is a sample solution

I will be making a PR once I fix it for all files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.