mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-14 03:44:02 +08:00
messing with params
This commit is contained in:
1 parent
177b86d490
commit
88748050d2
4 files changed
+21
-22
No files matched your search
@@ -83,7 +83,7 @@ method_configs["nerfacto"] = TrainerConfig(
|
||||
pipeline=VanillaPipelineConfig(
|
||||
datamanager=VanillaDataManagerConfig(
|
||||
dataparser=NerfstudioDataParserConfig(),
|
||||
train_num_rays_per_batch=8192,
|
||||
train_num_rays_per_batch=16000,
|
||||
eval_num_rays_per_batch=4096,
|
||||
camera_optimizer=CameraOptimizerConfig(
|
||||
mode="SO3xR3", optimizer=AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2)
|
||||
|
||||
@@ -351,7 +351,7 @@ class VanillaDataManager(DataManager): # pylint: disable=abstract-method
|
||||
# Otherwise, use the default pixel sampler
|
||||
if is_equirectangular.any():
|
||||
CONSOLE.print("[bold yellow]Warning: Some cameras are equirectangular, but using default pixel sampler.")
|
||||
return PatchPixelSampler(*args, **kwargs,patch_size=16)
|
||||
return PatchPixelSampler(*args, **kwargs,patch_size=8)
|
||||
|
||||
def setup_train(self):
|
||||
"""Sets up the data loaders for training"""
|
||||
|
||||
@@ -303,24 +303,26 @@ def depth_loss(
|
||||
|
||||
raise NotImplementedError("Provided depth loss type not implemented.")
|
||||
|
||||
def robust_rgb_loss(rgb_gt,rgb_outputs,patch_size=16):
|
||||
def robust_rgb_loss(rgb_gt,rgb_outputs,patch_size=8):
|
||||
out_patches = rgb_outputs.view(-1,1,patch_size,patch_size,3)
|
||||
gt_patches = rgb_gt.view(-1,1,patch_size,patch_size,3)
|
||||
device = rgb_outputs.device
|
||||
batch_size = out_patches.shape[0]
|
||||
residuals = torch.mean((out_patches - gt_patches)**2,dim=-1)
|
||||
with torch.no_grad():
|
||||
med_residual = torch.median(residuals)
|
||||
#equation 8
|
||||
weight = (residuals<med_residual).float()
|
||||
#equation 9
|
||||
blurred_w = (torch.nn.functional.conv2d(weight,(1/9.)*torch.ones((1,1,3,3),device=device),padding='same')>0.5).float()
|
||||
expected_w = torch.mean(torch.mean(blurred_w,dim=-1),dim=-1)
|
||||
#equation 10
|
||||
weight_r8 = (expected_w > 0.6).float()
|
||||
w_8x8 = weight_r8[...,None] * torch.ones((batch_size,8,8),device=device)
|
||||
final_w = torch.zeros((batch_size,patch_size,patch_size),device=device)
|
||||
final_w[:,
|
||||
(patch_size//2-patch_size//4):(patch_size//2+patch_size//4),
|
||||
(patch_size//2-patch_size//4):(patch_size//2+patch_size//4)] = w_8x8
|
||||
return torch.mean(residuals.squeeze()*final_w)
|
||||
# with torch.no_grad():
|
||||
med_residual = torch.median(residuals)
|
||||
#equation 8
|
||||
weight = (residuals<=med_residual).float()
|
||||
#equation 9
|
||||
blurred_w = (torch.nn.functional.conv2d(weight,(1/9.)*torch.ones((1,1,3,3),device=device),padding='same')>=0.5).float()
|
||||
# expected_w = torch.mean(torch.mean(blurred_w,dim=-1),dim=-1)
|
||||
#equation 10
|
||||
# weight_r8 = (expected_w > 0.6).float()
|
||||
# w_8x8 = weight_r8[...,None] * torch.ones((batch_size,8,8),device=device)
|
||||
# final_w = torch.zeros((batch_size,patch_size,patch_size),device=device)
|
||||
# final_w[:,
|
||||
# (patch_size//2-patch_size//4):(patch_size//2+patch_size//4),
|
||||
# (patch_size//2-patch_size//4):(patch_size//2+patch_size//4)] = w_8x8
|
||||
# loss = torch.mean(residuals.squeeze()*blurred_w)
|
||||
loss = torch.mean(residuals.squeeze()*blurred_w)
|
||||
return loss
|
||||
@@ -186,8 +186,7 @@ class NerfactoModel(Model):
|
||||
# renderers
|
||||
self.renderer_rgb = RGBRenderer(background_color=self.config.background_color)
|
||||
self.renderer_accumulation = AccumulationRenderer()
|
||||
self.renderer_depth = DepthRenderer(method='expected')
|
||||
self.renderer_truncdepth = DepthRenderer(method='median')
|
||||
self.renderer_depth = DepthRenderer()
|
||||
self.renderer_normals = NormalsRenderer()
|
||||
|
||||
# shaders
|
||||
@@ -264,8 +263,6 @@ class NerfactoModel(Model):
|
||||
"accumulation": accumulation,
|
||||
"depth": depth,
|
||||
}
|
||||
with torch.no_grad():
|
||||
outputs['depth_truncated']=self.renderer_truncdepth(weights=weights, ray_samples=ray_samples)
|
||||
|
||||
if self.config.predict_normals:
|
||||
normals = self.renderer_normals(normals=field_outputs[FieldHeadNames.NORMALS], weights=weights)
|
||||
|
||||
Reference in new issue
Block a user