nile649 / POLY-GAN

Poly-GAN: Multi-Conditioned GAN for Fashion Synthesis. (Not updating).
MIT License
45 stars 16 forks source link

Steps to run the code #3

Open dubesar opened 4 years ago

dubesar commented 4 years ago

Hey, there's some confusion regarding running the code. Can you create a copy of google colab for this code so that we can directly run on colab.

maycownd commented 4 years ago

Hey @dubesar , I had to modify a couple of things so far to run the code:

  1. In order to run the test.py the parameter was --stage "Stage3", not --stage "Refine"
  2. The test.py, line 85 is using absolute path plt.imsave("{}/{}_{}_ref.jpg".format(save_ref,f,img1[:-6]),resize(plt.imread("/home/np9207/vton/data/{}/image/{}_0.jpg".format(opt.datamode,img1[:-6])),(128,128))), I changed it too.

I am trying to encapsulate all the models needed to generate the final result, given a cloth and a person image, although I am having trouble to use the pose estimator and segmentation models.

lujiazho commented 1 year ago

Here is my steps to run this whole testing process through on Colab, the final result is not satisfying as I expected. Probably I'm doing it in a wrong way.

Model image: 1

cloth image: 2

final result: 3

  1. Get repo and data

    !git clone https://github.com/nile649/POLY-GAN.git
    %cd POLY-GAN
    !cp -r /content/drive/MyDrive/Dataset/poly-gan/pre_trained_models/ ./
    !cp -r ./pre_trained_models/data ./
    !unzip ./data/data.zip
  2. show some data

    from PIL import Image
    im = Image.open("/content/POLY-GAN/data/test/image/000001_0.jpg")
    im
  3. change code

in test.py, line 10, change

from skimage.filters import threshold_otsu,threshold_adaptive

to

from skimage.filters import threshold_otsu,threshold_local

in line 97, also change

binary = threshold_adaptive(temp2[:,:,0], block_size, offset=0)

to

binary = threshold_local(temp2[:,:,0], block_size, offset=0)

In line 85, change

"/home/np9207/vton/data/{}/image/{}_0.jpg"

to

"./data/{}/image/{}_0.jpg"

Note: if you don't want to change threshold_adaptive, you need to install scikit-image==0.14.2 as mentioned in requirements.txt, which may take you some minutes

  1. run

stage1

!python test.py --datamode test --stage Stage1 --model_image 000001_0.jpg --reference_image 000347_1.jpg

stage2

!python test.py --datamode test --stage Stage2 --model_image 000001_0.jpg --reference_image 000347_1.jpg

stage3

!pip install matplotlib==3.0.2
!!python test.py --datamode test --stage Stage3 --model_image 000001_0.jpg --reference_image 000347_1.jpg

Then you cannot find final result at results/test/Stage3. It's at ./results/test/Stage3temp_res.