Skip to content
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

Clip jialin dev #76

Open
wants to merge 72 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
c19c69c
added pointcloud as generator condition
mengxuyiGit Oct 17, 2022
d60d3c2
included all the new classes to support volume feature
mengxuyiGit Oct 17, 2022
f0f15a8
stylegan2_volume using pc volume as conditional ws
mengxuyiGit Oct 17, 2022
9ca0d43
stylegan2_3dconv: synthesis3DUnet, naive 3d conv with latent and noise
mengxuyiGit Oct 17, 2022
7e559d5
modified module name to pcws
mengxuyiGit Oct 17, 2022
efda602
increased synthesis3DUnet resolution to 128
mengxuyiGit Oct 17, 2022
8a08ddb
using the combination of tri-plane and volume64, C=32
mengxuyiGit Oct 18, 2022
a9e676a
added script
mengxuyiGit Oct 18, 2022
bce2bdd
added networks_stylegan2_trip_and_vol.py
mengxuyiGit Oct 18, 2022
01fbd52
added completed dataset to script
mengxuyiGit Oct 18, 2022
8f9ec23
track scripts and network
mengxuyiGit Oct 18, 2022
9b8bd51
fixed _pc
mengxuyiGit Oct 18, 2022
bba123a
metric utils fixed
mengxuyiGit Oct 18, 2022
1497623
fix: update environment
KalinZhang Oct 18, 2022
002487b
Merge branch 'jialin_dev' of https://github.com/mengxuyiGit/eg3d into…
KalinZhang Oct 18, 2022
a5055c1
minor: gitignore
KalinZhang Oct 18, 2022
52c4cc1
metrics utils fixed
mengxuyiGit Oct 18, 2022
1691dc6
metrics utils
mengxuyiGit Oct 18, 2022
300ab70
metrics utils merged
mengxuyiGit Oct 18, 2022
3799f72
voxel resolution is 128
mengxuyiGit Oct 18, 2022
901bdaf
before fixinf grp_torch_range
mengxuyiGit Oct 18, 2022
7d47abe
fixed grp_torch_range
mengxuyiGit Oct 18, 2022
d01c199
before cherrypick grp_torch
mengxuyiGit Oct 18, 2022
e300125
grid_size to 64
mengxuyiGit Oct 18, 2022
485761d
Merge branch 'tri_plane_and_vol' of https://github.com/mengxuyiGit/eg…
mengxuyiGit Oct 18, 2022
7879297
changed points to 1024
mengxuyiGit Oct 18, 2022
3fd25be
pc_ws with train logger, grid_size=64
mengxuyiGit Oct 18, 2022
a3d6956
added train logger
mengxuyiGit Oct 18, 2022
3e1948a
merged from fourier
mengxuyiGit Oct 18, 2022
8f44a19
added training/networks_stylegan2_pcws.py
mengxuyiGit Oct 18, 2022
0d8e6ab
Merge branch 'pc_ws' of https://github.com/mengxuyiGit/eg3d into pc_ws
mengxuyiGit Oct 18, 2022
f576330
pass opt.volume_res to grid_size
mengxuyiGit Oct 18, 2022
f73a596
Merge branch 'synthesis3dunet' of https://github.com/mengxuyiGit/eg3d…
mengxuyiGit Oct 18, 2022
bfb5d74
pass volume res to grid_size
mengxuyiGit Oct 18, 2022
b90a350
OSGdecoder in click opts
mengxuyiGit Oct 18, 2022
74763d5
added gen_video script for ABO dataset
mengxuyiGit Oct 19, 2022
9e5018d
feat: add volume discriminator
KalinZhang Oct 19, 2022
593254c
meeting check
mengxuyiGit Oct 20, 2022
f35cfaa
added jialin script
mengxuyiGit Oct 20, 2022
a60fddb
added jialin_depth_vis.sh script
mengxuyiGit Oct 20, 2022
51ba4d5
merged with jialin dev
mengxuyiGit Oct 20, 2022
9f11379
added eg3d/scripts/jialin_depth_vis.sh
mengxuyiGit Oct 20, 2022
3045e0e
minor: add gitignore
KalinZhang Oct 20, 2022
da733ab
minor: update gitignore, wait for fixes
KalinZhang Oct 20, 2022
a9654ad
minor: fix gitignore
KalinZhang Oct 20, 2022
cc3ccd3
Merge branch 'synthesis3dunet' into jialin_dev
KalinZhang Oct 20, 2022
45f14ca
refactor: extract chamfer block
KalinZhang Oct 21, 2022
36c50f4
gen video for abo
mengxuyiGit Oct 21, 2022
d11f609
Merge branch 'synthesis3dunet' of https://github.com/mengxuyiGit/eg3d…
mengxuyiGit Oct 21, 2022
be4c3e0
enabled logger and multiple gpu training
mengxuyiGit Oct 21, 2022
eaf3d72
enabled use_ray_directions during rendering as default choice
mengxuyiGit Oct 21, 2022
7d3f863
Merge branch 'synthesis3dunet' of https://github.com/mengxuyiGit/eg3d…
mengxuyiGit Oct 21, 2022
be6dfbd
noise stregth 0.5
mengxuyiGit Oct 21, 2022
89db296
Merge branch 'synthesis3dunet' of https://github.com/mengxuyiGit/eg3d…
mengxuyiGit Oct 21, 2022
1dc64f6
Merge branch 'synthesis3dunet' into jialin_dev
KalinZhang Oct 22, 2022
cc3d7b0
temporary work SyncBatchnorm
mengxuyiGit Oct 22, 2022
8297326
Merge branch 'jialin_dev' of https://github.com/mengxuyiGit/eg3d into…
mengxuyiGit Oct 22, 2022
0b8dda9
temprary working syncnorm before distrubution
mengxuyiGit Oct 22, 2022
48938fd
Merge branch 'ddb' into synthesis3dunet
mengxuyiGit Oct 22, 2022
c4b1615
added noise_strength as click option
mengxuyiGit Oct 22, 2022
c3be0cc
trying with ddp
mengxuyiGit Oct 24, 2022
b49a5a0
feat: skip consistency check in bn
KalinZhang Oct 22, 2022
96d3e7f
vfe_model: pointnet -> embedding
mengxuyiGit Oct 24, 2022
0b1edb2
enable logger, metric every batch, costReg not print
mengxuyiGit Oct 24, 2022
9912e44
added perceptual loss by clip ViT-B model
mengxuyiGit Oct 25, 2022
40add72
assert not use embedding: not as good as pointnet
mengxuyiGit Oct 25, 2022
d437b65
added l2 loss, and move clip model into class module
mengxuyiGit Oct 25, 2022
b5c8d4c
explicitly removed chamfer
mengxuyiGit Oct 25, 2022
dbf6a0b
feat: re-added chamfer loss
KalinZhang Oct 25, 2022
e96d981
fix: fix enviromnent && fix chamfer loss
KalinZhang Oct 26, 2022
bdff688
added chamfer_reg to scale loss
mengxuyiGit Oct 26, 2022
044a14d
checked chamfer scale
mengxuyiGit Oct 26, 2022
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ archive
*.ply
eval
out
__pycache__
try-runs

# evaluation:
temp/
Expand All @@ -25,3 +27,6 @@ vids/
stylegan3/results
eg3d/results
eg3d_results

*runs/
*ipynb
1 change: 1 addition & 0 deletions dataset_preprocessing/abo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.zip
130 changes: 130 additions & 0 deletions dataset_preprocessing/abo/preprocess_abo_cameras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.

#############################################################

# Usage: python dataset_preprocessing/shapenet/preprocess_cars_cameras.py --source ~/downloads/cars_train --dest /data/cars_preprocessed

#############################################################


# from distutils.debug import DEBUG
import json
import numpy as np
import os
from tqdm import tqdm
import argparse
from ipdb import set_trace as st

def list_recursive(folderpath):
return [os.path.join(folderpath, filename) for filename in os.listdir(folderpath)]

DEBUG=True

if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--source", type=str)
parser.add_argument("--max_images", type=int, default=None)
args = parser.parse_args()

# Parse cameras
dataset_path = args.source
cameras = {}

blender2opencv = np.array([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
w, h = 512, 512

#### this is for directly listing
# for scene_folder_path in list_recursive(dataset_path):
# if not os.path.isdir(scene_folder_path): continue

#### this is using predefined list, to avoid folders that the datageneration is not complete
all_data = []
resolution = 512
for split in ['train', 'val']:
with open(os.path.join(dataset_path, 'meta', f'abo_{resolution}_{split}.txt')) as f:
scans = [line.rstrip() for line in f.readlines()]
all_data += scans
print(len(all_data), all_data)
for scene_folder_path_rel in all_data:
scene_folder_path = os.path.join(dataset_path, scene_folder_path_rel)
# st() # the sibling folder with rgb should be mesh>: no, only intrinsics and pose

pointcloud_csv = os.path.join(scene_folder_path,'sample', f"pc.csv")
assert os.path.isfile(pointcloud_csv)
pc_relative_path = os.path.relpath(pointcloud_csv, dataset_path)
# print(pc_relative_path)

with open(os.path.join(scene_folder_path,'render', f"transforms.json"), 'r') as f:
meta = json.load(f)
# print(meta.keys()) ['camera_angle_x', 'frames']
# print(meta ['frames'][0]['file_path'])

focal = .5 * w / np.tan(0.5 * meta['camera_angle_x'])
# intrinsic_for_all = np.array([[focal, 0, w / 2], [0, focal, h / 2], [0, 0, 1]])
### IMPORTANT!!! EG3D use the intrinsics that agnostic of original resolution!!
# intrinsics = np.array(
# [[focal / orig_img_size, 0.00000000e+00, cx / orig_img_size],
# [0.00000000e+00, focal / orig_img_size, cy / orig_img_size],
# [0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]
# ).tolist()
intrinsic_for_all = np.array(
[[focal / w, 0.00000000e+00, (w / 2)/w],
[0.00000000e+00, focal / h, (h / 2)/h],
[0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]
).tolist()
st()

# continue
# for rgb_path in list_recursive(os.path.join(scene_folder_path, 'render')):
for frame in meta ['frames']:
rgb_path = frame['file_path']
relative_path = os.path.relpath(rgb_path, dataset_path)
print(relative_path)

intrinsics = intrinsic_for_all
pose = (np.array(frame['transform_matrix'])@blender2opencv).tolist()
# print(len(pose))

cameras[relative_path] = {'pose': pose, 'intrinsics': intrinsics, 'scene-name': os.path.basename(scene_folder_path),\
'pc_csv':pc_relative_path}
# if DEBUG:
# break

with open(os.path.join(dataset_path, 'cameras.json'), 'w') as outfile:
json.dump(cameras, outfile, indent=4)


camera_dataset_file = os.path.join(args.source, 'cameras.json')

with open(camera_dataset_file, "r") as f:
cameras = json.load(f) # same camera file as saved above

dataset = {'labels':[]}
# max_images = args.max_images if args.max_images is not None else len(cameras)
max_images = len(cameras)
for i, filename in tqdm(enumerate(cameras), total=max_images):
if (max_images is not None and i >= max_images): break

pose = np.array(cameras[filename]['pose'])
intrinsics = np.array(cameras[filename]['intrinsics'])
label = np.concatenate([pose.reshape(-1), intrinsics.reshape(-1)]).tolist()

image_path = os.path.join(args.source, filename)
pc_rel_path = cameras[filename]['pc_csv']
dataset["labels"].append([filename, label, pc_rel_path])
# also append pointcloud filename, but need to check with the dataset class too

# print(dataset)
# check cameras/dataset

with open(os.path.join(args.source, 'dataset.json'), "w") as f:
json.dump(dataset, f, indent=4)

Loading