Giter Site home page Giter Site logo

rgeirhos / stylized-imagenet Goto Github PK

View Code? Open in Web Editor NEW
497.0 13.0 63.0 988 KB

Code to create Stylized-ImageNet, a stylized version of standard ImageNet (ICLR 2019 Oral)

Home Page: https://openreview.net/forum?id=Bygh9j09KX

License: MIT License

Python 97.86% Shell 2.14%
deep-learning style-transfer computer-vision human-vision shape-bias texture-bias

stylized-imagenet's People

Contributors

dependabot[bot] avatar rgeirhos 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stylized-imagenet's Issues

can not use torch.legacy for torch version==1.1.0

Thanks for your sharing. I run the code as you suggested in the readme file and found the torch.legacy (in file torch_to_pytorch.py )has been removed since version==0.4, but we are recommended to install torch with version==1.1.0. Could you check that?
AND load_lua was also removed since version==0.5

Custom dataset

Is it possible to create stylized VOC? If so could you tell me how to do this? Thanks!

Issue with RuntimeError in Stylized-ImageNet Preprocessing

I hope this message finds you well. I am writing to seek your assistance with an issue I've encountered while using your Stylized-ImageNet code, specifically during the preprocessing of ImageNet validation data.

I am encountering a runtime error in the preprocessing script (preprocess_imagenet.py). The error occurs at the point of applying transformations to the input data. Here is the traceback for your reference:

Preprocessing validation data:
content.shape torch.Size([1, 3, 224, 224])
Traceback (most recent call last):
  File "preprocess_imagenet.py", line 211, in <module>
    main()
  File "preprocess_imagenet.py", line 129, in main
    targetdir = os.path.join(g.STYLIZED_IMAGENET_PATH, "val/"))
  File "preprocess_imagenet.py", line 166, in preprocess
    input = transform(input)
  File "/home/Stylized-ImageNet-master/code/adain.py", line 75, in get_style_tensor_function
    content_tensor = content_tensor)
  File "/home/Stylized-ImageNet-master/code/adain.py", line 195, in transfer_tensor_to_tensor
    output_to_cpu = output_to_cpu)
  File "/home/Stylized-ImageNet-master/code/adain.py", line 216, in transfer_single_style
    alpha = self.args.alpha).data
  File "/home/Stylized-ImageNet-master/code/adain.py", line 240, in transfer_helper
    content_f = self.vgg(content)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 282, in forward
    self.padding, self.dilation, self.groups)
  File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 90, in conv2d
    return f(input, weight, bias)
RuntimeError: CUDNN_STATUS_EXECUTION_FAILED

The error seems to be related to the convolution operations in PyTorch, as suggested by the CUDNN_STATUS_EXECUTION_FAILED message. I am currently using PyTorch version 0.4.1 in a Python 3.6 environment.

I have attempted several troubleshooting steps, including [mention any specific steps you have taken, like checking CUDA/cuDNN versions, ensuring sufficient GPU memory, etc.]. However, the issue persists.

I would greatly appreciate any insights or suggestions you might have regarding this error. Your guidance would be invaluable in helping me resolve this issue and continue with my work using Stylized-ImageNet.

Thank you very much for your time and assistance. I look forward to hearing from you.

Best regards!

Can you share the vgg_normalised.pth,.py,decoder.pth,.py and so on?

from torch.utils.serialization import load_lua need torch 0.4 but my version is 1.0. And when I reinstall torch 0.4,there alse has a error:no such a dictionary:'home/faustino/python_workshop/Stylized-ImageNet/models/vgg_normalised.py'

When i creat a 'vgg_normalised.py' in this place,another error occurs:no such a dictionary:'home/faustino/python_workshop/Stylized-ImageNet/models/vgg_normalised.pth'

This time is not useful to creat a 'vgg_normalised.pth'

Conflicting torch / numpy versions

Hello! I'd really like to use this library but pytorch 0.4.1 is only supported through python 3.7 and numpy 1.22.0 is supported starting with python 3.8. Using an older version of numpy causes an import error. Any suggestions? I have 1 nvidia GPU and I'm using conda to set up my env. Thanks!

Also, when I try the docker route I get the error: Running as root is not recommended. Use --allow-root to bypass

Fraction of 'shape' decisions and Fraction of 'texture' decisions

Hi Robert,
This is more of a question than an issue, in Figure 4: How did you decide "Fraction of 'shape' decisions" and "Fraction of 'texture' decisions". In case of humans you can simply ask them if they went with the shape or the texture but in the case of the CNNs how did you calculate the percentage?

About checkpoint file

Hi, I just want to double check that you use the pre-trained vgg19 and decoder networks from AdaIN paper to stylize the ImageNet dataset, right? You did not re-train the decoder based on your dataset.

Please point out if I make any mistake.

Thanks!

docker image missing requirements

Hi, fyi - the docker image did not have tensorboardX installed and also, protobuf needed to be updated to version 3.6.0. This was causing errors.

Also, roughly how long does it take for create_stylized_imagenet.sh to complete?

Thanks!

Kaggle's painter-by-numbers dataset is not found

I tried to download Kaggle's painter-by-numbers dataset from the link mentioned in README. But it is not there. Can you please provide modified link for downloading Kaggle's painter-by-numbers dataset?? Thanks

[Request] requirements.txt

Hi! Thanks a bunch for this great repo.
Just to make things easy for us lazy users, would it be possible to provide a requirements.txt so that I don't have to keep running the script again and again just to find out what libraries I need? Alternatively, give me a one-liner for the docker? A link to a docker image doesn't tell me how I am supposed to specify the paths and run it properly.

imagenet root problem.

I set the IMAGENET_PATH to where I store the datasets, but I got this problem when I run the code:

Traceback (most recent call last):
File "preprocess_imagenet.py", line 211, in
main()
File "preprocess_imagenet.py", line 111, in main
sampler = None)
File "preprocess_imagenet.py", line 93, in init
target_transform = target_transform)
File "/users/k1898460/.conda/envs/SIN/lib/python3.6/site-packages/torchvision/datasets/folder.py", line 209, in init
target_transform=target_transform)
File "/users/k1898460/.conda/envs/SIN/lib/python3.6/site-packages/torchvision/datasets/folder.py", line 87, in init
"Supported extensions are: " + ",".join(extensions)))
RuntimeError: Found 0 files in subfolders of: /mnt/lustre/users/k1898460/ILSVRC/Data/CLS-LOC/val
Supported extensions are: .jpg,.jpeg,.png,.ppm,.bmp,.pgm,.tif,.tiff,webp

The files in val folder are like this:
ILSVRC2012_val_00024986.JPEG ILSVRC2012_val_00049986.JPEG
ILSVRC2012_val_00024987.JPEG ILSVRC2012_val_00049987.JPEG
ILSVRC2012_val_00024988.JPEG ILSVRC2012_val_00049988.JPEG
ILSVRC2012_val_00024989.JPEG ILSVRC2012_val_00049989.JPEG
ILSVRC2012_val_00024990.JPEG ILSVRC2012_val_00049990.JPEG
ILSVRC2012_val_00024991.JPEG ILSVRC2012_val_00049991.JPEG
ILSVRC2012_val_00024992.JPEG ILSVRC2012_val_00049992.JPEG
ILSVRC2012_val_00024993.JPEG ILSVRC2012_val_00049993.JPEG
ILSVRC2012_val_00024994.JPEG ILSVRC2012_val_00049994.JPEG
ILSVRC2012_val_00024995.JPEG ILSVRC2012_val_00049995.JPEG
ILSVRC2012_val_00024996.JPEG ILSVRC2012_val_00049996.JPEG
ILSVRC2012_val_00024997.JPEG ILSVRC2012_val_00049997.JPEG
ILSVRC2012_val_00024998.JPEG ILSVRC2012_val_00049998.JPEG
ILSVRC2012_val_00024999.JPEG ILSVRC2012_val_00049999.JPEG
ILSVRC2012_val_00025000.JPEG ILSVRC2012_val_00050000.JPEG

Is something wrong?

recommendations for training

I'm currently training a variation on darknet19 on IN+SIN at 224 x 224
My aim is to get the highest AP object detector that I can based on transfering from these weights. I understand that in the original paper, best results were achieved by training on IN + SIN and then finetuning on IN only. At what point would you suggest doing the finetuning? Is it after the AP for IN+SIN has started to level off or whilst it is still rising?
I also plan to finetune at a greater resolution - maybe 448 x 448 - do you think I should do this after finetuning on IN only at 224 x 224 ?

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.