mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-01 13:28:59 +08:00
ns-eval save images by name
This commit is contained in:
1 parent
631b3c6dae
commit
c3c151f3ae
4 files changed
+21
-6
No files matched your search
@@ -64,8 +64,8 @@ def Get_PanoHDR_Nerfacto_config():
|
|||||||
pipeline=VanillaPipelineConfig(
|
pipeline=VanillaPipelineConfig(
|
||||||
datamanager=HDRVanillaDataManagerConfig(
|
datamanager=HDRVanillaDataManagerConfig(
|
||||||
dataparser=NerfstudioDataParserConfig(),
|
dataparser=NerfstudioDataParserConfig(),
|
||||||
train_num_rays_per_batch=8192,
|
train_num_rays_per_batch=4096,
|
||||||
eval_num_rays_per_batch=8192,
|
eval_num_rays_per_batch=4096,
|
||||||
# camera_optimizer=CameraOptimizerConfig(
|
# camera_optimizer=CameraOptimizerConfig(
|
||||||
# mode="SO3xR3",
|
# mode="SO3xR3",
|
||||||
# optimizer=AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
|
# optimizer=AdamOptimizerConfig(lr=6e-4, eps=1e-8, weight_decay=1e-2),
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ class HDRInputDataset(InputDataset):
|
|||||||
"""
|
"""
|
||||||
image = self.get_image(image_idx)
|
image = self.get_image(image_idx)
|
||||||
data = {"image_idx": image_idx, "image": image}
|
data = {"image_idx": image_idx, "image": image}
|
||||||
|
image_filename = self._dataparser_outputs.image_filenames[image_idx]
|
||||||
|
data["image_filename"] = str(image_filename.name)
|
||||||
if self._dataparser_outputs.mask_filenames is not None:
|
if self._dataparser_outputs.mask_filenames is not None:
|
||||||
mask_filepath = self._dataparser_outputs.mask_filenames[image_idx]
|
mask_filepath = self._dataparser_outputs.mask_filenames[image_idx]
|
||||||
data["mask"] = get_image_mask_tensor_from_path(filepath=mask_filepath, scale_factor=self.scale_factor)
|
data["mask"] = get_image_mask_tensor_from_path(filepath=mask_filepath, scale_factor=self.scale_factor)
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class PanoHDRNeRFModel(NerfactoModel):
|
|||||||
gt_rgb = batch["mask"] * gt_rgb
|
gt_rgb = batch["mask"] * gt_rgb
|
||||||
predicted_rgb = batch["mask"] * predicted_rgb
|
predicted_rgb = batch["mask"] * predicted_rgb
|
||||||
|
|
||||||
combined_rgb = torch.cat([gt_rgb, predicted_rgb], dim=1)
|
combined_rgb = predicted_rgb # torch.cat([gt_rgb, predicted_rgb], dim=1)
|
||||||
combined_acc = torch.cat([acc], dim=1)
|
combined_acc = torch.cat([acc], dim=1)
|
||||||
combined_depth = torch.cat([depth], dim=1)
|
combined_depth = torch.cat([depth], dim=1)
|
||||||
|
|
||||||
|
|||||||
@@ -395,9 +395,22 @@ class VanillaPipeline(Pipeline):
|
|||||||
camera_indices = camera_ray_bundle.camera_indices
|
camera_indices = camera_ray_bundle.camera_indices
|
||||||
assert camera_indices is not None
|
assert camera_indices is not None
|
||||||
for key, val in images_dict.items():
|
for key, val in images_dict.items():
|
||||||
Image.fromarray((val * 255).byte().cpu().numpy()).save(
|
if 'image_filename' in batch.keys():
|
||||||
output_path / "{0:06d}-{1}.jpg".format(int(camera_indices[0, 0, 0]), key)
|
output_name = batch['image_filename'].split('.')[0] + '-' + key
|
||||||
)
|
if key == 'img':
|
||||||
|
output_name = output_name + '.' + batch['image_filename'].split('.')[-1]
|
||||||
|
else:
|
||||||
|
output_name = output_name + '.jpg'
|
||||||
|
else:
|
||||||
|
output_name = "{0:06d}-{1}.jpg".format(int(camera_indices[0, 0, 0]), key)
|
||||||
|
if output_name.endswith('.exr'):
|
||||||
|
import cv2
|
||||||
|
render_image = cv2.cvtColor(val.cpu().numpy(), cv2.COLOR_BGR2RGB)
|
||||||
|
cv2.imwrite(str(output_path / output_name), render_image)
|
||||||
|
else:
|
||||||
|
Image.fromarray((val * 255).byte().cpu().numpy()).save(
|
||||||
|
output_path / output_name
|
||||||
|
)
|
||||||
assert "num_rays_per_sec" not in metrics_dict
|
assert "num_rays_per_sec" not in metrics_dict
|
||||||
metrics_dict["num_rays_per_sec"] = num_rays / (time() - inner_start)
|
metrics_dict["num_rays_per_sec"] = num_rays / (time() - inner_start)
|
||||||
fps_str = "fps"
|
fps_str = "fps"
|
||||||
|
|||||||
Reference in new issue
Block a user