Comments (4)
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.
from image_completion_tf2.
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.
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.
Thank you, that clarifies my question.
from image_completion_tf2.
Related Issues (20)
- where did you use the joint loss? HOT 6
- Test different size of images
- does this code deal with random mask? HOT 2
- error on Keras 2.2.2 merge HOT 4
- question HOT 1
- data preprocess HOT 2
- Why d_container.trainable is set to False in the train.py? HOT 3
- I cant load G-discriminator HOT 7
- Test.py HOT 2
- ValueError: Layer sequential expects 1 inputs, but it received 2 input tensors.
- test.py
- train.py
- which branch should I choose? HOT 2
- Can't training the model on GPU HOT 3
- The results seems not good. HOT 15
- Computer available memory is reduced from 14G to 100M until the program is killed HOT 3
- I didn't see obvious differents in the results with or without the local and global D. HOT 1
- predict the test pic HOT 4
- A keras question about bulid network HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image_completion_tf2.