Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
riebling committed Aug 28, 2017
1 parent d21b65c commit b1d116c
Show file tree
Hide file tree
Showing 95 changed files with 10,690 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fabio Valente ([email protected])
Deepu Vijayasenan ([email protected])
David Imseng ([email protected])
Srikanth Madikeri ([email protected])
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For installation instructions, see src/diarization/README
39 changes: 39 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
This README file explains, in brief, the commands to
compile and run the IB diarization toolkit.

# PREREQUISITES

There are three prerequisites to the package

1) Cmake -- required to build the package
2) libboost -- boost library for C++
3) openmp library -- for multithreaded processing

# CLEAN COMPILATION

$> cd src/diarization/cmake/
$> cmake .
$> # make clean if cmake has already been run once
$> make

# TO RUN

$> # cd to $IB_DIARIZATION_HOME
$> bash scripts/run.diarizeme.sh ipfile scpfile opfolder fileid [betaval]


Example command

$> bash scripts/run.diarizeme.sh data/mfcc/AMI_20050204-1206.fea data/scp/AMI_20050204-1206.scp result.dir/ AMI_20050204-1206

To test the result use md-perl-eval tool available on the NIST website

$> perl md-eval-v21.pl -m -afc -c 0.25 -r data/rttm/AMI_20050204-1206.rttm -s result.dir/AMI_20050204-1206.rttm

The expected DER is 8.79%

To add TDOA features, use the following script

$>bash scripts/run.diarizeme.tdoa.sh data/mfcc/$AMI_20050204-1206.fea 0.8 data/tdoa/$AMI_20050204-1206.fea 0.2 data/scp/$AMI_20050204-1206.scp result.dir.tdoa $AMI_20050204-1206

The expected DER is 7.12%
Binary file added data/mfcc/AMI_20050204-1206.fea
Binary file not shown.
333 changes: 333 additions & 0 deletions data/rttm/AMI_20050204-1206.rttm

Large diffs are not rendered by default.

333 changes: 333 additions & 0 deletions data/scp/AMI_20050204-1206.scp

Large diffs are not rendered by default.

Binary file added data/tdoa/AMI_20050204-1206.fea
Binary file not shown.
Binary file added lib/libboost_filesystem-mt.so.1.53.0
Binary file not shown.
Binary file added lib/libboost_program_options-mt.so.1.53.0
Binary file not shown.
Binary file added lib/libboost_system-mt.so.1.53.0
Binary file not shown.
35 changes: 35 additions & 0 deletions scripts/run.diarizeme.qsub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diarizeme_bin=/idiap/temp/msrikanth/repo/idiap-aib-diarization-dimseng/src/diarization/cmake/diarizeme
beta_val=10

numargs=3
if [ $# -lt $numargs ]; then
echo "Usage: bash run.diarizeme.sh iplist scpfolder opfolder"
exit
fi

iplist=$1
scpfolder=$2
opdir=$3

export nthreads=1

if [ -e $opdir -a ! -d $opdir ]; then
echo "Warning: $opdir exists but is not a directory"
exit
elif [ ! -d $opdir ]; then
mkdir $opdir
fi

for fname in `cat $iplist`; do
fileid=`basename $fname .fea`
scpfile=$scpfolder/$fileid.scp
echo "$diarizeme_bin \
--mfcc $fname 1.0 \
--recid $fileid \
--outdir $opdir \
--tmpdir $opdir \
-s $scpfile \
--beta $beta_val \
--nthread 1 > $opdir/$fileid.out" > temp.$fileid.sh
qsub -l q1d temp.$fileid.sh
done
50 changes: 50 additions & 0 deletions scripts/run.diarizeme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
trap "exit" SIGINT


diarizeme_bin=src/diarization/cmake/diarizeme
beta_val=10

numargs=4
if [ $# -lt $numargs ]; then
echo "Usage: bash run.diarizeme.sh ipfile scpfile opfolder fileid [betaval]"
echo ""
echo "ipfile : Input file with MFCC features in HTK format"
echo "scpfile : file with speech boundaries in the following format"
echo " segment_name=file_name[start_frame,end_frame]"
echo "outdir : directory to store temporary files and output rttm in"
echo "fileid : ID of the file (to be used in rttm output)"
echo "betaval : (optional) beta value for IB clustering"
exit
fi

BASEDIR="$( cd "$(dirname "$0")" ; pwd -P )"
export LD_LIBRARY_PATH=$BASEDIR/../lib/

fname=$1
scpfile=$2
opdir=$3
fileid=$4

if [ $# -eq 5 ]; then
beta_val=$5
fi

if [ -z $nthreads ]; then
export nthreads=3
fi

if [ -e $opdir -a ! -d $opdir ]; then
echo "Warning: $opdir exists but is not a directory"
exit
elif [ ! -d $opdir ]; then
mkdir -p $opdir
fi

$diarizeme_bin \
--mfcc $fname 1.0 \
--recid $fileid \
--outdir $opdir \
--tmpdir $opdir \
-s $scpfile \
--beta $beta_val \
--nthread $nthreads > $opdir/$fileid.out
54 changes: 54 additions & 0 deletions scripts/run.diarizeme.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
trap "exit" SIGINT


diarizeme_bin=src/diarization/cmake/diarizeme
beta_val=10

numargs=4
if [ $# -lt $numargs ]; then
echo "Usage: bash run.diarizeme.sh ipfile scpfile opfolder fileid [betaval]"
echo ""
echo "ipfile : Input file with MFCC features in HTK format"
echo "scpfile : file with speech boundaries in the following format"
echo " segment_name=file_name[start_frame,end_frame]"
echo "outdir : directory to store temporary files and output rttm in"
echo "fileid : ID of the file (to be used in rttm output)"
echo "betaval : (optional) beta value for IB clustering"
exit
fi

BASEDIR="$( cd "$(dirname "$0")" ; pwd -P )"
#export LD_LIBRARY_PATH=$BASEDIR/../lib/
LD_LIBRARY_PATH=$BASEDIR/../lib/

echo $LD_LIBRARY_PATH
ls $LD_LIBRARY_PATH

fname=$1
scpfile=$2
opdir=$3
fileid=$4

if [ $# -eq 5 ]; then
beta_val=$5
fi

if [ -z $nthreads ]; then
export nthreads=3
fi

if [ -e $opdir -a ! -d $opdir ]; then
echo "Warning: $opdir exists but is not a directory"
exit
elif [ ! -d $opdir ]; then
mkdir -p $opdir
fi

$diarizeme_bin \
--mfcc $fname 1.0 \
--recid $fileid \
--outdir $opdir \
--tmpdir $opdir \
-s $scpfile \
--beta $beta_val \
--nthread $nthreads > $opdir/$fileid.out
63 changes: 63 additions & 0 deletions scripts/run.diarizeme.tdoa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
trap "exit" SIGINT

diarizeme_bin=src/diarization/cmake/diarizeme
beta_val=10

numargs=7
if [ $# -lt $numargs ]; then
echo -ne "Usage: bash run.diarizeme.sh mfccfile mfccwt"
echo " tdoafile tdoawt scpfile opfolder fileid [betaval]"
echo ""
echo "mfccfile : Input file with MFCC features in HTK format"
echo "mfccwt : a value between 0.0 and 1.0 as a weight on MFCC features"
echo "tdoafile : Input file with TDOA features in TDOA format"
echo "tdoawt : a value between 0.0 and 1.0 as a weight on TDOA features"
echo "scpfile : file with speech boundaries in the following format"
echo " segment_name=file_name[start_frame,end_frame]"
echo "outdir : directory to store temporary files and output rttm in"
echo "fileid : ID of the file (to be used in rttm output)"
echo "betaval : (optional) beta value for IB clustering"
exit
fi

fname=$1
fwt=$2
tdoafname=$3
tdoawt=$4
scpfile=$5
opdir=$6
fileid=$7

if [ $# -eq 8 ]; then
beta_val=$8
fi

export nthreads=1

if [ -e $opdir -a ! -d $opdir ]; then
echo "Warning: $opdir exists but is not a directory"
exit
elif [ ! -d $opdir ]; then
mkdir $opdir
fi

echo $diarizeme_bin \
--mfcc $fname $fwt \
--tdoa $tdoafname $tdoawt \
--recid $fname \
--outdir $opdir \
--tmpdir $opdir \
-s $scpfile \
--beta $beta_val \
--nthread 1


$diarizeme_bin \
--mfcc $fname $fwt \
--tdoa $tdoafname $tdoawt \
--recid $fileid \
--outdir $opdir \
--tmpdir $opdir \
-s $scpfile \
--beta $beta_val \
--nthread 1 > $opdir/$fileid.out
146 changes: 146 additions & 0 deletions src/aIB/include/aIB.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// Copyright (c) 2015 Idiap Research Institute, http://www.idiap.ch/
// Written by Fabio Valente <[email protected]>
// Written by Deepu Vijayasenan <[email protected]>
// Written by David Imseng <[email protected]>
// Written by Srikanth Madikeri <[email protected]>
//
// This file is part of the IB Speaker Diarization Toolkit.
//
// IB diarization toolkit is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// version 3 as published by the Free Software Foundation.
//
// The IB Speaker Diarization Toolkit is distributed in the hope that it
// will be useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the IB Speaker Diarization Toolkit. If not, see
// <http://www.gnu.org/licenses/>.


#ifndef AIB_H
#define AIB_H


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include <iostream>
#include <vector>
#include <map>
#include "tools.h"

using namespace std;
using namespace libtools;



struct bestmerge {
int bm_l;
int bm_r;
};



class Prm {
public:

Prm();

Prm(unsigned int xx,unsigned int yy,double Bbeta, int isUniformpriors);

Prm(unsigned int xx,unsigned int yy,double Bbeta, int isUniformpriors, vector <int>);

Prm(vector < vector <double> > *MM,double Bbeta, int isUniformpriors, vector <int> );

~Prm();

unsigned int getX();
unsigned int getY();
double getBeta();
int getUniformPriors();
const vector <int> * getTsizes();

protected:
unsigned int X,Y;
double beta;
vector <int>* Tsizes;
int Uniformpriors;
};


class Inp {
public:
Inp(vector < vector <double> > * M, int Uniform);
~Inp();
double getI();
double getHx();
double getHy();
const vector <vector <double> > *get_Py_x();
const vector <double> *get_Px();

protected:
vector < vector <double> > *Py_x;
vector < vector <double> > *Pxy;
vector <double> *Py;
vector <double> *Px;
MIvalues initialmi;
};


class TmpT{
public:
TmpT(Inp * input, Prm * currprm);
~TmpT();
int get_tmpT_size();
vector<double>* get_Py_t(int ii);
vector<int>* get_Pt_x();
double get_Info_Ity(int ii);
double get_Pt(int ii);
int get_tmpt_size();
double get_Info_Ht(int ii);
void updatemergelog(unsigned int thismerge, int l,int r);
void updateDelta(unsigned int thismerge,double deltavalue);
void updateclustering(int thisr, int newval);
void updatePy_t(int thisl, int thisr);
void updatePt(int thisl, int thisr);
void updateInfoValues(int thisl, int thisr,double beta, double thisdelta);
void updateDeltaL(vector< vector<double> >* delta, TmpT* loctmpt, int thisl, int thisr, double beta,functionals ff);

protected:
vector <vector <int> > *MergeLog;
vector <double> *Info_Ity;
vector <double> *Info_Ht;
vector <double> *Info_deltaL;
//AAACTHUNG tmpt_size is the index of the last element in the vectors/matrix not its size - this mess up is because in the original MATLAB notation vectors start from 1 - so let's stick to Slonim ...
int tmpt_size;
int prevTsize;
double pi_l,pi_r;
vector <int> *Pt_x;
vector < vector <double> > *Py_t;
vector <double> *Pt;
};



class TT_elem {
public:
TT_elem(TmpT *r_tmpt, Inp *r_inp, Prm * r_prm);
double get_Ity();
vector <int> * get_Pt_x();
~TT_elem();

protected:
vector <int> *Pt_x;
double Ity;
double Ht;
double Ity_div_Ixy;
double Ht_div_Hx;
int size;
};


#endif
Loading

0 comments on commit b1d116c

Please sign in to comment.