Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create image-parse images #76

Open
furkan59 opened this issue Aug 25, 2023 · 9 comments
Open

How to create image-parse images #76

furkan59 opened this issue Aug 25, 2023 · 9 comments

Comments

@furkan59
Copy link

I have human images but how can I create image-parse images in folder "VITON-HD\data\train\image-parse-v3".

@KIRAN-MK-211
Copy link

https://colab.research.google.com/drive/1JOwOPaChoc9GzyBi5FUEYTSaP2qxJl10?usp=sharing#scrollTo=VtZDKLL8jWLr
You can refer this notebook. results are not exactly same as shown in the paper, but works well.

@garychan22
Copy link

garychan22 commented Sep 12, 2023

I think the problem is how to get the exact training data of VITON-HD according to the documentation

I saved a parse map image using PIL.Image with P mode. The color of the parse map image in our dataset(VITON-HD) is just for the visualization, it has 0~19 uint values.

Should we just change this line
https://github.com/Engineering-Course/CIHP_PGN/blob/master/test_pgn.py#L194C11-L194C11

cv2.imwrite('{}/{}.png'.format(parsing_dir, img_id), parsing_[0,:,:,0])

to

Image.fromarray(parsing_[0,:,:,0]).convert("P").save('{}/{}.png'.format(parsing_dir, img_id))

@furkan59
Copy link
Author

@garychan22
Copy link

but the results produced by this https://colab.research.google.com/drive/1JOwOPaChoc9GzyBi5FUEYTSaP2qxJl10?usp=sharing#scrollTo=VtZDKLL8jWLr are far from the ones in viton regardless of the color

example here

the one in viton
00000_00

the one produced by the referred package, where the torso is missing and mistakenly classified into background
00000_00

@triminh12042002
Copy link

triminh12042002 commented Dec 20, 2023

According to the processing part of the HR-VITON code: https://github.com/sangyun884/HR-VITON/blob/main/Preprocessing.md

Check https://github.com/Engineering-Course/CIHP_PGN for human parsing. I inferenced a parse map on 256x192 resolution, and upsample it to 1024x768. Then you can see that it has a alias artifact, so I smooth it using "torchgeometry.image.GaussianBlur((15, 15), (3, 3))". I saved a parse map image using PIL.Image with P mode. The color of the parse map image in our dataset(VITON-HD) is just for the visualization, it has 0~19 uint values.

Using repo https://github.com/Engineering-Course/CIHP_PGN
and with the human image you can use the inf_pgn.py to generate the segmentation results with the trained models.
Before it, you must setup:

  1. Install requirements package, you should use virtual env with python3.7 like conda to install these package:
    a. pip install -r requirements.pip
    b. pip install --upgrade pip
    c. pip install protobuf==3.20.1
    d. run the command: python3 inf_pgn.py (to make sure your code already run first)
  2. Download pretrained model https://drive.google.com/file/d/1Mqpse5Gen4V4403wFEpv3w3JAsWw2uhk/view?usp=drive_open and store to checkpoint/ folder (instruction: https://github.com/Engineering-Course/CIHP_PGN?tab=readme-ov-file#pre-trained-models)
  3. Add your image to folder image (datasets/images)
  4. Adjust the code in file inf_pgn.py to store the result image with "P" mode: Add parsing_im = parsing_im.convert('P')
    before the line 198 parsing_im.save('{}/{}_vis.png'.format(parsing_dir, img_id))

Now run the command: python3 inf_pgn.py
The output image path will be in folder datasets/output
This result will be use for the image-parse-v3 folder of VITON - HD dataset

@whiterose199187
Copy link

hi @triminh12042002

I tries this approach but looks like that repo is using pretty old versions of tensorflow. How did you get it to work? Did you use python 2.x ?

@triminh12042002
Copy link

triminh12042002 commented Dec 26, 2023

whiterose199187 No, I'm using python 3.7
According to file requirements.pip, the repo used Tensorflow 1.5 so we need python3.7 or lower to install it.
I think u should use conda to create an env with python3.7 and install the requirements package as step 1

@kapoorkhushi03
Copy link

@whiterose199187 were u able to implement viton-HD?

@vahid037
Copy link

@whiterose199187 were u able to implement viton-HD?

you should implement vton-hd and preprocessing data in different virtual environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@furkan59 @KIRAN-MK-211 @triminh12042002 @garychan22 @kapoorkhushi03 @whiterose199187 @vahid037 and others