GithubHelp home page GithubHelp logo

cvg / pixel-perfect-sfm Goto Github PK

View Code? Open in Web Editor NEW
1.3K 49.0 131.0 9.24 MB

Pixel-Perfect Structure-from-Motion with Featuremetric Refinement (ICCV 2021, Best Student Paper Award)

License: Apache License 2.0

CMake 3.62% Python 28.17% C++ 68.02% Shell 0.19%
deep-learning structure-from-motion 3d-vision visual-localization feature-matching

pixel-perfect-sfm's Introduction

Pixel-Perfect Structure-from-Motion

Best student paper award @ ICCV 2021

We introduce a framework that improves the accuracy of Structure-from-Motion (SfM) and visual localization by refining keypoints, camera poses, and 3D points using the direct alignment of deep features. It is presented in our paper:

Here we provide pixsfm, a Python package that can be readily used with COLMAP and our toolbox hloc. This makes it easy to refine an existing COLMAP model or reconstruct a new dataset with state-of-the-art image matching. Our framework also improves visual localization in challenging conditions.

The refinement is composed of 2 steps:

  1. Keypoint adjustment: before SfM, jointly refine all 2D keypoints that are matched together.
  2. Bundle adjustment: after SfM, refine 3D points and camera poses.

In each step, we optimize the consistency of dense deep features over multiple views by minimizing a featuremetric cost. These features are extracted beforehand from the images using a pre-trained CNN.

With pixsfm, you can:

  • reconstruct and refine a scene using hloc, from scratch or with given camera poses
  • localize and refine new query images using hloc
  • run the keypoint or bundle adjustments on a COLMAP database or 3D model
  • evaluate the refinement with new dense or sparse features on the ETH3D dataset

Our implementation scales to large scenes by carefully managing the memory and leveraging parallelism and SIMD vectorization when possible.

Installation

pixsfm requires Python >=3.6, GCC >=6.1, and COLMAP 3.8 installed from source. The core optimization is implemented in C++ with Ceres >= 2.1 but we provide Python bindings with high granularity. The code is written for UNIX and has not been tested on Windows. The remaining dependencies are listed in requirements.txt and include PyTorch >=1.7 and pycolmap + pyceres built from source:

# install COLMAP following colmap.github.io/install.html#build-from-source, tag 3.8
sudo apt-get install libhdf5-dev
git clone https://github.com/cvg/pixel-perfect-sfm --recursive
cd pixel-perfect-sfm
pip install -r requirements.txt

To use other local features besides SIFT via COLMAP, we also require hloc:

git clone --recursive https://github.com/cvg/Hierarchical-Localization/
cd Hierarchical-Localization/
pip install -e .

Finally build and install the pixsfm package:

pip install -e .  # install pixsfm in develop mode

We highly recommend to use pixsfm with a working GPU for the dense feature extraction. All other steps can only run on the CPU. Having issues with compilation errors or runtime crashes? Want to use the codebase as a C++ library? Check our FAQ.

Tutorial

The Jupyter notebook demo.ipynb demonstrates a minimal usage example. It shows how to run Structure-from-Motion and the refinement, how to align and compare different 3D models, and how to localize and refine additional query images.


Visualizing mapping and localization results in the demo.

Structure-from-Motion

End-to-end SfM with hloc

Given keypoints and matches computed with hloc and stored in HDF5 files, we can run Pixel-Perfect SfM from a Python script:

from pixsfm.refine_hloc import PixSfM
refiner = PixSfM()
model, debug_outputs = refiner.reconstruction(
    path_to_working_directory,
    path_to_image_dir,
    path_to_list_of_image_pairs,
    path_to_keypoints.h5,
    path_to_matches.h5,
)
# model is a pycolmap.Reconstruction 3D model

or from the command line:

python -m pixsfm.refine_hloc reconstructor \
    --sfm_dir path_to_working_directory \
    --image_dir path_to_image_dir \
    --pairs_path path_to_list_of_image_pairs \
    --features_path path_to_keypoints.h5 \
    --matches_path path_to_matches.h5

Note that:

  • The final refined 3D model is written to path_to_working_directory in either case.
  • Dense features are automatically extracted (on GPU when available) using a pre-trained CNN, S2DNet by default.
  • The result debug_outputs contains the dense features and optimization statistics.

Configurations

We have fine-grained control over all hyperparameters via OmegaConf configurations, which have sensible default values defined in PixSfM.default_conf. See Detailed configuration for a description of the main configuration entries and their defaults.

[Click to see some examples]

For example, dense features are stored in memory by default. If we reconstruct a large scene or have limited RAM, we should instead write them to a cache file that is loaded on-demand. With the Python API, we can pass a configuration update:

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

or equivalently with the command line using a dotlist:

python -m pixsfm.refine_hloc reconstructor [...] dense_features.use_cache=true

We also provide ready-to-use configuration templates in pixsfm/configs/ covering the main use cases. For example, pixsfm/configs/low_memory.yaml reduces the memory consumption to scale to large scene and can be used as follow:

refiner = PixSfM(conf="low_memory")
# or
python -m pixsfm.refine_hloc reconstructor [...] --config low_memory

Triangulation from known camera poses

[Click to expand]

If camera poses are available, we can simply triangulate a 3D point cloud from an existing reference COLMAP model with:

model, _ = refiner.triangulation(..., path_to_reference_model, ...)

or

python -m pixsfm.refine_hloc triangulator [...] \
    --reference_sfm_model path_to_reference_model

By default, camera poses and intrinsics are optimized by the bundle adjustment. To keep them fixed, we can simply overwrite the corresponding options as:

conf = {"BA": {"optimizer": {
    "refine_focal_length": False,
    "refine_extra_params": False,  # distortion parameters
    "refine_extrinsics": False,    # camera poses
}}}
refiner = PixSfM(conf=conf)
refiner.triangulation(...)

or equivalently

python -m pixsfm.refine_hloc triangulator [...] \
  'BA.optimizer={refine_focal_length: false, refine_extra_params: false, refine_extrinsics: false}'

Keypoint adjustment

The first step of the refinement is the keypoint adjustment (KA). It refines the keypoints from tentative matches only, before SfM. Here we show how to run this step separately.

[Click to expand]

To refine keypoints stored in an hloc HDF5 feature file:

from pixsfm.refine_hloc import PixSfM
refiner = PixSfM()
keypoints, _, _ = refiner.refine_keypoints(
    path_to_output_keypoints.h5,
    path_to_input_keypoints.h5,
    path_to_list_of_image_pairs,
    path_to_matches.h5,
    path_to_image_dir,
)

To refine keypoints stored in a COLMAP database:

from pixsfm.refine_colmap import PixSfM
refiner = PixSfM()
keypoints, _, _ = refiner.refine_keypoints_from_db(
    path_to_output_database,  # pass path_to_input_database for in-place refinement
    path_to_input_database,
    path_to_image_dir,
)

In either case, there is an equivalent command line interface.

Bundle adjustment

The second contribution of the refinement is the bundle adjustment (BA). Here we show how to run it separately to refine an existing COLMAP 3D model.

[Click to expand]

To refine a 3D model stored on file:

from pixsfm.refine_colmap import PixSfM
refiner = PixSfM()
model, _, _, = refiner.refine_reconstruction(
    path_to_input_model,
    path_to_output_model,
    path_to_image_dir,
)

Using the command line interface:

python -m pixsfm.refine_colmap bundle_adjuster \
    --input_path path_to_input_model \
    --output_path path_to_output_model \
    --image_dir path_to_image_dir

Visual localization

When estimating the camera pose of a single image, we can also run the keypoint and bundle adjustments before and after PnP+RANSAC. This requires reference features attached to each observation of the reference model. They can be computed in several ways.

[Click to learn how to localize a single image]
  1. To recompute the references from scratch, pass the path to the reference images:
from pixsfm.localization import QueryLocalizer
localizer = QueryLocalizer(
    reference_model,  # pycolmap.Reconstruction 3D model
    image_dir=path_to_reference_image_dir,
    dense_features=cache_path,  # optional: cache to file for later reuse
)
pose_dict = localizer.localize(
    pnp_points2D      # keypoints with valid 3D correspondence (N, 2)
    pnp_point3D_ids,  # IDs of corresponding 3D points in the reconstruction
    query_camera,     # pycolmap.Camera
    image_path=path_to_query_image,
)
if pose_dict["success"]:
    # quaternion and translation of the query, from world to camera
    qvec, tvec = pose_dict["qvec"], pose_dict["tvec"]

The default localization configuration can be accessed with QueryLocalizer.default_conf.

  1. Alternatively, if dense reference features have already been computed during the pixel-perfect SfM, it is more efficient to reuse them:
refiner = PixSfM()
model, outputs = refiner.reconstruction(...)
features = outputs["feature_manager"]
# or load the features manually
features = pixsfm.extract.load_features_from_cache(
    refiner.resolve_cache_path(output_dir=path_to_output_sfm)
)
localizer = QueryLocalizer(
    reference_model,  # pycolmap.Reconstruction 3D model
    dense_features=features,
)

We can also batch-localize multiple queries equivalently to hloc.localize_sfm:

pixsfm.localize.main(
    dense_features,  # FeatureManager or path to cache file
    reference_model,  # pycolmap.Reconstruction 3D model
    path_to_query_list,
    path_to_image_dir,
    path_to_image_pairs,
    path_to_keypoints,
    path_to_matches,
    path_to_output_results,
    config=config,  # optional dict
)

Example: mapping and localization

We now show how to run the featuremetric pipeline on the Aachen Day-Night v1.1 dataset. First, download the dataset by following the instructions described here. Then run python examples/sfm+loc_aachen.py, which will perform mapping and localization with SuperPoint+SuperGlue. As the scene is large, with over 7k images, we cache the dense feature patches and therefore require about 350GB of free disk space. Expect the sparse feature matching to take a few hours on a recent GPU. We also show in examples/refine_sift_aachen.py how to start from an existing COLMAP database.

Evaluation

We can evaluate the accuracy of the pixel-perfect SfM and of camera pose estimation on the ETH3D dataset. Refer to the paper for more details.

First, we download the dataset with python -m pixsfm.eval.eth3d.download, by default to ./datasets/ETH3D/.

3D triangulation

[Click to expand]

We first need to install the ETH3D multi-view evaluation tool:

sudo apt install libpcl-dev  # linux only
git clone [email protected]:ETH3D/multi-view-evaluation.git
cd multi-view-evaluation && mkdir build && cd build
cmake .. && make -j

We can then evaluate the accuracy of the sparse 3D point cloud triangulated with Pixel-Perfect SfM, for example on the courtyard scene with SuperPoint keypoints:

python -m pixsfm.eval.eth3d.triangulation \
    --scenes courtyard \
    --methods superpoint \
    --tag pixsfm
  • omit --scenes and --methods to run all scenes with all feature detectors.
  • the results are written to ./outputs/ETH3D/ by default
  • use --tag some_run_name to distinguish different runs
  • add --config norefine to turn off any refinement or use the dotlist KA.apply=false BA.apply=false
  • add --config photometric to run the photometric BA (no KA)

To aggregate the results and compare different runs, for example with and without refinement, we run:

python -m pixsfm.eval.eth3d.plot_triangulation \
    --scenes courtyard \
    --methods superpoint \
    --tags pixsfm raw

Running on all scenes and all detectors should yield the following results (±1%):

----scene---- -keypoints- -tag-- -accuracy @ X cm- completeness @ X cm
                                  1.0   2.0   5.0   1.0   2.0   5.0 
----------------------------------------------------------------------
indoor        sift        raw    75.95 85.50 92.88  0.21  0.88  3.65
                          pixsfm 83.16 89.94 94.94  0.25  0.96  3.77
              superpoint  raw    78.96 87.77 94.55  0.64  2.36  9.39
                          pixsfm 89.93 94.09 97.04  0.76  2.62  9.85
              r2d2        raw    67.91 80.25 90.45  0.55  2.12  8.85
                          pixsfm 81.09 87.78 93.41  0.67  2.32  9.04
----------------------------------------------------------------------
outdoor       sift        raw    57.70 72.90 86.41  0.06  0.34  2.46
                          pixsfm 68.10 80.57 91.59  0.08  0.42  2.75
              superpoint  raw    53.63 68.93 83.27  0.11  0.64  4.43
                          pixsfm 71.83 82.65 92.06  0.18  0.89  5.40
              r2d2        raw    49.33 66.21 83.37  0.11  0.55  3.62
                          pixsfm 67.94 81.02 91.68  0.16  0.71  3.99

The results of this evaluation can be different from the numbers reported in the paper. The trends are however similar and the conclusions of the paper still hold. This difference is due to improvements of the pixsfm code and to changes in the SuperPoint implementation: we initially used the setup of PatchFlow and later switched to hloc, which is strictly better and easier to install.

Camera pose estimation

[Click to expand]

Similarly, we evaluate the accuracy of camera pose estimation given sparse 3D models triangulated from other views:

python -m pixsfm.eval.eth3d.localization --tag pixsfm

Again, we can also run on a subset of scenes or keypoint detectors. To aggregate the results and compare different runs, for example with and without KA and BA, we run:

python -m pixsfm.eval.eth3d.plot_localization --tags pixsfm raw

We should then obtain the following table and plot (±2%):

-keypoints- -tag-- -AUC @ X cm (%)--
                    0.1    1    10  
sift        raw    16.92 55.39 81.15
            pixsfm 23.08 60.47 84.01
superpoint  raw    15.38 63.41 87.24
            pixsfm 41.54 73.86 89.66
r2d2        raw     6.15 51.70 83.46
            pixsfm 23.85 62.41 86.89

SIFT (black), SuperPoint (red), R2D2 (green)

Results for the 0.1cm threshold can vary across setups and therefore differ from the numbers reported in the paper. This might be due to changes in the PyTorch and COLMAP dependencies. We are investigating this but any help is welcome!

Advanced usage

Detailed configuration

Here we explain the main configuration entries for mapping and localization along with their default values:

[Click to expand]
dense_features:  # refinement features
  model:  # the CNN that extracts the features
    name: s2dnet  # the name of one of the models defined in pixsfm/features/models/
    num_layers: 1  # the number of output layers (model-specific parameters)
  device: auto  # cpu, cuda, or auto-determined based on CUDA availability
  max_edge: 1600  # downscale the image such the largest dimension has this value
  resize: LANCZOS  # interpolation algorithm for the image resizing
  pyr_scales: [1.0]   # concat features extracted at multiple scales
  fast_image_load: false  # approximate resizing for large images
  l2_normalize: true  # whether to normalize the features so they have unit norm
  sparse: true  # whether to store sparse patches of features instead of the full feature maps
  patch_size: 8  # the size of the feature patches if sparse
  dtype: half  # the data type of features when stored, half float or double
  use_cache: false  # whether to cache the features on file or keep them in memory
  overwrite_cache: false  # whether to overwrite the cache file if it already exists
  cache_format: chunked
interpolation:
  nodes: [[0.0, 0.0]]  # grid over which to compute the cost, by default a single point
  mode: BICUBIC  # the interpolation algorithm
  l2_normalize: true
  ncc_normalize: false  # only works if len(nodes)>1, mostly for photometric
mapping:  # pixsfm.refine_colmap.PixSfM
  dense_features: ${..dense_features}
  KA:  # keypoint adjustment
    apply: true  # whether to apply or instead skip
    strategy: featuremetric  # regular, or alternatively topological_reference (much faster)
    interpolation: ${...interpolation}  # we can use a different interpolation for KA
    level_indices: null  # we can optimize a subset of levels, by default all
    split_in_subproblems: true  # parallelize the optimization
    max_kps_per_problem: 50  # parallelization, a lower value saves memory, conservative if -1
    optimizer:  # optimization problem and solving
      loss:
        name: cauchy  # name of the loss function, among {huber, soft_l1, ...}
        params: [0.25]  # loss-specific parameters
      solver:
        function_tolerance: 0.0
        gradient_tolerance: 0.0
        parameter_tolerance: 1.0e-05
        minimizer_progress_to_stdout: false  # print a progress bar
        max_num_iterations: 100  # maximum number of optimization iterations
        max_linear_solver_iterations: 200
        max_num_consecutive_invalid_steps: 10
        max_consecutive_nonmonotonic_steps: 10
        use_inner_iterations: false
        use_nonmonotonic_steps: false
        num_threads: 1
      root_regularize_weight: -1  # prevent drift by adding edges to the root node, disabled if -1
      print_summary: false  # whether to print a detailed summary after completion
      bound: 4.0  # constraint on the distance (in pixels) w.r.t. the initial values
      num_threads: -1  # number of threads if parallelize in subproblems
  BA:  # bundle adjustment
    apply: true  # whether to apply or instead skip
    strategy: feature_reference  # regular, or alternatively {costmaps, patch_warp}
    interpolation: ${...interpolation}  # we can use a different interpolation for BA
    level_indices: null  # we can optimize a subset of levels, by default all
    max_tracks_per_problem: 10  # parallelization of references/costmaps, a lower value saves memory
    num_threads: -1
    optimizer:
      loss:  # same config as KA.optimizer.loss
      solver:  # same config as KA.optimizer.solver
      print_summary: false
      refine_focal_length: true  # whether to optimize the focal length
      refine_principal_point: false  # whether to optimize the principal points
      refine_extra_params: true  # whether to optimize distortion parameters
      refine_extrinsics: true  # whether to optimize the camera poses
    references:  # if strategy==feature_reference
      loss:  # what to minimize to compute the robust mean
        name: cauchy
        params: [0.25]
      iters: 100  # number of iterations to compute the robust mean
      num_threads: -1
    repeats: 1
localization:  # pixsfm.localization.main.QueryLocalizer
  dense_features: ${..dense_features}
  target_reference: nearest  # how to select references, in {nearest, robust_mean, all_observations}
  overwrite_features_sparse: null  # overwrite dense_features.sparse in query localization only
  references:  # how to compute references
    loss:  # what to minimize to compute the robust mean, same as BA.references.loss
    iters: 100
    keep_observations: true  # required for target_reference in {nearest, all_observations}
    num_threads: -1
  max_tracks_per_problem: 50  # parallelization of references, a lower value saves memory
  unique_inliers: min_error  # how we select unique matches for each 3D point
  QKA:  # query keypoint adjustment
    apply: true  # whether to apply or instead skip
    interpolation: ${...interpolation}
    level_indices: null
    feature_inlier_thresh: -1  # discard points with high feature error, disabled if -1
    stack_correspondences: False # Stack references for equal keypoints
    optimizer:
      loss:  # same config as KA.optimizer.loss
        name: trivial  # L2, no robust loss function
        params: []
      solver:  # same config as KA.optimizer.solver
      print_summary: false
      bound: 4.0  # constraint on the distance (in pixels) w.r.t. the initial values
  PnP:
    estimation:  # pycolmap.absolute_pose_estimation
      ransac:
        max_error: 12  # inlier threshold in pixel reprojection error
        estimate_focal_length: false  # if the focal length is unknown
    refinement:  # refinement in pycolmap.absolute_pose_estimation
    	refine_focal_length: false
    	refine_extra_params: false
  QBA:  # query bundle adjuster
    apply: true  # whether to apply or instead skip
    interpolation: ${...interpolation}
    level_indices: null
    optimizer:
      loss:  # same config as KA.optimizer.loss
      solver:  # same config as KA.optimizer.solver
      print_summary: false
      refine_focal_length: false
      refine_principal_point: false
      refine_extra_params: false

Note that the config supports variable interpolation through omegaconf.

Large-scale refinement

When dealing with large scenes or with a large number of images, memory is often a bottleneck. The configuration low_memory shows how to decrease the memory consumption by trading-off accuracy and speed.

[Click to expand]

The main improvements are:

  • dense_features
    • store as sparse patches: sparse=true
    • reduce the size of the patches: patch_size=8 (or smaller)
    • store in a cache file: use_cache=true
  • KA
    • chunk the optimization, loading only a subset of features at once: split_in_subproblems=true
    • optimize at most around 50 keypoints per chunk: max_kps_per_problem=50
  • BA
    • use the costmap approximation: strategy=costmaps (described in Section C of the paper)

When runtime is a limitation, one can also reduce the runtime of KA by optimizing only costs with respect to the topological center of each track with KA.strategy=topological_reference.

Keypoints with large noise

[Click to expand]

Some keypoint detectors with low output resolution, like D2-Net, predict keypoints that are localized inaccurately. In this case, the refinement is highly beneficial but the default parameters are not optimal. It is necessary to increase the patch size and use multiple feature layers. An example configuration is given in pixsfm_eth3d_d2net to evaluate D2-Net on ETH3D.

Extending pixsfm

Still having questions about pixsfm? Anything in the doc is unclear? Are you unsure whether it fits your use case? Please let us know by opening an issue!

Contributing

We welcome external contributions, especially to improve the following points:

  • make pixsfm work on Windows
  • train and integrate dense features that are more compact with fewer dimensions
  • build a conda package for pixsfm and pycolmap to not require installing COLMAP from source
  • add examples on how to build featuremetric problems with pyceres

BibTex citation

Please consider citing our work if you use any code from this repo or ideas presented in the paper:

@inproceedings{lindenberger2021pixsfm,
  author    = {Philipp Lindenberger and
               Paul-Edouard Sarlin and
               Viktor Larsson and
               Marc Pollefeys},
  title     = {{Pixel-Perfect Structure-from-Motion with Featuremetric Refinement}},
  booktitle = {ICCV},
  year      = {2021},
}

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

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

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.

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)

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?

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.

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.

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!

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)

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

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?

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!

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

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.

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.

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?

[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.

[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 :)

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'

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

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)

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)

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!

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.

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?

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

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!!!

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

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 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?

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

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!

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'

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!

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.

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);

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?

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?

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.

Scale of Cauchy loss

Hello,

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

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 !

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);

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

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 : ‘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

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?

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.