isa*_*lla 6 python machine-learning progress-bar conv-neural-network keras
我曾尝试构建CNN 1D,但口译员说:
AttributeError:“ ProgbarLogger”对象没有属性“ log_values”
这是代码片段:
model = Sequential()
model.add(Conv1D(200, 20, activation='relu', padding='same',input_shape=(1154,1024))
print(model.summary())
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
history=model.fit(X, y,batch_size=10, epochs=25,validation_split=0.7)
Run Code Online (Sandbox Code Playgroud)
这是错误:
Layer (type) Output Shape Param #
=================================================================
conv1d_1 (Conv1D) (None, 1154, 200) 4096200
=================================================================
Total params: 4,096,200
Trainable params: 4,096,200
Non-trainable params: 0
_________________________________________________________________
None
Train on 0 samples, validate on 1 samples
Epoch 1/25
Traceback (most recent call last):
File "binary_classification.py", line 59, in <module>
history=model.fit(X, y,batch_size=10, epochs=25,validation_split=0.7)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/engine/training.py",
line 1039, in fit
validation_steps=validation_steps)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/engine/training_arrays.py",
line 217, in fit_loop
callbacks.on_epoch_end(epoch, epoch_logs)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/callbacks.py",
line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/home/isabella/.local/lib/python3.6/site-packages/keras/callbacks.py",
line 338, in on_epoch_end
self.progbar.update(self.seen, self.log_values)
AttributeError: 'ProgbarLogger' object has no attribute 'log_values'
X shape is :(1,1154,1024),
y shape is :(1,1154, 1 )
Run Code Online (Sandbox Code Playgroud)
如果仔细看,您将在堆栈跟踪输出之前看到以下行:
Train on 0 samples, validate on 1 samples
Run Code Online (Sandbox Code Playgroud)
没有训练数据!为什么?这是因为您已将设置为validation_split,0.7所以X(和y)中的前70%的数据点被留作验证,其余30%的数据用于训练。数据点的数量可能X少于4,因此其30%的数量将少于1,这意味着仍有零数据点需要训练。使用4个以上的数据点或删除validation_split参数(或降低参数以使至少有一个样本可供训练)。
| 归档时间: |
|
| 查看次数: |
3112 次 |
| 最近记录: |