Coder Social home page Coder Social logo

muelea / shapy Goto Github PK

View Code? Open in Web Editor NEW
298.0 15.0 45.0 13.48 MB

CVPR 2022 - Official code repository for the paper: Accurate 3D Body Shape Regression using Metric and Semantic Attributes.

Home Page: https://shapy.is.tue.mpg.de/

Python 88.03% C++ 4.45% C 3.94% Cuda 3.52% Shell 0.05%
3d-human human-pose-estimation human-shape-estimation smpl smpl-model smpl-x

shapy's Introduction

SHAPY

Accurate 3D Body Shape Regression using Metric and Semantic Attributes.
[Project Page] [Paper] [MPI Project Page]

Teaser SHAPY

In this repo you will find ...

... SHAPY, a state-of-the-art network that predicts the body shape of a person from a single image. The body shape is represented as SMPL-X parameters or metric measurements, i.e. height, weight and chest/waist/hip circumference.

... Virtual Measurements, a method to compute body measurements from a 3D human mesh.

... Shape to Attributes, a model to obtain ratings how much a word that describes body shape applies to a SMPL-X body.

... Attribute to Shape, a model to obtain the body shape of a person from linguistic attribute ratings and body measurements.

News

  • [2023/05/22] Since some people have trouble installing SHAPY. Here's a Google Colab.
  • [2022/08/11] The HBW Test split evluation protocol is available. See HBW Test.
  • [2022/08/11] Supporting SHAPY evaluation on the HBW validation set. See Evaluation.

License

Software Copyright License for non-commercial scientific research purposes. Please read carefully the following terms and conditions and any accompanying documentation before you download and/or use the SHAPY data and software, (the "Data & Software"), including 3D meshes, alignments, measurements, images, videos, textures, software, scripts, and animations. By downloading and/or using the Data & Software (including downloading, cloning, installing, and any other use of the corresponding github repository), you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Data & Software. Any infringement of the terms of this agreement will automatically terminate your rights under this License.

Installation

Please see Installation for details.

Datasets

We publish two new datasets. Please see Dataset for details. We also provide information how to evaluate your own method on our dataset Human Bodies in The Wild (HBW).

SHAPY Demo

Regressor

Demo SHAPY

cd regressor

# run SHAPY regressor to estimate body shape for images in the wild
python demo.py --save-vis true --save-params true --save-mesh true --split test --datasets openpose --output-folder ../samples/shapy_fit/ --exp-cfg configs/b2a_expose_hrnet_demo.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A part_key=pose datasets.pose.openpose.data_folder=../samples datasets.pose.openpose.img_folder=images  datasets.pose.openpose.keyp_folder=openpose datasets.batch_size=1 datasets.pose_shape_ratio=1.0

Virtual Measurements

Demo Virtual Measurements

We compute virtual measurements from a 3D mesh in SMPL topology.
cd measurements

# given SMPL betas compute anthropometric measurements
python virtual_measurements.py --input-folder ../samples/shapy_fit_for_virtual_measurements/ --output-folder=../samples/virtual_measurements/

Shape to Attributes (S2A)

Demo S2A

We use SMPL-X body shape parameters, predicted by our SHAPY regressor, as input to our S2A model. The estimated ratings are not scaled. The S2A training data, however, ranges from 1.0 to 5.0. Consequently, a predicted rating of 1.0 relates to "strongly disagree" (that the attribute applies to the body shape) whereas a rating value of 5.0 relates to "strongly agree" (that the attribute applies to the body shape).

cd attributes

# given neutral betas estimate female attribute ratings
python demo.py --exp-cfg configs/s2a.yaml --exp-opts output_dir=../data/trained_models/b2a/polynomial/caesar-female_smplx-neutral-10betas ds_gender=female model_gender=neutral num_shape_comps=10

# given neutral betas estimate male attribute ratings
python demo.py --exp-cfg configs/s2a.yaml --exp-opts output_dir=../data/trained_models/b2a/polynomial/caesar-male_smplx-neutral-10betas ds_gender=male model_gender=neutral num_shape_comps=10

Attributes to Shape (A2S)

Demo A2S

Our demo data contains collected attribute ratings and body measurements (height, chest/waist/hip circumference) of two female models, Ali Tate and Judy Kinuthia, and two male models, Joep and AJ. The demo code predicts SMPL-X shape parameters from attributes (a), attributes + height (b), and attributes + height + chest + waist + hips for females (c, d) and males (e, f).

cd attributes

# a) female attributes to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/00_a2s_ff --exp-cfg configs/a2s_variations_polynomial/00_a2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/00_a2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# b) female attributes + height to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/01b_ah2s_ff --exp-cfg configs/a2s_variations_polynomial/01b_ah2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/01b_ah2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# c) female attributes + height + chest + waist + hips to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_ff --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# d) female attributes + height + chest + waist + hips to gender-neutral betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_fn --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-neutral-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=female model_gender=neutral num_shape_comps=10

# e) male attributes + height + chest + waist + hips to gender-neutral betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_mn --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-male_smplx-neutral-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=male model_gender=neutral num_shape_comps=10

# f) male attributes + height + chest + waistß + hips to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_mm --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-male_smplx-male-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=male model_gender=male num_shape_comps=10

Evaluation

You can evaluate SHAPY on the HBW valiation set. To evaluate your own model on the HBW test set, please follow the instructions here.

First, create a symlink in $SHAPY_REPO/datasets to your original HBW folder: ln -s $HBW_FOLDER $SHAPY_REPO/datasets/HBW. Alternatively, you can change the HBW data_folder (l.46) in regressor/configs/b2a_expose_hrnet_eval_shape.yaml.

cd regressor

python evaluate.py --exp-cfg configs/b2a_expose_hrnet_eval_shape.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A datasets.batch_size=1 datasets.pose_shape_ratio=0.0 is_training=False run_final_evaluation_on_validation_set=True

Citation

@inproceedings{Shapy:CVPR:2022,
  title = {Accurate 3D Body Shape Regression using Metric and Semantic Attribute},
  author = {Choutas, Vasileios and M{\”u}ller, Lea and Huang, Chun-Hao P. and Tang, Siyu and Tzionas, Dimitris and Black, Michael J.},
  booktitle = {Proceedings IEEE/CVF Conf.~on Computer Vision and Pattern Recognition (CVPR)},
  month = jun,
  year = {2022},
  month_numeric = {6}
}

Acknowledgments

This work was supported by the Max Planck ETH Center for Learning Systems and the International Max Planck Research School for Intelligent Systems. We thank Tsvetelina Alexiadis, Galina Henz, Claudia Gallatz, and Taylor McConnell for the data collection, and Markus Höschle for the camera setup. We thank Muhammed Kocabas, Nikos Athanasiou and Maria Alejandra Quiros-Ramirez for the insightful discussions.

Disclosure

Conflict of interest disclosure for Michael J. Black March 11, 2022 MJB has received research gift funds from Adobe, Intel, Nvidia, Meta/Facebook, and Amazon. MJB has financial interests in Amazon, Datagen Technologies, and Meshcapade GmbH. While MJB was a part-time employee of Amazon during this project, his research was performed solely at, and funded solely by, the Max Planck Society.

Contact

For questions, please contact [email protected]

For commercial licensing (and all related questions for business applications), please contact [email protected].

shapy's People

Contributors

muelea avatar vchoutas 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

shapy's Issues

SHAPY predicts hugely differences in shape parameters between 2 close images.

Hi,

I have 2 images, 24.png and 24t.png in this Google Drive link:
https://drive.google.com/drive/folders/17HfdAsXvj87JIfFFGwoymDDj1K1w5vm4?usp=sharing
As you can see, these two images are really similar.

I ran these two images using the SHAPY regressor and I got 24.npz and 24t.npz.
When I calculate the L1 distance between betas parameters of 24npz and 24t.npz, I got:

data1 = np.load('24t.npz')['betas']
data2 = np.load('24.npz')['betas']
np.sum(np.abs(data1 - data2))
9.660576

I also got virtual measurements from them:
Processing: 24.npz
Virtual measurements: mass: 71.00 kg height: 1.75 m chest: 0.99 m waist: 0.81 m hips: 1.00 m
Processing: 24t.npz
Virtual measurements: mass: 54.81 kg height: 1.62 m chest: 0.87 m waist: 0.75 m hips: 0.94 m

As you can see, they are hugely different in betas parameters and virtual measurements.

So I don't know if this is caused by a bug in the SHAPY code, or if it's just the output of the SHAPY. As I see between their two meshes and their two images from virtual measurements, the mesh from 24 seems male but the mesh from 24t seems female, so I think maybe this is a bug.

Running setup.py install for mesh-mesh-intersection ... error

The code released by the author can be run on google Colab, but because my device is relatively new, I want to installed the same environment as colab on the local side (ubuntu version, cuda, and torch are all the same as colab)
There will be an error during the last step of installation: pip install .

It seems to be a problem with the torch or cuda version?
I want to know why mesh-mesh-interseection can be installed on colab, but there are errors on the local side.

`  × Running setup.py install for mesh-mesh-intersection did not run successfully.
  │ exit code: 1
  ╰─> [91 lines of output]
      running install
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/__init__.py -> build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/cwh_measurements.py -> build/lib.linux-x86_64-3.10/body_measurements
      copying body_measurements/body_measurements.py -> build/lib.linux-x86_64-3.10/body_measurements
      creating build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/loss.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/__init__.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      copying mesh_mesh_intersection/mesh_mesh_intersection.py -> build/lib.linux-x86_64-3.10/mesh_mesh_intersection
      running build_ext
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py:414: UserWarning: The detected CUDA version (12.2) has a minor version mismatch with the version that was used to compile PyTorch (12.1). Most likely this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      /home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 12.2
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'mesh_mesh_intersect_cuda' extension
      creating /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10
      creating /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src
      Emitting ninja build file /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      [1/2] /usr/bin/nvcc  -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
      FAILED: /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.o
      /usr/bin/nvcc  -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
      /usr/include/cub/detail/device_synchronize.cuh(53): error: identifier "__cudaDeviceSynchronizeDeprecationAvoidance" is undefined
      
      1 error detected in the compilation of "/home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect_cuda_op.cu".
      [2/2] c++ -MMD -MF /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect.o.d -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/mesh-mesh-intersection/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/TH -I/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/include/THC -I/home/widelab/miao/shapy/.venv/shapy/include -I/usr/include/python3.10 -c -c /home/widelab/miao/shapy/mesh-mesh-intersection/src/mesh_mesh_intersect.cpp -o /home/widelab/miao/shapy/mesh-mesh-intersection/build/temp.linux-x86_64-3.10/src/mesh_mesh_intersect.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mesh_mesh_intersect_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2100, in _run_ninja_build
          subprocess.run(
        File "/usr/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/home/widelab/miao/shapy/mesh-mesh-intersection/setup.py", line 76, in <module>
          setup(name=NAME,
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
          return orig.install.run(self)
        File "/usr/lib/python3.10/distutils/command/install.py", line 619, in run
          self.run_command('build')
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
          _build_ext.run(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
          self.build_extensions()
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 873, in build_extensions
          build_ext.build_extensions(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
          self._build_extensions_serial()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
          _build_ext.build_extension(self, ext)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
          objects = self.compiler.compile(sources,
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 686, in unix_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/home/widelab/miao/shapy/.venv/shapy/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mesh-mesh-intersection`

Can't run the sample. What am I missing?

Hi

Running this in a Colab Notebook.
All is well until running the demo.

I get:

omegaconf.errors.ValidationError: Cannot convert 'tuple' to string: '('betas', 'global_rot', 'body_pose', 'camera')'
full_key: groups[0]
reference_type=Tuple[str]
object_type=list

Keypoint detection

In addition to openpose, can I use other key points to detect the model? I run the code to test my own data measured waist circumference is about 88, and my data is the thinnest girl waist circumference is 70, the fattest boy waist circumference is 115, what may be the reason

Request code changes to compatible with higher Python version or at least higher Pytorch version

Hi,

The shapy code use Python 3.8 with Pytorch 1.7.1. All of them are old compare to Python 3.11.3 and Pytorch 2.0.1 right now.
Can you consider upgrade Python version, or at least Pytorch version?

Pytorch version 1.7.1 is not compatible with newer GPU (I am using RTX 3080), and when I tried newer Pytorch version, for example Pytorch 1.8, I got this error during running regressor:

Traceback (most recent call last):
File "demo.py", line 24, in
from human_shape.models.build import build_model
File "/home/csgrad/ngnguyen/shapy/regressor/human_shape/models/init.py", line 1, in
from .build import build_model
File "/home/csgrad/ngnguyen/shapy/regressor/human_shape/models/build.py", line 10, in
from .body_heads import build_body_head, BODY_HEAD_REGISTRY
File "/home/csgrad/ngnguyen/shapy/regressor/human_shape/models/body_heads/init.py", line 3, in
from .body_heads import *
File "/home/csgrad/ngnguyen/shapy/regressor/human_shape/models/body_heads/body_heads.py", line 13, in
from ..common.iterative_regressor import HMRLikeRegressor
File "/home/csgrad/ngnguyen/shapy/regressor/human_shape/models/common/iterative_regressor.py", line 21, in
from body_measurements import BodyMeasurements
File "/home/csgrad/ngnguyen/env2/lib/python3.8/site-packages/mesh_mesh_intersection-0.2.0-py3.8-linux-x86_64.egg/body_measurements/init.py", line 1, in
from .body_measurements import BodyMeasurements
File "/home/csgrad/ngnguyen/env2/lib/python3.8/site-packages/mesh_mesh_intersection-0.2.0-py3.8-linux-x86_64.egg/body_measurements/body_measurements.py", line 6, in
from mesh_mesh_intersection import MeshMeshIntersection
File "/home/csgrad/ngnguyen/env2/lib/python3.8/site-packages/mesh_mesh_intersection-0.2.0-py3.8-linux-x86_64.egg/mesh_mesh_intersection/init.py", line 18, in
from .mesh_mesh_intersection import MeshMeshIntersection
File "/home/csgrad/ngnguyen/env2/lib/python3.8/site-packages/mesh_mesh_intersection-0.2.0-py3.8-linux-x86_64.egg/mesh_mesh_intersection/mesh_mesh_intersection.py", line 29, in
import mesh_mesh_intersect_cuda
ImportError: /home/csgrad/ngnguyen/env2/lib/python3.8/site-packages/mesh_mesh_intersection-0.2.0-py3.8-linux-x86_64.egg/mesh_mesh_intersect_cuda.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c107complexIfEEEEPKNS_6detail12TypeMetaDataEv

It seems your mesh_mesh_intersect packages not compatible with Pytorch 1.8 or higher.
Please consider update your mesh_mesh_intersect packages to run with later Pytorch version, or if posible further, update your code with newer python version.

Thank you

Running Attributes to Shape (A2S) on my data

Hi, Thank you for your great work.

I am curious whether I can directly use your pre-trained model to test only my data. For example, I know the person's height and weight, and also the image of him.

Can I directly evaluate A2S model and get SMPL-X betas by changing the commands?

Or do I have to re-trained the model by myself?

Thank you:)

Running regression demo.py in container with Ubuntu 18.04

Hi Shapy devs,

Could you assist with helping me debug this error? I have strung up a container with Ubuntu 18.04 with CUDA enabled.
Thank you so much in advance!

Here is the command that was executed:
MESA_GL_VERSION_OVERRIDE=4.1 python3 demo.py --save-vis true --save-params true --save-mesh true --split test --datasets openpose --output-folder ../samples/shapy_fit/ --exp-cfg configs/b2a_expose_hrnet_demo.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A part_key=pose datasets.pose.openpose.data_folder=../samples datasets.pose.openpose.img_folder=images datasets.pose.openpose.keyp_folder=openpose datasets.batch_size=1 datasets.pose_shape_ratio=1.0

The error given in traceback is as follows:

File "/home/shapy/regressor/human_shape/utils/transf_utils.py", line 73, in crop
new_x = max(0, -ul[0]), min(br[0], len(img[0])) - ul[0]
IndexError: index 0 is out of bounds for axis 0 with size 0

Full error traceback shown below:

Traceback (most recent call last):
File "demo.py", line 435, in
main(cfg, show=show, demo_output_folder=output_folder, pause=pause,
File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "demo.py", line 212, in main
for bidx, batch in enumerate(tqdm(body_dloader, dynamic_ncols=True)):
File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1167, in iter
for obj in iterable:
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next
data = self._next_data()
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data
data.reraise()
File "/usr/local/lib/python3.8/dist-packages/torch/_utils.py", line 428, in reraise
raise self.exc_type(msg)
IndexError: Caught IndexError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/shapy/regressor/human_shape/data/datasets/openpose.py", line 240, in getitem
img, cropped_image, target = self.transforms(
File "/home/shapy/regressor/human_shape/data/transforms/transforms.py", line 32, in call
output = t(*next_input, **kwargs)
File "/home/shapy/regressor/human_shape/data/transforms/transforms.py", line 542, in call
cropped_image = crop(
File "/home/shapy/regressor/human_shape/utils/transf_utils.py", line 73, in crop
new_x = max(0, -ul[0]), min(br[0], len(img[0])) - ul[0]
IndexError: index 0 is out of bounds for axis 0 with size 0

Installation instruction seems not to work

Hi, I've just tried to install the project as described in the Installation.md and tried to run the demo command:

cd regressor

# run SHAPY regressor to estimate body shape for images in the wild
python demo.py --save-vis true --save-params true --save-mesh true --split test --datasets openpose --output-folder ../samples/shapy_fit/ --exp-cfg configs/b2a_expose_hrnet_demo.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A part_key=pose datasets.pose.openpose.data_folder=../samples datasets.pose.openpose.img_folder=images  datasets.pose.openpose.keyp_folder=openpose datasets.batch_size=1 datasets.pose_shape_ratio=1.0

First of all, the demo script seems to expect a different folder structure than explained in the installation manual. It's not a problem to copy them to the right place, but with the installation script this could be automated (or adapted in the code):

# should be at data/models/smplx/
FileNotFoundError: [Errno 2] No such file or directory: '../data/expose_release/models/smplx/SMPLX_NEUTRAL.npz'

# should be at data/utility_files/smplx
FileNotFoundError: [Errno 2] No such file or directory: '../data/expose_release/utility_files/smplx/smplx_extra_joints.yaml'

And second, there are files missing, like the HRNet pretrained imagenet weights (and not mentioned in the installation):

ValueError: ../data/hrnet_v2/hrnetv2_w48_imagenet_pretrained.pth is not exist!

Would it be possible provide all the files necessary to reproduce your results? I guess it is this model: HRNet-W48-C

And libturbojpeg is needed as well (sudo apt-get install libturbojpeg).

Model Agency Data Expired

Hi,
It seems like URI given in model agency data are expired. I am getting a 404 when trying to download the image. If possible can you please release the images.

Thanks

ImportError: cannot import name 'model_urls' from 'torchvision.models.resnet'

I have successfully installed everything in Installation instructions. However, I'm getting this error when running the demo code.

ImportError: cannot import name 'model_urls' from 'torchvision.models.resnet' (/home/user/.conda/envs/shapy/lib/python3.8/site-packages/torchvision/models/resnet.py)

I understand that the original repo was tested with Python 3.8, CUDA 10.2 and PyTorch 1.7.1. But due to a constraint of my GPU I can only use CUDA 11.X +. Thus I'm current using CUDA 11.8 and PyTorch 2.1.1.

Am I out of luck trying to run this code on my setup?

any way to do the opposite of regressor?

Is it possible to go from image2image given a modified shape file?
E.g. I put a photo of myself if I'm fat, regressor => creates a "fat" shape.
I go S2A, modify some attributes to slim me and make me more muscular, A2S => create a new shape.
Is there any research that would take the updated shape and the source image and generate a new image with that updated shape?

great work! simple question about texture rendering

Hello there, this is a really interesting work. I have been following your group for a while. You have several good works such VIBE, PARE, and SHAPY. My question is why there is no discussion on cloth rendering? Is it because it is a different topic than naked human digitalization or am I missing some obvious technique for texture rendering (clothes, skin and so on)?
I am looking forward to your reply. Thank you!

any Google Colab notebook for Shapy?

just curious. i'm on a M1 MacStudio and would love to run this locally but even a Colab notebook would help. i did register and got the shapy data and Model Agency data. thanks!

Getting whole SMPL-X Parameters from Demo.py

Hello, I would like to get the SMPL-X paratmers from demo.py. My target parameters are

'global_orient' (3,), 'transl' (3,), 'body_pose' (63,), 'left_hand_pose' (45,), 'right_hand_pose' (45,), 
 'jaw_pose' (3,), 'leye_pose' (3,), 'reye_pose' (3,), 'expression' (10,), 'betas' (10,)

However, after I run demo.py and enable --save-params to get the .npz file, I found the parameters stored in .npz miss some SMPL-X parameters I want, as well as have different shape to what I expect.

This is the data stored in the .npz file after running demo.py

image

Basically, it contains only betas, transl, global_rot, and body_pose that may be part of what I want. The other parameters are missing. Moreover, I found the the shape of global_rot is (1,3,3) and raw_global_rot is (6,); the shape of body_pose is (21,3,3) and raw_body_pose is (126,). None of these has the same shape with what I expect. What is the meaning of these parameters and how could I get the whole SMPL-X parameters?

A2S with ModelAgency data

Hi

Thanks for this exciting project.
I am trying to run A2S using ModelAgence data.

I downloaded the ModelAgencydata, but it seemed impossible to use it for testing right away, so I checked the file modeldata_for_a2s_mal.pt and the file modeldata_for_a2s_mal.pt in the path of /shapy/samples/attributes. And I pre-processed the data.

When I followed your demo code below:

cd attributes

# a) female attributes to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/00_a2s_ff --exp-cfg configs/a2s_variations_polynomial/00_a2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/00_a2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# b) female attributes + height to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/01b_ah2s_ff --exp-cfg configs/a2s_variations_polynomial/01b_ah2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/01b_ah2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# c) female attributes + height + chest + waist + hips to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_ff --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-female-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=female model_gender=female num_shape_comps=10

# d) female attributes + height + chest + waist + hips to gender-neutral betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_fn --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-female_smplx-neutral-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=female model_gender=neutral num_shape_comps=10

# e) male attributes + height + chest + waist + hips to gender-neutral betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_mn --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-male_smplx-neutral-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=male model_gender=neutral num_shape_comps=10

# f) male attributes + height + chest + waistß + hips to gender-specific betas
python demo.py --demo_output_folder ../samples/a2s_fit/04b_ahcwh2s_mm --exp-cfg configs/a2s_variations_polynomial/04b_ahcwh2s.yaml --exp-opts output_dir=../data/trained_models/a2b/caesar-male_smplx-male-10betas/poynomial/04b_ahcwh2s.yaml/ ds_gender=male model_gender=male num_shape_comps=10

a) is worked well but the rest of the cases had very strange betas results like this:

Predicted bestas for ullamodels_Lukas_A
[-220010.45    -87673.35     34770.098     2416.1309   20770.61
  -22331.287   -12247.801  -113331.45   -108111.984   154844.66  ]

Unlike a2s, ahcwh2s seems to require additional setup or previous steps, is that right? If so, which one do I need?

Some problems and solves

1.ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Cannot connect to "None""
solved:

import os
os.environ['PYOPENGL_PLATFORM'] = 'egl'

2.error:pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
solved:
pip install pyrender==0.1.43

Installation on Windows

Hello, I've been trying to install the project as described in the Installation.md, but on Windows 10 instead of Ubuntu. Also, my machine has a rtx 3060, that's why I also installed CUDA 11.0 instead of 10.2 (keeping PyTorch 1.7.1 and every other requirement).

The problem I have with this method is in the last step, when I try to run python setup.py install inside mesh-mesh-intersection I get the following error:

nvcc fatal : Unsupported gpu architecture 'compute_86' error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.0\\bin\\nvcc.exe' failed with exit code 1

I wanted to know if there is a known way to run shapy on windows 10, or if there is a way to fix the above error since I wasn't able to find an answer googling by myself.

Thanks!

Edit: PS: I also have installed Visual studio 2019 with cpp desktop development, VS2019 build tools and its redistributables

Working Colab Notebook

Can you provide a colab notebook with a proper setup?

I tried but was unable to get it working.

A few issues:

  1. Running shapy/data/download_data.sh as instructed in INSTALL.md fails b/c there is no data folder, and hence no download_data.sh. I tried using wget directly by running wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=shapy&sfile=shapy_data.zip' -O './shapy_data.zip' --no-check-certificate --continue but that did not work either.
  2. Colab uses python 3.7 and shapy uses python 3.8. This leads to pip requirement versions that are impossible to satisfy.
    ``ERROR: Could not find a version that satisfies the requirement fvcore==0.1.5 (from versions: 0.1.dev191230, ...) ERROR: No matching distribution found for fvcore==0.1.5```

I was able to fix the pip issues by relaxing the versions of Pillow, PyYAML and fvcore, so the pip install succeeded.

But when I run

%cd /content/shapy/regressor
! python demo.py --save-vis true --save-params true --save-mesh true --split test --datasets openpose --output-folder samples/shapy_fit/ --exp-cfg configs/b2a_expose_hrnet_demo.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A part_key=pose datasets.pose.openpose.data_folder=../samples datasets.pose.openpose.img_folder=images  datasets.pose.openpose.keyp_folder=openpose datasets.batch_size=1 datasets.pose_shape_ratio=1.0

I get the following error.

INFO - 2022-06-17 20:33:28,903 - acceleratesupport - No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
Traceback (most recent call last):
  File "demo.py", line 24, in <module>
    from human_shape.models.build import build_model
  File "/content/shapy/regressor/human_shape/models/__init__.py", line 1, in <module>
    from .build import build_model
  File "/content/shapy/regressor/human_shape/models/build.py", line 10, in <module>
    from .body_heads import build_body_head, BODY_HEAD_REGISTRY
  File "/content/shapy/regressor/human_shape/models/body_heads/__init__.py", line 3, in <module>
    from .body_heads import *
  File "/content/shapy/regressor/human_shape/models/body_heads/body_heads.py", line 13, in <module>
    from ..common.iterative_regressor import HMRLikeRegressor
  File "/content/shapy/regressor/human_shape/models/common/iterative_regressor.py", line 21, in <module>
    from body_measurements import BodyMeasurements
  File "/usr/local/lib/python3.7/dist-packages/mesh_mesh_intersection-0.2.0-py3.7-linux-x86_64.egg/body_measurements/__init__.py", line 1, in <module>
    from .body_measurements import BodyMeasurements
  File "/usr/local/lib/python3.7/dist-packages/mesh_mesh_intersection-0.2.0-py3.7-linux-x86_64.egg/body_measurements/body_measurements.py", line 6, in <module>
    from mesh_mesh_intersection import MeshMeshIntersection
  File "/usr/local/lib/python3.7/dist-packages/mesh_mesh_intersection-0.2.0-py3.7-linux-x86_64.egg/mesh_mesh_intersection/__init__.py", line 18, in <module>
    from .mesh_mesh_intersection import MeshMeshIntersection
  File "/usr/local/lib/python3.7/dist-packages/mesh_mesh_intersection-0.2.0-py3.7-linux-x86_64.egg/mesh_mesh_intersection/mesh_mesh_intersection.py", line 28, in <module>
    import mesh_mesh_intersect_cuda
ImportError: /usr/local/lib/python3.7/dist-packages/mesh_mesh_intersection-0.2.0-py3.7-linux-x86_64.egg/mesh_mesh_intersect_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at10TensorBase8data_ptrIdEEPT_v

I think this indicates a cuda mismatch?

Colab cuda version is V11.1.105:

! /usr/local/cuda/bin/nvcc --version 
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

Here is my notebook:
https://colab.research.google.com/drive/15M3KpSCX_pvI5yv40spzvYiLXlDRUXf4?usp=sharing

[Windows] Solved problem(mesh-mesh-intersection)

To Windows users, I hope this post proves helpful. I recently became aware of issues specific to Windows users and wanted to share my expertise.

The focus of this post is on the MSVC compiler environment variables, without altering the contents of setup.py.

I tested in CUDA 12.1 with PyTorch 2.3.0. Compare my environment variables with yours below.

CUDA_SAMPLES_INC=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\CUDA-SAMPLES\Common
CUDA_HOME=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1

There aren't any significant differences from here on. After installing VS2022 Community, I separately ran my command prompt window and called vcvars64.bat (usually located at 2022/Community/VC/Auxiliary/Build). For more details, please refer to the link below.

NVlabs/tiny-cuda-nn#280

If running vcvars64.bat still doesn't resolve the issue (even after rebooting), add the following paths to the environment variable PATH:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x64

I'm not entirely sure why, but my environment variables also include the following two paths (Windows Kit). It seems like a good idea to include them, possibly because they were encountered during the implementation of another project.

"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64"
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt"

This post is for Windows users experiencing setup issues with mesh-mesh intersection. Furthermore, it serves as a helpful guide for users encountering messages indicating the absence of the "cl" compiler during the "build_ext" stage, or facing problems during compilation where "crtdefs" or "cstddef" cannot be found. I haven't encountered any other issues myself.

temp

Poses with backwards bent legs

Hi,
I ran SHAPY on my data

I have 3 issues that occur frequently on most of my test samples:

  1. The head pose frequently leans back
  2. The knees are frequently bent backwards.
  3. Hands pose are not accurate

I've seen this happening slightly on the demo set but not as frequent as on my data.

I was wondering if I'm missing anything.

Thanks in advance!

SMPLify-X vs SHAPY compared pose examples

woman-01-issue
woman-02-issue

Configuration

Input data (images and keypoints with SHAPY and SMPLify-X results):
data.zip

genders.yaml

...
"woman-01": "female"
"woman-02": "female"
...

Run command:

python demo.py \
    --save-vis true \
    --save-params true \
    --save-mesh true \
    --split test \
    --datasets openpose \
    --output-folder ../samples/public-testset/shapy_output \
    --exp-cfg configs/b2a_expose_hrnet_demo.yaml \
    --exp-opts \
            output_folder=../data/trained_models/shapy/SHAPY_A \
            part_key=pose \
            datasets.pose.openpose.data_folder=../samples \
            datasets.pose.openpose.img_folder=public-testset/images \
            datasets.pose.openpose.keyp_folder=public-testset/keypoints \
            datasets.batch_size=1 \
            datasets.pose_shape_ratio=1.0

Error when running Demo.py

Hello, can someone help me with this error? I follow every step that mentions in the installation. But when I run the demo.py code, I got this error. Please check full error log in the attachment file.

File "/usr/local/lib/python3.10/dist-packages/omegaconf/nodes.py", line 29, in init
self._set_value(value) # lgtm [py/init-calls-subclass]
File "/usr/local/lib/python3.10/dist-packages/omegaconf/nodes.py", line 46, in _set_value
self._val = self.validate_and_convert(value)
File "/usr/local/lib/python3.10/dist-packages/omegaconf/nodes.py", line 76, in validate_and_convert
return self._validate_and_convert_impl(value)
File "/usr/local/lib/python3.10/dist-packages/omegaconf/nodes.py", line 194, in _validate_and_convert_impl
raise ValidationError("Cannot convert '$VALUE_TYPE' to string: '$VALUE'")
omegaconf.errors.ValidationError: Cannot convert 'tuple' to string: '('betas', 'global_rot', 'body_pose', 'camera')'
full_key: groups[0]
reference_type=Tuple[str]
object_type=list

error_log.txt

SMPLX body doesn't match the beta coefficient

Hi,

thanks for the amazing work. However, when I run demo.py, the output beta coefficient can't match the output vertices. Here's a code snippet that can reproduce the problem:

import smplx
import numpy as np
smplx_model = smplx.SMPLX(os.path.join(SMPLX_MODEL_DIR, "SMPLX_NEUTRAL.npz"))
faces = smplx_model.faces

body_estimation_path = "/root/project/shapy/samples/shapy_fit/img_21.npz"
body_estimation = np.load(body_estimation_path)
est_body_vertices = smplx_model(beta=torch.tensor(body_estimation["betas"][None], dtype=torch.float32))

save_obj_mesh(os.path.join(data_dir, "smplx_vshaped.obj"), est_body_vertices.v_shaped.detach().cpu().numpy()[0], faces)
save_obj_mesh(os.path.join(data_dir, "est_body_vshaped.obj"), body_estimation['v_shaped'], faces)

The visualization of these two meshes is as follows. The grayish one is est_body_vshaped.obj (it's the same shape as the saved ply file) and the white one is smplx_vshaped.obj (obtained by running SMPLX alone using the predicted betas). And they have a clear difference. I also tried with other examples, and they all have this problem. I would really appreciate it if you have any hints about solving this. Thank you!

Screenshot 2023-11-17 010106

ModuleNotFoundError: No module named 'mesh_mesh_intersect_cuda'

Hello, I am having some problems with the module mesh_mesh_instersect_cuda when trying to use the shape to attributes and attributes to shape modules, it says it is not found, but I make sure that the module mesh_mesh_intersect (including torch-mesh-isect) were installed correctly (at least no error found in the log after running the setup.py)

Any help would be greatly appreciated, thanks!

how to test own dataset on Demo.py

Hello, I want to try my own dataset to test regressor. Which process that I need to do first before I run on regressor? Do I need to run openpose and get json format first? And also image size is only 300 450 px ?

I run my own image and got this error : ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 135 and the array at index 1 has size 131

My image is :1920 1080 px but I resize to 300 450 px to match with yours and still have that error.

Issue in testing video

When passing a video in pipeline the predictions of 3D overlay is fine. But when getting the 2D projected keypoints and mapping that onto the image plane I have noticed a slight displacement in the keypoints being plotted. Is the result from shapy be slightly displaced.

Evaluation script

Hello,

In https://github.com/muelea/shapy/blob/master/documentation/DATA.md, you have mentioned that you have provided a script to evaluate on the HBW validation dataset. I would be greatly obliged if you could please point me to this script and provide instructions to run the script.

Also I could not find the instructions for evaluation on the HBW test set. Could you please point me to where on the website this is mentioned. Would you be releasing the ground truth shape for the test set?

Import error/issue

Hi,
I am encountering this error

from attributes import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jupyter/shapy/attributes/attributes/__init__.py", line 1, in <module>
    from .attributes_betas.a2b import A2B, A2BProbabilistic
  File "/home/jupyter/shapy/attributes/attributes/attributes_betas/a2b.py", line 25, in <module>
    from body_measurements import BodyMeasurements
ImportError: cannot import name 'BodyMeasurements' from 'body_measurements' (unknown location)

I did a pip install of body_measurements but that does not seem to have resolved the issue. Can you please help with this?

Applicability of Model to partial pose

I was wondering if this project is usable on partial datasets, say waist up shots or maybe even an extended portrait shot, for partial reconstruction and if not if there has been other work to do this/if this model can be modified to to perform that task?

ModuleNotFoundError: No module named 'attributes.attributes_betas'

I got this error while running demp.py in COLAB. Can you help me?

File "/usr/local/lib/python3.10/dist-packages/attributes/init.py", line 1, in
from .attributes_betas.a2b import A2B, A2BProbabilistic
ModuleNotFoundError: No module named 'attributes.attributes_betas'

CalledProcessError Traceback (most recent call last)
in <cell line: 1>()
----> 1 get_ipython().run_cell_magic('shell', '', 'cd /content/shapy/regressor\npython demo.py --save-vis true --save-params true --save-mesh true --split test --datasets openpose --output-folder samples/shapy_fit/ --exp-cfg configs/b2a_expose_hrnet_demo.yaml --exp-opts output_folder=../data/trained_models/shapy/SHAPY_A part_key=pose datasets.pose.openpose.data_folder=../samples datasets.pose.openpose.img_folder=images datasets.pose.openpose.keyp_folder=openpose datasets.batch_size=1 datasets.pose_shape_ratio=1.0\n')

Can I use pre-trained model to get SMPL-X parameters from a RGB-D image?

Hello, I would like to ask could I get SMPL-X parameters from a RGB-D image using this model? Specifically, I may only need the beta value of SMPL-X. If I could do this, how should I do that?

Should I use openpose to extract the keypoints first? If so, what output format of openpose and how many keypoints I should use?

All meshes are same

i was trying to get hip, waist, bust from the mesh but meshes are all same, gives different values but same mesh, (i didnt use model agency and SP-3D data, only HBW). can you please explain each dataset uses.

realse of training code

Hi, thanks for sharing great works.

It is quiet novel idea in terms of new focus on aspect of body shape and effective solution for it.
I wonder if you plan to release the code for training either. I guess the current code version does not contain training code.

Thanks

HOTO?

I'm trying to figure out how to run the shapy model on my own RGB images, without needing any additional files like keypoints or vertices.

I would greatly appreciate it if you could provide me an explanation of how to run the code with my RGB images only - to get the measurements of the body

Waist measurement problem

Hello, do the key points of the face and hand affect the waist measurement? For example, I use my model to detect body keys, while hand and face keys use the hands and faces corresponding to the images in your routine

Predictions Problems

Hi, I am trying to run Shapy locally on my computer.

After finishing the installation, I managed to run shapy regressor on the repo's sample data.

Unfortunately there seems to be some issue with the predictions as they all look the same and don't resemble the input data.

The input data is the one provided in the repo (images and openpose).

The output of the regressor all look weird:

img_00
img_00.jpg
img_00_hd_stage_02_cat
img_00_hd_stage_02_cat.png
img_01
img_01.jpg
img_01_hd_stage_02_cat
img_01_hd_stage_02_cat.png
img_02
img_02.jpg
img_02_hd_stage_02_cat
img_02_hd_stage_02_cat.png

The issue is even more clear when looking at the output from the virtual measurements:

Processing: img_00.npz
Virtual measurements: mass: 63.45 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_01.npz
Virtual measurements: mass: 63.55 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_02.npz
Virtual measurements: mass: 63.33 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_03.npz
Virtual measurements: mass: 63.27 kg height: 1.69 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_04.npz
Virtual measurements: mass: 63.24 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_05.npz
Virtual measurements: mass: 63.18 kg height: 1.69 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_06.npz
Virtual measurements: mass: 62.90 kg height: 1.69 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_07.npz
Virtual measurements: mass: 62.98 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_08.npz
Virtual measurements: mass: 62.64 kg height: 1.69 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_09.npz
Virtual measurements: mass: 63.78 kg height: 1.70 m chest: 0.94 m waist: 0.81 m hips: 0.94 m
Processing: img_10.npz
Virtual measurements: mass: 63.20 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_11.npz
Virtual measurements: mass: 63.13 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_12.npz
Virtual measurements: mass: 63.32 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_13.npz
Virtual measurements: mass: 63.04 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_14.npz
Virtual measurements: mass: 63.11 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_15.npz
Virtual measurements: mass: 62.85 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_16.npz
Virtual measurements: mass: 62.93 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_17.npz
Virtual measurements: mass: 63.04 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_18.npz
Virtual measurements: mass: 62.89 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.93 m
Processing: img_19.npz
Virtual measurements: mass: 62.99 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_20.npz
Virtual measurements: mass: 63.10 kg height: 1.69 m chest: 0.94 m waist: 0.80 m hips: 0.94 m
Processing: img_21.npz
Virtual measurements: mass: 63.02 kg height: 1.70 m chest: 0.94 m waist: 0.80 m hips: 0.93 m


Does anyone know why something like this might happen? As I said I've only followed the installation steps and run the model.

ModuleNotFoundError: No module named 'resource

Hello Owais Here, i run the demo.py and getting the error ..

"ModuleNotFoundError: No module named 'resource'"

also when i run the virtual_measurements file i am getting this error

"ModuleNotFoundError: No module named 'body_measurements'"

Thanks in advance : - ))

gender-neutral betas vs gender-specific betas

Hi, great work.

i have a question about "gender-neutral betas" vs "gender-specific betas":

the neural network in "regressor/demo.py", that predicts the betas, doesnt have a gender_type category in its "exp_cfg" config.

but the attributes network has an option for "gender-specific" betas ("model_gender").

Could you elaborate on this ? can the neural network predict "gender-specific" betas ?

Thanks,
Tal

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.