GithubHelp home page GithubHelp logo

jczarnowski / deepfactors Goto Github PK

View Code? Open in Web Editor NEW
621.0 47.0 82.0 16.85 MB

Real-Time Probabilistic Dense Monocular SLAM Using Compact Code Representation

Home Page: https://www.imperial.ac.uk/dyson-robotics-lab/projects/deepfactors

License: Other

CMake 3.96% Shell 0.81% Python 1.03% C++ 93.28% GLSL 0.92%

deepfactors's Introduction

DeepFactors is a Dense Monocular SLAM system that takes in a stream of RGB images from a single camera and produces a dense geometric reconstruction in the form of a keyframe map. You can see the system in action in this YouTube video. The key features of this work include:

  • Joint, interactive real-time probabilistic inference on dense geometry
  • Natural integration of learned priors and classical geometry
  • Easy to extend with additional sensors, due to the use of GTSAM as the mapping backend
  • Trivial initialisation: just point the camera and press a button!

The method has been described in the paper DeepFactors: Real-Time Probabilistic Dense Monocular SLAM

Disclaimer

Please bear in mind that this repository contains research code, which is not perfect and elegant due to the experimental nature of the project and time constraints. While we have tried to keep things reasonably clean, the PhD programme did not grant us the liberty of refactoring the code. DeepFactors is also an experimental monocular dense system, which naturally performs worse than its RGB-D counterparts, and is not meant to be an out-of-the-box SLAM solution that can be used in a product.

The network provided along this system release has been trained on the ScanNet dataset and therefore will work best on similar sequences. If you want to increase performance in your specific domain, please consider training a network on your data. We currently do not provide training code, but might release it later.

Dependencies

Prerequisites

  • C++17
  • CMake >= 3.7
  • unzip and wget
  • An NVIDIA GPU with CUDA

Required system dependencies

Core library dependencies:

  • Boost
  • CUDA
  • Gflags
  • Glog
  • Jsoncpp
  • OpenCV
  • OpenNI2
  • GLEW
  • TensorFlow C API

Vendored dependencies

The following dependencies are included and build together with the project:

Getting Started

Get the code

Clone the repository with all submodules:

git clone --recursive <url>

If you forgot to clone with --recursive then run:

git submodule update --init --recursive

Install system dependencies

Depending on your linux distribution, you might need to perform different steps to install required dependencies. Below you can find some hints on how to do this. We have tested these instructions on fresh installs of Arch Linux and Ubuntu 18.04.

Ubuntu 18.04

Install the required packages with apt:

sudo apt install cmake libboost-all-dev libglew-dev libgoogle-glog-dev \
      libjsoncpp-dev libopencv-dev libopenni2-dev unzip wget

You will also need to install the TensorFlow C API. If you have CUDA 10.0 and cuDNN 7.5, you can simply download the pre-built binaries by following these instructions. When using a different version of CUDA or cuDNN, pre-compiled TensorFlow C API will not work and you have to compile it from source.

Arch Linux

Install the following official packages:

boost cuda gflags glew google-glog jsoncpp opencv tensorflow-cuda 

You will also need the openni2 AUR package.

Compile third-party dependencies

Build the vendorized dependencies with:

./thirdparty/makedeps.sh

This will build all CMake dependencies. You can speed up compilation with the --threads option, but it might cause your PC to run out of memory in some cases:

./thirdparty/makedeps.sh --threads 5

Build DeepFactors

Configure project with CMake and start the build. For example:

mkdir build
cd build
cmake ..
make

You can speed up the compilation by using multiple threads e.g. make -j5.

Running the system

First, download the example network trained by the authors:

bash scripts/download_network.bash

In order to run the demonstration you will need to request access to the ScanNet dataset by following instructions on the authors's website, which involve sending a signed TOS agreement via email. You should receive an email giving you access to the download-scannet.py script. Please place it in the scripts subdirectory of this repository as such: scripts/download-scannet.py. You can then run a quick demo of the system with:

bash scripts/run_scannet.bash

The script will download, unpack and preprocess a sample ScanNet scene and run DeepFactors on it. You can also run the system on a different scene by specifying it on the command line:

bash scripts/run_scannet.bash --scene_id <scene_id>

Here are some example scenes: scene0565_00, scene0334_01, scene0084_00.

On a successful system start, you should see the following window:

Running the system on a live camera

To run the system in the odometry configuration on a live OpenNI device such as Asus Xtion:

build/bin/df_demo --flagfile=data/flags/live_odom.flags --source_url=openni://<camera_id>

where <camera_id> is the index your camera. This can be set to 0 to open the first camera connected to the PC. The local refinement mode can be started with:

build/bin/df_demo --flagfile=data/flags/live_refine.flags --source_url=openni://<camera_id>

The system also supports the flycap source that allows you to use a PointGrey camera using the FlyCapture API. This feature needs to be enabled during compilation with DF_WITH_FLYCAP=ON.

The following keys can be used to control the system:

  • r resets the slam system
  • space initializes the system and later allows adding new views to refine current keyframe
  • p pauses camera input. Allows for a break to rotate the reconstructed model
  • n spawns a new keyframe

Running the system on TUM RGB-D

Download selected sequences from the dataset website and put them into some directory. You also need to download the associate.py script and use it to associate the RGB and depth images based on their timestamps:

python associate.py <seqdir>/rgb.txt <seqdir>/depth.txt > <seqdir>/associate.txt

where <seqdir> is the path to the downloaded TUM sequence. This step needs to be repeated for each sequence you want to run DeepFactors on. To run the system on a preprocessed sequence:

build/bin/df_demo --flagfile=data/flags/dataset_odom.flags --source_url=tum://<seqdir>

Tools

We provide several tools which can be built using the DF_BUILD_TOOLS cmake option. The resulting binaries are located in <build_dir>/bin:

  • decode_image Loads a specified input image and displays the decoded zero-code and explicitly predicted code for it, producing an initial depth (proximity) prediction. This allows to test the network and compare zero code prediction with explicit code prediction. The program also provides timing information.

  • kernel_benchmark Allows to tune the number of blocks and threads used in the core CUDA kernels by grid search and benchmarking. These parameters can be specified with the following command line options:

    --sfm_step_blocks=
    --sfm_step_threads=
    --sfm_eval_blocks=
    --sfm_eval_threads=
    
  • result_viewer Reads in a trajectory from a dataset and displays reprojected ground-truth depth and the ground-truth trajectory optionally along with an estimated trajectory (typically the result of running DeepFactors on the same sequence). Allows for qualitative evaluation of results and converting dataset trajectories to TUM format.

  • test_matching Loads in two images and runs our feature matching algorithm on them. Used to test our feature matching and to tune its parameters

  • voc_builder Builds a BRISK feature vocabulary for DBoW2 based on selected TUM dataset sequences.

  • voc_test Allows to test a vocabulary on a set of images by calculating similarity among them and the confusion matrix

Evaluation

To save results, specify the option -run_log_dir=results. This will save each system run in a timestamped folder under results. That folder will include the estimated trajectory in the TUM format, saved keyframes, debug images and parameters used to run the system.

Acknowledgements

Codebase:

Paper authors:

Testing/Bug Fixes for the open source release:

Citation

If you find DeepFactors useful for your research, please cite the paper as:

@article{Czarnowski:2020:10.1109/lra.2020.2965415,
   author = {Czarnowski, J and Laidlow, T and Clark, R and Davison, AJ},
   doi = {10.1109/lra.2020.2965415},
   journal = {IEEE Robotics and Automation Letters},
   pages = {721--728},
   title = {DeepFactors: Real-time probabilistic dense monocular SLAM},
   url = {http://dx.doi.org/10.1109/lra.2020.2965415},
   volume = {5},
   year = {2020}
}

deepfactors's People

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

deepfactors's Issues

About pthread

Hello, thank you for your work. And when i run the 'makedeps.sh' in thirdparty folder, i encountered the question, 'usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgtest.a(gtest-all.cc.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'', what should i do to solve it?

Running session failed: Conv2DCustomBackpropInputOp only supports NHWC.

dear jczarnowski:
When I run the test data with "bash scripts / run_scan. Bash", the system outputs the following error:

terminate called after throwing an instance of 'std::runtime_error'
what(): Running session failed: Conv2DCustomBackpropInputOp only supports NHWC.
[[{{node CNN/dpt_decode/dpt_std_pyr/pyr_0/conv2d_transpose}}]]
scripts/run_scannet.bash: line 102: 5729 Aborted (core dumped) ${df_bin} --flagfile=data/flags/dataset_odom.flags --source_url=scannet://${seq_dir}
~/Desktop/DeepFactors

Please help me!

scripts/run_scannet.bash: line 102: 3011 Illegal instruction ${df_bin} --flagfile=data/flags/dataset_odom.flags --source_url=scannet://${seq_dir}

I'm trying to run a demo of the system but I get the following error when running bash scripts/run_scannet.bash :

/mnt/d/Documenti/ETH/3DV/DeepFactors /mnt/d/Documenti/ETH/3DV/DeepFactors
-- Using default build directory /mnt/d/Documenti/ETH/3DV/DeepFactors/build
-- You can override it with the build_dir env variable
patching file download-scannet.py
Reversed (or previously applied) patch detected! Skipping patch.
6 out of 6 hunks ignored
-- Getting ScanNet test sequence scene0356_02. This might take a while
-- Scene output directory download/scene0356_02 already exists
-- Starting DeepFactors
scripts/run_scannet.bash: line 102: 3011 Illegal instruction ${df_bin} --flagfile=data/flags/dataset_odom.flags --source_url=scannet://${seq_dir}

Here is the related code snippet:

image

Conv2DCustomBackpropInputOp only supports NHWC

Dear colleagues, please tell, how to solve this problem?

build/bin/df_demo --flagfile=data/flags/dataset_odom.flags --source_url=tum:///home/gleb/TUM_DATASETS/rgbd_dataset_freiburg3_long_office_household
I0722 19:42:01.418680 28296 camera_interface_factory.cpp:45] prefix: tum, remainder: /home/gleb/TUM_DATASETS/rgbd_dataset_freiburg3_long_office_household
I0722 19:42:01.443441 28296 tum_interface.cpp:164] Frame timestamp is smaller then first pose timestamp for frame 0
I0722 19:42:01.443459 28296 tum_interface.cpp:164] Frame timestamp is smaller then first pose timestamp for frame 1
I0722 19:42:01.443461 28296 tum_interface.cpp:164] Frame timestamp is smaller then first pose timestamp for frame 2
I0722 19:42:01.546115 28296 cuda_context.cpp:114] Selected GPU 0: GeForce GTX 1070
2020-07-22 19:42:02.029951: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-22 19:42:02.033890: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3600000000 Hz
2020-07-22 19:42:02.034199: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x56491d08ecd0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-22 19:42:02.034213: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
ISAM2 params
type: ISAM2GaussNewtonParams
wildfireThreshold: 0.001
relinearizeThreshold: 0.03
relinearizeSkip: 1
enableRelinearization: 1
evaluateNonlinearError: 0
factorization: CHOLESKY
cacheLinearizedFactors: 1
enableDetailedResults: 1
enablePartialRelinearizationCheck: 1
findUnusedFactorSlots: 1
I0722 19:42:02.036118 28296 deepfactors.cpp:183] Loading vocabulary from: data/voc/small_voc.yml.gz
I0722 19:42:02.078781 28296 live_demo.cpp:129] Entering processing loop
I0722 19:42:02.078797 28296 live_demo.cpp:140] Initializing system on the first frame
I0722 19:42:02.078799 28329 live_demo.cpp:238] Visualization thread started
2020-07-22 19:42:06.281578: E tensorflow/core/common_runtime/executor.cc:642] Executor failed to create kernel. Invalid argument: Conv2DCustomBackpropInputOp only supports NHWC.
[[{{node CNN/dpt_decode/dpt_std_pyr/pyr_0/conv2d_transpose}}]]
terminate called after throwing an instance of 'std::runtime_error'
what(): Running session failed: Conv2DCustomBackpropInputOp only supports NHWC.
[[{{node CNN/dpt_decode/dpt_std_pyr/pyr_0/conv2d_transpose}}]]

How to reproduce the same results on TUM sequences?

I've tried to reproduce the results on tum/360,desk,desk2,rpy,xyz, but couldn't get the same results.
The following results were obtained by comparing the outputted keyframe trajectories with ground truths.
desk 0.228
desk2 0.324
360 0.304
rpy 0.091
xyz 0.054

Can you tell me how to reproduce the results given in the paper.

monocular camera

I want to experiment with image(video) data taken with a monocular camera.
Is it possible to do that?
If you can, please tell me what to do.
Regards

My camera is a RICOH THETA V and iphone.

Build dependency library display error

hi@jczarnowski:
I'm a rookie in programming ,I intend to learn the implementation creativity of the algorithm. When I try to compile the third-party dependency library with ". / thirdparty / makedeps.sh", the compiler prompts:
/home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/util
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/util/EmulateArray.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h
-- Up-to-date: /home/zhlx007/Desktop/DeepFactors/thirdparty/install/include/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h
Building brisk
Error: could not load cache

I have tried many times and the result is the same. So I write to you for your guidance and help.

download_network.bash failed

Hello,
When I run download_network.bash, it failed like below:
./scripts/download_network.bash

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

Do you know what could be wrong ?

Thanks very much

Xiang

OpenGL Error : GLSL 3.30 is not supported

I1210 22:35:58.294739 30777 deepfactors.cpp:183] Loading vocabulary from: /home/ss/DeepFactors/data/voc/small_voc.yml.gz
I1210 22:35:58.342175 30777 live_demo.cpp:129] Entering processing loop
I1210 22:35:58.342185 30829 live_demo.cpp:238] Visualization thread started
I1210 22:35:58.342198 30777 live_demo.cpp:140] Initializing system on the first frame
Framebuffer with requested attributes not available. Using available framebuffer. You may see visual artifacts.I1210 22:35:58.390899 30829 visualizer.cpp:54] OpenGL Debug message: 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES
F1210 22:35:58.390920 30829 visualizer.cpp:56] OpenGL error: 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES

Hello, After many hours configuration, This error I can't solve.(My enviroment is Ubuntu 16.04 and Cuda 10.1, Opencv-3.4.3)
Can you help me?

cudaError code: out of memory

Thanks again for releasing the code. Great work!

I am running a modified version of your code. It is just a modification to make it run on Ubuntu 16.04.

However, I was wondering if it is normal that you are getting out-of-memory error on Ubuntu 18.04. I got

Exception in slam: CUDAException: Unable to cudaMallocPitch

I also observed that the GPU memory usage was getting higher and higher until it reached the maximum usage before the program crashed. I tested on a ScanNet sequence and a TUM RGBD sequence.

Other than that, the point cloud output and camera tracking are pretty much the same as what I saw in the video and the screenshots.
deepfactor

Error in your relative pose jacobian to pose0 and pose1 jacobian calculation

Your relative pose to pose0 and pose1-related jacobian calculation is wrong. Since both of your delta pose use left-side convention, it is not as simple as multiply a relpose_J_pose0 and relpose_J_pose1 after xx_J_relpose to get what you need. I have confirmed this error and the corrected version runs much more accurately.

Please refer to Blanco Claraco, José Luis. 2017. “A Tutorial on SE(3) Transformation Parameterizations and on-Manifold Optimization.” University of Malaga, Tech. Rep, no. 3 for correction.

OptimizeRep may never get removed

Hello,
First off thanks for the awesome code! Had thorough fun going through the code and using it. Found this one use case which, although unlikely, may happen:
In OptimizeWork the condition for SignalRemove is as below:

template <typename Scalar>
void OptimizeWork<Scalar>::Update()
{
  if (active_level_ >= 0 && --iters_[active_level_] < 0)
    active_level_ -= 1;

  if (remove_after_ && active_level_ < 0)
    SignalRemove();
}

However, OptimizeRep, never sets remove_after flag to true. So SignalRemove would never be invoked.
Another possible code path which works well for OptimizePhoto is through SignalNoRelinearize in Mapper::MappingStep(), when isam_res_.variablesRelinearized == 0 is met. But that also wouldn't work here.
I am trying to reproduce this issue but am stuck because ReprojectionFactors don't get added for me at all in tum-d dataset (will probably raise a query if I am still not able to fix it). But I suppose the correct way to handle this code would be to implement Update() in the each of the child classes as opposed to OptimizeWork?

Compiling third-party dependencies does not work correctly

Thank you for publishing such an excellent code!

I tried to compile it with running makedeps.sh, I got the following error:

./thirdparty/makedeps.sh: line 148: patch/brisk-missing-functional.patch: No such file or directory
./thirdparty/makedeps.sh: line 149: patch/brisk-opencv4.patch: No such file or directory

It appears that downloaded brisk (version 2.0.5) was not unzipped with the correct directory structure.
I eventually resolved this by changing the version of brisk from 2.0.5 to 2.0.2!

It is recommended that you change the version of brisk in makedeps.sh to 2.0.2 or change the code to allow download as an appropriate directory structure.

cudaError code: out of memory (2)

hi, wher run "bash scripts/run_scannet.bash", there are some erros:
`2020-06-04 21:17:57.491545: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-06-04 21:18:24.873704: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-06-04 21:18:25.891247: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-04 21:18:26.042894: I tensorflow/stream_executor/cuda/cuda_driver.cc:831] failed to allocate 2.46G (2637299712 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory
2020-06-04 21:18:27.309915: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.21GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2020-06-04 21:18:27.309964: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.21GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
I0604 21:18:29.635712 15844 mapper.cpp:973] Predicted code: -0.42332 0.587109 -3.20559 -1.51732 0.119985 4.01925 1.02588 -6.02855 1.06465 1.36855 2.08156 -0.731649 -2.07897 -0.159496 -5.41297 2.68764 4.25025 -1.98336 -3.48971 -2.25345 -0.701885 -5.20343 4.59833 -1.28721 2.40772 4.0764 6.57294 2.55272 -3.17423 -2.14269 -3.59266 -1.91305
I0604 21:18:29.950726 15844 deepfactors.cpp:321] CUDAException: [SfmAligner::RunStep] kernel launch failed
cudaError code: out of memory (2)
E0604 21:18:29.950767 15844 deepfactors.cpp:322] Mapping failed, saving debug images
I0604 21:18:29.951128 15844 mapper.cpp:612] CodePrior on c1
I0604 21:18:29.951200 15844 mapper.cpp:615] PosePrior on p1
I0604 21:18:29.951215 15844 mapper.cpp:603] PhotometricFactor p1 -> a1, pyrlevel = 2
I0604 21:18:29.951241 15844 work_manager.cpp:135] [2] OptimizePhoto kf1 -> fr1 iters = 14 active_level = 2 new level = 0 finished = 0 factor indices =
I0604 21:18:29.951313 15844 live_demo.cpp:207] Exception in slam: CUDAException: [SfmAligner::RunStep] kernel launch failed
cudaError code: out of memory (2)
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.2.0) /home/mext/Downloads/opencv-4.2.0/modules/imgcodecs/src/loadsave.cpp:715: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

scripts/run_scannet.bash: line 102: 15844 Aborted (core dumped) ${df_bin} --flagfile=data/flags/dataset_odom.flags --source_url=scannet://${seq_dir}
~/keepCoding/slam_project/DeepFactors
`
It looks like more memory needed, it there any way to limit the memory used? I am using GeForce GTX 1650 with 4GB memory

About vision_core

Sorry to interrupt.
I try to compile the vison_core. But I got this error:
2021-07-27 14-37-21屏幕截图

However, when I add std=c++11, a new error occurs. Is there any way to solve it? Thanks a lot.
2021-07-27 14-39-12屏幕截图

nvcc fatal : Unsupported gpu architecture 'compute_75'

Hi, when run " ./thirdparty/makedeps.sh --threads 5", there some errors:
(CUDA 10.0 , CUDNN 7.5)
Scanning dependencies of target VisionCore
[ 4%] Building CXX object CMakeFiles/VisionCore.dir/sources/Image/BufferOpsCPU.cpp.o
[ 8%] Building CXX object CMakeFiles/VisionCore.dir/sources/Image/ConnectedComponents.cpp.o
[ 13%] Building CXX object CMakeFiles/VisionCore.dir/sources/Image/ColorMapCPU.cpp.o
[ 17%] Building CXX object CMakeFiles/VisionCore.dir/sources/Image/FiltersCPU.cpp.o
[ 21%] Building CXX object CMakeFiles/VisionCore.dir/sources/Image/PixelConvertCPU.cpp.o
[ 26%] Building CXX object CMakeFiles/VisionCore.dir/sources/IO/ImageIO.cpp.o
[ 30%] Building CXX object CMakeFiles/VisionCore.dir/sources/IO/ImageUtilsCPU.cpp.o
[ 34%] Building CXX object CMakeFiles/VisionCore.dir/sources/IO/PLYModel.cpp.o
[ 39%] Building CXX object CMakeFiles/VisionCore.dir/sources/IO/SaveBuffer.cpp.o
[ 43%] Building CXX object CMakeFiles/VisionCore.dir/sources/Math/ConvolutionCPU.cpp.o
[ 47%] Building CXX object CMakeFiles/VisionCore.dir/sources/VisionCore.cpp.o
[ 52%] Building CXX object CMakeFiles/VisionCore.dir/sources/WrapGL/WrapGLBuffer.cpp.o
[ 56%] Building CXX object CMakeFiles/VisionCore.dir/sources/WrapGL/WrapGLCommon.cpp.o
[ 60%] Building CXX object CMakeFiles/VisionCore.dir/sources/WrapGL/WrapGLFramebuffer.cpp.o
[ 65%] Building CXX object CMakeFiles/VisionCore.dir/sources/Math/Random.cpp.o
[ 69%] Building CUDA object CMakeFiles/VisionCore.dir/sources/Image/BufferOpsGPU.cpp.o
nvcc fatal : Unsupported gpu architecture 'compute_75'
CMakeFiles/VisionCore.dir/build.make:422: recipe for target 'CMakeFiles/VisionCore.dir/sources/Image/BufferOpsGPU.cpp.o' failed
make[2]: *** [CMakeFiles/VisionCore.dir/sources/Image/BufferOpsGPU.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/VisionCore.dir/all' failed
make[1]: *** [CMakeFiles/VisionCore.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

How to solve this problem ?

Source Webcam

I am running some tests as ground truth for evaluations and i want to use my laptop webcam, Any idea how to source it?
Regards

Build Issue with cmake 3.20.5

Hi @jczarnowski,

thank you for this nice open-source project! Working with the code was a pleasure so far!

I just tried to build the dependencies (./makedeps.sh) with cmake 3.20.5 and it doesn't build with this error

CMake Error: Unknown argument -Eigen_DIR=/some/dir/I/removed

I think this is a cmake bug that is reported here: https://gitlab.kitware.com/cmake/cmake/-/issues/22060. Additionally, I built the project on the same machine with cmake 3.19 and all goes well.

Maybe you could add an if clause that removes the -- -j${num_threads} part from line 30 if num_threads=1

  ${CMAKE} --build ${builddir} --target install -- -j${num_threads} || exit

or add a comment for cmake 3.20 users until this bug is fixed.

Cheers
Lukas

Saving the results

Hello @jczarnowski

I was wondering if there is a way to save the resulting 3d reconstructed model as a point cloud or any other file format, and if it would be a build up of all the frames

And would it be possible to modify deepfactors to add such functionality

I encountered an error while compiling DeepFactors,does anyone know how to fix this?

[ 27%] Building CXX object sources/core/CMakeFiles/df_core.dir/gtsam/photometric_factor.cpp.o
In file included from /usr/include/boost/smart_ptr/make_shared.hpp:14:0,
from /usr/include/boost/archive/detail/helper_collection.hpp:28,
from /usr/include/boost/archive/detail/basic_iarchive.hpp:28,
from /usr/include/boost/serialization/collections_load_imp.hpp:35,
from /usr/include/boost/serialization/list.hpp:24,
from /usr/local/include/gtsam/base/FastList.h:25,
from /usr/local/include/gtsam/inference/Key.h:20,
from /usr/local/include/gtsam/inference/Factor.h:28,
from /usr/local/include/gtsam/linear/GaussianFactor.h:23,
from /usr/local/include/gtsam/linear/HessianFactor.h:21,
from /home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:21:
/usr/include/boost/smart_ptr/make_shared_object.hpp: In instantiation of ‘typename boost::detail::sp_if_not_array::type boost::make_shared(Args&& ...) [with T = gtsam::HessianFactor; Args = {const std::vector<long unsigned int, std::allocator >&, std::vector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, std::allocator<Eigen::Matrix<double, -1, -1, 0, -1, -1> > >&, std::vector<Eigen::Matrix<double, -1, 1, 0, -1, 1>, std::allocator<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >&, double}; typename boost::detail::sp_if_not_array::type = boost::shared_ptrgtsam::HessianFactor]’:
/home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:180:50: required from ‘boost::shared_ptrgtsam::GaussianFactor df::PhotometricFactor<Scalar, CS>::linearize(const gtsam::Values&) const [with Scalar = float; int CS = 32]’
/home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:345:16: required from here
/usr/include/boost/smart_ptr/make_shared_object.hpp:256:5: error: no matching function for call to ‘gtsam::HessianFactor::HessianFactor(const std::vector&, std::vector<Eigen::Matrix<double, -1, -1> >&, std::vector<Eigen::Matrix<double, -1, 1> >&, double)’
::new( pv ) T( boost::detail::sp_forward( args )... );

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:21:0:
/usr/local/include/gtsam/linear/HessianFactor.h:361:5: note: candidate: gtsam::HessianFactor::HessianFactor(const gtsam::Scatter&)
HessianFactor(const Scatter& scatter);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:361:5: note: candidate expects 1 argument, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:178:14: note: candidate: gtsam::HessianFactor::HessianFactor(const gtsam::GaussianFactorGraph&, boost::optional<const gtsam::Scatter&>)
explicit HessianFactor(const GaussianFactorGraph& factors,
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:178:14: note: candidate expects 2 arguments, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:175:14: note: candidate: gtsam::HessianFactor::HessianFactor(const gtsam::GaussianFactor&)
explicit HessianFactor(const GaussianFactor& factor);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:175:14: note: candidate expects 1 argument, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:171:14: note: candidate: gtsam::HessianFactor::HessianFactor(const gtsam::JacobianFactor&)
explicit HessianFactor(const JacobianFactor& cg);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:171:14: note: candidate expects 1 argument, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:168:5: note: candidate: template gtsam::HessianFactor::HessianFactor(const KEYS&, const gtsam::SymmetricBlockMatrix&)
HessianFactor(const KEYS& keys, const SymmetricBlockMatrix& augmentedInformation);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:168:5: note: template argument deduction/substitution failed:
In file included from /usr/include/boost/smart_ptr/make_shared.hpp:14:0,
from /usr/include/boost/archive/detail/helper_collection.hpp:28,
from /usr/include/boost/archive/detail/basic_iarchive.hpp:28,
from /usr/include/boost/serialization/collections_load_imp.hpp:35,
from /usr/include/boost/serialization/list.hpp:24,
from /usr/local/include/gtsam/base/FastList.h:25,
from /usr/local/include/gtsam/inference/Key.h:20,
from /usr/local/include/gtsam/inference/Factor.h:28,
from /usr/local/include/gtsam/linear/GaussianFactor.h:23,
from /usr/local/include/gtsam/linear/HessianFactor.h:21,
from /home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:21:
/usr/include/boost/smart_ptr/make_shared_object.hpp:256:5: note: candidate expects 2 arguments, 4 provided
::new( pv ) T( boost::detail::sp_forward( args )... );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ljw/DeepFactors/sources/core/gtsam/photometric_factor.cpp:21:0:
/usr/local/include/gtsam/linear/HessianFactor.h:162:5: note: candidate: gtsam::HessianFactor::HessianFactor(const KeyVector&, const std::vector<Eigen::Matrix<double, -1, -1> >&, const std::vector<Eigen::Matrix<double, -1, 1> >&, double)
HessianFactor(const KeyVector& js, const std::vector& Gs,
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:162:5: note: no known conversion for argument 1 from ‘const std::vector’ to ‘const KeyVector& {aka const std::vector<long unsigned int, tbb::tbb_allocator >&}’
/usr/local/include/gtsam/linear/HessianFactor.h:153:5: note: candidate: gtsam::HessianFactor::HessianFactor(gtsam::Key, gtsam::Key, gtsam::Key, const Matrix&, const Matrix&, const Matrix&, const Vector&, const Matrix&, const Matrix&, const Vector&, const Matrix&, const Vector&, double)
HessianFactor(Key j1, Key j2, Key j3,
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:153:5: note: candidate expects 13 arguments, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:145:5: note: candidate: gtsam::HessianFactor::HessianFactor(gtsam::Key, gtsam::Key, const Matrix&, const Matrix&, const Vector&, const Matrix&, const Vector&, double)
HessianFactor(Key j1, Key j2,
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:145:5: note: candidate expects 8 arguments, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:128:5: note: candidate: gtsam::HessianFactor::HessianFactor(gtsam::Key, const Vector&, const Matrix&)
HessianFactor(Key j, const Vector& mu, const Matrix& Sigma);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:128:5: note: candidate expects 3 arguments, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:123:5: note: candidate: gtsam::HessianFactor::HessianFactor(gtsam::Key, const Matrix&, const Vector&, double)
HessianFactor(Key j, const Matrix& G, const Vector& g, double f);
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:123:5: note: no known conversion for argument 1 from ‘const std::vector’ to ‘gtsam::Key {aka long unsigned int}’
/usr/local/include/gtsam/linear/HessianFactor.h:116:5: note: candidate: gtsam::HessianFactor::HessianFactor()
HessianFactor();
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:116:5: note: candidate expects 0 arguments, 4 provided
/usr/local/include/gtsam/linear/HessianFactor.h:101:22: note: candidate: gtsam::HessianFactor::HessianFactor(const gtsam::HessianFactor&)
class GTSAM_EXPORT HessianFactor : public GaussianFactor {
^~~~~~~~~~~~~
/usr/local/include/gtsam/linear/HessianFactor.h:101:22: note: candidate expects 1 argument, 4 provided
cc1plus: warning: unrecognized command line option ‘-Wno-catch-value’
sources/core/CMakeFiles/df_core.dir/build.make:86: recipe for target 'sources/core/CMakeFiles/df_core.dir/gtsam/photometric_factor.cpp.o' failed
make[2]: *** [sources/core/CMakeFiles/df_core.dir/gtsam/photometric_factor.cpp.o] Error 1
CMakeFiles/Makefile2:195: recipe for target 'sources/core/CMakeFiles/df_core.dir/all' failed
make[1]: *** [sources/core/CMakeFiles/df_core.dir/all] Error 2
Makefile:129: recipe for target 'all' failed

failed to load the pre training model

Hello, failed to load the pre training model. The environment is cuda11.4. What's the reason

terminate called after throwing an instance of 'std::runtime_error'
what(): Failed importing graph from: data/nets/scannet256_32_frozen.pb

Docker issue

while in docker workspace running 'scripts/run_scannet.bash' yields error after successfully downloading scene

/DeepFactors/build/bin/df_demo: error while loading shared libraries: libmetis.so: cannot open shared object file: No such file or directory
/DeepFactors

Questions about evaluation

Hi,

First of all, great work! I am looking forward to the release of the code.

About the evaluation, I have some questions:

  1. In Section VI C, the first paragraph explains the use of ground truth depth maps to evaluate the reconstruction accuracy. The next paragraph talks about the use of TUM benchmark scripts to scale the depth maps and the trajectory. However, In Table II, I can't find the ATE of those sequences.
  2. Also, Table III only shows the ATE but not the reconstruction error on another set of sequences. Is there a reason why do you have two different sets of sequences with two different metrics?
  3. You did mention in the paper that you evaluated the reconstruction errors of the scaled depth map using SfMLearner code. But what I found in SfMLearner depth evaluation code is that each depth map is individually scaled according to the medians of the ground truth depth map and the predicted depth map, see here. Therefore, I am wondering how exactly did you evaluate the reconstruction errors.

It would be great if you can share at least your evaluation code to minimise the discrepancy between the papers working on monocular dense reconstruction problems, given the fact that running SLAM is already non-deterministic on different machines. Thanks again.

Can not finish building properly, help please

I have the below error at bulding. There are some CMake warnings but I cannot figure out if the build error is due to those warnings and what they mean neiher.
Can you help me?
(I am building everything under colab, CUDA version is 10.1 and CuDNN 7)

`
%cd /content/DeepFactors/
! mkdir build
% cd build
! cmake ..
! make

/content/DeepFactors
/content/DeepFactors/build
-- The CXX compiler identification is GNU 7.5.0
-- The CUDA compiler identification is NVIDIA 10.1.243
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
Project: deepfactors
Version: 0.1
Build type: Release
Compiled on: Linux-4.19.104+
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - found
-- Found OpenCL: /usr/lib/x86_64-linux-gnu/libOpenCL.so (found version "2.2")
-- Found GLEW: /usr/include
-- GTSAM include directory: /content/DeepFactors/thirdparty/install/lib/cmake/GTSAM/../../../include
-- Found Threads: TRUE
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
-- GTSAM include directory: /content/DeepFactors/thirdparty/install/lib/cmake/GTSAM/../../../include
-- Found TensorFlow (include: /usr/local/include, library: /usr/local/lib/libtensorflow.so)
-- Autodetected CUDA architecture(s): 7.5
Compiling for CUDA architectures: -gencode;arch=compute_75,code=sm_75
-- The C compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.17")
-- Configuring done
CMake Warning at sources/core/CMakeLists.txt:81 (add_library):
Cannot generate a safe runtime search path for target df_core 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:
  /usr/local/lib
runtime library [libtbb.so.2] 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.

-- Generating done
-- Build files have been written to: /content/DeepFactors/build
Scanning dependencies of target df_common
[ 1%] Building CXX object sources/common/CMakeFiles/df_common.dir/image_sequences.cpp.o
[ 3%] Building CXX object sources/common/CMakeFiles/df_common.dir/timing.cpp.o
...
[ 66%] Built target df_drivers
Scanning dependencies of target df_demo
[ 67%] Building CXX object sources/demo/CMakeFiles/df_demo.dir/main.cpp.o
[ 69%] Building CXX object sources/demo/CMakeFiles/df_demo.dir/live_demo.cpp.o
[ 70%] Linking CXX executable ../../bin/df_demo
/usr/lib/x86_64-linux-gnu/libGL.so: undefined reference to _glapi_tls_Current' collect2: error: ld returned 1 exit status sources/demo/CMakeFiles/df_demo.dir/build.make:185: recipe for target 'bin/df_demo' failed make[2]: *** [bin/df_demo] Error 1 CMakeFiles/Makefile2:352: recipe for target 'sources/demo/CMakeFiles/df_demo.dir/all' failed make[1]: *** [sources/demo/CMakeFiles/df_demo.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

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.