我有以下代码,我想模仿所有标签的串联。
我在使用np.hstack做的是: np.concatenate(前一个标签,新标签)
def createTrainingSVM(path):
#iterating through the training file and getting all wav files to train SVM
features = []
labels = []
for filename in glob.glob(path):
#getting the sample rate value: 16000hz and the data read from wav file
sr_value, x_value = wav.read(filename)
#calling extract_feat which returns 39 mfcc features for each value in the vector
vector = extract_feat(x_value, sr_value)#default values
features.append(vector)
#create labels for each vector with the particular number being spoken
labels.append(np.full(len(vector),int(ntpath.basename(filename).split('.')[0])))
final_labels = np.hstack(labels)
final_features = np.vstack(features)
#fitting the model
svmModel.fit(final_features, final_labels)