Skip to content

Commit 98b6bee

Browse files
authored
[Community Pipeline][Bug Fix] marigold_depth_estimation: input image value range (#6787)
[FIX] IMPORTANT: rgb normalization
1 parent ab71134 commit 98b6bee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/community/marigold_depth_estimation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ def __call__(
170170

171171
# Normalize rgb values
172172
rgb = np.transpose(image, (2, 0, 1)) # [H, W, rgb] -> [rgb, H, W]
173-
rgb_norm = rgb / 255.0
173+
rgb_norm = rgb / 255.0 * 2.0 - 1.0 # [0, 255] -> [-1, 1]
174174
rgb_norm = torch.from_numpy(rgb_norm).to(self.dtype)
175175
rgb_norm = rgb_norm.to(device)
176-
assert rgb_norm.min() >= 0.0 and rgb_norm.max() <= 1.0
176+
assert rgb_norm.min() >= -1.0 and rgb_norm.max() <= 1.0
177177

178178
# ----------------- Predicting depth -----------------
179179
# Batch repeated input image

0 commit comments

Comments
 (0)