最近訓練遇到一個錯誤
WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 1000 batches). You may need to use the repeat() function when building your dataset.
仔細查看程式後發現
是我自定義的資料generator輸出資料有誤
就是step還沒結束
但是資料返回就結束了
正常來講
輸出資料的 step 計算方式可以參考以下:
model.fit( train_generator, steps_per_epoch=math.ceil(len(Y_train) / batch_size), epochs=EPOCHS, validation_data=test_generator, validation_steps=math.ceil(len(Y_test) / batch_size), callbacks=callbacks_list )
Y_train 是訓練資料
Y_test 是驗證資料
math.ceil 是為了讓資料步驟無條件進位
給大家參考囉
留言板
歡迎留下建議與分享!希望一起交流!感恩!