This project focuses on optimizing the parameters of a genetic algorithm (GA) to generate encrypted biometric images. The aim is to create cancelable biometric templates with high accuracy by fine-tuning the GA's crossover and mutation rates.
- Project Overview
- Prerequisites
- Installation
- Usage
- Project Structure
- Functions Description
- Acknowledgements
The project involves the following steps:
- Generate Initial Population: Create an initial population of encrypted biometric images using multiple rounds of XOR encryption with random keys.
- Optimize GA Parameters: Use the genetic algorithm to optimize the crossover and mutation rates for generating cancelable biometric templates.
- Evaluate Accuracy: Evaluate the accuracy of the cancelable templates generated by the GA.
- Python 3.x
- OpenCV
- NumPy
- Clone the repository:
git clone https://github.com/JayArcher9/TRWI.git cd TRWI
- Install the required Python packages:
pip install opencv-python numpy
- Place the original biometric image in the project directory. The image should be named
download.jpg
. - Run the main script:
python main.py
- The script will generate initial encrypted images and optimize the GA parameters, printing the accuracy scores for each combination of crossover and mutation rates.
main.py
: Main script to execute the project.generate_initial_population
: Function to generate initial population images using multiple rounds of encryption.optimize_ga_parameters
: Function to optimize GA parameters (crossover and mutation rates).evaluate_population
,select_parents
,crossover_and_mutate
,crossover
,mutate
,next_generation
: Helper functions for GA operations.
Generates an initial population of encrypted biometric images using XOR encryption.
Parameters:
original_biometric_image
: The original biometric image.num_images
: Number of initial population images to generate.num_rounds
: Number of encryption rounds.
Returns:
initial_population
: List of encrypted images.
Optimizes the genetic algorithm parameters (crossover and mutation rates) to find the best cancelable template.
Parameters:
initial_population
: Initial population of encrypted images.
Returns:
accuracy_scores
: Dictionary containing accuracy scores for each combination of crossover and mutation rates.
evaluate_population(population)
: Evaluates the fitness of each cancelable template in the population.select_parents(population, fitness_scores)
: Selects parent cancelable templates for reproduction based on fitness scores.crossover_and_mutate(parents, crossover_rate, mutation_rate)
: Performs crossover and mutation operations on the parent cancelable templates.crossover(parent1, parent2)
: Performs crossover operation on two parent cancelable templates.mutate(individual, mutation_rate)
: Performs mutation operation on a cancelable template.next_generation(population, offspring, fitness_scores, offspring_fitness)
: Combines the offspring and parents, and selects the fittest individuals for the next generation.
This project was developed using Python, OpenCV, and NumPy. Special thanks to the open-source community for providing valuable resources and libraries.