Predicting from the middle of a Keras modelRegularisers in Keras vs. CaffeKeras: Use the same layer in different models (share weights)Keras model gets constant loss and accuracyKeras model to predict number sequenceChange the input size in KerasMultilayer Seq2Seq model with LSTM in KerasRemove middle layers in the pre-trained VGG16 model in KerasImplementation of Adversarial Loss In Kerasreuse middle layer as input for another model in KerasCaffe to Keras conversion of grouped convolution
Yandex programming contest: Alarms
Can you move on your turn, and then use the Ready Action to move again on another creature's turn?
Why does the 6502 have the BIT instruction?
What are the slash markings on Gatwick's 08R/26L?
What is the intuition behind uniform continuity?
What are the benefits of cryosleep?
Select row of data if next row contains zero
Can a helicopter mask itself from Radar?
Rotated Position of Integers
Beginner's snake game using PyGame
count number of files in directory with a certain name
Differences between “pas vrai ?”, “c’est ça ?”, “hein ?”, and “n’est-ce pas ?”
Can an old DSLR be upgraded to match modern smartphone image quality
60s (or earlier) short story where each colony has one person who doesn't connect well with others who is there for being able to absorb knowledge
In what episode of TOS did a character on the bridge make a comment about raising the number 1 to some power?
Are UK pensions taxed twice?
How can I include a header file that contains `>` in its name?
Adding strings in lists together
Why does the UK have more political parties than the US?
How do I subvert the tropes of a train heist?
Is the world in Game of Thrones spherical or flat?
What is/are this/these giant NASA box(es)?
Comment dit-on « I’ll tell you what » ?
What is game ban VS VAC ban in steam?
Predicting from the middle of a Keras model
Regularisers in Keras vs. CaffeKeras: Use the same layer in different models (share weights)Keras model gets constant loss and accuracyKeras model to predict number sequenceChange the input size in KerasMultilayer Seq2Seq model with LSTM in KerasRemove middle layers in the pre-trained VGG16 model in KerasImplementation of Adversarial Loss In Kerasreuse middle layer as input for another model in KerasCaffe to Keras conversion of grouped convolution
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to develop an auto-encoder for compressing images using Keras. I was able to train it and to compress images, but I am struggling with the decoder part of it. Specifically, given a compressed image, I don't know how to use the model to de-compress it.
This is what I have:
input_layer = keras.layers.Input(shape=(64, 64, 3))
code_layer = build_encoder(input_layer, size_of_code) # add some convolution layers and max-pooling
output_layer = build_decoder(code_layer) # add some convolution layers and up-sampling
autoencoder_model = keras.models.Model(input_layer, output_layer)
encoder_model = keras.models.Model(input_layer, code_layer)
decoder_model = ??
autoencoder_model.compile(optimizer='adam', loss='binary_crossentropy')
using the code above I can train the autoencoder_model
and compress the images using the encoder_model
, but I don't know how to construct the decoder_model
, mainly because I don't know how to insert a new input to the middle of the model.
python tensorflow keras neural-network
add a comment |
I am trying to develop an auto-encoder for compressing images using Keras. I was able to train it and to compress images, but I am struggling with the decoder part of it. Specifically, given a compressed image, I don't know how to use the model to de-compress it.
This is what I have:
input_layer = keras.layers.Input(shape=(64, 64, 3))
code_layer = build_encoder(input_layer, size_of_code) # add some convolution layers and max-pooling
output_layer = build_decoder(code_layer) # add some convolution layers and up-sampling
autoencoder_model = keras.models.Model(input_layer, output_layer)
encoder_model = keras.models.Model(input_layer, code_layer)
decoder_model = ??
autoencoder_model.compile(optimizer='adam', loss='binary_crossentropy')
using the code above I can train the autoencoder_model
and compress the images using the encoder_model
, but I don't know how to construct the decoder_model
, mainly because I don't know how to insert a new input to the middle of the model.
python tensorflow keras neural-network
add a comment |
I am trying to develop an auto-encoder for compressing images using Keras. I was able to train it and to compress images, but I am struggling with the decoder part of it. Specifically, given a compressed image, I don't know how to use the model to de-compress it.
This is what I have:
input_layer = keras.layers.Input(shape=(64, 64, 3))
code_layer = build_encoder(input_layer, size_of_code) # add some convolution layers and max-pooling
output_layer = build_decoder(code_layer) # add some convolution layers and up-sampling
autoencoder_model = keras.models.Model(input_layer, output_layer)
encoder_model = keras.models.Model(input_layer, code_layer)
decoder_model = ??
autoencoder_model.compile(optimizer='adam', loss='binary_crossentropy')
using the code above I can train the autoencoder_model
and compress the images using the encoder_model
, but I don't know how to construct the decoder_model
, mainly because I don't know how to insert a new input to the middle of the model.
python tensorflow keras neural-network
I am trying to develop an auto-encoder for compressing images using Keras. I was able to train it and to compress images, but I am struggling with the decoder part of it. Specifically, given a compressed image, I don't know how to use the model to de-compress it.
This is what I have:
input_layer = keras.layers.Input(shape=(64, 64, 3))
code_layer = build_encoder(input_layer, size_of_code) # add some convolution layers and max-pooling
output_layer = build_decoder(code_layer) # add some convolution layers and up-sampling
autoencoder_model = keras.models.Model(input_layer, output_layer)
encoder_model = keras.models.Model(input_layer, code_layer)
decoder_model = ??
autoencoder_model.compile(optimizer='adam', loss='binary_crossentropy')
using the code above I can train the autoencoder_model
and compress the images using the encoder_model
, but I don't know how to construct the decoder_model
, mainly because I don't know how to insert a new input to the middle of the model.
python tensorflow keras neural-network
python tensorflow keras neural-network
asked Mar 24 at 10:03
monte carlomonte carlo
3017
3017
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Like this. Instead of the code_layer, need to define an input layer and build the decoder model with that input.
latent_inputs = keras.layers.Input(shape=(size_of_code))
output_layer = build_decoder(latent_inputs) # add some convolution layers and up-sampling
decoder_model = keras.models.Model(latent_inputs, output_layer)
You can refer this complete VAE example:
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322619%2fpredicting-from-the-middle-of-a-keras-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Like this. Instead of the code_layer, need to define an input layer and build the decoder model with that input.
latent_inputs = keras.layers.Input(shape=(size_of_code))
output_layer = build_decoder(latent_inputs) # add some convolution layers and up-sampling
decoder_model = keras.models.Model(latent_inputs, output_layer)
You can refer this complete VAE example:
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
add a comment |
Like this. Instead of the code_layer, need to define an input layer and build the decoder model with that input.
latent_inputs = keras.layers.Input(shape=(size_of_code))
output_layer = build_decoder(latent_inputs) # add some convolution layers and up-sampling
decoder_model = keras.models.Model(latent_inputs, output_layer)
You can refer this complete VAE example:
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
add a comment |
Like this. Instead of the code_layer, need to define an input layer and build the decoder model with that input.
latent_inputs = keras.layers.Input(shape=(size_of_code))
output_layer = build_decoder(latent_inputs) # add some convolution layers and up-sampling
decoder_model = keras.models.Model(latent_inputs, output_layer)
You can refer this complete VAE example:
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
Like this. Instead of the code_layer, need to define an input layer and build the decoder model with that input.
latent_inputs = keras.layers.Input(shape=(size_of_code))
output_layer = build_decoder(latent_inputs) # add some convolution layers and up-sampling
decoder_model = keras.models.Model(latent_inputs, output_layer)
You can refer this complete VAE example:
https://github.com/keras-team/keras/blob/master/examples/variational_autoencoder.py
answered Mar 24 at 15:23
Manoj MohanManoj Mohan
1,696510
1,696510
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55322619%2fpredicting-from-the-middle-of-a-keras-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown