Repository navigation
Description
Hello. Firstly congrats on this great work and thanks for sharing the code.
I have an indoor picture dataset consisting of 247 images each 9248x6936 pixels and taken with the same camera with the same settings.
I am trying to run a pipeline based on your Aachen_v1_1 pipeline using loFTR in order to increase the completeness of my point cloud (total number of 3d points). However, I keep getting the error given below in various different configurations while some configurations works smoothly.
For example:
- When I use "loftr" as dense matcher with "netvlad" as feature extractor, I get the same array error below when I use "indoor" weights but it works fine when I set the weights as "outdoor" although it is an indoor picture set.
- When I use "loftr_superpoint" as dense matcher with "superpoint_max_ as feature extractor, I get the same array error below if I set both "max_error" and "cell_size" to "1" or "2". However if I leave them both as "4" it works fine.
- When I use "loftr_superpoint" as dense matcher with "superpoint_max" as feature extractor, setting both "max_error" and "cell_size" to 4 but changing "Number of image pairs for SfM" and
"Number of image pairs for loc" to 40 and 100, respectively gives me the same array error. Or just changing "Number of image pairs for SfM" from 20 to 40 causing the same error.
Since changes in different settings causing the same error, I cannot pinpoint what the actual reason can be. The only pattern I can see, whenever I change the settings in a way to increase the accuracy and completeness I start to get the same error.
The error is as follows:
[2022/12/01 23:18:34 hloc INFO] Importing matches into the database...
5%| | 250/4893 [00:00<00:02, 1578.48it/s]
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/paperspace/pixel-perfect-sfm/Hierarchical-Localization/hloc/pipelines/NEWbedroom02/pipeline.py", line 45, in
triangulation.main(
File "/home/paperspace/pixel-perfect-sfm/Hierarchical-Localization/hloc/triangulation.py", line 224, in main
import_matches(image_ids, database, pairs, matches,
File "/home/paperspace/pixel-perfect-sfm/Hierarchical-Localization/hloc/triangulation.py", line 90, in import_matches
matches, scores = get_matches(matches_path, name0, name1)
File "/home/paperspace/pixel-perfect-sfm/Hierarchical-Localization/hloc/utils/io.py", line 69, in get_matches
matches = np.stack([idx, matches[idx]], -1)
File "<array_function internals>", line 180, in stack
File "/home/paperspace/.local/lib/python3.8/site-packages/numpy/core/shape_base.py", line 426, in stack
raise ValueError('all input arrays must have the same shape')
ValueError: all input arrays must have the same shape
Your help is much appreciated.
Activity
sarlinpe commentedon Dec 5, 2022
Can you replace
Hierarchical-Localization/hloc/utils/io.py
Line 69 in 7e6551d
with
so we can better understand what is happening here?
cc @Phil26AT in case you have any idea. Maybe related to #241.
paxabledev commentedon Dec 7, 2022
Thanks a lot for the prompt response. Below is the summary of the first configuration I mentioned above and output after modifying io.py as suggested. I will be running second and the third configs mentioned above and updating shortly.
/pipeline.py
--Number of image pairs for SfM 20
--Number of image pairs for loc 50
--max_kps 8192
/extract_features.py
--resize_max 512
--interpolation pil_linear
/match_dense.py
--weights outdoor(*)
--resize_max 512
--max_error 1
--cell_size 1
(*): When I change weights to 'indoor', it runs with no error in this config case.
paxabledev commentedon Dec 7, 2022
/pipeline.py
--Number of image pairs for SfM 20
--Number of image pairs for loc 50
--max_kps 8192
/extract_features.py
--resize_max 1024
--interpolation pil_linear
/match_dense.py
--weights outdoor
--resize_max 1024
--max_error 2 ( * )
--cell_size 2 ( * )
( * ): When I set max_error and cell_size 2 and 2 or 1 and 1 respectively it fails with the same error but on a different image of the set. If I set them 4 and 4 it runs with no error in this config case.
paxabledev commentedon Dec 7, 2022
/pipeline.py
--Number of image pairs for SfM 40 ( * )
--Number of image pairs for loc 50
--max_kps 8192
/extract_features.py
--resize_max 1024
--interpolation pil_linear
/match_dense.py
--weights outdoor
--resize_max 1024
--max_error 4
--cell_size 4
( * ): When I set "Number of image pairs for SfM" to 40 it fails as below yet at another image. With 20 it runs normally. Also as another combination, I tried to keep "Number of image pairs for SfM" as 40 and increased "resize_max" from 1024 to 2048. This time it ran normally,too. I hope you can spot the problem and advise for a workaround. Thanks in advance.
sarlinpe commentedon Dec 7, 2022
Thanks for the detailed logs. Can you please try PR #254? Please remove existing match and features files beforehand.
paxabledev commentedon Dec 8, 2022
Hello,
I ran the first configuration again with "indoor" weights which was the failed case. It passed the previous stage. However, it failed again with a different type of array error at a different stage. Copying the output below.
Also I noticed that -as a side question- indoor weight produced far more less (only 1855) 3D points, while using outdoor weights produces 34013 points during 3D reconstruction. The image set belongs to an indoor area (a simple bedroom), so I would expect the number to be higher when "indoor" weights used. Is this an expected behavior?
sarlinpe commentedon Dec 8, 2022
I recommend to always use outdoor weights, regardless of the type of environment. The indoor model likely overfits to the camera statistics of the ScanNet dataset.
Regarding your error: what are you trying to achieve? do you have query images to localize? If not, all steps after the triangulation/reconstruction are irrelevant and should be discarded from the original pipeline. This simply fails because it cannot find query images with the prefix
query.paxabledev commentedon Dec 11, 2022
Thanks for the explanation. I have gone through it and understood it better. I have also run the other 2 config cases and they are working fine. I believe this issue can be closed.
I have 2 off-topic questions if you don't mind answering, though.
( * ) https://github.com/Tangshitao/QuadTreeAttention
( ** ) https://www.kaggle.com/competitions/image-matching-challenge-2022/discussion/328805
sarlinpe commentedon Dec 13, 2022
Thanks for confirming that everything works.