{"action":"opened","issue":{"url":"https://api.github.com/repos/keras-team/keras/issues/11849","repository_url":"https://api.github.com/repos/keras-team/keras","labels_url":"https://api.github.com/repos/keras-team/keras/issues/11849/labels{/name}","comments_url":"https://api.github.com/repos/keras-team/keras/issues/11849/comments","events_url":"https://api.github.com/repos/keras-team/keras/issues/11849/events","html_url":"https://github.com/keras-team/keras/issues/11849","id":389753492,"node_id":"MDU6SXNzdWUzODk3NTM0OTI=","number":11849,"title":"\"You must feed a value for placeholder tensor\" error when feeding model.outputs on epoch end","user":{"login":"MarcelBeining","id":1278660,"node_id":"MDQ6VXNlcjEyNzg2NjA=","avatar_url":"https://avatars1.githubusercontent.com/u/1278660?v=4","gravatar_id":"","url":"https://api.github.com/users/MarcelBeining","html_url":"https://github.com/MarcelBeining","followers_url":"https://api.github.com/users/MarcelBeining/followers","following_url":"https://api.github.com/users/MarcelBeining/following{/other_user}","gists_url":"https://api.github.com/users/MarcelBeining/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcelBeining/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcelBeining/subscriptions","organizations_url":"https://api.github.com/users/MarcelBeining/orgs","repos_url":"https://api.github.com/users/MarcelBeining/repos","events_url":"https://api.github.com/users/MarcelBeining/events{/privacy}","received_events_url":"https://api.github.com/users/MarcelBeining/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-11T13:01:10Z","updated_at":"2018-12-11T13:01:10Z","closed_at":null,"author_association":"NONE","body":"Please make sure that the boxes below are checked before you submit your issue.\r\nIf your issue is an **implementation question**, please ask your question on [StackOverflow](http://stackoverflow.com/questions/tagged/keras) or [on the Keras Slack channel](https://keras-slack-autojoin.herokuapp.com/) instead of opening a GitHub issue.\r\n\r\nThank you!\r\n\r\n- [x] Check that you are up-to-date with the master branch of Keras. You can update with:\r\n`pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps`\r\n\r\n- [x] Check that your version of TensorFlow is up-to-date. The installation instructions can be found [here](https://www.tensorflow.org/get_started/os_setup).\r\n\r\n- [x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).\r\n\r\nHi,\r\nI am using keras and wanted to created a callback subclass that writes one sample of my raw image, labeled image and predicted image to be viewed in tensorboard.\r\nBelow is the class that I have written for that problem and which is added to the `callbacks` list of the keras `model.fit` method. However on running `model.fit` I get the error\r\n\r\n> InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'predictedImage' with dtype float\r\n\r\nwhich I do not understand, since, as far as I understand, model.outputs[0] (which I fed the first entry to the placeholder tensor 'predictedImage') should contain all the outputs of the last epoch.\r\nAny idea what is going on?\r\n\r\n\r\n```\r\nimport tensorflow as tf\r\n\r\nclass VisImages(tf.keras.callbacks.Callback):        \r\n    def __init__(self, log_dir):\r\n        super()\r\n        self.log_dir = log_dir\r\n        self.session = tf.keras.backend.get_session()\r\n    \r\n        self.var_x = tf.placeholder(shape=(), dtype=tf.uint8, name='rawImage') #tf.Variable(0., validate_shape=False)\r\n        tf.summary.image('var_x',self.var_x)\r\n        \r\n        self.var_y_target = tf.placeholder(shape=(), dtype=tf.uint8, name='labeledImage') #tf.Variable(0., validate_shape=False)\r\n        tf.summary.image('var_y_target',self.var_y_target)\r\n\r\n        self.var_y_pred = tf.placeholder(dtype=tf.float32, shape=(),  name='predictedImage') # tf.Variable(0., validate_shape=False) \r\n        tf.summary.image('var_y_pred',self.var_y_pred)\r\n        \r\n        \r\n        self.merged = tf.summary.merge_all()\r\n        self.writer = tf.summary.FileWriter(self.log_dir)\r\n\r\n  \r\n    def on_epoch_end(self, epoch, logs):\r\n        summary = self.session.run(self.merged,\r\n                                   feed_dict={self.var_y_target: self.model.targets[0][0],\r\n                                              self.var_y_pred: self.model.outputs[0][0],\r\n                                              self.var_x: self.model.inputs[0][0],\r\n                                              })\r\n        self.writer.add_summary(summary, epoch)\r\n        self.writer.flush()\r\n```\r\n\r\nBackground Info: I use the keras Sequential Model with 25 Conv3D layers (ReLU activation) and the last layer having sigmoid activation function. Model is compiled in this line in the main script:\r\nrun_opts = tf.RunOptions(report_tensor_allocations_upon_oom = True)\r\n```\r\nmodel.compile(loss=tf.keras.losses.binary_crossentropy,\r\n              optimizer=tf.keras.optimizers.SGD(lr=learning_rate, momentum=1, decay=0, nesterov=False),\r\n              metrics=['accuracy'],options = run_opts)\r\n```\r\nand run with these lines\r\n\r\n```\r\nvi = VisImages(log_dir)   \r\ntb = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1, batch_size=dataPar['batchSize'], write_graph=True, write_grads=True, write_images=True)\r\nton = tf.keras.callbacks.TerminateOnNaN()\r\ntmc = tf.keras.callbacks.ModelCheckpoint('./models/%s_%s_weights.{epoch:02d}-{val_loss:.2f}.hdf5'%(datetime.datetime.now().strftime(\"%Y%m%d_%H%M%S\"),cnntype), monitor='val_loss', verbose=1, save_best_only=True, save_weights_only=True, mode='auto', period=1)\r\nhistory = model.fit(raw_train_normalized, label_train, validation_split=dataPar['amountValidation']/(1-dataPar['amountTest']),\r\n              batch_size=dataPar['batchSize'],\r\n              epochs=dataPar['epochs'],\r\n              verbose=1,callbacks=[tb,ton,tmc,vi])\r\n```\r\n\r\nThank you so much!"}}
{"actor":{"display_login":"MarcelBeining"}}