Code Monkey home page Code Monkey logo

i-octree's Introduction

i-Octree is a dynamic octree data structure that supports both fast nearest neighbor search and real-time dynamic updates, such as point insertion, deletion, and on-tree down-sampling. The i-Octree is built upon a leaf-based octree and has two key features: a local spatially continuous storing strategy that allows for fast access to points while minimizing memory usage, and local on-tree updates that significantly reduce computation time compared to existing static or dynamic tree structures.

Features

  • Dynamically insert points to the tree.
  • Delete points inside given axis-aligned bounding boxes.
  • Fast k-nearest neighbors search.
  • Fast radius neighbors search.
  • Fully templated for maximal flexibility to support arbitrary point representations & containers.

News 📰

[2024.03.16] - Feature Enhancement

  • Enhanced the implementation of the i-Octree with new functionalities and updated the Python bindings accordingly.

Python Bindings Test

1. Requirement

To compile, we require Eigen, C++17, and torch.

2. Run

git clone [email protected]:zhujun3753/i-octee.git

cd octree_map
# Update the `CMAKE_PREFIX_PATH` variable in `CMakeLists.txt` to reflect your own path settings.!!!!
bash build.sh

cd ..
python demo.py

3. Results

==============================
This is a debug print in OctreeMap C++!
==============================
num: 100
attr_n: 6
after filter num: 95
octree_feature.get_size(): 85
tensor([0.5879, 0.8644, 0.9247, 0.9912, 0.9457, 0.2752, 0.5103, 0.7180, 0.9304])
tensor([0.5879, 0.8644, 0.9247, 0.9912, 0.9457, 0.2752, 0.5103, 0.7180, 0.9304])

Run Randomized Data Experiments

1. Build

git clone [email protected]:zhujun3753/i-octee.git

# For Comparison
cd i-octree
git clone [email protected]:hku-mars/ikd-Tree.git

# Build & Run
bash run.sh

# Plot Results
python plot_time.py

2. Results

Attribution

If you use the implementation or ideas from the corresponding paper in your academic work, it would be nice if you cite the corresponding paper:

@misc{zhu2023ioctree,
      title={i-Octree: A Fast, Lightweight, and Dynamic Octree for Proximity Search}, 
      author={Jun Zhu and Hongyi Li and Shengjie Wang and Zhepeng Wang and Tao Zhang},
      year={2023},
      eprint={2309.08315},
      archivePrefix={arXiv},
      primaryClass={cs.RO}
}

Acknowledgement

Thanks to Jens Behley for open-sourcing his excellent work octree.

This project uses "ikd-Tree" by Cai, Yixi for comparison purposes. The code from "ikd-Tree" is licensed under the GPL-2.0. You can find the original project and its source code here.

License

The source code of i-Octree is released under GPLv2 license. For commercial use, please contact Mr. Jun ZHU ([email protected]) or Dr. Tao ZHANG ([email protected]).

i-octree's People

Contributors

zhujun3753 avatar

Stargazers

titlez avatar Mandy avatar  avatar Oriol Martínez avatar ChenghaoSun avatar Tykis avatar Mitchell Mosure avatar  avatar  avatar Jihoon Oh avatar Sam Li avatar  avatar  avatar Fudong Ge avatar saehan Lee/SLAM in the hazardous environments avatar Hyunggi Chang avatar  avatar Vishal Prabhu avatar Kevin Doherty avatar Easton Potokar avatar Taylor avatar  avatar  avatar Niranjan Anandkumar avatar SouthRiver avatar cimu avatar HyanZhang avatar  avatar  avatar Jiujiang Liu avatar  avatar  avatar You Ziang avatar  avatar ShuaiLi avatar  avatar begininend avatar 파래 avatar Feiyu Xiao avatar Tao Jianhang avatar Sikiru O. Salau avatar Yuki Furuta avatar Kohei Miura avatar Kenneth Pirman avatar  avatar SoufianeKHIAT avatar Danil avatar Juan Pablo Manson avatar  avatar  avatar Aikawa Fuyuka avatar Richard Kelley avatar Guilherme Euzébio avatar Junhua Liu avatar Julian Kunze avatar  avatar Tuan Phuc PHAN avatar Dusan Svilarkovic avatar Daoming Chen avatar Will Allen avatar Xiaodong Huang avatar BruceW avatar  avatar JoeyChia avatar Lang avatar  avatar 江俊龙 avatar Faded Weiss avatar  avatar Xiang ZH avatar  avatar Julian Gaal avatar JaySlamer avatar  avatar Nical avatar  avatar  avatar  avatar  avatar Hyeontae Son avatar nuo112 avatar Bin Chao avatar  avatar ahmed avatar Dimitri Diakopoulos avatar  avatar Hu Zhu avatar Yihua avatar Hekui Guo avatar Gyubeom Im avatar  avatar Atticus Zhou avatar  avatar Tong Wu avatar fateshelled avatar Shirokuma (k tanaka) avatar Yixin Fang avatar  avatar Myeongcheol Kwak avatar  avatar

Watchers

 avatar Roee Litman avatar 小白白学习 avatar  avatar  avatar Atticus Zhou avatar

i-octree's Issues

Examples of the functions

Is there any example of your functions?
How to use the lib to implement the functions like,
Fast k-nearest neighbors search.
Fast radius neighbors search.

Slow than KDTree in scipy.spatial

I test a sample by the following code,

from scipy.spatial import KDTree
from octree_map import OctreeMap
import torch,time
pts = torch.randint(0,1000,size=(805285,3)).float()
qury_pts = torch.randint(0,1000,size=(10000,3)).float()
OctreeMap.add_pts_with_attr_cpu(pts)
t1 = time.time()
data2 = OctreeMap.nearest_search(pts, qury_pts)
print('ioctree',time.time()-t1)

tree_gloabl = KDTree(pts, compact_nodes=False)
t2 = time.time()
min_dis, min_nnIDx = tree_gloabl.query(qury_pts, 11, workers=-1)
print('scipy',time.time()-t2)

while fix the interface in octree_map.hpp

	torch::Tensor nearest_search(torch::Tensor pts_attr, torch::Tensor query_pts)
	{
		if(octree_feature.size()<1)
		{
			std::cout<<"Empty octree!\n";
			return torch::empty(0);;
		}
		int num = query_pts.size(0);
		auto pts_attr_acces = pts_attr.accessor<float,2>();
		auto query_pts_acces = query_pts.accessor<float,2>();
		if(pts_attr.size(1)<3)
		{
			std::cout<<"Must be 3D pts!\n";
			return torch::empty(0);;
		}
		int attr_n = octree_feature.get_attr_n();
		torch::Tensor data_tensor = torch::zeros({num, 11, attr_n}, torch::dtype(torch::kFloat32));
		auto data_tensor_acces = data_tensor.accessor<float,3>();
		for(int i=0; i<num; i++)
		{
			std::vector<float> query;
			for(int j=0; j<3; j++)
				query.push_back(query_pts_acces[i][j]);
			std::vector<std::vector<float>> resultIndices;
			std::vector<float> distances;
			octree_feature.knnNeighbors_eigen(query, 11, resultIndices, distances);
			if(distances.size()>0)
			{
				for(int n=0; n<11;n++){
					for(int j=0; j<attr_n; j++)
					{
						data_tensor_acces[i][n][j] = resultIndices[n][j];
					}
				}
			}
		}
		return data_tensor;
	}

Then I got,

num: 805285
attr_n: 0
after filter num: 804958
octree_feature.get_size(): 804958
ioctree 0.14931321144104004
scipy 0.017796754837036133

This means ioctree is much slower than scipy.KDTree, is that right?

疑似bug

如果当我只使用一个点初始化octree的时候
image
max=min,此时的创建的octant的extent=0,如果后面我在对这个octree更新的时候,
image
这里就会陷入死循环,因为extent一直都是0

这里还有个问题,希望可以解答一下#5

Any Plan for Python Bindings?

I'm just asking, if you have a plan to update the python bindings, I believe it will definitely expand the influence of this work. Because Python is very convenient for trying new ideas.

关于ioctree和ikdtree的比较

您好,感谢您的工作!
我看了论文,在论文中只对比了ikdtree,但其实除了ikdtree外,还有个高博的ivox为代表的faster_lio,不知道您私下是否对比过ioctree和ivox,这二者在实时性与精度上对比效果如何?

关于调参

我最近正在测试您的i-octree,请问有没有什么参数可以进行微调呢?或者有没有提供调参手册,调整这些参数可能带来的影响。
测试结果:
ikdtree体素大小为0.5,不触发删除,耗时为3.297860ms
ioctree默认参数,不触发删除,耗时为2.875930ms。
基于fastlio测试。貌似也没有快很多?

关于八叉树深度的疑惑

您好,感谢您和您团队的工作!
我看了论文和源码,我发现,在每次新加入点时,都会判断是否存在存在点位于当前树的外面,如果在当前树的外面,就会在当前树的基础上,将Extent扩大二倍,新建一个树,把当前树接在新建树的后面;而八叉树由于它的特性原因,每一层只有八个子节点,那么这样子的话,随着时间运行,这个八叉树的深度就会越来越深,这样可能就会导致在近邻搜索的时候,递归层数很深,从而降低搜索效率呢?
下面两个图分别为代码和论文对应扩大八叉树的地方:
image
image

运行python3 demo.py ,出现如下错误。

i-octree/octree_map/build/liboctree_map.so: undefined symbol: _ZN3c109TupleTypeC1ESt6vectorINS_4Type24SingletonOrSharedTypePtrIS2_EESaIS4_EESt8optionalINS_13QualifiedNameEESt10shared_ptrINS_14FunctionSchemaEE

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.