pytorch3d
pytorch3d copied to clipboard
focal lengths are not scaled?
🐛 Bugs / Unexpected behaviors
The code at line 115 of the file projects/nerf/nerf/dataset.py can cause potential bugs when the image_size
is not the same as the original image size, this could happen because if we scale the images we need to scale the focal lengths as well.
scale_factors = [s_new / s for s, s_new in zip(images.shape[1:3], image_size)]
if abs(scale_factors[0] - scale_factors[1]) > 1e-3:
raise ValueError(
"Non-isotropic scaling is not allowed. Consider changing the 'image_size' argument."
)
scale_factor = sum(scale_factors) * 0.5
if scale_factor != 1.0:
print(f"Rescaling dataset (factor={scale_factor})")
images = torch.nn.functional.interpolate(
images.permute(0, 3, 1, 2),
size=tuple(image_size),
mode="bilinear",
).permute(0, 2, 3, 1)
cameras = [
PerspectiveCameras(
**{k: v[cami][None] for k, v in train_data["cameras"].items()}
).to("cpu")
for cami in range(n_cameras)
]
Besides, when I test the code with the lego
dataset, I find that the principal points are not provided and thus set to be zero by default, shouldn't it be at the center of the image? Moreover, the focal length is scaled to the world unit, I wonder why to do this?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.