Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues related to the example of Localization with points&lines in doc #64

Open
dansonZhang opened this issue Dec 9, 2023 · 4 comments

Comments

@dansonZhang
Copy link

Hello, first of all, thank you very much for contributing the code!

I followed the example step by step, but when I reached this python code:
python runners/7scenes/localization.py --dataset $dataset -s stairs --skip_exists --use_dense_depth --localization.optimize.loss_func TrivialLoss

The following error occurs:
[LOG] Output dir: tmp/7scenes/stairs
[LOG] Loading dir: tmp/7scenes/stairs
[LOG] weight dir: /home/danson/.limap/models
[2023/12/09 13:50:15 JointLoc INFO] Working on scene "stairs".
[2023/12/09 13:50:15 hloc INFO] Extracting local features with configuration:
{'model': {'max_keypoints': 4096, 'name': 'superpoint', 'nms_radius': 3},
'output': 'feats-superpoint-n4096-r1024',
'preprocessing': {'globs': ['*.color.png'],
'grayscale': True,
'resize_max': 1024}}
[2023/12/09 13:50:15 hloc INFO] Found 3000 images in root datasets/7scenes/stairs.
[2023/12/09 13:50:16 hloc INFO] Skipping the extraction.
[2023/12/09 13:50:17 hloc INFO] Creating the reference model.
[2023/12/09 13:50:21 hloc INFO] Kept 2000 images out of 3000.
[2023/12/09 13:50:22 hloc INFO] Matching local features with configuration:
{'model': {'name': 'superglue', 'sinkhorn_iterations': 5, 'weights': 'outdoor'},
'output': 'matches-superglue'}
[2023/12/09 13:50:22 hloc INFO] Skipping the matching.
[2023/12/09 13:50:22 hloc INFO] Matching local features with configuration:
{'model': {'name': 'superglue', 'sinkhorn_iterations': 5, 'weights': 'outdoor'},
'output': 'matches-superglue'}
[2023/12/09 13:50:22 hloc INFO] Skipping the matching.
[2023/12/09 13:50:23 hloc INFO] Correcting sfm using depth...
100%|████████████████████████████████████████████████████████████████████████████████████████████████| 2000/2000 [00:15<00:00, 131.40it/s]
[2023/12/09 13:50:39 JointLoc INFO] Running Point-only localization...
[2023/12/09 13:50:39 hloc.utils.parsers INFO] Imported 1000 images from query_list_with_intrinsics.txt
[2023/12/09 13:50:39 hloc INFO] Reading the 3D model...
[2023/12/09 13:50:39 hloc INFO] Starting localization...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:25<00:00, 38.76it/s]
[2023/12/09 13:51:05 hloc INFO] Localized 1000 / 1000 images.
[2023/12/09 13:51:05 hloc INFO] Writing poses to outputs/localization/7scenes/stairs/results_dense_point.txt...
[2023/12/09 13:51:05 hloc INFO] Writing logs to outputs/localization/7scenes/stairs/results_dense_point.txt_logs.pkl...
[2023/12/09 13:51:06 hloc INFO] Done!
[2023/12/09 13:51:06 JointLoc INFO] Coarse pose saved at outputs/localization/7scenes/stairs/results_dense_point.txt
[2023/12/09 13:51:07 hloc.pipelines.Cambridge.utils INFO] Results for file results_dense_point.txt:
Median errors: 0.047m, 1.252deg
Percentage of test images localized within:
1cm, 1deg : 2.10%
2cm, 2deg : 12.90%
3cm, 3deg : 29.10%
5cm, 5deg : 53.10%
25cm, 2deg : 68.60%
50cm, 5deg : 91.40%
500cm, 10deg : 97.10%
[2023/12/09 13:51:07 JointLoc INFO] Coarse pose read from outputs/localization/7scenes/stairs/results_dense_point.txt
[2023/12/09 13:51:08 JointLoc INFO] Running LIMAP fit&merge
[LOG] Number of images: 2000
[LOG] Output dir: tmp/7scenes/stairs
[LOG] Loading dir: tmp/7scenes/stairs
[LOG] weight dir: /home/danson/.limap/models
[LOG] Start 2D line detection and description (detector = lsd, extractor = sold2, n_images = 2000)...
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 2000/2000 [00:00<00:00, 607034.37it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████| 2000/2000 [02:17<00:00, 14.57it/s]
[LOG] Start 2D line detection and description (detector = lsd, extractor = sold2, n_images = 2000)...
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 2000/2000 [00:00<00:00, 585061.24it/s]
[LOG] Start 2D line detection and description (detector = lsd, extractor = sold2, n_images = 1000)...
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:00<00:00, 574877.19it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 2000/2000 [00:00<00:00, 593841.71it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:00<00:00, 590830.26it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:00<00:00, 299123.09it/s]
[LOG] Starting localization with points+lines...
0%| | 0/1000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/danson/Code_center/limap/runners/7scenes/localization.py", line 164, in
main()
File "/home/danson/Code_center/limap/runners/7scenes/localization.py", line 158, in main
final_poses = _runners.line_localization(
File "/home/danson/Code_center/limap/limap/runners/line_localization.py", line 207, in line_localization
final_pose, ransac_stats = _estimators.pl_estimate_absolute_pose(
File "/home/danson/Code_center/limap/limap/estimators/absolute_pose/init.py", line 26, in pl_estimate_absolute_pose
return _pl_estimate_absolute_pose(cfg, l3ds, l3d_ids, l2ds, p3ds, p2ds, camera, campose=campose,
File "/home/danson/Code_center/limap/limap/estimators/absolute_pose/_pl_estimate_absolute_pose.py", line 13, in _pl_estimate_absolute_pose
jointloc_cfg['loss_function'] = getattr(_ceresbase, jointloc_cfg['loss_func'])(*jointloc_cfg['loss_func_args'])
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. _limap._ceresbase.TrivialLoss()

Invoked with: 1.0

I need help!

@thuanaislab
Copy link

try to run only: python runners/7scenes/localization.py --dataset $dataset -s stairs --skip_exists --use_dense_depth
It will work :).

@dansonZhang
Copy link
Author

Thank you so much for answering my questions so quickly!

I tried your suggestion and it worked. But the process of "Starting localization with points+lines..." is very, very slow. 1/2000 takes about 200s, my CPU is I7-12700H.
I would like to ask, does "--localization.optimize.loss_func TrivialLoss" require the installation of a specified version of Ceres Solver to run correctly? Or what conditions do I need to meet to run "--localization.optimize.loss_func TrivialLoss"?

Thank you again for your help!

@Lin239522
Copy link

非常感谢您这么快回答我的问题!

我尝试了你的建议并且有效。但“用点+线开始定位……”的过程非常非常慢。 1/2000大约需要200s,我的CPU是I7-12700H。 我想问一下,“--localization.optimize.loss_func TrivialLoss”是否需要安装指定版本的Ceres Solver才能正确运行?或者我需要满足什么条件才能运行“--localization.optimize.loss_func TrivialLoss”?

再次感谢你的帮助!

你好,我在安装limap的时候遇到了一些问题。我看到您成功安装了,想请问关于您的环境版本,比如python、cmake、cuda、pytorch等,万分感谢您的回复!

@MarkYu98
Copy link
Collaborator

Thank you so much for answering my questions so quickly!

I tried your suggestion and it worked. But the process of "Starting localization with points+lines..." is very, very slow. 1/2000 takes about 200s, my CPU is I7-12700H. I would like to ask, does "--localization.optimize.loss_func TrivialLoss" require the installation of a specified version of Ceres Solver to run correctly? Or what conditions do I need to meet to run "--localization.optimize.loss_func TrivialLoss"?

Thank you again for your help!

To run with TrivialLoss you need to change the config localization.optimize.loss_func_args to an umpty list [] in https://github.com/cvg/limap/blob/main/cfgs/localization/7scenes.yaml. Or adding --localization.optimize.loss_func_args with an empty value might also work. This is a flaw in the config design, sorry for the confusion :(.

The slow speed might also due to your Ceres version, we observed significantly lower speed when using Ceres 2.2.0 (with the Manifold parameterization instead of quaternion parameterization). I would recommend using Ceres 2.0.0/2.1.0 for faster speed.

Sorry for the late reply :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants