The pipeline details, experiments, ablations, and results are presented in the wandb report.
To get started install the requirements
pip install -r ./requirements.txt
Then download train data (ASVSpoof2019 dataset)
sudo apt install axel
bash loader.sh
This project implements RawNet2 model for anti-spoofing.
To train model from scratch run
python3 train.py -c asp/configs/train.json
For fine-tuning pretrained model from checkpoint, --resume
parameter is applied.
For example, continuing training model with train.json
config organized as follows
python3 train.py -c nv/configs/train.json -r saved/models/final/<run_id>/<any_checkpoint>.pth
Checkpoint should be located in default_test_model
directory. Pretrained model can be downloaded by running python code
import gdown
gdown.download("https://drive.google.com/uc?id=1HBDp__V5AGJacbhnaoQiC4g0wxizEFWa", "default_test_model/checkpoint.pth")
Model evaluation is executed by command
python3 test.py \
-i default_test_model/test \
-r default_test_model/checkpoint.pth \
-o output.csv \
-l False
-i
(--input-dir
) provide the path to directory with input audio files. The model classify them to bonafide/spoof.-r
(--resume
) provide the path to model checkpoint. Note that config file is expected to be in the same dir with nameconfig.json
.-o
(--output
) specify output.csv
file path. The dataframe with results will be saved there. Each row containsFilename
of audio.Logits
predicted by model (the first one corresponds to thespoof
target).Probs
calculated bysoftmax
of logits.Prediction
specifying the forecasted type (spoof
for fake,bonafide
for real).
-l
(--log-wandb
) determine log results to wandb project or not. IfTrue
, authorization in command line is needed. Name of project can be changed in the config file.
Running with default parameters
python3 test.py
The code of model is based on an asr-template project and notebook with SincNet implementation.