Skip to content

Commit 4004482

Browse files
author
Suwon Shon
committed
some updates..
1 parent fc7dc76 commit 4004482

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

scripts/ivector_tools.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,13 @@ def read_ivector_key(file):
6060
return spkid, ivec_pointer,total_num
6161

6262
def length_norm(mat):
63-
mat = mat.transpose()
6463
norm_mat = []
6564
for line in mat:
6665
temp = line/np.math.sqrt(sum(np.power(line,2)))
6766
norm_mat.append(temp)
6867
norm_mat = np.array(norm_mat)
6968

70-
return norm_mat.transpose()
69+
return norm_mat
7170

7271
def lda(mat,label):
7372
# mat = observation x dim ( for example, 8x600 for 8 obs and 600dim ivector)

scripts/siamese_model.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ def network(self, x):
2626
n_prev_weight = int(x.get_shape()[1])
2727
conv1_d = tf.reshape(conv1r,[-1, n_prev_weight/stride*depth])
2828

29-
kernel_size =10
30-
stride = 2
31-
depth=10
32-
conv2 = self.conv_layer(conv1_d, kernel_size,stride,depth,'conv2')
33-
conv2r = tf.nn.relu(conv2)
34-
n_prev_weight = int(conv1_d.get_shape()[1])
35-
conv2_d = tf.reshape(conv2r,[-1, n_prev_weight/stride*depth])
29+
# kernel_size =10
30+
# stride = 2
31+
# depth=10
32+
# conv2 = self.conv_layer(conv1_d, kernel_size,stride,depth,'conv2')
33+
# conv2r = tf.nn.relu(conv2)
34+
# n_prev_weight = int(conv1_d.get_shape()[1])
35+
# conv2_d = tf.reshape(conv2r,[-1, n_prev_weight/stride*depth])
3636

3737
fc1 = self.fc_layer(conv1_d, 1500, "fc1")
3838
ac1 = tf.nn.relu(fc1)

train_ivector.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@
108108
"dev_ivectors = np.dot( np.subtract( dev_ivectors, m), W)\n",
109109
"tst_ivectors = np.dot( np.subtract( tst_ivectors, m), W)\n",
110110
"\n",
111-
"trn_ivectors = it.length_norm(trn_ivectors.transpose()).transpose()\n",
112-
"trndev_ivectors = it.length_norm(trndev_ivectors.transpose()).transpose()\n",
113-
"dev_ivectors = it.length_norm(dev_ivectors.transpose()).transpose()\n",
114-
"tst_ivectors = it.length_norm(tst_ivectors.transpose()).transpose()\n",
111+
"trn_ivectors = it.length_norm(trn_ivectors)\n",
112+
"trndev_ivectors = it.length_norm(trndev_ivectors)\n",
113+
"dev_ivectors = it.length_norm(dev_ivectors)\n",
114+
"tst_ivectors = it.length_norm(tst_ivectors)\n",
115115
"\n",
116116
"\n",
117117
"#language modeling\n",
@@ -120,7 +120,7 @@
120120
" lang_mean.append(np.mean(np.append(trndev_ivectors[np.nonzero(trndev_labels == i+1)] ,dev_ivectors[np.nonzero(dev_labels == i+1)],axis=0),axis=0))\n",
121121
"\n",
122122
"lang_mean = np.array(lang_mean)\n",
123-
"lang_mean = it.length_norm(lang_mean.transpose()).transpose()\n",
123+
"lang_mean = it.length_norm(lang_mean.transpose)\n",
124124
"\n",
125125
"print( np.shape(trn_ivectors), np.shape(dev_ivectors), np.shape(lang_mean),np.shape(tst_ivectors) )\n"
126126
]

0 commit comments

Comments
 (0)