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

input_tensor option for segmentation model #182

Open
cwchengtw opened this issue Aug 20, 2019 · 2 comments
Open

input_tensor option for segmentation model #182

cwchengtw opened this issue Aug 20, 2019 · 2 comments

Comments

@cwchengtw
Copy link

I have the need to pass an input_tensor to the segmentation model just like I do in keras. application. I see your code have **kwargs in all segmentation model and can be pass to backbone model.
But when I do this, I get an error from the get_submodules_from_kwargs(kwargs).
Because get_submodules_from_kwargs just accept "backend, layers, models, keras_utils" kwargs,it result an error.
I suggest to add default input_tensor=None to all segmentation model and it will work.

@qubvel
Copy link
Owner

qubvel commented Aug 20, 2019

Hi @cwchengtw
It might be an option, but not sure you will be able to load encoder_weights in this case.

@cwchengtw
Copy link
Author

Hi @qubvel

I used to train model in keras application and classification model, and deploy model in tensorflow saved model or frozen model format. Before I convert from keras model to tensorflow model, I add a
tf.placeholder and some ops to do image transformation (mean, or normalize) and redefine keras model with transform input tensor and load the training weight.
After doing that, I convert model to tensorflow saved model or frozen model with input_tensor and model.outputs, I will not to do image preprocessing in deployment.

I tried encoder_weights and model.load_weights in this case, it work. (in keras)

And, I have another issue with tfkeras in classification model (not an issue in tensorflow keras application). When I used input_tensor in tfkeras, backend.is_keras_tensor will not work, and it raise an error. (I think tensorflow.keras.application really use keras backend in this case.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants