Giter Club home page Giter Club logo

Comments (4)

neka-nat avatar neka-nat commented on June 25, 2024

Thank you for your opinion.
Probably I think that trainable is correct with false.

I attached the pseudo code of the paper.
The place where all_model is used is line 10. Here the discriminator is fixed and learning only the completion network.
The discriminator update is done on line 8, and it uses d_model in my code.
algorithm

from image_completion_tf2.

bis-carbon avatar bis-carbon commented on June 25, 2024

I agree that d_container.trainable = False but once you make the discriminator non trainable then you wouldn't able to train it on the following batches. The discriminator has to be trained as long as t>Tc and in order to do that I guess we need to set d_container.trainable = True after the completion network is trained. Correct me if I am wrong and thank you for your quick response.

The algorithm on the paper is something like this:

            if n < tc:
                ''' Train completion network '''
            elif n<tc+td:
                ''' Train discriminator network '''
            else:
                ''' Train both completion and discriminator '''

What I am suggesting is something like this:

if n >= tc + td:
     d_container.trainable = False
    all_model = Model([org_img, mask, in_pts], [cmp_out, d_container([cmp_out, in_pts])])
    all_model.compile(loss=['mse', 'binary_crossentropy'], loss_weights=[1.0, alpha], optimizer=optimizer)
    g_loss = all_model.train_on_batch([inputs, masks, points], [inputs, valid])
    g_loss = g_loss[0] + alpha * g_loss[1]
  
    "" the following codes makes the discriminator trainable again on the following batch "" 
     d_container.trainable = True 
     all_model.compile(loss=['mse', 'binary_crossentropy'], loss_weights=[1.0, alpha], optimizer=optimizer) ```
             

from image_completion_tf2.

neka-nat avatar neka-nat commented on June 25, 2024

The following links may be helpful for your point.
https://stackoverflow.com/questions/45154180/how-to-dynamically-freeze-weights-after-compiling-model-in-keras

The trainable flag is fixed in the model at compile time.
So, changes to the flag after compile will not affect the compiled model.

from image_completion_tf2.

bis-carbon avatar bis-carbon commented on June 25, 2024

Thank you, that clarifies my question.

from image_completion_tf2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.