I have this CNN I'm working on. Input shape is dynamic, but I fixed it to [?, 600, 451, 3] (batch_size, height, width, channels) so that I can debug it.
I have a random batch generator I created:
test = random_batch_generator(z_train
, num_processes=12
, num_batch=steps_train
, preloaded_batch=100
, batch_size=batch_size
, chunk_size=batch_size
, dataaugmfunc=heavy_dataaugm
, seq=seq
, initial_dim=initial_dim
, min_overlap=MINOVERLAP
)
When I do:
next(test)[0].shape
or
next(test)[0].dtype
it outputs me the correct shape ([?, 600, 451, 3]) and dtype (float32), which is in theory required for my input. I also checked the content of the batches, it seems good.
Still, I got, when I train my model with the following:
model.fit_generator(
random_batch_generator(z_train (...)),
validation_data= (x_val_mem,y_val_mem),
steps_per_epoch=steps_train,
validation_steps=steps_val,
epochs=epochs
,callbacks=model_callbacks(modelname)
,class_weight = [0.005,0.995]
)
this error message:
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,600,451,3]
[[Node: input_1 = Placeholderdtype=DT_FLOAT, shape=[?,600,451,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]]
What am I doing wrong? Thanks a thousand for any help or intuition on this.
Are you using a TensorBoard callback? If so, you could try adding this before creating the model
import keras.backend as K
K.clear_session()
See this answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With