Spaces:
Runtime error
Runtime error
Upload luciddreamer.py with huggingface_hub
Browse files- luciddreamer.py +10 -7
luciddreamer.py
CHANGED
@@ -231,7 +231,7 @@ class LucidDreamer:
|
|
231 |
framelist = []
|
232 |
depthlist = []
|
233 |
dmin, dmax = 1e8, -1e8
|
234 |
-
for view in views:
|
235 |
results = render(view, self.gaussians, self.opt, self.background, render_only=True)
|
236 |
frame, depth = results['render'], results['depth']
|
237 |
framelist.append(
|
@@ -244,6 +244,9 @@ class LucidDreamer:
|
|
244 |
if dmax_local > dmax:
|
245 |
dmax = dmax_local
|
246 |
depthlist.append(depth)
|
|
|
|
|
|
|
247 |
# depthlist = [colorize(depth, vmin=dmin, vmax=dmax) for depth in depthlist]
|
248 |
depthlist = [colorize(depth) for depth in depthlist]
|
249 |
if not os.path.exists(videopath):
|
@@ -256,7 +259,7 @@ class LucidDreamer:
|
|
256 |
if not self.scene:
|
257 |
raise('Build 3D Scene First!')
|
258 |
|
259 |
-
for iteration in tqdm(range(1, self.opt.iterations + 1)):
|
260 |
self.gaussians.update_learning_rate(iteration)
|
261 |
|
262 |
# Every 1000 its we increase the levels of SH up to a maximum degree
|
@@ -349,10 +352,10 @@ class LucidDreamer:
|
|
349 |
|
350 |
pts_coord_world, pts_colors = new_pts_coord_world2.copy(), new_pts_colors2.copy()
|
351 |
|
352 |
-
progress(0, desc='Dreaming...')
|
353 |
# time.sleep(0.5)
|
354 |
|
355 |
-
for i in progress.tqdm(range(1, len(render_poses)), desc='Dreaming'):
|
356 |
R, T = render_poses[i,:3,:3], render_poses[i,:3,3:4]
|
357 |
|
358 |
### Transform world to pixel
|
@@ -480,10 +483,10 @@ class LucidDreamer:
|
|
480 |
# render_poses = get_pcdGenPoses(pcdgenpath)
|
481 |
internel_render_poses = get_pcdGenPoses('hemisphere', {'center_depth': center_depth})
|
482 |
|
483 |
-
progress(0, desc='Aligning...')
|
484 |
# time.sleep(0.5)
|
485 |
|
486 |
-
for i in progress.tqdm(range(len(render_poses)), desc='Aligning'):
|
487 |
for j in range(len(internel_render_poses)):
|
488 |
idx = i * len(internel_render_poses) + j
|
489 |
print(f'{idx+1} / {len(render_poses)*len(internel_render_poses)}')
|
@@ -539,5 +542,5 @@ class LucidDreamer:
|
|
539 |
'transform_matrix': Pc2w.tolist(),
|
540 |
})
|
541 |
|
542 |
-
progress(1, desc='Baking Gaussians...')
|
543 |
return traindata
|
|
|
231 |
framelist = []
|
232 |
depthlist = []
|
233 |
dmin, dmax = 1e8, -1e8
|
234 |
+
for view in progress.tqdm(views, desc='[4/4] Rendering a video'):
|
235 |
results = render(view, self.gaussians, self.opt, self.background, render_only=True)
|
236 |
frame, depth = results['render'], results['depth']
|
237 |
framelist.append(
|
|
|
244 |
if dmax_local > dmax:
|
245 |
dmax = dmax_local
|
246 |
depthlist.append(depth)
|
247 |
+
|
248 |
+
progress(1, desc='[4/4] Rendering a video...')
|
249 |
+
|
250 |
# depthlist = [colorize(depth, vmin=dmin, vmax=dmax) for depth in depthlist]
|
251 |
depthlist = [colorize(depth) for depth in depthlist]
|
252 |
if not os.path.exists(videopath):
|
|
|
259 |
if not self.scene:
|
260 |
raise('Build 3D Scene First!')
|
261 |
|
262 |
+
for iteration in progress.tqdm(range(1, self.opt.iterations + 1), desc='[3/4] Baking Gaussians'):
|
263 |
self.gaussians.update_learning_rate(iteration)
|
264 |
|
265 |
# Every 1000 its we increase the levels of SH up to a maximum degree
|
|
|
352 |
|
353 |
pts_coord_world, pts_colors = new_pts_coord_world2.copy(), new_pts_colors2.copy()
|
354 |
|
355 |
+
progress(0, desc='[1/4] Dreaming...')
|
356 |
# time.sleep(0.5)
|
357 |
|
358 |
+
for i in progress.tqdm(range(1, len(render_poses)), desc='[1/4] Dreaming'):
|
359 |
R, T = render_poses[i,:3,:3], render_poses[i,:3,3:4]
|
360 |
|
361 |
### Transform world to pixel
|
|
|
483 |
# render_poses = get_pcdGenPoses(pcdgenpath)
|
484 |
internel_render_poses = get_pcdGenPoses('hemisphere', {'center_depth': center_depth})
|
485 |
|
486 |
+
progress(0, desc='[2/4] Aligning...')
|
487 |
# time.sleep(0.5)
|
488 |
|
489 |
+
for i in progress.tqdm(range(len(render_poses)), desc='[2/4] Aligning'):
|
490 |
for j in range(len(internel_render_poses)):
|
491 |
idx = i * len(internel_render_poses) + j
|
492 |
print(f'{idx+1} / {len(render_poses)*len(internel_render_poses)}')
|
|
|
542 |
'transform_matrix': Pc2w.tolist(),
|
543 |
})
|
544 |
|
545 |
+
progress(1, desc='[3/4] Baking Gaussians...')
|
546 |
return traindata
|