简体   繁体   English

您输入的数据不足; 中断训练。 确保您的数据集或生成器至少可以生成`steps_per_epoch

[英]Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch

When i am training my self-driving car model it is giving me error in the first epoch.当我训练我的自动驾驶汽车模型时,它在第一个时代给了我错误。 although when i reduced the batch_size it is working fine.虽然当我减少batch_size它工作正常。 But that is not giving me accuracy as i want.但这并没有给我想要的准确性。

I am trainning my model in Google Collab.我正在 Google Collab 中训练我的模型。

tensorflow version 2.3.1张量流版本 2.3.1

Error:错误:

错误

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, 20000 batches). You may need to use the repeat() function when building your dataset.

My code:我的代码:

def modified_model():
  model = Sequential()
  model.add(Conv2D(60, (5, 5), input_shape=(32, 32, 1), activation='relu'))
  model.add(Conv2D(60, (5, 5), activation='relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  
  model.add(Conv2D(30, (3, 3), activation='relu'))
  model.add(Conv2D(30, (3, 3), activation='relu'))
  model.add(MaxPooling2D(pool_size=(2, 2)))
  
  model.add(Flatten())
  model.add(Dense(500, activation='relu'))
  model.add(Dropout(0.5))
  model.add(Dense(43, activation='softmax'))
  
  model.compile(Adam(lr = 0.001), loss='categorical_crossentropy', metrics=['accuracy'])
  return model
model = modified_model()
print(model.summary())

history = model.fit_generator(datagen.flow(X_train, y_train, batch_size=50),
                            steps_per_epoch=2000,
                            epochs=10,
                            validation_data=(X_val, y_val), shuffle = 1)

When using generators, let the model figure out how many steps are practically there to cover a epoch otherwise you'll have to calculate steps_per_epoch=(data_samples/batch_size) .使用生成器时,让模型计算出实际上有多少步骤来覆盖一个时期,否则您将不得不计算steps_per_epoch=(data_samples/batch_size) Try running without the step_per_epoch parameter尝试在没有step_per_epoch参数的情况下运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您输入的数据用完了; 中断训练。 确保您的数据集或生成器至少可以生成 `steps_per_epoch * epochs` 批次 - Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches 警告:tensorflow:您的输入数据不足; 中断训练 - WARNING:tensorflow:Your input ran out of data; interrupting training 训练时出错:tensorflow:你的输入数据用完了; 中断训练 - Error while training: tensorflow:Your input ran out of data; interrupting training 'tf.data()' throwing 你的输入数据用完了; 中断训练 - 'tf.data()' throwing Your input ran out of data; interrupting training 即使指定了steps_per_epoch,自定义生成器也会耗尽数据 - Custom generator runs out of data even when steps_per_epoch specified 输入的数据用完了; 中断训练 - input ran out of data; interrupting training tensorflow:使用自定义生成器时您的输入用完了数据 - tensorflow:Your input ran out of data when using custom generator fit_generator中的Keras steps_per_epoch如何工作 - How the Keras steps_per_epoch in fit_generator works Keras Sequence,fit_generator和steps_per_epoch - Keras Sequence, fit_generator and steps_per_epoch tensorflow:您的输入数据用完 - tensorflow:Your input ran out of data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM