microsoft / microsoft/MoGe

`infer_panorama.py` fails on a specific panorama image

Open
#55 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

I have encountered that running infer_panorama.py on this panorama image below fails with the following error thrown.

Image

File "/mnt/DataDisk3/satyam/MoGe/scripts/infer_panorama.py", line 273, in main
    output = model.infer(image_tensor, fov_x=fov_x, apply_mask=False)
  File "/home/visualcomputing/anaconda3/envs/MoGe/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/mnt/DataDisk3/satyam/MoGe/moge/model/moge_model.py", line 350, in infer
    _, shift = recover_focal_shift(points, None if mask is None else mask > 0.5, focal=focal)
  File "/mnt/DataDisk3/satyam/MoGe/moge/utils/geometry_torch.py", line 156, in recover_focal_shift
    optim_shift_i = solve_optimal_shift(uv_lr_i_np, points_lr_i_np, focal_np[i])
  File "/mnt/DataDisk3/satyam/MoGe/moge/utils/geometry_numpy.py", line 105, in solve_optimal_shift
    solution = least_squares(partial(fn, uv, xy, z), x0=0, ftol=1e-3, method='lm')
  File "/home/visualcomputing/anaconda3/envs/MoGe/lib/python3.10/site-packages/scipy/optimize/_lsq/least_squares.py", line 851, in least_squares
    raise ValueError("Method 'lm' doesn't work when the number of "
ValueError: Method 'lm' doesn't work when the number of residuals is less than the number of variables.

What could be the reason? I debugged and found out that uv and xyz going into solve_optimal_shift are empty tensors, maybe something to do with the masks output by the head?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from scripts/infer_panorama.py:273 and trace the inputs through moge/model/moge_model.py:350 and moge/utils/geometry_torch.py:156 into moge/utils/geometry_numpy.py:105. Inspect why the masks produce empty uv and xyz for the attached panorama; done means the cause is confirmed and the failure has defined handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.