当前位置:网站首页>Gan model architecture in mm
Gan model architecture in mm
2022-07-03 00:28:00 【Kun Li】
mmgeneration Medium GAN The architecture of includes , Enter a real image , If it's a condition gan Words , What you input is a real image and the corresponding label ,
1. First, train the discriminator , The gradient in the discriminator is saved during training , And the discriminator optimizer zero_grad(),gan There is an optimizer in the generator and the discriminator , It's actually two relatively independent training processes .
2. When training the discriminator, the generator is also used to generate a false sample , Note that the generator at this time is not trained , Just generate a fake sample , In terms of gan when , There is also a batch_accumulation_step Steps for , It will train several more times during generator training .
3. Use a discriminator to distinguish between true samples and false samples , Calculate the loss of discriminator training , natural ganloss And the corresponding auxiliary losses , Put it in disc_auxiliary_loss in , Feeling gan There are not many directions that can be expanded in , Architecturally speaking transformers perhaps self-attention And so on. , In theory, it is basically a loss function ,l Some operations on constraints , So at this time gen_auxiliary_loss Is a different point . The discriminator's loss It is essentially a two category , Negative sample input , The label given is 0, The label of positive sample input is 1.
4. After calculating the loss ,loss_disc.bachward() Back propagation ,optimizer['disciminator'].step() Gradient update , Here the discriminator is trained .
5. Conduct 5-8 After the discriminator training of the wheel, start the steering generator training , In fact, the gradient is cleared before each training , It is equivalent to not accumulating gradients in each round , First, the gradient of the discriminator is not saved , Notice when training the discriminator at the beginning , The gradient of the discriminator is preserved , Then the gradient of the generator is zero_grad().
6. Training generator , The input of the generator is still noise , After getting the image of the generator , Perform a discriminator decision , The last layer of the discriminator is usually a Linear(n,1) The layer , That is, the output is N,1 Dimensional , Input to gen_loss in , here gen_loss The middle core is also an auxiliary loss gen_auxiliary_loss in , Some may also be added here l Constraints and so on .
7. After calculating the loss ,loss_gen.backward() Back propagation ,optimizer['generator'].step() Gradient update , Generator training complete .

The figure above shows the structure of a typical generator and discriminator , In generator , We need a module that converts noise vectors into two-dimensional features , That is to say noise2feat block. Next, several upsampling blocks are needed to convert the low-resolution features into high-resolution features , stay DCGAN in , We use transposed convolution To achieve . Last , Need one to_rgb Block to map the number of channels of the feature graph to 3 passageway , So as to generate pictures . The discriminator is actually an inversion of the generator , We need to pass img2feat And a large number of down sampled blocks will continuously reduce the resolution of the feature map , Finally delivered to decision head, To judge the current input image .
边栏推荐
- How do educators find foreign language references?
- Which websites can I search for references when writing a thesis?
- FRP reverse proxy +msf get shell
- Digital collection trading website domestic digital collection trading platform
- ftrace工具的介绍及使用
- JSON conversion tool class
- 多进程编程(三):消息队列
- [shutter] Introduction to the official example of shutter Gallery (learning example | email application | retail application | wealth management application | travel application | news application | a
- Is there a specific format for English papers?
- Implement the foreach method of array
猜你喜欢

Architecture: load balancing

Digital twin visualization solution digital twin visualization 3D platform

可下载《2022年中国数字化办公市场研究报告》详解1768亿元市场

Which websites can I search for references when writing a thesis?

布隆过滤器

Understanding and application of least square method

字符设备注册常用的两种方法和步骤

Multiprocess programming (I): basic concepts

Custom throttling function six steps to deal with complex requirements

【单片机项目实训】八路抢答器
随机推荐
[shutter] image component (image component introduction | image constructor | image.network constructor | image.asset constructor)
Andorid 获取系统标题栏高度
MySQL advanced learning notes (III)
[shutter] Introduction to the official example of shutter Gallery (project introduction | engineering construction)
Go custom sort
Multi process programming (III): message queue
Bypass AV with golang
写论文可以去哪些网站搜索参考文献?
Slf4j + logback logging framework
大学生课堂作业2000~3000字的小论文,标准格式是什么?
Basic 10 of C language: array and pointer
Multiprocess programming (V): semaphores
Basic use of shell script
What website can you find English literature on?
How QT exports data to PDF files (qpdfwriter User Guide)
About the practice topic of screen related to unity screen, unity moves around a certain point inside
Which websites can I search for references when writing a thesis?
MySQL 23 classic interview hanging interviewer
[shutter] open the third-party shutter project
NC24325 [USACO 2012 Mar S]Flowerpot