# pix2pix
毕业设计
摘 要
近些年机器学习以及深度学习的快速发展为图像转换任务提供了有效的工具,而GAN的出现更是使得这一领域出现百花齐放、百家争鸣的局面。作为GAN的一个拓展模型,Pix2Pix GAN在源图像与目标图像的转换任务中表现出了非常好的性能,并得到了广泛的应用。因此,本文基于Pix2Pix生成对抗网络,使用maps图像数据集,实现图像转换的算法。
首先,本文阐述了选择maps图像数据集的几个原因以及其获取方式,并对其进行了一定的预处理。之后,对Pix2Pix GAN的相关理论进行简要的分析,从理论上确定了算法的可行性,并为后面确定网络的架构指明了方向。然后,具体分析Pix2Pix GAN所包括的判别器和生成器的网络架构以及实现方式。其中,判别器使用了Patch GAN的结构,而生成器则使用了U-Net的结构,并且两者都是基于卷积神经网络的。接下来,则实际构建Pix2Pix GAN复合模型、初步确定模型的超参数以及训练的参数并对模型进行训练。并且根据初步模型训练的结果对超参数以及参数进行微调,从而能够达到较好的性能。最后,确定了一些图像转换的评价指标,并基于这些指标从训练轮次和网络结构两大方面展开了一系列的对比分析试验,从而观察不同因素对最终模型性能的影响。
经过实验分析,发现由于生成对抗模型训练过程的特殊性,单纯地增加训练轮次并不一定会带来模型性能的提高,且主要是由于梯度消失、模式崩溃等问题造成的。而对于本文所选择的maps数据集,由于图像具有一定的特殊性,生成器跳跃连接添加与否以及损失函数的选择对模型性能的影响较大。当然,总体上本文所设计的图像转换算法模型在maps图像数据集上取得了不错的效果,但其训练过程仍存在着一定的困难,以及最终得到的模型性能仍有待提高,值得进一步地去探索。
关键词: 生成对抗网络,图像转换,机器学习,深度学习
Abstract
In recent years, the rapid development of machine learning and deep learning has provided effective tools for image transformation tasks, and the emergence of GAN has made a hundred flowers blossom and a hundred schools of thought contend in this field. As an extended GAN model, Pix2Pix GAN has shown excellent performance in the conversion task of source image and target image, and has been widely used. Therefore, this paper generates an adversation network based on Pix2Pix and uses maps image data set to realize the algorithm of image conversion.
Firstly, this paper describes several reasons for choosing maps image data set and its acquisition methods, and preprocesses it to a certain extent. Then, the relevant theories of Pix2Pix GAN are briefly analyzed, the feasibility of the algorithm is theoretically determined, and the direction of the network architecture is pointed out.
Then, the network architecture and implementation of the discriminator and generator included in Pix2Pix GAN are analyzed. Among them, the discriminator uses the structure of Patch GAN, while the generator uses the structure of U-Net, and both of them are based on convolutional neural network. Then, the composite model of Pix2Pix GAN is actually constructed, the hyperparameters and training parameters of the model are preliminarily determined and the model is trained. And according to the results of the preliminary model training to fine-tune the super parameters and parameters, so as to achieve better performance. Finally, some evaluation indexes of image conversion are determined, and based on these indexes, a series of comparative analysis experiments are carried out from two aspects of training rounds and network structure, so as to observe the influence of different factors on the performance of the final model.
Through experimental analysis, it is found that because of the particularity of training process of generating confrontation model, simply increasing training rounds does not necessarily improve the performance of the model, and it is mainly caused by problems such as gradient disappearance and mode collapse. For the maps data set selected in this paper, due to the particularity of the image, whether the generator jump connection is added or not and the selection of the loss function have a great impact on the model performance. Of course, in general, the image conversion algorithm model designed in this paper has achieved a good effect on maps image data set, but there are still some difficulties in the training process, and the performance of the final model still needs to be improved, which is worth further exploration.
Key words: Pix2Pix GAN,Image Conversion,Machine Learning,Deep Learning
目 录
摘 要 II
Abstract III
1 绪论 1
1.1 背景与意义 1
1.2 国内外研究现状 3
1.2.1 研究现状 3
1.2.2 现状总结 4
1.3 研究内容及论文结构 4
1.3.1 研究内容 4
1.3.2 论文结构 5
2 maps图像数据集获取与预处理 7
2.1 获取数据集 7
2.2 图像预处理 8
2.3 本章小结 13
3 基于Pix2Pix GAN的图像转换模型与算法 14
3.1 Pix2Pix GAN相关理论介绍 14
3.2 判别器模型设计与算法 18
3.3 生成器模型设计与算法 27
3.4 复合模型设计与算法 32
3.5 图像转换评价标准选择与算法 34
3.5.1 峰值信噪比(PSNR) 34
3.5.2 结构相似性指标(SSIM) 34
3.5.3 语义分割评价指标 36
3.6 本章小结 38
4 实验分析 39
4.1 实验环境配置 39
4.2 实验方案设计 40
4.3 不同训练轮次的模型性能结果及分析 41
4.4 不同网络结构的模型性能结果及分析 52
4.4.1 不同判别器结构模型性能 53
4.4.2 不同生成器结构模型性能 55
4.4.3 不同损失函数模型性能 57
4.5 本章小结 60
5 工作总结与展望 61
5.1 研究总结 61
5.2 工作展望 61
致谢 63
参考文献 65
1 绪论
1.1 背景与意义
近几年来,人工智能领域发展迅速,其中在机器学习以及深度学习方面所取得的成果更是令人眼花缭乱,它们涉及到金融、医疗、生物、教育等不同的领域。当然,机器学习以及深度学习的快速发展更为图像处理、计算机图形学和计算机视觉等方向的研究提供了有力的解决方案。这些方向所研究的许多任务本质上都可以视为输入图像与相应输出图像之间的转换。尽管这些任务的总体目标都是建立两张图像像素与像素之间的映射关系,但在早期这些任务都是通过不同的各自独立的机器学习来完成的。显然,当我们需要解决不同的图像转换任务时,需要建立不同的模型。不同于传统的分类、回归等模型,完成这些任务的模型称为生成式模型,目前有自回归模型(Autoregressive Model)、变分自编码器(VAE)[1]、基于流的模型(Flow-based Model)以及生成对抗网络(GAN)等几种主流的生成式模型。其中,GAN最早是由Ian Goodfellow[2]等人于2014年提出,是一种使用深度学习方法(例如卷积神经网络)进行生成建模的方法,也是本篇论文将要论述的生成式模型。生成建模是机器学习中的无监督学习任务,涉及自动发现和学习输入数据中的规律性或模式,以使该模型可用于生成或输出可能从原始数据集中得出的新示例。GAN是通过将问题设定为具有两个子模型的监督学习问题来训练生成模型的聪明方法:用于训练以生成新示例的生成器模型,以及试图将示例分类为真实示例(来自目标域)或伪造示例(生成的)的判别器模型。这两个模型在一个零和博弈中一起训练,直到判别器模型被愚弄了大约一半的次数,这意味着生成器模型能够生成合理的示例。在GAN被提出�