Skip to content

Commit

Permalink
adding single gaussian without viterbi code
Browse files Browse the repository at this point in the history
  • Loading branch information
jitendrab committed Apr 2, 2014
1 parent b81f91b commit c19ca0c
Show file tree
Hide file tree
Showing 160 changed files with 740,931 additions and 154,174 deletions.
11,265 changes: 11,265 additions & 0 deletions c_code/diarization_single/src/IS1007a.rttm~

Large diffs are not rendered by default.

11,264 changes: 11,264 additions & 0 deletions c_code/diarization_single/src/IS1007a_19mfcc.rttm

Large diffs are not rendered by default.

19,137 changes: 19,137 additions & 0 deletions c_code/diarization_single/src/IS1007a_mfcc_0.rttm

Large diffs are not rendered by default.

193,201 changes: 96,598 additions & 96,603 deletions c_code/diarization_single/src/feature_file_all.txt

Large diffs are not rendered by default.

115,099 changes: 57,547 additions & 57,552 deletions c_code/diarization_single/src/plot_data.txt

Large diffs are not rendered by default.

Binary file modified c_code/diarization_single/src/pre
Binary file not shown.
34 changes: 16 additions & 18 deletions c_code/diarization_single/src/viterbi_realign.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ int* viterbi( VECTOR_OF_F_VECTORS *features, int *numStates,
//clear any remainings
for(i = 0; i < *numStates; i++){
for(j = 0; j < totalNumFeatures; j++){
T1[i][j] = 0.0;
T2[i][j] = 0;
T1[i][j] = 0.0; //T1 as delta matrix(in book)
T2[i][j] = 0; // T2 as Si matrix
}
}
for(i = 0; i < (*numStates); i++){
Expand All @@ -40,33 +40,31 @@ int* viterbi( VECTOR_OF_F_VECTORS *features, int *numStates,
int max_prob_state = 0;
//printf(" %f ", B[j][i]);
for(k = 0; k < (*numStates); k++){
if(( T1[k][i-1] + A + B[j][i]) > max_prob){
max_prob = T1[k][i-1] + A + B[j][i];
if((T1[k][i-1] + A ) > max_prob){
max_prob = T1[k][i-1] + A;
max_prob_state = k;
}
}
T1[j][i] = max_prob;
T1[j][i] = max_prob + B[j][i];
T2[j][i] = max_prob_state;
//printf("max_prob_state: %d\n", max_prob_state);
}
}
int *Z = (int *)calloc(totalNumFeatures, sizeof(int));
// there is an logical algorithmic error in below code
for(i = 0; i < totalNumFeatures; i++){
float max_prob = -9999999;
max_prob_state = 0;
for(k = 0; k < (*numStates); k++){
if( T1[k][i] > max_prob){
max_prob = T1[k][i];
max_prob_state = k;
}
float max_prob = -999999;
int max_state = 0;
for(i = 0; i < *numStates; i++){
if( T1[i][totalNumFeatures-1] > max_prob){
max_prob = T1[i][totalNumFeatures-1];
max_state = i;
}
Z[i] = max_prob_state;
}
hiddenStateSeq[totalNumFeatures - 1] = max_prob_state;
for(i = totalNumFeatures - 1; i > 0; i--){
int s = Z[i-1];
hiddenStateSeq[i-1] = T2[s][i];
hiddenStateSeq[totalNumFeatures-1] = max_state;
int t = 0;
for(t = totalNumFeatures-2; t >= 0; t--){
int idx = hiddenStateSeq[t+1];
hiddenStateSeq[t] = T2[idx][t+1];
}

return CheckMinDuration(features , hiddenStateSeq, numStates, allMixtureMeans, allMixtureVars,
Expand Down
2 changes: 1 addition & 1 deletion c_code/diarization_single/src/viterbi_realign.c~
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int* viterbi( VECTOR_OF_F_VECTORS *features, int *numStates,
}
}
int *Z = (int *)calloc(totalNumFeatures, sizeof(int));

// there is an logical algorithmic error in below code
for(i = 0; i < totalNumFeatures; i++){
float max_prob = -9999999;
max_prob_state = 0;
Expand Down
24 changes: 24 additions & 0 deletions c_code/signle_diag_gaussian_no_viterbi/Makefile~
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BASEDIR = /home/jitu/btp/iitm/preprocessing
SRCDIR = $(BASEDIR)/src
DSPLIB = $(BASEDIR)/src
OBJDIR = $(BASEDIR)/obj
BINDIR = $(BASEDIR)/bin

all:$(BINDIR)/diarization

$(BINDIR)/diarization: $(OBJDIR)/preprocessing.o $(OBJDIR)/VQ_Modified.o $(OBJDIR)/GMM.o $(OBJDIR)/viterbi_realign.o
gcc $(OBJDIR)/preprocessing.o $(OBJDIR)/VQ_Modified.o $(OBJDIR)/GMM.o $(OBJDIR)/viterbi_realign.o -o $(BINDIR)/diarization

$(OBJDIR)/viterbi_realign.o: $(SRCDIR)/viterbi_realign.c
gcc -c $(SRCDIR)/viterbi_realign.c

$(OBJDIR)/GMM.o: $(SRCDIR)/GMM.c
gcc -c $(SRCDIR)/GMM.c

$(OBJDIR)/VQ_Modified.o: $(SRCDIR)/VQ_Modified.c
gcc -c $(SRCDIR)/VQ_Modified.c

$(OBJDIR)/preprocessing.o: $(SRCDIR)/preprocessing.c
gcc -c $(SRCDIR)/preprocessing.c
clean: rm $(OBJDIR)/*.o
rm bin/diarization
Empty file.
Loading

0 comments on commit c19ca0c

Please sign in to comment.