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;








0















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.










share|improve this question




























    0















    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.










    share|improve this question
























      0












      0








      0








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 10:03









      monte carlomonte carlo

      3017




      3017






















          1 Answer
          1






          active

          oldest

          votes


















          2














          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






          share|improve this answer























            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
            );



            );













            draft saved

            draft discarded


















            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









            2














            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






            share|improve this answer



























              2














              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






              share|improve this answer

























                2












                2








                2







                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






                share|improve this answer













                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







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 15:23









                Manoj MohanManoj Mohan

                1,696510




                1,696510





























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현