-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
6,943 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 1,54 @@ | ||
# HyFluid | ||
Official code for Inferring Hybrid Neural Fluid Fields from Videos (NeurIPS 2023) | ||
# Inferring Hybrid Neural Fluid Fields from Videos | ||
This is the official code for Inferring Hybrid Neural Fluid Fields from Videos (NeurIPS 2023). | ||
|
||
![teaser](assets/demo_hyfluid.gif) | ||
|
||
**[[Paper](https://arxiv.org/pdf/2312.06561.pdf)] [[Project Page](https://kovenyu.com/hyfluid/)]** | ||
|
||
## Installation | ||
Install with conda: | ||
```bash | ||
conda env create -f environment.yml | ||
conda activate hyfluid | ||
``` | ||
or with pip: | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## Data | ||
The demo data is available at [data/ScalarReal](data/ScalarReal). | ||
The full ScalarFlow dataset can be downloaded [here](https://ge.in.tum.de/publications/2019-scalarflow-eckert/). | ||
|
||
## Quick Start | ||
To learn the hybrid neural fluid fields from the demo data, firstly reconstruct the density field by running (~40min): | ||
```bash | ||
bash scripts/train.sh | ||
``` | ||
Then, reconstruct the velocity field by jointly training with the density field (~15 hours on a single A6000 GPU.): | ||
```bash | ||
bash scripts/train_j.sh | ||
``` | ||
Finally, add vortex particles and optimize their physical parameters (~40min): | ||
```bash | ||
bash scripts/train_vort.sh | ||
``` | ||
The results will be saved in `./logs/exp_real`. With the learned hybrid neural fluid fields, you can re-simulate the fluid by using the velocity fields to advect density: | ||
```bash | ||
bash scripts/test_resim.sh | ||
``` | ||
Or, you can predict the future states by extrapolating the velocity fields: | ||
```bash | ||
bash scripts/test_future_pred.sh | ||
``` | ||
|
||
## Citation | ||
If you find this code useful for your research, please cite our paper: | ||
``` | ||
@article{yu2023inferring, | ||
title={Inferring Hybrid Neural Fluid Fields from Videos}, | ||
author={Yu, Hong-Xing and Zheng, Yang and Gao, Yuan and Deng, Yitong and Zhu, Bo and Wu, Jiajun}, | ||
journal={NeurIPS}, | ||
year={2023} | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,8 @@ | ||
expname = scalarflowreal | ||
basedir = ./logs | ||
datadir = ./data/ScalarReal | ||
|
||
N_samples = 192 | ||
N_rand = 1024 | ||
|
||
half_res = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,231 @@ | ||
{ | ||
"train_videos": [ | ||
{ | ||
"file_name": "train00.mp4", | ||
"frame_rate": 30, | ||
"frame_num": 120, | ||
"camera_angle_x": 0.40746459248665245, | ||
"camera_hw": [ | ||
1920, | ||
1080 | ||
], | ||
"transform_matrix": [ | ||
[ | ||
0.48627835512161255, | ||
-0.24310240149497986, | ||
-0.8393059968948364, | ||
-0.7697111964225769 | ||
], | ||
[ | ||
-0.01889985240995884, | ||
0.9573688507080078, | ||
-0.2882491946220398, | ||
0.013170702382922173 | ||
], | ||
[ | ||
0.8735995292663574, | ||
0.15603208541870117, | ||
0.4609531760215759, | ||
0.3249526023864746 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"file_name": "train01.mp4", | ||
"frame_rate": 30, | ||
"frame_num": 120, | ||
"camera_angle_x": 0.39413608028840563, | ||
"camera_hw": [ | ||
1920, | ||
1080 | ||
], | ||
"transform_matrix": [ | ||
[ | ||
0.8157652020454407, | ||
-0.1372431218624115, | ||
-0.5618642568588257, | ||
-0.39192497730255127 | ||
], | ||
[ | ||
-0.04113851860165596, | ||
0.9552109837532043, | ||
-0.2930521070957184, | ||
0.010452679358422756 | ||
], | ||
[ | ||
0.5769183039665222, | ||
0.262175977230072, | ||
0.7735819220542908, | ||
0.8086869120597839 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"file_name": "train03.mp4", | ||
"frame_rate": 30, | ||
"frame_num": 120, | ||
"camera_angle_x": 0.41320072172607875, | ||
"camera_hw": [ | ||
1920, | ||
1080 | ||
], | ||
"transform_matrix": [ | ||
[ | ||
0.8836436867713928, | ||
0.15215487778186798, | ||
0.44274458289146423, | ||
0.8974969983100891 | ||
], | ||
[ | ||
-0.021659603342413902, | ||
0.9579861760139465, | ||
-0.28599533438682556, | ||
0.02680988796055317 | ||
], | ||
[ | ||
-0.46765878796577454, | ||
0.24312829971313477, | ||
0.8498140573501587, | ||
0.8316138386726379 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
] | ||
}, | ||
{ | ||
"file_name": "train04.mp4", | ||
"frame_rate": 30, | ||
"frame_num": 120, | ||
"camera_angle_x": 0.40746459248665245, | ||
"camera_hw": [ | ||
1920, | ||
1080 | ||
], | ||
"transform_matrix": [ | ||
[ | ||
0.6336104273796082, | ||
0.20118704438209534, | ||
0.7470352053642273, | ||
1.2956339120864868 | ||
], | ||
[ | ||
0.014488859102129936, | ||
0.9623404741287231, | ||
-0.27146074175834656, | ||
0.02436656318604946 | ||
], | ||
[ | ||
-0.7735165357589722, | ||
0.1828240603208542, | ||
0.6068339943885803, | ||
0.497546911239624 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
] | ||
} | ||
], | ||
"test_videos": [ | ||
{ | ||
"file_name": "train02.mp4", | ||
"frame_rate": 30, | ||
"frame_num": 120, | ||
"camera_angle_x": 0.41505697544547304, | ||
"camera_hw": [ | ||
1920, | ||
1080 | ||
], | ||
"transform_matrix": [ | ||
[ | ||
0.999511182308197, | ||
-0.0030406631994992495, | ||
-0.03111351653933525, | ||
0.2844361364841461 | ||
], | ||
[ | ||
-0.005995774641633034, | ||
0.9581364989280701, | ||
-0.2862490713596344, | ||
0.011681094765663147 | ||
], | ||
[ | ||
0.03068138100206852, | ||
0.28629571199417114, | ||
0.9576499462127686, | ||
0.9857829809188843 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
] | ||
} | ||
], | ||
"frame_bkg_color": [ | ||
0.0, | ||
0.0, | ||
0.0 | ||
], | ||
"voxel_scale": [ | ||
0.4909, | ||
0.73635, | ||
0.4909 | ||
], | ||
"voxel_matrix": [ | ||
[ | ||
7.549790126404332e-08, | ||
0.0, | ||
1.0, | ||
0.081816665828228 | ||
], | ||
[ | ||
0.0, | ||
1.0, | ||
0.0, | ||
-0.044627271592617035 | ||
], | ||
[ | ||
-1.0, | ||
0.0, | ||
7.549790126404332e-08, | ||
-0.004908999893814325 | ||
], | ||
[ | ||
0.0, | ||
0.0, | ||
0.0, | ||
1.0 | ||
] | ||
], | ||
"render_center":[ | ||
0.3382070094283088, | ||
0.38795384153014023, | ||
-0.2609209839653898 | ||
], | ||
"near":1.1, | ||
"far":1.5, | ||
"phi":20.0, | ||
"rot":"Y" | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.