Giter Club home page Giter Club logo

pixel-perfect-sfm's People

Contributors

ahmed-shariff avatar phil26at avatar prajwalchidananda avatar sarlinpe avatar skydes avatar spacycoder avatar tangshengku avatar thomasparistech avatar totorro35 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pixel-perfect-sfm's Issues

Scale of Cauchy loss

Hello,

What is the rationale behind setting the scale of Cauchy loss to 0.25, have you tested different values?

Tanks and Temples eval?

Hi, Thanks for making this code available, and especially for the pycolmap improvements-- those have been needed for a very long time and the effort will have a big impact.

Have you evaluated this method on Tanks and Temples (or considered doing so) ? The object-centric scenes are a perhaps bit different-- there is perhaps more range of depth and background keypoints have less support (fewer images). If not, do you see more relevance with ETH3D?

Specify Camera Model?

I would like to specify the camera model for the reconstruction model. I've seen pycolmap accepts a camera_model parameter in its import_images function , which is called by hloc's import_images. In PixSfM it seems we can pass arguments for hloc's main, but hloc only knows how to manage camera_mode and not camera_model.

If I, for instance, would like to create and refine end-to-end a reconstruction with camera model OPENCV using (using hloc and not colmap). How should I do it?

PS: I could be posting this on hloc's issues, but since using pixsfm is my end goal maybe there is a better way to do it from here, that I'm not seeing.

Thank you!

[Announcements] Code release

Hit the subscribe button on the right of this issue if you wish to be notified of the code release. Please do not reply to this issue to not spam other subscribers. Please do not contact us to ask for early-access to the code.

cannot get s2dnet_weights.pth

when refiner = PixSfM(),

super(_open_file, self).init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/home/ai/workspace/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth'

Very sparse images matched incorrectly

I have been trying to locate the camera positions for this very challenging dataset. It is a 360 from a sofa with very little texture and views are very sparse. I can only get 10 cameras poses, whether with COLMAP or pixsfm. The successful ones are frontal, while the laterals and rear ones fail.

In other software(COLMAP), I've been trying to constraint the matching only to the images described by a manually made image_pairs.txt in order to enforce that the images match to the ones I want. I would like to try the same with pixsfm, but even though I see refiner.reconstruction accepts a list_of_image_pairs, the matching seems to happen before.

I assume I need to create image pairs with pairs_from_* but I can't seem to find one that accepts an input text.

I could also find a way to manually create guesstimated priors to correctly initialize optimization, but I don't know of an easy way to do this.

I have other datasets of very shiny objects with which I get into similar problems. What would you recommend doing?

Thank you very much in advance!

glibcxx error (via conda on Arch)

As shown below, glibcxx 3.4.29 is required but not found on my system, presumably because conda 4.11.0 (the latest version for Arch at the time of writing) does not include this.

strings /usr/lib/libstdc++.so.6 | grep GLIBCXX_3.4.29 returns:

GLIBCXX_3.4.29
GLIBCXX_3.4.29

I created a new symbolic link from the conda lib path to the system lib shown above:
ln -s /usr/lib/libstdc++.so.6 ./libstdc++.so.6

However it seems conda cannot locate the above, as below:

Python (3.8.12) invocation follows:

Python 3.8.12 (default, Oct 12 2021, 13:49:34)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pixsfm.refine_hloc import PixSfM
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kevin/pixel-perfect-sfm/pixsfm/__init__.py", line 16, in <module>
from ._pixsfm import *  # noqa F403
ImportError: /home/kevin/anaconda3/envs/pixSfM/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /home/kevin/pixel-perfect-sfm/pixsfm/_pixsfm.cpython-38-x86_64-linux-gnu.so)

build failed: pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o

Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o
In file included from /work/pixel-perfect-sfm/pixsfm/keypoint_adjustment/src/featuremetric_keypoint_optimizer.h:8:0,
from /work/pixel-perfect-sfm/pixsfm/keypoint_adjustment/bindings.cc:8:
/work/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:90:6: error: prototype for ‘std::unordered_map<long unsigned int, decltype (static_cast<Optimizer*>(nullptr)->.RunSubset<Ns ...>(((pixsfm::ParallelOptimizer<Optimizer, idx_t>)this)->pixsfm::ParallelOptimizer<Optimizer, idx_t>::dummy, pixsfm::ParallelOptimizer::RunParallel::parameters ...))> pixsfm::ParallelOptimizer<Optimizer, idx_t>::RunParallel(std::vector, Param& ...)’ does not match any in class ‘pixsfm::ParallelOptimizer<Optimizer, idx_t>’
auto ParallelOptimizer<Optimizer, idx_t>::RunParallel(
^
/work/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:78:8: error: candidate is: template<class Optimizer, class idx_t> template<int ...Ns, class ... Param> std::unordered_map<long unsigned int, decltype (static_cast<Optimizer
>(nullptr)->.RunSubset<Ns ...>(((pixsfm::ParallelOptimizer<Optimizer, idx_t>*)this)->pixsfm::ParallelOptimizer<Optimizer, idx_t>::dummy, pixsfm::ParallelOptimizer::RunParallel::parameters ...))> pixsfm::ParallelOptimizer<Optimizer, idx_t>::RunParallel(std::vector, Param& ...)
auto RunParallel(std::vector problem_labels, Param&... parameters)
^
pixsfm/CMakeFiles/pypixsfm.dir/build.make:134: recipe for target 'pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o' failed


gcc -v
gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu8~16.04.1)

Costmap containers crash if some images have no observations

Error described in #17 with data from https://github.com/ThomasParistech/test_pixsfm. Following error message with all debug enabled:

[2022/01/28 08:47:50 pixsfm INFO] Extracting references and costmaps.
Segmentation fault (core dumped)

According to @ThomasParistech and faulthandler the crash occurs in:

# Extracts the reference for each point3D using IRLS, then
# computes costmaps for each observation. A costmap is the pixel-wise
# difference of a local featuremap towards its reference.
costmap_fset, references = ce.run(problem_labels, reconstruction,
feature_set, ref_extractor)

colmap::BundleAdjustmentOptions in bundle_optimizer_test.cc

Hello, thanks for your amazing work for using the learning technique to improve the accuracy of SfM !

There is no definition of colmap::BundleAdjustmentOptions in bundle_optimizer_test.cc, I found the definition of colmap::BundleAdjustmentOptions is in colmap.

When I use CMake to compile the the project, I just comment the line of #PIXSFM_ADD_TEST(bundle_optimizer_test src/bundle_optimizer_test.cc) of pixsfm/bundle_adjustment/CMakeLists.txt. There is no error in compilation.

The requirement of pycolmap is installed, but I don't know colmap is necessary to run the pixsfm.

[HOW TO] Serialize References obtained during BA

I first run a triangulation with Bundle Adjustment on my PixSfM model and then call the QueryLocalizer to localize an image within it.

However, (for specific reasons) I need to do this in two separate Python runs but want to avoid the computational cost of re-extracting the features references at the QueryLocalizer init.

Here's what I do:

reconstruction, outputs = refiner.triangulation(...

...

reconstruction = pycolmap.Reconstruction(model_folder)
feature_manager_path = Path(model_folder) / "s2dnet_featuremaps_sparse.h5"
dense_features = load_features_from_cache(feature_manager_path)
localizer = QueryLocalizer(reconstruction, conf, dense_features=dense_features)

I'd prefer to use the constructor below directly to skip the redundant extraction. But I don't see how to serialize the references I got during triangulation: outputs["BA"]["references"]

QueryLocalizer(conf, reconstruction, references=references)

The bindings don't provide a constructor for "Reference" and its attributes aren't pickable.

Do you have any advice?

Many thanks :)

Question of Fig.4 in paper

This is exciting work. How was the correlation map in Figure 4 calculated?

image

Was it computed using normalized cross-correlation (NCC)? If so, here's a question: Deep features may be 128-dimensional, while the reference image is a 1-dimensional greyscale map. How did they compute the correlation map?

Recursive cloning

I'm receiving a 'permission denied' error from github when checking out pixSfM with the public key:

git clone https://github.com/cvg/pixel-perfect-sfm --recursive

Cloning without the --recursive switch executes fine. The shell output is below:

Cloning into 'pixel-perfect-sfm'...
remote: Enumerating objects: 258, done.
remote: Counting objects: 100% (258/258), done.
remote: Compressing objects: 100% (212/212), done.
remote: Total 258 (delta 44), reused 245 (delta 39), pack-reused 0
Receiving objects: 100% (258/258), 9.13 MiB | 1.30 MiB/s, done.
Resolving deltas: 100% (44/44), done.
Submodule 'third-party/HighFive' ([email protected]:Phil26AT/HighFive.git) registered for path 'third-party/HighFive'
Submodule 'third-party/pybind11' ([email protected]:pybind/pybind11.git) registered for path 'third-party/pybind11'
Cloning into '/home/kevin/pixel-perfect-sfm/third-party/HighFive'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:Phil26AT/HighFive.git' into submodule path '/home/kevin/pixel-perfect-sfm/third-party/HighFive' failed
Failed to clone 'third-party/HighFive'. Retry scheduled
Cloning into '/home/kevin/pixel-perfect-sfm/third-party/pybind11'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:pybind/pybind11.git' into submodule path '/home/kevin/pixel-perfect-sfm/third-party/pybind11' failed
Failed to clone 'third-party/pybind11'. Retry scheduled
Cloning into '/home/kevin/pixel-perfect-sfm/third-party/HighFive'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:Phil26AT/HighFive.git' into submodule path '/home/kevin/pixel-perfect-sfm/third-party/HighFive' failed
Failed to clone 'third-party/HighFive' a second time, aborting

error running demo.ipynb

I run it on ubnutu18, cuda11.2

but when i preceed :
"
# run pixsfm
sfm = PixSfM({"dense_features": {"max_edge": 1024}})
refined, sfm_outputs = sfm.reconstruction(ref_dir, images, sfm_pairs, features, matches, image_list=references)
# here ref is pycolmap.Reconstruction object

    # run the raw geometric SfM for comparison
    raw_sfm = PixSfM({"KA":{"apply": False}, "BA": {"apply": False}})
    raw, _ = raw_sfm.reconstruction(raw_dir, images, sfm_pairs, features, matches, image_list=references)

"

result:
"
[2022/05/23 16:19:41 hloc INFO] Finished exporting matches.
[2022/05/23 16:19:43 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /home/ray/Workspace/project/ORB_SLAM3/src/ref/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/05/23 16:19:43 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
'device': 'auto',
'dtype': 'half',
'fast_image_load': False,
'l2_normalize': True,
'load_cache_on_init': False,
'max_edge': 1024,
'model': {'name': 's2dnet'},
'overwrite_cache': False,
'patch_size': 16,
'pyr_scales': [1.0],
'resize': 'LANCZOS',
'sparse': True,
'use_cache': False}
[2022/05/23 16:19:43 pixsfm INFO] Building matching graph...
[2022/05/23 16:19:43 pixsfm INFO] Extracting dense features...
100%|██████████| 10/10 [00:03<00:00, 2.78it/s]
[2022/05/23 16:19:47 pixsfm INFO] Computing tracks...
[2022/05/23 16:19:47 pixsfm INFO] # graph nodes: 10926
[2022/05/23 16:19:47 pixsfm INFO] # graph edges: 17937
[2022/05/23 16:19:47 pixsfm INFO] # tracks: 3224
[2022/05/23 16:19:47 pixsfm INFO] Start feature-metric keypoint adjustment.
100%[████████████████████] 10926/10926 [00:01, 5827.20it/s]
[2022/05/23 16:19:49 hloc INFO] Creating an empty database...
[2022/05/23 16:19:49 pixsfm INFO] KA Time: 1.87487s, cost change: 0.0232185 --> 0.0214045
[2022/05/23 16:19:49 hloc INFO] Importing images into the database...
[2022/05/23 16:19:49 hloc INFO] Importing features into the database...
100%|██████████| 10/10 [00:00<00:00, 2381.50it/s]
[2022/05/23 16:19:49 hloc INFO] Importing matches into the database...
100%|██████████| 45/45 [00:00<00:00, 1683.36it/s]
[2022/05/23 16:19:49 hloc INFO] Performing geometric verification of the matches...

    Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

"

please help

Some issues during BA

Hi, Paul@Skydes, I've met some issues during bundle adjustment .
Photo_0417_1a

It seems that no bundle adjustment process is done and the cost didn't change at all.
So, how could this happen? Is the cost much lower than threshold?

Looking forward to your earliest reply!
Thanks a lot!

Shengkun Tang

Having a issue when i run demo.ipynb

First of all, thanks for the great work.I have successfully installed pixsfm, but there is an error when I run the demo in jupyter.
The running code is:

%load_ext autoreload
%autoreload 2
import tqdm, tqdm.notebook
tqdm.tqdm = tqdm.notebook.tqdm  # notebook-friendly progress bars
from pathlib import Path

from hloc import extract_features, match_features, reconstruction, pairs_from_exhaustive, visualization
from hloc.visualization import plot_images, read_image
from hloc.utils.viz_3d import init_figure, plot_points, plot_reconstruction, plot_camera_colmap

from pixsfm.util.visualize import init_image, plot_points2D
from pixsfm.refine_hloc import PixSfM
from pixsfm import ostream_redirect

# redirect the C++ outputs to notebook cells
cpp_out = ostream_redirect(stderr=True, stdout=True)
cpp_out.__enter__()

Error reported as:

ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_29924/2490466277.py in <module>
      9 from hloc.utils.viz_3d import init_figure, plot_points, plot_reconstruction, plot_camera_colmap
     10 
---> 11 from pixsfm.util.visualize import init_image, plot_points2D
     12 from pixsfm.refine_hloc import PixSfM
     13 from pixsfm import ostream_redirect

/mnt/vdc/pixel-perfect/pixel-perfect-sfm/pixsfm/__init__.py in <module>
     16 from ._pixsfm import *  # noqa F403
     17 
---> 18 from . import (  # noqa F403
     19     base, features, bundle_adjustment, keypoint_adjustment,
     20     extract, localization, util, cpplog, pyceres

/mnt/vdc/pixel-perfect/pixel-perfect-sfm/pixsfm/base/__init__.py in <module>
----> 1 from .._pixsfm._base import *  # noqa F403
      2 from .main import * # noqa F403

ModuleNotFoundError: No module named 'pixsfm._pixsfm._base'

How to solve it?

Question of Eq.(4) in paper

Thank you for open source this great project.
Recently I read yourpixel-perfect-sfm paper. I have one question in Eq.(4) which can be described as follows:

image

I think the key idea of FKA is to minimize error between matched keypoints from different images in feature-metric domain. I don't know if I am right?

An error occurred while running the demo.ipynb

First of all, thank you very much for sharing this achievement. When I was running the demo, an error occurred.
The code I run is

import pycolmap
from pixsfm.localize import QueryLocalizer, pose_from_cluster

camera = pycolmap.infer_camera_from_image(images / query)
ref_ids = [refined.find_image_with_name(r).image_id for r in references_registered]
conf = {
    "dense_features": sfm.conf.dense_features,  # same features as the SfM refinement
    "PnP": {  # initial pose estimation with PnP+RANSAC
        'estimation': {'ransac': {'max_error': 12.0}},
        'refinement': {'refine_focal_length': True, 'refine_extra_params': True},
    },
    "QBA": {  # query pose refinement
        "optimizer:": {'refine_focal_length': True, 'refine_extra_params': True},
    }
}
dense_features = sfm_outputs["feature_manager"]
localizer = QueryLocalizer(refined, conf, dense_features=dense_features)
ret, log = pose_from_cluster(localizer, query, camera, ref_ids, features, matches, image_path=images/query)

print(f'found {sum(ret["inliers"])}/{len(ret["inliers"])} inlier correspondences.')
visualization.visualize_loc_from_log(images, query, log, refined, top_k_db=1)

The error prompt is

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_6339/735069453.py in <module>
     17 localizer = QueryLocalizer(refined, conf, dense_features=dense_features)
     18 print(localizer, query, camera, ref_ids, features, matches, images/query)
---> 19 ret, log = pose_from_cluster(localizer, query, camera, ref_ids, features, matches, image_path=images/query)
     20 
     21 print(f'found {sum(ret["inliers"])}/{len(ret["inliers"])} inlier correspondences.')

/mnt/vdc/pixel-perfect/Hierarchical-Localization/hloc/localize_sfm.py in pose_from_cluster(localizer, qname, query_camera, db_ids, features_path, matches_path, **kwargs)
    106     mkp_idxs = [i for i in idxs for _ in kp_idx_to_3D[i]]
    107     mp3d_ids = [j for i in idxs for j in kp_idx_to_3D[i]]
--> 108     ret = localizer.localize(kpq, mkp_idxs, mp3d_ids, query_camera, **kwargs)
    109     ret['camera'] = {
    110         'model': query_camera.model_name,

/mnt/vdc/pixel-perfect/pixel-perfect-sfm/pixsfm/localization/main.py in localize(self, keypoints, pnp_point2D_idxs, pnp_points3D_id, query_camera, image_path, query_fmaps)
    441         if require_feats:
    442             query_references = self.get_query_references(
--> 443                 pnp_points3D_id, query_fmaps, pnp_points2D, pnp_point2D_idxs)
    444             assert(len(query_fmaps) == len(query_references))
    445 

/mnt/vdc/pixel-perfect/pixel-perfect-sfm/pixsfm/localization/main.py in get_nearest_references(self, pnp_points3D_id, query_fmaps, pnp_points2D, patch_idxs)
    508                     pnp_points3D_id,
    509                     to_ctr(self.conf.interpolation),
--> 510                     patch_idxs=patch_idxs))
    511         return nearest_references
    512 

ValueError: [nearest_references.h:35] Check Failed: reference.HasObservations() : Missing observations in references. Extract references with option keep_observations=True.

How to solve it? Thank you.

Some issues when loading match data from colmap database

Hi, thanks for your fantastic work. But I got some problems when loading .db file generated by colmap. Here is the problem trace:

Traceback (most recent call last):
File "/home/tsk/anaconda3/envs/pixel/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/tsk/anaconda3/envs/pixel/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/tsk/workspace/pixel-perfect-sfm/pixsfm/refine_colmap.py", line 209, in
args.database_path, args.image_dir, cache_path=args.cache_path)
File "/home/tsk/workspace/pixel-perfect-sfm/pixsfm/refine_colmap.py", line 108, in refine_keypoints_from_db
pairs, matches, scores = read_matches_from_db(database_path)
File "/home/tsk/workspace/pixel-perfect-sfm/pixsfm/util/colmap.py", line 38, in read_matches_from_db
desc[image_id] = blob_to_array(data, np.uint32, (-1, c))
File "/home/tsk/workspace/pixel-perfect-sfm/pixsfm/util/database.py", line 134, in blob_to_array
return np.fromstring(blob, dtype=dtype).reshape(*shape)
ValueError: cannot reshape array of size 277536 into shape (128)

This seems to be the dimention of descriptor. However, I build the latest version of colmap and pycolmap from source. The .db file is generated from the colmap. Moreover, I noticed that the output dimention of descriptor is always 128.

Thanks in advance for your reply!
Shengkun

build error when building the pixsfm package:

Hey, I encountered this build error as below. It looks like from ceres library. I installed ceres-solver from colmap official website https://colmap.github.io/install.html#build-from-source

Any suggestions? Thanks!

Error message:
pixsfm/util/src/memory.h:59:39: error: ‘const class ceres::Problem’ has no member named ‘ParameterBlockLocalSize’; did you mean ‘ParameterBlockSize’?
59 | num_active_params += problem->ParameterBlockLocalSize(param_block);

How to compile with Clang

I am trying to compile it on M1, and creating this issue to put my notes and hopefully guide others, who try to do the same.

There are 2 minor issues, which are fixable with this branch https://github.com/ducha-aiki/pixel-perfect-sfm/tree/M1-macos
The fixable issues are:

  1. Turn off AVX2 optimization
  2. Removing import of #include "sys/sysinfo.h" and replacing std::chrono::high_resolution_clock with std::chrono::system_clock

There is a bigger problem, though, with interpolation.h, Evaluate function. It is a template, and not all possible variants of the templated function are good. GCC ignores this, but not Clang (see https://stackoverflow.com/questions/60180873/template-function-error-in-clang-but-not-gcc)

I will keep updating this issue, as I will be progressing with the compilation.

Error message (part of):

In file included from /Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/features/bindings.cc:12:
In file included from /Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/features/src/dynamic_patch_interpolator.h:20:
In file included from /Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/features/src/featurepatch.h:20:
/Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/base/src/interpolation.h:137:11: error: member reference base type 'double' is not a structure or union
f[i].a = frc[i];
~~~~^~
/Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/base/src/interpolation.h:138:11: error: member reference base type 'double' is not a structure or union
f[i].v = dfdr[i] * r.v + dfdc[i] * c.v;
~~~~^~
/Users/dmytromishkin/dev/pixel-perfect-sfm/pixsfm/base/src/interpolation.h:135:15: error: member reference base type 'const double' is not a structure or union
Evaluate(r.a, c.a, frc, dfdr, dfdc);

Core dump during feature-metric keypoint adjustment

I'm trying to refine keypoint from database,and I get core dump during Start feature-metric keypoint adjustment.

The database is built on superpoint and superglue. When the descriptor does not exist in the database, the program will core dump. If the score is empty, this situation will be handle in the Graph::RegisterMatches, what is the cause of this problem?

void Graph::RegisterMatches(std::string imname1, std::string imname2,
                            size_t* matches,       // Nx2
                            double* similarities,  // Nx1
                            size_t n_matches) {
  for (size_t match_idx = 0; match_idx < n_matches; ++match_idx) {
    colmap::point2D_t feature_idx1 = matches[2 * match_idx];
    colmap::point2D_t feature_idx2 = matches[2 * match_idx + 1];
    **double similarity = similarities ? similarities[match_idx] : 1.0;**

    FeatureNode* node1 = FindOrCreateNode(imname1, feature_idx1);
    FeatureNode* node2 = FindOrCreateNode(imname2, feature_idx2);

    AddEdge(node1, node2, similarity);
  }
}

When I import the descriptor of superpoint and read it accoording to float32, it still core dump in feature-metric keypoint adjustment. But I use the default uint8 to read the descriptor and the program works fine. I don`t think this is normal, the superpoint descriptor should not be of uint8. What is the cause of this problem?

my code

conf = {
        "dense_features": {"use_cache": True,
        "max_edge": 1024},
}
refiner = PixSfM(conf=conf)
keypoints, _, _ = refiner.refine_keypoints_from_db(
        refined_database,
        database,
        image_dir,
        )

Thanks in advance!

my environment:
Ubuntu 16.04
Python 3.8

Latest HLOC update breaks PixSfM

Error:

Traceback (most recent call last):
  File "run_reconstruction.py", line 40, in <module>
    refined, sfm_outputs = sfm.reconstruction(ref_dir, images, sfm_pairs, features, matches,
  File "/home/prajwal.chidananda/code/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 143, in reconstruction
    return self.run(
  File "/home/prajwal.chidananda/code/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 42, in run
    _, ka_data, feature_manager = self.refine_keypoints(
  File "/home/prajwal.chidananda/code/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 84, in refine_keypoints
    matches_scores = read_matches_hloc(matches_path, pairs)
  File "/home/prajwal.chidananda/code/pixel-perfect-sfm/pixsfm/util/hloc.py", line 63, in read_matches_hloc
    m = h5f[pair]["matches0"].__array__()
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "/usr/local/lib/python3.8/dist-packages/h5py/_hl/group.py", line 305, in __getitem__
    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'mapping-IMG_9547.png_mapping-IMG_9465.png' doesn't exist)"

The reconstruction pipeline is broken because of this latest commit to HLOC: cvg/Hierarchical-Localization@653d3e2

I've created a PR that fixes this: #33

Error in compilation types.cc.o

I run into the following issue while compilation:
`
ERROR: Command errored out with exit status 1:
command: /home/shengjie/anaconda3/envs/torch16/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py'"'"'; file='"'"'/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps
cwd: /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/
Complete output (158 lines):
running develop
running egg_info
writing pixsfm.egg-info/PKG-INFO
writing dependency_links to pixsfm.egg-info/dependency_links.txt
writing top-level names to pixsfm.egg-info/top_level.txt
reading manifest file 'pixsfm.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'pixsfm.egg-info/SOURCES.txt'
running build_ext
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.2.92 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.14.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- system
-- unit_test_framework
-- Found Eigen
-- Includes : /usr/include/eigen3
-- Found FreeImage
-- Includes : /usr/include
-- Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
-- Found Glog
-- Includes : /usr/include
-- Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
CMake Warning (dev) at /usr/local/share/cmake-3.13/Modules/FindOpenGL.cmake:270 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  /usr/local/share/colmap/COLMAPConfig.cmake:103 (find_package)
  CMakeLists.txt:35 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   serialization
-- pybind11 v2.8.1
-- Configuring done
CMake Warning at third-party/pybind11/tools/pybind11Tools.cmake:165 (add_library):
  Cannot generate a safe runtime search path for target _pixsfm because files
  in some directories may conflict with libraries in implicit directories:

    runtime library [libtbbmalloc.so.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/shengjie/anaconda3/envs/torch16/lib
    runtime library [libtbb.so.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/shengjie/anaconda3/envs/torch16/lib
    runtime library [libGLU.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/shengjie/anaconda3/envs/torch16/lib

  Some of these libraries may not be found correctly.
Call Stack (most recent call first):
  cmake/CMakeHelper.cmake:136 (pybind11_add_module)
  pixsfm/CMakeLists.txt:23 (PIXSFM_ADD_PYMODULE)


-- Generating done
-- Build files have been written to: /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/build/temp.linux-x86_64-3.6
Scanning dependencies of target pixsfm
[  9%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/base/src/graph.cc.o
[  9%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/simple_logger.cc.o
[  9%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/threading.cc.o
[ 12%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/stringprintf.cc.o
[ 15%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/glog.cc.o
[ 18%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featurepatch.cc.o
[ 25%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featureview.cc.o
[ 25%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremap.cc.o
[ 28%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremanager.cc.o
[ 31%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featureset.cc.o
[ 34%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/references.cc.o
[ 37%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/keypoint_adjustment/src/keypoint_adjustment_options.cc.o
[ 40%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/bundle_adjustment/src/bundle_adjustment_options.cc.o
[ 43%] Linking CXX static library libpixsfm.a
[ 43%] Built target pixsfm
Scanning dependencies of target pypixsfm
[ 46%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/base/bindings.cc.o
[ 50%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/util/bindings.cc.o
[ 53%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/callbacks.cc.o
[ 56%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/residuals/bindings.cc.o
[ 59%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/features/bindings.cc.o
[ 62%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o
[ 65%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/localization/bindings.cc.o
[ 71%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/solver.cc.o
[ 71%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/bundle_adjustment/bindings.cc.o
[ 75%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/loss_functions.cc.o
[ 78%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/cost_functions.cc.o
[ 81%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/problem.cc.o
[ 84%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/pyceres.cc.o
[ 87%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/parameterization.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/types.cc.o
In file included from /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/keypoint_adjustment/src/featuremetric_keypoint_optimizer.h:8,
                 from /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/keypoint_adjustment/bindings.cc:8:
/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:78:3: error: ‘RunParallel’ function uses ‘auto’ type specifier without trailing return type
   78 |   auto RunParallel(std::vector<int> problem_labels, Param&... parameters) {
      |   ^~~~
/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:78:3: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
In file included from /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/bundle_adjustment/src/costmap_extractor.h:16,
                 from /home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/bundle_adjustment/bindings.cc:14:
/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:78:3: error: ‘RunParallel’ function uses ‘auto’ type specifier without trailing return type
   78 |   auto RunParallel(std::vector<int> problem_labels, Param&... parameters) {
      |   ^~~~
/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/pixsfm/base/src/parallel_optimizer.h:78:3: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
pixsfm/CMakeFiles/pypixsfm.dir/build.make:101: recipe for target 'pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o' failed
make[2]: *** [pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
pixsfm/CMakeFiles/pypixsfm.dir/build.make:114: recipe for target 'pixsfm/CMakeFiles/pypixsfm.dir/bundle_adjustment/bindings.cc.o' failed
make[2]: *** [pixsfm/CMakeFiles/pypixsfm.dir/bundle_adjustment/bindings.cc.o] Error 1
CMakeFiles/Makefile2:241: recipe for target 'pixsfm/CMakeFiles/pypixsfm.dir/all' failed
make[1]: *** [pixsfm/CMakeFiles/pypixsfm.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py", line 126, in <module>
    package_data={'': ['configs/*.yaml']},
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/site-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/site-packages/setuptools/command/develop.py", line 114, in install_for_development
    self.run_command('build_ext')
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py", line 55, in run
    self.build_extension(ext)
  File "/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py", line 99, in build_extension
    cwd=self.build_temp)
  File "/home/shengjie/anaconda3/envs/torch16/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j']' returned non-zero exit status 2.
----------------------------------------

ERROR: Command errored out with exit status 1: /home/shengjie/anaconda3/envs/torch16/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py'"'"'; file='"'"'/home/shengjie/Documents/supporting_projects/EMAwareFlow_related_projects/pixel-perfect-sfm/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
`

I tried the solution provided in issue 9, still, unresolved.
I tried gcc 8.4.0; gcc 9.4.0; and gcc 5.5.0. Also, I tried AVX2_ENABLED=OFF pip install -e . and branch fix-parallel-optimizer.
It seems the gcc does not load c++ 14. But I am not sure. Any suggestion will be helpful!!!

Build error from glog in PixSfM /src

Installation went smoothly for me until the final pixSfM package install via pip. Compilation reached 40%, then returned this error from the glog source packaged with pixSfM:

/pixel-perfect-sfm/pixsfm/util/src/glog.cc:86:48: error: invalid conversion from ‘void (*)(const char*, int)’ to ‘void (*)(const char*, size_t)’ {aka ‘void (*)(const char*, long unsigned int)’} [-fpermissive] 86 | []() { google::InstallFailureWriter(&PyBindLogStack); })

The full error context is reprinted below:

[ 40%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/bundle_adjustment/src/bundle_adjustment_options.cc.o
/home/kevin/pixel-perfect-sfm/pixsfm/util/src/glog.cc: In lambda function:
/home/kevin/pixel-perfect-sfm/pixsfm/util/src/glog.cc:86:48: error: invalid conversion from ‘void (*)(const char*, int)’ to ‘void (*)(const char*, size_t)’ {aka ‘void (*)(const char*, long unsigned int)’} [-fpermissive]
86 |            []() { google::InstallFailureWriter(&PyBindLogStack); })
|                                                ^~~~~~~~~~~~~~~
|                                                |
|                                                void (*)(const char*, int)
In file included from /usr/local/include/colmap/util/logging.h:37,
from /home/kevin/pixel-perfect-sfm/pixsfm/util/src/glog.cc:1:
/usr/local/include/glog/logging.h:1972:12: note:   initializing argument 1of ‘void google::InstallFailureWriter(void (*)(const char*, size_t))’
1972 |     void (*writer)(const char* data, size_t size));
|     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:132: pixsfm/CMakeFiles/pixsfm.dir/util/src/glog.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:368: pixsfm/CMakeFiles/pixsfm.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/kevin/pixel-perfect-sfm/setup.py", line 112, in <module>
setup(
File "/home/kevin/anaconda3/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/kevin/anaconda3/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/kevin/anaconda3/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/kevin/anaconda3/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/kevin/anaconda3/lib/python3.9/site-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/home/kevin/anaconda3/lib/python3.9/site-packages/setuptools/command/develop.py", line 114, in install_for_development
self.run_command('build_ext')
File "/home/kevin/anaconda3/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/kevin/anaconda3/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/kevin/pixel-perfect-sfm/setup.py", line 55, in run
self.build_extension(ext)
File "/home/kevin/pixel-perfect-sfm/setup.py", line 98, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args,
File "/home/kevin/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j']' returned non-zero exit status 2.
----------------------------------------
ERROR: Command errored out with exit status 1: /home/kevin/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/kevin/pixel-perfect-sfm/setup.py'"'"'; __file__='"'"'/home/kevin/pixel-perfect-sfm/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Segfault during triangulation

I'm trying to refine a Pointcloud extracted using ArCore on my phone, and I get a Segmentation fault error at the end of the triangulation part of PixSfM.

As an input, I provide:

  • A folder of images
  • A binary colmap model (cameras.bin, images.bin, points3D.bin): The pointcloud is noisy and used only for the pairs_from_covisibility method (In images.bin, point3D_ids make sense but I simply put dummy zeros xys for the 2d features since features should be recomputed by hloc) but the intrinsics/extrinsics estimate from arcore are quite good and should be used as priors

and I want to refine the poses and the pointcloud.

My pipeline is the following:

  1. hloc.extract_features
  2. hloc.pairs_from_covisibility
  3. hloc.match_features
  4. PixSfM.triangulation

I use the low memory configuration file, because it crashes otherwise.

Here's my code:

from pathlib import Path
from hloc import extract_features, match_features, pairs_from_covisibility
from pixsfm.refine_hloc import PixSfM

images = Path('data/images')
input_model = Path('data/input_model')
outputs = Path('data/results')

sfm_pairs = outputs / 'pairs-sfm.txt'
features = outputs / 'features.h5'
matches = outputs / 'matches.h5'
sfm_dir = outputs / "sfm"

feature_conf = extract_features.confs['superpoint_aachen']
matcher_conf = match_features.confs['superglue']

references = [str(p.relative_to(images))for p in images.iterdir()]

extract_features.main(feature_conf, images,
                      image_list=references,
                      feature_path=features)
pairs_from_covisibility.main(input_model,
                             sfm_pairs,
                             num_matched=5)
match_features.main(matcher_conf,
                    sfm_pairs,
                    features=features,
                    matches=matches)

refiner = PixSfM(conf="/dependencies/pixel-perfect-sfm/pixsfm/configs/low_memory.yaml")
model, _ = refiner.triangulation(output_dir=sfm_dir,
                                 reference_model_path=input_model,
                                 image_dir=images,
                                 pairs_path=sfm_pairs,
                                 features_path=features,
                                 matches_path=matches
                                 )

and here's the output I got:

[2022/01/27 09:56:05 hloc INFO] Extracting local features with configuration:
{'model': {'max_keypoints': 4096, 'name': 'superpoint', 'nms_radius': 3},
 'output': 'feats-superpoint-n4096-r1024',
 'preprocessing': {'grayscale': True, 'resize_max': 1024}}
[2022/01/27 09:56:05 hloc INFO] Skipping the extraction.
[2022/01/27 09:56:05 hloc INFO] Reading the COLMAP model...
[2022/01/27 09:56:05 hloc INFO] Extracting image pairs from covisibility info...
  0%|                                                                                                                                                                                   | 0/283 [00:00<?, ?it/s][2022/01/27 09:56:05 hloc INFO] Image 28 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 29 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 30 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 57 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 74 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 75 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 131 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 191 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 192 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 202 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 203 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 211 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 223 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 224 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 243 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 244 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 245 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 246 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 247 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 248 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 249 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 264 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 265 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 266 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 269 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 270 does not have any covisibility.
[2022/01/27 09:56:05 hloc INFO] Image 271 does not have any covisibility.
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 283/283 [00:00<00:00, 4739.06it/s]
[2022/01/27 09:56:05 hloc INFO] Found 911 pairs.
[2022/01/27 09:56:05 hloc INFO] Matching local features with configuration:
{'model': {'name': 'superglue',
           'sinkhorn_iterations': 50,
           'weights': 'outdoor'},
 'output': 'matches-superglue'}
Loaded SuperGlue model ("outdoor" weights)
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 911/911 [00:31<00:00, 28.93it/s]
[2022/01/27 09:56:39 hloc INFO] Finished exporting matches.
[2022/01/27 09:56:40 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /dependencies/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/01/27 09:56:40 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
 'device': 'auto',
 'dtype': 'half',
 'fast_image_load': False,
 'l2_normalize': True,
 'load_cache_on_init': False,
 'max_edge': 1600,
 'model': {'name': 's2dnet', 'num_layers': 1, 'checkpointing': None, 'output_dim': 128, 'pretrained': 's2dnet', 'remove_pooling_layers': False, 'combine': False},
 'overwrite_cache': True,
 'patch_size': 8,
 'pyr_scales': [1.0],
 'resize': 'LANCZOS',
 'sparse': True,
 'use_cache': True}
[2022/01/27 09:56:41 pixsfm INFO] Building matching graph...
[2022/01/27 09:56:41 pixsfm INFO] Extracting dense features...
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 256/256 [00:12<00:00, 20.47it/s]
[2022/01/27 09:56:54 pixsfm INFO] Loading featuremaps from H5 File.
100%[████████████████████] 256/256 [00:00, 3605.63it/s]
[2022/01/27 09:56:54 pixsfm INFO] Computing tracks...
[2022/01/27 09:56:54 pixsfm INFO] # graph nodes: 109498
[2022/01/27 09:56:54 pixsfm INFO] # graph edges: 249077
[2022/01/27 09:56:54 pixsfm INFO] # tracks: 34883
[2022/01/27 09:56:54 pixsfm INFO] Start feature-metric keypoint adjustment.
[2022/01/27 09:56:54 pixsfm INFO] Start topological-reference keypoint adjustment.
100%[████████████████████] 109498/109498 [00:11, 9302.35it/s]
[2022/01/27 09:57:06 pixsfm INFO] KA Time: 11.7715s, cost change: 0.0232999 --> 0.0206287
[2022/01/27 09:57:06 hloc INFO] Importing features into the database...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 283/283 [00:00<00:00, 4536.62it/s]
[2022/01/27 09:57:06 hloc INFO] Importing matches into the database...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 911/911 [00:00<00:00, 8098.12it/s]
[2022/01/27 09:57:06 hloc INFO] Performing geometric verification of the matches...
[2022/01/27 09:57:07 hloc INFO] Running 3D triangulation...
[2022/01/27 09:57:10 hloc INFO] Finished the triangulation with statistics:
Reconstruction:
        num_reg_images = 283
        num_cameras = 283
        num_points3D = 1662
        num_observations = 3408
        mean_track_length = 2.05054
        mean_observations_per_image = 12.0424
        mean_reprojection_error = 1.84696
[2022/01/27 09:57:10 pixsfm INFO] Extracting references and costmaps.
Segmentation fault (core dumped)

Did I miss something or is there an actual bug? Might it be related to the low_memory conf? Is is still ok since I got the log "Finished the triangulation" ?

Many thanks !

build failed, cmake error ‘const class ceres::Problem’ has no member named ‘ParameterBlockLocalSize’ during final step

Everything is fine until final step "pip install -e ."

pixel-perfect-sfm/pixsfm/util/src/memory.h:59:39: error: ‘const class ceres::Problem’ has no member named ‘ParameterBlockLocalSize’; did you mean ‘ParameterBlockSize’?
       59 |         num_active_params += problem->ParameterBlockLocalSize(param_block);
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~
          |                                       ParameterBlockSize
    make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:167: pixsfm/CMakeFiles/pixsfm.dir/features/src/featureview.cc.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [CMakeFiles/Makefile2:457: pixsfm/CMakeFiles/pixsfm.dir/all] Error 2
    make: *** [Makefile:130: all] Error 2

os: linux ubuntu 20.04
colmap and ceres-solver was installed successfully, and there is no problem in running those two packages independently

why are refining steps for colmap format disconnected?

In refine.hloc a keypoint adjustment step is followed by another reconstruction/triangulation step, which seems to be a triangulate_points/incremental_mapping step of pycolmap.

I don't see a similar complete pipeline for refining when the reconstruction has been done with colmap. It seems to be either keypoint refinement or bundle adjustment in refine_colmap.py. How should I run bundle adjustment after keypoint refinement when dealing with colmap reconstructions? Should I run a triangulation step manually in between?
Or is this refinded information somewhat passed on through the FeatureManager?
Thank you!

Build error : ‘attribute_error’ is not a member of ‘py’

Thanks for sharing these excellent work.
This strange error occured during pip installing, i found no info about it on google

ubuntu 20.04
gcc 9.4.0
cmake 3.21.6
ceres 2.2.0
python 3.9.7

Building log:
-- Generating done
-- Build files have been written to: /home/horry/pixel-perfect-sfm/build/temp.linux-x86_64-3.9
[ 3%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/base/src/graph.cc.o
[ 6%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/simple_logger.cc.o
[ 9%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/threading.cc.o
[ 12%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/stringprintf.cc.o
[ 15%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featurepatch.cc.o
[ 18%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/util/src/glog.cc.o
[ 21%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremap.cc.o
[ 25%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featureview.cc.o
[ 28%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremanager.cc.o
[ 31%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/references.cc.o
[ 34%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/bundle_adjustment/src/bundle_adjustment_options.cc.o
[ 37%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/features/src/featureset.cc.o
[ 40%] Building CXX object pixsfm/CMakeFiles/pixsfm.dir/keypoint_adjustment/src/keypoint_adjustment_options.cc.o
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/references.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/references.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featuremap.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featuremap.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureview.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureview.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featurepatch.h:3,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featurepatch.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureset.h:3,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureset.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/keypoint_adjustment/src/keypoint_adjustment_options.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/keypoint_adjustment/src/keypoint_adjustment_options.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/bundle_adjustment/src/bundle_adjustment_options.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/bundle_adjustment/src/bundle_adjustment_options.cc:1:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featuremanager.h:2,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featuremanager.cc:7:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h: In lambda function:
/home/horry/pixel-perfect-sfm/pixsfm/_pixsfm/src/helpers.h:222:21: error: ‘attribute_error’ is not a member of ‘py’
222 | throw py::attribute_error(ss.str());

| ^~~~~~~~~~~~~~~
In file included from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureview.cc:3:
/home/horry/pixel-perfect-sfm/pixsfm/util/src/memory.h: In function ‘long long int pixsfm::NumNonZerosJacobian(const ceres::Problem*)’:
/home/horry/pixel-perfect-sfm/pixsfm/util/src/memory.h:59:74: warning: ‘int ceres::Problem::ParameterBlockLocalSize(const double*) const’ is deprecated: LocalParameterizations are deprecated. Use ParameterBlockTangentSize instead. [-Wdeprecated-declarations]
59 | num_active_params += problem->ParameterBlockLocalSize(param_block);
| ^
In file included from /usr/local/include/ceres/ceres.h:66,
from /home/horry/pixel-perfect-sfm/pixsfm/base/src/interpolation.h:15,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featurepatch.h:20,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featuremap.h:24,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureview.h:23,
from /home/horry/pixel-perfect-sfm/pixsfm/features/src/featureview.cc:1:
/usr/local/include/ceres/problem.h:494:7: note: declared here
494 | int ParameterBlockLocalSize(const double* values) const;
| ^~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:216:pixsfm/CMakeFiles/pixsfm.dir/features/src/references.cc.o] error 1
make[2]: *** waiting for unfinished work....
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:230:pixsfm/CMakeFiles/pixsfm.dir/keypoint_adjustment/src/keypoint_adjustment_options.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:146:pixsfm/CMakeFiles/pixsfm.dir/features/src/featurepatch.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:244:pixsfm/CMakeFiles/pixsfm.dir/bundle_adjustment/src/bundle_adjustment_options.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:160:pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremap.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:188:pixsfm/CMakeFiles/pixsfm.dir/features/src/featureview.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:202:pixsfm/CMakeFiles/pixsfm.dir/features/src/featureset.cc.o] error 1
make[2]: *** [pixsfm/CMakeFiles/pixsfm.dir/build.make:174:pixsfm/CMakeFiles/pixsfm.dir/features/src/featuremanager.cc.o] error 1
make[1]: *** [CMakeFiles/Makefile2:421:pixsfm/CMakeFiles/pixsfm.dir/all] error 2
make: *** [Makefile:136:all] error 2
Traceback......etc.....
----------------------------------------
ERROR: Command errored out with exit status 1: /home/horry/anaconda3/envs/pytorch/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/horry/pixel-perfect-sfm/setup.py'"'"'; file='"'"'/home/horry/pixel-perfect-sfm/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Thanks for any advice

Demo not working properly

Hi, thank you for your great work!
I try to run the demo, but the program stops running at Featureview().

I got the following error:

Traceback (most recent call last):
File "demo_test.py", line 47, in
refined, sfm_outputs = sfm.reconstruction(ref_dir, images, sfm_pairs, features, matches, image_list=references)
File "/home/algo/Projects/pixel-sfm/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 143, in reconstruction
return self.run(
File "/home/algo/Projects/pixel-sfm/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 57, in run
reconstruction, ba_data, feature_manager = self.run_ba(
File "/home/algo/Projects/pixel-sfm/pixel-perfect-sfm/pixsfm/refine_colmap.py", line 93, in run_ba
ba_data = self.bundle_adjuster.refine_multilevel(
File "/home/algo/Projects/pixel-sfm/pixel-perfect-sfm/pixsfm/bundle_adjustment/main.py", line 93, in refine_multilevel
out = self.refine(
File "/home/algo/Projects/pixel-sfm/pixel-perfect-sfm/pixsfm/bundle_adjustment/main.py", line 129, in refine
feature_view = features.FeatureView(
TypeError: FeatureView(): incompatible function arguments. The following argument types are supported:
1. (feature_set: pixsfm._pixsfm._features.FeatureSet_f16, reconstruction: colmap::Reconstruction) -> pixsfm._pixsfm._features.FeatureView_f16
2. (feature_set: pixsfm._pixsfm._features.FeatureSet_f16, graph: pixsfm._pixsfm._base.Graph) -> pixsfm._pixsfm._features.FeatureView_f16
3. (feature_set: pixsfm._pixsfm._features.FeatureSet_f16, graph: pixsfm._pixsfm._base.Graph, required_nodes: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f16
4. (feature_set: pixsfm._pixsfm._features.FeatureSet_f16, image_names: Set[str]) -> pixsfm._pixsfm._features.FeatureView_f16
5. (feature_set: pixsfm._pixsfm._features.FeatureSet_f16, reconstruction: colmap::Reconstruction, point3D_ids: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f16
6. (feature_set: pixsfm._pixsfm._features.FeatureSet_f64, reconstruction: colmap::Reconstruction) -> pixsfm._pixsfm._features.FeatureView_f64
7. (feature_set: pixsfm._pixsfm._features.FeatureSet_f64, graph: pixsfm._pixsfm._base.Graph) -> pixsfm._pixsfm._features.FeatureView_f64
8. (feature_set: pixsfm._pixsfm._features.FeatureSet_f64, graph: pixsfm._pixsfm._base.Graph, required_nodes: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f64
9. (feature_set: pixsfm._pixsfm._features.FeatureSet_f64, image_names: Set[str]) -> pixsfm._pixsfm._features.FeatureView_f64
10. (feature_set: pixsfm._pixsfm._features.FeatureSet_f64, reconstruction: colmap::Reconstruction, point3D_ids: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f64
11. (feature_set: pixsfm._pixsfm._features.FeatureSet_f32, reconstruction: colmap::Reconstruction) -> pixsfm._pixsfm._features.FeatureView_f32
12. (feature_set: pixsfm._pixsfm._features.FeatureSet_f32, graph: pixsfm._pixsfm._base.Graph) -> pixsfm._pixsfm._features.FeatureView_f32
13. (feature_set: pixsfm._pixsfm._features.FeatureSet_f32, graph: pixsfm._pixsfm._base.Graph, required_nodes: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f32
14. (feature_set: pixsfm._pixsfm._features.FeatureSet_f32, image_names: Set[str]) -> pixsfm._pixsfm._features.FeatureView_f32
15. (feature_set: pixsfm._pixsfm._features.FeatureSet_f32, reconstruction: colmap::Reconstruction, point3D_ids: Set[int]) -> pixsfm._pixsfm._features.FeatureView_f32

Invoked with: <pixsfm._pixsfm._features.FeatureSet_f16 object at 0x7f716642f530>, <Reconstruction 'num_reg_images=10, num_cameras=10, num_points3D=1856, num_observations=8069'>

128 feature_view = features.FeatureView(
129 feature_set,
130 reconstruction
131 )

I printed out the types of the following two parameters, which are <class 'pixsfm._pixsfm._features.FeatureSet_f16'> and <class 'pycolmap.Reconstruction'>.
Is the error due to the wrong type of parameter for reconstruction? how can i solve this problem?

Thanks in advance!

my environment:
Ubuntu 16.04
Python 3.8

FeatureView(): incompatible function arguments

When trying to run cell demo.ipynb I get the error message

FeatureView(): incompatible function arguments. The following argument types are supported:...

I am using hloc version 1.3 and the latest version of pixsfm. Do you know what does this error means?

Thanks!

Disable AVX2 if the CPU doesn't support it

#9 (comment) shows that the compilation fails if AVX2_ENABLED=ON (default) and the CPU doesn't support AVX2. We should check if __AVX2__ is defined by the compiler, something like #if defined(AVX2_ENABLED) && defined(__AVX2__)

Question of Eq.7 in paper

Thank you for open source this great project.
I have some question of the Eq.7
image
I just wonder what is the μ and the f in the Eq.(7)

Code Release

With all the amazing light field papers coming out in Jan 2022, it would be amazing to pair this work with them. Is the COLMAP plugin code coming soon?

error running demo.ipynb, type error

when running below code, error occurs
sfm = PixSfM({"dense_features": {"max_edge": 1024}}) refined, sfm_outputs = sfm.reconstruction(ref_dir, images, sfm_pairs, features, matches, image_list=references)
image
but the type of 'reconstruction' is pycolmap.reconstruction, how to figure it out?

Faster loading of SuperGlue weights

Each time I run a script that calls the matcher, it takes about 20s to load SuperGlue model ("outdoor" weights).
Is there a way to better reuse cache between consecutive runs? Or is it that big in memory?

For instance loading S2DNet checkpoint at /dependencies/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth. is instantaneous

Many thanks

IndexError: _Map_base::at when running demo.ipynb

Hi.

I get the following error when testing the demo.ipynb on another small dataset:

IndexError                                Traceback (most recent call last)
/tmp/ipykernel_5075/3412010250.py in <cell line: 1>()
----> 1 raw.align_points(refined, max_error=0.005, min_inlier_ratio=0.9, min_overlap=3)

IndexError: _Map_base::at

Here's the summary of the reconstruction:

Raw Reconstruction:
	num_reg_images = 25
	num_cameras = 1
	num_points3D = 1262
	num_observations = 4097
	mean_track_length = 3.24643
	mean_observations_per_image = 163.88
	mean_reprojection_error = 1.35567
Refined Reconstruction:
	num_reg_images = 24
	num_cameras = 1
	num_points3D = 1259
	num_observations = 4241
	mean_track_length = 3.36855
	mean_observations_per_image = 176.708
	mean_reprojection_error = 1.292

It worked OK on the demo dataset but not on my dataset. What could be the problem here?

error in bundle_adjustment

I met the ba problem,how can I due with it?

this is the error message:
Reconstruction:
num_reg_images = 135
num_cameras = 135
num_points3D = 24356
num_observations = 142783
mean_track_length = 5.86233
mean_observations_per_image = 1057.65
mean_reprojection_error = 1.31232
num_input_images = 143
Traceback (most recent call last):
File "/home/user/anaconda3/envs/sfm_loc/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/user/anaconda3/envs/sfm_loc/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 210, in
args.matches_path, cache_path=args.cache_path)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 146, in reconstruction
feature_manager=feature_manager, **hloc_args)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/refine_hloc.py", line 59, in run
cache_path=cache_path, feature_manager=feature_manager)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/refine_colmap.py", line 94, in run_ba
reconstruction, feature_manager)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/bundle_adjustment/main.py", line 95, in refine_multilevel
problem_setup)
File "/home/user/workspace/projects/python/pixel-perfect-sfm/pixsfm/bundle_adjustment/main.py", line 267, in refine
feature_set, ref_extractor)
TypeError: run(): incompatible function arguments. The following argument types are supported:
1. (self: pixsfm._pixsfm._bundle_adjustment.CostMapExtractor, arg0: List[int], arg1: colmap::Reconstruction, arg2: pixsfm::FeatureSet<half_float::half>, arg3: pixsfm._pixsfm._bundle_adjustment.ReferenceExtractor) -> Tuple[pixsfm::FeatureSet<half_float::half>, std::unordered_map<unsigned long, pixsfm::Reference, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, pixsfm::Reference> > >]
2. (self: pixsfm._pixsfm._bundle_adjustment.CostMapExtractor, arg0: List[int], arg1: colmap::Reconstruction, arg2: pixsfm::FeatureSet, arg3: pixsfm._pixsfm._bundle_adjustment.ReferenceExtractor) -> Tuple[pixsfm::FeatureSet, std::unordered_map<unsigned long, pixsfm::Reference, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, pixsfm::Reference> > >]
3. (self: pixsfm._pixsfm._bundle_adjustment.CostMapExtractor, arg0: List[int], arg1: colmap::Reconstruction, arg2: pixsfm::FeatureSet, arg3: pixsfm._pixsfm._bundle_adjustment.ReferenceExtractor) -> Tuple[pixsfm::FeatureSet, std::unordered_map<unsigned long, pixsfm::Reference, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, pixsfm::Reference> > >]

Invoked with: <pixsfm._pixsfm._bundle_adjustment.CostMapExtractor object at 0x7f4492090a70>, [-1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0,..., 298], <Reconstruction 'num_reg_images=135, num_cameras=135, num_points3D=24356, num_observations=142783'>, <pixsfm._pixsfm._features.FeatureSet_f16 object at 0x7f4492efb0f0>, <pixsfm._pixsfm._bundle_adjustment.ReferenceExtractor object at 0x7f449b3cffb0>

Did you forget to #include <pybind11/stl.h>? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.

Random exception in low_memory mode

Dear authors,

Really appreciate your efforts to open source this great paper. When I was testing my data, sometimes it can't run through the costmaps generation process. I am using the latest code, here is the log:

==============================================================================
Extracting colors

[2022/04/25 19:14:56 pixsfm INFO] Extracting references and costmaps.
[2022/04/25 19:14:58 pixsfm ERROR] Child process threw exception in problem 6567.
[2022/04/25 19:14:58 pixsfm ERROR] Child process threw exception in problem 6574.
[2022/04/25 19:14:58 pixsfm ERROR] Child process threw exception in problem 6583.

Do you know what might be cause the exception? Thanks.

Installation issue: No module named 'pixsfm._pixsfm._base'

I'm facing an issue while importing pixsfm .
Following is the error-

>>> from pixsfm.util.visualize import init_image, plot_points2D Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ubuntu/pixelperf/pixel-perfect-sfm/pixsfm/__init__.py", line 18, in <module> from . import ( # noqa F403 File "/home/ubuntu/pixelperf/pixel-perfect-sfm/pixsfm/base/__init__.py", line 1, in <module> from .._pixsfm._base import * # noqa F403 ModuleNotFoundError: No module named 'pixsfm._pixsfm._base'

About the featuremetric alignment.

Thanks for the excellent work on Structure from Motion.
One question for the paper:
In the feature extraction, are the features extracted from the pre-trained CNNs? Since I found no loss function to train the CNNs.

Scaling PixSfM to thousands of images

First of all, thanks for the great work. In the paper and project page the authors mention scaling PixSfM to thousands of images. I'm however running into issues doing the same with datasets ranging in the 1600-3000 image range. Two of the datasets in question can be found at: https://meganerf.cmusatyalab.org/#data

My code looks roughly like:

def main(hparams: Namespace) -> None:
    output_path = Path(hparams.output_path)
    output_path.mkdir(exist_ok=True, parents=True)

    feature_conf = extract_features.confs['superpoint_max']
    matcher_conf = match_features.confs['superglue']

    images_path = Path(hparams.images_path)

    images = sorted(images_path.iterdir())
    references = [str(images[i].relative_to(images_path)) for i in range(len(images))]
    print(len(references), 'mapping images')

    features_path = output_path / 'features.h5'
    sfm_pairs_path = output_path / 'pairs-sfm.txt'
    matches_path = output_path / 'matches.h5'

    extract_features.main(feature_conf, images_path, image_list=references, feature_path=features_path)
    pairs_from_gps.main(sfm_pairs_path, images_path, references, 50) # Custom matcher that uses the GPS metadata to match only to the 50 closest pairs
    match_features.main(matcher_conf, sfm_pairs_path, features=features_path, matches=matches_path)

    sfm = PixSfM(conf={"dense_features": {"use_cache": True}})

    ref_dir = output_path / 'ref'
    refined, sfm_outputs = sfm.reconstruction(ref_dir, images_path, sfm_pairs_path, features_path, matches_path,
                                              image_list=references)

And in particular the keypoint adjustment phase seems to be taking a very long time. Some examples so far:

1678 mapping images                                                                                                                                                                                                                                
[2022/02/04 18:28:11 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /home/ubuntu/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.                                                                        
[2022/02/04 18:28:25 pixsfm INFO] Loaded dense extractor with configuration:                                                                                                                                                                       
{'cache_format': 'chunked',                                                                                                                                                                                                                        
 'device': 'auto',                                                                                                                                                                                                                                 
 'dtype': 'half',                                                                                                                                                                                                                                  
 'fast_image_load': False,                                                                                                                                                                                                                         
 'l2_normalize': True,                                                                                                                                                                                                                             
 'load_cache_on_init': False,                                                                                                                                                                                                                      
 'max_edge': 1600,                                                                                                                                                                                                                                 
 'model': {'name': 's2dnet', 'num_layers': 1, 'checkpointing': None, 'output_dim': 128, 'pretrained': 's2dnet', 'remove_pooling_layers': False, 'combine': False},                                                                                 
 'overwrite_cache': False,                                                                                                                                                                                                                         
 'patch_size': 16,                                                                                                                                                                                                                                 
 'pyr_scales': [1.0],                                                                                                                                                                                                                              
 'resize': 'LANCZOS',                                                                                                                                                                                                                              
 'sparse': True,                                                                                                                                                                                                                                   
 'use_cache': True}                                                                                                                                                                                                                                [2022/02/04 18:29:52 pixsfm INFO] Building matching graph...                                                                                                                                                                                       
[2022/02/04 18:31:00 pixsfm INFO] Extracting dense features...                                                                                                                                                                                                                                                                                                                                                                                                                                      
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1678/1678 [1:05:39<00:00,  2.35s/it]|
[2022/02/04 19:36:40 pixsfm INFO] Loading featuremaps from H5 File.                                                                                                                                                                                
100%[████████████████████] 1678/1678 [00:51, 32.4514it/s]                                                                                                                                                                                          
[2022/02/04 19:37:32 pixsfm INFO] Computing tracks...                                                                                                                                                                                              
[2022/02/04 19:37:32 pixsfm INFO] # graph nodes: 6001799                                                                                                                                                                                           
[2022/02/04 19:37:38 pixsfm INFO] # graph edges: 87565132                                                                                                                                                                                          
[2022/02/04 19:39:26 pixsfm INFO] # tracks: 655998                                                                                                                                                                                                 
[2022/02/04 19:39:31 pixsfm INFO] Start feature-metric keypoint adjustment.                                                                                                                                                                        
[2022/02/04 19:39:35 pixsfm WARNING] 13887 / 115040 problems have more than 50 keypoints.                                                                                                                                                          
         Maximum keypoints in a problem: 202                                                                                                                                                                                                       
 74%[███████████████     ] 4484836/6001799 [171:56:55, 7.24511it/s]

Another example seems to be getting slower over time:

[2022/02/05 12:35:10 pixsfm INFO] Loading featuremaps from H5 File.
1940 mapping images
[2022/02/05 11:47:44 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /data/hturki/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/02/05 11:47:44 pixsfm.features.models.s2dnet INFO] Downloading S2DNet weights.
[2022/02/05 11:47:51 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
 'device': 'auto',
 'dtype': 'half',
 'fast_image_load': False,
 'l2_normalize': True,
 'load_cache_on_init': False,
 'max_edge': 1600,
 'model': {'name': 's2dnet', 'num_layers': 1, 'checkpointing': None, 'output_dim': 128, 'pretrained': 's2dnet', 'remove_pooling_layers': False, 'combine': False},
 'overwrite_cache': False,
 'patch_size': 16,
 'pyr_scales': [1.0],
 'resize': 'LANCZOS',
 'sparse': True,
 'use_cache': True}
[2022/02/05 11:48:51 pixsfm INFO] Building matching graph...
[2022/02/05 11:50:23 pixsfm INFO] Extracting dense features...
100%[████████████████████] 1938/1938 [00:10, 183.748it/s]
[2022/02/05 12:35:21 pixsfm INFO] Computing tracks...
[2022/02/05 12:35:21 pixsfm INFO] # graph nodes: 6696955
[2022/02/05 12:35:28 pixsfm INFO] # graph edges: 84325871
[2022/02/05 12:38:06 pixsfm INFO] # tracks: 761986
[2022/02/05 12:38:13 pixsfm INFO] Start feature-metric keypoint adjustment.
[2022/02/05 12:38:19 pixsfm WARNING] 16060 / 125998 problems have more than 50 keypoints.
         Maximum keypoints in a problem: 265
  0%[                    ]   59491/6696955 [01:18:26, 12.6392it/s]
 10%[██                  ]  729223/6696955 [23:18:52, 8.68822it/s]
 10%[██                  ]  729290/6696955 [23:19:05, 8.68761it/s]
 25%[█████               ] 1718493/6696955 [70:43:00, 6.75028it/s]
 27%[██████              ] 1830843/6696955 [76:13:28, 6.67195it/s]
 41%[████████            ] 2765893/6696955 [121:42:58, 6.31225it/s]
 49%[██████████          ] 3347643/6696955 [150:00:06, 6.19926it/s]

And same for a third example

3019 mapping images
[2022/02/06 12:12:32 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /home/cloudlet/hturki/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/02/06 12:12:36 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
 'device': 'auto',
 'dtype': 'half',
 'fast_image_load': False,
 'l2_normalize': True,
 'load_cache_on_init': False,
 'max_edge': 1600,
 'model': {'name': 's2dnet', 'num_layers': 1, 'checkpointing': None, 'output_dim': 128, 'pretrained': 's2dnet', 'remove_pooling_layers': False, 'combine': False},
 'overwrite_cache': False,
 'patch_size': 16,
 'pyr_scales': [1.0],
 'resize': 'LANCZOS',
 'sparse': True,
 'use_cache': True}
[2022/02/06 12:14:03 pixsfm INFO] Building matching graph...
[2022/02/06 12:16:14 pixsfm INFO] Extracting dense features...
  5%|██████████▏                                                                                                                                                                                              | 153/  5%|██████████▎                                                                                                                                                                                              | 154/  5%|██████████▎                                              100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3019/3019 [1:08:49<00:00,  1.37s/it]
[2022/02/06 13:25:03 pixsfm INFO] Loading featuremaps from H5 File.
100%[████████████████████] 3019/3019 [00:17, 172.998it/s]
[2022/02/06 13:25:21 pixsfm INFO] Computing tracks...
[2022/02/06 13:25:21 pixsfm INFO] # graph nodes: 11090098
[2022/02/06 13:25:27 pixsfm INFO] # graph edges: 122388899
[2022/02/06 13:34:55 pixsfm INFO] # tracks: 834854
[2022/02/06 13:35:05 pixsfm INFO] Start feature-metric keypoint adjustment.
[2022/02/06 13:35:13 pixsfm WARNING] 41539 / 141697 problems have more than 50 keypoints.
         Maximum keypoints in a problem: 1022
  0%[                    ]    28755/11090098 [12:26, 38.5155it/s]
  0%[                    ]    42692/11090098 [29:23, 24.2052it/s]
  0%[                    ]    62858/11090098 [50:21, 20.8059it/s]
 16%[███                 ]  1884721/11090098 [23:21:01, 22.4207it/s]
 37%[████████            ]  4142028/11090098 [78:01:34, 14.7458it/s]
 45%[█████████           ]  5016151/11090098 [114:52:32, 12.1294it/s]
 46%[█████████           ]  5208388/11090098 [125:06:01, 11.5649it/s]

The specs for the machines across each of these runs varies a bit, but they're pretty powerful machines (>100GB of ram, dozens of cores, SSD mounts)

I've also tried running PixSfM on an even larger example (matching only against the 20 closest neighbors instead of 50), where keypoint adjustment throws an exception. I've trying reducing the output dim and patch size to no avail:

5871 mapping images
[2022/02/11 08:29:37 hloc INFO] Extracting local features with configuration:
{'model': {'max_keypoints': 4096, 'name': 'superpoint', 'nms_radius': 3},
 'output': 'feats-superpoint-n4096-rmax1600',
 'preprocessing': {'grayscale': True, 'resize_force': True, 'resize_max': 1600}}
Loaded SuperPoint model
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5871/5871 [16:57<00:00,  5.77it/s]
[2022/02/11 08:46:38 hloc INFO] Finished exporting features.
[2022/02/11 08:46:41 hloc INFO] Obtaining pairwise distances between 5871 images...
[2022/02/11 08:46:43 hloc INFO] Found 117230 pairs.
[2022/02/11 08:46:43 hloc INFO] Matching local features with configuration:
{'model': {'name': 'superglue',
           'sinkhorn_iterations': 50,
           'weights': 'outdoor'},
 'output': 'matches-superglue'}
Loaded SuperGlue model ("outdoor" weights)
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 117230/117230 [6:16:43<00:00,  5.19it/s]
[2022/02/11 15:03:29 hloc INFO] Finished exporting matches.
[2022/02/11 15:03:31 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /compute/autobot-1-1/hturki/pixel-perfect-sfm/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/02/11 15:03:31 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
 'device': 'auto',
 'dtype': 'half',
 'fast_image_load': False,
 'l2_normalize': True,
 'load_cache_on_init': False,
 'max_edge': 1600,
 'model': {'name': 's2dnet', 'num_layers': 1, 'checkpointing': None, 'output_dim': 64, 'pretrained': 's2dnet', 'remove_pooling_layers': False, 'combine': False, 'patch_size': 8},
 'overwrite_cache': False,
 'patch_size': 8,
 'pyr_scales': [1.0],
 'resize': 'LANCZOS',
 'sparse': True,
 'use_cache': True} # Have also tried keeping everything in memory
[2022/02/11 15:04:33 pixsfm INFO] Building matching graph...
[2022/02/11 15:07:55 pixsfm INFO] Extracting dense features...
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5871/5871 [45:08<00:00,  2.17it/s]
[2022/02/11 15:53:04 pixsfm INFO] Computing tracks...
[2022/02/11 15:53:04 pixsfm INFO] # graph nodes: 21615817
[2022/02/11 15:53:12 pixsfm INFO] # graph edges: 106782076
[2022/02/11 15:55:08 pixsfm INFO] # tracks: 2955327
[2022/02/11 15:55:28 pixsfm INFO] Start feature-metric keypoint adjustment.
[2022/02/11 15:55:52 pixsfm WARNING] 206052 / 906513 problems have more than 20 keypoints.
         Maximum keypoints in a problem: 487
  0%[                    ]        0/21615817 [00:00, -nanit/s][2022/02/11 15:56:13 pixsfm ERROR] Child process threw exception in problem 0.

Any thoughts on what I might be doing wrong, or is a week+ runtime to be expected no matter what? I've gotten suboptimal results on these (drone imagery-related) datasets using even commercial photogrammetry software, so excited to see if I can get better results with your featuremetric approach!

i have problem in demo

I've tried demo with my own datasets. there are 239 images in datasets. everything works fine until "reconstruction ". My kernel always die in this process. what happened? how to solve this?

Aborted (core dumped) during 3D reconstruction

Hi, author. I met the issue when testing the demo.ipynb.
The complete info is as follows.

10 mapping images
[2022/09/20 14:58:31 hloc INFO] Extracting local features with configuration:
{'model': {'max_keypoints': 4096, 'name': 'superpoint', 'nms_radius': 3},
 'output': 'feats-superpoint-n4096-r1024',
 'preprocessing': {'grayscale': True, 'resize_max': 1024}}
[2022/09/20 14:58:31 hloc INFO] Skipping the extraction.
[2022/09/20 14:58:31 hloc INFO] Found 45 pairs.
[2022/09/20 14:58:31 hloc INFO] Matching local features with configuration:
{'model': {'name': 'superglue',
           'sinkhorn_iterations': 50,
           'weights': 'outdoor'},
 'output': 'matches-superglue'}
[2022/09/20 14:58:31 hloc INFO] Skipping the matching.
[2022/09/20 14:58:32 pixsfm.features.models.s2dnet INFO] Loading S2DNet checkpoint at /media/.../pixel-perfect-sfm-fix-ceres-v2.2.0/pixsfm/features/models/checkpoints/s2dnet_weights.pth.
[2022/09/20 14:58:35 pixsfm INFO] Loaded dense extractor with configuration:
{'cache_format': 'chunked',
 'device': 'auto',
 'dtype': 'half',
 'fast_image_load': False,
 'l2_normalize': True,
 'load_cache_on_init': False,
 'max_edge': 1024,
 'model': {'name': 's2dnet'},
 'overwrite_cache': False,
 'patch_size': 16,
 'pyr_scales': [1.0],
 'resize': 'LANCZOS',
 'sparse': True,
 'use_cache': False}
[2022/09/20 14:58:35 pixsfm INFO] Building matching graph...
[2022/09/20 14:58:35 pixsfm INFO] Extracting dense features...
  0%|          | 0/10 [00:00<?, ?it/s]
[2022/09/20 14:58:36 pixsfm INFO] Computing tracks...
[2022/09/20 14:58:36 pixsfm INFO] # graph nodes: 10930
[2022/09/20 14:58:36 pixsfm INFO] # graph edges: 17944
[2022/09/20 14:58:36 pixsfm INFO] # tracks: 3227
[2022/09/20 14:58:36 pixsfm INFO] Start feature-metric keypoint adjustment.
100%[████████████████████] 10930/10930 [00:01, 7852.01it/s]
[2022/09/20 14:58:37 pixsfm INFO] KA Time: 1.39268s, cost change: 0.0232016 --> 0.0213704
[2022/09/20 14:58:37 hloc WARNING] The database already exists, deleting it.
[2022/09/20 14:58:37 hloc INFO] Creating an empty database...
[2022/09/20 14:58:38 hloc INFO] Importing images into the database...
[2022/09/20 14:58:38 hloc INFO] Importing features into the database...
  0%|          | 0/10 [00:00<?, ?it/s]
[2022/09/20 14:58:38 hloc INFO] Importing matches into the database...
  0%|          | 0/45 [00:00<?, ?it/s]
[2022/09/20 14:58:38 hloc INFO] Performing geometric verification of the matches...
[2022/09/20 14:58:39 hloc INFO] Running 3D reconstruction...
Aborted (core dumped)

I checked the code and found the issue lies in pycolmap.incremental_mapping.
Any ideas to solve it?

ubuntu18.04 cuda11.1 python3.8 torch1.8.1+cu111 torchvision0.9.1+cu111
colmap and pycolmap are all installed from source.

Build fails

[ 43%] Built target pixsfm
Scanning dependencies of target pypixsfm
[ 50%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/base/bindings.cc.o
[ 87%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/features/bindings.cc.o
[ 87%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/util/bindings.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/localization/bindings.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/keypoint_adjustment/bindings.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/residuals/bindings.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/bundle_adjustment/bindings.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/cost_functions.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/pyceres.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/solver.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/parameterization.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/callbacks.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/loss_functions.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/types.cc.o
[ 90%] Building CXX object pixsfm/CMakeFiles/pypixsfm.dir/pyceres/problem.cc.o
[ 93%] Linking CXX static library libpypixsfm.a
[ 93%] Built target pypixsfm
Scanning dependencies of target _pixsfm
[ 96%] Building CXX object pixsfm/CMakeFiles/_pixsfm.dir/_pixsfm/bindings.cc.o
[100%] Linking CXX shared module ../../../pixsfm/_pixsfm.cpython-38-x86_64-linux-gnu.so
/usr/bin/ld: /usr/local/lib/libceres.a(covariance_impl.cc.o): in function `ceres::internal::CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(double const*, double const*, bool, double*) const':
covariance_impl.cc:(.text+0xa81b): undefined reference to `void Eigen::internal::call_dense_assignment_loop<Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::Matrix<double, -1, -1, 1, -1, -1>, Eigen::internal::assign_op<double, double> >(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, Eigen::Matrix<double, -1, -1, 1, -1, -1> const&, Eigen::internal::assign_op<double, double> const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [pixsfm/CMakeFiles/_pixsfm.dir/build.make:133: ../../pixsfm/_pixsfm.cpython-38-x86_64-linux-gnu.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:403: pixsfm/CMakeFiles/_pixsfm.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
/usr/local/lib/python3.8/dist-packages/setuptools/command/easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/local/lib/python3.8/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/prajwal.chidananda/pixel-perfect-sfm/setup.py", line 112, in <module>
    setup(
  File "/usr/local/lib/python3.8/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.8/dist-packages/setuptools/command/develop.py", line 34, in run
    self.install_for_development()
  File "/usr/local/lib/python3.8/dist-packages/setuptools/command/develop.py", line 114, in install_for_development
    self.run_command('build_ext')
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/prajwal.chidananda/pixel-perfect-sfm/setup.py", line 55, in run
    self.build_extension(ext)
  File "/home/prajwal.chidananda/pixel-perfect-sfm/setup.py", line 98, in build_extension
    subprocess.check_call(['cmake', '--build', '.'] + build_args,
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j']' returned non-zero exit status 2.
----------------------------------------

ERROR: Command errored out with exit status 1: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/prajwal.chidananda/pixel-perfect-sfm/setup.py'"'"'; file='"'"'/home/prajwal.chidananda/pixel-perfect-sfm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

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.