Coder Social home page Coder Social logo

tink's Introduction

Logo

Tink

CVPR, 2022
Lixin Yang* · Kailin Li* · Xinyu Zhan* · Fei Wu · Anran Xu . Liu Liu · Cewu Lu
\star = equal contribution

Paper PDF ArXiv PDF Project Page Youtube Video

This repo contains the official implementation of Tink -- one of the core contributions in the CVPR2022 paper: OakInk.

Tink is a novel method that Transfers the hand's INteraction Knowledge among objects.

tink

Installation

  • First, clone this repo:

    git clone https://github.com/KailinLi/Tink.git
    cd Tink
    git submodule init && git submodule update
  • Second, to set up the environment, follow the instruction: stand-alone in OakInk to install the environment with conda.

  • Third, inside the OakInk directory, install the oikit as package:

    $ cd OakInk
    $ pip install .

Download

In this repo, we provide a mini dataset to demonstrate the pipeline of Tink.

  • Download the assets files.
  • Download mano following the official instructions. And put the mano_v1_2 under the assets directory.
  • Download the mini dataset from this link. And unzip them under the DeepSDF_OakInk directory.

Your directory should look like this:

Tink
├── assets
│   ├── anchor
│   ├── hand_palm_full.txt
│   └── mano_v1_2
├── DeepSDF_OakInk
│   ├── data
│   │   ├── meta
│   │   ├── OakInkObjects
│   │   ├── OakInkVirtualObjects
│   │   ├── raw_grasp
│   │   └── sdf
│   │       └── phone

DeepSDF

In this section, we demonstrate how to preprocess the object meshes and train a category-level DeepSDF.

If you are not interested in training DeepSDF, feel free to skip this section.

1. Compile the C++ code

Please follow the official instructions of DeepSDF.

You will get two executables in the DeepSDF_OakInk/bin directory. (We modified some of the original source code in DeepSDF, so please make sure to compile these scripts from the scratch.)

2. Preprocess the object meshes

export MESA_GL_VERSION_OVERRIDE=3.3
export PANGOLIN_WINDOW_URI=headless://

cd DeepSDF_OakInk
python preprocess_data.py --data_dir data/sdf/phone --threads 4

After finishing the script, you can find the SDF files in DeepSDF_OakInk/data/sdf/phone/SdfSamples directory.

3. Train the network

CUDA_VISIBLE_DEVICES=0 python train_deep_sdf.py -e data/sdf/phone

4. Dump the latent codes and reconstructed meshes

CUDA_VISIBLE_DEVICES=0 python reconstruct_train.py -e data/sdf/phone  --mesh_include

You can find the reconstructed meshes under the DeepSDF_OakInk/data/sdf/phone/Reconstructions/Meshes.

Shape Interpolation

If you skip the above section, we provide a pre-trained DeepSDF network. Please download the files, unzip them and replace the original phone directory:

sdf
├── phone
│   ├── network
│   │   ├── ModelParameters
│   │   │   └── latest.pth
│   │   └── LatentCodes
│   ├── Reconstructions
│   │   ├── Codes
│   │   │   ├── C52001.pth
│   │   │   ├── ...
│   │   └── Meshes
│   │       ├── C52001.ply
│   │       ├── ...
│   ├── rescale.pkl
│   ├── SdfSamples
│   │   ├── C52001.npz
│   │   ├── ...
│   ├── SdfSamples_resize
│   ├── specs.json
│   └── split.json

Now, go to the Tink directory, and run the following script to generate the interpolations:

cd ..

# you can generate all of the interpolations:
python tink/gen_interpolate.py --all -d ./DeepSDF_OakInk/data/sdf/phone

# or just interpolate between two objects (from C52001 to o52105):
python tink/gen_interpolate.py -d ./DeepSDF_OakInk/data/sdf/phone -s C52001 -t o52105

You can find the interpolations in DeepSDF_OakInk/data/sdf/phone/interpolate directory.

Calculate Contact Info

We calculate the contact region of C52001:

python tink/cal_contact_info.py \
	-d ./DeepSDF_OakInk/data/sdf/phone \
	-s C52001 \
	--tag demo \
	-p DeepSDF_OakInk/data/raw_grasp/demo/C52001_0001_0000/2021-10-09-15-13-39/dom.pkl \
	--vis

The contact_info.pkl is stored in DeepSDF_OakInk/data/sdf/phone/contact/C52001/demo_e54965ec08. e54965ec08 is the hash code of the hand parameters.

contact

Contact Mapping

We take the virtual object o52105 as an example.

To transfer the contact information from C52001 to o52105:

python tink/info_transform.py \
	-d ./DeepSDF_OakInk/data/sdf/phone \
	-s C52001 \
	-t o52105 \
	-p DeepSDF_OakInk/data/sdf/phone/contact/C52001/demo_e54965ec08

You can find the transfered contact info in DeepSDF_OakInk/data/sdf/phone/contact/C52001/demo_e54965ec08/o52105.

Pose Refinement

CUDA_VISIBLE_DEVICES=0 python tink/pose_refine.py \
	-d ./DeepSDF_OakInk/data/sdf/phone \
	-s C52001 \
	-t o52105 \
	-p DeepSDF_OakInk/data/sdf/phone/contact/C52001/demo_e54965ec08 \
	--vis

The fitted hand pose will be stored in DeepSDF_OakInk/data/sdf/phone/contact/C52001/demo_e54965ec08/o52105 directory. (When visualizing the hand pose, you might need to chick the 'x' on the window status bar to start fitting.)

refine

We also provide all the transferred hand poses of the mini dataset. You can download the files, unzip them and replace the original phone directory.

all_refine

tink's People

Contributors

kailinli avatar lixiny avatar

Stargazers

Mona Jalal avatar  avatar Dehao Huang avatar warm tan avatar Dimitrije Antic avatar Gentle Jan(Juntao Jian) avatar DDDDDDaisy avatar  avatar  avatar lixiny-nreal avatar Akira avatar Yunchong Gan avatar  avatar yang avatar  avatar Chujun Song avatar Haimin Luo avatar  avatar 爱可可-爱生活 avatar Julian Tanke avatar Dimitrios Tzionas avatar Supreeth Narasimhaswamy avatar Haoyu Zhen avatar kelvin34501 avatar Raphaël avatar Matt Shaffer avatar  avatar  avatar

Watchers

 avatar Matt Shaffer avatar

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.