Comfy-Org/ComfyUI · error · ValueError

MoGePanoramaInference takes a single image (got batch of {im

Error message

MoGePanoramaInference takes a single image (got batch of {image.shape[0]})

What it means

MoGePanoramaInference generates a 360 panorama from exactly one perspective image by splitting it into 12 view directions and batched inference. A batch of images has no meaningful panorama semantics, so anything other than batch size 1 is rejected up front.

Source

Thrown at comfy_extras/nodes_moge.py:116

                MoGeModelType.Input("moge_model"),
                io.Image.Input("image", tooltip="Equirectangular panorama (any aspect)."),
                io.Int.Input("resolution_level", default=9, min=0, max=9,
                             tooltip="Per-view detail (0 = fastest, 9 = most detailed)."),
                io.Int.Input("split_resolution", default=512, min=256, max=1024,
                             tooltip="Resolution of each perspective split."),
                io.Int.Input("merge_resolution", default=1920, min=256, max=8192,
                             tooltip="Long-side resolution of the merged equirect distance map."),
                io.Int.Input("batch_size", default=4, min=1, max=12,
                             tooltip="Views per inference batch (12 splits total)."),
            ],
            outputs=[MoGeGeometry.Output(display_name="moge_geometry")],
        )

    @classmethod
    def execute(cls, moge_model, image, resolution_level, split_resolution, merge_resolution, batch_size) -> io.NodeOutput:

        if image.shape[0] != 1:
            raise ValueError(f"MoGePanoramaInference takes a single image (got batch of {image.shape[0]})")

        image = image[..., :3]
        H, W = int(image.shape[1]), int(image.shape[2])
        scale = min(merge_resolution / max(H, W), 1.0)
        merge_h, merge_w = max(int(H * scale), 32), max(int(W * scale), 32)

        extrinsics, intrinsics = get_panorama_cameras()

        comfy.model_management.load_model_gpu(moge_model.patcher)
        device = moge_model.load_device
        img_chw = image[0].movedim(-1, -3).to(device=device, dtype=moge_model.dtype)
        splits = split_panorama_image(img_chw, extrinsics, intrinsics, split_resolution)

        n_views = splits.shape[0]

        # Weight each lsmr solve by 4^level so the final-resolution solve doesn't leave the bar idle.
        merge_levels: list[tuple[int, int]] = []
        w_, h_ = merge_w, merge_h

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Select a single frame before the node, e.g. with an image-index/batch-select node so shape[0] == 1.
  2. Process batches in a loop, calling the node once per image.
  3. Check the upstream loader's settings to avoid importing animations as batches.

Example fix

// before
geo = MoGePanoramaInference.execute(model, video_frames)  # batch of N

// after
from comfy_extras.nodes_images import GetImageSizeAndBatch  # or any batch selector
geo = MoGePanoramaInference.execute(model, video_frames[i:i+1])
Defensive patterns

Strategy: validation

Validate before calling

if image.shape[0] != 1:
    raise UserFacingError('panorama inference needs exactly one image')

Prevention

When it happens

Trigger: Feeding an image tensor with shape[0] > 1, e.g. a video frame batch, a multi-image batch node output, or an animated batch, into the panorama node.

Common situations: Reusing the same image source that feeds batch-aware nodes; LoadImage with a batch format (e.g. APNG/WebP); assuming the node iterates over batches like other MoGe nodes do.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/3c5a99e01579d66e. Report an issue: GitHub.