Skip to content

Commit 35a3fdc

Browse files
author
William Campbell
committed
examples unix version
1 parent 01a07cc commit 35a3fdc

File tree

2 files changed

+82
-82
lines changed

2 files changed

+82
-82
lines changed

examples/example_gsv.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
#!/usr/bin/env python
2-
3-
import json
4-
5-
from pyslgr.GMMModel import GMMSAD
6-
from pyslgr.GSV import GSV
7-
from pyslgr.LLSignal import LLSignal
8-
from pyslgr.MFCCFeatures import MFCCFeatures
9-
from pyslgr.FeatPipe import FeatPipe
10-
from pyslgr.sad import XtalkSAD
11-
12-
if __name__ == "__main__":
13-
14-
# Load example signal
15-
fn = 'signals/example.sph'
16-
x = LLSignal()
17-
x.load_sph(fn, 0)
18-
19-
# Initialize feature pipe
20-
mfcc_pipe_fn = "config/sid_mfcc+gmmsad_pipe.json"
21-
with open(mfcc_pipe_fn, 'r') as fp:
22-
pipe_config = json.load(fp)
23-
fpipe = FeatPipe(pipe_config, MFCCFeatures, GMMSAD)
24-
25-
# Get MFCCFeatures
26-
f = fpipe.process(x)
27-
28-
# Info
29-
print 'Number of output features: {}'.format(f.num_outfeat())
30-
# f.save_raw('tmp/gsv_feat.dat')
31-
32-
# Load in and create GSV
33-
with open('config/gsv.json', 'r') as fp:
34-
config = json.load(fp)
35-
gsv = GSV(config)
36-
37-
# Now compute a GSV expansion
38-
v = gsv.process(f)
39-
print 'A few elements of GSV expansion: {}'.format(v[0:10])
40-
print 'GSV expansion dimension = {}'.format(len(v))
41-
1+
#!/usr/bin/env python
2+
3+
import json
4+
5+
from pyslgr.GMMModel import GMMSAD
6+
from pyslgr.GSV import GSV
7+
from pyslgr.LLSignal import LLSignal
8+
from pyslgr.MFCCFeatures import MFCCFeatures
9+
from pyslgr.FeatPipe import FeatPipe
10+
from pyslgr.sad import XtalkSAD
11+
12+
if __name__ == "__main__":
13+
14+
# Load example signal
15+
fn = 'signals/example.sph'
16+
x = LLSignal()
17+
x.load_sph(fn, 0)
18+
19+
# Initialize feature pipe
20+
mfcc_pipe_fn = "config/sid_mfcc+gmmsad_pipe.json"
21+
with open(mfcc_pipe_fn, 'r') as fp:
22+
pipe_config = json.load(fp)
23+
fpipe = FeatPipe(pipe_config, MFCCFeatures, GMMSAD)
24+
25+
# Get MFCCFeatures
26+
f = fpipe.process(x)
27+
28+
# Info
29+
print 'Number of output features: {}'.format(f.num_outfeat())
30+
# f.save_raw('tmp/gsv_feat.dat')
31+
32+
# Load in and create GSV
33+
with open('config/gsv.json', 'r') as fp:
34+
config = json.load(fp)
35+
gsv = GSV(config)
36+
37+
# Now compute a GSV expansion
38+
v = gsv.process(f)
39+
print 'A few elements of GSV expansion: {}'.format(v[0:10])
40+
print 'GSV expansion dimension = {}'.format(len(v))
41+
4242
print 'Done! Successfully completed GSV tests'

examples/example_ivec.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
#!/usr/bin/env python
2-
3-
import json
4-
5-
from pyslgr.GMMModel import GMMSAD
6-
from pyslgr.iVector import iVector
7-
from pyslgr.LLSignal import LLSignal
8-
from pyslgr.MFCCFeatures import MFCCFeatures
9-
from pyslgr.FeatPipe import FeatPipe
10-
import sys
11-
12-
if __name__ == "__main__":
13-
14-
# Load example signal
15-
fn = 'signals/example.sph'
16-
x = LLSignal()
17-
x.load_sph(fn, 0)
18-
19-
# Initialize feature pipe
20-
mfcc_pipe_fn = "config/sid_mfcc+gmmsad_pipe.json"
21-
with open(mfcc_pipe_fn, 'r') as fp:
22-
pipe_config = json.load(fp)
23-
fpipe = FeatPipe(pipe_config, MFCCFeatures, GMMSAD)
24-
25-
# Get MFCCFeatures
26-
f = fpipe.process(x)
27-
28-
# Info
29-
print 'Number of output features: {}'.format(f.num_outfeat())
30-
# f.save_raw('tmp/ivec_feat.dat')
31-
32-
# Load in and create ivector
33-
with open('config/ivec.json', 'r') as fp:
34-
config = json.load(fp)
35-
ivec = iVector(config)
36-
37-
# Now compute an ivector
38-
v = ivec.process(f)
39-
print 'A few elements of iVector: {}'.format(v[0:10])
40-
print 'iVector dimension = {}'.format(len(v))
41-
1+
#!/usr/bin/env python
2+
3+
import json
4+
5+
from pyslgr.GMMModel import GMMSAD
6+
from pyslgr.iVector import iVector
7+
from pyslgr.LLSignal import LLSignal
8+
from pyslgr.MFCCFeatures import MFCCFeatures
9+
from pyslgr.FeatPipe import FeatPipe
10+
import sys
11+
12+
if __name__ == "__main__":
13+
14+
# Load example signal
15+
fn = 'signals/example.sph'
16+
x = LLSignal()
17+
x.load_sph(fn, 0)
18+
19+
# Initialize feature pipe
20+
mfcc_pipe_fn = "config/sid_mfcc+gmmsad_pipe.json"
21+
with open(mfcc_pipe_fn, 'r') as fp:
22+
pipe_config = json.load(fp)
23+
fpipe = FeatPipe(pipe_config, MFCCFeatures, GMMSAD)
24+
25+
# Get MFCCFeatures
26+
f = fpipe.process(x)
27+
28+
# Info
29+
print 'Number of output features: {}'.format(f.num_outfeat())
30+
# f.save_raw('tmp/ivec_feat.dat')
31+
32+
# Load in and create ivector
33+
with open('config/ivec.json', 'r') as fp:
34+
config = json.load(fp)
35+
ivec = iVector(config)
36+
37+
# Now compute an ivector
38+
v = ivec.process(f)
39+
print 'A few elements of iVector: {}'.format(v[0:10])
40+
print 'iVector dimension = {}'.format(len(v))
41+
4242
print 'Done! Successfully completed iVector tests'

0 commit comments

Comments
 (0)