当前位置:网站首页>Is index reproduction text generation image is score quantitative experiment whole process reproduction inception score quantitative evaluation experiment step on the pit and avoid the pit process
Is index reproduction text generation image is score quantitative experiment whole process reproduction inception score quantitative evaluation experiment step on the pit and avoid the pit process
2022-07-27 02:08:00 【Medium coke with ice】
Catalog
- One 、IS Introduction to scores
- Two 、IS fraction CUB Quantitative experiment steps
- First step :B_VALIDATION Change it to True
- The second step : Configure the trained generator
- The third step : Sampling generates images
- Step four : download IS Code and configure
- Step five : Download pre trained inception mode And configuration
- Step six : To configure inception_score.py, Change the read path
- Step seven : Start quantitative evaluation
- Last
One 、IS Introduction to scores
The evaluation of text generated images is also a very challenging work ,IS Score is a general index to measure image quality .
IS Yes KL Mathematical knowledge of divergence and entropy , Its main principle is to calculate p(y|x) and p(y) The divergence between ,IS The higher the score, the better .
Two 、IS fraction CUB Quantitative experiment steps
With DF-GAN As an example :
First step :B_VALIDATION Change it to True
according to DF-GAN Official documents of , First of all, will bird.yml Medium B_VALIDATION Change it to True:
The second step : Configure the trained generator
Configure trained model, And put it in code/bird in , Rename it to netG.pth,DF-GAN The official also gave a well-trained model : The official link , Those who cannot open the official link can click CSDN link , After downloading, put it into the specified folder .
The third step : Sampling generates images
function :python main.py --cfg cfg/bird.yml
Possible problems 1:RuntimeError: Attempting to deserialize object on CUDA device
1 but torch.cuda.device_count() is 1
Question why : The model uses several blocks during training GPU, But this machine only 1 block GPU
Solution : Designated for “cuda:0”, Find two torch.load()
The first place is main.py Of the 57 That's ok :netG.load_state_dict(torch.load('models/%s/netG.pth' % (cfg.CONFIG_NAME))Change it to :netG.load_state_dict(torch.load('models/%s/netG.pth' % (cfg.CONFIG_NAME), map_location='cuda:0'))
The second place is the second 254 Change it to :state_dict = torch.load(cfg.TEXT.DAMSM_NAME, map_location='cuda:0')
Possible problems 2:
RuntimeError: Error(s) in loading state_dict for NetG:
size mismatch for fc.weight: copying a param with shape torch.Size([4096, 100]) from checkpoint, the shape in current model is torch.Size([1024, 100]).
size mismatch for fc.bias: copying a param with shape torch.Size([4096]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for block0.c1.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 64, 3, 3])
Question why : When loading the model , The parameter does not correspond to , Size mismatch
Solution : Check the trained model model.py And do quantitative at this time model.py Whether or not the same , see yml Whether the size of the file is set the same , especially NF Parameter settings . If used DF-GAN Officially trained models , To put NF Set to 32, Others should also be consistent :
After successful operation , It will automatically sample and generate several pictures , The successful 
Step four : download IS Code and configure
Official IS fraction (StackGAN Used ) Code :github link , Put it in the folder in the following location :
Step five : Download pre trained inception mode And configuration
Download pre trained inception model: The official link 、 If you can't open it, you can click :CSDN link , Put it in the specified location of the folder , The location is as follows :

Step six : To configure inception_score.py, Change the read path
open inception_score.py Code for , Locate the 41 Row to 49 That's ok :
You can see that there are two file addresses , The first address indicates where to read the pre trained inception model checkpoints, Change it to your own path :
tf.app.flags.DEFINE_string('checkpoint_dir',
'../birds_valid299/model.ckpt',
"""Path where to read model checkpoints.""")
The second path refers to where to read the sampled pictures , Also change it to your own path :
tf.app.flags.DEFINE_string('image_folder',
'../test/valid/single',
"""Path where to load the images """)
Step seven : Start quantitative evaluation
Input... At the terminal :python inception_score.py --image_folder ../test/valid/single
It is shown as follows :
It's done , It can be seen that the result of this time is 4.61, Error is ±0.13!
Last
Personal profile : Graduate students in the field of artificial intelligence , At present, I mainly focus on text generation and image generation (text to image) Direction
Personal home page : Medium coke with more ice
Time limited free subscribe : Text generated images T2I special column
Stand by me : give the thumbs-up + Collection ️+ Leaving a message.
If this article helps you a lot , I hope you can give me a coke ! Add more ice
边栏推荐
- MySQL multi table query
- JS——初识JS、变量的命名规则,数据类型
- 6.28大华笔试
- JS -- first understand the naming rules and data types of JS and variables
- 6.28同花顺笔试
- 6.30滴滴面经(一面+二面)
- Enumerated valueof() method stepping on the pit
- Share 29 chrome plug-ins, and there is always one for you
- SQL anti injection regular expression
- [reprint] GPU compute capability table
猜你喜欢

高度塌陷解决方法

IO function of standard C library

ERROR! MySQL is not running, but PID file exists

mysql一个select语句的执行过程

MySQL view

Gan's training skills: alchemist cultivation plan - generative confrontation network training, participation and improvement

Text to image intensive reading of paper gr-gan: gradually refine text to image generation
![[translation] explicit and implicit batch in tensorrt](/img/17/3f00697d53ff43cd881960849da5f7.png)
[translation] explicit and implicit batch in tensorrt

Solution: various error reporting and pit stepping and pit avoiding records encountered in the alchemist cultivation plan pytoch+deeplearning (III)

mysql的安装
随机推荐
DF-GAN实验复现——复现DFGAN详细步骤 及使用MobaXtem实现远程端口到本机端口的转发查看Tensorboard
shell课程总结
(codeforce 807div2)C. Mark and his unfinished essay (thinking)
解决方案:炼丹师养成计划 Pytorch+DeepLearning遇见的各种报错与踩坑避坑记录(一)
The gradient descent method and Newton method are used to calculate the open radical
TIM输出比较——PWM
机器学习概述
Unity Huatuo example project source code analysis and inspiration
分库与分表
Enumerated valueof() method stepping on the pit
Connect mysql detailed graphic operations in ECs docker (all)
Solution: various error reporting and pit stepping and pit avoiding records encountered in the alchemist cultivation plan pytoch+deeplearning (III)
【volatile原理】volatile原理
JS——初识JS、变量的命名规则,数据类型
JS 99 multiplication table
Acwing 1057. stock trading IV
详解文本生成图像的仿射变换模块(Affine Transformation)和条件批量标准化(CBN)
[paddleseg source code reading] paddleseg export static graph export Trace in py file
Text to image论文精读DF-GAN:A Simple and Effective Baseline for Text-to-Image Synthesis一种简单有效的文本生成图像基准模型
[FPGA tutorial case 29] the second DDS direct digital frequency synthesizer based on FPGA - Verilog development