def predict(m, fs, signal, da):
        try:
            feat = mix_feature((fs, signal))
            feat = da.get_hidden_values(feat).eval()
        except Exception as e:
            return None
        return m.gmmset.predict_one(feat)
コード例 #2
0
 def enroll(self, name, fs, signal):
     """
     add the signal to this person's training dataset
     name: person's name
     """
     feat = mix_feature((fs, signal))
     self.features[name].extend(feat)
コード例 #3
0
 def predict(self, fs, signal):
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     return self.gmmset.predict_one(feat)
コード例 #4
0
 def enroll(self, name, fs, signal):
     """
     add the signal to this person's training dataset
     name: person's name
     """
     feat = mix_feature((fs, signal))
     self.features[name].extend(feat)
 def predict(self, fs, signal):
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     return self.gmmset.predict_one(feat)
コード例 #6
0
 def predict(self, fs, signal):
     """
     return a label (name)
     """
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print(tb.format_exc())
         return None
     return self.gmmset.predict_one(feat)
コード例 #7
0
 def predict_scores(self, fs, signal):
     """
     return scores
     """
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     return self.gmmset.predict_scores(feat)
def predict(m, fs, signal, da, up_bound, lower_bound):
        try:
            feat = mix_feature((fs, signal))
            # put all values into -1~1
            for i in xrange(len(feat)):
    						for j in xrange(len(feat[0])):
    								feat[i][j] = 2*((feat[i][j]-lower_bound[j]) / (up_bound[j]-lower_bound[j]))-1
            feat = da.get_hidden_values(feat).eval()
        except Exception as e:
            return None
        return m.gmmset.predict_one(feat)
コード例 #9
0
 def predict_with_score(self, fs, signal):
     """
     return a label (name)
     """
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     # gmmset = GMMSet() = gmmset.GMMSetPyGMM
     return self.gmmset.predict_one_with_score(feat)
コード例 #10
0
def test_model(mods,path = "./tmp.wav"):
	fs, signal = read_wav(path)
	feat = mix_feature((fs, signal))
	x = feat
	scores = [mods.gmmset.gmm_score(gmm, x) / len(x) for gmm in mods.gmmset.gmms]
	import operator
	p = sorted(enumerate(scores), key=operator.itemgetter(1), reverse=True)
	p = [(str(mods.gmmset.y[i]), y, p[0][1] - y) for i, y in p]
	result = [(mods.gmmset.y[index], value) for (index, value) in enumerate(scores)]
	p = max(result, key=operator.itemgetter(1))
	return result
コード例 #11
0
 def predict(self, fs, signal):
     """
     return a label (name)
     """
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     try:
         return self.gmmset.predict_one_with_score(feat)
     except:
         print "Unexpected error:", sys.exc_info()[0]
コード例 #12
0
 def predict(self, fs, signal, reject=False):
     from gmmset import GMMSetPyGMM
     if GMMSet is not GMMSetPyGMM:
         reject = False
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print tb.format_exc()
         return None
     if reject:
         try:
             return self.gmmset.predict_one_with_rejection(feat)
         except Exception as e:
             print tb.format_exc()
     return self.gmmset.predict_one(feat)
コード例 #13
0
 def predict(self, fs, signal, reject=False):
     from gmmset import GMMSetPyGMM
     if GMMSet is not GMMSetPyGMM:
         reject = False
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print str(e)
         return None
     if reject:
         try:
             l = self.gmmset.predict_one_with_rejection(feat)
             return l
         except Exception as e:
             print str(e)
     return self.gmmset.predict_one(feat)
コード例 #14
0
 def predict(self, fs, signal, reject=False):
     from gmmset import GMMSetPyGMM
     if GMMSet is not GMMSetPyGMM:
         reject = False
     print "Length of signal to predict:", len(signal)
     try:
         feat = mix_feature((fs, signal))
     except Exception as e:
         print str(e)
         return None
     if reject:
         try:
             l = self.gmmset.predict_one_with_rejection(feat)
             return l
         except Exception as e:
             print str(e)
     return self.gmmset.predict_one(feat)
コード例 #15
0
 def predict(self, fs, signal):
     feat = mix_feature((fs, signal))
     return self.gmmset.predict_one(feat)
コード例 #16
0
 def enroll(self, name, fs, signal):
     feat = mix_feature((fs, signal))
     self.features[name].extend(feat)
 def enroll(self, name, fs, signal):
     feat = mix_feature((fs, signal))
     #pdb.set_trace()
     self.features[name].extend(feat)
コード例 #18
0
 def enroll(self, name, fs, signal):
     feat = mix_feature((fs, signal))
     self.features[name].extend(feat)