在网上找了语音情感分析的代码,带入自己的数据集怎么样都会报错,通过gpt每一步都统一了维数,还是没用,真的很崩溃,机器学习要我命
ValueError: operands could not be broadcast together with shapes (1,1025) (0,)
这个报错到底是为什么呀,调了一下好像是mel的原因导致维数不一致,但怎么调都是这个报错,真的要feng了

涉及到mfcc特征提取的两个函数:
```python
def compute_mfcc(y, sr, n_mfcc=16, n_fft=2048, hop_length=512, n_mels=128):
# 1. 预处理音频数据
S = librosa.feature.melspectrogram(y=y, sr=sr, n_fft=n_fft, hop_length=hop_length, n_mels=n_mels)
log_S = librosa.power_to_db(S, ref=np.max)
# 2. 计算 MFCC
mfcc = fftpack.dct(log_S, axis=0, type=2, norm='ortho')[:n_mfcc]
# 3. 可能的话,对 MFCC 进行降维处理(这里设不进行降维处理)
return mfcc
# 特征提取函数
def getFeature(file_path, mfcc_feature_num=16):
y, sr = librosa.load(file_path)
mfcc = compute_mfcc(y, sr, n_mfcc=mfcc_feature_num) # 提取MFCC特征
print("MFCC feature shape:", mfcc.shape)# 输出MFCC特征形状
zcr_feature = librosa.feature.zero_crossing_rate(y,frame_length=len(mfcc))
energy_feature = librosa.feature.rms(y,frame_length=len(mfcc))
rms_feature = librosa.feature.rms(y,frame_length=len(mfcc))
# 确保其他特征的维度与MFCC特征的时间步长一致
zcr_feature = np.expand_dims(zcr_feature.T, axis=1)
energy_feature = np.expand_dims(energy_feature.T, axis=1)
rms_feature = np.expand_dims(rms_feature.T, axis=1) # 添加一个维度以匹配时间步
# 对提取的特征进行处理
data_feature = np.concatenate((mfcc, zcr_feature, energy_feature, rms_feature), axis=1)
return data_feature
```