且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Keras 1D CNN:如何正确指定尺寸?

更新时间:2023-12-02 18:49:58

  1. 是的,您的数据集应该是3d张量.

  1. Yes, your dataset should be a 3d tensor.

正确的输入形状(对于tensorflow后端)为(样本编号,样本大小,通道编号).您可以从错误消息中检查预期尺寸为(None,3197,1)".

The correct input shape (for tensorflow backend) is (sample_number,sample_size,channel_number). You can check that from your error message, "the expected dimension was (None, 3197, 1)".

无"是指任意大小的尺寸,因为它是训练中使用的样本数量的期望值.

'None' refers to an arbitrary size dimension, as it is expected to the number of samples used in training.

因此,根据您的情况,正确的形状是(570,3197,1).

So in your situation the correct shape is (570, 3197, 1).

如果您碰巧使用theano后端,则应将频道尺寸放在首位: (样本编号,频道编号,样本大小)或在您的特殊情况下

If you happen to use theano backend you should put your channel dimension first: (sample_number,channel_number,sample_size) or in your paricular case

(570,1,3197)