Giter Club home page Giter Club logo

eslam's Introduction

[CVPR 2023 Highlight]

ESLAM: Efficient Dense SLAM System Based on Hybrid Representation of Signed Distance Fields

Project Page | Paper


Installation

First you have to make sure that you have all dependencies in place. The simplest way to do so, is to use anaconda.

You can create an anaconda environment called eslam. For linux, you need to install libopenexr-dev before creating the environment.

sudo apt-get install libopenexr-dev
    
conda env create -f environment.yaml
conda activate eslam

If desired, the Open3D package can be installed in the headless rendering mode. This is useful for running ESLAM on a server without a display. We recommend to install from this commit as we observed bugs in other releases of Open3D.

Run

Replica

Download the data as below and the data is saved into the ./Datasets/Replica folder.

bash scripts/download_replica.sh

and you can run ESLAM:

python -W ignore run.py configs/Replica/room0.yaml

The mesh for evaluation is saved as $OUTPUT_FOLDER/mesh/final_mesh_eval_rec_culled.ply, where the unseen and occluded regions are culled using all frames.

ScanNet

Please follow the data downloading procedure on ScanNet website, and extract color/depth frames from the .sens file using this code.

[Directory structure of ScanNet (click to expand)]

DATAROOT is ./Datasets by default. If a sequence (sceneXXXX_XX) is stored in other places, please change the input_folder path in the config file or in the command line.

  DATAROOT
  └── scannet
      └── scans
          └── scene0000_00
              └── frames
                  ├── color
                  │   ├── 0.jpg
                  │   ├── 1.jpg
                  │   ├── ...
                  │   └── ...
                  ├── depth
                  │   ├── 0.png
                  │   ├── 1.png
                  │   ├── ...
                  │   └── ...
                  ├── intrinsic
                  └── pose
                      ├── 0.txt
                      ├── 1.txt
                      ├── ...
                      └── ...

Once the data is downloaded and set up properly, you can run ESLAM:

python -W ignore run.py configs/ScanNet/scene0000.yaml

The final mesh is saved as $OUTPUT_FOLDER/mesh/final_mesh_culled.ply.

TUM RGB-D

Download the data as below and the data is saved into the ./Datasets/TUM folder.

bash scripts/download_tum.sh

and you can run ESLAM:

python -W ignore run.py configs/TUM_RGBD/freiburg1_desk.yaml

The final mesh is saved as $OUTPUT_FOLDER/mesh/final_mesh_culled.ply.

Evaluation

Average Trajectory Error

To evaluate the average trajectory error. Run the command below with the corresponding config file:

# An example for room0 of Replica
python src/tools/eval_ate.py configs/Replica/room0.yaml

Reconstruction Error

To evaluate the reconstruction error, first download the ground truth Replica meshes and the files that determine the unseen regions.

bash scripts/download_replica_mesh.sh

Then run the cull_mesh.py with the following commands to exclude the unseen and occluded regions from evaluation.

# An example for room0 of Replica
# this code should create a culled mesh named 'room0_culled.ply'
GT_MESH=cull_replica_mesh/room0.ply
python src/tools/cull_mesh.py configs/Replica/room0.yaml --input_mesh $GT_MESH

Then run the command below. The 2D metric requires rendering of 1000 depth images, which will take some time. Use -2d to enable 2D metric. Use -3d to enable 3D metric.

# An example for room0 of Replica
OUTPUT_FOLDER=output/Replica/room0
GT_MESH=cull_replica_mesh/room0_culled.ply
python src/tools/eval_recon.py --rec_mesh $OUTPUT_FOLDER/mesh/final_mesh_eval_rec_culled.ply --gt_mesh $GT_MESH -2d -3d

Visualizing ESLAM Results

For visualizing the results, we recommend to set mesh_freq: 40 in configs/ESLAM.yaml and run ESLAM from scratch.

After ESLAM is trained, run the following command for visualization.

python visualizer.py configs/Replica/room0.yaml --output output/Replica/room0 --top_view --save_rendering

The result of the visualization will be saved at output/Replica/room0/vis.mp4. The green trajectory indicates the ground truth trajectory, and the red one is the trajectory of ESLAM.

Note: mesh_freq: 40 means extracting a mesh every 40 input frames. Since extracting a mesh with a high resolution takes some time, for faster running of ESLAM for visualization set meshing resolution in configs/Replica/replica.yaml to a higher value before running ESLAM (e.g., 5 cm).

Visualizer Command line arguments

  • --output $OUTPUT_FOLDER output folder (overwrite the output folder in the config file)
  • --top_view set the camera to top view. Otherwise, the camera is set to the first frame of the sequence
  • --save_rendering save rendering video to vis.mp4 in the output folder
  • --no_gt_traj do not show ground truth trajectory

Related Repositories

We would like to extend our gratitude to the authors of NICE-SLAM for their exceptional work. Their code served as a valuable foundation for our own project, and we are appreciative of the effort they put into their work.

Contact

You can contact the author through email: mohammad.johari At idiap.ch.

Citing

If you find our work useful, please consider citing:

@inproceedings{johari-et-al-2023,
  author = {Johari, M. M. and Carta, C. and Fleuret, F.},
  title = {{ESLAM}: Efficient Dense SLAM System Based on Hybrid Representation of Signed Distance Fields},
  booktitle = {Proceedings of the IEEE international conference on Computer Vision and Pattern Recognition (CVPR)},
  year = {2023},
  type = {Highlight}
}

Acknowledgement

This work was supported by ams OSRAM.

eslam's People

Contributors

mohammadjohari 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

eslam's Issues

RuntimeError: unable to write to file </torch_31911_952036340_6686>: No space left on device (28)

Hello! I encountered the following error while running your code,
image

I used the nvidia-smi command to find out that my GPU's memory is sufficient.
image
I suspect this is due to an error with torch.multiprocessing because the use of shared memory causes the device to be unable to continue running once there are many other tasks running on the host, butit seems that the file-sharing strategy is irreplaceable. Can you tell me how to solve this problem? Thank you!

Visualizaton Error

When I visualized the results of the dataset, the resulting view consisted only of the camera's trajectory and no scene mesh.

There is some warning when i run python visualizer.py configs/Replica/room0.yaml --output output/Replica/room0 --top_view --save_rendering:

[mjpeg @ 0x562cad8edf00] overread 8 7424kB time=00:06:44.10 bitrate= 150.5kbits/s speed=3.91x [mjpeg @ 0x562cad8edf00] EOI missing, emulating

Unsatisfactory results using demo code

Thank you so much for your awesome work!

I installed your repo on WSL2 and docker, and my GPU is 3090. I haven't seen any errors during training.

After running the code, I was so confused why the reconstructed results on TUM (freiburg1_desk) and ScanNet (Scene0000_00) is not satisfactory. I was using the provided config files without making any changes.

Here is the culled mesh of Freiburg1_desk:
image
As you can see, it appears like a tetrahedron without no details inside.

The same issue is observed with Scannet:
image

Could you please provide guidance on how to troubleshoot the issue?

feature_planes value not changed during training

I understand from the thesis that feature_plane takes part in the training. But when I debugging,I find that though the reconstruction result is good, the value of feature_plane seems to be not changed,. Is there something wrong with my operation

White back ground in visualizer

image

I do not have any errors or working in the previews steps, but after I run python visualizer.py configs/Replica/room0.yaml --output output/Replica/room0 --top_view --save_rendering

I only got this red line and green line moving video, the background, which is supposed to be the room0, is just white color.

Is this the same for everyone?

4.2 Runtime Analysis

Hi Mohammad,

thank you every much for your great job! About 4.2 Runtime Analysis in the paper I have some questions.
When you analysis avarage frame processing time(FPT), do you count mapping and tracking time togother? I mean, do you count FPT after a whole sequence (while blocking visualization part and mesh part)?

In addition, in nice-slam and eslam, you use different strategies for tracking and maping frequency. So you calculate speed FPT based on same completion/completion ratio/accuracy or?

Thanks a lot in advance!
Jonas

Mesh comparison: ReplicaViewer to check mesh

Hallo,

thanks for your great job!
I want to compare different reconstructed mesh at same view for Replica Dataset. But actually, at Replica official website they provide the mesh without texture. They provide also ReplicaViewer to check rendered mesh. However, it is hard to adjust recontructed mesh in meshlab with ReplicaViewe.

Is it possible to get textured mesh from ReplicaViewer? How can you check them like Figure 3. in paper?

I really appreciate any help you can provide!

Dakai

RuntimeError : Cuda out of memory

Ours : GTX TitanX Ubuntu 20.04
RuntimeError: CUDA out of memory. Tried to allocate 62.00 MiB (GPU 0; 11.92 GiB total capacity; 8.81 GiB already allocated; 50.31 MiB free; 9.09 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

We got this Error while running Replica or TumRGBD.
In the Nice-SLAM model, this error only appeared in the dataset we constructed ourselves, and not in TumRGBD or Replica.
How can we fix it?

RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1]

H idiap,

Thanks for releasing your code, it really helps me. I'm testing your code on my own dataset, but caught the CUDA Memory Out error. So I follow this issue and change the meshing setting below:

meshing:
  level_set: 0
  resolution: 0.01 #cm # Increase this number to speed up meshing algorithm
  eval_rec: False
  mesh_bound_scale: 1.02

# change to:

meshing:
  level_set: 0
  resolution: 32 #cm # Increase this number to speed up meshing algorithm
  eval_rec: False
  mesh_bound_scale: 1.00

The Memory Out error disappears bug I got another problem:

Traceback (most recent call last):
  File "/home/yanchi/miniconda3/envs/eslam/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/home/yanchi/miniconda3/envs/eslam/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/yanchi/qudelin/ESLAM/src/ESLAM.py", line 259, in mapping
    self.mapper.run()
  File "/home/yanchi/qudelin/ESLAM/src/Mapper.py", line 473, in run
    self.mesher.get_mesh(mesh_out_file, all_planes, self.decoders, self.keyframe_dict, self.device)
  File "/home/yanchi/qudelin/ESLAM/src/utils/Mesher.py", line 234, in get_mesh
    for i, pnts in enumerate(torch.split(points, self.points_batch_size, dim=0)):
  File "/home/yanchi/qudelin/ESLAM/src/utils/Mesher.py", line 170, in eval_points
    ret = decoders(pi, all_planes=all_planes)
  File "/home/yanchi/miniconda3/envs/eslam/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/yanchi/qudelin/ESLAM/src/networks/decoders.py", line 165, in forward
    raw = raw.reshape(*p_shape[:-1], -1)
RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1] because the unspecified dimension size -1 can be any value and is ambiguous

It seems that they decoder reshape an empty tensor of shape (0, 4) at the forward step.

I have no idea how to solve this problem, could you provide me something about the setting rule of mesh_bound_scale, resolution, and bound? BTW, would the 3D reconstruction evaluation stay safe if I do not render a 3D ply file?

I'm looking forward to your reply and thanks in advance.

Novel View Render

image
Dose render a image mush be use gt_depth as arg? how can I render a image with Novel View?

Number of parameters in Table4

Hi Mohammad,

Thank you every much for your great job! About Table 4 in the paper I have some questions.
How did you calculate the number of parameters in the table? Is it the memory of the decoder plus the size of the entire scene representation?

I also tried to calculate the memory of scene room0 of Replica in the same way as in table 4, but found that it is much smaller than the size given in table 4 of the paper (6.79MB), and my calculation is only about 4.587MB. Please point out if I have missed something.

Here is how I calculated it and the results.

For decoder:

        model = config.get_model(cfg)
        model.to("cuda:0")
        memory_usage = torch.cuda.memory_allocated()
        print(f"Memory Usage: {memory_usage} bytes",f"{memory_usage/1024**2}MB")

Memory Usage: 14848 bytes 0.014MB

For Embedding if scene:

        memory = 0
        for i in range(len(planes_xy)):
            memory=+planes_xy[i].element_size()* planes_xy[i].nelement()
        for i in range(len(planes_xz)):
            memory=+planes_xz[i].element_size()* planes_xz[i].nelement()
        for i in range(len(planes_yz)):
            memory=+planes_yz[i].element_size()* planes_yz[i].nelement()
            
        for i in range(len(c_planes_xy)):
            memory=+c_planes_xy[i].element_size()* c_planes_xy[i].nelement()
        for i in range(len(planes_xz)):
            memory=+c_planes_xz[i].element_size()* c_planes_xz[i].nelement()
        for i in range(len(planes_yz)):
            memory=+c_planes_yz[i].element_size()* c_planes_yz[i].nelement()

        print(f"embedding size {memory/1024**2}MB")

embedding size 4.5732421875MB

Thanks a lot in advance!
Cancan

testing on custom data

Congrats on the impressive work!

Is it possible to test ESLAM on data obtained from a commercial RGBD camera like Intel Realsense or Kinect?

I tried using the config file for TUM RGBD, after I have prepared the rgb.txt and depth.txt files, and the corresponding depth and rgb folders, and I also changed the width and hight and the intrinsic parameters as well, but I got the following error:

Traceback (most recent call last):
File "run.py", line 65, in
main()
File "run.py", line 60, in main
eslam = ESLAM(cfg, args)
File "/home/desk/my_WorkingDirectory/Neural Implicit-Based SLAM/Depth-Based/ESLAM/src/ESLAM.py", line 105, in init
self.frame_reader = get_dataset(cfg, args, self.scale)
File "/home/desk/my_WorkingDirectory/Neural Implicit-Based SLAM/Depth-Based/ESLAM/src/utils/datasets.py", line 71, in get_dataset
return dataset_dict[cfg['dataset']](cfg, args, scale, device=device)
File "/home/desk/my_WorkingDirectory/Neural Implicit-Based SLAM/Depth-Based/ESLAM/src/utils/datasets.py", line 193, in init
self.input_folder, frame_rate=32)
File "/home/desk/my_WorkingDirectory/Neural Implicit-Based SLAM/Depth-Based/ESLAM/src/utils/datasets.py", line 233, in loadtum
pose_data = self.parse_list(pose_list, skiprows=1)
UnboundLocalError: local variable 'pose_list' referenced before assignment

It seems like I should also pass the ground-truth poses (?)

Any advice would be highly appreciated!
Thank you in advance for your time

About bound and marching_cubes_bound

Hi,
Thank you for your excellent work。For the bound and marching in the configuration file_ Cubes_ I have some questions about bound and I need your help. May I ask what is the reason for setting it here? I think this is a hyperparameter. If I want to use my own dataset to run ESLAM, how should I configure bound and marching_ Cubes_bound。
Thanks in advance.

Running on ScanNet

Hi,
Thanks for making this project open source!

I am trying to run ESLAM on the ScanNet scenes 233, 465 and 54. I created the configs with the bounds borrowed from GO-SLAM.

However, when I run on these three scenes I get the following runtime errors which I have not been able to figure out myself yet.

Scenes 465 and 54 I get the error:
image

On scene 233 I get the error:
image

Would be very grateful for ideas on what I can do to fix this. I currently suspect that it might be the bounds of the scenes that is causing this, but thought I'd check with you if I can rule that out as an issue.

Cheers,
Erik

Control random number seeds

Thank you for your wonderful work,

and have you ever tried to control random number seeds to make the results reproducible? But I was trying to add random seeds and found that there was no guarantee that the output would be consistent every time. And I found that as long as the network performs a backpropagation, the output results at this time are already inconsistent. Do you know how to solve it?

Thank you!

def setup_seed(seed):
    torch.manual_seed(seed)
    torch.cuda.manual_seed_all(seed)
    np.random.seed(seed)
    random.seed(seed)
    torch.backends.cudnn.deterministic = True
    torch.backends.cudnn.benchmark = False

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.