-
-
Save kwea123/f0e8f38ff2aa94495dbfe7ae9219f75c to your computer and use it in GitHub Desktop.
| { | |
| "nbformat": 4, | |
| "nbformat_minor": 0, | |
| "metadata": { | |
| "colab": { | |
| "name": "colmap_colab.ipynb", | |
| "provenance": [], | |
| "collapsed_sections": [], | |
| "authorship_tag": "ABX9TyPm82PiwqyzEJ6i0yaFnrIX", | |
| "include_colab_link": true | |
| }, | |
| "kernelspec": { | |
| "name": "python3", | |
| "display_name": "Python 3" | |
| }, | |
| "accelerator": "GPU" | |
| }, | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "view-in-github", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "<a href=\"https://colab.research.google.com/gist/kwea123/f0e8f38ff2aa94495dbfe7ae9219f75c/colmap_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "SpaQWAQg1VtD", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "# Installation" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "eGdRYPFIzvFs", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "!sudo apt-get install \\\n", | |
| " git \\\n", | |
| " cmake \\\n", | |
| " build-essential \\\n", | |
| " libboost-program-options-dev \\\n", | |
| " libboost-filesystem-dev \\\n", | |
| " libboost-graph-dev \\\n", | |
| " libboost-regex-dev \\\n", | |
| " libboost-system-dev \\\n", | |
| " libboost-test-dev \\\n", | |
| " libeigen3-dev \\\n", | |
| " libsuitesparse-dev \\\n", | |
| " libfreeimage-dev \\\n", | |
| " libgoogle-glog-dev \\\n", | |
| " libgflags-dev \\\n", | |
| " libglew-dev \\\n", | |
| " qtbase5-dev \\\n", | |
| " libqt5opengl5-dev \\\n", | |
| " libcgal-dev \\\n", | |
| " libcgal-qt5-dev" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "yptHICvs1evY", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "## Install Ceres-solver (takes 10~20 minutes...)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "gAwEYpOk0Irw", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "!sudo apt-get install libatlas-base-dev libsuitesparse-dev\n", | |
| "!git clone https://ceres-solver.googlesource.com/ceres-solver\n", | |
| "%cd ceres-solver\n", | |
| "!git checkout $(git describe --tags) # Checkout the latest release\n", | |
| "%mkdir build\n", | |
| "%cd build\n", | |
| "!cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF\n", | |
| "!make\n", | |
| "!sudo make install" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "lmePvOPY3dof", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "## Install colmap (takes another 10~20 minutes...)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "gKTtduYW3LpH", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "!git clone https://github.com/colmap/colmap\n", | |
| "%cd colmap\n", | |
| "!git checkout dev\n", | |
| "%mkdir build\n", | |
| "%cd build\n", | |
| "!cmake ..\n", | |
| "!make\n", | |
| "!sudo make install\n", | |
| "!CC=/usr/bin/gcc-6 CXX=/usr/bin/g++-6 cmake .." | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "AH2TnXfE8rCV", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "Next, we need to prepare the images to run colmap.\n", | |
| "First, create a folder in your google drive and a subfolder named `images`, and put your images inside." | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "GqVrYev0313H", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "## Mount your drive (to access data)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "4rH78spM2Rn-", | |
| "colab_type": "code", | |
| "colab": { | |
| "base_uri": "https://localhost:8080/", | |
| "height": 124 | |
| }, | |
| "outputId": "0b4a48e5-6e6d-4001-fd25-d184acff6c91" | |
| }, | |
| "source": [ | |
| "from google.colab import drive\n", | |
| "drive.mount('/content/drive/', force_remount=True)" | |
| ], | |
| "execution_count": 6, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": [ | |
| "Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n", | |
| "\n", | |
| "Enter your authorization code:\n", | |
| "··········\n", | |
| "Mounted at /content/drive/\n" | |
| ], | |
| "name": "stdout" | |
| } | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "0QbTfCds1yy_", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "## Clone LLFF util" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "QTt2JDhV0QQA", | |
| "colab_type": "code", | |
| "colab": { | |
| "base_uri": "https://localhost:8080/", | |
| "height": 173 | |
| }, | |
| "outputId": "1026caae-c17b-47ba-d160-e6fda96d6f26" | |
| }, | |
| "source": [ | |
| "%cd /content\n", | |
| "!git clone https://github.com/Fyusion/LLFF" | |
| ], | |
| "execution_count": 18, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": [ | |
| "/content\n", | |
| "Cloning into 'LLFF'...\n", | |
| "remote: Enumerating objects: 11, done.\u001b[K\n", | |
| "remote: Counting objects: 100% (11/11), done.\u001b[K\n", | |
| "remote: Compressing objects: 100% (10/10), done.\u001b[K\n", | |
| "remote: Total 759 (delta 1), reused 5 (delta 1), pack-reused 748\u001b[K\n", | |
| "Receiving objects: 100% (759/759), 31.94 MiB | 26.72 MiB/s, done.\n", | |
| "Resolving deltas: 100% (403/403), done.\n", | |
| "/content/LLFF\n" | |
| ], | |
| "name": "stdout" | |
| } | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "Zvxe5vDL7blW", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "# Run COLMAP! (depending on number of images, this takes 10~20 minutes)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "d9ryuCQt2hEv", | |
| "colab_type": "code", | |
| "colab": { | |
| "base_uri": "https://localhost:8080/", | |
| "height": 224 | |
| }, | |
| "outputId": "b5bccfb5-7ba8-44fd-fe93-eeae82be7fa9" | |
| }, | |
| "source": [ | |
| "%cd /content/LLFF\n", | |
| "# change the path below to your data folder (the folder containing the `images` folder)\n", | |
| "!python imgs2poses.py \"/content/drive/My Drive/colab/nerf/my/silica/\"" | |
| ], | |
| "execution_count": 19, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": [ | |
| "/content/LLFF\n", | |
| "Need to run COLMAP\n", | |
| "Features extracted\n", | |
| "Features matched\n", | |
| "Sparse map created\n", | |
| "Finished running COLMAP, see /content/drive/My Drive/colab/nerf/my/silica/colmap_output.txt for logs\n", | |
| "Post-colmap\n", | |
| "Cameras 5\n", | |
| "Images # 65\n", | |
| "Points (3181, 3) Visibility (3181, 65)\n", | |
| "Depth stats 1.9465594577666598 62.523538453729515 4.761593846905955\n", | |
| "Done with imgs2poses\n" | |
| ], | |
| "name": "stdout" | |
| } | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "MLP3_P9q8M9d", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "After running colmap, you will get a `poses_bounds.npy` file under your data folder, once you got that, you're ready to train!" | |
| ] | |
| } | |
| ] | |
| } |
@UncleTom111 The command I download and build Ceres Solver 2.0 is like below
!wget http://ceres-solver.org/ceres-solver-2.0.0.tar.gz
!tar -xvzf ceres-solver-2.0.0.tar.gz
%cd ceres-solver-2.0.0
%mkdir build
%cd build
!cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
!make
!sudo make install
I had the same error of @imadgohar ; I updated the dependencies chunk with the latest colmap installation here and the Ceres-solver chunk with that one proposed from @gdhy9064 .
Now everything works.
@gdhy9064 thanks for your advices!
@kwea123
I follow your instructions step by step, but I always encounter this problem. May I ask how I could solve this problem?

@Bohan-Zhang-2017 Maybe you can use this version of pose_utils.py to see if it works or not, referring to #Fyusion/LLFF#60.
@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.
Thank you for your reply! I have solved this problem.
When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?

@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use pose_utils.py I provided, it will generate a file named view_imgs.txt, just use the images listed in it as your dataset.
@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use
pose_utils.pyI provided, it will generate a file namedview_imgs.txt, just use the images listed in it as your dataset.
@kwea123
Thank you for your reply!
According to your suggestion, I got a result. But the result is not good. May I ask how I could solve this problem? (I also uploaded the view_imgs.txt file generated according to your program)


@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use
pose_utils.pyI provided, it will generate a file namedview_imgs.txt, just use the images listed in it as your dataset.@kwea123 Thank you for your reply! According to your suggestion, I got a result. But the result is not good. May I ask how I could solve this problem? (I also uploaded the
view_imgs.txtfile generated according to your program)
hhh, you seem to mistake me for the author. Maybe more training time would help? I'm not sure.
@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use
pose_utils.pyI provided, it will generate a file namedview_imgs.txt, just use the images listed in it as your dataset.@kwea123 Thank you for your reply! According to your suggestion, I got a result. But the result is not good. May I ask how I could solve this problem? (I also uploaded the
view_imgs.txtfile generated according to your program)[ ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif)  [ ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif)![]()
hhh, you seem to mistake me for the author. Maybe more training time would help? I'm not sure.
@gdhy9064
Thank you for helping me sincerely!
@kwea123 while installing the colmap I am getting this error, what I am missing here, exactly same steps I am following. @zjz123-eng Your problem is occuring bcs colmap is not installed correctly which I am trying here. Without it's installation I am facing same same error. Anyone else solved this problem? If yes, Please share your method. Thanks , values.end(), result.begin(), 0);it is because latest Ceres Solver 2.2 requires a fully C++17-compliant compiler, you can download the one with version 2.0 from here and build it colmap/colmap#1482. I also encountered the following error
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libOpenGL.so: undefined reference to `_glapi_tls_Current'I run
!sudo apt-get install autoconf automake libtooland build libglvnd from https://github.com/NVIDIA/libglvnd, and it is solved.
Hello, thank you for sharing, could you kindly share the code that you fixed which is working for you, I have tried all suggestions and I am still getting errors, I want to generate poses for a school project I am working on. I will really appreciate this. Thank you
@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use
pose_utils.pyI provided, it will generate a file namedview_imgs.txt, just use the images listed in it as your dataset.@kwea123 Thank you for your reply! According to your suggestion, I got a result. But the result is not good. May I ask how I could solve this problem? (I also uploaded the
view_imgs.txtfile generated according to your program)![]()
![]()
Hello @Bohan-Zhang-2017
Did you solve the problem of the failed result of the synthetic images?
I have the same error, and I would like to know if you managed to solve it
@kwea123
I follow your instructions step by step, but I always encounter this problem. May I ask how I could solve this problem?
Hello, I am facing but I get this error too, can someone help me figure it out?
Thank you
@gdhy9064 @zjz123-eng @imadgohar @bigian98 @Bohan-Zhang-2017
can any one help me in this error
Need to run COLMAP
[option_manager.cc:795] Check failed: ExistsDir(*image_path)
ERROR: Invalid options provided.
Traceback (most recent call last):
File "imgs2poses.py", line 18, in
gen_poses(args.scenedir, args.match_type)
File "/home/yaten/ceres-solver/build/colmap/build/LLFF/llff/poses/pose_utils.py", line 268, in gen_poses
run_colmap(basedir, match_type)
File "/home/yaten/ceres-solver/build/colmap/build/LLFF/llff/poses/colmap_wrapper.py", line 35, in run_colmap
feat_output = ( subprocess.check_output(feature_extractor_args, universal_newlines=True) )
File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['colmap', 'feature_extractor', '--database_path', '/home/yaten/data/database.db', '--image_path', '/home/yaten/data/images', '--ImageReader.single_camera', '1']' returned non-zero exit status 1.
Hi,
I met the error below!
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
Traceback (most recent call last):
File "imgs2poses.py", line 18, in <module>
gen_poses(args.scenedir, args.match_type)
File "/defaultShare/SHFP12/02_bevdet/nerf_pl/LLFF/llff/poses/pose_utils.py", line 268, in gen_poses
run_colmap(basedir, match_type)
File "/defaultShare/SHFP12/02_bevdet/nerf_pl/LLFF/llff/poses/colmap_wrapper.py", line 35, in run_colmap
feat_output = ( subprocess.check_output(feature_extractor_args, universal_newlines=True) )
File "/opt/conda/lib/python3.7/subprocess.py", line 411, in check_output
**kwargs).stdout
File "/opt/conda/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['colmap', 'feature_extractor', '--database_path', '/SHFP12/02_bevdet/LargeScaleNeRFPytorch/data/front_800w/20220103-00-00-01/database.db', '--image_path', '/SHFP12/02_bevdet/LargeScaleNeRFPytorch/data/front_800w/20220103-00-00-01/images', '--ImageReader.single_camera', '1']' returned non-zero exit status 1.
Si rencontré l'erreur comme suit
/usr/local/include/ceres/product_manifold.h:260:10 : erreur : 'exclusive_scan' n'est pas membre de 'std'
std ::exclusive_scan(values.begin(), values.end(), result.begin (), 0);c'est parce que le dernier Ceres Solver 2.2 nécessite un compilateur entièrement compatible C++ 17, vous pouvez télécharger celui avec la version 2.0 à partir d' ici et le construire colmap/colmap#1482 . J'ai également rencontré l'erreur suivante
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libOpenGL.so: undefined reference to `_glapi_tls_Current'Je lance
!sudo apt-get install autoconf automake libtoolet construis libglvnd à partir de https://github.com/NVIDIA/libglvnd , et c'est résolu.Salut, pouvez-vous montrer toute la commande sur la façon de télécharger et de construire le Ceres Solver 2.0 ? J'ai essayé le tutoriel d'installation officiel, mais j'ai quand même échoué.
If encountered the error as follow
/usr/local/include/ceres/product_manifold.h:260:10: error: ‘exclusive_scan’ is not a member of ‘std’
std::exclusive_scan(values.begin(), values.end(), result.begin(), 0);it is because latest Ceres Solver 2.2 requires a fully C++17-compliant compiler, you can download the one with version 2.0 from here and build it colmap/colmap#1482. I also encountered the following error
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libOpenGL.so: undefined reference to `_glapi_tls_Current'I run
!sudo apt-get install autoconf automake libtooland build libglvnd from https://github.com/NVIDIA/libglvnd, and it is solved.
hello, can you show me the instructions to build libglvnd
same error here 'FileNotFoundError: [Errno 2] No such file or directory: 'colmap''
Hello!Help!
The results are very vague. Does anyone else have the same problem?
@Bohan-Zhang-2017 Maybe you can use this version of
pose_utils.pyto see if it works or not, referring to #Fyusion/LLFF#60.Thank you for your reply! I have solved this problem. When I execute the code of "360 inward facing scene", I encounter this problem. May I ask how I could solve this problem?
If you use
pose_utils.pyI provided, it will generate a file namedview_imgs.txt, just use the images listed in it as your dataset.@kwea123 Thank you for your reply! According to your suggestion, I got a result. But the result is not good. May I ask how I could solve this problem? (I also uploaded the
view_imgs.txtfile generated according to your program)[  ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif) [ ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif)[ ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif)  [ ](https://user-images.githubusercontent.com/50520115/175796481-edb68deb-69a7-447d-a2d4-f515732162e4.gif)![]()
hhh, you seem to mistake me for the author. Maybe more training time would help? I'm not sure.
@gdhy9064 Thank you for helping me sincerely!
Have you solved the problem? I would like to ask you how to do it. I have the same problem, the picture is fuzzy and strange.
@smallpeachofchangan can you help with this error

@kwea123
I have these questions. How should I solve them? thank
error: pathspec 'dev' did not match any file(s) known to git
[210/210] Linking CXX executable src/colmap/exe/colmap
FAILED: src/colmap/exe/colmap
Hi I'm having the same problem, did you find a soln ? Do tell
Hi I'm having the same problem, did you find a soln ? Do tell
Hello! I've got this error.:
CMake Warning at cmake/CMakeHelper.cmake:103 (add_executable):
Cannot generate a safe runtime search path for target colmap_main because
files in some directories may conflict with libraries in implicit
directories:
runtime library [libtbb.so.12] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/lib
Some of these libraries may not be found correctly.
Call Stack (most recent call first):
src/colmap/exe/CMakeLists.txt:67 (COLMAP_ADD_EXECUTABLE)
CMake Error in src/colmap/math/CMakeLists.txt:
Imported target "metis" includes non-existent path
"/content/ceres-solver/build/colmap/build/colmap/METIS_INCLUDE_DIRS-NOTFOUND"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
-
The path was deleted, renamed, or moved to another location.
-
An install or uninstall procedure did not complete successfully.
-
The installation package was faulty and references files it does not
provide.
-- Generating done (0.2s)
CMake Generate step failed. Build files cannot be regenerated correctly.
Do you guys know how to fix it?
Hello! I've got this error.: CMake Warning at cmake/CMakeHelper.cmake:103 (add_executable): Cannot generate a safe runtime search path for target colmap_main because files in some directories may conflict with libraries in implicit directories:
runtime library [libtbb.so.12] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /usr/local/libSome of these libraries may not be found correctly. Call Stack (most recent call first): src/colmap/exe/CMakeLists.txt:67 (COLMAP_ADD_EXECUTABLE)
CMake Error in src/colmap/math/CMakeLists.txt: Imported target "metis" includes non-existent path
"/content/ceres-solver/build/colmap/build/colmap/METIS_INCLUDE_DIRS-NOTFOUND"in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
- The path was deleted, renamed, or moved to another location.
- An install or uninstall procedure did not complete successfully.
- The installation package was faulty and references files it does not
provide.-- Generating done (0.2s) CMake Generate step failed. Build files cannot be regenerated correctly.
Do you guys know how to fix it?
I am getting the same error!!!




Hi, can you show the whole command about how to download and build the Ceres Solver 2.0?
I tried the official installation tutorial, but somehow I still failed.