Skip to content

PPR #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 97 commits into
base: main
Choose a base branch
from
Open

PPR #25

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
075111b
add bg ensemble
Jul 24, 2023
c226478
slightly speed up of mmlp
gengshan-y Jul 24, 2023
acb391d
remove unused files
gengshan-y Jul 24, 2023
4b58b71
fix export
gengshan-y Jul 25, 2023
d6868eb
update ensemble
gengshan-y Jul 26, 2023
e74dcef
Merge remote-tracking branch 'origin/main' into gengshan/dev
Jul 30, 2023
d00381f
Merge remote-tracking branch 'origin/gengshan/dev' into gengshan/dev
Jul 30, 2023
8d28d06
clean up
gengshan-y Jul 30, 2023
dfe367e
dict_mlp; independent vis_field
gengshan-y Aug 1, 2023
0d6572e
update project ppr
gengshan-y Aug 1, 2023
9700a99
update ppr
gengshan-y Aug 1, 2023
bf1fc31
working forward backward
gengshan-y Aug 1, 2023
8be5f97
add vis
gengshan-y Aug 2, 2023
46f248b
update dp_interface
gengshan-y Aug 2, 2023
abfaa30
update scene rectification
gengshan-y Aug 3, 2023
d240be0
fix urdf
gengshan-y Aug 3, 2023
3faa742
fix urdf
gengshan-y Aug 4, 2023
d19d7ca
init plane once
gengshan-y Aug 4, 2023
9f242fe
update
gengshan-y Aug 4, 2023
5efec17
Merge branch 'main' into gengshan/dev
gengshan-y Aug 4, 2023
ebe36ab
Merge branch 'main' into ppr
gengshan-y Aug 4, 2023
3f017db
readibility
gengshan-y Aug 6, 2023
39cfc2c
Merge branch 'main' into ppr
gengshan-y Aug 9, 2023
e5ad970
allow decimal frame id
gengshan-y Aug 11, 2023
6cae768
frz gauss rel scale; fix dq norm bug; urdf bones
gengshan-y Aug 15, 2023
4c130eb
improve bg fitting
gengshan-y Aug 16, 2023
d2eee3e
remove frame filtering
gengshan-y Aug 16, 2023
67769b7
update bg nerf; load fgbg
gengshan-y Aug 17, 2023
85a1b0a
glue in phys reg; remove param transfer
gengshan-y Aug 17, 2023
54df5bc
update vis freq
gengshan-y Aug 18, 2023
3cc8af9
modify ckpt order; large step; mod loss
gengshan-y Aug 18, 2023
b3c0e5d
partially finished camera mlp;
gengshan-y Aug 19, 2023
dd7d160
Merge branch 'gengshan/dev' into ppr
gengshan-y Aug 19, 2023
aeddf5d
simpify get params; mod bg for multi; large phys_q
gengshan-y Aug 19, 2023
bc0aae8
update param dict match
gengshan-y Aug 20, 2023
579cf6d
distill; fix skel prior loss; fix dqs
gengshan-y Aug 23, 2023
563a57c
compute metrics; mesh rnd; frame int and step
gengshan-y Aug 25, 2023
862da53
update with prev
gengshan-y Aug 25, 2023
478c362
ext-fps30; 10x bone len loss; beta=0.5 for aabb
gengshan-y Aug 26, 2023
9aa43dd
no update of base quat
gengshan-y Aug 28, 2023
ef90409
camera mlp depth=2, modify render/eval
gengshan-y Aug 28, 2023
2c3eff0
camera so3 update; sinkhorn loss
gengshan-y Aug 29, 2023
3f19cf8
skin gauss in t; cam mlp sep head; skel prior loc
gengshan-y Aug 30, 2023
361a691
Merge branch 'main' into ppr
gengshan-y Aug 30, 2023
76b7b16
fix merge
gengshan-y Aug 30, 2023
94239db
rm skin ent; decay skel prior, gauss mask, dskin; improve skin
gengshan-y Aug 31, 2023
7833b98
is; alpha; fix eikonal bug
gengshan-y Sep 1, 2023
4e62647
rollback skel prior loss
gengshan-y Sep 1, 2023
e55bbf1
fix is
gengshan-y Sep 1, 2023
7641fc0
fix eval
gengshan-y Sep 1, 2023
cb274da
refact warp; sep rot ebd; low dim ebd; clip grad
gengshan-y Sep 3, 2023
1789ca5
rollback eikonal rendering
gengshan-y Sep 4, 2023
50119cb
f8; larger skel wt; no bottleneck
gengshan-y Sep 4, 2023
cfdea13
render bone mesh; rm gauss skin; const skel; sup gauss mask with gt;…
gengshan-y Sep 4, 2023
548af8e
add pre-rotate; use f10
gengshan-y Sep 5, 2023
4ea9c96
momag; skel block; gmask loss;reg gauss; se3; clip
gengshan-y Sep 6, 2023
c6e3a65
use optical transport loss; fix dqs bug
gengshan-y Sep 6, 2023
ee47080
keep gauss skin; clip momag; fix orient; cat scale
gengshan-y Sep 6, 2023
a689b08
update lr for phys module; l2 depth loss
gengshan-y Sep 8, 2023
695b9b6
improve feat proj
gengshan-y Sep 9, 2023
8103291
init no eikonal; inside bbox for feat match
gengshan-y Sep 9, 2023
41514dd
update mesh render
gengshan-y Sep 10, 2023
9a2886f
momag mask; normal loss; clip bg; update aabb
gengshan-y Sep 11, 2023
dc22488
eik=0.1; weight ekl/init; depth loss; modify so3 reinit; clip sdf net…
gengshan-y Sep 13, 2023
b5c343f
detach vis xyz; provide option to freeze intr
gengshan-y Sep 16, 2023
bbe7915
remove composed mask loss
gengshan-y Sep 16, 2023
b6286c2
large phys_q_wt; schedule wdw length; gc
gengshan-y Sep 17, 2023
2a2c2a4
no wdw schedule
gengshan-y Sep 18, 2023
ac98657
absorb camera motion after 5rounds; freeze different vars
gengshan-y Sep 21, 2023
55872f8
pose rect; comp mask; up_dire; norm feat
gengshan-y Sep 30, 2023
c942497
alter flow; jacob; bg init; vis; level; no-prerot
gengshan-y Oct 1, 2023
3fac296
update proxy level; all pixels for feat learning
gengshan-y Oct 3, 2023
4767427
tune csim bg results
gengshan-y Oct 4, 2023
4bd2404
numerical grad; large cyc; small gauss skin; g=1
gengshan-y Oct 6, 2023
f89d1d6
ramp gauss skin
gengshan-y Oct 6, 2023
0b05644
fix floor estimation
gengshan-y Oct 7, 2023
23a8dae
stab resume; no upt urdf scale; no comp mask loss
gengshan-y Oct 8, 2023
8b54c7d
refac some funcs
gengshan-y Oct 8, 2023
32a79c3
add mesh viewer; rename pyrender
gengshan-y Oct 9, 2023
bda3688
add viewer; update bg floor append
gengshan-y Oct 9, 2023
4f15bfc
add gui camera frame
gengshan-y Oct 9, 2023
a76fd5a
visualize sim results
gengshan-y Oct 10, 2023
33027f7
align scene center; remove debug info
gengshan-y Oct 14, 2023
b2273f0
Merge branch 'main' into ppr
gengshan-y Oct 18, 2023
a259436
cosmetic changes
gengshan-y Oct 19, 2023
66bc5d0
update script for ama
gengshan-y Oct 19, 2023
3210c59
rename
gengshan-y Oct 19, 2023
ec28166
update compute_metrics.py
gengshan-y Oct 19, 2023
fa96e33
rollback feat matching; aabb beta=0.9; add cat script
gengshan-y Oct 23, 2023
551a153
update track anything
gengshan-y Oct 26, 2023
b9611a1
fix render.py for novel viewpoint
gengshan-y Nov 19, 2023
f879182
flow wt; init_feat_sigma=1; flexible skinning;
gengshan-y Dec 2, 2023
ed7f339
bug fix: check video fps (#34)
DenisKochetov Dec 7, 2023
69cf327
cyclic schedular; feat_wt=0.05; eikonal_wt=0.01; num_grad=all
gengshan-y Jan 28, 2024
39c4ad7
Merge remote-tracking branch 'origin/main' into ppr
Jan 28, 2024
34eb134
merge from main
gengshan-y Jun 24, 2024
7ac01d3
Merge remote-tracking branch 'origin/main' into ppr
gengshan-y Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
projects
submit.py
scripts/run_all_exps.sh
misc
viewer
run.sh
run-long.sh
/database/processed
/database/configs
/database/raw
/logdir
/database/ama
/database/polycam
/logdir*
/tmp
projects/csim

lab4d.egg-info
__pycache__/
Expand All @@ -16,3 +21,4 @@ __pycache__/
preprocess/third_party/vcnplus/vcn_rob.pth
preprocess/third_party/viewpoint/human.pth
preprocess/third_party/viewpoint/quad.pth
preprocess/third_party/omnivision/*.ckpt
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
[submodule "docs/pytorch_sphinx_theme"]
path = docs/pytorch_sphinx_theme
url = https://github.com/gengshan-y/pytorch_sphinx_theme
[submodule "projects/ppr/ppr-diffphys"]
path = projects/ppr/ppr-diffphys
url = git@github.com:gengshan-y/ppr-diffphys.git
[submodule "projects/ppr/eval/third_party/ChamferDistancePytorch"]
path = projects/ppr/eval/third_party/ChamferDistancePytorch
url = https://github.com/ThibaultGROUEIX/ChamferDistancePytorch
2 changes: 1 addition & 1 deletion docs/source/tutorials/single_video_cat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ To render novel views, run::

To render a video of the proxy geometry and cameras over training iterations, run::

python scripts/render_intermediate.py --testdir logdir/$logname/
python lab4d/render_intermediate.py --testdir logdir/$logname/

.. raw:: html

Expand Down
7 changes: 5 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ dependencies:
- python=3.9
- setuptools=66.0.0
- pip
- pytorch==2.0.0=py3.9_cuda11.7_cudnn8.5.0_0
- torchvision
- pytorch=2.0.0
- pytorch-cuda=11.7
- torchvision=0.15.2
- cudatoolkit-dev=11.7
- gcc_linux-64=10
- gxx_linux-64=10
Expand Down Expand Up @@ -38,3 +39,5 @@ dependencies:
- groundingdino @ git+https://github.com/IDEA-Research/GroundingDINO.git
- openmim
- pyrender
- open3d==0.17.0
- geomloss==0.2.6
35 changes: 20 additions & 15 deletions lab4d/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@ class TrainModelConfig:
# weights of reconstruction terms
flags.DEFINE_float("mask_wt", 0.1, "weight for silhouette loss")
flags.DEFINE_float("rgb_wt", 0.1, "weight for color loss")
flags.DEFINE_float("depth_wt", 1e-4, "weight for depth loss")
flags.DEFINE_float("depth_wt", 0.0, "weight for depth loss")
flags.DEFINE_float("normal_wt", 0.0, "weight for normal loss")
flags.DEFINE_float("flow_wt", 0.5, "weight for flow loss")
flags.DEFINE_float("vis_wt", 1e-2, "weight for visibility loss")
flags.DEFINE_float("feature_wt", 1e-2, "weight for feature reconstruction loss")
flags.DEFINE_float("feat_reproj_wt", 5e-2, "weight for feature reprojection loss")
flags.DEFINE_float("feat_reproj_wt", 0.05, "weight for feature reprojection loss")

# weights of regularization terms
flags.DEFINE_float(
"reg_visibility_wt", 1e-4, "weight for visibility regularization"
)
flags.DEFINE_float("reg_eikonal_wt", 1e-3, "weight for eikonal regularization")
flags.DEFINE_float("reg_eikonal_wt", 0.01, "weight for eikonal regularization")
flags.DEFINE_float("reg_eikonal_scale_max", 1, "max scaling for eikonal reg")
flags.DEFINE_float(
"reg_deform_cyc_wt", 0.01, "weight for deform cyc regularization"
)
flags.DEFINE_float("reg_delta_skin_wt", 5e-3, "weight for delta skinning reg")
flags.DEFINE_float("reg_skin_entropy_wt", 5e-4, "weight for delta skinning reg")
flags.DEFINE_float(
"reg_gauss_skin_wt", 1e-3, "weight for gauss skinning consistency"
"reg_deform_cyc_wt", 0.05, "weight for deform cyc regularization"
)
flags.DEFINE_float("reg_delta_skin_wt", 1e-3, "weight for delta skinning reg")
flags.DEFINE_float("reg_skin_entropy_wt", 0.0, "weight for delta skinning reg")
flags.DEFINE_float("reg_gauss_skin_wt", 0.02, "weight for gauss density loss in 3D")
# flags.DEFINE_float("reg_gauss_skin_wt", 0.0, "weight for gauss density loss in 3D")
flags.DEFINE_float("reg_cam_prior_wt", 0.1, "weight for camera regularization")
flags.DEFINE_float("reg_skel_prior_wt", 0.1, "weight for skeleton regularization")
flags.DEFINE_float("reg_skel_prior_wt", 0.01, "weight for skeleton regularization")
flags.DEFINE_float(
"reg_gauss_mask_wt", 0.01, "weight for gauss mask regularization"
)
Expand All @@ -41,7 +42,8 @@ class TrainModelConfig:
flags.DEFINE_string(
"fg_motion", "rigid", "{rigid, dense, bob, skel-human, skel-quad}"
)
flags.DEFINE_bool("single_inst", True, "assume the same morphology over objs")
flags.DEFINE_bool("single_inst", True, "assume the same morphology over videos")
flags.DEFINE_bool("single_scene", True, "assume the same scene over videos")


class TrainOptConfig:
Expand All @@ -57,22 +59,25 @@ class TrainOptConfig:
flags.DEFINE_string("feature_type", "dinov2", "{dinov2, cse}")
flags.DEFINE_string("load_path", "", "path to load pretrained model")

# accuracy-related
# optimization-related
flags.DEFINE_float("learning_rate", 5e-4, "learning rate")
flags.DEFINE_integer("num_rounds", 20, "number of rounds to train")
flags.DEFINE_integer("num_rounds_cam_init", 10, "number of rounds for camera init")
flags.DEFINE_integer("iters_per_round", 200, "number of iterations per round")
flags.DEFINE_integer("imgs_per_gpu", 128, "images samples per iter, per gpu")
flags.DEFINE_integer("pixels_per_image", 16, "pixel samples per image")
# flags.DEFINE_integer("imgs_per_gpu", 1, "size of minibatches per iter")
# flags.DEFINE_integer("pixels_per_image", 4096, "number of pixel samples per image")
flags.DEFINE_boolean(
"freeze_bone_len", False, "do not change bone length of skeleton"
)
flags.DEFINE_boolean("use_freq_anneal", True, "whether to use frequency annealing")
flags.DEFINE_boolean(
"reset_steps",
True,
"reset steps of loss scheduling, set to False if resuming training",
)
flags.DEFINE_boolean("pose_correction", False, "whether to execute pose correction")
flags.DEFINE_boolean("alter_flow", False, "alternatve between flow and all terms")
flags.DEFINE_boolean("freeze_intrinsics", False, "whether to freeze intrinsics")
flags.DEFINE_boolean("absorb_base", True, "whether to absorb se3 into base")

# efficiency-related
flags.DEFINE_integer("ngpu", 1, "number of gpus to use")
Expand Down
1 change: 1 addition & 0 deletions lab4d/config_omega.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"field_type": "bg", # {bg, fg, comp}
"fg_motion": "rigid", # {rigid, dense, bob, skel}
"single_inst": True, # assume the same morphology over objs
"single_scene": True, # assume the same scene over videos
},
"io": {
"seqname": "cat", # name of the sequence
Expand Down
62 changes: 51 additions & 11 deletions lab4d/dataloader/data_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2023 Gengshan Yang, Carnegie Mellon University.
import configparser
import glob
import os
import random

import numpy as np
Expand Down Expand Up @@ -234,6 +235,7 @@ def get_data_info(loader):
intrinsics = []
raw_size = []
feature_pxs = []
motion_scales = []

for dataset in dataset_list:
frame_info = FrameInfo(dataset.dict_list["ref"])
Expand All @@ -253,11 +255,29 @@ def get_data_info(loader):
num_skip = max(1, len(feature_array) // 1000)
feature_pxs.append(feature_array[::num_skip])

# compute motion magnitude
mask = dataset.mmap_list["mask"][:-1, ..., 0].copy()
if dataset.field_type == "bg":
mask = np.logical_not(mask)
elif dataset.field_type == "fg":
pass
elif dataset.field_type == "comp":
mask[:] = True
else:
raise ValueError("Unknown field type: %s" % dataset.field_type)
flow = dataset.mmap_list["flowfw"][1][mask, :2]
motion_scale = np.linalg.norm(flow, 2, -1).mean()
motion_scales.append(motion_scale)

# compute PCA on non-zero features
feature_pxs = np.concatenate(feature_pxs, 0)
feature_pxs = feature_pxs[np.linalg.norm(feature_pxs, 2, -1) > 0]
data_info["apply_pca_fn"] = pca_numpy(feature_pxs, n_components=3)

# store motion magnitude
data_info["motion_scales"] = motion_scales
# print("motion scales: ", motion_scales)

frame_info = {}
frame_info["frame_offset"] = np.asarray(frame_offset).cumsum()
frame_info["frame_offset_raw"] = np.asarray(frame_offset_raw).cumsum()
Expand Down Expand Up @@ -310,23 +330,43 @@ def load_small_files(data_path_dict):
# [np.load(path).astype(np.float32) for path in data_path_dict["crop2raw"]], 0
# ) # N,4

rtmat_bg = np.concatenate(
[np.load(path).astype(np.float32) for path in data_path_dict["cambg"]], 0
) # N,4,4
rtmat_fg = np.concatenate(
[np.load(path).astype(np.float32) for path in data_path_dict["camfg"]], 0
) # N,4,4
# bg/fg camera
rtmat_bg = []
for vid, path in enumerate(data_path_dict["cambg"]):
# get N
num_frames = np.load(data_path_dict["is_detected"][vid]).shape[0]
if os.path.exists(path):
rtmat_bg.append(np.load(path).astype(np.float32))
else:
rtmat_bg.append(np.eye(4)[None].repeat(num_frames, 0))
print("Warning: no bg camera found at %s" % path)
rtmat_bg = np.concatenate(rtmat_bg, 0) # N,4,4

rtmat_fg = []
for vid, path in enumerate(data_path_dict["camfg"]):
# get N
num_frames = np.load(data_path_dict["is_detected"][vid]).shape[0]
if os.path.exists(path):
rtmat_fg.append(np.load(path).astype(np.float32))
else:
rtmat_fg.append(np.eye(4)[None].repeat(num_frames, 0))
print("Warning: no fg camera found at %s" % path)

rtmat_fg = np.concatenate(rtmat_fg, 0)

# hard-code for now
vis_info = {"bg": 0, "fg": 1} # video instance segmentation info
data_info["vis_info"] = vis_info
data_info["rtmat"] = np.stack([rtmat_bg, rtmat_fg], 0)

# path to centered mesh files
camera_prefix = data_path_dict["cambg"][0].rsplit("/", 1)[0]
data_info["geom_path"] = [
"%s/mesh-00-centered.obj" % camera_prefix,
"%s/mesh-01-centered.obj" % camera_prefix,
]
geom_path_bg = []
geom_path_fg = []
for path in data_path_dict["cambg"]:
camera_prefix = path.rsplit("/", 1)[0]
geom_path_bg.append("%s/mesh-00-centered.obj" % camera_prefix)
geom_path_fg.append("%s/mesh-01-centered.obj" % camera_prefix)
data_info["geom_path"] = [geom_path_bg, geom_path_fg]
return data_info


Expand Down
Loading