mapillary / mapillary/OpenSfM

Error running `opensfm create_rig`

Open
#1,012 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
899
PR merge metrics
No merged PRs in 30d

Description

I have 4 cameras in a rig with camera names Left-left, Left-right, Right-left, and Right-right. The image files are named Left-left-001.png ... The camera: field exif_overrides.json is set correctly to each corresponding camera name. Normal reconstruction without considering rig runs correctly.

However, when I run opensfm create_rig data camera '{"RIG_CAMERA_ID1": "Left-left", "RIG_CAMERA_ID2": "Left-right", "RIG_CAMERA_ID3": "Right-left", "RIG_CAMERA_ID4": "Right-right"}', it shows the following info and error:

2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -79.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -33.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -228.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -58.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -204.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 4 shots for instance -96.png using pattern matching.
2023-08-11 10:47:24,678 INFO: Found 0 single shots using pattern matching.
2023-08-11 10:47:25,390 INFO: Found 2 connected components
2023-08-11 10:47:25,394 INFO: Best component has 247 instances
Traceback (most recent call last):
  File "/home/meson/Applications/src/OpenSfM/bin/opensfm_main.py", line 25, in <module>
    commands.command_runner(
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/command_runner.py", line 38, in command_runner
    command.run(data, args)
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/command.py", line 13, in run
    self.run_impl(data, args)
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/create_rig.py", line 15, in run_impl
    create_rig.run_dataset(dataset, args.method, json.loads(args.definition), True)
  File "/home/meson/Applications/src/OpenSfM/opensfm/actions/create_rig.py", line 26, in run_dataset
    rig.create_rigs_with_pattern(data, definition)
  File "/home/meson/Applications/src/OpenSfM/opensfm/rig.py", line 317, in create_rigs_with_pattern
    for subset_data, instances in propose_subset_dataset_from_instances(
  File "/home/meson/Applications/src/OpenSfM/opensfm/rig.py", line 205, in propose_subset_dataset_from_instances
    yield data.subset(name, subset_images), total_instances
  File "/home/meson/Applications/src/OpenSfM/opensfm/dataset.py", line 655, in subset
    subset_dataset = DataSet(subset_dataset_path, self.io_handler)
  File "/home/meson/Applications/src/OpenSfM/opensfm/dataset.py", line 52, in __init__
    self.load_image_list()
  File "/home/meson/Applications/src/OpenSfM/opensfm/dataset.py", line 82, in load_image_list
    raise IOError("No Images found in {}".format(image_list_path))
OSError: No Images found in data/rig_calibration/images

I could copy all images to data/rig_calibration/images first, make rig.py not to delete them then run again. But then it appears to be reconstructing all the images rather than a select subset of them.

And in the end, it fails.

2023-08-11 11:27:38,394 INFO: Some images can not be added
2023-08-11 11:27:38,394 INFO: -------------------------------------------------------
2023-08-11 11:27:38,396 INFO: Shots and/or GCPs are well-conditioned. Using naive 3D-3D alignment.
2023-08-11 11:27:38,801 INFO: Ran GLOBAL bundle in 0.36 secs.with 20/3791/14875 (3.92) shots/points/proj. (avg. length)
2023-08-11 11:27:38,802 DEBUG: Ceres Solver Report: Iterations: 6, Initial cost: 6.977387e+02, Final cost: 6.945257e+02, Termination: CONVERGENCE
2023-08-11 11:27:38,839 INFO: Removed outliers: 0
2023-08-11 11:27:38,885 INFO: Reconstruction 0: 28 images, 11431 points
2023-08-11 11:27:38,885 INFO: Reconstruction 1: 20 images, 3791 points
2023-08-11 11:27:38,885 INFO: Reconstruction 2: 9 images, 3483 points
2023-08-11 11:27:38,885 INFO: Reconstruction 3: 8 images, 4630 points
2023-08-11 11:27:38,885 INFO: Reconstruction 4: 8 images, 1237 points
2023-08-11 11:27:38,885 INFO: Reconstruction 5: 8 images, 960 points
2023-08-11 11:27:38,885 INFO: Reconstruction 6: 6 images, 2492 points
module>
    commands.command_runner(
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/command_runner.py", line 38, in command_runner
    command.run(data, args)
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/command.py", line 13, in run
    self.run_impl(data, args)
  File "/home/meson/Applications/src/OpenSfM/opensfm/commands/create_rig.py", line 15, in run_impl
    create_rig.run_dataset(dataset, args.method, json.loads(args.definition), True)
  File "/home/meson/Applications/src/OpenSfM/opensfm/actions/create_rig.py", line 26, in run_dataset
    rig.create_rigs_with_pattern(data, definition)
  File "/home/meson/Applications/src/OpenSfM/opensfm/rig.py", line 357, in create_rigs_with_pattern
    reconstructed_instances = count_reconstructed_instances(
  File "/home/meson/Applications/src/OpenSfM/opensfm/rig.py", line 398, in count_reconstructed_instances
    instances_count[instances_map[s]] -= 1
KeyError: 'Left-right-106.png'

Is this a bug or perhaps I am not using this feature correctly?

Contributor guide

Open the contributing guide

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

Start by reproducing the command and reading opensfm/actions/create_rig.py and opensfm/rig.py, especially propose_subset_dataset_from_instances and count_reconstructed_instances. Check how opensfm/dataset.py loads the subset image directory and how filenames are mapped to instances. Done means create_rig handles this four-camera naming pattern without the missing-images error or the KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.