-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c17da0c
commit 6b295d8
Showing
14 changed files
with
442 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
conda=/share/mini1/sw/std/python/anaconda3-2019.07/v3.7 | ||
conda_env=torch_1.9 | ||
source $conda/bin/activate $conda_env | ||
|
||
|
||
splits="train_nodev dev eval" | ||
|
||
for split in $splits ; do | ||
|
||
echo "[preprocess]: $split for vcc2020" | ||
python3 preprocess/preprocess_vcc2020.py \ | ||
--data_root downloads/vcc2020 \ | ||
--scp_dir data/vcc2020 \ | ||
--metadata_dir data/vcc2020/$split/ \ | ||
--split $split \ | ||
--max_workers 20 | ||
done | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import glob | ||
import argparse | ||
import os | ||
import sys | ||
import re | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--split', type = str) | ||
parser.add_argument('--db', type = str) | ||
parser.add_argument('--data_dir', type = str) | ||
parser.add_argument('--spk', type = str) | ||
parser.add_argument('--num_dev', type = int, default = 10) | ||
args = parser.parse_args() | ||
|
||
|
||
scp_path = os.path.join(args.data_dir, args.split, 'wav.scp') | ||
text_path = os.path.join(args.data_dir, args.split, 'text') | ||
os.makedirs(os.path.dirname(scp_path), exist_ok = True) | ||
|
||
f = open(scp_path, 'a') | ||
f_text = open(text_path, 'a') | ||
if args.split == 'eval': | ||
wav_paths = sorted(glob.glob(os.path.join(args.db, args.spk, '[EGFM]3*.wav' ))) | ||
else: | ||
wav_paths = list(sorted(glob.glob(os.path.join(args.db, args.spk, '[EGFM]1*.wav'))))\ | ||
+ list(sorted(glob.glob(os.path.join(args.db, args.spk, '[EGFM]2*.wav')))) | ||
if args.split == 'train_nodev': | ||
wav_paths = wav_paths[:-args.num_dev] | ||
elif args.split == 'dev': | ||
wav_paths = wav_paths[-args.num_dev:] | ||
|
||
for ind, wav_path in enumerate(wav_paths): | ||
basename = os.path.basename(wav_path).split('.')[0] | ||
if basename.startswith('E'): | ||
trans_path = os.path.join(args.db, 'prompts', 'Eng_transcriptions.txt') | ||
elif basename.startswith('G'): | ||
trans_path = os.path.join(args.db, 'prompts', 'Ger_transcriptions.txt') | ||
elif basename.startswith('F'): | ||
trans_path = os.path.join(args.db, 'prompts', 'Fin_transcriptions.txt') | ||
elif basename.startswith('M'): | ||
trans_path = os.path.join(args.db, 'prompts', 'Man_transcriptions.txt') | ||
|
||
|
||
id = f'{args.spk}_{basename}' | ||
for line in open(trans_path).readlines(): | ||
line = line.strip() | ||
if line.split()[0] == basename[1:]: | ||
text = ' '.join(line.split()[1:]) | ||
assert type(text) == str | ||
text = text.upper() | ||
if not basename.startswith('M'): | ||
text = re.sub(r"[^A-Z ]", '', text) | ||
f.write(f'{id} {wav_path}\n') | ||
f_text.write(f'{id} {text}\n') | ||
print(f'vcc2020 {args.split}: ({id} {wav_path}) {text}') | ||
|
||
f.close() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
|
||
db=downloads/vcc2020 | ||
data_dir=data/vcc2020 | ||
|
||
|
||
|
||
splits=("train_nodev" "dev" "eval") | ||
spks=("SEF1" "SEF2" "SEM1" "SEM2" "TEF1" "TEF2" "TEM1" "TEM2" "TGM1" "TGF1" "TFM1" "TFF1" "TMM1" "TMF1") | ||
|
||
for split in ${splits[*]}; do | ||
[ -e $data_dir/$split/wav.scp ] && rm $data_dir/$split/wav.scp | ||
[ -e $data_dir/$split/text ] && rm $data_dir/$split/text | ||
for spk in ${spks[*]}; do | ||
python3 dataset/vcc2020/data_prep.py \ | ||
--db $db \ | ||
--split $split \ | ||
--spk $spk \ | ||
--data_dir $data_dir | ||
done | ||
done | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.