Code Monkey home page Code Monkey logo

tailornet's Introduction

TailorNet

This repository contains training and inference code for the following paper:

TailorNet: Predicting Clothing in 3D as a Function of Human Pose, Shape and Garment Style  
Chaitanya Patel*, Zhouyingcheng Liao*, Gerard Pons-Moll  
CVPR 2020 (ORAL)  

[ArXiv] [Project Website] [Dataset Repo] [Oral Presentation] [Results Video]

Teaser

Citation

Cite us if you use our model, code or data:

@inproceedings{patel20tailornet,
        title = {TailorNet: Predicting Clothing in 3D as a Function of Human Pose, Shape and Garment Style},
        author = {Patel, Chaitanya and Liao, Zhouyingcheng and Pons-Moll, Gerard},
        booktitle = {{IEEE} Conference on Computer Vision and Pattern Recognition (CVPR)},
        month = {jun},
        organization = {{IEEE}},
        year = {2020},
    }

Updates

  • [26-12-2020] Female skirt weights added.
  • [11-11-2020] Female and male short-pant weights added.
  • [02-08-2020] Female and male pant weights added.
  • [19-07-2020] Male shirt weights added.
  • [12-07-2020] Female shirt weights added.
  • [28-06-2020] Female t-shirt weights added.
  • [25-06-2020] Minor bug fixes and male t-shirt weights added.
  • [17-06-2020] Inference script and female old-t-shirt weights added.

Requirements

python3
pytorch
scipy
chumpy
psbody.mesh

Code works with psbody.mesh v0.4 , pytorch >= v1.0 , chumpy v0.7 and scipy v1.3 .

How to Run

  • Download and prepare SMPL model and TailorNet data from dataset repository.
  • Set DATA_DIR and SMPL paths in global_var.py file accordingly.
  • Download trained model weights in a directory and set its path to MODEL_WEIGHTS_PATH variable in global_var.py.
  • Set output path in run_tailornet.py and run it to predict garments on some random inputs. You can play with different inputs. You can also run inference on motion sequence data.
  • To visualize predicted garment using blender, run python run_tailornet.py render. (Blender 2.79 needs to be installed.)

TailorNet Per-vertex Error in mm on Test Set

... evaluated using evaluate function in utils/eval.py.

garment_class gender TailorNet Baseline TailorNet Mixture Model
old-t-shirt female 11.1 10.7
t-shirt female 12.6 12.3
t-shirt male 11.4 11.2
shirt female 14.2 14.1
shirt male 12.7 12.5
pant female 4.7 4.8
pant male 8.1 8.1
short-pant female 6.8 6.6
short-pant male 7.0 7.0
skirt female 7.7 7.8

Training TailorNet yourself

  • Set global variables in global_var.py, especially LOG_DIR where training logs will be stored.
  • Set config variables like gender and garment class in trainer/base_trainer.py (or pass them via command line) and run python trainer/base_trainer.py to train TailorNet MLP baseline.
  • Similarly, run python trainer/lf_trainer.py to train low frequency predictor and trainer/ss2g_trainer.py to train shape-style-to-garment(in canonical pose) model.
  • Run python trainer/hf_trainer.py --shape_style <shape1>_<style1> <shape2>_<style2> ... to train pivot high frequency predictors for pivots <shape1>_<style1>, <shape2>_<style2>, and so on. See DATA_DIR/<garment_class>_<gender>/pivots.txt to know available pivots.
  • Use models.tailornet_model.TailorNetModel with appropriate logdir arguments to do prediction.

Inference Time

In the paper, we report inference time to be 1-2 ms per frame(depending upon garment) which is averaged inference time over the batch of 21 samples(20-40 ms per batch). Apologies for the ambiguity. Running each sample separately takes almost same time as batch - around 20 ms per frame for all garments. However, note that TailorNet has 21 independent MLPs, so we believe that faster inference time is possible if MLPs are configured to run in parallel on GPU cores.

Misc

  • See ./models/skirt_model.md for the explanation of skirt garment model.
  • Thanks to Bharat for many fruitful discussions and for smpl_lib library taken from his MultiGarmentNet repo's lib folder.
  • Thanks to Garvita for helping out during the onerous procedure of data generation.

For any doubt or concert about the code, raise an issue on this repository.

tailornet's People

Contributors

chaitanya100100 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  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  avatar  avatar  avatar  avatar  avatar

tailornet's Issues

bad result

Hi, when I put pose parameters from another model, I get bad results for the right side of the body. How to resolve it?
Screenshot from 2021-02-01 22-00-58
Screenshot from 2021-02-01 22-01-49
Screenshot from 2021-02-01 22-02-59

Input format

Hi, I want to try TailorNet on my data.
What is the input format? A 3D obj or a 2D image?
If it is 3D, should I first use something like MGN to produce a 3D obj of my 2D input?
for example, if I want to use the below woman as a body shape input and the coat image as a garment and as a result see the coat on the woman.
8790E227-2883-48DB-B694-76074FD31B71
main-qimg-3d4ae1dcd8616ebe58bd77a88c172ad1

@chaitanya100100

dataset generation

Hi,

refer to part 5 dataset generation, is there any detailed instruction on how to generate paired data of parameters and the garment? Thanks.

NotImplementedError: Platform does not define a GLUT font retrieval function

Hi, I run into this error when executing python run_tailornet.py on a remote linux machine:

Traceback (most recent call last):
  File "run_tailornet.py", line 6, in <module>
    from psbody.mesh import Mesh
  File "/data/miniconda3/envs/pytorch/lib/python3.8/site-packages/psbody/mesh/__init__.py", line 10, in <module>
    from .meshviewer import MeshViewer, MeshViewers
  File "/data/miniconda3/envs/pytorch/lib/python3.8/site-packages/psbody/mesh/meshviewer.py", line 49, in <module>
    from OpenGL import GL, GLU, GLUT
  File "/data/miniconda3/envs/pytorch/lib/python3.8/site-packages/OpenGL/GLUT/__init__.py", line 5, in <module>
    from OpenGL.GLUT.fonts import *
  File "/data/miniconda3/envs/pytorch/lib/python3.8/site-packages/OpenGL/GLUT/fonts.py", line 20, in <module>
    p = platform.getGLUTFontPointer( name )
  File "/data/miniconda3/envs/pytorch/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 344, in getGLUTFontPointer
    raise NotImplementedError(
NotImplementedError: Platform does not define a GLUT font retrieval function

Can someone help me with this issue? Thanks!

model for garment generation based on style-shape

Hi Author,

Based on the information in the paper, seems there is a model which can be used for generating different style garment mesh based on style-shape. Could you please share this model to us? thanks.

new garment

I want to try my t-shirt bought from a brand using tailornet. Am I supposed to create the rgb image of my t-shirt to some 3d template if so how to do that or I can only try the garments in MGN templates?

visualization/blender_renderer.py default arguments

Hi Chaitanya,

I was looking at blender_renderer.py. Can you please add default arguments ?. e.g what should be the input to the following arguments. --body, --gar, --garment_class

Thank you for this wonderful work.

garment to body

Hi, did you train any model to match garment and body vertices which is the "I" parameter in this equation 3.3 below?
TG(β, θ, D) = I T(β, θ) + D

Minimizing model sizes

Screenshot from 2021-05-05 18-43-10
DISCLAIMER: I am deploying Tailornet for academic dissertation

  1. I have applied a simple dynamic quantization which reduced the model sizes to 1/4. How do I evaluate the accuracy vs original model weights?

  2. Applying any sort of PyTorch pruning even with very very small amount results in all weights to be removed. Any idea why this happens?

skirt draping

Hi, it seems you have applied a different strategy for skirts. Did you calculate skinning weights for the skirt with data from PBS based method then train a model or does it include somehow rule-based solution?

Old-t-shirt for male dataset

Hi,

Do you have the dataset for old-t-shirt for male? If have, could you please kindly upload it? Thanks so much.

run_tailornet.py render fails

Read blend: /home/arash/Desktop/TailorNet/./visualization/scene.blend
['/usr/lib/blender/blender', '/home/arash/Desktop/TailorNet/visualization/blender_renderer.py', '--', '--body', '/tmp/body.obj', '--gar', '/tmp/gar.obj', '--outpath', '/home/arash/Desktop/TailorNet/outputs/img_0002.png', '--gar_classes', 'pant']
usage: blender [-h] [--outpath OUTPATH] [--body BODY [BODY ...]]
               [--gar GAR [GAR ...]]
               [--gar_classes GAR_CLASSES [GAR_CLASSES ...]]
blender: error: unrecognized arguments: /home/arash/Desktop/TailorNet/visualization/blender_renderer.py -- --body /tmp/body.obj --gar /tmp/gar.obj --outpath /home/arash/Desktop/TailorNet/outputs/img_0002.png --gar_classes pant

Trying to run the render on the predicted garments gives the above error. It seems to throw an error about unrecognised arguments but I'm not sure what exactly it's complaining about. Any help would be appreciated, since this is the final step remaining to achieve inference. Thanks

python ./run_taylornet.py searches for file gamma_000.npy

Hi, I'm just trying to see if I can run this in my enviornment, and I'm getting an error because it's looking for a gamma_000.npy file. Where can I find this file and/or how do I fix this error?

Thanks in advance!

Unable to load font: GLUT_STROKE_ROMAN
Unable to load font: GLUT_STROKE_MONO_ROMAN
Unable to load font: GLUT_BITMAP_9_BY_15
Unable to load font: GLUT_BITMAP_8_BY_13
Unable to load font: GLUT_BITMAP_TIMES_ROMAN_10
Unable to load font: GLUT_BITMAP_TIMES_ROMAN_24
Unable to load font: GLUT_BITMAP_HELVETICA_10
Unable to load font: GLUT_BITMAP_HELVETICA_12
Unable to load font: GLUT_BITMAP_HELVETICA_18
Traceback (most recent call last):
  File "./run_tailornet.py", line 138, in <module>
    run_tailornet()
  File "./run_tailornet.py", line 79, in run_tailornet
    thetas, betas, gammas = get_single_frame_inputs(garment_class, gender)
  File "./run_tailornet.py", line 42, in get_single_frame_inputs
    get_style('000', garment_class=garment_class, gender=gender),
  File "/Users/jihoonkim/Desktop/UCLA/capstone/TailorNet/dataset/canonical_pose_dataset.py", line 11, in get_style
    gammas = np.load(os.path.join(
  File "/Users/jihoonkim/opt/miniconda3/lib/python3.8/site-packages/numpy/lib/npyio.py", line 416, in load
    fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jihoonkim/Desktop/UCLA/capstone/TailorNet_dataset/t-shirt_male/style/gamma_000.npy'

blender verison incompatibility

Any suggestion to install blender 2.79? I install 2.91 when I tried then I get an error in the below:
AttributeError: 'RenderSettings' object has no attribute 'alpha_mode'

neutral model to gendered model

Hi, I use a human mesh reconstruction tool that infers based on the SMPL neutral model. Is there any way that I can convert the parameters to fit the gendered model(s) that is used by Tailornet?

load smpl pkl error

I download the female and male pkl from smpl website, but when I use pikle load the pkl, will cause error

dd = pkl.load(open(self.get_smpl_file(), 'rb'), encoding='latin1')
_pickle.UnpicklingError: invalid load key, '\x00'.

can you provide the smpl pkl?

pose doesn't exist

Thanks for your excellent work.
I download the dataset as you suggested. When I trained the base_trainer, it tells me that some data of t-shirt_male doesn't exist.

../TailorNet_dataset-master/data/t-shirt_male/pose/006_023/unposed_002.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_013.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_013.npy doesn't exist.

Well, it finished training anyway. But when I trained the lf_trainer, the same issue came up. And then it just finished without training the lf_trainer. I have no idea of what happened, could you kindly look through my problem. Thanks in advance.

../TailorNet_dataset-master/data/t-shirt_male/pose/006_023/unposed_002.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_013.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_013.npy doesn't exist.
Using Smoothing in the dataset
../TailorNet_dataset-master/data/t-shirt_male/pose/006_023/unposed_002.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_016/unposed_013.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_009.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/006_006/unposed_013.npy doesn't exist.
../TailorNet_dataset-master/data/t-shirt_male/pose/007_011/smooth_unposed_000.npy doesn't exist.

can't run run_tailornet.py

Hi,I reproduced your code according to your idea, and the result appeared such an error. What should I do?
image
And when I follow the steps to train the model, this error will be reported. What should I do?
image

Graph CNN code for Single style-Shape model

Great job! The paper reported an experiment of Graph CNN for the style-shape model. It is interesting that MLP outperforms GCN here. I would like to test some ideas based on your GCN network. Would you plan to release its code? It is also good if you can provide detailed network settings. Thanks a lot!

how to combine up cloth and pants

Hi @chaitanya100100,
Thanks a lot for sharing the code and it makes very interesting step in the subject of dressing up SMPL model. In your codes, we can only render up cloth, do you mind to shed more codes on how to dress the SMPL model completely?

Environment Requirement

Hi,
It may be useful and more convenient for others like me(green hand in this field) if you could please provide the environment requirements in detail such as:

  • cuda version
  • Pytorch version
  • and the version of other libs
    More specifically, maybe a requirments.txt file would be so helpful.

Best,

real garment

Hi, what is needed to put a real garment on an smpl body model? Do I need a 3d model of the garment to do this without losing texture details?

Need guidance

I ran the code successfully and thanks for the amazing work.
i have 2 questions
section 6.3 in the paper says that we can also transfer the textures from real scan on our predictions. can you suggest a method of doing that?

Also how can i control the garment size? i couldn't figure out how from the paper.

Excuse me if the questions seem naive as i don't have much experience in the field. Thanks in advance

How to combine up upper cloth and pants in detail?

I have noticed the closed issue (here), but when I use visualize_two_garments_body function to replace visualize_garment_body in run_tailornet.py with:

visualize_two_garments_body(
      pred_gar, body, os.path.join(OUT_PATH, "img_{:04d}.png".format(i)),
lower_gc='skirt', upper_gc='t-shirt', side='front')

run python run_tailortnet.py render
an error occurred:

Traceback (most recent call last):
  File "run_tailornet.py", line 143, in <module>
    render_images()
  File "run_tailornet.py", line 128, in render_images
    pred_gar, body, os.path.join(OUT_PATH, "img_{:04d}.png".format(i)), lower_gc='skirt', upper_gc='t-shirt', side='front')    
TypeError: visualize_two_garments_body() missing 1 required positional argument: 'outpath'

especially I have tried to use the function get_sequence_inputs, but this error still occurred.
Could you tell me how to fix this problem?
and what`s the pipeline of rendering two_garments?
@chaitanya100100
Thanks!

How can we use our own meshes to apply garment meshes on top?

According your your readme, you have mentioned that the program is using random inputs and that we can play with different inputs. But you have not explicitly mentioned what the exact inputs that the TailorNet network takes to make a prediction. For example, can we only use SMPL model to apply garment meshes on the model? Is there a method to use my own model that I created using SMPL model and apply the garment meshes on top of that? Please guide, thanks.

multigarmentnetwork

Hi, there are only 4 numbers to modify the garment. How to get a garment from multi garment network as said in oral presentation? I couldn't find any parameter other than gamma to modify the garment.

tailornet dataset

Why do we need to download the large datasets? The model weights are already provided in this repo's readme.

use smplx model problem

thanks for your code, greate work!!
i use expose model params to test this code,
when i use the betas, is not right, looks like the shape is different from smplx
the body_pose i change to check the pose is ok
please help

Missing SMPL models

Hi, from the code, it requires the following SMPL models. but cannot find them. could you please upload them? thanks.

SMPL_PATH_NEUTRAL = '/BS/RVH/work/data/smpl_models/neutral/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl'
SMPL_PATH_MALE = '/BS/RVH/work/data/smpl_models/lrotmin/lbs_tj10smooth6_0fixed_normalized/male/model.pkl'
SMPL_PATH_FEMALE = '/BS/RVH/work/data/smpl_models/lrotmin/lbs_tj10smooth6_0fixed_normalized/female/model.pkl'

Missing SMPL Models

Hi, from the code, it requires the following SMPL models.
SMPL_PATH_NEUTRAL = '/BS/RVH/work/data/smpl_models/neutral/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl'
SMPL_PATH_MALE = '/BS/RVH/work/data/smpl_models/lrotmin/lbs_tj10smooth6_0fixed_normalized/male/model.pkl'
SMPL_PATH_FEMALE = '/BS/RVH/work/data/smpl_models/lrotmin/lbs_tj10smooth6_0fixed_normalized/female/model.pkl'

I download the SMPL_python_v.1.0.0.zip, but inside the folder, only has the male and female models. No neutral model. could you please suggest where to get the neutral one? And from the names above, seems the SMPL Models of male and female have been normalized. Do I understand right, or the models are same as the downloaded ones? thanks.

Multi Mesh registration.

Hi,

Can i get a sample code for doing multi mesh registration as i am having a hard time figuring how to do that? I am trying to use my 3D scans and hoping to register those to tailornet data.

Thanks for the great work tho.

speed

is there any way to speed up the infrence. It seems it processes a single theta,beta,gamma triplet in 5 seconds with gtx 1070. Is it normal or am I doing something wrong?

gammas

What does gamma parm mean? For a garment, is there any way to modify gamma so that the created garment looks like the one we want to create?

vt and face information of the prediction result

Hi,

If change the prediction output as .obj files, how would I create the vt and f information inside the .obj file? Please kindly send me examples/templates of each garment if you have them.

Besides, is there a way to change the number of the vertices and faces for prediction output. Thank you so much.

Best Regards,
JC

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.