GAN
文章平均质量分 86
Mr_health
这个作者很懒,什么都没留下…
展开
-
图像超分辨率评价指标
参考文章:https://zhuanlan.zhihu.com/p/50757421在ESRGAN中采用第二种形式,python的实现如下:def calculate_psnr(img1, img2): # img1 and img2 have range [0, 255] img1 = img1.astype(np.float64) img2 = img2.astype(np.float64) mse = np.mean((img1 - img2)**2)原创 2022-02-15 17:27:28 · 4570 阅读 · 0 评论 -
DSGAN退化网络
非成对的退化1.基本结构 generator 1个conv + 8个resblock + 1个convGenerator( (block_input): Sequential( (0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (1): PReLU(num_parameters=1) ) (res_blocks): ModuleList( (0): Residua原创 2022-02-14 17:34:53 · 1063 阅读 · 0 评论 -
pytorch中交叉熵损失函数的细节
1. 一般分类任务实现:二分类在二分类中,pytorch主要可以应用的损失函数分为以下四个:F.cross_entropy()与torch.nn.CrossEntropyLoss() F.binary_cross_entropy()与torch.nn.BCELoss()之所以将四个函数分成两类,是因为:前者输入是非onehot label + logit,函数会自动将logit通过softmax映射为概率 后者输入的是onehot label + prob(概率,一般是经过softmax后原创 2022-02-10 19:13:39 · 7353 阅读 · 0 评论 -
cycleGAN解析
前言在上一篇博文中我们讲述了pix2pix的方法,见Pix2Pix原理解析,pix2pix的方法适用于成对数据的风格迁移,如下图左边。但是在大多数情况,对于A风格的图像,我们并没有与之相对应的B风格图像,我们所拥有的是一群处于风格A(源域)的图像和一群处于风格B(目标域)的图像,这样pix2pix2的方法就不管用了。CycleGAN的创新点在于能够在源域和目标域之间,无须建立训练数据间一对一的映射,就可实现这种迁移。基本架构cyclegan的原理如下图所示。整个架构结构整理如下:(1)原创 2021-01-12 20:14:08 · 4885 阅读 · 0 评论 -
Pix2Pix原理解析
class UnetGenerator(nn.Module): """Create a Unet-based generator""" def __init__(self, input_nc, output_nc, num_downs, ngf=64, norm_layer=nn.BatchNorm2d, use_dropout=False): """Construct a Unet generator Parameters: in.原创 2021-01-07 19:48:10 · 3369 阅读 · 1 评论 -
pytorch可视化输出的图像
最近在学习GAN,跑了两个目前是sota的开源代码:https://github.com/Tencent/Real-SR以及https://github.com/ManuelFritsche/real-world-sr,前者是在esrgan的基础上做了一定的改动,后者包含dsgan和esrgan-fs两部分,其中esrgan-fs与腾讯的代码均在BasicSR增添了自己的改进,总体的框架基本不变。.在学习的时候,主要是dsgan部分和esrgan部分对输入图片和可视化的操作有一点不同,在此做以记录...原创 2020-10-20 16:16:37 · 4631 阅读 · 0 评论 -
【GAN网络】tensorflow和pytorch实现损失函数
import tensorflow as tf#batch_size = 3,真实数据real_logits=tf.constant([[1.25], [2.5], [-1.7]]) #GAN的话是两分类,因此最后只有一个节点,经过D映射后表示为真的概率 real_prob=tf.nn.sigmoid(real_logits) #真实数据经过D后被判别为真的概率read_labels=tf.ones_like(.原创 2020-09-18 15:00:06 · 1640 阅读 · 1 评论