This repository contains the source code of TypeFormer, a novel Transformer-based mobile keystroke verification system proposed in [1]. The model development and evaluation described is carried out over the Aalto Mobile Keystroke Database. The experimental protocol is the same as in [2], [3].
The model was developed from the following sources:
- https://github.com/getalp/Lightweight-Transformer-Models-For-HAR-on-Mobile-Devices
- https://github.com/lucidrains/block-recurrent-transformer-pytorch
- https://github.com/BiDAlab/ExploringTransformers
In this repository, we provide:
- The source code for TypeFormer [1], and for the preliminary Transformer in [2] in
model/Model.py
and inmodel/Preliminary.py
. - The scripts to train (
train.py
) and evaluate (test.py
) said models on the Aalto Mobile Keystroke Database. - The scripts to train (
KVC_train.py
) and evaluate (KVC_test.py
) said models on the Keystroke Verification Competition (KVC) . - The script to plot DET curves (
plot_DET.py
). - The script to plot loss and EER on the training and validation sets over the training epochs (
read_log.py
). - The script to plot t-SNE representation (
tSNE.py
). - Pretrained TypeFormer (
pretrained/TypeFormer_pretrained.pt
) and the preliminary Transformer (pretrained/preliminary_transformer_pretrained.pt
). - For the protocol adopted in the original papers [1, 2], adopted in the scripts
train.py
andtest.py
the preprocessed data on which we perform the experiments should be placed indata/
. Get in touch with the authors to get access to the data. - For the protocol adopted in the KVC, the data should be downloaded from CodaLab after joining the competition. The data should be placed in
../../databases/KVC_data/
. This directory is specified in the variableconfigs.data_dir
in theutils/KVC_config.py
script and it can be modified. We recommend this approach over the original experimental protocol.
If you use any of the parts of this repo, please cite:
@article{stragapede2022typeformer,
title={TypeFormer: Transformers for mobile keystroke biometrics},
author={Stragapede, Giuseppe and Delgado-Santos, Paula and Tolosana, Ruben and Vera-Rodriguez, Ruben and Guest, Richard and Morales, Aythami},
journal={arXiv preprint arXiv:2212.13075},
year={2022}
}
@inproceedings{stragapede2023mobile,
title={Mobile keystroke biometrics using transformers},
author={Stragapede, Giuseppe and Delgado-Santos, Paula and Tolosana, Ruben and Vera-Rodriguez, Ruben and Guest, Richard and Morales, Aythami},
booktitle={2023 IEEE 17th International Conference on Automatic Face and Gesture Recognition (FG)},
pages={1--6},
year={2023},
organization={IEEE}
}