znxlwm / pytorch-cartoongan Goto Github PK
View Code? Open in Web Editor NEWPytorch implementation of CartoonGAN (CVPR 2018)
License: MIT License
Pytorch implementation of CartoonGAN (CVPR 2018)
License: MIT License
Hello ,I have some error: FileNotFoundError: [Errno 2] No such file or directory: 'pre_trained_model'.
I didn't find this file, how to solve it? Thank you very much for your answers
I am trying to test the test.py script from this project. I have downloaded the bash script from the original authors github and got the pth and t7 data.
Hayao_net_G_float.pth
Hayao_net_G_float.t7
What should I insert for testing
parser.add_argument('--pre_trained_model', required=False, default='./pretrained_model/Hayao_net_G_float.pth', help='pre_trained cartoongan model path')
I got the following error
G.load_state_dict(torch.load(args.pre_trained_model))
File "/home/bfu_local/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for generator:
Missing key(s) in state_dict: "down_convs.0.weight", "down_convs.0.bias", "down_convs.3.weight", "down_convs.3.bias", "down_convs.4.weight", "down_convs.4.bias", "down_convs.7.weight", "down_convs.7.bias", "down_convs.8.weight", "down_convs.8.bias", "resnet_blocks.0.conv1.weight", "resnet_blocks.0.conv1.bias", "resnet_blocks.0.conv2.weight", "resnet_blocks.0.conv2.bias", "resnet_blocks.1.conv1.weight", "resnet_blocks.1.conv1.bias", "resnet_blocks.1.conv2.weight", "resnet_blocks.1.conv2.bias", "resnet_blocks.2.conv1.weight", "resnet_blocks.2.conv1.bias", "resnet_blocks.2.conv2.weight", "resnet_blocks.2.conv2.bias", "resnet_blocks.3.conv1.weight", "resnet_blocks.3.conv1.bias", "resnet_blocks.3.conv2.weight", "resnet_blocks.3.conv2.bias", "resnet_blocks.4.conv1.weight", "resnet_blocks.4.conv1.bias", "resnet_blocks.4.conv2.weight", "resnet_blocks.4.conv2.bias", "resnet_blocks.5.conv1.weight", "resnet_blocks.5.conv1.bias", "resnet_blocks.5.conv2.weight", "resnet_blocks.5.conv2.bias", "resnet_blocks.6.conv1.weight", "resnet_blocks.6.conv1.bias", "resnet_blocks.6.conv2.weight", "resnet_blocks.6.conv2.bias", "resnet_blocks.7.conv1.weight", "resnet_blocks.7.conv1.bias", "resnet_blocks.7.conv2.weight", "resnet_blocks.7.conv2.bias", "up_convs.0.weight", "up_convs.0.bias", "up_convs.1.weight", "up_convs.1.bias", "up_convs.4.weight", "up_convs.4.bias", "up_convs.5.weight", "up_convs.5.bias", "up_convs.8.weight", "up_convs.8.bias".
Unexpected key(s) in state_dict: "conv01_1.weight", "conv01_1.bias", "in01_1.scale", "in01_1.shift", "conv02_1.weight", "conv02_1.bias", "conv02_2.weight", "conv02_2.bias", "in02_1.scale", "in02_1.shift", "conv03_1.weight", "conv03_1.bias", "conv03_2.weight", "conv03_2.bias", "in03_1.scale", "in03_1.shift", "conv04_1.weight", "conv04_1.bias", "in04_1.scale", "in04_1.shift", "conv04_2.weight", "conv04_2.bias", "in04_2.scale", "in04_2.shift", "conv05_1.weight", "conv05_1.bias", "in05_1.scale", "in05_1.shift", "conv05_2.weight", "conv05_2.bias", "in05_2.scale", "in05_2.shift", "conv06_1.weight", "conv06_1.bias", "in06_1.scale", "in06_1.shift", "conv06_2.weight", "conv06_2.bias", "in06_2.scale", "in06_2.shift", "conv07_1.weight", "conv07_1.bias", "in07_1.scale", "in07_1.shift", "conv07_2.weight", "conv07_2.bias", "in07_2.scale", "in07_2.shift", "conv08_1.weight", "conv08_1.bias", "in08_1.scale", "in08_1.shift", "conv08_2.weight", "conv08_2.bias", "in08_2.scale", "in08_2.shift", "conv09_1.weight", "conv09_1.bias", "in09_1.scale", "in09_1.shift", "conv09_2.weight", "conv09_2.bias", "in09_2.scale", "in09_2.shift", "conv10_1.weight", "conv10_1.bias", "in10_1.scale", "in10_1.shift", "conv10_2.weight", "conv10_2.bias", "in10_2.scale", "in10_2.shift", "conv11_1.weight", "conv11_1.bias", "in11_1.scale", "in11_1.shift", "conv11_2.weight", "conv11_2.bias", "in11_2.scale", "in11_2.shift", "deconv01_1.weight", "deconv01_1.bias", "deconv01_2.weight", "deconv01_2.bias", "in12_1.scale", "in12_1.shift", "deconv02_1.weight", "deconv02_1.bias", "deconv02_2.weight", "deconv02_2.bias", "in13_1.scale", "in13_1.shift", "deconv03_1.weight", "deconv03_1.bias".
Thanks a lot for your help.
Best regards!
The paper authors appear to have released their torch implementation here:
https://github.com/FlyingGoblin/CartoonGAN
The readme says some parameters were set arbitrarily because the paper didn't mention them,
could maybe use the ones from the author's implementation?
In the networks.py, I saw the last layer for generator is tanh, and the last layer for discriminator is sigmoid. However, in the network architecture proposed on the paper, the generator and the discriminator doesn't seem to need the last activation layer. Why do we add them?
RuntimeError: Calculated padded input size per channel: (258 x 2). Kernel size: (3 x 3). Kernel size can't be greater than the actual input size.. Any corrections needed for this error?
in pre-training, your recon loss:
Recon_loss = 10 * L1_loss(G_feature, x_feature.detach())
the '10' here is useless.
can you share your train dataset about real photos and cartoon images?
After this plan to expand to the edge of the fuzzy, and then on the edge of the expansion after fuzzy, finally back to the original image, but this process will have a defect, is "we're going to on the edge of the original fuzzy", directly after the fuzzy edge posted back to the original image can make between the edge and the original "gradient zone":
training start!
[1/100] - time: 0.03, Disc loss: nan, Gen loss: nan, Con loss: nan
[2/100] - time: 0.02, Disc loss: nan, Gen loss: nan, Con loss: nan
[3/100] - time: 0.02, Disc loss: nan, Gen loss: nan, Con loss: nan
[4/100] - time: 0.02, Disc loss: nan, Gen loss: nan, Con loss: nan
[5/100] - time: 0.02, Disc loss: nan, Gen loss: nan, Con loss: nan
...
I tried different datasets, and the train loss is nan.
By the way, I see the warning that optimizer is before lr_scheduler, so I adjustment the order of the two.
Could you tell me how to solve this problem? Thank you.
D_real_loss = BCE_loss(D_real, real)
D_fake_loss = BCE_loss(D_fake, fake)
why use loss to optim them to real and fake?
I have a question regarding the input of the VGG network.
Is the (x+1)/2 used as some kind of scaling?
If I put VGG(x) I have the same output dimension of (batch_size, 512, 32, 32)
If so, why do we need to scale it like this?
Thanks!
Best regards!
pytorch-CartoonGAN/CartoonGAN.py
Line 111 in fa4f9a3
Why +1 and divide by 2 is used here??
Hello, I want to know whether you crop anime face as celebA, and how does
I ran the training scripts directly, but can't reproduce the results.
It seems there is no significant difference between the original and generated images:
Is it sensitive to training data? I also used face-cropped celebA as src_data:
and face-cropped danbooru2018 as tgt_data:
Each dataset contains about 1600 images (for fast training)ใ
So, where is the problem? THX~
hello there, I am currently facing an issue of cuda out of memory for running this code. I have Nvidia 1060 6GB. Is there any way to solve this issue?
znxlwm,
The loss functions are giving me NaN values and it seems training is not happening at all. I have traced the error back to the for loop that iterates over the zipped train_loader_src and train_loader_tgt. The for loop never runs because zipping those two data loaders returns an empty list. I think the arguments train_loader_src and train_loader_tgt are empty/malformed. I don't entirely understand how data_load() works but I think that is where my ultimate problem lies. Do you have any advice?
I am new to PyTorch but this CartoonGAN is helping me learn. Thank you for sharing the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.