Coder Social home page Coder Social logo

omerbt / splice Goto Github PK

View Code? Open in Web Editor NEW
360.0 11.0 33.0 210.51 MB

Official Pytorch Implementation for "Splicing ViT Features for Semantic Appearance Transfer" presenting "Splice" (CVPR 2022 Oral)

Home Page: https://splice-vit.github.io/

Python 4.27% Jupyter Notebook 95.73%
generative-models vision-transformer splice image-translation style-transfer single-image-generation single-image cvpr2022

splice's People

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

splice's Issues

Batch Size?

Hello, very cool project! Is there a parameter to change the batch size? It seems that 8GB of VRAM isn't enough and I'm getting CUDA OOM errors. I've tried lowering the image resolutions but I still get the same issue.

Memory leakage causes running time to increase from epoch to epoch

Pytorch version 1.10.1
CUDA version 11.3

When running the model, the time per iteration increases with each epoch.
When printing
import os, psutil; process = psutil.Process(os.getpid()); print(process.memory_info().rss),
the memory used by the CPU increases with each epoch.
After digging a bit, I think the issue is with the handlers, that are removed but aren't deleted from the hook_handlers list (the length of the hook_handlers list keeps increasing), so python's garbage collector does not collect them.

Experiments with multiple target images

Hi!

I love your work and have a question regarding multiple target images.
Have you experimented with multiple target images?
For example:
Source Domain - Horses
Target Domain - Zebras
What happens if we pick a new zebra image as the target for every epoch?

Thanks!

URLError: <urlopen error>

Hi, thanks for your great work.
when I try to training model, meet this error.
self.model = torch.hub.load('facebookresearch/dino:main', model_name).to(device) -- > URLError:
It maybe my machine is no internet, but I try using "torch.save()" , and "torch.load" to replace "torch.hub.load " , it was error again.
what shoud I fix this? Thanks again , waiting for your reply.

Codes of Inversion.

Dear authors:

Thanks for sharing your interesting work! Can you share the codes of inversion? Thanks!

Disabling L_struct

I'm trying to recreate the results in figure 9 in your paper. Specifically, disabling L_structure. Are both lambda_global_ssim and lambda_entire_ssim taken together form the entirety of L_struct or am I misreading the code?

So far tinkering with the various lambda terms, it seems the result always retains very high structural fidelity to the structure image.

CUDA out of memory after a few epochs

Trying your code in Colab, everything goes well for a few minutes (~300 epochs) and then it gets a CUDA memory error. Is there a leak somewhere?
https://colab.research.google.com/drive/17UgzBmKtqRXniuG6fHqMGh3xIaVIJnd2?usp=sharing

Traceback (most recent call last):
  File "train.py", line 87, in <module>
    train_model(dataroot)
  File "train.py", line 58, in train_model
    losses = criterion(outputs, inputs)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/Splice/util/losses.py", line 64, in forward
    losses['loss_global_cls'] = self.calculate_crop_cls_loss(outputs['x_global'], inputs['B_global'])
  File "/content/Splice/util/losses.py", line 90, in calculate_crop_cls_loss
    cls_token = self.extractor.get_feature_from_input(a)[-1][0, 0, :]
  File "/content/Splice/models/extractor.py", line 84, in get_feature_from_input
    self.model(input_img)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/facebookresearch_dino_main/vision_transformer.py", line 212, in forward
    x = blk(x)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1071, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/facebookresearch_dino_main/vision_transformer.py", line 108, in forward
    y, attn = self.attn(self.norm1(x))
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1071, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/facebookresearch_dino_main/vision_transformer.py", line 85, in forward
    attn = (q @ k.transpose(-2, -1)) * self.scale
RuntimeError: CUDA out of memory. Tried to allocate 30.00 MiB (GPU 0; 11.17 GiB total capacity; 10.35 GiB already allocated; 23.81 MiB free; 10.68 GiB reserved in total by PyTorch)

ValueError: high is out of bounds for int32 in seed

In the beginning, the seed is being created as int32 for some reason.
Maybe pick a lower seed?

Traceback (most recent call last):
  File "train.py", line 88, in <module>
    train_model(dataroot)
  File "train.py", line 28, in train_model
    seed = np.random.randint(2 ** 32)
  File "mtrand.pyx", line 745, in numpy.random.mtrand.RandomState.randint
  File "_bounded_integers.pyx", line 1343, in numpy.random._bounded_integers._rand_int32
ValueError: high is out of bounds for int32

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.