NightRaven109 commited on
Commit
3dffb99
·
verified ·
1 Parent(s): 0e0fa12

Update infer.py

Browse files
Files changed (1) hide show
  1. infer.py +3 -2
infer.py CHANGED
@@ -64,10 +64,11 @@ def infer_pipe(pipe, test_image, task_name, seed, device, video_depth=False):
64
  task_emb=task_emb,
65
  ).images[0]
66
 
67
- # Post-process the prediction
68
  if task_name == 'depth':
69
  output_npy = pred.mean(axis=-1)
70
- output_color = colorize_depth_map(output_npy, reverse_color=True)
 
71
  else:
72
  output_npy = pred
73
  output_color = Image.fromarray((output_npy * 255).astype(np.uint8))
 
64
  task_emb=task_emb,
65
  ).images[0]
66
 
67
+ # NEW CODE:
68
  if task_name == 'depth':
69
  output_npy = pred.mean(axis=-1)
70
+ depth_normalized = ((output_npy - output_npy.min()) / (output_npy.max() - output_npy.min()) * 255).astype(np.uint8)
71
+ output_color = Image.fromarray(depth_normalized, mode='L')
72
  else:
73
  output_npy = pred
74
  output_color = Image.fromarray((output_npy * 255).astype(np.uint8))