huntrezz commited on
Commit
001bc7d
·
verified ·
1 Parent(s): a67ce24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -48,10 +48,9 @@ def process_frame(image):
48
  predicted_depth = model(input_tensor).predicted_depth
49
  depth_map = predicted_depth.squeeze()
50
 
51
- # Discretization on GPU
52
- num_bins = 256 # Match the color_map size
53
- depth_map = torch.quantile(depth_map, torch.linspace(0, 1, num_bins, device=device))
54
- depth_map = torch.bucketize(depth_map.squeeze(), depth_map)
55
 
56
  depth_map_colored = color_map[depth_map]
57
 
 
48
  predicted_depth = model(input_tensor).predicted_depth
49
  depth_map = predicted_depth.squeeze()
50
 
51
+ # Normalize depth map to [0, 255] range
52
+ depth_map = (depth_map - depth_map.min()) / (depth_map.max() - depth_map.min())
53
+ depth_map = (depth_map * 255).byte()
 
54
 
55
  depth_map_colored = color_map[depth_map]
56