`pip install torch ninja`
# Pytorch Chamfer Distance.
Include a **CUDA** version, and a **PYTHON** version with pytorch standard operations.
NB : In this depo, dist1 and dist2 are squared pointcloud euclidean distances, so you should adapt thresholds accordingly.
- [x] F - Score
### CUDA VERSION
- [x] JIT compilation
- [x] Supports multi-gpu
- [x] 2D point clouds.
- [x] 3D point clouds.
- [x] 5D point clouds.
- [x] Contiguous() safe.
### Python Version
- [x] Supports any dimension
### Usage
```python
import torch, chamfer3D.dist_chamfer_3D, fscore
chamLoss = chamfer3D.dist_chamfer_3D.chamfer_3DDist()
points1 = torch.rand(32, 1000, 3).cuda()
points2 = torch.rand(32, 2000, 3, requires_grad=True).cuda()
dist1, dist2, idx1, idx2 = chamLoss(points1, points2)
f_score, precision, recall = fscore.fscore(dist1, dist2)
```
### Add it to your project as a submodule
```shell
git submodule add https://github.com/ThibaultGROUEIX/ChamferDistancePytorch
```
### Benchmark: [forward + backward] pass
- [x] CUDA 10.1, NVIDIA 435, Pytorch 1.4
- [x] p1 : 32 x 2000 x dim
- [x] p2 : 32 x 1000 x dim
| *Timing (sec * 1000)* | 2D | 3D | 5D |
| ---------- | -------- | ------- | ------- |
| **Cuda Compiled** | **1.2** | 1.4 |1.8 |
| **Cuda JIT** | 1.3 | **1.4** |**1.5** |
| **Python** | 37 | 37 | 37 |
| *Memory (MB)* | 2D | 3D | 5D |
| ---------- | -------- | ------- | ------- |
| **Cuda Compiled** | 529 | 529 | 549 |
| **Cuda JIT** | **520** | **529** |**549** |
| **Python** | 2495 | 2495 | 2495 |
### What is the chamfer distance ?
[Stanford course](http://graphics.stanford.edu/courses/cs468-17-spring/LectureSlides/L14%20-%203d%20deep%20learning%20on%20point%20cloud%20representation%20(analysis).pdf) on 3D deep Learning
### Aknowledgment
Original backbone from [Fei Xia](https://github.com/fxia22/pointGAN/blob/master/nndistance/src/nnd_cuda.cu).
JIT cool trick from [Christian Diller](https://github.com/chrdiller)
### Troubleshoot
- `Undefined symbol: Zxxxxxxxxxxxxxxxxx `:
--> Fix: Make sure to `import torch` before you `import chamfer`.
--> Use pytorch.version >= 1.1.0
- [RuntimeError: Ninja is required to load C++ extension](https://github.com/zhanghang1989/PyTorch-Encoding/issues/167)
```shell
wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
sudo unzip ninja-linux.zip -d /usr/local/bin/
sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force
```
#### TODO:
* Discuss behaviour of torch.min() and tensor.min() which causes issues in some pytorch versions
没有合适的资源?快使用搜索试试~ 我知道了~
ChamferDistancePytorch:Pytorch 中的倒角距离与 f-score

共22个文件
py:11个
cu:4个
cpp:4个


温馨提示
pip install torch ninja Pytorch 倒角距离。 包括一个CUDA版本和一个带有 pytorch 标准操作的PYTHON版本。 注意:在这个仓库中,dist1 和 dist2 是点云欧氏距离的平方,因此您应该相应地调整阈值。 F - 分数 CUDA 版本 即时编译 支持多GPU 二维点云。 3D 点云。 5D 点云。 连续()安全。 Python版本 支持任意维度 用法 import torch , chamfer3D . dist_chamfer_3D , fscore chamLoss = chamfer3D . dist_chamfer_3D . chamfer_3DDist () points1 = torch . rand ( 32 , 1000 , 3 ). cuda () points2 = torch . rand ( 32
资源详情
资源评论
资源推荐
收起资源包目录




























共 22 条
- 1






















蒋叶婷
- 粉丝: 40
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- vcos_components_configs-智能车资源
- 中职计算机教学中存在的问题及对策探思.docx
- 数字图像处理实验指导说明书zqd.doc
- lanqiao-蓝桥杯资源
- 汇编语言-汇编语言资源
- 通信工程中多网融合技术的探析.docx
- 基于华为云计算技术的多课程教学平台的构建.docx
- cotParam-C语言资源
- klogging-C++资源
- VC数据挖掘在客户关系管理中的实际应用.doc
- (源码)基于Pytorch的CenterNet目标检测模型实现.zip
- 完成Java面向对象程序设计方案实验课的心得体会.doc
- 中职计算机蓝领人才培养的思考与探索.docx
- 海外工程项目管理面临的挑战与对策.docx
- 基于智慧城市的快递寄件系统研究.docx
- 人工智能改善生活.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论1