Skip to content

Commit fec388d

Browse files
committed
first commit
0 parents  commit fec388d

File tree

137 files changed

+16340
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+16340
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.pyc
2+
*.pth
3+
.vs/
4+
__pycache__/
5+
data
6+
results
7+
out

LICENSE.txt

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
NVIDIA License
2+
3+
1. Definitions
4+
5+
“Licensor” means any person or entity that distributes its Work.
6+
“Work” means (a) the original work of authorship made available under this license, which may include software, documentation, or other files, and (b) any additions to or derivative works thereof that are made available under this license.
7+
The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the meaning as provided under U.S. copyright law; provided, however, that for the purposes of this license, derivative works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work.
8+
Works are “made available” under this license by including in or with the Work either (a) a copyright notice referencing the applicability of this license to the Work, or (b) a copy of this license.
9+
10+
2. License Grant
11+
12+
2.1 Copyright Grant. Subject to the terms and conditions of this license, each Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free, copyright license to use, reproduce, prepare derivative works of, publicly display, publicly perform, sublicense and distribute its Work and any resulting derivative works in any form.
13+
14+
3. Limitations
15+
16+
3.1 Redistribution. You may reproduce or distribute the Work only if (a) you do so under this license, (b) you include a complete copy of this license with your distribution, and (c) you retain without modification any copyright, patent, trademark, or attribution notices that are present in the Work.
17+
18+
3.2 Derivative Works. You may specify that additional or different terms apply to the use, reproduction, and distribution of your derivative works of the Work (“Your Terms”) only if (a) Your Terms provide that the use limitation in Section 3.3 applies to your derivative works, and (b) you identify the specific derivative works that are subject to Your Terms. Notwithstanding Your Terms, this license (including the redistribution requirements in Section 3.1) will continue to apply to the Work itself.
19+
20+
3.3 Use Limitation. The Work and any derivative works thereof only may be used or intended for use non-commercially. Notwithstanding the foregoing, NVIDIA Corporation and its affiliates may use the Work and any derivative works commercially. As used herein, “non-commercially” means for research or evaluation purposes only.
21+
22+
3.4 Patent Claims. If you bring or threaten to bring a patent claim against any Licensor (including any claim, cross-claim or counterclaim in a lawsuit) to enforce any patents that you allege are infringed by any Work, then your rights under this license from such Licensor (including the grant in Section 2.1) will terminate immediately.
23+
24+
3.5 Trademarks. This license does not grant any rights to use any Licensor’s or its affiliates’ names, logos, or trademarks, except as necessary to reproduce the notices described in this license.
25+
26+
3.6 Termination. If you violate any term of this license, then your rights under this license (including the grant in Section 2.1) will terminate immediately.
27+
28+
4. Disclaimer of Warranty.
29+
30+
THE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
31+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE.
32+
33+
5. Limitation of Liability.
34+
35+
EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

README.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Learning Physically Simulated Tennis Skills from Broadcast Videos
2+
3+
<strong>Haotian zhang</strong>, Ye Yuan, Viktor Makoviychuk, Yunrong Guo, Sanja Fidler, Xue Bin Peng, Kayvon Fatahalian
4+
5+
SIGGRAPH 2023 (best paper honorable mention)
6+
7+
[Paper](https://research.nvidia.com/labs/toronto-ai/vid2player3d/data/tennis_skills_main.pdf) |
8+
[Project](https://research.nvidia.com/labs/toronto-ai/vid2player3d/) |
9+
[Video](https://youtu.be/ZZVKrNs7_mk)
10+
11+
<img src="doc/teaser.png"/>
12+
13+
# The current release provides the implementation of the controller, including the low-level imitation policy, motion embedding and the high-level planning policy, as well as the environment setup in IsaacGym. Unfortunately, the demo can NOT run because the trained models are currently not available due to legal issues.
14+
15+
# Environment setup
16+
17+
### 1. Download IsaacGym and create python virtual env
18+
You can download IsaacGym Preview Release 4 from the official [site](https://developer.nvidia.com/isaac-gym).
19+
Then download Miniconda3 from [here](https://repo.anaconda.com/miniconda/Miniconda3-py37_23.1.0-1-Linux-x86_64.sh).
20+
Create a conda virtual env named `rlgpu` by running `create_conda_env_rlgpu.sh` from IsaacGym, either python3.7 or python3.8 works.
21+
Note you might need to run the following command or add it to your `.bashrc` if you encounter the error `ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory` when running IsaacGym.
22+
```
23+
export LD_LIBRARY_PATH=<YOUR CONDA PATH>envs/rlgpu/lib/
24+
```
25+
26+
### 2. Install dependencies
27+
Enter the created virtual env and run the install script.
28+
```
29+
conda activate rlgpu
30+
bash install.sh
31+
```
32+
33+
### 3. Install [smpl_visualizer](https://github.com/Haotianz94/smpl_visualizer) for visualizing results
34+
Git clone and then run
35+
```
36+
bash install.sh
37+
```
38+
39+
### 4. Download data/checkpoints
40+
41+
Download [data](https://drive.google.com/drive/folders/1kkM9tl1T3dXZbvh5oYHSerL0JkgaL1Mi?usp=sharing) into `vid2player3d/data`.
42+
43+
Download checkpoints of motion VAE and trained polices into `vid2player3d/results` (currently unavailable).
44+
45+
Download SMPL [models](https://download.is.tue.mpg.de/download.php?domain=smpl&sfile=SMPL_python_v.1.0.0.zip) (male and female models) into `smpl_visualizer/data/smpl` after registering and rename the files as `SMPL_MALE.pkl` and `SMPL_FEMALE.pkl`.
46+
47+
# Test with trained policies
48+
### Single player
49+
In the single player setting, the player will react to consecutive incoming tennis balls from the other side.
50+
The script below runs the simulation and renders the result online. The simulation will be reset after 300 frames. You can change the player by chaning`--cfg` to `djokovic` or `nadal`.
51+
```
52+
python vid2player/run.py --cfg federer --rl_device cuda:0 --test --num_envs 1 --episode_length 300 --seed 0 --checkpoint latest --enable_shadow
53+
```
54+
55+
The script below will run the simulations in batch and render the result videos offline and saved into `out/video`. You can also change `--record` to `--record_scenepic`, which will save the result into an interactive html file under `out/html`. Note that the saved html file is large and may take seconds to load.
56+
```
57+
python vid2player/run.py --cfg federer --rl_device cuda:0 --test --num_envs 8192 --episode_length 300 --seed 0 --checkpoint latest --select_best --enable_shadow --num_rec_frames 300 --num_eg 5 --record --headless
58+
```
59+
60+
### Dual player
61+
In the dual player setting, the two players will play tennis rally against each other.
62+
The script below runs the simulation and renders the result online. The simulation will be reset if the ball is missed or out. You can change the players by changing `--cfg` to `nadal_djokovic`. More player settings will be added soon.
63+
```
64+
python vid2player/run.py --cfg federer_djokovic --rl_device cuda:0 --test --num_envs 2 --episode_length 10000 --seed 0 --checkpoint latest --enable_shadow
65+
```
66+
67+
The script below will run the simulations in batch and render the result videos offline and saved into `out/video`.
68+
```
69+
python vid2player/run.py --cfg federer_djokovic --rl_device cuda:0 --test --num_envs 8192 --episode_length 10000 --seed 0 --checkpoint latest --enable_shadow --headless --num_rec_frames 600 --num_eg 5 --record
70+
```
71+
72+
73+
# Retrain the high-level policy
74+
We also provide code for training the high-level policy using Federer's motion VAE. As described in the paper, we design a curriculum trained in three stages. You can run the following script to execute the curriculum training.
75+
The script assumes a GPU with memory >= 24GB and it takes about 2 days to finish on a single A5000.
76+
```
77+
python vid2player/run.py --cfg federer_train_stage_1 --rl_device cuda:0 --headless
78+
python vid2player/run.py --cfg federer_train_stage_2 --rl_device cuda:0 --headless
79+
python vid2player/run.py --cfg federer_train_stage_3 --rl_device cuda:0 --headless
80+
```
81+
82+
83+
# Citation
84+
```
85+
@article{
86+
zhang2023vid2player3d,
87+
author = {Zhang, Haotian and Yuan, Ye and Makoviychuk, Viktor and Guo, Yunrong and Fidler, Sanja and Peng, Xue Bin and Fatahalian, Kayvon},
88+
title = {Learning Physically Simulated Tennis Skills from Broadcast Videos},
89+
journal = {ACM Trans. Graph.},
90+
issue_date = {August 2023},
91+
numpages = {14},
92+
doi = {10.1145/3592408},
93+
publisher = {ACM},
94+
address = {New York, NY, USA},
95+
keywords = {physics-based character animation, imitation learning, reinforcement learning},
96+
}
97+
```
98+
99+
# Contact
100+
For any question regarding this project, please contact Haotian Zhang via [email protected].

doc/teaser.png

1.17 MB
Loading

install.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Addtional python libs
2+
python -m pip install rl-games==1.1.4 pyvista==0.34.2 pyglet==1.5.27 tqdm
3+
4+
# The default install may install `vtk>=9.2.0` which will lead to program crash when running pyvista.
5+
# A temporary fix is to install vtk in an older version
6+
python -m pip install --ignore-installed vtk==9.1.0
7+
8+
# Downgrade numpy
9+
conda install numpy=1.23.5 --force -c conda-forge

0 commit comments

Comments
 (0)