Keras模型密集输入形状投掷E

2024-05-14 07:45:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个形状为X_train.shape的特征向量(52, 54)

当我训练keras模型时,它会向我抛出错误:

ValueError: Error when checking model input: expected dense_109_input to have shape (None, 52) but got array with shape (52, 54)

我已经尝试了几乎所有我能想到的以及扫描堆栈溢出,但我的问题仍然存在。代码如下:

^{pr2}$

如果有人对数据头感兴趣

In[42]: X_train.head()
Out[42]: 
       tempo  total_beats  average_beats  chroma_stft_mean  chroma_stft_std  \
35  0.438961     0.480897       0.505383          0.504320         0.938452   
34  0.520000     0.552580       0.500670          0.581778         0.680247   
63  0.477551     0.361328       0.334990          0.705472         0.357676   
27  0.477551     0.345419       0.309433          0.492245         0.728405   
43  0.520000     0.530305       0.495715          0.306097         0.663995   

    chroma_stft_var  chroma_cq_mean  chroma_cq_std  chroma_cq_var  \
35         0.932494        0.975206       0.394472       0.366960   
34         0.657810        0.654770       0.550766       0.522269   
63         0.333977        0.495473       0.618748       0.591578   
27         0.707998        0.644147       0.628125       0.601222   
43         0.640980        0.591299       0.639918       0.613379   

    chroma_cens_mean    ...       zcr_var  harm_mean  harm_std  harm_var  \
35          0.964034    ...      0.381363   0.021468  0.426776  0.225840   
34          0.755071    ...      0.213207   0.021598  0.115191  0.031476   
63          0.704930    ...      0.197960   0.021620  0.350194  0.163286   
27          0.715832    ...      0.247092   0.022253  0.319208  0.140714   
43          0.784991    ...      0.221276   0.021777  0.656981  0.471881   

    perc_mean  perc_std  perc_var  frame_mean  frame_std  frame_var  
35   0.362241  0.673257  0.467421    0.343459   0.174215   0.048846  
34   0.365434  0.152561  0.031588    0.091940   0.088991   0.018342  
63   0.340043  0.320664  0.116833    0.097610   0.077334   0.015154  
27   0.372315  0.604247  0.380492    0.995443   1.000000   1.000000  
43   0.377154  0.529161  0.296033    0.122519   0.089255   0.018417  

[5 rows x 54 columns]

Tags: inputvartrainmeanframe形状stdshape

热门问题