mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.27k stars 843 forks source link

Docker Kubernetes FileNotFoundError: [Errno 2] No such file or directory: './images/undistorted/reconstruction.json' #831

Closed walter-morawa closed 2 years ago

walter-morawa commented 2 years ago

Hello All,

I am happy to say that I almost have set up a kubernetes backend to run OpenSfM! (I'd attach the link, but I don't want to be spammy.) The logs show that features are being detected, and matched but failing at the depth reconstruction stage. What am I doing wrong? I have attached the logs. Is this a simple permissions error, where I need to create a file? Or did I install the docker image incorrectly? I just used the ceres2 docker image, with gsutil added on. There appear to be plenty of matches across these 10 images.

I also confirmed that I am putting images in the correct folder. So, the issue is with 0 partial reconstructions made, even though there are plenty of features and matches.

Edit: After further testing, I realized that the docker container is in fact able to run the berlin sample dataset. So it has something to do with my dataset or config files perhaps? My config.yaml is pretty simple and there is nothing else in the folder but the images. Here are my images, you can see there is plenty of overlap and should be no problem matching for OpenSfM: https://drive.google.com/drive/folders/1AJfmACkQZbLZC4B63yjSIzes8FEY4U__?usp=sharing

# CONFIG.YAML
processes: 32                 # Number of threads to use
depthmap_min_consistent_views: 2      # Min number of views that should reconstruct a point for it to be valid
depthmap_save_debug_files: no         # Save debug files with partial reconstruction results
feature_process_size: 1024
bundle_use_gcp: yes

feature_type: AKAZE
feature_min_frames: 10000
akaze_dthreshold: 0.00001 
021-12-11 04:46:17,508 DEBUG: Computing AKAZE with threshold 9.999999747378752e-06
2021-12-11 04:46:17,509 DEBUG: Computing AKAZE with threshold 9.999999747378752e-06
2021-12-11 04:46:17,606 DEBUG: Computing AKAZE with threshold 9.999999747378752e-06
Keeping 10000 out of 18292
(*) Time Scale Space: 207.146
(*) Time Detector: 1200.19
   - Time Derivatives: 39.8956
   - Time Extrema: 1121.45
   - Time Subpixel: 3.47004
(*) Time Descriptor: 103.122
2021-12-11 04:46:18,280 DEBUG: Found 9958 points in 1.515587329864502s
2021-12-11 04:46:18,296 DEBUG: No segmentation for DJI_0007.JPG, no features masked.
Keeping 10000 out of 18649
Keeping 10000 out of 19660
Keeping 10000 out of 19216
(*) Time Scale Space: 234.86
(*) Time Detector: 1277.26
   - Time Derivatives: 40.139
   - Time Extrema: 1213.01
2021-12-11 04:46:23,729 DEBUG: Matching DJI_0004.JPG and DJI_0006.JPG.  Matcher: FLANN (symmetric) T-desc: 0.577 T-
robust: 0.045 T-total: 0.624 Matches: 1507 Robust: 1456 Success: True
2021-12-11 04:46:23,736 INFO: Matched 45 pairs (perspective-perspective: 45) in 2.7554057790002844 seconds (0.06123
125257777752 seconds/pair).
2021-12-11 04:46:26,126 INFO: reading features
2021-12-11 04:46:26,371 DEBUG: Merging features onto tracks
2021-12-11 04:46:26,696 DEBUG: Good tracks: 17484
2021-12-11 04:46:28,667 INFO: Starting incremental reconstruction
2021-12-11 04:46:28,988 INFO: 0 partial reconstructions in total.
Traceback (most recent call last):
  File "/source/OpenSfM/bin/opensfm_main.py", line 25, in <module>
    commands.command_runner(
  File "/source/OpenSfM/opensfm/commands/command_runner.py", line 37, in command_runner
    command.run(data, args)
  File "/source/OpenSfM/opensfm/commands/command.py", line 12, in run
    self.run_impl(data, args)
  File "/source/OpenSfM/opensfm/commands/compute_depthmaps.py", line 11, in run_impl
    compute_depthmaps.run_dataset(dataset, args.subfolder, args.interactive)
  File "/source/OpenSfM/opensfm/actions/compute_depthmaps.py", line 20, in run_dataset
    reconstructions = udataset.load_undistorted_reconstruction()
  File "/source/OpenSfM/opensfm/dataset.py", line 932, in load_undistorted_reconstruction
    with self.io_handler.open_rt(filename) as fin:
  File "/source/OpenSfM/opensfm/io.py", line 1372, in open_rt
    return cls.open(path, "r", encoding="utf-8")
  File "/source/OpenSfM/opensfm/io.py", line 1364, in open
    return open(*args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: './images/undistorted/reconstruction.json'
walter-morawa commented 2 years ago

I ran python3 -m pytest && cd cmake_build && ctest && cd - to see if there was something set up incorrectly on my docker image/container, but all tests passed.

opensfm/test/test_multiview.py .........
opensfm/test/test_pairs_selection.py .........
opensfm/test/test_reconstruction_alignment.py ........
opensfm/test/test_reconstruction_incremental.py ..
opensfm/test/test_reconstruction_resect.py ..
opensfm/test/test_reconstruction_shot_neighborhood.py ......
opensfm/test/test_reconstruction_triangulation.py .
opensfm/test/test_rig.py ..
opensfm/test/test_robust.py .............
opensfm/test/test_stats.py ..............
opensfm/test/test_triangulation.py .....
opensfm/test/test_types.py ...........
opensfm/test/test_undistort.py .
opensfm/test/test_vlad.py ...
opensfm/test/large/test_tools.py .
=========================================== 251 passed in 173.58 seconds ===========================================
Test project /source/OpenSfM/cmake_build
    Start 1: foundation_test
1/7 Test #1: foundation_test ..................   Passed    0.01 sec
    Start 2: bundle_test
2/7 Test #2: bundle_test ......................   Passed    0.01 sec
    Start 3: dense_test
3/7 Test #3: dense_test .......................   Passed    0.01 sec
    Start 4: geo_test
4/7 Test #4: geo_test .........................   Passed    0.01 sec
    Start 5: geometry_test
5/7 Test #5: geometry_test ....................   Passed    0.07 sec
    Start 6: sfm_test
6/7 Test #6: sfm_test .........................   Passed    0.01 sec
    Start 7: map_test
7/7 Test #7: map_test .........................   Passed    0.02 sec
100% tests passed, 0 tests failed out of 7
Total Test time (real) =   0.14 sec
fabianschenk commented 2 years ago

Hi @waltermorawa ,

Thanks for using OpenSfM. I seems you installed the docker correctly and that this is not not a permissions issue. You see the error message about the reconstruction.json because you have "0 partial reconstruction" and no reconstruction.json is stored. See your output:

2021-12-11 04:46:28,667 INFO: Starting incremental reconstruction
2021-12-11 04:46:28,988 INFO: 0 partial reconstructions in total.

The problem is that OpenSfM is not able to triangulate the points, which could have several issues. Here are a two things you could try/check: 1) Use HAHOG (the default features) instead of Akaze. We exclusively use HAHOG for all our reconstructions, so if this does not work, then we can digger more into the problem. 2) Check the GPS of the image. If the GPS of the image is the same for all images, this could also lead to problems.

Note: For faster tests, you could try to find a set of ~3 images with reasonable baseline and run on them instead of on all of them.

Good luck