Kai-46 / SatelliteSfM

A library for solving the satellite structure from motion problem
298 stars 27 forks source link

Not able to install adpated Colmap #2

Closed A-guridi closed 2 years ago

A-guridi commented 2 years ago

Hello,

I am running into some problems when calling install_colmapforvissat.sh

At first, everything seems fine and it starts building and downloading different components, like ceres and such. However, when it reaches the moment of building colmap_cuda, it runs into the following error:

[ 25%] Built target colmap_cuda [ 26%] Building C object lib/VLFeat/CMakeFiles/vlfeat.dir/scalespace.c.o In file included from /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.h:21, from /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:363: /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c: In function ‘_vl_kmeans_quantize_f’: /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/mathop.h:92:37: error: ‘vl_infinity_d’ not specified in enclosing ‘parallel’ 92 | #define VL_INFINITY_D (vl_infinity_d.value) | ~~~~^~~~~ /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:685:34: note: in expansion of macro ‘VL_INFINITY_D’ 685 | TYPE bestDistance = (TYPE) VL_INFINITY_D ; | ^~~~~ In file included from /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:1782: /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:672:9: error: enclosing ‘parallel’ 672 | #pragma omp parallel default(none) \ | ^~~ In file included from /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:1788: /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c: In function ‘_vl_kmeans_quantize_d’: /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:685:27: error: ‘vl_infinity_d’ not specified in enclosing ‘parallel’ 685 | TYPE bestDistance = (TYPE) VL_INFINITY_D ; /home/guri_ar/3drend/SatelliteSfM/preprocess_sfm/ColmapForVisSat/lib/VLFeat/kmeans.c:672:9: error: enclosing ‘parallel’ 672 | #pragma omp parallel default(none) \ | ^~~ make[2]: [lib/VLFeat/CMakeFiles/vlfeat.dir/build.make:258: lib/VLFeat/CMakeFiles/vlfeat.dir/kmeans.c.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:902: lib/VLFeat/CMakeFiles/vlfeat.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 56%] Built target colmap make: *** [Makefile:141: all] Error 2 Command failed: cmake --build . --target install --config Release -- -j8

I have tried to build it myself from source by running cmake and then make and it run into the same problem. My cmake configuration is able to detect my CUDA config and seems to work fine.

My specs are:

Ubuntu 20.04 gcc g++ version 9 nvcc version 11.3 cmake version 3.10 Libboost version 1.71.0

Many thanks in advance for your help and this great project !!

Kai-46 commented 2 years ago

gcc-9 and g++-9 are not supported. Can you check if you have gcc-7 and g++-7? Here's the relevant command you might want to take a look: CC=/usr/bin/gcc-7 CXX=/usr/bin/g++-7.

SBCV commented 2 years ago

@A-guridi what is your cuda version? The last time I tried to inistall the adapted colmap version, I needed to use CUDA 10. The installation with CUDA 11 did not work :( But that was several month ago (maybe already a year ago), so maybe this information is no longer valid.

A-guridi commented 2 years ago

Hello,

In the end it was as @SBCV sugested, the CUDA version was not working for me. Downgraded to CUDA 10.2 and the installation worked perfectly.

I am now running into another issue.

When running the example, everything seems fine, until I reach this error:

Processed file [24/24] Name: JAX_167_026_RGB.png Dimensions: 1024 x 1024 Camera: #24 - PERSPECTIVE Focal Length: 1228.80px Features: 18868 Elapsed time: 1.040 [minutes]

============================================================= Exhaustive feature matching

ERROR: Not enough GPU memory to match 20112 features. Reduce the maximum number of matches. ERROR: SiftGPU not fully supported

============================================================ Loading database

Loading cameras... 24 in 0.000s Loading matches... 0 in 0.000s Loading images... 24 in 0.000s (connected 0) Building correspondence graph... in 0.000s (ignored 0)

... Continues with more errors...

I am pretty sure that I have enough GPU memory. I have tried running it on my machine´s GPU (4GB) and on a GPU server (24GB) and both of them produced the same error. With such GPUs I doubt that the problem is a lack of memory for just this example.

To further add, I have tried running this with and without strm4, both with the same output.

Kai-46 commented 2 years ago

@SBCV , thanks for pointing out the cuda issue.

@A-guridi, Maybe try reducing the max_num_features to 10000, and max_num_matches to 20000, in order to reduce the memory usage? If you are still running out of GPU memory, try further decreasing these two hyper-parameters.

A-guridi commented 2 years ago

Thanks, worked like a charm !!

I take the chance to point out that there is an error in satellite_sfm.py in line 27:

You need to write latlonalt_bbx instead of just latlonalt to run with srtm4.

Many thanks for your work !!