生成网络的损失函数

1. medSynthesis

criterion_bce=nn.BCELoss()

loss_real = criterion_bce(outputD_real,real_label)
loss_real.backward()

loss_fake = criterion_bce(outputD_fake,fake_label)
loss_fake.backward()
            
lossD = loss_real + loss_fake

或者是

outputD_real = netD(labels)
outputD = netD(outputG)
outputD = F.sigmoid(outputD)
lossG_D = opt.lambda_AD*criterion_bce(outputD,real_label) 


outputD_fake = netD(outputG)
outputD_fake = netD(outputG)
outputD_fake = outputD_fake.mean()
lossG_D = opt.lambda_AD*outputD_fake.mean()
lossG_D.backward(mone)

2. HA-GAN

loss_f = nn.BCEWithLogitsLoss()
loss_mse = nn.L1Loss()

y_real_pred = D(real_images_crop, real_images_small, crop_idx)
d_real_loss = loss_f(y_real_pred, real_labels)

fake_images, fake_images_small = G(noise, crop_idx=crop_idx, class_label=None)
y_fake_pred = D(fake_images, fake_images_small, crop_idx)
d_fake_loss = loss_f(y_fake_pred, fake_labels)

d_loss = d_real_loss + d_fake_loss

3. 3dbraingen

G = Generator(noise = latent_dim)
CD = Code_Discriminator(code_size = latent_dim ,num_units = 4096)
D = Discriminator(is_dis=True)
E = Discriminator
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值