minar09 / ACGPN

"Towards Photo-Realistic Virtual Try-On by Adaptively Generating↔Preserving Image Content",CVPR 2020. (Modified from original with fixes for inference)
https://github.com/switchablenorms/DeepFashion_Try_On
77 stars 70 forks source link

hi, can anyone help me , how to setup this project on windows for the testng purpose using cpu, pls? #8

Open AyeshaShafique opened 3 years ago

AyeshaShafique commented 3 years ago

its and urgent task

minar09 commented 3 years ago

Hi @AyeshaShafique , I ran and tested this project in windows, so I think you can do as well. For using in CPU, please check the following: 1) Install the requirements 2) Provide the gpu id argument value "-1" for CPU and try to run the test.py: https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/options/base_options.py#L16 3) If there's some error due to .cuda() ending, remove .cuda() from the code Hope that helps. Thanks.

AyeshaShafique commented 3 years ago

thank u so much for ur reply

i need to remove .cuda() from everyline of code?

AyeshaShafique commented 3 years ago

AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

facing this error

minar09 commented 3 years ago

thank u so much for ur reply

i need to remove .cuda() from everyline of code?

Maybe First try to run without removing. Then if you get an error somewhere due to .cuda(), then remove that one and try running again if you don't wanna remove all of them.

minar09 commented 3 years ago

AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

facing this error

Can you please provide more details for the error. Thanks.

AyeshaShafique commented 3 years ago

i was getting error with .cuda(), so i removed and ran it .

now facing this

latest_net_U.pth latest_net_G1.pth latest_net_G2.pth latest_net_G.pth ? ? C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead. warnings.warn(warning.format(ret)) C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:1558: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead. warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.") C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:3226: UserWarning: Default grid_sample and affine_gri d behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desi red. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " ..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated: nonzero(Tensor input, , Tensor out) Consider using one of the following signatures instead: nonzero(Tensor input, , bool as_tuple) Traceback (most recent call last): File ".\test.py", line 154, in loss_dict = dict(zip(model.module.loss_names, losses)) File "C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 594, in getattr type(self).name, name)) AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

AyeshaShafique commented 3 years ago

someone provided this solution, but im not sure where to add this,

This will solve the issue, after model.initialize(), add the below code .Here,the model is wrapped around the DataParallel and the 'module' attribute is coming from here. model = torch.nn.DataParallel(model, device_ids=[0]) #0 because of only 1 GPU, add [0,1,2,3] if you have multiple GPUs

minar09 commented 3 years ago

You can try this one maybe: https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/models/pix2pixHD_model.py#L140

AyeshaShafique commented 3 years ago

i dont know how to add here :(

AyeshaShafique commented 3 years ago

i think the above issue is resolved. now the test.py is running .

logs are here:

C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the trans orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the trans orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn_reduction.py:43: UserWarning: size_average and reduce args will b deprecated, please use reduction='mean' instead. warnings.warn(warning.format(ret)) C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:1558: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead. warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.") C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:3226: UserWarning: Default grid_sample and affine_gr d behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is des red. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " ..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated: nonzero(Tensor input, , Tensor out) Consider using one of the following signatures instead: nonzero(Tensor input, , bool as_tuple) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

what does these number mean, plus where i will get the results?

minar09 commented 3 years ago

Great! This number means the serial of output images that are being saved. You will get the results in the directory given here: https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/options/test_options.py#L9

AyeshaShafique commented 3 years ago

Hi

Can you please tell me how to test for one custom image, like one source image which cloth design we want to copy, and other target image on which we want to put on design.

Will be very thankful to you

On Wed, 23 Dec 2020, 7:32 am Matiur Rahman Minar, notifications@github.com wrote:

Great! This number means the serial of output images that are being saved. You will get the results in the directory given here: https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/options/test_options.py#L9

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/minar09/ACGPN/issues/8#issuecomment-749889339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4637TS4UWOPDV7KF32H3DSWFJDLANCNFSM4VFU5ZFQ .

minar09 commented 3 years ago

Can you please provide sample input images? That would be great. If you are talking about person-to-person clothing transfer, then you can refer to the research works like SwapNet, O-VITON, Human appearance transfer, etc. Thanks.

AyeshaShafique commented 3 years ago

i cant see any image in results directory. even results directory is not created till yet. pls help

On Wed, Dec 23, 2020 at 10:45 AM Matiur Rahman Minar < notifications@github.com> wrote:

Can you please provide sample input images? That would be great. If you are talking about person-to-person clothing transfer, then you can refer to the research works like SwapNet, O-VITON, Human appearance transfer, etc. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/minar09/ACGPN/issues/8#issuecomment-749948248, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4637STOE4QYE3NUDXAOYDSWF7XTANCNFSM4VFU5ZFQ .

AyeshaShafique commented 3 years ago

see this pls

PS D:\Ayesha\Upwork\Projects\FCGAN Clothing style transfer\switchablenorms\DeepFashion_Try_On-master\ACGPN_inference> py thon .\test.py --max_dataset_size 1 --gpu_ids -1 --tf_log ? ------------ Options ------------- batchSize: 1 beta1: 0.5 checkpoints_dir: ./checkpoints continue_train: False data_type: 32 dataroot: ../Data_preprocessing/ debug: False display_freq: 100 display_winsize: 512 fineSize: 512 gpu_ids: [] input_nc: 3 isTrain: True label_nc: 20 lambda_feat: 10.0 loadSize: 512 load_pretrain: ./checkpoints/label2city lr: 0.0002 max_dataset_size: 1 model: pix2pixHD nThreads: 2 n_blocks_global: 4 n_blocks_local: 3 n_downsample_global: 4 n_layers_D: 3 n_local_enhancers: 1 name: label2city ndf: 64 netG: global ngf: 64 niter: 100 niter_decay: 100 niter_fix_global: 0 no_flip: False no_ganFeat_loss: False no_html: False no_lsgan: False no_vgg_loss: False norm: instance num_D: 2 output_nc: 3 phase: test pool_size: 0 print_freq: 100 resize_or_crop: scale_width save_epoch_freq: 10 save_latest_freq: 1000 serial_batches: False tf_log: True use_dropout: False verbose: False which_epoch: latest -------------- End ---------------- CustomDatasetDataLoader dataset [AlignedDataset] was created ../Data_preprocessing/test_label label ../Data_preprocessing/test_label label ../Data_preprocessing/test_img img ../Data_preprocessing/test_img img ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_edge edge ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_mask mask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_colormask colormask ../Data_preprocessing/test_color color ../Data_preprocessing/test_color color

Inference images = 1

latest_net_U.pth latest_net_G1.pth latest_net_G2.pth latest_net_G.pth ? ? C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf orms.Scale transform is deprecated, please use transforms.Resize instead. warnings.warn("The use of the transforms.Scale transform is deprecated, " + C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn_reduction.py:43: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead. warnings.warn(warning.format(ret)) C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:1558: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead. warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.") C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:3226: UserWarning: Default grid_sample and affine_gri d behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desi red. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " ..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated: nonzero(Tensor input, , Tensor out) Consider using one of the following signatures instead: nonzero(Tensor input, , bool as_tuple) 1 End of epoch 1 / 200 Time Taken: 34 sec PS D:\Ayesha\Upwork\Projects\FCGAN Clothing style transfer\switchablenorms\DeepFashion_Try_On-master\ACGPN_inference>

On Wed, Dec 23, 2020 at 11:28 AM Ayesha Shafique aieeshashafique@gmail.com wrote:

i cant see any image in results directory. even results directory is not created till yet. pls help

On Wed, Dec 23, 2020 at 10:45 AM Matiur Rahman Minar < notifications@github.com> wrote:

Can you please provide sample input images? That would be great. If you are talking about person-to-person clothing transfer, then you can refer to the research works like SwapNet, O-VITON, Human appearance transfer, etc. Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/minar09/ACGPN/issues/8#issuecomment-749948248, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4637STOE4QYE3NUDXAOYDSWF7XTANCNFSM4VFU5ZFQ .

nitintyagi-ai commented 3 years ago

You can try this one maybe:

https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/models/pix2pixHD_model.py#L140

Hi @minar, I have removed .cuda() wherever it is giving error. After that I am struggling with "AttributeError: 'Pix2PixHDModel' object has no attribute 'module" issue even solution which you have provided. Any help will be appreciated.

BaseModel.initialize(self, opt)

its include in pix2pixHD_model.py file.

You can try this one maybe:

https://github.com/minar09/ACGPN/blob/c4df9738e13412f9fb2be57deefcce99373fa5f1/models/pix2pixHD_model.py#L140

minar09 commented 3 years ago

@nitintyagi-ai, actually I haven't tried this repo in CPU. So it's better if you refer to the original repository and their discussions: https://github.com/switchablenorms/DeepFashion_Try_On . Hope you can solve your issues.

yfedberts commented 3 years ago

@nitintyagi-ai, actually I haven't tried this repo in CPU. So it's better if you refer to the original repository and their discussions: https://github.com/switchablenorms/DeepFashion_Try_On . Hope you can solve your issues.

Hi there! Seems like issues on the original repo are no longer answered, hoping that you might have an answer about running on the CPU. I've added the -1 but it seems like it's still trying to run on CUDA.

RuntimeError: CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 4.00 GiB total capacity; 2.78 GiB already allocated; 25.22 MiB free; 2.79 GiB reserved in total by PyTorch)

Any answers or insights are greatly appreciated!

minar09 commented 3 years ago

Hi @Mystickal , for running the repo in CPU, you can follow the discussion above one by one. And for your error, it seems like OOM error, so you can try running with lower batch sizes. Good luck.

yfedberts commented 3 years ago

Hi @Mystickal , for running the repo in CPU, you can follow the discussion above one by one. And for your error, it seems like OOM error, so you can try running with lower batch sizes. Good luck.

Hi @minar09 thanks for the reply! I've followed the discussion above but am getting different errors. As for the batch size any insight as to where I can modify that? It seems like it's already set to 1 on the base_options file?

Thanks in advance!

minar09 commented 3 years ago

@Mystickal , I think base_options is the place to change the batch size. If you still getting OOM error, then you might need higher memory or GPU. For CPU running, remove the .cuda from the code and try to run.

yfedberts commented 3 years ago

@Mystickal , I think base_options is the place to change the batch size. If you still getting OOM error, then you might need higher memory or GPU. For CPU running, remove the .cuda from the code and try to run.

It's already set to 1 by default and removing the cuda causes a ton of errors unfortunately, guess I'll need a better GPU. Thank you anyways for the response!