Person-Segmentation-Keras
Person-Segmentation-Keras copied to clipboard
StopIteration()
Thanks for your code first. The program always breaks in the process of training. The error message is stopiteration. How can I solve this problem? Can you show me your keras version?
@Moyao6
Can you share the whole error message?
I get the same error: 937/937 [==============================] - 458s 488ms/step - loss: 0.0376 - acc: 0.9922 - val_loss: 0.0496 - val_acc: 0.9975
Epoch 00001: val_acc improved from -inf to 0.99750, saving model to ./unet_seg_weights.h5
Epoch 2/20
936/937 [============================>.] - ETA: 0s - loss: 0.0168 - acc: 0.9972Traceback (most recent call last):
File "laurent.py", line 147, in
I "fixed" the problem by removing the validation computations in fit_generator, as such:
#history =
model.fit_generator(train,
steps_per_epoch=len(trainitems) // train_batch_size,
#validation_data=val,
#validation_steps=len(valitems) // val_batch_size,
epochs=epochs,
#callbacks=[checkpoint],
)
#plot_history(history, './results/', 'unet')
#save_history(history, './results/', 'unet')
model.save(save_file)
I have solved this problem. The problem is caused by the validation_generator not have continue running? add while True. like this: else: while True: for j in range(len(items) // batch_size): x, y = get_batch(items[j * batch_size:(j + 1) * batch_size], root_path, n_classes, input_height, input_width) yield np.array(x), np.array(y)