mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-28 01:47:32 +08:00
Improve and correct error logging for mono/multi-view.
This commit is contained in:
parent
ddb8739963
commit
7cb2394630
@ -172,8 +172,8 @@ class DepthAnything3Inference(io.ComfyNode):
|
|||||||
tooltip="- upper_bound_resize: scale so the longest side = process_res (caps memory, default).\n"
|
tooltip="- upper_bound_resize: scale so the longest side = process_res (caps memory, default).\n"
|
||||||
"- lower_bound_resize: scale so the shortest side = process_res (preserves more detail on tall/wide images, uses more memory)."),
|
"- lower_bound_resize: scale so the shortest side = process_res (preserves more detail on tall/wide images, uses more memory)."),
|
||||||
io.DynamicCombo.Input("mode",
|
io.DynamicCombo.Input("mode",
|
||||||
tooltip="- mono: single image or independent batch — use with any model.\n"
|
tooltip="- mono: single image or independent batch — works with any model variant.\n"
|
||||||
"- multiview: all frames processed together with cross-view attention for geometric consistency; also outputs camera pose — requires DA3-Small or DA3-Base.",
|
"- multiview: all frames processed together for geometric consistency + camera pose — requires DA3-Small or DA3-Base (DA3-Mono-Large / DA3-Metric-Large do NOT support this mode).",
|
||||||
options=[
|
options=[
|
||||||
io.DynamicCombo.Option("mono", []),
|
io.DynamicCombo.Option("mono", []),
|
||||||
io.DynamicCombo.Option("multiview", [
|
io.DynamicCombo.Option("multiview", [
|
||||||
@ -188,8 +188,9 @@ class DepthAnything3Inference(io.ComfyNode):
|
|||||||
io.Combo.Input("pose_method",
|
io.Combo.Input("pose_method",
|
||||||
options=["cam_dec", "ray_pose"],
|
options=["cam_dec", "ray_pose"],
|
||||||
default="cam_dec",
|
default="cam_dec",
|
||||||
tooltip="- cam_dec: small MLP on the final camera token (DA3-Small/Base).\n"
|
tooltip="- cam_dec: small MLP on the final camera token — works on DA3-Small and DA3-Base.\n"
|
||||||
"- ray_pose: RANSAC over the DualDPT ray output (DA3-Small/Base only)."),
|
"- ray_pose: RANSAC over the DualDPT ray output — works on DA3-Small and DA3-Base.\n"
|
||||||
|
"Both methods require DA3-Small or DA3-Base; this setting is ignored on Mono/Metric-Large."),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
@ -208,22 +209,33 @@ class DepthAnything3Inference(io.ComfyNode):
|
|||||||
if mode_val == "mono":
|
if mode_val == "mono":
|
||||||
return cls._execute_mono(da3_model, image, process_res, resize_method)
|
return cls._execute_mono(da3_model, image, process_res, resize_method)
|
||||||
|
|
||||||
# Capability checks for multi-view pose.
|
# Capability checks for multi-view mode.
|
||||||
diffusion = da3_model.model.diffusion_model
|
diffusion = da3_model.model.diffusion_model
|
||||||
pose_method = mode["pose_method"]
|
pose_method = mode["pose_method"]
|
||||||
ref_view_strategy = mode["ref_view_strategy"]
|
ref_view_strategy = mode["ref_view_strategy"]
|
||||||
|
|
||||||
if pose_method == "cam_dec" and diffusion.cam_dec is None:
|
has_cam_dec = diffusion.cam_dec is not None
|
||||||
|
has_dualdpt = diffusion.head_type == "dualdpt"
|
||||||
|
|
||||||
|
if not has_cam_dec and not has_dualdpt:
|
||||||
|
raise ValueError(
|
||||||
|
"multiview mode requires DA3-Small or DA3-Base — the loaded model "
|
||||||
|
f"(head_type='{diffusion.head_type}') does not support cross-view "
|
||||||
|
"attention or camera pose estimation. Switch mode to 'mono', or "
|
||||||
|
"load DA3-Small / DA3-Base for multiview."
|
||||||
|
)
|
||||||
|
|
||||||
|
if pose_method == "cam_dec" and not has_cam_dec:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"pose_method='cam_dec' requires a camera decoder, but the loaded "
|
"pose_method='cam_dec' requires a camera decoder, but the loaded "
|
||||||
"model does not have one. Load a model with a camera decoder "
|
f"model (head_type='{diffusion.head_type}') does not have one. "
|
||||||
"(e.g. DA3-Small or DA3-Base), or set pose_method='ray_pose'."
|
"Use pose_method='ray_pose' instead."
|
||||||
)
|
)
|
||||||
if pose_method == "ray_pose" and diffusion.head_type != "dualdpt":
|
if pose_method == "ray_pose" and not has_dualdpt:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"pose_method='ray_pose' requires a DualDPT head, but the loaded "
|
"pose_method='ray_pose' requires a DualDPT head, but the loaded "
|
||||||
"model has a DPT head. Load a model with a DualDPT head "
|
f"model has a '{diffusion.head_type}' head. "
|
||||||
"(e.g. DA3-Small or DA3-Base), or set pose_method='cam_dec'."
|
"Use pose_method='cam_dec' instead."
|
||||||
)
|
)
|
||||||
|
|
||||||
return cls._execute_multiview(
|
return cls._execute_multiview(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user