Replies: 1 comment 1 reply
-
Hi there, greyfox80, It seems you're encountering an issue where your CNN model runs out of data after the first epoch, which causes an error when training resumes. This is likely due to the model exhausting the available data during the first epoch, leaving none for subsequent epochs. Based on my experience, this issue may be related to recent changes in TensorFlow, particularly in versions 2.16.0 or 2.17.0. I encountered a similar problem and found that downgrading TensorFlow to version 2.15.0 resolved it. Alternatively, you could create a separate environment with the older version of TensorFlow to isolate the issue. Here’s a quick breakdown:
To resolve this:
I hope this helps, and I’m confident these steps will allow you to continue training your model without any further issues. |
Beta Was this translation helpful? Give feedback.
-
I have this error after sucessfully run 1 epochs, please help, i don't know to fix it ?
Found 1500 images belonging to 2 classes.
Found 500 images belonging to 2 classes.
/usr/local/lib/python3.10/dist-packages/keras/src/layers/convolutional/base_conv.py:107: UserWarning: Do not pass an
input_shape
/input_dim
argument to a layer. When using Sequential models, prefer using anInput(shape)
object as the first layer in the model instead.super().init(activity_regularizer=activity_regularizer, **kwargs)
Epoch 1/5
/usr/local/lib/python3.10/dist-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:121: UserWarning: Your
PyDataset
class should callsuper().__init__(**kwargs)
in its constructor.**kwargs
can includeworkers
,use_multiprocessing
,max_queue_size
. Do not pass these arguments tofit()
, as they will be ignored.self._warn_if_super_not_called()
47/47 ━━━━━━━━━━━━━━━━━━━━ 9s 127ms/step - accuracy: 0.6046 - loss: 0.6536 - val_accuracy: 0.8220 - val_loss: 0.3963
Epoch 2/5
/usr/lib/python3.10/contextlib.py:153: UserWarning: Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least
steps_per_epoch * epochs
batches. You may need to use the.repeat()
function when building your dataset.self.gen.throw(typ, value, traceback)
AttributeError Traceback (most recent call last)
in <cell line: 50>()
48
49 #4. Fit the model for 20 epocsh (5 less than before)
---> 50 history_1 = model_1.fit(train_data, epochs=5,
51 steps_per_epoch=len(train_data),
52 validation_data=valid_data,
1 frames
/usr/local/lib/python3.10/dist-packages/keras/src/backend/tensorflow/trainer.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq)
352 )
353 val_logs = {
--> 354 "val_" + name: val for name, val in val_logs.items()
355 }
356 epoch_logs.update(val_logs)
AttributeError: 'NoneType' object has no attribute 'items'
Beta Was this translation helpful? Give feedback.
All reactions