mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
better implicit function #channels errors
Summary: More helpful errors when the output channels aren't 1 for density and 3 for color Reviewed By: shapovalov Differential Revision: D40341088 fbshipit-source-id: 6074bf7fefe11c8e60fee4db2760b776419bcfee
This commit is contained in:
parent
17bc043a0c
commit
a607dd063e
@ -362,6 +362,11 @@ class ViewMetrics(ViewMetricsBase):
|
|||||||
|
|
||||||
def _rgb_metrics(images, images_pred, masks, masks_pred, masks_crop):
|
def _rgb_metrics(images, images_pred, masks, masks_pred, masks_crop):
|
||||||
assert masks_crop is not None
|
assert masks_crop is not None
|
||||||
|
if images.shape[1] != images_pred.shape[1]:
|
||||||
|
raise ValueError(
|
||||||
|
f"Network output's RGB images had {images_pred.shape[1]} "
|
||||||
|
f"channels. {images.shape[1]} expected."
|
||||||
|
)
|
||||||
rgb_squared = ((images_pred - images) ** 2).mean(dim=1, keepdim=True)
|
rgb_squared = ((images_pred - images) ** 2).mean(dim=1, keepdim=True)
|
||||||
rgb_loss = utils.huber(rgb_squared, scaling=0.03)
|
rgb_loss = utils.huber(rgb_squared, scaling=0.03)
|
||||||
crop_mass = masks_crop.sum().clamp(1.0)
|
crop_mass = masks_crop.sum().clamp(1.0)
|
||||||
|
@ -215,6 +215,7 @@ def _check_raymarcher_inputs(
|
|||||||
if density_1d and rays_densities.shape[-1] != 1:
|
if density_1d and rays_densities.shape[-1] != 1:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"The size of the last dimension of rays_densities has to be one."
|
"The size of the last dimension of rays_densities has to be one."
|
||||||
|
+ f" Got shape {rays_densities.shape}."
|
||||||
)
|
)
|
||||||
|
|
||||||
rays_shape = rays_densities.shape[:-1]
|
rays_shape = rays_densities.shape[:-1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user