Giter Site home page Giter Site logo

ethz-asl / hfnet Goto Github PK

View Code? Open in Web Editor NEW
761.0 37.0 186.0 99.87 MB

From Coarse to Fine: Robust Hierarchical Localization at Large Scale with HF-Net (https://arxiv.org/abs/1812.03506)

License: MIT License

Python 83.53% Shell 1.75% CMake 0.08% C++ 14.62% Makefile 0.01%

hfnet's Introduction

➡️ For state-of-the-art visual localization and SfM, checkout our new toolbox hloc:
cvg/Hierarchical-Localization 🔥

HF-Net: Robust Hierarchical Localization at Large Scale

This repository accompanies our CVPR 2019 paper From Coarse to Fine: Robust Hierarchical Localization at Large Scale. We introduce a 6-DoF visual localization method that is accurate, scalable, and efficient, using HF-Net, a monolithic deep neural network for descriptor extraction. The proposed solution achieves state-of-the-art accuracy on several large-scale public benchmarks while running in real-time.

The proposed approach won the visual localization challenge of the CVPR 2019 workshop on Long-Term Visual Localization using this codebase. We also provide trained weights for HF-Net and reconstructed SfM 3D models.


Our method is significantly more robust, accurate, and scalable than standard approaches based on direct matching.

This code allows to:

  • Perform state-of-the-art 6-DoF hierarchical localization using a flexible Python pipeline
  • Train HF-Net with multi-task distillation in TensorFlow
  • Evaluate feature detectors and descriptors on standard benchmarks
  • Build Structure-from-Motion models based on state-of-the-art learned features

Setup

Python 3.6 is required. It is advised to run the following command within a virtual environment. By default, TensorFlow 1.12 GPU will be installed. You will be prompted to provide the path to a data folder (subsequently referred as $DATA_PATH) containing the datasets and pre-trained models and to an experiment folder ($EXPER_PATH) containing the trained models, training and evaluation logs, and CNN predictions. Create them wherever you wish and make sure to provide absolute paths. PyTorch 0.4.1 is also required to run the original SuperPoint and perform GPU-accelerated feature matching.

make install  # install Python requirements, setup paths

Refer to our dataset documentation for an overview of the supported datasets and their expected directory structure.

Demo

We provide a minimal example of the inference and localization with HF-Net in demo.ipynb. Download the trained model here and unpack it in $EXPER_PATH/saved_models/.


HF-Net simultaneously computes global descriptors and local features with an efficient architecture.

6-DoF Localization

We provide code to perform and evaluate our hierarchical localization on the three challenging benchmark datasets of Sattler et al: Aachen Day-Night, RobotCar Seasons, and CMU Seasons.

Required assets

Download the datasets as indicated in the dataset documentation. SfM models of Aachen, RobotCar, CMU, and Extended CMU, built SuperPoint and usable with HF-Net, are provided here. Download and unpack the HF-Net weights in $EXPER_PATH/hfnet/. To localize with NV+SP, download the network weights of NetVLAD and SuperPoint and put them in $DATA_PATH/weights/.

Exporting the predictions

We first export the local features and global descriptors for all database and query images as .npz files. For the sake of flexibility, local descriptors are exported as dense maps for database images, but as sparse samples for query images.

For HF-Net or SuperPoint:

python3 hfnet/export_predictions.py \
	hfnet/configs/[hfnet|superpoint]_export_[aachen|cmu|robotcar]_db.yaml \
	[superpoint/][aachen|cmu|robotcar] \
	[--exper_name hfnet] \ # for HF-Net only
	--keys keypoints,scores,local_descriptor_map[,global_descriptor]
python3 hfnet/export_predictions.py \
	hfnet/configs/[hfnet|superpoint]_export_[aachen|cmu|robotcar]_queries.yaml \
	[superpoint/][aachen|cmu|robotcar] \
	[--exper_name hfnet] \ # for HF-Net only
	--keys keypoints,scores,local_descriptors[,global_descriptor]

For NetVLAD:

python3 hfnet/export_predictions.py \
	hfnet/configs/netvlad_export_[aachen|cmu|robotcar].yaml \
	netvlad/[aachen|cmu|robotcar] \
	--keys global_descriptor

Localization

For Aachen:

python3 hfnet/evaluate_aachen.py \
	<sfm_model_name_or_path> \
	<eval_name>_[night|day] \
	--local_method [hfnet|superpoint|sift] \
	--global_method [hfnet|netvlad] \
	--build_db \
	--queries [night_time|day_time] \
	--export_poses

For RobotCar:

python3 hfnet/evaluate_robotcar.py \
	<sfm_model_name_or_path> \
	<eval_name> \
	--local_method [hfnet|superpoint|sift] \
	--global_method [hfnet|netvlad] \
	--build_db \
	--queries [dusk|sun|night|night-rain] \
	--export_poses

For CMU:

python3 hfnet/evaluate_cmu.py \
	<sfm_model_name_or_path> \
	<eval_name> \
	--local_method [hfnet|superpoint|sift] \
	--global_method [hfnet|netvlad] \
	--build_db \
	--slice [2|3|4|5|6|7|8|9|10|17] \
	--export_poses

The localization parameters can be adjusted in hfnet/evaluate_[aachen|robotcar|cmu].py. The evaluation logs and estimated poses are written to $EXPER_PATH/eval/[aachen|robotcar|cmu]/<eval_name>*. Of particular interest are the PnP+RANSAC success rate, the average number of inliers per query, and the average inlier ratio.

Visualization

Successful and failed queries can be visualized in notebooks/visualize_localization_[aachen|robotcar|cmu].ipynb.

Training with multi-task distillation

Instructions to train HF-Net are provided in the training documentation.

Evaluation of local features

Instructions to evaluate feature detectors and descriptors on the HPatches and SfM datasets are provided in the local evaluation documentation.

Building new SfM models

Instructions and scripts to build SfM models using COLMAP for any learned features are provided in colmap-helpers.

Citation

Please consider citing the corresponding publication if you use this work in an academic context:

@inproceedings{sarlin2019coarse,
  title={From Coarse to Fine: Robust Hierarchical Localization at Large Scale},
  author={Sarlin, Paul-Edouard and Cadena, Cesar and Siegwart, Roland and Dymczyk, Marcin},
  booktitle={CVPR},
  year={2019}
}

hfnet's People

Contributors

dymczykm avatar sarlinpe avatar skydes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hfnet's Issues

Would it be better if i fine-turn the model on my dataset?

Hi, author. thank you for your good job!I have run the hfnet for retrieval and the result is perfectly good.
But i wanna know that Would it be better if i fine-turn the model on my dataset?
i have no ground truth, learn your code, i find the GT is from NetVLAD and SuperPoint, so i'm not sure it's useful to fine-train...
thanks for your time!

Hello. About Robotcar evaluation

Hello. may I ask have you encountered the following problem?

# runing the 1st time
[07/12/2019 10:41:54 INFO] Starting to build databases: global: True, local: True
20862it [1:41:06,  3.88it/s]
Killed

# running the 2nd time
[07/12/2019 13:40:17 INFO] Importing global and local databases
Traceback (most recent call last):
  File "hfnet/evaluate_robotcar.py", line 104, in <module>
    loc = Localization('robotcar', args.model, config, build_db=args.build_db)
  File "/store/codeDemo/hfnet-master/hfnet/evaluation/localization.py", line 86, in __init__
    local_db = pickle.load(f)
EOFError: Ran out of input

Invalid argument: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [?,?,3]

Dear Author:
when I run the code (db = [hfnet.inference(i) for i in images_db]) of demo.ipynb,it report next error:InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [?,?,3]
[[{{node Placeholder}}]]
[[strided_slice_38/_587]]
(1) Invalid argument: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [?,?,3]
[[{{node Placeholder}}]]
0 successful operations.
0 derived errors ignored.
May I know how to solve this issue? Many thanks

is the global descriptor of hfnet better than netvlad?

hi author. thanks for your work.
I don't know much about knowledge distillation. As far as I understand, the student network will not outperform its teacher since it contains less parameters. But this student has multiple teachers, i.e. netvlad and superpoint. The overall loss is defined as the weight sum of individual losses. So I wonder if it can be true that the weakness of one teacher network(i.e. netvlad) can be compensated by another teacher(i.e superpoint), resulting in higher robustness and accuracy of global descriptor of hfnet than netvlad.

Aachen evaluation RAM

Hello, i have issue that there not enough RAM for /hfnet/evaluation/utils/db_management/build_localization_dbs for Aachen dataset (I have 16 gb Ram and 32 gb swap). Are there any solutions to use less ram at the moment? It really looks like leak of RAM

Modification of MobileNet V2

I find that you change the output channels of layer 6 and 7 to 64 and 128, respectively. Why are you doing this?
Thanks!

sqlite3.OperationalError: no such table: two_view_geometries

Hello, Mr. Sariln! thanks for selfless dedication.
In colmap-helpers. When I run : match_features_with_db_prior.py.
get some errors
File "match_features_with_db_prior.py", line 80, in <module> main() File "match_features_with_db_prior.py", line 39, in main args.database_file, args.min_num_matches, args.image_prefix) File "/hf_net/colmap-helpers/internal/db_matching_images.py", line 59, in get_matching_images (min_num_matches,)) sqlite3.OperationalError: no such table: two_view_geometries

Is it because this aachen.db file is new (2020.4), so this table " two_view_geometries" is not included

How to build my own sfm mode

hi, if i want to use my own data to build a new sfm mode, how to do that?
Is it in the file "colmap-helpers"? Can you say some of the details right?Thank you very much

setup problem, no files/directory from PKG-INFO

Hi,

I am trying to setup hfnet on my pc but when running make install, but I ran into the following problem

pip3 install -e setup/
Obtaining file:///mnt/c/Users/Luca/OneDrive%20-%20TUNI.fi/TTY/diplomityo/hfnet/setup
No files/directories in /mnt/c/Users/Luca/OneDrive%20-%20TUNI.fi/TTY/diplomityo/hfnet/setup (from PKG-INFO)
makefile:2: recipe for target 'install' failed
make: *** [install] Error 1

any suggestions how to fix this?

Is it suitable to train the HF-Net using other common datasets instead of Googble Landmarks/BDD?

When training HF-Net with multi-task distillation, is it feasible to train the HF-Net using some other common datasets instead of Googble Landmarks/BDD? Because we actually don't need labeled data here and is it better to train the whole HF-Net using some other data according to our application scenario?

For example, if we want to deploy it on autonomous vehicles, we could train a HF-Net using a larger training set from Kitti or RobotCar.

SfM models

Hi,

Thanks for the great work! I am just wondering are you planning to make SfM models of Aachen, RobotCar, and CMU obtained by the proposed method (and SuperPoint) publicly available at some point?

'Config' error during evaluation lfnet for hpatches.

Dear Author, during evaluation the lfnet in hpatches, I met some trouble. Just like this:

export predictions scripts:

python hfnet/export_predictions.py \
  hfnet/configs/lfnet_export_hpatches.yaml \
  lfnet/predictions_sfm

and met :

image

I have get the lfnet pretrained model and put it in correct places. How can i fix it .

Thanks!!!

dense directory is missing in sfm dataset

hi, thank you for your excellent work. it seems that only rgb images can be found in the testing sequences of sfm dataset and the "dense" directories are missing.

Training dataset

Hey, I'm wondering the way to construct training dataset. In your paper, you said that "We thus train on 185k images from the Google Landmarks dataset [34], containing a wide variety of day-time urban scenes, and 37k images from the night and dawn sequences of the Berkeley Deep Drive dataset [54], composed of road scenes with motion blur." However, I find that the images in Google Landmarks is much more than 185k as you described, it turns out 1098462 images in this dataset. So how do you pick out images in the dataset? Why not just use the whole dataset to train? Same question to the bdd dataset. Thx!

About the training process

Dear Author,
I've been confused about the training process that you calculate the detector loss using "dense_scores" from teacher model and "logits" from the student model. However, "dense_scores" is derived after a softmax function while "logits" is not. Why don't you use "prob_full" that is calculated in the local_head with softmax function which seems more reasonable? Are there any specific reasons? Looking forward to your reply.

How to do 2D-3D matching by SuperGlue?

Thanks for your working first! I noticed Hierarchical+SuperGlue won the first place in the CVPR2020's competition of Long-term localization, and this reponsitory do the 2D-3D mathing by knn+ratio test,and the SuperGlue seems to be used to do 2D-2D mathing.May I ask how to use SuperGlue to do the 2D-3D matching,should I project all the 3D map points to the current frame if I know an approximate 6-DOF pose or project all the 3D map points to the normalized plane if I don't know the 6-DOF pose.
And the second question is that erery 3D mappoint stores a distinctive descriptor,and SuperGlue needs a score with the descriptor as input.As for this 3D mappoint,should I choose the score corresponding to this distinctive descriptor or the average score of all frames where this map point is observed? Which could be better?
And the last question is that SuperGlue use all the keypoints extracted by superpoint as the input.If I randomly choose 1/10 keypoints in the first image and randomly choose 1/10 keypoints in the second image as the input.Will this affect the effect of superglue?
Thank you again for your work and look forward to your reply !

Config issue

Hello! Great work.

Just trying to follow the instruction but run into many troubles.

  1. The following instructions seems to be very similar
# instruction
Download the trained model here and unpack it in $EXPER_PATH/saved_models/.

Required assets
Download and unpack the HF-Net weights in $EXPER_PATH/hfnet/. 

After I download the hfnet from the link (https://projects.asl.ethz.ch/datasets/doku.php?id=cvpr2019hfnet) and unpack it, I only get saved_models folder. It seems like 'unpack the HF-Net weights in $EXPER_PATH/hfnet/' is unclear to me.

  1. Follow up question
# Running the command
python3 hfnet/export_predictions.py \
    'hfnet/configs/hfnet_export_aachen_db.yaml' \
    'superpoint/aachen' \
    --exper_name hfnet \
    --keys keypoints,scores,local_descriptor_map[,global_descriptor]
# Error
hfnet/export_predictions.py:30: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(f)
Traceback (most recent call last):
  File "hfnet/export_predictions.py", line 42, in <module>
    with open(Path(EXPER_PATH, exper_name, 'config.yaml'), 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'experiments/hfnet/config.yaml'

https://github.com/ethz-asl/hfnet/blob/master/hfnet/export_predictions.py#L42

with open(Path(EXPER_PATH, exper_name, 'config.yml'), 'r') as f:

It seems like there is no 'config.yml' anywhere.
So I try to find the similar file which is under the folder (https://github.com/ethz-asl/hfnet/tree/master/hfnet/configs) and I can find many '.yaml' files.
However, it is still unclear which one should I adopt in each circumstances.

Thank you

pca issue when # of query is not large enough

I am running evaluate_cmu.py for each slice of cmu datasets and I get the error shown below:

ValueError: n_components=1024 must be between 0 and min(n_samples, n_features)=446 with svd_solver='full'

Your paper indicates that you used pca_dims=1024 and do you know why it produces error when we set it to 1024 for cmu dataset?

It seems like many people encountered this issue.
I set pca_dims to 0, and it results in really bad localization results though it somehow solved the error shown above. If we set it to 0, is the global descriptor in size 4096 for both of db and queries? Can you please explain how the pca dims affect the performance?

Also, I have one more question. If HF-Net is tested on database images which were used to construct db npz files, should the localization result be 100 correct? If not, where does the error come from?

Aachen evaluation issue

Hello! Excellent work!

I was trying to follow the instruction of the Aachen localization part but run into trouble.

Running the command

python3 hfnet/export_predictions.py hfnet/configs/hfnet_export_aachen_db.yaml superpoint/aachen --exper_name hfnet --keys keypoints,scores,local_descriptor_map

Error

[02/04/2020 09:46:31 INFO] Starting to build databases: global: True, local: True
0it [00:00, ?it/s]
Traceback (most recent call last):
File "hfnet/evaluate_aachen.py", line 130, in
loc = Localization('aachen', args.model, config, build_db=args.build_db)
File "/home/yujr/hfnet-master/hfnet/evaluation/localization.py", line 67, in init
config_local=None if ok_local else config['local'])
File "/home/yujr/hfnet-master/hfnet/evaluation/utils/db_management.py", line 70, in build_localization_dbs
data['image'], data['name'], **config_global)
File "/home/yujr/hfnet-master/hfnet/evaluation/loaders.py", line 81, in export_loader
with np.load(path) as p:
File "/home/yujr/.local/lib/python3.6/site-packages/numpy/lib/npyio.py", line 428, in load
fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/yujr/hfnet-master/Exper/exports/hfnet/aachen/db/410.npz'

I am wondering where is the '410.npz' file?

By the way, I also tried to run the 'export_predictions.py', and here is part of the log,

[02/04/2020 10:11:40 INFO] Restoring parameters from /home/yujr/hfnet-master/Exper/hfnet/model.ckpt-83096
2020-02-04 10:11:44.478406: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2020-02-04 10:11:44.478482: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-04 10:11:44.478502: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2020-02-04 10:11:44.478508: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2020-02-04 10:11:44.478698: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3265 MB memory) -> physical GPU (device: 0, name: GeForce GTX 950M, pci bus id: 0000:01:00.0, compute capability: 5.0)
0it [00:00, ?it/s]2020-02-04 10:11:46.762573: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.46GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-02-04 10:11:46.785398: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
1it [00:02, 2.73s/it]2020-02-04 10:11:48.294971: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.46GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-02-04 10:11:48.317945: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2it [00:04, 2.37s/it]2020-02-04 10:11:49.836005: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.46GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-02-04 10:11:49.861545: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
4it [00:06, 1.56s/it]2020-02-04 10:11:51.696144: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.46GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-02-04 10:11:51.719383: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
6it [00:07, 1.33s/it]2020-02-04 10:11:53.328463: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.46GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-02-04 10:11:53.354390: W tensorflow/core/common_runtime/bfc_allocator.cc:211] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
4479it [19:06, 3.91it/s]

Thank you!

hfnet feature matching

Hi,can you show me a demo about the HF-Net feature match.For I want compare it with other features and demonstrate the robustness of HF-Net in varying conditions.
Looking forward your reply,thank you.

How to find the scale necessary to compute the pose accuracy ?

Hello Paul-Edouard,

Thank you for releasing the code of your paper.

I am currently trying to compute the camera pose accuracy and face the scale problem you mention in section 5.1, paragraph Datasets:
"A metric scale cannot be recovered with SfM reconstruction but is important to compute localization metrics. We therefore manually label each SfM model using metric distances measured in Google Maps."

Could you explain to me how to recover the scale in more details, please? Or point a resource that explains the steps in detail?

Thank you

About disstillation in the global descriptor

Hello, thanks for your paper! I just start to learn knowledge distillation, I want to know how to get the loss of global descriptor, does it works like get a vlad result in the student model and get another one in the teacher model(netvlad), and then calculate the MSE of them?

distilling path issue

Dear Author: in this page
https://github.com/ethz-asl/hfnet/blob/master/doc/datasets.md
google_landmarks/
├── images/
├── global_descriptors/
└── superpoint_predictions/
bdd/
├── dawn_images_vga/
├── night_images_vga/
├── global_descriptors/
└── superpoint_predictions/
The export models are under google/bdd folders.

However, with the commands in this page
https://github.com/ethz-asl/hfnet/blob/master/doc/training.md
such as python hfnet/export_predictions.py hfnet/configs/netvlad_export_distill.yaml global_descriptors --keys global_descriptor --as_dataset
the global_descriptors are place at $DATA_PATH folder instead of gooogle/bdd folder
and it cause an assertion at

assert Path(Path(DATA_PATH, im).parent,

May I know how to solve this issue? Many thanks.

hfnet inference with C++

Hi everyone, Thanks for @skydes 's great work. hf-net is a state-of-the-art method in visual localization. But the origin inference code is written with Python. I modified the inference part with c++, also provide a docker image, I guess it is more convenient integration into other projects. (slam or vio system)

The code is here:
https://github.com/TurtleZhong/hfnet_ros

Kitti dataset

Have you tried to use this for kitti dataset? It is possible at all?

Local feature matching

Hello, excellent work!
I have a minor question when I read your paper.
in the paper, "Local feature matching. For each place, we successively match the 2D keypoints detected in the query image to the 3D points contained in the place" .
May I ask that which method was adopted in the process of 2d and 3d matching ? because it only expressed as successfully matched and not mentioned matching algorithms.
Looking forward your reply.

hfnet feature matching VS colmap sift feature matching

@skydes siftAndSuperpoint
hello,as you sea ,In the picture ,the up is the result of " colmap sift feature matching ",the bottom is the result of "hfnet feature matching ". There are a lot of mismatches about hfnet feature matching .
A lot of papers show that superpoint is better than sift, so I'm confused . Am I wrong?

CUDA error "device_side assert triggered" when run localization script

Thanks for your great work!

I am currently testing the basic pipeline, I downloaded aachen data , exported global, local descriptor and feature points from hfnet as described in hfnet/export_predictions.py, everything is just ok.

well, while I continued to run the script "python3 hfnet/evaluate_aachen.py ", I got some CUDA-related error as below:
/tmp/pip-req-build-p5q91txh/aten/src/ATen/native/cuda/IndexKernel.cu:60: lambda ->auto::operator()(int)->auto: block: [3,0,0], thread: [127,0,0] Assertion index >= -sizes[i] && index < sizes[i] && "index out of bounds" failed.
Traceback (most recent call last):
File "hfnet/evaluate_aachen.py", line 137, in
loc, queries, query_dataset, max_iter=args.max_iter)
File "/home/jiangnicong/visual_place_recognition/hfnet/hfnet/evaluation/localization.py", line 215, in evaluate
result, stats = loc.localize(query_info, query_data, debug=False)
File "/home/jiangnicong/visual_place_recognition/hfnet/hfnet/evaluation/localization.py", line 160, in localize
debug_dict=matches_data)
File "/home/jiangnicong/visual_place_recognition/hfnet/hfnet/evaluation/utils/localization.py", line 96, in match_against_place
query_desc, place_desc, ratio_thresh, labels=place_lms)
File "/home/jiangnicong/visual_place_recognition/hfnet/hfnet/evaluation/utils/descriptors.py", line 111, in fast_matching
if match_ok.any():
RuntimeError: CUDA error: device-side assert triggered

Could you please tell me what's the potential problems, you help will be great appreciated.
Thanks

When re-generating SfM via superpoint, the number of pointclouds is too little so it raise some unexpected errors!

Hello, Mr. Sariln! :) First, thanks for giving these high-quality codes.

We want to employ your code on our environment, so we tested codes in the colmap-helpers on Aachen dataset before porting, yet it does not work.
Specifically, we followed the colmap-helpers instruction that written on the README.md, so tried to re-construct SfM model via superpoint, but the SfM have little pointclouds (almost 80,000 3-D points) compared to the provided SfM model (almost 680,000 3-D points).
So, I hope to get some information to generate SfM model from superpoint in detail to use it on the other dataset.
Thanks in advance!

Aachen Dataset

I download the Aachen dataset on the reference web. However, I cannot find the models folder and the corresponding contents, such as cameras.bin, images.bin, and points3D.bin. Could you tell me where to get these files? Thanks!

I have some problem in build the dependence of hloc-cpp

Dear author:

    I had some problems for many days. Could you give some advice?
    I can't build the dependence of hloc-cpp.
    My operating system is ubuntu 16.04, and I also build catkin_simple , eigen_catkin, gflags_catkin, pybind11_catkin and etc...   But some errors accured.

    1.I can't find .so files in opengv(opengv has been built), because of this, pybind11_catkin can't find opengv.
    2.My pybind11_catkin can't work. How to generate the pyd file? I can only get .so file.

How did you do it?

     By the way, whether hfNet depends on ROS-python? My python environment is built by anaconda...... Conda and ROS are difficult to work together.

      Thanks in advance!!!

ps: build details

-- Using CATKIN_DEVEL_PREFIX: /home/freedog/github/hfnet/hloc-cpp/build/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /home/freedog/anaconda3/envs/hf-net/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/freedog/github/hfnet/hloc-cpp/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /home/freedog/anaconda3/bin/nosetests
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
-- Marking HEADER FILES in "include" folder of package "hloc_cpp" for installation
-- Configuring done
-- Generating done
-- Build files have been written to: /home/freedog/github/hfnet/hloc-cpp/build

Scanning dependencies of target _hloc_cpp
[ 50%] Building CXX object CMakeFiles/_hloc_cpp.dir/src/hloc.cc.o
[100%] Linking CXX shared module devel/lib/_hloc_cpp.cpython-36m-x86_64-linux-gnu.so # can only generate .so file
[100%] Built target _hloc_cpp

Using matching method in hfnet to replace 2d-2d matching in colmap

I noticed that the matching method used in hfnet is quite efficient, it pile up the descriptors of several retrieval images into a big matrix and then match with the query descriptor matrix.after that it apply low ratio test to select valid matches. In this way, multiple database images can match with the query image in the same time.However , in colmap, when we use colmap sequential_mathcer, it only match one image pair at a time, which is slow compared to the matching method in hfnet.Is there any way to accelerate the matcher in colmap like the way hfnet did?

Error when training with my own data

Hi,

I have tried your hfnet model with my own data, and the data structure and model are similar to Aachen. However, we got an error when doing fast matching, the error is as follows:


Traceback (most recent call last):
File "evaluate_library.py", line 140, in
loc, queries, query_dataset, max_iter=args.max_iter)
File "/home/vision/Desktop/vision/hfnet/hfnet/evaluation/localization.py", line 215, in evaluate
result, stats = loc.localize(query_info, query_data, debug=False)
File "/home/vision/Desktop/vision/hfnet/hfnet/evaluation/localization.py", line 160, in localize
debug_dict=matches_data)
File "/home/vision/Desktop/vision/hfnet/hfnet/evaluation/utils/localization.py", line 96, in match_against_place
query_desc, place_desc, ratio_thresh, labels=place_lms)
File "/home/vision/Desktop/vision/hfnet/hfnet/evaluation/utils/descriptors.py", line 111, in fast_matching
labels_nn = labels[ind]
RuntimeError: index 182649 is out of bounds for dimension 0 with size 2890


The shape of labels and ind are:
labels torch.Size([2890])
ind torch.Size([365, 2])

Do you have some advice? By the way, we found that the localdb_hfnet.pkl is much larger than localdb_superpoint.pkl, is that right? Thank you

BDD dataset

Dear Author:
May I know, which BDD dataset shall be downloaded? Thank you!

Unable to load the model

It fires up the following error while trying to load the model
`

tensorflow.python.framework.errors_impl.NotFoundError: Op type not registered 'Resampler' in binary running on DESKTOP. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)tf.contrib.resampler should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.

`

initialize global descriptor

I want to use google landmark datasets for training . But i think this code looks like global descriptor needed in advance in .npz format. How can i get the Initialized global descriptor?

convert the data type of hfnet local desc from float to int8

I want to compress the hfnet local desc to int8 desc. I notice that in Colmap the normalized sift descriptor(float) is multplied by scale=512,then convert it to uint8 datatype. Now I want to do the same thing to nomalized hfnet local descriptors(convert to int8,since hfnet desc has both negative and positive values), but how to choose the scale value to maintain the most infomation of the original descriptor? I tried scale=724 and it works fine but I still didn't know the logic of choosing such a scale value.

Model Release

Thanks for your great work.
I saw that there is a closed sfm model question. Is that related this part?

"We provide SfM models of Aachen, RobotCar and CMU built with HF-Net/SuperPoint. Download and unpack the HF-Net weights in $EXPER_PATH/hfnet/"

CMU dataset

Is it possible to evaluate on the CMU dataset without downloading the Extended CMU dataset? If so, where do the sift_database.db and sift_queries.db files (as listed in the datasets documentation) for each slice exist? When I unzip the sift_descriptors files, there are individual .sift files, but I can't find the .db files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.