-
Notifications
You must be signed in to change notification settings - Fork 74.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple outputs from a keras model #36116
Comments
Can you please provide colab link or simple standalone code to reproduce the issue in our environment. It helps us in localizing the issue faster.Thanks! |
This code generates a slightly different error when resizing the ground truth images
but otherwise this code behaves similarly to what I described above. Play with the Run the code as Here are some links to tfrecord files to test. |
@ravikyram that looks to be the same error message that I reported originally? |
@Bidski However, |
I also have this issue when I call 'predict' of a model with multiple outputs. Reproduction: Anyone can fix it? |
Same here: i extract losses from several layers, but loss function is the same for me. Compilation succeeds, but .fit fails:
p.s. .predict might be a different issue, it works fine for me. |
Here is reproducible example:
i tried this shape too: if i convert labels into list, it works:
Main problem though for me is how to put this into a DataSet, which does not support anything besides tensors, i cannot use above solution for a DataSet, unless i missed some functionality. |
Is this keras-team/keras-preprocessing#295 somehow related? |
@Strateus I updated your code for multiple outputs. It works as expected. Please check the gist here. Thanks! @Bidski Is this still an issue for you? Also, please check Functional API guide for detailed guide on multiple-inputs and multiple-outputs model. Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
Closing as stale. Please reopen if you'd like to work on this further. |
Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template
System information
You can collect some of this information using our environment capture
script
You can also obtain the TensorFlow version with: 1. TF 1.0:
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
2. TF 2.0:python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"
Describe the current behavior
I have a custom (keras) CNN model as well as a custom loss function.
The model has two inputs at one resolution and multiple (6) outputs at different resolutions (each output has a different resolution).
The dataset, from a TFRecord file, has the 2 image inputs and 1 ground truth image as an output.
The loss function expects to receive the single ground truth image as
y_true
and the 6 outputs in a list asy_pred
and will then calculate the loss value based on this.With this scenario, I get the following error
If I modify my dataset loading code so that it resizes the ground truth image into a list of images with appropriate resolutions to match my networks output, I get the following error
Describe the expected behavior
I expect that TF/keras would allow at least one of these scenarios.
Is there an accepted way to handle this sort of situation?
The text was updated successfully, but these errors were encountered: