GithubHelp home page GithubHelp logo

xiezhy6 / pasta-gan Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 23.0 333 KB

Official code for NeurIPS 2021 paper "Towards Scalable Unpaired Virtual Try-On via Patch-Routed Spatially-Adaptive GAN"

Python 95.27% C++ 1.39% Cuda 3.13% Shell 0.13% Dockerfile 0.09%

pasta-gan's People

Contributors

xiezhy6 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

Watchers

 avatar  avatar  avatar

pasta-gan's Issues

pre-trianed model

Hi, Thanks for sharing your work. Will you plan to release the pretrained model?

modify a Dockerfile

FROM nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu18.04 as base

FROM base as base-amd64

FROM base-amd64

FROM pytorch/pytorch:1.7.1-cuda11.0-cudnn8-runtime
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install gcc -y
RUN pip3 install cython --use-feature=2020-resolver
RUN pip3 install torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html --use-feature=2020-resolver
RUN pip3 install scikit-build click requests tqdm pyspng ninja imageio-ffmpeg==0.4.3 --use-feature=2020-resolver
RUN pip3 install psutil scipy matplotlib opencv-python scikit-image pycocotools --use-feature=2020-resolver
RUN pip3 install pillow --use-feature=2020-resolver
RUN apt-get install openssh-server -y
RUN service ssh start
EXPOSE 22

Training time

Hi, Thanks for sharing your work,How long does it take to train to get a good model

Cant run on windows

When I try to run the inference it gives the following error:

Loading networks from "data/network-snapshot-004000.pkl"...
Loading custom kernel...
Traceback (most recent call last):
File "test.py", line 159, in
generate_images() # pylint: disable=no-value-for-parameter
File "g:\c-vton\pfafn\lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "g:\c-vton\pfafn\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "g:\c-vton\pfafn\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "g:\c-vton\pfafn\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "g:\c-vton\pfafn\lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "test.py", line 93, in generate_images
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
File "G:\c-vton\PASTA-GAN\legacy.py", line 21, in load_network_pkl
data = _LegacyUnpickler(f).load()
File "G:\c-vton\PASTA-GAN\torch_utils\persistence.py", line 191, in _reconstruct_persistent_obj
module = _src_to_module(meta.module_src)
File "G:\c-vton\PASTA-GAN\torch_utils\persistence.py", line 227, in _src_to_module
exec(src, module.dict) # pylint: disable=exec-used
File "", line 2243, in
NameError: name 'os' is not defined

Now os module is obviously installed and importable in python

Testing on CPU

Hi,
Thank you so much for your work. Is testing inference pipeline works without Cuda, run on cpu machine?

runtimeerror given group=1,weight of size [64,42,1,1],expected input[1,60,64,64] to have 42 channels, but got 60 channels instead

i use 'bash train.sh 1' to get a model, and 'bash test.sh 1' to inference. @xiezhy6

Traceback (most recent call last):
File "test.py", line 160, in
generate_images() # pylint: disable=no-value-for-parameter
File "/usr/local/miniconda3/lib/python3.8/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/usr/local/miniconda3/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/miniconda3/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/miniconda3/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/miniconda3/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "test.py", line 122, in generate_images
gen_c, cat_feat_list = G.style_encoding(norm_img_c_tensor, retain_tensor)
File "/usr/local/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/data1/codes/PASTA-GAN-main/training/networks.py", line 4880, in forward
x = module(x)
File "/usr/local/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/data1/codes/PASTA-GAN-main/training/networks.py", line 174, in forward
x = conv2d_resample.conv2d_resample(x=x, w=w.to(x.dtype), f=self.resample_filter, up=self.up, down=self.down, padding=self.padding, flip_weight=flip_weight)
File "/data1/codes/PASTA-GAN-main/torch_utils/misc.py", line 107, in decorator
return fn(*args, **kwargs)
File "/data1/codes/PASTA-GAN-main/torch_utils/ops/conv2d_resample.py", line 147, in conv2d_resample
return _conv2d_wrapper(x=x, w=w, padding=[py0,px0], groups=groups, flip_weight=flip_weight)
File "/data1/codes/PASTA-GAN-main/torch_utils/ops/conv2d_resample.py", line 54, in _conv2d_wrapper
return op(x, w, stride=stride, padding=padding, groups=groups)
File "/data1/codes/PASTA-GAN-main/torch_utils/ops/conv2d_gradfix.py", line 38, in conv2d
return torch.nn.functional.conv2d(input=input, weight=weight, bias=bias, stride=stride, padding=padding, dilation=dilation, groups=groups)
RuntimeError: Given groups=1, weight of size [64, 42, 1, 1], expected input[1, 60, 64, 64] to have 42 channels, but got 60 channels instead

Training issues

First, thank you for sharing great works!

I downloaded the UPT dataset, and the folder structures are as follows:

  • UPT_subset1_256_192
  • UPT_subset2_256_192
  • ...
  • UPT_subset6_256_192

I want to train PASTA-GAN with 256x192 UPT-dataset.

However, the class "UvitonDatasetFull(Dataset)" was not implemented to train the PASTA-GAN.

Specifically, (1) I found that the aforementioned class accessed to the following folder list:

['Zalando_256_192', 'Zalora_256_192', 'Deepfashion_256_192', 'MPV_256_192'].

Furthermore, (2) there were no folders named "train_img_vis" and "train_random_mask_acgpn" in the UPT_256_192 folder.

Would you have any plan to update the training codes?

Thank you.

Training model from scratch results in incompatibility with the testing script and inferior visual quality after adjustments

I have attempted to reproduce high levels of quality shown in your pretrained model through training on a substantively expanded dataset. However, I have encountered a number of divergences between your dedicated training and testing dataset classes (UvitonDatasetFull and UvitonDatasetV19_test). Notably, training dataset, network architecture and, consequently, all new models trained through the provided script use two arrays of normalized body part images (norm_img and norm_img_lower, with their corresponding shapes at 30x64x64 and 12x64x64) as style encoding inputs, while testing dataset and pretrained model use only one array of normalized body part images, concatenated with a normalized pose representation (norm_img and norm_pose or ‘stickman’, with shapes at 30x64x64 and 30x64x64).

My approach to resolving these differences so far was based on bringing the training dataset class into closer alignment with the testing dataset through modification of its normalize() function. After these dataset adjustments and slight changes to the training script to accommodate the new input flow, I was able to train a network model with style encoding input shape (norm_img and norm_pose) at 60x64x64, fully in line with the pretrained model. However, as attached images show, the resulting level of visual quality is far removed from yours, even at relatively advanced stages of training (8000-12000 iterations). Notably, shoulder area and general body shape experience unexpected deformations relative to the original pose, while use of full-body images as either person or garment causes severe distortion.

Given this disappointing outcome, would it be possible for you to provide some feedback to the general direction of my efforts? Is there something I might have overlooked in my attempts to bring two dataset classes in line? Were there any additional parameters in the training script that should have received more of my attention?

1a95a642b4a8440a81c96cc928b40e1c__5c5b36b78f2341e48946768b5c490ef9
1a30787ed8a94293a2ba2a6b0eb0aa32__0f47cb9cb50a4dba8bcdaa68ae4da54d
1a30787ed8a94293a2ba2a6b0eb0aa32__2ec33e777b9d4905941b1b33d670045a
2d1c8a0485704f1291c6a02be96bdac8__1a7a5302159e48af84a690e3ad456489
2d1c8a0485704f1291c6a02be96bdac8__0bc002dc7e474daeb9a97688043fd83f
6b9c0d92645049bc9906c7d418c1f09c__4d21f15280db465db0169b5804620d64
6b9c0d92645049bc9906c7d418c1f09c__1ec58bc1d00a4542bddd59c03664b24e

How to get "train_random_mask_acgpn"

It seems this part is missing when training PASTA-GAN by using UPT dataset. Would you release these images or share the generation code of them? Thank you.

Test--NameError: name 'os' is not defined Now os module is obviously installed and importable in python

When i run test.py, the error is as following:
Anyone could run the test.py successfully?

module: <module '_imported_module_65d04ead8c1241548c4d30a4fe7a76b7'>
Loading custom kernel...
Traceback (most recent call last):
File "/data_superbig/znn/CODE/NIPS2021_PASTA_GAN/PASTA_GAN_main/test.py", line 162, in
generate_images() # pylint: disable=no-value-for-parameter
File "/data_superbig/znn/Anaconda3/envs/Try_On37/lib/python3.7/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/data_superbig/znn/Anaconda3/envs/Try_On37/lib/python3.7/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/data_superbig/znn/Anaconda3/envs/Try_On37/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/data_superbig/znn/Anaconda3/envs/Try_On37/lib/python3.7/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/data_superbig/znn/Anaconda3/envs/Try_On37/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/data_superbig/znn/CODE/NIPS2021_PASTA_GAN/PASTA_GAN_main/test.py", line 96, in generate_images
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
File "/data_superbig/znn/CODE/NIPS2021_PASTA_GAN/PASTA_GAN_main/legacy.py", line 21, in load_network_pkl
data = _LegacyUnpickler(f).load()
File "/data_superbig/znn/CODE/NIPS2021_PASTA_GAN/PASTA_GAN_main/torch_utils/persistence.py", line 191, in _reconstruct_persistent_obj
module = _src_to_module(meta.module_src)
File "/data_superbig/znn/CODE/NIPS2021_PASTA_GAN/PASTA_GAN_main/torch_utils/persistence.py", line 231, in _src_to_module
exec(src, module.dict) # pylint: disable=exec-used
File "", line 2243, in
NameError: name 'os' is not defined

Process finished with exit code 1

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.