lixucuhk / ASV-anti-spoofing-with-Res2Net

Implementation of the paper: Replay and Synthetic Speech Detection with Res2Net architecture (ICASSP 2021) https://arxiv.org/abs/2010.15006
74 stars 14 forks source link

[: missing `]' in the line of [ -d data/spec/${name} ] cp -r data/${name} data/spec/${name} #4

Closed shahryarghayoor closed 2 years ago

shahryarghayoor commented 3 years ago

Hello dear Dr. Xu Li

My name is Shahryar Ghayour an I am working on your paper ''ASV-anti-spoofing-with-Res2Net''.

I have a question if you can help me please.

I have installed kaldi and made changes to your ''extract_feats.sh '' file and added my directory to the dataset. the question is when I put the file in terminal on linux there is an error in step 1.

when it reaches to this line : [ -d data/spec/${name} ] cp -r data/${name} data/spec/${name}

an error comes which is [: missing `]'

how can I make it work?

can you please tell me?

Thank you so much

lixucuhk commented 3 years ago

Hi Shahryar,

Thank you very much for your interest in our work! I saw that the command line you provide, i.e. "[ -d data/spec/${name} ] cp -r data/${name} data/spec/${name}", is not exactly the command in the line 42, Step 1, "extract_feats.sh". It should be "[ -d data/spec/${name} ] || cp -r data/${name} data/spec/${name} || exit 1". Please revise the command and see if the error still exists. Thank you!

shahryarghayoor commented 3 years ago

Hi Shahryar,

Thank you very much for your interest in our work! I saw that the command line you provide, i.e. "[ -d data/spec/${name} ] cp -r data/${name} data/spec/${name}", is not exactly the command in the line 42, Step 1, "extract_feats.sh". It should be "[ -d data/spec/${name} ] || cp -r data/${name} data/spec/${name} || exit 1". Please revise the command and see if the error still exists. Thank you!

Thank you so much for answering actually it went well untill step 3. there is a massage here :

Processing PA_train spec copy-feats --compress=true ark:- ark,scp:data/spec/PA_train/feats_slicing.ark,data/spec/PA_train/feats_slicing.scp LOG (copy-feats[5.5.985~1-94f37]:main():copy-feats.cc:143) Copied 113676 feature matrices. Processing PA_train cqt [Errno 2] No such file or directory: 'data/cqt/PA_train/feats.scp' copy-feats --compress=true ark:- ark,scp:data/cqt/PA_train/feats_slicing.ark,data/cqt/PA_train/feats_slicing.scp LOG (copy-feats[5.5.985~1-94f37]:main():copy-feats.cc:143) Copied 0 feature matrices. Exception in thread Thread-1: Traceback (most recent call last): File "/home/sh/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/home/sh/anaconda3/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/home/sh/.local/lib/python3.8/site-packages/kaldi_io/kaldi_io.py", line 97, in cleanup raise SubprocessFailed('cmd %s returned %d !' % (cmd,ret)) kaldi_io.kaldi_io.SubprocessFailed: cmd copy-feats --compress=true ark:- ark,scp:data/cqt/PA_train/feats_slicing.ark,data/cqt/PA_train/feats_slicing.scp returned 1 ! Traceback (most recent call last): File "feats_extraction/convertID2index.py", line 194, in convert_pa(opt.scp_file, opt.sysID_file, opt.out_file) File "feats_extraction/convertID2index.py", line 150, in convert_pa with open(systemID_file) as f: FileNotFoundError: [Errno 2] No such file or directory: 'data/cqt/PA_train/utt2systemID'

where did I make a mistake? can you tell me please?

lixucuhk commented 3 years ago

Hi Shahryar,

Thank you so much for pointing out this error. This could be a bug in my code. Actually, the missing utt2systemID file is identical to that in the data/PA_train directory, so you can copy the file from one to another. This also applies to the PA_dev, PA_eval, LA_train, LA_dev and LA_eval. I revised the extract_feats.sh script, and please see Line 52 to 55. Thank you!

shahryarghayoor commented 3 years ago

Hi Shahryar,

Thank you so much for pointing out this error. This could be a bug in my code. Actually, the missing utt2systemID file is identical to that in the data/PA_train directory, so you can copy the file from one to another. This also applies to the PA_dev, PA_eval, LA_train, LA_dev and LA_eval. I revised the extract_feats.sh script, and please see Line 52 to 55. Thank you!

Well thank you for your answer again. and it wokred as you mentioned. actually I think feature extraction is done completely by codes. But when I start the evaluaton step "start.sh" part, this error code comes and seems "utt2index" was not created: Traceback (most recent call last): File "train.py", line 172, in main(run_id, pretrained, data_files, model_params, training_params, device) File "train.py", line 62, in main train_data = SpoofDatsetSystemID(data_files['train_scp'], data_files['train_utt2index'], binary_class) File "/home/sh/Downloads/Compressed/ASV-anti-spoofing-with-EABN-main/data_reader/dataset_v1.py", line 42, in init with open(utt2index_file) as f: FileNotFoundError: [Errno 2] No such file or directory: 'data/cqt/PA_train/utt2index' Start evaluation on all checkpoints.

How can I create this file to avoid this problem?

lixucuhk commented 3 years ago

I guess you may skip Step 3 in the extract_feats.sh file. This step is necessary before training and evaluating our models, and it will create the utt2index file automatically. Thank you!

shahryarghayoor commented 3 years ago

I guess you may skip Step 3 in the extract_feats.sh file. This step is necessary before training and evaluating our models, and it will create the utt2index file automatically. Thank you!

Thank you and it worked fine because of your help. I came to step 4 where lfcc is being extracted. at this step I could extract lfcc fils as .txt file but stuck at line 12 of extaction where it should be converted to .ark and .scp files. unfortunatly this error occurs:

/home/sh/Downloads/Compressed/ASV-anti-spoofing-with-Res2Net/baseline/write_feature_kaldi_LA_LFCC.sh: line 12: copy-feats: command not found

this is because the output is a .txt file in lfcc folder. I am not sure if I am ready to go to the evaluation process. I started the "start.sh" and it started "Start training" stage.

lixucuhk commented 2 years ago

It seems that you need to install Kaldi and add the Kaldi path to the system before running the scripts.