GithubHelp home page GithubHelp logo

jarrentwu1031 / ccpl Goto Github PK

View Code? Open in Web Editor NEW
188.0 188.0 25.0 53.35 MB

Official Pytorch implementation of CCPL and SCTNet (ECCV2022, Oral)

License: Apache License 2.0

Python 98.47% Shell 1.53%
arbitrary-style-transfer artistic-style-transfer contrastive-learning contrastive-loss deep-learning eccv eccv-2022 eccv2022 image-to-image-translation photo-realistic-style-transfer pytorch style-transfer versatile-style-transfer video-style-transfer

ccpl's People

Contributors

chenxwh avatar heraclitusj avatar jarrentwu1031 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ccpl's Issues

Missing _calc_feat_flatten_mean_std in function.py

very good work.
there's a minor error near line 41 to 47, _calc_feat_flatten_mean_std is missed.
source_f, source_f_mean, source_f_std = _calc_feat_flatten_mean_std(source)
source_f_norm = (source_f - source_f_mean.expand_as(
source_f)) / source_f_std.expand_as(source_f)
source_f_cov_eye =
torch.mm(source_f_norm, source_f_norm.t()) + torch.eye(3)

target_f, target_f_mean, target_f_std = _calc_feat_flatten_mean_std(target)

alpha not used

Hi, it seems that alpha is not used in the test_video_frame.py script

GPU to use

Hi,

I trying to execute train.py, and scripts is asking for GPU parameter,
as I am using Nvidia, so which GPU i should mention.

RuntimeError: Error(s) in loading state_dict for SCT

It is normal to load VGG and Decoder, but this error is reported when loading SCT. Please, tell me why?
RuntimeError: Error(s) in loading state_dict for SCT:
Unexpected key(s) in state_dict: "cnet.4.weight", "cnet.4.bias", "snet.4.weight", "snet.4.bias".
size mismatch for cnet.0.weight: copying a param with shape torch.Size([256, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 256, 1, 1]).
size mismatch for cnet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for cnet.2.weight: copying a param with shape torch.Size([128, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
size mismatch for cnet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).
size mismatch for snet.0.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 256, 3, 3]).
size mismatch for snet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for snet.2.weight: copying a param with shape torch.Size([128, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
size mismatch for snet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).
size mismatch for uncompress.weight: copying a param with shape torch.Size([512, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 32, 1, 1]).
size mismatch for uncompress.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]).

pre-trained models

Hi, are the pre-trained models released here ready to be used for any customised content/style image pairs? Thanks!

transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ?

Hi, thank you for your greate work! I find that your code was not normalized with the pre trained ImageNet value, as shown in the title.
So I add this to the code, but when I use the trained weight to test, the performance is not good.
brad_pitt_stylized_in2
In contrast, I remove regularization and get the same result as yours.
brad_pitt_stylized_in2
So why this difference? Can you tell me the reason? thank you!

Error when loading pretrained SCT

Hi, I met this error when running test_video_frame.py:

Traceback (most recent call last):
  File "test_video_frame.py", line 120, in <module>
    SCT.load_state_dict(torch.load(args.SCT))
  File "D:\Anaconda\envs\CCPL\lib\site-packages\torch\nn\modules\module.py", line 1407, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SCT:
        Unexpected key(s) in state_dict: "cnet.4.weight", "cnet.4.bias", "snet.4.weight", "snet.4.bias".
        size mismatch for cnet.0.weight: copying a param with shape torch.Size([256, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 256, 1, 1]).
        size mismatch for cnet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).    
        size mismatch for cnet.2.weight: copying a param with shape torch.Size([128, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
        size mismatch for cnet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).     
        size mismatch for snet.0.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 256, 3, 3]).
        size mismatch for snet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).    
        size mismatch for snet.2.weight: copying a param with shape torch.Size([128, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
        size mismatch for snet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).     
        size mismatch for uncompress.weight: copying a param with shape torch.Size([512, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 32, 1, 1]).
        size mismatch for uncompress.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]).

It seems like something went wrong when loading the pretrained SCT, so how can I fix it?

Cannot untar the pretrained model

I tried to untar your pre-trained model, but some errors occurred as follows

tar: This does not look like a tar archive
tar: Skipping to the next header
tar: Exiting with failure status due to previous errors

model file: sct_iter_160000.pth.tar
So how to untar this file ?

Supplementary file

Hello, I would like to read the supplementary file of the paper but I can't find it anywhere, could you please help me?

error for running test.py (it seems that the pretrained sct_iter_160000.pth.tar is wrong for artistic style)

Hi,

When I try to run the following script:
python test.py --content input/content/lenna.jpg --style input/style/in2.jpg --decoder artistic/decoder_iter_160000.pth.tar --SCT artistic/sct_iter_160000.pth.tar --testing_mode artistic

I got some errors:
File "test.py", line 128, in
SCT.load_state_dict(torch.load(args.SCT))
File "/home/huiqin/anaconda3/envs/torch18/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1604, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for SCT:
Unexpected key(s) in state_dict: "cnet.4.weight", "cnet.4.bias", "snet.4.weight", "snet.4.bias".
size mismatch for cnet.0.weight: copying a param with shape torch.Size([256, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([128, 256, 1, 1]).
size mismatch for cnet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for cnet.2.weight: copying a param with shape torch.Size([128, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
size mismatch for cnet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).
size mismatch for snet.0.weight: copying a param with shape torch.Size([256, 512, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 256, 3, 3]).
size mismatch for snet.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([128]).
size mismatch for snet.2.weight: copying a param with shape torch.Size([128, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 128, 1, 1]).
size mismatch for snet.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([32]).
size mismatch for uncompress.weight: copying a param with shape torch.Size([512, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 32, 1, 1]).
size mismatch for uncompress.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([256]).

hi,i want to ask some question

First of all, I'm glad to see your amazing works,,Can your model apply to the conversion of the style of underwater images to that of land? If I want to do so, what do I need to prepare? For example, I now have a ready-made underwater fish data set

add web demo/models/datasets to ECCV 2022 organization on Hugging Face

Hi, congrats for the acceptance at ECCV 2022. We are having an event on Hugging Face for ECCV 2022, where you can submit spaces(web demos), models, and datasets for papers for a chance to win prizes. The hub offers free hosting and would make your work more accessible to the rest of the community. Hugging Hub works similar to github where you can push to user profiles or organization accounts, you can add the models/datasets and spaces to this organization:

https://huggingface.co/ECCV2022

after joining the organization using this link: https://huggingface.co/organizations/ECCV2022/share/kZuMIwRJKOTteDgoueNuPAMUGSnfDjWAGq

let me know if you need any help with the above steps, thanks

video

Can you give me *.py file for extracting frames from video

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.