Skip to content
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

Convert to Tensorflow #45

Closed
leacornelio opened this issue Oct 18, 2017 · 7 comments
Closed

Convert to Tensorflow #45

leacornelio opened this issue Oct 18, 2017 · 7 comments
Labels

Comments

@leacornelio
Copy link

do you have any suggestions on how to convert this Keras model to a Tensorflow model?

@mingrui
Copy link

mingrui commented Oct 25, 2017

keras is a wrapper for tensorflow, turn on tensorflow as backend for keras and start from there?

@jamespeterthornton
Copy link

The most noteworthy change is to switch the axis of concatenation to the last channel instead of the first. This is because Theano is channels_first but Tensorflow is channels_last. E.g. change 'concatenate([up5, conv3], axis=1)' to 'concatenate([up5, conv3], axis=4)'. Otherwise, things can generally stay the same.

@Zerseu
Copy link

Zerseu commented Dec 3, 2017

Could you please elaborate more on the changes needed to use TensorFlow as backend?
I have applied the fix above, setting axis=4, but am getting this message when trying to run:

ValueError: Error when checking input: expected input_1 to have shape (None, 64, 64, 32, 1) but got array with shape (1, 1, 64, 64, 32)

@Zerseu
Copy link

Zerseu commented Dec 3, 2017

I think it's from "data.py", function "add_data_to_storage". Any help would be appreciated.

@ellisdg
Copy link
Owner

ellisdg commented Feb 1, 2018

To use Tensorflow as a backend, you don't need to change any of the code. Simply follow the instructions listed in the Keras backend documentation.

@mingrui
Copy link

mingrui commented Feb 2, 2018

Tested with

KERAS_BACKEND=tensorflow python train.py

Works well

@stale
Copy link

stale bot commented Oct 20, 2020

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 for your contributions. If you have questions, feel free to join the Slack group or email me at davidgellis2@gmail.com.

@stale stale bot added the wontfix label Oct 20, 2020
@stale stale bot closed this as completed Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants