def __call__(self, mfcc_file):
     start, end = self.likelihoods[1][mfcc_file]
     if VERBOSE:
         print mfcc_file
         print start, end
     _, posteriorgrams = viterbi(self.likelihoods[0][start:end],
                                 self.transitions,
                                 self.map_states_to_phones,
                                 using_bigram=self.using_bigram)
     assert (not (posteriorgrams == np.NaN).any())
     assert (not (self.likelihoods[0][start:end] == np.NaN).any())
     self.write_file(mfcc_file, start, end, posteriorgrams)
示例#2
0
 def __call__(self, mfcc_file):
     start, end = self.likelihoods[1][mfcc_file]
     if VERBOSE:
         print mfcc_file
         print start, end
     _, posteriorgrams = viterbi(self.likelihoods[0][start:end],
                                self.transitions, 
                                self.map_states_to_phones,
                                using_bigram=self.using_bigram)
     assert(not (posteriorgrams == np.NaN).any())
     assert(not (self.likelihoods[0][start:end] == np.NaN).any())
     self.write_file(mfcc_file, start, end, posteriorgrams)
        dbn = cPickle.load(idbnf)
    with open(sys.argv[4]) as idbndtf:
        dbn_to_int_to_state_tuple = cPickle.load(idbndtf)
    dbn_phones_to_states = dbn_to_int_to_state_tuple[0]
    likelihoods_computer = functools.partial(
        reconstruct_articulatory_features_likelihoods, dbn)

# TODO bigrams
transitions = initialize_transitions(transitions)
#print transitions
transitions = penalty_scale(transitions,
                            insertion_penalty=INSERTION_PENALTY,
                            scale_factor=SCALE_FACTOR)

dummy = np.ndarray((2, 2))  # to force only 1 compile of Viterbi's C
viterbi(dummy, [None, dummy], {})  # also for this compile's debug purposes

list_of_mfcc_files = []
for d, ds, fs in os.walk(sys.argv[1]):
    for fname in fs:
        if fname[-4:] != '.mfc':
            continue
        fullname = d.rstrip('/') + '/' + fname
        list_of_mfcc_files.append(fullname)
#print list_of_mfcc_files

if dbn != None:
    input_n_frames_mfcc = dbn.rbm_layers[0].n_visible / 39  # TODO generalize
    input_n_frames_arti = dbn.rbm_layers[
        1].n_visible / 59  # 60 # TODO generalize
    print "this is a DBN with", input_n_frames_mfcc, "MFCC frames on the input layer"
示例#4
0
    from DBN_Gaussian_mocha_timit import DBN
    with open(sys.argv[3]) as idbnf:
        dbn = cPickle.load(idbnf)
    with open(sys.argv[4]) as idbndtf:
        dbn_to_int_to_state_tuple = cPickle.load(idbndtf)
    dbn_phones_to_states = dbn_to_int_to_state_tuple[0]
    likelihoods_computer = functools.partial(reconstruct_articulatory_features_likelihoods, dbn)

# TODO bigrams
transitions = initialize_transitions(transitions)
#print transitions
transitions = penalty_scale(transitions, insertion_penalty=INSERTION_PENALTY,
        scale_factor=SCALE_FACTOR)

dummy = np.ndarray((2,2)) # to force only 1 compile of Viterbi's C
viterbi(dummy, [None, dummy], {}) # also for this compile's debug purposes

list_of_mfcc_files = []
for d, ds, fs in os.walk(sys.argv[1]):
    for fname in fs:
        if fname[-4:] != '.mfc':
            continue
        fullname = d.rstrip('/') + '/' + fname
        list_of_mfcc_files.append(fullname)
#print list_of_mfcc_files

if dbn != None:
    input_n_frames_mfcc = dbn.rbm_layers[0].n_visible / 39 # TODO generalize
    input_n_frames_arti = dbn.rbm_layers[1].n_visible / 59 # 60 # TODO generalize
    print "this is a DBN with", input_n_frames_mfcc, "MFCC frames on the input layer"
    print "and", input_n_frames_arti, "articulatory frames on the other input layer"