Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

Overview

SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes

Paper | Supp | Video | Project Page | Blog (AITAVG)

Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes. We propose a novel forward skinning module to animate neural implicit shapes with good generalization to unseen poses.

If you find our code or paper useful, please cite as

@inproceedings{chen2021snarf,
  title={SNARF: Differentiable Forward Skinning for Animating Non-Rigid Neural Implicit Shapes},
  author={Chen, Xu and Zheng, Yufeng and Black, Michael J and Hilliges, Otmar and Geiger, Andreas},
  booktitle={International Conference on Computer Vision (ICCV)},
  year={2021}
}

Quick Start

Clone this repo:

git clone https://github.com/xuchen-ethz/snarf.git
cd snarf

Install environment:

conda env create -f environment.yml
conda activate snarf
python setup.py install

Download SMPL models (1.0.0 for Python 2.7 (10 shape PCs)) and move them to the corresponding places:

mkdir lib/smpl/smpl_model/
mv /path/to/smpl/models/basicModel_f_lbs_10_207_0_v1.0.0.pkl lib/smpl/smpl_model/SMPL_FEMALE.pkl
mv /path/to/smpl/models/basicmodel_m_lbs_10_207_0_v1.0.0.pkl lib/smpl/smpl_model/SMPL_MALE.pkl

Download our pretrained models and test motion sequences:

sh ./download_data.sh

Run a quick demo for clothed human:

python demo.py expname=cape subject=3375 demo.motion_path=data/aist_demo/seqs +experiments=cape

You can the find the video in outputs/cape/3375/demo.mp4 and images in outputs/cape/3375/images/. To save the meshes, add demo.save_mesh=true to the command.

You can also try other subjects (see outputs/data/cape for available options) by setting subject=xx, and other motion sequences from AMASS by setting demo.motion_path=/path/to/amass_modetion.npz.

Some motion sequences have high fps and one might want to skip some frames. To do this, add demo.every_n_frames=x to consider every x frame in the motion sequence. (e.g. demo.every_n_frames=10 for PosePrior sequences)

By default, we use demo.fast_mode=true for fast mesh extraction. In this mode, we first extract mesh in canonical space, and then forward skin the mesh to posed space. This bypasses the root finding during inference, thus is faster. However, it's not really deforming a continuous field. To first deform the continuous field and then extract mesh in deformed space, use demo.fast_mode=false instead.

Training and Evaluation

Install Additional Dependencies

Install kaolin for fast occupancy query from meshes.

git clone https://github.com/NVIDIAGameWorks/kaolin
cd kaolin
git checkout v0.9.0
python setup.py develop

Minimally Clothed Human

Prepare Datasets

Download the AMASS dataset. We use ''DFaust Snythetic'' and ''PosePrior'' subsets and SMPL-H format. Unzip the dataset into data folder.

tar -xf DFaust67.tar.bz2 -C data
tar -xf MPILimits.tar.bz2 -C data

Preprocess dataset:

python preprocess/sample_points.py --output_folder data/DFaust_processed
python preprocess/sample_points.py --output_folder data/MPI_processed --skip 10 --poseprior

Training

Run the following command to train for a specified subject:

python train.py subject=50002

Training logs are available on wandb (registration needed, free of charge). It should take ~12h on a single 2080Ti.

Evaluation

Run the following command to evaluate the method for a specified subject on within distribution data (DFaust test split):

python test.py subject=50002

and outside destribution (PosePrior):

python test.py subject=50002 datamodule=jointlim

Generate Animation

You can use the trained model to generate animation (same as in Quick Start):

python demo.py expname='dfaust' subject=50002 demo.motion_path='data/aist_demo/seqs'

Clothed Human

Training

Download the CAPE dataset and unzip into data folder.

Run the following command to train for a specified subject and clothing type:

python train.py datamodule=cape subject=3375 datamodule.clothing='blazerlong' +experiments=cape  

Training logs are available on wandb. It should take ~24h on a single 2080Ti.

Generate Animation

You can use the trained model to generate animation (same as in Quick Start):

python demo.py expname=cape subject=3375 demo.motion_path=data/aist_demo/seqs +experiments=cape

Acknowledgement

We use the pre-processing code in PTF and LEAP with some adaptions (./preprocess). The network and sampling part of the code (lib/model/network.py and lib/model/sample.py) is implemented based on IGR and IDR. The code for extracting mesh (lib/utils/meshing.py) is adapted from NASA. Our implementation of Broyden's method (lib/model/broyden.py) is based on DEQ. We sincerely thank these authors for their awesome work.

Comments
  • mise import error

    mise import error

    Hello, I am trying to compile the project but I am running into an error for the meshing.py runtime compilation: ImportError: cannot import name 'mise' from 'lib.libmise' (unknown location) This might be a cython error but I have it installed and also the mise.pyx is in the libmise folder. Pls let me know if this is an isolated issue or if its reproducible. regards SK

    opened by skore11 7
  • the results of AMASS are very different trained on torch1.6 and torch1.7

    the results of AMASS are very different trained on torch1.6 and torch1.7

    I am very confused about the AMASS results on subject 50002 trained on different versions of pytorch.

    According to your environments, it suggests to install pytorch==1.7.0. However the results trained on pytorch1.7 is less than the results I train on pytorch==1.6.0 significantly. I am very confused about it.

    the training loss, and evaluation IoU is shown as(blue is trained on torch==1.6.0, and red is trained on 1.7.0): Screenshot from 2022-01-08 14-15-30

    Screenshot from 2022-01-08 14-15-11

    Looking forward to your reply.

    opened by lingtengqiu 4
  • How to generate the 2D stick dataset?

    How to generate the 2D stick dataset?

    Hi, thanks for releasing the code!

    I just have a simple question -- how did you guys generate data for the 2D stick toy experiment [Figure 4]? Could you share a piece of code/pointer for doing this?

    Appreciate your help!

    image

    opened by yashkant 3
  • hydra error when running the train.py code

    hydra error when running the train.py code

    Hi, first of all , thanks for your team's great work.

    I am having trouble running CAPE training code provided by readme.md

      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 180, in instantiate
        return instantiate_node(config, *args, recursive=_recursive_, convert=_convert_)
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 266, in instantiate_node
        cfg[key] = instantiate_node(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 245, in instantiate_node
        value = instantiate_node(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 249, in instantiate_node
        return _call_target(_target_, *args, **kwargs)
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 64, in _call_target
        raise type(e)(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 62, in _call_target
        return _target_(*args, **kwargs)
    TypeError: Error instantiating 'lib.dataset.cape.CAPEDataProcessor' : __init__() missing 2 required positional arguments: 'opt' and 'meta_info'
    

    and this msg is produced when I run

     python train.py datamodule=cape subject=3375 +datamodule.clothing='blazerlong' +experiments=cape  
    

    I put + right before datamodule.clothing argument on purpose, which is different from the guide on readme.md; otherwise, it gave different error like:

    omegaconf.errors.ConfigAttributeError: Key 'clothing' is not in struct
        full_key: datamodule.clothing
        object_type=dict
    

    I think datamodule = hydra.utils.instantiate(opt.datamodule, opt.datamodule) in train.py part gave this error.

    If I train on AMASS it also produces similar error

    python train.py subject=50002
    

    then

    
    Traceback (most recent call last):
      File "D:\python_proj\snarf\train.py", line 64, in <module>
        main()
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\main.py", line 48, in decorated_main
        _run_hydra(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\utils.py", line 377, in _run_hydra
        run_and_report(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\utils.py", line 214, in run_and_report
        raise ex
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\utils.py", line 211, in run_and_report
        return func()
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\utils.py", line 378, in <lambda>
        lambda: hydra.run(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\hydra.py", line 111, in run
        _ = ret.return_value
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\core\utils.py", line 233, in return_value
        raise self._return_value
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\core\utils.py", line 160, in run_job
        ret.return_value = task_function(task_cfg)
      File "D:\python_proj\snarf\train.py", line 22, in main
        datamodule = hydra.utils.instantiate(opt.datamodule, opt.datamodule) #problem starts here.
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 180, in instantiate
        return instantiate_node(config, *args, recursive=_recursive_, convert=_convert_)
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 266, in instantiate_node
        cfg[key] = instantiate_node(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 249, in instantiate_node
        return _call_target(_target_, *args, **kwargs)
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 64, in _call_target
        raise type(e)(
      File "C:\Users\mms312\anaconda3\envs\snarf_env\lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 62, in _call_target
        return _target_(*args, **kwargs)
    TypeError: Error instantiating 'lib.dataset.dfaust.DFaustDataModule' : __init__() missing 1 required positional argument: 'opt'
    

    Any thought or idea on this? Thanks,

    opened by plentyluckman 3
  • Question

    Question

    Hi, first of all, thank you for sharing this amazing work! I had a question with regards to how you derived equation(13), and (14) on your paper. (Part about implicit differentiation when calculating the gradients).

    Please correct me if I'm wrong, but I think the sign of the second term in (13) should be negative.

    Could you explain in details how you derived (13) from (12)?

    Thank you.

    opened by songwoh 2
  • Training for CAPE dataset

    Training for CAPE dataset

    Hi I would like to train CAPE dataset by myself. By following the guidance, I put CAPE dataset under the data directory as shown below.

    data/CAPE/03375 data/CAPE/cape_release

    And I run the command for training.

    python train.py datamodule=cape subject=3375 datamodule.clothing='blazerlong' +experiments=cape

    Then the error was shown below.

    ValueError: Dataloader returned 0 length. Please make sure that it returns at least 1 batch

    Do you have any idea to solve it? Thanks

    opened by iwanao731 2
  • question

    question

    在执行 sh ./download_data.sh 出现如下问题: : not foundta.sh: 2: download_data.sh: Downloading motion sequences... : not foundta.sh: 4: download_data.sh: --2021-11-03 01:26:23-- https://scanimate.is.tue.mpg.de/media/upload/demo_data/aist_demo_seq.zip%0D Resolving scanimate.is.tue.mpg.de (scanimate.is.tue.mpg.de)... 192.124.27.142 Connecting to scanimate.is.tue.mpg.de (scanimate.is.tue.mpg.de)|192.124.27.142|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2021-11-03 01:26:24 ERROR 404: Not Found.

    unzip: cannot find or open aist_demo_seq.zip, aist_demo_seq.zip.zip or aist_demo_seq.zip.ZIP. rm: cannot remove 'aist_demo_seq.zip'$'\r': No such file or directory mv: cannot stat './data/gLO_sBM_cAll_d14_mLO1_ch05': No such file or directory : not foundta.sh: 9: download_data.sh: Done! : not foundta.sh: 11: download_data.sh: : not foundta.sh: 12: download_data.sh: mkdir: cannot create directory ‘outputs\r’: File exists : not foundta.sh: 14: download_data.sh: Downloading pretrained models ... --2021-11-03 01:26:24-- https://dataset.ait.ethz.ch/downloads/fOUiBuCXJy/pretrained_models.zip%0D Resolving dataset.ait.ethz.ch (dataset.ait.ethz.ch)... 129.132.114.75 Connecting to dataset.ait.ethz.ch (dataset.ait.ethz.ch)|129.132.114.75|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2021-11-03 01:26:25 ERROR 404: Not Found.

    unzip: cannot find or open pretrained_models.zip, pretrained_models.zip.zip or pretrained_models.zip.ZIP. mv: cannot stat 'outputs/pretrained_models/*': No such file or directory 'm: invalid option -- ' Try 'rm --help' for more information. rm: cannot remove 'pretrained_models.zip'$'\r': No such file or directory

    opened by HDYYZDN 1
  • A tiny bug in the broyden function.

    A tiny bug in the broyden function.

    Great work and thanks for releasing the code!

    I'm going through the code and it seems like there is a tiny bug that exists in the broyden function. It may or may not affect the results but I feel it's good to report it:

    https://github.com/xuchen-ethz/snarf/blob/69b50ce796087c13d0094dd3b6d435ccaa678698/lib/model/broyden.py#L36

    The code here should be x_opt = x.clone(). Otherwise the following code x[ids_val] += delta_x[ids_val] will also modify the values in the x_opt.

    opened by liruilong940607 1
Official implementation of NPMs: Neural Parametric Models for 3D Deformable Shapes - ICCV 2021

NPMs: Neural Parametric Models Project Page | Paper | ArXiv | Video NPMs: Neural Parametric Models for 3D Deformable Shapes Pablo Palafox, Aljaz Bozic

PabloPalafox 109 Nov 22, 2022
Open source repository for the code accompanying the paper 'Non-Rigid Neural Radiance Fields Reconstruction and Novel View Synthesis of a Deforming Scene from Monocular Video'.

Non-Rigid Neural Radiance Fields This is the official repository for the project "Non-Rigid Neural Radiance Fields: Reconstruction and Novel View Synt

Facebook Research 296 Dec 29, 2022
Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators..

ARAPReg Code for ICCV 2021 paper: ARAPReg: An As-Rigid-As Possible Regularization Loss for Learning Deformable Shape Generators.. Installation The cod

Bo Sun 132 Nov 28, 2022
Homepage of paper: Paint Transformer: Feed Forward Neural Painting with Stroke Prediction, ICCV 2021.

Paint Transformer: Feed Forward Neural Painting with Stroke Prediction [Paper] [PaddlePaddle Implementation] Homepage of paper: Paint Transformer: Fee

null 442 Dec 16, 2022
Differentiable Neural Computers, Sparse Access Memory and Sparse Differentiable Neural Computers, for Pytorch

Differentiable Neural Computers and family, for Pytorch Includes: Differentiable Neural Computers (DNC) Sparse Access Memory (SAM) Sparse Differentiab

ixaxaar 302 Dec 14, 2022
This is the official source code for SLATE. We provide the code for the model, the training code, and a dataset loader for the 3D Shapes dataset. This code is implemented in Pytorch.

SLATE This is the official source code for SLATE. We provide the code for the model, the training code and a dataset loader for the 3D Shapes dataset.

Gautam Singh 66 Dec 26, 2022
Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators

Brax is a differentiable physics engine that simulates environments made up of rigid bodies, joints, and actuators. It's also a suite of learning algorithms to train agents to operate in these environments (PPO, SAC, evolutionary strategy, and direct trajectory optimization are implemented).

Google 1.5k Jan 2, 2023
An automated algorithm to extract the linear blend skinning (LBS) from a set of example poses

Dem Bones This repository contains an implementation of Smooth Skinning Decomposition with Rigid Bones, an automated algorithm to extract the Linear B

Electronic Arts 684 Dec 26, 2022
This repository contains the accompanying code for Deep Virtual Markers for Articulated 3D Shapes, ICCV'21

Deep Virtual Markers This repository contains the accompanying code for Deep Virtual Markers for Articulated 3D Shapes, ICCV'21 Getting Started Get sa

KimHyomin 45 Oct 7, 2022
This repository contains the code for the CVPR 2020 paper "Differentiable Volumetric Rendering: Learning Implicit 3D Representations without 3D Supervision"

Differentiable Volumetric Rendering Paper | Supplementary | Spotlight Video | Blog Entry | Presentation | Interactive Slides | Project Page This repos

null 697 Jan 6, 2023
GPU Accelerated Non-rigid ICP for surface registration

GPU Accelerated Non-rigid ICP for surface registration Introduction Preivous Non-rigid ICP algorithm is usually implemented on CPU, and needs to solve

Haozhe Wu 144 Jan 4, 2023
A variational Bayesian method for similarity learning in non-rigid image registration (CVPR 2022)

A variational Bayesian method for similarity learning in non-rigid image registration We provide the source code and the trained models used in the re

daniel grzech 14 Nov 21, 2022
Official code release for "Learned Spatial Representations for Few-shot Talking-Head Synthesis" ICCV 2021

Official code release for "Learned Spatial Representations for Few-shot Talking-Head Synthesis" ICCV 2021

Moustafa Meshry 16 Oct 5, 2022
an implementation of softmax splatting for differentiable forward warping using PyTorch

softmax-splatting This is a reference implementation of the softmax splatting operator, which has been proposed in Softmax Splatting for Video Frame I

Simon Niklaus 338 Dec 28, 2022
Code release for ICCV 2021 paper "Anticipative Video Transformer"

Anticipative Video Transformer Ranked first in the Action Anticipation task of the CVPR 2021 EPIC-Kitchens Challenge! (entry: AVT-FB-UT) [project page

Facebook Research 123 Dec 13, 2022
The official implementation of the research paper "DAG Amendment for Inverse Control of Parametric Shapes"

DAG Amendment for Inverse Control of Parametric Shapes This repository is the official Blender implementation of the paper "DAG Amendment for Inverse

Elie Michel 157 Dec 26, 2022
Pytorch Implementation of Google's Parallel Tacotron 2: A Non-Autoregressive Neural TTS Model with Differentiable Duration Modeling

Parallel Tacotron2 Pytorch Implementation of Google's Parallel Tacotron 2: A Non-Autoregressive Neural TTS Model with Differentiable Duration Modeling

Keon Lee 170 Dec 27, 2022