This is achieved using a PyTorch implementation of SimCLR based on https://github.com/facebookresearch/moco, adapted so that the encoder consists of ResNet-18 followed by a representation network. Also, the QSSL method reference to QSSL
- Fingerprint Preprocessing
- dataset from Sokoto Coventry Fingerprint Dataset(kaggle)
![fingerprint image preprocessing](https://private-user-images.githubusercontent.com/79969875/275901720-e6fc9e3b-566d-4567-ac7a-a1cc68c6cb0a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NjA1MjksIm5iZiI6MTcyNTU2MDIyOSwicGF0aCI6Ii83OTk2OTg3NS8yNzU5MDE3MjAtZTZmYzllM2ItNTY2ZC00NTY3LWFjN2EtYTFjYzY4YzZjYjBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE4MTcwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhNjQ4MTg2NjUxZTRkY2Q5OWMwZGQ5ZWQyZmM2ODczNjVkNjQyODE5YjhkMGZjZjY2ZDY0YzcwZjdhZmU4NGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MToryNpvYZdM_ZxQxT9MwiWpWUy9dpEf1xOEe6fHlIg)
- Training Architecture(adapted from QSSL)
![fingerprint image preprocessing](https://private-user-images.githubusercontent.com/79969875/277249233-d91016f7-7284-431f-a690-dd28bd1d414d.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NjA1MjksIm5iZiI6MTcyNTU2MDIyOSwicGF0aCI6Ii83OTk2OTg3NS8yNzcyNDkyMzMtZDkxMDE2ZjctNzI4NC00MzFmLWE2OTAtZGQyOGJkMWQ0MTRkLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE4MTcwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThmOTI3YmY3YjM3MWRmZjRhMjgwOWNhZWFkNGNjZDI5MmNjZDg1NDYwMTYyZDEwYWVmZjBlYjhmZDY0ZTdkN2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GwGPl0HveK6XBXW2pvMZasqjRHgBsa2tHxQ11Teqh6U)
- Fingerprint Enhancement(Gabor Filter): Python implementation reference to author Utkarsh-Deshmukh Fingerprint-Enhancement-Python
- NOTE must clone the Fingerprint-Enhancement-Python first
- Fingerprint Canny Edge Detection
python train_simclr.py --gpu 0 --lr 1e-3 -b 256 -d data/ -w 8
Optional arguments:
--gpu gpu_id
--lr learning rate
-b batch_size
-d data_dir
-w width of representation network
NOTE You must clone quantum-neural-network and add it to your sys/python path first.
python train_simclr.py -q --q_backend qasm_simulator --q_ansatz sim_circ_14_half -w 8 --classes 5 --save-batches --epochs 2
Optional arguments:
-q Flag to use a quantum representation network
--q_backend Qiskit backend to use (can include real quantum devices)
--q_ansatz Variational ansatz for quantum neural network.
-w Width of representation network, in this case the number of qubits.
--classes Use the first N classes of the dataset
--save-batches Save the model after each batch (rather than epoch by default)
--epochs Number of epochs to train for (quantum training takes a long time)
The so called "ring" and "all-to-all" ansatzes used in the paper correspond to --q_anzatz sim_circ_14_half
and abbas
in these options respectively.
python linear_probe_simclr.py --pretrained model/selfsup/path_to_checkpoint_0000.path.tar -q --q_backend qasm_simulator --q_ansatz sim_circ_14_half -w 8 --classes 5
Optional arguments:
--pretrained path_to_self_sup_model
Jaderberg, B., Anderson, L.W., Xie, W., Albanie, S., Kiffner, M. and Jaksch, D., 2021. Quantum Self-Supervised Learning. arXiv preprint arXiv:2103.14653.