Git Product home page Git Product logo

up's Introduction

Unite the People code repository

Requirements:

  • OpenCV (on Ubuntu, e.g., install libopencv-dev and python-opencv).
  • SMPL (download at http://smpl.is.tue.mpg.de/downloads) and unzip to a place of your choice.
  • OpenDR (just run pip install opendr, unfortunately can't be done automatically with the setuptools requirements.
  • If you want to train a segmentation model, Deeplab V2 (https://bitbucket.org/aquariusjay/deeplab-public-ver2) with a minimal patch applied that can be found in the subdirectory patches, to enable on the fly mirroring of the segmented images. Since I didn't use the MATLAB interface and did not care about fixing related errors, I just deleted src/caffe/layers/mat_{read,write}_layer.cpp as well as src/caffe/util/matio_io.cpp and built with -DWITH_matlab=Off.
  • If you want to train a pose model, the Deepercut caffe (https://github.com/eldar/deepcut-cnn).
  • If you want to get deepercut-cnn predictions, download the deepercut .caffemodel file and place it in models/pose/deepercut.caffemodel.
  • Edit the file config.py to set up the paths.
  • Register on https://smpl.is.tue.mpg.de/ to obtain a SMPL license and place the model file at models/3D/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl.

The rest of the requirements is then automatically installed when running:

python setup.py develop

Folder structure

For each of the tasks we described, there is one subfolder with the related executables. All files that are being used for training or testing models are executable and provide a full synopsis when run with the --help option. In the respective tools subfolder for each task, there is a create_dataset.py script to summarize the data in the proper formats. This must be usually run before the training script. The models folder contains pretrained models and infos, patches a patch for deeplab caffe, tests some Python tests and up_tools some Python tools that are shared between modalities.

There is a Docker image available that has been created by TheWebMonks here (not affiliated with the authors): https://github.com/TheWebMonks/demo-2d3d .

Bodyfit

The adjusted SMPLify code to fit bodies to 91 keypoints is located in the folder 3dfit. It can be used for 14 or 91 keypoints. Use the script 3dfit/render.py to render a fitted body.

Direct 3D fitting using regression forests

The relevant files are in the folder direct3d. Run run_partforest_training.sh to train all regressors. After that, you can use bodyfit.py to get predictions from estimated keypoints of the 91 keypoint pose predictor.

91 keypoint pose prediction

The pose folder containes infrastructure for 91 keypoint pose prediction. Use the script pose/tools/create_dataset.py with a dataset name of your choice and a target person size of 500 pixels to create the pose data from UP-3D, alternatively download it from our website.

Configure a model by creating the model configuration folder pose/training/config/modelname by cloning the pose model. Then you can run run.sh {train,test,evaluate,trfull,tefull,evfull} modelname to run training, testing or evaluation on either the reduced training set with the held-out validation set as test data or the full training set and real test data. We initialized our training from the original Resnet models (https://github.com/KaimingHe/deep-residual-networks). You can do so by downloading the model and saving it as pose/training/config/modelname/init.caffemodel.

The pose.py script will produce a pose prediction for an image. It assumes that a model with name pose has been trained (or downloaded). We normalize the training images w.r.t. person size, that's why the model works best for images with a rough person height of 500 pixels. Multiple people are not taken into account; for every joint the arg max position is used over the full image.

31 part segmentation

The folder setup is just as for the keypoint estimation: use segmentation/tools/create_dataset.py to create a segmentation dataset from the UP-3D data or download it (again, we used target person size 500). Then use run.sh {train,test,evaluate,trfull,tefull,evfull} modelname as described above to create your models. The segmentation.py script can be used to get segmentation results for the model named segmentation from and image. We initialized our models from the Deeplab trained models available here. Move the model file to segmentation/training/modelname/init.caffemodel.

Website, citation, license

You can find more information on the website. If you use this code for your research, please consider citing us:

@inproceedings{Lassner:UP:2017,
  title = {Unite the People: Closing the Loop Between 3D and 2D Human Representations},
  author = {Lassner, Christoph and Romero, Javier and Kiefel, Martin and Bogo, Federica and Black, Michael J. and Gehler, Peter V.},
  booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  month = jul,
  year = {2017},
  url = {http://up.is.tuebingen.mpg.de},
  month_numeric = {7}
}

License: Creative Commons Non-Commercial 4.0.

The code for 3D fitting is based on the SMPLify code. Parts of the files in the folder up_tools (capsule_ch.py, capsule_man.py, max_mixture_prior.py, robustifiers.py, sphere_collisions.py) as well as the model models/3D/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl fall under the SMPLify license conditions.

up's People

Contributors

classner avatar joel-huang avatar kant avatar nschloe 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

up's Issues

3d model generation error

Hi @classner, thank you for your quick response on my earlier query. I got stuck into another one, could you please help me out.

I am running direct3d/bodyfit.py after generating the pose from pose/pose.py from a .png image with height 513 and maintaining the aspect ratio. I'm passing a folder with a single image in it. The problem I'm facing is this:

No such file or directory: 'direct3d/../models/2dto3d/separate_regressors/forest_82_final.z'

and another thing is that 2 files are being generated namely,
1.) 33.png_body_directseparate.pkl_working
2.) work_lock

Upon opening these files the first one has the character 't' in it and the second one is empty.

Basically my end goal is to feed in an image and get a 3d model of it based on the 91 keypoints. I'm unable to figure out how to achieve this.

Can you please guide me with few details. I am running out of time here😅

DeepLab_v2 undefined layer

I'm interested in testing the body segmentation, so according to readme, I compiled the DeepLab_v2 from (https://bitbucket.org/aquariusjay/deeplab-public-ver2). However, I couldn't find the patch in the patches/ directory.

Directly running something like

./store_segmentation_results.py testpy.prototxt test2.caffemodel val___.txt seg_prepared_output/ --caffe_install_path /deeplab-public-ver2/build/python --n_labels 32

yields the error
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format caffe.NetParameter: 17:16: Message type "caffe.LayerParameter" has no field named "interp_param".

I'm suspecting that I install the wrong version of DeepLab, or is there some patches necessary? Thanks!

about the up-3d dataset

when I use your dataset, I try to project 3D model on the image plane.But some instances are not consistent, such as this(2616)
test001
Are the camera parameters you provided wrong?

The label definition of the dataset

Hi, thank you for sharing awesome code and dataset!
I tried to find the definition of index labels of semantic segmentation dataset (up-s31).
Where can I find it?
Thank you for considering in advance!

Index in the SMPL model and vertices?

with open(path.join(path.dirname(__file__),
has the landmarks.pkl pickle file to read, however, I did not find the pickle location in the model webpage?

May I ask whether the 91 joints are all from SMPL model? if so, may I have the indexes for the vertices?

Projecting SMPL body model to the image

Hi,

I'm trying to prjoect SMPL body model to the image using pytorch.
The SMPL body model is obtained from pose and betas of the 00001_body.pkl file in UP-3D dataset. Actual mesh model is obtained using this repo.

I assume the vertex coordinates are in world coordinate system, so I tried to transform it to the camera coordinate system, and project it to the image coordinate.

First, I added trans to the world coordinate mesh coordinates.
world_coord = world_coord + trans

Second, I changed the world coordinates to the camera coordinates. I think rt and t are camera rotation and translation (i.e., extrinsic camera parameters). It seems rt is in a form of axis-angle representation, so I converted rt to rotation matrix using rodrigues function. The camera coordinates are obtained as follow:
cam_coord = torch.matmul(rt, (world_coord - t).permute(1,0)).permute(1,0).

Third, I projected camera coordinates to the image coordinates. As there is no principal component annotation (i.e., intrinsic camera parameter), I just used half of each image resolution. For example, if the image size is (H,W), then, c = (H/2, W/2). The image coordinates are obtained as follow:
img_coord_x = cam_coord_x / cam_coord_z * f_x + c_x.

And the result projected joint coordinates are visualized in this way.
As you can see, it does not align to the image. Could you help me? Am I doing something wrong?

a

Would you like to provide the crop & scale information in your UP-91 dataset

Hi, Classner. Recently I'm working on something about dense landmarks on human body. I found the UP-91 dataset you provided really fasinating. But I meet some problems when I want to intergrate your 91p landmark with the original 14p-h label. Would you please provide some information about how you crop and scale images from these original dataset? Thank you very much!

Check failed: error == cudaSuccess (2 vs. 0) out of memory

Hi, I am training the segmentation with using the test2.caffemodel you provided.

python segmentation.py xxx.png

But I get the following error, and I use nvidia-smi to see the use of gpu, there is no other process.
How can I solve this problem? Thank you @classner

[libprotobuf WARNING google/protobuf/io/coded_stream.cc:537] Reading dangerously large protocol message. If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h. [libprotobuf WARNING google/protobuf/io/coded_stream.cc:78] The total number of bytes read was 539792218 I0323 19:55:29.644702 6432 net.cpp:816] Ignoring source layer data I0323 19:55:29.644721 6432 net.cpp:816] Ignoring source layer data_data_0_split I0323 19:55:29.644728 6432 net.cpp:816] Ignoring source layer label_data_1_split I0323 19:55:29.744916 6432 net.cpp:816] Ignoring source layer fc1_training_c0 I0323 19:55:29.744940 6432 net.cpp:816] Ignoring source layer fc1_training_c1 I0323 19:55:29.744959 6432 net.cpp:816] Ignoring source layer fc1_training_c2 I0323 19:55:29.744977 6432 net.cpp:816] Ignoring source layer fc1_training_c3 I0323 19:55:29.744983 6432 net.cpp:816] Ignoring source layer fc1_training I0323 19:55:29.744987 6432 net.cpp:816] Ignoring source layer fc1_training_fc1_training_0_split I0323 19:55:29.744998 6432 net.cpp:816] Ignoring source layer fc1_training_res05_c0 I0323 19:55:29.745005 6432 net.cpp:816] Ignoring source layer fc1_training_res05_c1 I0323 19:55:29.745010 6432 net.cpp:816] Ignoring source layer fc1_training_res05_c2 I0323 19:55:29.745018 6432 net.cpp:816] Ignoring source layer fc1_training_res05_c3 I0323 19:55:29.745023 6432 net.cpp:816] Ignoring source layer fc1_training_res05 I0323 19:55:29.745028 6432 net.cpp:816] Ignoring source layer fc1_training_res05_fc1_training_res05_0_split I0323 19:55:29.745036 6432 net.cpp:816] Ignoring source layer fc1_training_res075_c0 I0323 19:55:29.745043 6432 net.cpp:816] Ignoring source layer fc1_training_res075_c1 I0323 19:55:29.745048 6432 net.cpp:816] Ignoring source layer fc1_training_res075_c2 I0323 19:55:29.745054 6432 net.cpp:816] Ignoring source layer fc1_training_res075_c3 I0323 19:55:29.745060 6432 net.cpp:816] Ignoring source layer fc1_training_res075 I0323 19:55:29.745066 6432 net.cpp:816] Ignoring source layer fc1_training_res05_interp I0323 19:55:29.745074 6432 net.cpp:816] Ignoring source layer fc1_training_res075_interp I0323 19:55:29.745077 6432 net.cpp:816] Ignoring source layer fc1_training_res075_interp_fc1_training_res075_interp_0_split I0323 19:55:29.745086 6432 net.cpp:816] Ignoring source layer fc_fusion_fc_fusion_0_split I0323 19:55:29.745095 6432 net.cpp:816] Ignoring source layer label_shrink I0323 19:55:29.745100 6432 net.cpp:816] Ignoring source layer label_shrink_label_shrink_0_split I0323 19:55:29.745105 6432 net.cpp:816] Ignoring source layer loss I0323 19:55:29.745110 6432 net.cpp:816] Ignoring source layer accuracy I0323 19:55:29.745115 6432 net.cpp:816] Ignoring source layer loss_res1 I0323 19:55:29.745121 6432 net.cpp:816] Ignoring source layer accuracy_res1 I0323 19:55:29.745126 6432 net.cpp:816] Ignoring source layer loss_res075 I0323 19:55:29.745129 6432 net.cpp:816] Ignoring source layer accuracy_res075 I0323 19:55:29.745136 6432 net.cpp:816] Ignoring source layer label_shrink16 I0323 19:55:29.745141 6432 net.cpp:816] Ignoring source layer label_shrink16_label_shrink16_0_split I0323 19:55:29.745146 6432 net.cpp:816] Ignoring source layer loss_res05 I0323 19:55:29.745152 6432 net.cpp:816] Ignoring source layer accuracy_res05 INFO:__main__:Done! F0323 19:55:30.254861 6432 syncedmem.cpp:56] Check failed: error == cudaSuccess (2 vs. 0) out of memory *** Check failure stack trace: *** Aborted (core dumped)

Some wrong parameters in the dataset?

I try to project the vertexes to 2d using the parameters in .pkl file (02628_body.pkl for example). But I find for some images (especially for images from mpii), the result is wrong:
image

I use an opencv function to do the projection:

m = load_model( 'basicModel_m_lbs_10_207_0_v1.0.0.pkl' )
file_name = b'02628_body.pkl'
f = open(file_name, 'rb')
info = pickle.load(f)
m.pose[:] = info['pose']
m.betas[:] = info['betas']
m.trans[:] = info['trans']

img = cv2.imread('02628_image.png'))
h,w,_ = img.shape
k=np.zeros(5)
c=np.array((w,h)) / 2.
f=(info['f'], info['f'])
camera_mtx = np.array([[f[0], 0, c[0]],[0., f[1], c[1]],[0.,0.,1.]], dtype=np.float64)
point_projected = cv2.projectPoints(m.r, info['rt'], info['t'], camera_mtx, k)

I find that 'rt' is always [0., 0., 0.] and 'f' is always 5000.0.
I wonder if the parameters in .pkl file is always right, or you just set them to a fixed value?

Meshio assertion error

I am getting error while running 3dfit/render.py, meshio cannot read .ply format file

AssertionError: Could not deduce file format from extension '. ../up/3dfit/../models/3D/template.ply'.

DensePose to SMPL

Has anyone here attempted to fit the densepose predictions to this model and produce an animated output?

How to generate the 3D texture

I am wondering how to map the texture from the texture image to the 3D mesh. I tried to run render.py. However, because I do not have 3D models and corresponding parameter pkl files, I cannot run render.py.

Could you please provide some example input of render.py and help me learn the generation of 3D texture?

Segmentation annotation for LSP dataset

Hi,

Thanks for the great work. In the upi-s1h dataset, we can obtain the segmentation annotation for the LSP dataset. However, the segmentation is made within bounding box. I wonder where can I get the bounding box information? Or can we get the segmentation under full image as MPII dataset?

Thanks,
Yufei

Help

hello,i want to use this dataset ,is there any way can make me get the human mask?i know the dataset has the segmentation image,like this
5MM E$5%_}TJ`)}N@U3VQXV

but i just want get the mask of the people in this image,like the people in white color,and the background in black coclor
can you help me?

meshio for i/o

I recently updated meshio to include support for PLY, and using it as a drop-in replacement for plyfile would increase the number of supported mesh formats by a great deal. Perhaps that's worth considering.

Aligning images, parts and keypoints

It'd be very useful to be able to align the semantic part labels, keypoints and 3d images - I've been trying to figure out how to do this, but can't seem to find instructions or reverse engineer the cropping pipeline. Are there instructions that I've missed, or could you offer any advice?

I've looked at the {}_fit_crop_info.txt files, but these seem to give a crop of a different size. I've looked at person_size = robust_person_size(joints) and norm_factor = float(target_person_size) / person_size as well, but the function signature for the first doesn't seem to match the function definition (expects pose as a first parameter? Judging by the shape this is not the pose from the pickle file?) and I'm not 100% sure what the value for target_person_size should be (looks like 500?)

Why the 3d texture seems inverted......

I want to render a image onto 3d model using render.py, but when I change "texture = None" to "texture = texture_image_path" in function "render(model, image, cam, steps, segmented=False, scale=1.)", I found the rendering result is so poor and seems inverted, like this. I use the #5 as my input, texture and pkl. I set flag "segmented" to False.
0000texture

Ask for: Pose Model test2.caffemodel

Hi, this work is great! And I am glad to be the first one to ask an issue.

Could you provide your trained model, which should be located in

~/up/pose/training/model/pose/test2.caffemodel

I can't find the download link for this model. Thanks

How to transform mpii 2d keypoint to correspond to image?

image
Seems like provided mpii 2d keypoint in poses.npz locates as relative position to left upper corner of bounding box, and scaling by a scalar.
As shown in figure below row2(original) vs row3(manually multiply a scalar).
image
I wonder how to calculate this scaling scalar? It's changed depend to each sample.

Mismatch between original image and the rendered 3D human model

Hi,

I am trying to render projected 3D human model on the original image using 3dfit/render.py. Although it works for some examples, it would produce mismatched results on some examples as following:
index
Could you help me to solve this problem? Thanks in advance!
Plus, in case you want to reproduce the results by yourselve, the example image in this issue is 05122_image.png.

A bug found in up_tools/mesh.py

recfunctions module should be imported like this:

import numpy.lib.recfunctions as rfn

or there will be an error in line 41:

vertex = rfn.merge_arrays([

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.