SerialLain3170 / adeleine

Automatic line art colorization using various types of hint or without hint
Other
353 stars 47 forks source link

Question about training atari_userhint_v2 with grayscale image #37

Closed crodis-strife closed 2 years ago

crodis-strife commented 2 years ago

I'm developing a grayscale lineart colorization tool, generating the grayscale output image given lineart and grayscale hints. When I tried to training atari_userhint_v2 with grayscale image, the error below occurs:

新點陣圖影像

How can I fix this error? Thank you!

Also, this is the setup in param.yaml.

train: epoch: 1000 snapshot_interval: 1000 batchsize: 1 validsize: 5 out_guide: true gamma: 0.9

dataset: extension: ".jpg" train_size: 512 valid_size: 512 color_space: "gray" line_space: "gray" line_method: ["xdog", "pencil", "blend"]

model: generator: base: 64

in_ch: 5

    in_ch: 3
    lr: 0.0005
    b1: 0.0
    b2: 0.99
    guide: true
    resnext: true
    encoder_type: "res"
    num_layers: 10
    up_layers: [10, 5, 5, 3]
    #up_layers: [10, 5, 5, 1]
    mode: "train"
discriminator:
    base: 64
    #in_ch: 3
    in_ch: 1
    multi: 1
    sn: false
    resnext: true
    patch: true
    lr: 0.0005
    b1: 0.0
    b2: 0.99
    mode: "train"
vgg:
    mode: "eval"

loss: content: 1.0 adv: 0.1 tv: 100000.0 pef: 0.01 fm: 0.0 perceptual: 100000.0 gp: 1.0

SerialLain3170 commented 2 years ago

Thank you for the issue, and I am very sorry for the late reply.

A generator of atari_userhint_v2 is designed to output images that have 3 channels. To obtain grayscale output images, you need to change the code into EqualizedConv2d(base, 1, 3, 1, 1),.

crodis-strife commented 2 years ago

Besides modifying EqualizedConv2d, I also made these modifications.

(1) loss.py loss_py

(2) visualize.py visualize1 visualize2

Now the training process runs properly. process

Thanks for your help!

SerialLain3170 commented 2 years ago

I forgot that there are other places requiring 3 channels. Thank you!