Comments (3)
Actually the same. Since we wrote our paper from the vallina GAN objective, for the vallina GAN, the output of discriminator is [0, 1], the probablity, and we add the -0.5 in the paper for consistency. In the implementation, we follow the StyleGAN-ADA and the discriminator outputs the logits, which could be negative, hence we use
from diffusion-gan.
(1) If you use sigmoid as the final activation function to rescale the output to [0, 1], then you should use r_d = (d_real.detach() - 0.5).sign().mean()
.
(2) we use concat and it works in our case, but I think better architecture design could benefit more here.
from diffusion-gan.
@Zhendong-Wang Hello again, and I have a few questions here:
(1) If to use r_d
with LSGAN loss, that is, the discriminator D will learn to regress to 0.0 ~ 1.0, without the last activation layer (just logit):
class Discriminator(nn.Module):
def __init__(self):
super(Discriminator, self).__init__()
self.mynet = MyNetwork() # has NO last activation layer such as sigmoid
def forward(self, img, t):
batch_size, H, W = img.size(0), img.size(-2), img.size(-1)
t = torch.ones(batch_size, 1, H, W) * t.view(-1, 1, 1, 1)
x = torch.cat((img, t), dim=1) # Is this correct?
x = self.mynet(x)
return x # logit, without the last activation layer
loss = nn.MSELoss()
# ... extra code omitted
real_diffused, t = diffusion(real)
d_real = discriminator(real_diffused, t)
# ... extra code omitted
d_loss_real = loss(d_real, torch.ones_like(d_real))
d_loss_fake = loss(d_fake, torch.zeros_like(d_fake))
r_d = (d_real.detach() - 0.5).sign().mean()
In this case, r_d = (d_real.detach() - 0.5).sign().mean()
is correct?
(2) In the above code block, intoducing the time step t
as concat, just as the condition concat, is okay?
Or, a trainable structure, such as a fully-connected linear layer or single convolutional layer would be required?
Thank you !! :-)
from diffusion-gan.
Related Issues (20)
- No module named 'upfirdn2d_plugin' HOT 5
- AssertionError: Default process group is not initialized HOT 1
- RuntimeError: Both events must be recorded before calculating elapsed time. HOT 3
- ninja: build stopped: subcommand failed. HOT 5
- Error while running train.py HOT 3
- 'tuple' object is not callable HOT 1
- how to lower fid? HOT 2
- Use Diffusion-GAN in Other GAN Architecture HOT 2
- How to use Diffusion-GAN in GP-UNIT
- A tiny question in diffusion.py HOT 2
- FID discrepancy HOT 3
- Application HOT 1
- about the value of target HOT 1
- regarding the setting of the hyperparameter "ada_kimg" HOT 4
- grid_sampler_2d_backward() is missing value for argument 'output_mask'.
- How to modify discriminator to incorporate diffusion timestep t?
- Questions about adaptive diffusion. HOT 2
- About the dataset preprocessing HOT 1
- How to use in Our Model?
- Generation includes reverse process of Diffusion? HOT 3
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 diffusion-gan.