-
Notifications
You must be signed in to change notification settings - Fork 100
Fix critical bugs in Skyfall-GS codebase #12
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -69,8 +69,9 @@ def create_offset_gt(image, offset): | |||||
| id_coords = torch.from_numpy(id_coords).cuda() | ||||||
|
|
||||||
| id_coords = id_coords.permute(1, 2, 0) + offset | ||||||
| id_coords[..., 0] /= (width - 1) | ||||||
| id_coords[..., 1] /= (height - 1) | ||||||
| # Avoid division by zero for single-pixel dimensions | ||||||
| id_coords[..., 0] /= max(width - 1, 1) | ||||||
| id_coords[..., 1] /= max(height - 1, 1) | ||||||
| id_coords = id_coords * 2 - 1 | ||||||
|
|
||||||
| image = torch.nn.functional.grid_sample(image[None], id_coords[None], align_corners=True, padding_mode="border")[0] | ||||||
|
|
@@ -235,10 +236,9 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi | |||||
|
|
||||||
| opacity_loss = 0.0 | ||||||
| if opt.lambda_opacity > 0: | ||||||
| # Get each gaussians' opacity and use cross entropy loss | ||||||
| # Get each gaussians' opacity and use entropy loss to encourage binary values | ||||||
| opacity = gaussians.get_opacity.clamp(1.0e-3, 1.0 - 1.0e-3) | ||||||
| opacity_loss = torch.nn.functional.binary_cross_entropy(opacity, opacity) | ||||||
| # opacity_loss = torch.mean(-opacity * torch.log(opacity + 1e-6)) | ||||||
| opacity_loss = torch.mean(-opacity * torch.log(opacity + 1e-6)) | ||||||
| loss += opt.lambda_opacity * opacity_loss | ||||||
|
|
||||||
|
|
||||||
|
|
@@ -272,7 +272,7 @@ def training(dataset, opt, pipe, testing_iterations, saving_iterations, checkpoi | |||||
| depth_loss_pseudo = depth_loss_func(gt_depth, render_depth) | ||||||
|
|
||||||
| if torch.isnan(depth_loss_pseudo).sum() == 0: | ||||||
| loss_scale = min((iteration - args.start_sample_pseudo) / 500., 1) | ||||||
| loss_scale = min((iteration - opt.start_sample_pseudo) / 500., 1) | ||||||
| loss += loss_scale * opt.lambda_pseudo_depth * depth_loss_pseudo | ||||||
| depth_loss += depth_loss_pseudo | ||||||
|
|
||||||
|
|
@@ -459,28 +459,9 @@ def generate_idu_training_set( | |||||
| n_avg=flow_edit_n_avg | ||||||
| ) | ||||||
| elif use_difix3d: | ||||||
| refine_pipe = Difix3DRefineIDU( | ||||||
| save_path=refine_path, | ||||||
| device="cuda:0", | ||||||
| model_name=difix3d_model, | ||||||
| use_reference=difix3d_use_reference | ||||||
| ) | ||||||
| final_imgs = refine_pipe.run( | ||||||
| imgs, | ||||||
| prompt=difix3d_prompt, | ||||||
| num_inference_steps=difix3d_steps, | ||||||
| timesteps=difix3d_timesteps, | ||||||
| guidance_scale=difix3d_guidance | ||||||
| ) | ||||||
| raise NotImplementedError("Difix3D refine is not yet implemented. Please use FlowEdit refine instead.") | ||||||
| elif use_dreamscene: | ||||||
| refine_pipe = DreamSceneRefineIDU( | ||||||
| save_path=refine_path, | ||||||
| device="cuda:0", | ||||||
| model="sd21" if use_sd21 else "diffusionsat", | ||||||
| ) | ||||||
| final_imgs = refine_pipe.run( | ||||||
| imgs, | ||||||
| ) | ||||||
| raise NotImplementedError("DreamScene refine is not yet implemented. Please use FlowEdit refine instead.") | ||||||
| else: | ||||||
| raise NotImplementedError("DiffusionSat refine is deprecated") | ||||||
| if refine_pipe: | ||||||
|
|
@@ -833,10 +814,9 @@ def training_idu_episode( | |||||
|
|
||||||
| opacity_loss = 0.0 | ||||||
| if opt.lambda_opacity > 0: | ||||||
| # Get each gaussians' opacity and use cross entropy loss | ||||||
| # Get each gaussians' opacity and use entropy loss to encourage binary values | ||||||
| opacity = gaussians.get_opacity.clamp(1.0e-3, 1.0 - 1.0e-3) | ||||||
| opacity_loss = torch.nn.functional.binary_cross_entropy(opacity, opacity) | ||||||
| # opacity_loss = torch.mean(-opacity * torch.log(opacity + 1e-6)) | ||||||
| opacity_loss = torch.mean(-opacity * torch.log(opacity + 1e-6)) | ||||||
|
||||||
| opacity_loss = torch.mean(-opacity * torch.log(opacity + 1e-6)) | |
| opacity_loss = torch.mean(-opacity * torch.log(opacity)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,5 +24,14 @@ def mkdir_p(folder_path): | |
| raise | ||
|
|
||
| def searchForMaxIteration(folder): | ||
| saved_iters = [int(fname.split("_")[-1]) for fname in os.listdir(folder)] | ||
| saved_iters = [] | ||
| for fname in os.listdir(folder): | ||
| try: | ||
| # Try to parse the iteration number from the filename | ||
| saved_iters.append(int(fname.split("_")[-1])) | ||
| except (ValueError, IndexError): | ||
| # Skip files that don't match the expected pattern | ||
| continue | ||
| if not saved_iters: | ||
| return 0 | ||
| return max(saved_iters) | ||
|
Comment on lines
26
to
37
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
+ 1e-6epsilon in the log is redundant sinceopacityis already clamped to a minimum of1.0e-3on the previous line. The epsilon should either be removed from the log calculation, or the clamping bounds should be adjusted to use the same epsilon value for consistency (e.g., clamp to1e-6instead of1.0e-3).