示例#1
0
 def predict_whole(self, mfccs):
     num_item = np.shape(mfccs, 0)
     result = np.zeros(num_item, self.class_num)
     feature = get_feature_npy(mfccs)
     for label in self.labels:
         result[:, self.label_to_idx[label]] = self.discriminators[
             label].predict(feature)
     return result
示例#2
0
 def regress_one(self, mfcc):
     mfcc = mfcc[np.newaxis, :]
     result = np.zeros(self.class_num)
     feature = get_feature_npy(mfcc)
     for label in self.labels:
         result[self.label_to_idx[label]] = self.regressors[label].predict(
             feature)
     return result
示例#3
0
 def predict_meta(self, mfcc):
     mfcc = mfcc[np.newaxis, :]
     feature = get_feature_npy(mfcc)
     result = np.zeros(self.meta_class_num)
     if not len(self.meta_discriminators):
         return None
     for i in range(self.meta_class_num):
         result[i] = self.meta_discriminators[i].predict(feature)
     return result
示例#4
0
 def predict_one(self, mfcc, meta_label=None):
     labels = []
     if not len(self.meta_discriminators):
         labels = self.labels
     else:
         for i in range(self.meta_class_num):
             labels += self.meta_labels[i] if meta_label[i] else []
     mfcc = mfcc[np.newaxis, :]
     result = np.zeros(self.class_num)
     feature = get_feature_npy(mfcc)  # feature: 1*40
     for label in labels:
         result[self.label_to_idx[label]] = self.discriminators[
             label].predict(feature)
     return result