百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 热门文章 > 正文

Open3D-ML快速教程「激光点云」

bigegpt 2024-08-07 17:45 2 浏览

Open3D-ML 是 3D 机器学习任务 Open3D 的扩展。它建立在 Open3D 核心库之上,并使用机器学习工具扩展 3D 数据处理。Open3D-ML侧重于语义点云细分等应用,并提供可应用于常见任务的预培训模型以及用于训练的管道。

Open3D-ML 与TensorFlowPyTorch合作,轻松集成到现有项目中,还提供独立于 ML 框架(如数据可视化)的一般功能。

1、安装

Open3D-ML 集成在Python版本的Open3D v0.11 中。要使用所有的机器学习功能,你需要安装 PyTorch 或 TensorFlow。Open3D v0.11 与以下版本兼容

  • PyTorch 1.6
  • TensorFlow 2.3
  • CUDA 10.1 (可选)

如果你需要使用不同的版本,我们建议从源码构建 Open3D。

我们提供预制的 pip 包,用于Ubuntu 18.04+ 的 Open3D-ML+,可以使用如下命令安装:

$ pip install open3d

可以使用如下命令测试安装:

# with PyTorch
$ python -c "import open3d.ml.torch as ml3d"
# or with TensorFlow
$ python -c "import open3d.ml.tf as ml3d"

2、读取数据集

dataset命名空间包含了用于阅读常见数据集的类。在这里,我们阅读语义KITTI数据集并将其可视化。

import open3d.ml.torch as ml3d  # or open3d.ml.tf as ml3d

# construct a dataset by specifying dataset_path
dataset = ml3d.datasets.SemanticKITTI(dataset_path='/path/to/SemanticKITTI/')

# get the 'all' split that combines training, validation and test set
all_split = dataset.get_split('all')

# print the attributes of the first datum
print(all_split.get_attr(0))

# print the shape of the first point cloud
print(all_split.get_data(0)['point'].shape)

# show the first 100 frames using the visualizer
vis = ml3d.vis.Visualizer()
vis.visualize_dataset(dataset, 'all', indices=range(100))

3、运行预先训练的模型

在上一个示例的基础上,我们可以使用预先训练的语义分割模型对管道进行即时处理,并在数据集的点云上运行。请参阅model zoo获得预训练模型的权重。

model = ml3d.models.RandLANet()
pipeline = ml3d.pipelines.SemanticSegmentation(model=model, dataset=dataset, device="gpu")

# load the parameters.
pipeline.load_ckpt(ckpt_path='randlanet_semantickitti_202009090354utc.pth', is_train=False)

data = test_split.get_data(0)

# run inference on a single example.
# returns dict with 'predict_labels' and 'predict_scores'.
result = pipeline.run_inference(data)

# evaluate performance on the test set; this will write logs to './logs'.
pipeline.run_test()

4、训练模型

与推理类似,管道为在数据集上训练模型提供了接口。

# use a cache for storing the results of the preprocessing (default path is './logs/cache')
dataset = ml3d.datasets.SemanticKITTI(dataset_path='/path/to/SemanticKITTI/', use_cache=True)

# create the model with random initialization.
model = RandLANet()

pipeline = SemanticSegmentation(model=model, dataset=dataset, max_epoch=100)

# prints training progress in the console.
pipeline.run_train()

有关更多示例,请参阅examples和scripts目录。

5、使用预定义的脚本

scripts/semseg.py为在数据集中培训和评估模型提供了一个容易的接口。它减少了定义特定模型和传递精确配置的麻烦。

python scripts/semseg.py {tf/torch} -c <path-to-config> --<extra args>

请注意,extra args的优先级高于配置文件中的相同参数。因此,在启动脚本时,你可以通过命令行而不是在配置文件中更改参数。

例如:

# Launch training for RandLANet on SemanticKITTI with torch.
python scripts/semseg.py torch -c ml3d/configs/randlanet_semantickitti.yml --dataset.dataset_path <path-to-dataset> --dataset.use_cache True

# Launch testing for KPConv on Toronto3D with tensorflow.
python scripts/semseg.py tf -c ml3d/configs/kpconv_toronto3d.yml --dataset.dataset_path <path-to-dataset> --model.ckpt_path <path-to-checkpoint>

要获得进一步的帮助,请运行python scripts/semseg.py --help

6、存储库结构

Open3D-ML 的核心部分位于ml3d子目录中,该子目录集成到ml命名空间。除了核心部分外,exsamples和scripts目录中还提供支持脚本,以便设置训练管道或在数据集商运行网络。

├─ docs                   # Markdown and rst files for documentation
├─ examples               # Place for example scripts and notebooks
├─ ml3d                   # Package root dir that is integrated in open3d
     ├─ configs           # Model configuration files
     ├─ datasets          # Generic dataset code; will be integratede as open3d.ml.{tf,torch}.datasets
     ├─ utils             # Framework independent utilities; available as open3d.ml.{tf,torch}.utils
     ├─ vis               # ML specific visualization functions
     ├─ tf                # Directory for TensorFlow specific code. same structure as ml3d/torch.
     │                    # This will be available as open3d.ml.tf 
     ├─ torch             # Directory for PyTorch specific code; available as open3d.ml.torch
          ├─ dataloaders  # Framework specific dataset code, e.g. wrappers that can make use of the 
          │               # generic dataset code.
          ├─ models       # Code for models
          ├─ modules      # Smaller modules, e.g., metrics and losses
          ├─ pipelines    # Pipelines for tasks like semantic segmentation
├─ scripts                # Demo scripts for training and dataset download scripts

7、语义分割任务

对于语义分割的任务,我们使用所有类的平均交叉合并 (mIoU) 来衡量不同方法的性能。该表显示了用于分割任务的可用模型和数据集以及相应的得分。每个分数都链接到相应的权重文件。

Model / Dataset

SemanticKITTI

Toronto 3D

S3DIS

RandLA-Net (tf)

53.7

69.0

67.0

RandLA-Net (torch)

52.8

71.2

67.0

KPConv (tf)

58.7

65.6

65.0

KPConv (torch)

58.0

65.6

60.0

8、Model Zoo

有关所有全重文件的完整列表,请参阅model_weights.txt和 MD5 检查文件model_weights.md5。

9、预置数据集

以下是我们提供Reader的数据集列表:

  • SemanticKITTI (project page)
  • Toronto 3D (github)
  • Semantic 3D (project-page)
  • S3DIS (project-page)
  • Paris-Lille 3D (project-page)

要下载这些数据集,请访问对应网页并查看scripts/download_datasets中的脚本。


原文链接:

相关推荐

10w qps缓存数据库——Redis(redis缓存调优)

一、Redis数据库介绍:Redis:非关系型缓存数据库nosql:非关系型数据库没有表,没有表与表之间的关系,更不存在外键存储数据的形式为key:values的形式c语言写的服务(监听端口),用来存...

Redis系列专题4--Redis配置参数详解

本文基于windowsX64,3.2.100版本讲解,不同版本默认配置参数不同在Redis中,Redis的根目录中有一个配置文件(redis.conf,windows下为redis.windows....

开源一夏 | 23 张图,4500 字从入门到精通解释 Redis

redis是目前出场率最高的NoSQL数据库,同时也是一个开源的数据结构存储系统,在缓存、数据库、消息处理等场景使用的非常多,本文瑞哥就带着大家用一篇文章入门这个强大的开源数据库——Redis。...

redis的简单与集群搭建(redis建立集群)

Redis是什么?是开源免费用c语言编写的单线程高性能的(key-value形式)内存数据库,基于内存运行并支持持久化的nosql数据库作用主要用来做缓存,单不仅仅是做缓存,比如:redis的计数器生...

推荐几个好用Redis图形化客户端工具

RedisPlushttps://gitee.com/MaxBill/RedisPlusRedisPlus是为Redis可视化管理开发的一款开源免费的桌面客户端软件,支持Windows、Linux...

关于Redis在windows上运行及fork函数问题

Redis在将数据库进行持久化操作时,需要fork一个进程,但是windows并不支持fork,导致在持久化操作期间,Redis必须阻塞所有的客户端直至持久化操作完成。微软的一些工程师花费时间在解决在...

你必须懂的Redis十大应用场景(redis常见应用场景)

Redis作为一款高性能的键值存储数据库,在互联网业务中有着广泛的应用。今天,我们就来详细盘点一下Redis的十大常用业务场景,并附上Golang的示例代码和简图,帮助大家更好地理解和应用Redis。...

极简Redis配置(redis的配置)

一、概述Redis的配置文件位于Redis安装目录下,文件名为redis.conf(Windows名为redis.windows.conf,linux下的是redis.conf)你可以通过C...

什么是redis,怎么启动及如何压测

从今天起咱们一起来学习一下关于“redis监控与调优”的内容。一、Redis介绍Redis是一种高级key-value数据库。它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富。...

一款全新Redis UI可视化管理工具,支持WebUI和桌面——P3X Redis UI

介绍P3XRedisUI这是一个非常实用的RedisGUI,提供响应式WebUI访问或作为桌面应用程序使用,桌面端是跨平台的,而且完美支持中文界面。Githubhttps://github....

windows系统的服务器快速部署java项目环境地址

1、mysql:https://dev.mysql.com/downloads/mysql/(msi安装包)2、redis:https://github.com/tporadowski/redis/r...

window11 下 redis 下载与安装(windows安装redis客户端)

#热爱编程是一种怎样的体验#window11下redis下载与安装1)各个版本redis下载(windows)https://github.com/MicrosoftArchive/r...

一款轻量级的Redis客户端工具,贼好用!

使用命令行来操作Redis是一件非常麻烦的事情,我们一般会选用客户端工具来操作Redis。今天给大家分享一款好用的Redis客户端工具TinyRDM,它的界面清新又优雅,希望对大家有所帮助!简介Ti...

一个.NET开发且功能强大的Windows远程控制系统

我们致力于探索、分享和推荐最新的实用技术栈、开源项目、框架和实用工具。每天都有新鲜的开源资讯等待你的发现!项目介绍SiMayRemoteMonitorOS是一个基于Windows的远程控制系统,完...

Redis客户端工具详解(4款主流工具)

大家好,我是mikechen。Redis是大型架构的基石,也是大厂最爱考察内容,今天就给大家重点详解4款Redis工具@mikechen本篇已收于mikechen原创超30万字《阿里架构师进阶专题合集...