给我的batch_size提供什么价值?

时间:2017-10-15 16:22:10

标签: python deep-learning

我想在编译CNN模型后预测我的x_test的值:

y_test_predict= model.predict(x_test[3])

我的x_test[3]形状约为(8000, 1)

但是这行代码给了我这个我真正理解的错误:

Traceback (most recent call last):
  File "CNN_Learning_Side_Channel_Attack.py", line 155, in <module>
    test_One_Trace= model.predict(x_test[3])
  File "/home/user/.local/lib/python3.4/site-packages/keras/models.py", line 899, in predict
    return self.model.predict(x, batch_size=batch_size, verbose=verbose)
  File "/home/user/.local/lib/python3.4/site-packages/keras/engine/training.py", line 1555, in predict
    check_batch_axis=False)
  File "/home/user/.local/lib/python3.4/site-packages/keras/engine/training.py", line 121, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking : expected conv1d_1_input to have 3 dimensions, but got array with shape (8000, 1)

如果你能帮助我,我将非常感激。

1 个答案:

答案 0 :(得分:0)

要使卷积运算有意义,您需要提供3个维度。在您的情况下,您提供的(8000, 1)明显没有3维度(它有2)。

根据提供的信息,很难准确地为您提供尺寸,但您的问题主要是尺寸。您应该在训练时检查输入尺寸。