UserWarning: Method on_batch_end() is slow compared to the batch update. Check your callbacks.

https://github.com/keras-team/keras/issues/2603

history=model.fit(X_train,y_train,epochs=30,batch_size=32,validation_split=0.2,verbose=2)

出现的原因是一开始berbose=1(默认),在一个epoch中训练一个batch就会打印进度条和结果,但是打印到控制台所需时间比训练模型时间更长,所以有了警告。

将verbose=0,使得一点训练过程信息也不打印;verbose=2,每一个epoch打印一次。

原文地址:https://www.cnblogs.com/BlueBlueSea/p/11063712.html