我目前在理解连接三个numpy矩阵如何导致数据更改时遇到问题。三个numpy矩阵包含应在视频中显示的数据。
但不知何故,当我连接它们[static delta delta_delta]并制作相同的图时,它看起来像这样:
为什么数据集在最后一个中变得腐败?这是我如何连接并制作图。
import os
import sys
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sb
import matplotlib
from matplotlib import cm
from PIL import Image
from python_speech_features import logfbank
from python_speech_features import delta
import scipy.io.wavfile as wav
import librosa
y,sr = librosa.load(fp,sr=16000) #fp being path to audio file
static_data = logfbank(y,sr,nfilt=13,preemph=0)
delta_data = delta(static_data,1)
delta_delta_data = delta(static_data,2)
output_hstacked = np.concatenate((static_data,delta_data,delta_delta_data),axis=0)
print output_hstacked.shape
Y = np.array(range(0,output_hstacked.shape[1]))
X = np.array(range(0,output_hstacked.shape[0]))
X,Y = np.meshgrid(X, Y)
plt.pcolormesh(X,Y,output_hstacked.T,cmap=cm.jet)
plt.xlabel('Frames(s)')
plt.ylabel('Frequency(Hz)')
plt.title('MFSS features of ' + filename)
#plt.yscale('log')
plt.colorbar()
#plt.show()
plt.savefig(spectogram_path_test+"/"+modified_name+"_stacked.png")
plt.close()
Y = np.array(range(0,static_data.shape[1]))
X = np.array(range(0,static_data.shape[0]))
X,Y = np.meshgrid(X, Y)
plt.pcolormesh(X,Y,static_data.T,cmap=cm.jet)
plt.xlabel('Frames(s)')
plt.ylabel('Frequency(Hz)')
plt.title('MFSS features of ' + filename)
#plt.yscale('log')
plt.colorbar()
#plt.show()
plt.savefig(spectogram_path_test+"/"+modified_name+"_static.png")
plt.close()
plt.pcolormesh(X,Y,delta_data.T,cmap=cm.jet)
plt.xlabel('Frames(s)')
plt.ylabel('Frequency(Hz)')
plt.title('MFSS features of ' + filename)
#plt.yscale('log')
plt.colorbar()
#plt.show()
plt.savefig(spectogram_path_test+"/"+modified_name+"_delta.png")
plt.close()
plt.pcolormesh(X,Y,delta_delta_data.T,cmap=cm.jet)
plt.xlabel('Frames(s)')
plt.ylabel('Frequency(Hz)')
plt.title('MFSS features of ' + filename)
#plt.yscale('log')
plt.colorbar()
#plt.show()
plt.savefig(spectogram_path_test+"/"+modified_name+"_delta_delta.png")
plt.close()
可以找到音频文件here