High-Resolution 3D Human Digitization from A Single Image.

Related tags

Deep Learning pifuhd
Overview

PIFuHD: Multi-Level Pixel-Aligned Implicit Function for High-Resolution 3D Human Digitization (CVPR 2020)

report Open In Colab

News:

  • [2020/06/15] Demo with Google Colab (incl. visualization) is available! Please check out #pifuhd on Twitter for many results tested by users!

This repository contains a pytorch implementation of "Multi-Level Pixel-Aligned Implicit Function for High-Resolution 3D Human Digitization".

Teaser Image

This codebase provides:

  • test code
  • visualization code

Demo on Google Colab

In case you don't have an environment with GPUs to run PIFuHD, we offer Google Colab demo. You can also upload your own images and reconstruct 3D geometry together with visualization. Try our Colab demo using the following notebook:
Open In Colab

Requirements

  • Python 3
  • PyTorch tested on 1.4.0, 1.5.0
  • json
  • PIL
  • skimage
  • tqdm
  • cv2

For visualization

  • trimesh with pyembree
  • PyOpenGL
  • freeglut (use sudo apt-get install freeglut3-dev for ubuntu users)
  • ffmpeg

Note: At least 8GB GPU memory is recommended to run PIFuHD model.

Run the following code to install all pip packages:

pip install -r requirements.txt 

Download Pre-trained model

Run the following script to download the pretrained model. The checkpoint is saved under ./checkpoints/.

sh ./scripts/download_trained_model.sh

A Quick Testing

To process images under ./sample_images, run the following code:

sh ./scripts/demo.sh

The resulting obj files and rendering will be saved in ./results. You may use meshlab (http://www.meshlab.net/) to visualize the 3D mesh output (obj file).

Testing

  1. run the following script to get joints for each image for testing (joints are used for image cropping only.). Make sure you correctly set the location of OpenPose binary. Alternatively colab demo provides more light-weight cropping rectange estimation without requiring openpose.
python apps/batch_openpose.py -d {openpose_root_path} -i {path_of_images} -o {path_of_images}
  1. run the following script to run reconstruction code. Make sure to set --input_path to path_of_images, --out_path to where you want to dump out results, and --ckpt_path to the checkpoint. Note that unlike PIFu, PIFuHD doesn't require segmentation mask as input. But if you observe severe artifacts, you may try removing background with off-the-shelf tools such as removebg. If you have {image_name}_rect.txt instead of {image_name}_keypoints.json, add --use_rect flag. For reference, you can take a look at colab demo.
python -m apps.simple_test
  1. optionally, you can also remove artifacts by keeping only the biggest connected component from the mesh reconstruction with the following script. (Warning: the script will overwrite the original obj files.)
python apps/clean_mesh.py -f {path_of_objs}

Visualization

To render results with turn-table, run the following code. The rendered animation (.mp4) will be stored under {path_of_objs}.

python -m apps.render_turntable -f {path_of_objs} -ww {rendering_width} -hh {rendering_height} 
# add -g for geometry rendering. default is normal visualization.

Citation

@inproceedings{saito2020pifuhd,
  title={PIFuHD: Multi-Level Pixel-Aligned Implicit Function for High-Resolution 3D Human Digitization},
  author={Saito, Shunsuke and Simon, Tomas and Saragih, Jason and Joo, Hanbyul},
  booktitle={CVPR},
  year={2020}
}

Relevant Projects

Monocular Real-Time Volumetric Performance Capture (ECCV 2020)
Ruilong Li*, Yuliang Xiu*, Shunsuke Saito, Zeng Huang, Kyle Olszewski, Hao Li

The first real-time PIFu by accelerating reconstruction and rendering!!

PIFu: Pixel-Aligned Implicit Function for High-Resolution Clothed Human Digitization (ICCV 2019)
Shunsuke Saito*, Zeng Huang*, Ryota Natsume*, Shigeo Morishima, Angjoo Kanazawa, Hao Li

The original work of Pixel-Aligned Implicit Function for geometry and texture reconstruction, unifying sigle-view and multi-view methods.

Learning to Infer Implicit Surfaces without 3d Supervision (NeurIPS 2019)
Shichen Liu, Shunsuke Saito, Weikai Chen, Hao Li

We answer to the question of "how can we learn implicit function if we don't have 3D ground truth?"

SiCloPe: Silhouette-Based Clothed People (CVPR 2019, best paper finalist)
Ryota Natsume*, Shunsuke Saito*, Zeng Huang, Weikai Chen, Chongyang Ma, Hao Li, Shigeo Morishima

Our first attempt to reconstruct 3D clothed human body with texture from a single image!

Other Relevant Works

ARCH: Animatable Reconstruction of Clothed Humans (CVPR 2020)
Zeng Huang, Yuanlu Xu, Christoph Lassner, Hao Li, Tony Tung

Learning PIFu in canonical space for animatable avatar generation!

Robust 3D Self-portraits in Seconds (CVPR 2020)
Zhe Li, Tao Yu, Chuanyu Pan, Zerong Zheng, Yebin Liu

They extend PIFu to RGBD + introduce "PIFusion" utilizing PIFu reconstruction for non-rigid fusion.

Deep Volumetric Video from Very Sparse Multi-view Performance Capture (ECCV 2018)
Zeng Huang, Tianye Li, Weikai Chen, Yajie Zhao, Jun Xing, Chloe LeGendre, Linjie Luo, Chongyang Ma, Hao Li

Implict surface learning for sparse view human performance capture!

License

CC-BY-NC 4.0. See the LICENSE file.

Comments
  • TypeError: group_keypoints() got an unexpected keyword argument 'demo'

    TypeError: group_keypoints() got an unexpected keyword argument 'demo'

    I try to run the demo on Google collab, but the following errors always appear. All processes are carried out according to the video, and the input image is also used test.png Why do the following errors occur? After trying many solutions, I don't know if anyone has the same problem. Can it be solved?


    TypeError Traceback (most recent call last) in () 3 load_state(net, checkpoint) 4 ----> 5 get_rect(net.cuda(), [image_path], 512)

    in get_rect(net, images, height_size) 28 total_keypoints_num += extract_keypoints(heatmaps[:, :, kpt_idx], all_keypoints_by_type, total_keypoints_num) 29 ---> 30 pose_entries, all_keypoints = group_keypoints(all_keypoints_by_type, pafs, demo=True) 31 for kpt_id in range(all_keypoints.shape[0]): 32 all_keypoints[kpt_id, 0] = (all_keypoints[kpt_id, 0] * stride / upsample_ratio - pad[1]) / scale

    TypeError: group_keypoints() got an unexpected keyword argument 'demo'

    opened by sxstone 19
  • Error in google colab notebook

    Error in google colab notebook

    It was running fine, just 2-3 hours ago, but isn't working now. Probably there has been some updates on the github repositories used in this notebook.

    Complete error log:

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-14-22614b7ef849> in <module>()
    ----> 1 from lib.colab_util import generate_video_from_obj, set_renderer, video
          2 
          3 renderer = set_renderer()
          4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer)
          5 
    
    4 frames
    /content/pifuhd/lib/colab_util.py in <module>()
         33 
         34 # Util function for loading meshes
    ---> 35 from pytorch3d.io import load_objs_as_meshes
         36 
         37 from IPython.display import HTML
    
    /usr/local/lib/python3.6/dist-packages/pytorch3d/io/__init__.py in <module>()
          2 
          3 
    ----> 4 from .obj_io import load_obj, load_objs_as_meshes, save_obj
          5 from .ply_io import load_ply, save_ply
          6 
    
    /usr/local/lib/python3.6/dist-packages/pytorch3d/io/obj_io.py in <module>()
         12 from pytorch3d.io.mtl_io import load_mtl, make_mesh_texture_atlas
         13 from pytorch3d.io.utils import _check_faces_indices, _make_tensor, _open_file
    ---> 14 from pytorch3d.renderer import TexturesAtlas, TexturesUV
         15 from pytorch3d.structures import Meshes, join_meshes_as_batch
         16
    
    /usr/local/lib/python3.6/dist-packages/pytorch3d/renderer/__init__.py in <module>()
          1 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
          2 
    ----> 3 from .blending import (
          4     BlendParams,
          5     hard_rgb_blend,
    
    /usr/local/lib/python3.6/dist-packages/pytorch3d/renderer/blending.py in <module>()
          7 
          8 # pyre-fixme[21]: Could not find name `_C` in `pytorch3d`.
    ----> 9 from pytorch3d import _C
         10 
         11 
    
    ImportError: /usr/local/lib/python3.6/dist-packages/pytorch3d/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c104impl23ExcludeDispatchKeyGuardC1ENS_11DispatchKeyE
    
    ---------------------------------------------------------------------------
    NOTE: If your import is failing due to a missing package, you can
    manually install dependencies using either !pip or !apt.
    
    To view examples of installing some common dependencies, click the
    "Open Examples" button below.
    --------------------------------------------------------------------------- 
    
    opened by abhijeetmanhas 18
  • ImportError: cannot import name 'Textures'

    ImportError: cannot import name 'Textures'

    ImportError Traceback (most recent call last) in () ----> 1 from lib.colab_util import generate_video_from_obj, set_renderer, video 2 3 renderer = set_renderer() 4 generate_video_from_obj(obj_path, out_img_path, video_path, renderer) 5

    /content/pifuhd/lib/colab_util.py in () 39 40 # Data structures and functions for rendering ---> 41 from pytorch3d.structures import Meshes, Textures 42 from pytorch3d.renderer import ( 43 look_at_view_transform,

    ImportError: cannot import name 'Textures'

    from the google colab could be due to pytorch3d version?

    opened by ak9250 16
  • openpose on windows

    openpose on windows

    Which file from the openpose binaries should I use on Windows10? The file (./build/examples/openpose/openpose.bin) given in batch_openpose.py does not exist on the Windows 10 binaries with the openpose version 1.6.0

    Btw:. In the documentation the command (python apps/process_openpose.py .....) is wrong. It has to be (python apps/batch_openpose.py .....) i guess.

    opened by Maxinger15 6
  • color mesh is weird

    color mesh is weird

    Thank you for your great work

    but i have a trouble with getting color mesh

    I changed from get_mesh to get_mesh_img on recon.py and executed. The result is the same on the front and back as in the picture below. Is there any additional part that I need to set up?

    Thank you

    Untitled Untitled (1)

    opened by name8997 6
  • Issues about the inputs of HGPIFuMRNet

    Issues about the inputs of HGPIFuMRNet

    When I read the code of HGPIFuMRNet.py, I'm not clear about the meaning of images_local([B1, B2, C, H, W]) and images_global([B1, C, H, W]). What is the difference between images_local and images_global and what does B1, B2 mean? And for points_nml and labels_nml, are they from .obj file or calculated? @shunsukesaito Thank you!

    opened by troylujc 5
  • Google Colab notebook does not work with an error.

    Google Colab notebook does not work with an error.

    Google Colab notebook does not work with an error. When I try to move the second Render the result block, I get the following error:

    ImportError: /usr/local/lib/python3.6/dist-packages/pytorch3d/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c104impl23ExcludeDispatchKeyGuardC1ENS_11DispatchKeyE

    opened by cedro3 4
  • anyone have problems  in 6G GPU ?

    anyone have problems in 6G GPU ?

    env: pytorch1.7.0、 cuda 11.0、RTX2060 、win10system.

    get this Error: RuntimeError: CUDA out of memory. Tried to allocate 256.00 MiB (GPU 0; 6.00 GiB total capacity; 3.87 GiB already allocated; 187.62 MiB free; 4.01 GiB reserved in total by PyTorch)

    is there any method to solve this problem?

    opened by wingdi 4
  • recurrent training code

    recurrent training code

    i have a question about HGPIFuNetwNML.py code,why the def get_error has a parameter named gamma,the have bug when i run the code,because the loss only need pred and label that two input,and the loss function is defined to MSE ,i see the paper about the loss function is BCE

    opened by Henry831 4
  • cuda out of memory when training with 24G  gpu memory

    cuda out of memory when training with 24G gpu memory

    The number of network parameters of PIFuHD is 387 million,which is 25 times that of PIFu. Can you share with us the hardware requirements of your GPU when training pifuhd? Such as GPU memory, type and number of gpus.The GPU memory I used for training was 24g,batch_size=1, but still cuda out of memory

    opened by SFM2020 4
  • NotImplementedError: Input Error: Only 3D, 4D and 5D input Tensors supported (got 3D) for the modes: nearest | linear | bilinear | bicubic | trilinear (got bicubic)

    NotImplementedError: Input Error: Only 3D, 4D and 5D input Tensors supported (got 3D) for the modes: nearest | linear | bilinear | bicubic | trilinear (got bicubic)

    Hi @shunsukesaito

    I could run the code on colab on my test data and worked fine. I am trying to run it on gpu machine getting this following error.

    Traceback (most recent call last): File "/home/hamid_farhid/anaconda3/envs/PIFuHD/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/hamid_farhid/anaconda3/envs/PIFuHD/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/hamid_farhid/PIFuHD/pifuhd/apps/simple_test.py", line 30, in reconWrapper(cmd, args.use_rect) File "/home/hamid_farhid/PIFuHD/pifuhd/apps/recon.py", line 220, in reconWrapper recon(opt, use_rect) File "/home/hamid_farhid/PIFuHD/pifuhd/apps/recon.py", line 210, in recon gen_mesh(opt.resolution, netMR, cuda, test_data, save_path, components=opt.use_compose) File "/home/hamid_farhid/PIFuHD/pifuhd/apps/recon.py", line 38, in gen_mesh net.filter_global(image_tensor_global) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGPIFuMRNet.py", line 83, in filter_global self.netG.filter(images) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGPIFuNetwNML.py", line 134, in filter self.im_feat_list, self.normx = self.image_filter(images) File "/home/hamid_farhid/anaconda3/envs/PIFuHD/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGFilters.py", line 195, in forward hg = self._modules'm' + str(i) File "/home/hamid_farhid/anaconda3/envs/PIFuHD/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGFilters.py", line 117, in forward return self._forward(self.depth, x) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGFilters.py", line 103, in _forward low2 = self._forward(level - 1, low1) File "/home/hamid_farhid/PIFuHD/pifuhd/lib/model/HGFilters.py", line 111, in _forward up2 = F.interpolate(low3, scale_factor=2, mode='bicubic', align_corners=True) File "/home/hamid_farhid/anaconda3/envs/PIFuHD/lib/python3.7/site-packages/torch/nn/functional.py", line 2459, in interpolate " (got {})".format(input.dim(), mode)) NotImplementedError: Input Error: Only 3D, 4D and 5D input Tensors supported (got 4D) for the modes: nearest | linear | bilinear | trilinear (got bicubic) freeglut (foo): failed to open display ''

    By referencing this: Error, we should do some changes on input tensor. Any thought on this one?

    opened by hfarhidzadeh 4
  • Empty results file

    Empty results file

    I have followed all the steps from this video: https://www.youtube.com/watch?v=QANxO69y6r4 But after having the pifuhd file appear and the lightweight-human-pose estimation file appear, the results file was empty and just had the recon file. I had no errors when running, but this somehow happened. Any help would be appreciated.

    opened by RocketbunnyDev 0
  • Quick test process is killed before mech generation

    Quick test process is killed before mech generation

    I installed all the libraries successfully but I got this unexpected kill process without generating the 3d mesh

    Error: generate mesh (test) ... 0%| | 0/1 [00:00<?, ?it/s]./results/pifuhd_final/recon/result_test_512.obj Killed []

    opened by aabdel-kader 0
  • I think this is abbandoned

    I think this is abbandoned

    I tried to make the code work all the ways I could and it simply did not load I got the stat dict error several times, I think it doesn't work anymore

    opened by leonnn1 0
  • Broken 3D Model

    Broken 3D Model

    Hi All,

    Hope you are doing well.

    I am newbie, so please bear with me. Also, let me know what further information is required so that you can help me with solutions.

    Please refer to the attached png, can anyone tell me why the render is broken?

    Many thanks in advance.

    Regards

    Broken render

    opened by ShubhamRD30 2
Owner
Meta Research
Meta Research
Boosting Monocular Depth Estimation Models to High-Resolution via Content-Adaptive Multi-Resolution Merging

Boosting Monocular Depth Estimation Models to High-Resolution via Content-Adaptive Multi-Resolution Merging This repository contains an implementation

Computational Photography Lab @ SFU 1.1k Jan 2, 2023
The project is an official implementation of our CVPR2019 paper "Deep High-Resolution Representation Learning for Human Pose Estimation"

Deep High-Resolution Representation Learning for Human Pose Estimation (CVPR 2019) News [2020/07/05] A very nice blog from Towards Data Science introd

Leo Xiao 3.9k Jan 5, 2023
Deep High-Resolution Representation Learning for Human Pose Estimation

Deep High-Resolution Representation Learning for Human Pose Estimation (accepted to CVPR2019) News If you are interested in internship or research pos

HRNet 167 Dec 27, 2022
AOT-GAN for High-Resolution Image Inpainting (codebase for image inpainting)

AOT-GAN for High-Resolution Image Inpainting Arxiv Paper | AOT-GAN: Aggregated Contextual Transformations for High-Resolution Image Inpainting Yanhong

Multimedia Research 214 Jan 3, 2023
Official repository for "Restormer: Efficient Transformer for High-Resolution Image Restoration". SOTA for motion deblurring, image deraining, denoising (Gaussian/real data), and defocus deblurring.

Restormer: Efficient Transformer for High-Resolution Image Restoration Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan,

Syed Waqas Zamir 906 Dec 30, 2022
A fast poisson image editing implementation that can utilize multi-core CPU or GPU to handle a high-resolution image input.

Poisson Image Editing - A Parallel Implementation Jiayi Weng (jiayiwen), Zixu Chen (zixuc) Poisson Image Editing is a technique that can fuse two imag

Jiayi Weng 110 Dec 27, 2022
PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network"

HAN PyTorch code for our ECCV 2020 paper "Single Image Super-Resolution via a Holistic Attention Network" This repository is for HAN introduced in the

五维空间 140 Nov 23, 2022
Practical Single-Image Super-Resolution Using Look-Up Table

Practical Single-Image Super-Resolution Using Look-Up Table [Paper] Dependency Python 3.6 PyTorch glob numpy pillow tqdm tensorboardx 1. Training deep

Younghyun Jo 116 Dec 23, 2022
PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

About PyTorch 1.2.0 Now the master branch supports PyTorch 1.2.0 by default. Due to the serious version problem (especially torch.utils.data.dataloade

Sanghyun Son 2.1k Jan 1, 2023
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 436 Jan 9, 2023
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"

NTIRE2017 Super-resolution Challenge: SNU_CVLab Introduction This is our project repository for CVPR 2017 Workshop (2nd NTIRE). We, Team SNU_CVLab, (B

Bee Lim 625 Dec 30, 2022
PyTorch code for 'Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning'

Efficient Single Image Super-Resolution Using Dual Path Connections with Multiple Scale Learning This repository is for EMSRDPN introduced in the foll

null 7 Feb 10, 2022
Augmentation for Single-Image-Super-Resolution

SRAugmentation Augmentation for Single-Image-Super-Resolution Implimentation CutBlur Cutout CutMix Cutup CutMixup Blend RGBPermutation Identity OneOf

Yubo 6 Jun 27, 2022
Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN

Single Image Super-Resolution (SISR) with SRResNet, EDSR and SRGAN Introduction Image super-resolution (SR) is the process of recovering high-resoluti

null 8 Apr 15, 2022
Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two

512x512 flowers after 12 hours of training, 1 gpu 256x256 flowers after 12 hours of training, 1 gpu Pizza 'Lightweight' GAN Implementation of 'lightwe

Phil Wang 1.5k Jan 2, 2023
Multi-Scale Vision Longformer: A New Vision Transformer for High-Resolution Image Encoding

Vision Longformer This project provides the source code for the vision longformer paper. Multi-Scale Vision Longformer: A New Vision Transformer for H

Microsoft 209 Dec 30, 2022
Official implement of Paper:A deeply supervised image fusion network for change detection in high resolution bi-temporal remote sening images

A deeply supervised image fusion network for change detection in high resolution bi-temporal remote sensing images 深度监督影像融合网络DSIFN用于高分辨率双时相遥感影像变化检测 Of

Chenxiao Zhang 135 Dec 19, 2022
Unofficial pytorch implementation of the paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution"

DFSA Unofficial pytorch implementation of the ICCV 2021 paper "Dynamic High-Pass Filtering and Multi-Spectral Attention for Image Super-Resolution" (p

null 2 Nov 15, 2021
High-Resolution Image Synthesis with Latent Diffusion Models

Latent Diffusion Models Requirements A suitable conda environment named ldm can be created and activated with: conda env create -f environment.yaml co

CompVis Heidelberg 5.6k Jan 4, 2023