-
Notifications
You must be signed in to change notification settings - Fork 130
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
Showing
10 changed files
with
850 additions
and
56 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
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,36 @@ | ||
#!/bin/bash | ||
|
||
# Copyright xmuspeech (Author: Snowdar 2020-05-04) | ||
|
||
dir=data/voxceleb1 | ||
tasks="voxceleb1-O voxceleb1-O-clean voxceleb1-E voxceleb1-E-clean voxceleb1-H voxceleb1-H-clean" | ||
|
||
. subtools/parse_options.sh | ||
. subtools/path.sh | ||
|
||
[ "$dir" == "" ] && echo "[exit] Expected a dir to save trials, but got nothing." && exit 1 | ||
|
||
mkdir -p $dir | ||
|
||
for task in $tasks;do | ||
name="" | ||
[ "$task" == "voxceleb1-O" ] && name="veri_test.txt" | ||
[ "$task" == "voxceleb1-O-clean" ] && name="veri_test2.txt" | ||
[ "$task" == "voxceleb1-H" ] && name="list_test_hard.txt" | ||
[ "$task" == "voxceleb1-H-clean" ] && name="list_test_hard2.txt" | ||
[ "$task" == "voxceleb1-E" ] && name="list_test_all.txt" | ||
[ "$task" == "voxceleb1-E-clean" ] && name="list_test_all2.txt" | ||
|
||
[ "$name" == "" ] && echo "The $task task is invalid here. Please select from voxceleb1-O/E/H[-clean]." && exit 1 | ||
|
||
if [ ! -f $dir/$name ];then | ||
echo "The $dir/$name is not exist, so download it now...(If failed, download the list from" \ | ||
"http://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta by yourself.)" | ||
trap "rm -f $dir/$name && exit 1" INT | ||
wget -P $dir http://www.robots.ox.ac.uk/~vgg/data/voxceleb/meta/$name || (rm -f $dir/$name && exit 1) | ||
trap INT | ||
fi | ||
|
||
sed 's/\//-/g;s/\.wav//g' $dir/$name | awk '{if($1=="1"){print $2,$3,"target"}else{print $2,$3,"nontarget"}}' > $dir/${task}.trials | ||
echo "Generate $dir/${task}.trials 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
#!/usr/bin/perl | ||
# | ||
# Copyright 2018 Ewald Enzinger | ||
# 2018 David Snyder | ||
# 2019 Soonshin Seo | ||
# | ||
# Usage: make_voxceleb1_v2.pl /export/voxceleb1 dev data/dev | ||
# | ||
# The VoxCeleb1 corpus underwent several updates that changed the directory and speaker ID format. | ||
# The script 'make_voxceleb1.pl' works for the oldest version of the corpus. | ||
# This script should be used if you've downloaded the corpus recently. | ||
|
||
if (@ARGV != 3) { | ||
print STDERR "Usage: $0 <path-to-voxceleb1> <dataset> <path-to-data-dir>\n"; | ||
print STDERR "e.g. $0 /export/voxceleb1 dev data/dev\n"; | ||
exit(1); | ||
} | ||
|
||
($data_base, $dataset, $out_dir) = @ARGV; | ||
|
||
if ("$dataset" ne "dev" && "$dataset" ne "test") { | ||
die "dataset parameter must be 'dev' or 'test'!"; | ||
} | ||
|
||
if (system("mkdir -p $out_dir") != 0) { | ||
die "Error making directory $out_dir"; | ||
} | ||
|
||
opendir my $dh, "$data_base/$dataset/wav" or die "Cannot open directory: $!"; | ||
my @spkr_dirs = grep {-d "$data_base/$dataset/wav/$_" && ! /^\.{1,2}$/} readdir($dh); | ||
closedir $dh; | ||
|
||
if ($dataset eq "dev"){ | ||
open(SPKR_TRAIN, ">", "$out_dir/utt2spk") or die "could not open the output file $out_dir/utt2spk"; | ||
open(WAV_TRAIN, ">", "$out_dir/wav.scp") or die "could not open the output file $out_dir/wav.scp"; | ||
|
||
foreach (@spkr_dirs) { | ||
my $spkr_id = $_; | ||
opendir my $dh, "$data_base/$dataset/wav/$spkr_id/" or die "Cannot open directory: $!"; | ||
my @rec_dirs = grep {-d "$data_base/$dataset/wav/$spkr_id/$_" && ! /^\.{1,2}$/} readdir($dh); | ||
closedir $dh; | ||
foreach (@rec_dirs) { | ||
my $rec_id = $_; | ||
opendir my $dh, "$data_base/$dataset/wav/$spkr_id/$rec_id/" or die "Cannot open directory: $!"; | ||
my @files = map{s/\.[^.]+$//;$_}grep {/\.wav$/} readdir($dh); | ||
closedir $dh; | ||
foreach (@files) { | ||
my $name = $_; | ||
my $wav = "$data_base/$dataset/wav/$spkr_id/$rec_id/$name.wav"; | ||
my $utt_id = "$spkr_id-$rec_id-$name"; | ||
print WAV_TRAIN "$utt_id", " $wav", "\n"; | ||
print SPKR_TRAIN "$utt_id", " $spkr_id", "\n"; | ||
} | ||
} | ||
} | ||
close(SPKR_TRAIN) or die; | ||
close(WAV_TRAIN) or die; | ||
} | ||
|
||
if ($dataset eq "test"){ | ||
if (! -e "$data_base/voxceleb1_test_v2.txt") { | ||
system("wget -O $data_base/voxceleb1_test_v2.txt http://www.openslr.org/resources/49/voxceleb1_test_v2.txt"); | ||
} | ||
|
||
open(TRIAL_IN, "<", "$data_base/voxceleb1_test_v2.txt") or die "could not open the verification trials file $data_base/voxceleb1_test_v2.txt"; | ||
open(TRIAL_OUT, ">", "$out_dir/trials") or die "Could not open the output file $out_test_dir/trials"; | ||
open(SPKR_TEST, ">", "$out_dir/utt2spk") or die "could not open the output file $out_dir/utt2spk"; | ||
open(WAV_TEST, ">", "$out_dir/wav.scp") or die "could not open the output file $out_dir/wav.scp"; | ||
|
||
my $test_spkrs = (); | ||
while (<TRIAL_IN>) { | ||
chomp; | ||
my ($tar_or_non, $path1, $path2) = split; | ||
# Create entry for left-hand side of trial | ||
my ($spkr_id, $rec_id, $name) = split('/', $path1); | ||
$name =~ s/\.wav$//g; | ||
my $utt_id1 = "$spkr_id-$rec_id-$name"; | ||
$test_spkrs{$spkr_id} = (); | ||
|
||
# Create entry for right-hand side of trial | ||
my ($spkr_id, $rec_id, $name) = split('/', $path2); | ||
$name =~ s/\.wav$//g; | ||
my $utt_id2 = "$spkr_id-$rec_id-$name"; | ||
$test_spkrs{$spkr_id} = (); | ||
|
||
my $target = "nontarget"; | ||
if ($tar_or_non eq "1") { | ||
$target = "target"; | ||
} | ||
print TRIAL_OUT "$utt_id1 $utt_id2 $target\n"; | ||
} | ||
|
||
foreach (@spkr_dirs) { | ||
my $spkr_id = $_; | ||
opendir my $dh, "$data_base/$dataset/wav/$spkr_id/" or die "Cannot open directory: $!"; | ||
my @rec_dirs = grep {-d "$data_base/$dataset/wav/$spkr_id/$_" && ! /^\.{1,2}$/} readdir($dh); | ||
closedir $dh; | ||
foreach (@rec_dirs) { | ||
my $rec_id = $_; | ||
opendir my $dh, "$data_base/$dataset/wav/$spkr_id/$rec_id/" or die "Cannot open directory: $!"; | ||
my @files = map{s/\.[^.]+$//;$_}grep {/\.wav$/} readdir($dh); | ||
closedir $dh; | ||
foreach (@files) { | ||
my $name = $_; | ||
my $wav = "$data_base/$dataset/wav/$spkr_id/$rec_id/$name.wav"; | ||
my $utt_id = "$spkr_id-$rec_id-$name"; | ||
print WAV_TEST "$utt_id", " $wav", "\n"; | ||
print SPKR_TEST "$utt_id", " $spkr_id", "\n"; | ||
} | ||
} | ||
} | ||
close(SPKR_TEST) or die; | ||
close(WAV_TEST) or die; | ||
close(TRIAL_OUT) or die; | ||
close(TRIAL_IN) or die; | ||
} | ||
|
||
if (system( | ||
"utils/utt2spk_to_spk2utt.pl $out_dir/utt2spk >$out_dir/spk2utt") != 0) { | ||
die "Error creating spk2utt file in directory $out_dir"; | ||
} | ||
system("env LC_COLLATE=C utils/fix_data_dir.sh $out_dir"); | ||
if (system("env LC_COLLATE=C utils/validate_data_dir.sh --no-text --no-feats $out_dir") != 0) { | ||
die "Error validating directory $out_dir"; | ||
} |
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,70 @@ | ||
#!/usr/bin/perl | ||
# | ||
# Copyright 2018 Ewald Enzinger | ||
# | ||
# Usage: make_voxceleb2.pl /export/voxceleb2 dev data/dev | ||
# | ||
# Note: This script requires ffmpeg to be installed and its location included in $PATH. | ||
|
||
if (@ARGV != 3) { | ||
print STDERR "Usage: $0 <path-to-voxceleb2> <dataset> <path-to-data-dir>\n"; | ||
print STDERR "e.g. $0 /export/voxceleb2 dev data/dev\n"; | ||
exit(1); | ||
} | ||
|
||
# Check that ffmpeg is installed. | ||
if (`which ffmpeg` eq "") { | ||
die "Error: this script requires that ffmpeg is installed."; | ||
} | ||
|
||
($data_base, $dataset, $out_dir) = @ARGV; | ||
|
||
if ("$dataset" ne "dev" && "$dataset" ne "test") { | ||
die "dataset parameter must be 'dev' or 'test'!"; | ||
} | ||
|
||
opendir my $dh, "$data_base/$dataset/aac" or die "Cannot open directory: $!"; | ||
my @spkr_dirs = grep {-d "$data_base/$dataset/aac/$_" && ! /^\.{1,2}$/} readdir($dh); | ||
closedir $dh; | ||
|
||
if (system("mkdir -p $out_dir") != 0) { | ||
die "Error making directory $out_dir"; | ||
} | ||
|
||
open(SPKR, ">", "$out_dir/utt2spk") or die "Could not open the output file $out_dir/utt2spk"; | ||
open(WAV, ">", "$out_dir/wav.scp") or die "Could not open the output file $out_dir/wav.scp"; | ||
|
||
foreach (@spkr_dirs) { | ||
my $spkr_id = $_; | ||
|
||
opendir my $dh, "$data_base/$dataset/aac/$spkr_id/" or die "Cannot open directory: $!"; | ||
my @rec_dirs = grep {-d "$data_base/$dataset/aac/$spkr_id/$_" && ! /^\.{1,2}$/} readdir($dh); | ||
closedir $dh; | ||
|
||
foreach (@rec_dirs) { | ||
my $rec_id = $_; | ||
|
||
opendir my $dh, "$data_base/$dataset/aac/$spkr_id/$rec_id/" or die "Cannot open directory: $!"; | ||
my @files = map{s/\.[^.]+$//;$_}grep {/\.m4a$/} readdir($dh); | ||
closedir $dh; | ||
|
||
foreach (@files) { | ||
my $name = $_; | ||
my $wav = "ffmpeg -v 8 -i $data_base/$dataset/aac/$spkr_id/$rec_id/$name.m4a -f wav -acodec pcm_s16le -|"; | ||
my $utt_id = "$spkr_id-$rec_id-$name"; | ||
print WAV "$utt_id", " $wav", "\n"; | ||
print SPKR "$utt_id", " $spkr_id", "\n"; | ||
} | ||
} | ||
} | ||
close(SPKR) or die; | ||
close(WAV) or die; | ||
|
||
if (system( | ||
"utils/utt2spk_to_spk2utt.pl $out_dir/utt2spk >$out_dir/spk2utt") != 0) { | ||
die "Error creating spk2utt file in directory $out_dir"; | ||
} | ||
system("env LC_COLLATE=C utils/fix_data_dir.sh $out_dir"); | ||
if (system("env LC_COLLATE=C utils/validate_data_dir.sh --no-text --no-feats $out_dir") != 0) { | ||
die "Error validating directory $out_dir"; | ||
} |
Oops, something went wrong.