mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 10:55:57 +08:00
Fix benchmarking: apply get_background_color in renderer and set profiler to none (#2397)
* apply get_background_color and set profiler to none * Apply override first --------- Co-authored-by: Brent Yi <yibrenth@gmail.com>
This commit is contained in:
1 parent
570ccf3c0a
commit
cc98fb6bd4
2 files changed
+10
-13
No files matched your search
@@ -102,21 +102,18 @@ class RGBRenderer(nn.Module):
|
||||
comp_rgb = torch.sum(weights * rgb, dim=-2)
|
||||
accumulated_weight = torch.sum(weights, dim=-2)
|
||||
if BACKGROUND_COLOR_OVERRIDE is not None:
|
||||
# This case must be before the others or the override is not properly applied
|
||||
background_color = cls.get_background_color(
|
||||
BACKGROUND_COLOR_OVERRIDE, shape=comp_rgb.shape, device=comp_rgb.device
|
||||
)
|
||||
elif background_color == "random":
|
||||
background_color = BACKGROUND_COLOR_OVERRIDE
|
||||
if background_color == "random":
|
||||
# If background color is random, the predicted color is returned without blending,
|
||||
# as if the background color was black.
|
||||
return comp_rgb
|
||||
|
||||
elif background_color == "last_sample":
|
||||
# Note, this is only supported for non-packed samples.
|
||||
background_color = rgb[..., -1, :]
|
||||
background_color = cls.get_background_color(background_color, shape=comp_rgb.shape, device=comp_rgb.device)
|
||||
|
||||
assert isinstance(background_color, torch.Tensor)
|
||||
comp_rgb = comp_rgb + background_color.to(comp_rgb.device) * (1.0 - accumulated_weight)
|
||||
comp_rgb = comp_rgb + background_color * (1.0 - accumulated_weight)
|
||||
return comp_rgb
|
||||
|
||||
@classmethod
|
||||
@@ -124,13 +121,13 @@ class RGBRenderer(nn.Module):
|
||||
cls, background_color: BackgroundColor, shape: Tuple[int, ...], device: torch.device
|
||||
) -> Union[Float[Tensor, "3"], Float[Tensor, "*bs 3"]]:
|
||||
"""Returns the RGB background color for a specified background color.
|
||||
|
||||
Note:
|
||||
This function CANNOT be called for background_color being either "last_sample" or "random".
|
||||
|
||||
Args:
|
||||
rgb: RGB for each sample.
|
||||
background_color: The background color specification.
|
||||
background_color: The background color specification. If a string is provided, it must be a valid color name.
|
||||
shape: Shape of the output tensor.
|
||||
device: Device on which to create the tensor.
|
||||
|
||||
Returns:
|
||||
Background color as RGB.
|
||||
|
||||
@@ -17,7 +17,7 @@ while getopts "m:v:s" opt; do
|
||||
m ) method_name="$OPTARG" ;;
|
||||
v ) vis="$OPTARG" ;;
|
||||
s ) single=true ;;
|
||||
? ) helpFunction ;;
|
||||
? ) helpFunction ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -83,12 +83,12 @@ for dataset in "${DATASETS[@]}"; do
|
||||
--steps-per-save=1000 \
|
||||
--max-num-iterations=16500 \
|
||||
--logging.local-writer.enable=False \
|
||||
--logging.enable-profiler=False \
|
||||
--logging.profiler="none" \
|
||||
--vis "${vis}" \
|
||||
--timestamp "$timestamp" \
|
||||
${dataparser} & GPU_PID[$idx]=$!
|
||||
echo "Launched ${method_name} ${dataset} on gpu ${GPU_IDX[$idx]}, ${tag}"
|
||||
|
||||
|
||||
# update gpu
|
||||
((idx=(idx+1)%len))
|
||||
done
|
||||
|
||||
Reference in new issue
Block a user