Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GAN渲染问题 #6

Closed
Imagery007 opened this issue Nov 3, 2020 · 3 comments
Closed

GAN渲染问题 #6

Imagery007 opened this issue Nov 3, 2020 · 3 comments

Comments

@Imagery007
Copy link

你好,我正在复现RPC数据集论文,目前进行到对合成图片进行渲染,发现渲染图片中商品位置发生改变,数量也发生了变化,请问可以详细交流一下渲染训练与测试过程吗,十分感谢,以下是我的训练和渲染过程:

1.我使用了1000张合成图片放入trainA文件夹,1000张RPC数据集真实图片放入突然trainB文件夹,训练了200个epoch。
2.训练指令为python train.py --dataroot ./datasets/goods --name goods_cyclegan --model cycle_gan --pool_size 50 --no_dropout。
3.日志文件最后一个epoch显示:
learning rate 0.0000020 -> 0.0000000
(epoch: 200, iters: 100, time: 0.346, data: 0.206) D_A: 0.142 G_A: 0.519 cycle_A: 0.220 idt_A: 0.078 D_B: 0.034 G_B: 0.762 cycle_B: 0.292 idt_B: 0.068
(epoch: 200, iters: 200, time: 1.660, data: 0.001) D_A: 0.143 G_A: 0.342 cycle_A: 0.360 idt_A: 0.079 D_B: 0.089 G_B: 0.731 cycle_B: 0.314 idt_B: 0.102
(epoch: 200, iters: 300, time: 0.346, data: 0.001) D_A: 0.192 G_A: 0.414 cycle_A: 0.213 idt_A: 0.045 D_B: 0.062 G_B: 0.679 cycle_B: 0.193 idt_B: 0.086
(epoch: 200, iters: 400, time: 0.346, data: 0.002) D_A: 0.182 G_A: 0.421 cycle_A: 0.457 idt_A: 0.080 D_B: 0.028 G_B: 0.803 cycle_B: 0.239 idt_B: 0.134
(epoch: 200, iters: 500, time: 0.345, data: 0.001) D_A: 0.186 G_A: 0.249 cycle_A: 0.273 idt_A: 0.054 D_B: 0.068 G_B: 0.578 cycle_B: 0.211 idt_B: 0.077
(epoch: 200, iters: 600, time: 0.587, data: 0.001) D_A: 0.205 G_A: 0.253 cycle_A: 0.258 idt_A: 0.099 D_B: 0.204 G_B: 0.650 cycle_B: 0.379 idt_B: 0.071
(epoch: 200, iters: 700, time: 0.345, data: 0.001) D_A: 0.157 G_A: 0.469 cycle_A: 0.266 idt_A: 0.064 D_B: 0.099 G_B: 0.426 cycle_B: 0.219 idt_B: 0.083
(epoch: 200, iters: 800, time: 0.346, data: 0.001) D_A: 0.122 G_A: 0.426 cycle_A: 0.400 idt_A: 0.137 D_B: 0.142 G_B: 0.857 cycle_B: 0.431 idt_B: 0.133
(epoch: 200, iters: 900, time: 0.346, data: 0.001) D_A: 0.137 G_A: 0.664 cycle_A: 0.320 idt_A: 0.071 D_B: 0.084 G_B: 0.456 cycle_B: 0.280 idt_B: 0.085
(epoch: 200, iters: 1000, time: 1.736, data: 0.001) D_A: 0.116 G_A: 0.381 cycle_A: 0.288 idt_A: 0.077 D_B: 0.121 G_B: 0.725 cycle_B: 0.296 idt_B: 0.088
saving the latest model (epoch 200, total_iters 200000)
saving the model at the end of epoch 200, iters 200000
End of epoch 200 / 200 Time Taken: 332 sec

4.测试指令为python test.py --dataroot datasets/goods/testA --name goods_pretrained --model test --no_dropout,其中使用的模型为latest_net_G_A.pth模型修改得到的latest_net_G.pth,用于单侧的测试。

最后生成的渲染图片效果不是很理想,如下图所示:
106_real
106_fake
102_real
102_fake

非常希望得到你的帮助,谢谢!

@lufficc
Copy link
Owner

lufficc commented Nov 3, 2020

训练 opt.txt:

----------------- Options ---------------
             aspect_ratio: 1.0                           
               batch_size: 1                             
          checkpoints_dir: ./checkpoints                 
                    count: 3                             	[default: 1]
                crop_size: 256                           
                 dataroot: ./datasets/rpc                	[default: None]
             dataset_mode: test                          	[default: unaligned]
                direction: AtoB                          
          display_winsize: 256                           
                    epoch: latest                        
                     eval: False                         
                  gpu_ids: 0                             
                init_gain: 0.02                          
                init_type: normal                        
                 input_nc: 3                             
                  isTrain: False                         	[default: None]
                load_iter: 0                             	[default: 0]
                load_size: 800                           	[default: 256]
               local_rank: 1                             	[default: 0]
         max_dataset_size: inf                           
                    model: cycle_gan                     	[default: test]
               n_layers_D: 3                             
                     name: rpc                           	[default: experiment_name]
                      ndf: 64                            
                     netD: basic                         
                     netG: resnet_9blocks                
                      ngf: 64                            
               no_dropout: True                          
                  no_flip: False                         
                     norm: instance                      
                    ntest: inf                           
                 num_test: 50                            
              num_threads: 4                             
                output_nc: 3                             
                    phase: test                          
               preprocess: scale_width                   	[default: resize_and_crop]
              results_dir: ./results/                    
           serial_batches: False                         
                   suffix:                               
                  verbose: False                         
----------------- End -------------------

A 和 B 各随机选择 3000 张图片即可

渲染时命令行额外参数为:--model cycle_gan --preprocess scale_width --load_size 800 --dataset_mode test --no_dropout

@ShihuaiXu
Copy link

ShihuaiXu commented Nov 27, 2020

@lufficc @Imagery007
两位朋友您们好,想向你们请教一个问题,
我用gan训练完后也遇到了类似的问题,我只训练了20个epoch,A 和 B 各随机选择 3000 张图片,最后得到的图像如下图所示,图1和图3是real图像,图2和图4是对应得到的fake图像。可以看到,fake图像中有奇怪的黑色物体,请问两位朋友能否帮我看下,是否我训练的epoch数不够导致的,或者是我的训练设置有误,trainA里面放了3000张生成好的图像,trainB里面放了3000张RPC数据集test集,其中使用的模型也是latest_net_G_A.pth模型修改得到的latest_net_G.pth,用于单侧的测试,训练的命令是
python train.py --dataroot ./datasets/rpc --name maps_cyclegan --model cycle_gan
测试的命令是
python test.py --model cycle_gan --dataroot datasets/rpc/testA --preprocess scale_width --load_size 800 --model test --no_dropout --checkpoints_dir maps_cyclegan

synthesized_image_318_real
synthesized_image_318_fake
synthesized_image_426_real
synthesized_image_426_fake

@KingWangJL
Copy link

@lufficc 您好 ,我想问一下,在渲染的时候trainA和trainB都是随机选择的?那trainA和trainB图像中的商品位置、品类等是否需要对应?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants