Code Monkey home page Code Monkey logo

qssl's Introduction

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 image preprocessing
  • Training Architecture(adapted from QSSL)
fingerprint image preprocessing

Fingerprint Image Preprocessing

  1. Fingerprint Enhancement(Gabor Filter): Python implementation reference to author Utkarsh-Deshmukh Fingerprint-Enhancement-Python
  2. Fingerprint Canny Edge Detection

Self-supervised Training with Classical Representation Network

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

Self-supervised Training with Quantum 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.

Linear Probing the Above Quantum Model

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

Reference

Jaderberg, B., Anderson, L.W., Xie, W., Albanie, S., Kiffner, M. and Jaksch, D., 2021. Quantum Self-Supervised Learning. arXiv preprint arXiv:2103.14653.

qssl's People

Contributors

allenlin316 avatar

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.