---
title: cv_pointnet2_sceneflow-estimation_general
canonical_url: "https://www.modelscope.cn/models/damo/cv_pointnet2_sceneflow-estimation_general"
md_url: "https://www.modelscope.cn/models/damo/cv_pointnet2_sceneflow-estimation_general.md"
repository: damo/cv_pointnet2_sceneflow-estimation_general
chinese_name: "点云Scene Flow预测"
last_updated: 2023-04-03
license: "Apache License 2.0"
pipeline_tag: pointcloud-sceneflow-estimation
tasks:
  - pointcloud-sceneflow-estimation
model_type:
  - roberta
library_name:
  - pytorch
frameworks:
  - pytorch
domain:
  - cv
downloads: 234
stars: 10
tags:
  - Alibaba
  - XR
  - PointClouds
  - SceneFlow
  - "3D Vision"
  - "Recurrent Network"
  - Attention
---

# cv_pointnet2_sceneflow-estimation_general

> cv_pointnet2_sceneflow-estimation_general - damo 在 ModelScope 开源的模型。在点云Scene Flow的预测的任务上，采用递归神经网络和attention机制来迭代求解每次flow的增量， 在FlyingThings3D仿真数据集上进行训练，可以用于点云的配准等任务中。

damo/cv_pointnet2_sceneflow-estimation_general 是 ModelScope 魔搭社区上的pointcloud-sceneflow-estimation模型，采用 Apache License 2.0 许可。

- **Repository**: damo/cv_pointnet2_sceneflow-estimation_general
- **License**: Apache License 2.0
- **Tasks**: pointcloud-sceneflow-estimation
- **Tags**: Alibaba, XR, PointClouds, SceneFlow, 3D Vision, Recurrent Network, Attention
- **Downloads**: 234
- **Stars**: 10
- **Last updated**: 2023-04-03

Source: https://www.modelscope.cn/models/damo/cv_pointnet2_sceneflow-estimation_general

---

# Scene Flow Estimation on 3D Point Clouds 介绍
任务：输入两堆点云，输出每个点的三维光流（xyz）


## 模型描述
采用递归神经网络和attention机制来迭代求解每次flow的增量。递归神经网络可以记忆之前的尝试过的历史经验（当前的预测值和当前的cost）来指导下一步增量的预测。每次迭代预测需要计算当前的cost，即找对应点然后计算特征距离。由于点云的稀疏原因，无法类似2d图像，不一定能找够找到匹配点，为次我们采用attention的机制利用一堆邻域点插值出匹配点。

该模型在FlyingThings3D仿真数据集上进行训练，可以用于点云的配准等任务中。


## 期望模型使用方式以及适用范围
本模型主要用于点云的sceneflow求解。用户可以自行尝试各种输入点云的模型效果。具体调用方式请参考代码示例


### 如何使用
在ModelScope里可以比较方便的使用

注意点：

1、目前只支持在GPU模式下使用

2、安装第三方依赖pointnet2++:
pip install git+https://github.com/gxd1994/Pointnet2.PyTorch.git@master#subdirectory=pointnet2

### 代码范例

```python
import numpy as np
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks


input_location = ('data/test/pointclouds/flyingthings_pcd1.npy',
                  'data/test/pointclouds/flyingthings_pcd2.npy')

#input_location = ('rcp_test_data/flyingthings_pcd1.npy',
#                  'rcp_test_data/flyingthings_pcd2.npy')  # [N, 3]

estimator = pipeline(task=Tasks.pointcloud_sceneflow_estimation, model='damo/cv_pointnet2_sceneflow-estimation_general')

result = estimator(input_location)
flow = result[OutputKeys.OUTPUT]
pcd12 = result[OutputKeys.PCD12]
pcd12_align = result[OutputKeys.PCD12_ALIGN]

np.save('flow.npy', flow)
# visualization
pcd12.write('pcd12.ply')
pcd12_align.write('pcd12_algin.ply')

```

### 模型局限性以及可能的偏差
该模型在FlyingThings3D数据集上训练，有可能产生一些偏差，请用户自行评测后决定如何使用。



## 训练数据介绍
FlyingThings3D是一个合成数据集，由ShapeNet数据集中的多个随机采样移动对象的场景渲染而成。它包含大约32k个立体图像，包括地面真实视差和光流图

## 模型训练流程
暂时不支持通过ModelScope接口进行训练，敬请期待。

### 训练预处理

我们按照之前的工作 [HPLFlowNet](https://github.com/laoreja/HPLFlowNet)来预处理数据集

1、下载FlyingThings3D数据，下载链接[FlyingThings3D website](https://lmb.informatik.uni-freiburg.de/resources/datasets/SceneFlowDatasets.en.html) 或者 [FlyingThings3D download paths](https://lmb.informatik.uni-freiburg.de/data/FlyingThings3D_subset/FlyingThings3D_subset_all_download_paths.txt)

2、解压后到 RAW_DATA_PATH 文件夹，然后使用HPLFlowNet提供的脚本进行预处理
```
python data_preprocess/process_flyingthings3d_subset.py --raw_data_path ${RAW_DATA_PATH} --save_path ${SAVE_PATH}/FlyingThings3D_subset_processed_35m --only_save_near_pts
```



### 训练
暂不支持

## 数据评估及结果

| Datasets | EPE3D | Acc3DS | AccDR | Outliers3D |
| :--- | :---: | :---: | :---: |  :---: |
| FlyingThings3D | 0.0403 | 0.8567 | 0.9635 | 0.1976 |
| KITTI | 0.0481 | 0.8491 | 0.9448 | 0.1228 |


## 相关论文以及引用信息
如果你觉得这个该模型对有所帮助，请考虑引用下面的相关的论文：
```
@inproceedings{gu2022rcp,
  title={RCP: Recurrent Closest Point for Point Cloud},
  author={Gu, Xiaodong and Tang, Chengzhou and Yuan, Weihao and Dai, Zuozhuo and Zhu, Siyu and Tan, Ping},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={8216--8226},
  year={2022}
}
```
该项目中一些代码来自于：[Flowstep3d](https://github.com/yairkit/flowstep3d), [FLOT](https://github.com/valeoai/FLOT), [flownet3d_Pytorch](https://github.com/hyangwinter/flownet3d_pytorch), [HPLFlowNet](https://github.com/laoreja/HPLFlowNet) and [Pointnet2.PyTorch](https://github.com/sshaoshuai/Pointnet2.PyTorch)，非常感谢他们开源了相关的工作。
