-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Multi output network generator #7003
Comments
My experience with using My intuition leads me to believe that for a multi-output model you need to yield I would write a quick "generator joiner": (untested)
Note the assumption here is that you need to ensure that the order in which your data flows from the directory is the same for each generator |
Thanks |
yes i am using same seed for all generators, and i tested that as well. |
Don't worry, I didn't include a doc string.
This was just a skeleton of a possible implementation. For example, if your generators only return one element you could just:
Or vary the code accordingly. |
I like that trick. In my experience, writing a custom generator that yields both inputs is easier to manage than zipping two generators. It is especially evident when managing complex augmentation and sampling methods. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
@zafarali Thanks for that trick, this really helps me a lot a lot !
especially we can handle a dict or a list for return, which the fit_generator allows the x of (x, y, sample_weight) to be a list or dict (see #2568) Hope this trick can show up in the keras documents |
@zafarali How do we handle shuffling the dataset if we use "flow_from_directory"? |
I am not sure, I haven’t used the more advanced features of keras in a
while and this function is unfamiliar to me.
However, If it returns a generator, it should work.
…On Wed, Jan 30, 2019 at 9:23 AM moondra2017 ***@***.***> wrote:
@zafarali <https://github.com/zafarali> How do we handle shuffling the
dataset if we use "flow_from_directory"?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7003 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGAO_Mr9JQe89B7WP405nDMyh1rA73Auks5vIar4gaJpZM4N7KwF>
.
|
@moondra2017 in my opinion seed parameter control this. It use same randomness. try on multiple generator with Shuffule=True |
@hassaan90 might you have a github link where I could find your full model? i think, it would be a nice reference to see how to build/train/test multi-output models in Keras. My current model is unfortunately not converging when I add the second output branch and I'm not so sure, what I'm doing wrong. |
@tinalegre and @hassaan90 same here I have the same problem, trying to train multi- output U-net and the code doesn't work, any progress did you resolve the problem? |
model.fit support multi input/output network, but if data-set is large enough and one have to use model.fit_generator, its complicated to generate tuple for such case, is there any plan to make it more simpler like model.fit.
I have network that take one input and produce two outputs, i created
separate
generator for each, but i am not able to run network on this. my input should be of form x, [y1, y2].i think i need to extend generator for such case ?
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
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).
The text was updated successfully, but these errors were encountered: