Table of contents
GAN principle and Pytorch framework to realize GAN (relatively easy to understand)
Pytorch framework implements DCGAN (relatively easy to understand)
The basic principle of CycleGAN and the implementation of Pytorch framework
The basic principle of WGAN and the implementation of WGAN by Pytorch
1. Generate background
Whether it is in our life or in the industrial world, when we acquire images, we all hope to get a clear image, so that we can see the objects and background in the image more clearly, and for the industrial world, this is also very important . For example, in our WeChat shooting system, sometimes due to weather or other reasons, the captured images are blurred or noisy, so the images may not be clear, which is very unfavorable for understanding geography, architecture or natural disasters. In order to remove Noise in the image, this article mainly uses the generative confrontation network (GAN) to achieve image denoising.
2. Data Collection
Tip: This article is mainly to remove Gaussian noise in the image. In fact, there are many types of noise in the image. A clear image will be collected, and the program will be used to add Gaussian noise or salt and pepper noise to the image to obtain a noisy image while retaining the original clear image.
Dataset download:
Link: https://pan.baidu.com/s/1jCFcLb9dVoQJWDOJgspr0A
Extraction code: 69sc
illustrate:
- The downloaded dataset contains clean images and noisy images
- Dataset directory: data
- Original clear image directory: faces
- train
- val
- Image directory with Gaussian noise added: GFaces
- train
- val
- Original clear image directory: faces
- Dataset directory: data
Tip: The procedure for adding Gaussian noise will be given in the following specific implementation.
3. Overall Design Ideas
(1) Generate model
It adopts a network type similar to U-Net
(2) Discriminant model
4. Model denoising effect
(1) Demo demonstration effect
Tip: Here is a program (mainWindow.py) to display the image displayed by the generator, load the generator model saved after the previous training, and then use this model to generate a denoised image, as follows:
(1) Run mainWindow.py The initial interface is as follows
5. GitHub code download
6. Model download
Link: https://pan.baidu.com/s/1KF-WLxhqCUIbUAQzq5sIag
Extraction code: xiit