progress bar

This commit is contained in:
spacepxl
2024-10-05 01:08:28 -04:00
parent 8b03754d91
commit 2d04f5fcd6
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -10,6 +10,8 @@ In order to convert metric depth to relative depth, like what's needed for contr
If you get errors about "vit_large_patch14_dinov2" make sure timm is up to date (tested with 0.9.16 and 1.0.9) If you get errors about "vit_large_patch14_dinov2" make sure timm is up to date (tested with 0.9.16 and 1.0.9)
The "(Down)Load Depth Pro model" node will auto-download the model from huggingface, but if you want to manually download it, you can download it [from here](https://huggingface.co/spacepxl/ml-depth-pro/blob/main/depth_pro.fp16.safetensors) and place it in `ComfyUI/models/depth/ml-depth-pro/`
## Example ## Example
![img](https://github.com/spacepxl/ComfyUI-Depth-Pro/blob/main/example/workflow.png) ![img](https://github.com/spacepxl/ComfyUI-Depth-Pro/blob/main/example/workflow.png)
+2 -1
View File
@@ -79,7 +79,7 @@ class DepthPro:
depth = [] depth = []
focal_px = [] focal_px = []
# add comfyui progress bar pbar = comfy.utils.ProgressBar(rgb.size(0)) if comfy.utils.PROGRESS_BAR_ENABLED else None
for i in trange(rgb.size(0)): for i in trange(rgb.size(0)):
rgb_image = rgb[i, :3].unsqueeze(0).to(device, dtype=dtype) rgb_image = rgb[i, :3].unsqueeze(0).to(device, dtype=dtype)
rgb_image = transform(rgb_image) rgb_image = transform(rgb_image)
@@ -87,6 +87,7 @@ class DepthPro:
prediction = model.infer(rgb_image) prediction = model.infer(rgb_image)
depth.append(prediction["depth"].unsqueeze(-1)) depth.append(prediction["depth"].unsqueeze(-1))
focal_px.append(prediction["focallength_px"].item()) focal_px.append(prediction["focallength_px"].item())
if pbar is not None: pbar.update(1)
depth = torch.stack(depth, dim=0).repeat(1,1,1,3) depth = torch.stack(depth, dim=0).repeat(1,1,1,3)
focal_list = focal_px focal_list = focal_px