It seems to me that the MiDaS_Depth_Approx node was supposed to work without MiDaS model explicitly loaded, but when attempting to do so, the script throws an error:
WAS Node Suite: Loading MiDaS Model from `ComfyUI\models\midas\checkpoints\dpt_large_384.pt`
Using cache found in ComfyUI\models\midas\intel-isl_MiDaS_master
!!! Exception during processing!!! Cannot find callable ComfyUI\models\midas\checkpoints\dpt_large_384.pt in hubconf
Traceback (most recent call last):
File "ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "ComfyUI\custom_nodes\was-node-suite-comfyui\WAS_Node_Suite.py", line 8768, in midas_approx
midas = torch.hub.load("intel-isl/MiDaS", midas_type, trust_repo=True)
File "ComfyUI\venv\lib\site-packages\torch\hub.py", line 566, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "ComfyUI\venv\lib\site-packages\torch\hub.py", line 594, in _load_local
entry = _load_entry_from_hubconf(hub_module, model)
File "ComfyUI\venv\lib\site-packages\torch\hub.py", line 348, in _load_entry_from_hubconf
raise RuntimeError(f'Cannot find callable {model} in hubconf')
RuntimeError: Cannot find callable ComfyUI\models\midas\checkpoints\dpt_large_384.pt in hubconf
At line 8753 there's a check for midas_model which in this case is none and the check should be performed against midas_type instead. Then, at 8765 midas_type gets overwritten by model_path and I have no idea why. Finally, at 8768 the model tries to get loaded using the recently wrongly overwritten midas_type which leads to the error.
With some quick/stupid edits (mainly reusing portions of MiDaS_Background_Foreground_Removal) I could get it working, but then it throws new error at 8813 because midas gets deleted twice.
I know it makes sense to load the MiDaS model separately, I was mainly wondering why the discrepancy between MiDaS_Background_Foreground_Removal (which loads midas internally) and MiDaS_Depth_Approx.
It seems to me that the
MiDaS_Depth_Approx
node was supposed to work without MiDaS model explicitly loaded, but when attempting to do so, the script throws an error:Looking at the code, specifically in this section: https://github.com/WASasquatch/was-node-suite-comfyui/blob/587ad8cbcb287027152f635eed0bd8047a9cb956/WAS_Node_Suite.py#L8710-L8768
At line 8753 there's a check for
midas_model
which in this case isnone
and the check should be performed againstmidas_type
instead. Then, at 8765midas_type
gets overwritten bymodel_path
and I have no idea why. Finally, at 8768 the model tries to get loaded using the recently wrongly overwrittenmidas_type
which leads to the error.With some quick/stupid edits (mainly reusing portions of
MiDaS_Background_Foreground_Removal
) I could get it working, but then it throws new error at 8813 becausemidas
gets deleted twice.I know it makes sense to load the MiDaS model separately, I was mainly wondering why the discrepancy between
MiDaS_Background_Foreground_Removal
(which loadsmidas
internally) andMiDaS_Depth_Approx
.Not a programmer, apologies if this is stupid.