-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit demo code for Alize Speaker Recognition Project.
- Loading branch information
Showing
66 changed files
with
13,097 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,113 @@ | ||
package Demo; | ||
use strict; | ||
use warnings; | ||
|
||
require Exporter; | ||
our @ISA = qw(Exporter); | ||
our @EXPORT_OK = qw(ExactFeature EnergyDetect NormalizateFeature NormalizateFeatureForEnergy ); | ||
|
||
|
||
sub ExactFeature | ||
{ | ||
my ($energydetectorlist, $spherepath, $featurepath, $labelpath) = @_; | ||
|
||
ExactFeatureFromList($energydetectorlist, $spherepath, $featurepath); | ||
NormalizateFeatureForEnergy($energydetectorlist, $featurepath); | ||
EnergyDetect($energydetectorlist, $featurepath, $labelpath); | ||
NormalizateFeature($energydetectorlist,$featurepath, $labelpath); | ||
} | ||
|
||
|
||
sub ExactFeatureFromList | ||
{ | ||
my ($utterlistfilename, $sphfilepath, $featurepath) = @_; | ||
|
||
open(TFH, "<$utterlistfilename"); | ||
|
||
while (<TFH>) | ||
{ | ||
chomp; | ||
my @tmpelements = split /\\/; | ||
my $utterchannel = $tmpelements[$#tmpelements]; | ||
my $uttername; | ||
my $channelname; | ||
my $channelid = 0; | ||
my $channelindex = index($utterchannel, "_"); | ||
if ( $channelindex > 0 ) | ||
{ | ||
$uttername = substr($utterchannel, 0, $channelindex); | ||
$channelname = substr($utterchannel, $channelindex + 1, $channelindex + 2); | ||
if(lc($channelname) eq "a"){ $channelid = 1; } | ||
if(lc($channelname) eq "b"){ $channelid = 2; } | ||
} | ||
else | ||
{ | ||
$uttername = $utterchannel; | ||
$channelid = 1; | ||
} | ||
|
||
my $sourcefilename = "$sphfilepath$uttername.pcm"; | ||
my $targetfilename = "$featurepath$_.pro4"; | ||
|
||
ExercuteExactFeatureCmd($channelid, $sourcefilename, $targetfilename); | ||
|
||
} | ||
close(TFH); | ||
} | ||
|
||
|
||
sub ExercuteExactFeatureCmd | ||
{ | ||
my ($channelid, $sourcefilename, $targetfilename) = @_; | ||
|
||
my $cmdstr = "SproBin4.0\\sfbcep -F sphere -m -p 13 -n 24 -k 0.97 -e -D -i 300 -u 3400 -x $channelid $sourcefilename $targetfilename";#-Z -R # MFCC Feature | ||
#my $cmdstr = "SproBin4.0\\slpcep -F sphere -l 30 -n 18 -p 13 -e -D -x $channelid $sourcefilename $targetfilename";#-Z -R | ||
|
||
print $cmdstr, "\n"; | ||
system($cmdstr); | ||
|
||
} | ||
|
||
|
||
sub NormalizateFeatureForEnergy | ||
{ | ||
my ($inputfeaturefilename, $featurepath) = @_; | ||
|
||
my $normcmd = "AlizeBin2.0\\NormFeat --config conf\\NormFeatEnergy.cfg "; | ||
$normcmd .= " --inputFeatureFilename $inputfeaturefilename"; | ||
$normcmd .= " --featureFilesPath $featurepath"; | ||
|
||
print $normcmd,"\n"; | ||
system($normcmd) == 0 or die "Normalizate Feature For Energy Error£¡"; | ||
} | ||
|
||
|
||
sub EnergyDetect | ||
{ | ||
my ($inputfeaturefilename, $featurepath, $labelpath) = @_; | ||
|
||
my $detectcmd = "AlizeBin2.0\\EnergyDetector --config conf\\EnergyDetector.cfg "; | ||
$detectcmd .= " --featureFilesPath $featurepath"; | ||
$detectcmd .= " --labelFilesPath $labelpath"; | ||
$detectcmd .= " --inputFeatureFilename $inputfeaturefilename"; | ||
|
||
print $detectcmd,"\n"; | ||
system($detectcmd) == 0 or die "Energy Detect Error£¡"; | ||
} | ||
|
||
|
||
sub NormalizateFeature | ||
{ | ||
my ($inputfeaturefilename,$featurefilespath, $labelpath) = @_; | ||
|
||
my $normcmd = "AlizeBin2.0\\NormFeat --config conf\\NormFeat.cfg "; | ||
$normcmd .= " --inputFeatureFilename $inputfeaturefilename"; | ||
$normcmd .= " --featureFilesPath $featurefilespath"; | ||
$normcmd .= " --labelFilesPath $labelpath"; | ||
|
||
print $normcmd,"\n"; | ||
system($normcmd) == 0 or die "Normalization Feature Error£¡"; | ||
} | ||
|
||
|
||
1; |
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,17 @@ | ||
########################################################## | ||
# Voice Print Recognition | ||
# | ||
# Author: Bill Xia | ||
# Email: ibillxia@gmail.com | ||
# Blog: http://ibillxia.github.com | ||
########################################################## | ||
|
||
The Demo directory is a simple tutorial of how to use this integrated system. | ||
|
||
If you have any questions, you can go to | ||
------------------------------------------------------------------------------------------------- | ||
https://groups.google.com/forum/?hl=zh-CN&fromgroups=#!forum/alize---voice-print-recognition | ||
------------------------------------------------------------------------------------------------- | ||
for help. If you are every familiar with Alize, you can also go to the BBS to help others. | ||
Further more, if you are interested in making contributions to the Alize project with me, | ||
please send an email to me(ibillxia@gmail.com). |
Binary file not shown.
Binary file not shown.
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,56 @@ | ||
package Demo; | ||
use strict; | ||
use base 'Exporter'; | ||
our @EXPORT_OK = qw(TrainUBM TrainTarget ComputeTest ); | ||
|
||
|
||
sub TrainUBM | ||
{ | ||
my ($lambda, $inputfeaturefilename, $outputwordfilename) = @_; | ||
|
||
my $trainubm = "AlizeBin2.0\\TrainWorld --config conf\\TrainWorld.cfg "; | ||
$trainubm .= " --inputFeatureFilename $inputfeaturefilename "; | ||
$trainubm .= " --nbTrainIt 25"; | ||
$trainubm .= " --baggedFrameProbabilityInit 0.5"; | ||
$trainubm .= " --baggedFrameProbability 0.5"; | ||
$trainubm .= " --outputWorldFilename $outputwordfilename"; | ||
$trainubm .= " --fileInit false"; | ||
$trainubm .= " --lambda $lambda"; | ||
|
||
print $trainubm,"\n"; | ||
system($trainubm) == 0 or die "TrainUBM Error£¡"; | ||
} | ||
|
||
|
||
sub TrainTarget | ||
{ | ||
my ($targetidlist,$worldfilename,$FeatPath,$MixturePath) = @_; | ||
|
||
my $traintarget = "AlizeBin2.0\\TrainTarget --config conf\\TrainTarget.cfg "; | ||
$traintarget .= " --targetIdList $targetidlist"; | ||
$traintarget .= " --mixtureFilesPath $MixturePath"; | ||
$traintarget .= " --featureFilesPath $FeatPath"; | ||
$traintarget .= " --inputWorldFilename $worldfilename"; | ||
|
||
print $traintarget, "\n"; | ||
system($traintarget) == 0 or die "TrainTarget Error£¡"; | ||
} | ||
|
||
|
||
sub ComputeTest | ||
{ | ||
my ($testndxFilename, $testmodelPath, $testFeaturePath, $testLabelPath, $worldFilename, $resultfile) = @_; | ||
|
||
my $testtarget = "AlizeBin2.0\\ComputeTest --config conf\\ComputeTest.cfg "; | ||
$testtarget .= " --ndxFilename $testndxFilename"; | ||
$testtarget .= " --mixtureFilesPath $testmodelPath"; | ||
$testtarget .= " --featureFilesPath $testFeaturePath"; | ||
$testtarget .= " --labelFilesPath $testLabelPath"; | ||
$testtarget .= " --inputWorldFilename $worldFilename"; | ||
$testtarget .= " --outputFilename $resultfile"; | ||
|
||
print $testtarget,"\n"; | ||
system($testtarget) == 0 or die "ComputeTest Error£¡"; | ||
} | ||
|
||
1; |
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,16 @@ | ||
function EER = Compute_EER(P_miss,P_fa) | ||
|
||
|
||
%Zhenchun Lei 05-07-23 | ||
|
||
for j = 1 : size(P_miss, 1) | ||
if P_miss(j) >= P_fa(j) | ||
break | ||
end | ||
end | ||
|
||
if P_miss(j) == P_fa(j) | ||
EER = P_miss(j); | ||
else | ||
EER = (P_miss(j)+P_fa(j)+P_miss(j-1)+P_fa(j-1))/4; | ||
end |
Oops, something went wrong.