Skip to content

Commit 89d1d89

Browse files
committed
docs(cuda): correct our cuda chamfer dis speed
previously I first print time but the thing may didn't return back so print loss to make sure we finished calculation.
1 parent f374245 commit 89d1d89

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

assets/cuda/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ The number of points: (pc0: 88132, pc1: 88101)
1717
| Faiss | 817.698 |
1818
| CUDA([SCOOP](https://github.com/itailang/SCOOP/tree/master/auxiliary/ChamferDistancePytorch), Batch) | 83.275 |
1919
| Pytorch3D | 68.256 |
20-
| CUDA([SeFlow](https://github.com/KTH-RPL/SeFlow), SharedM) | **1.667** |
20+
| CUDA([SeFlow](https://github.com/KTH-RPL/SeFlow), SharedM) | **14.308** |
2121
| ~~mmcv~~(chamfer2D) | 651.510 |

assets/cuda/chamfer3D/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The number of points: (pc0: 88132, pc1: 88101)
4444
| Faiss | 817.698 |
4545
| CUDA([SCOOP](https://github.com/itailang/SCOOP/tree/master/auxiliary/ChamferDistancePytorch), Batch) | 83.275 |
4646
| Pytorch3D | 68.256 |
47-
| CUDA([SeFlow](https://github.com/KTH-RPL/SeFlow), SharedM) | **1.667** |
47+
| CUDA([SeFlow](https://github.com/KTH-RPL/SeFlow), SharedM) | **14.308** |
4848
| ~~mmcv~~(chamfer2D) | 651.510 |
4949

5050
对比命令行:

assets/tests/chamferdis_speed_test.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
# Copyright (C) 2023-now, RPL, KTH Royal Institute of Technology
44
# Author: Qingwen Zhang (https://kin-zhang.github.io/)
55
#
6-
# This work is licensed under the terms of the MIT license.
7-
# For a copy, see <https://opensource.org/licenses/MIT>.
8-
6+
#
97
# Description: Test which existing chamfer distance is faster.
108
11-
Dependence:
9+
Dependence for this test scripts:
1210
* faiss-gpu
1311
* Pytorch3d
1412
* mmcv
@@ -29,8 +27,8 @@
2927
CUDA_TEST = True
3028

3129
if __name__ == "__main__":
32-
pc0 = np.load('test_pc0.npy')
33-
pc1 = np.load('test_pc1.npy')
30+
pc0 = np.load(f'{BASEF_DIR}/assets/tests/test_pc0.npy')
31+
pc1 = np.load(f'{BASEF_DIR}/assets/tests/test_pc1.npy')
3432
print('Start status on GPU allocation: {:.3f}MB'.format(torch.cuda.memory_allocated()/1024**2))
3533
pc0 = torch.from_numpy(pc0[...,:3]).float().cuda().contiguous()
3634
pc1 = torch.from_numpy(pc1[...,:3]).float().cuda().contiguous()
@@ -101,8 +99,8 @@ def faiss_knn(pc1, pc2):
10199
from assets.cuda.chamfer3D import nnChamferDis
102100
start_time = time.time()
103101
loss = nnChamferDis(truncate_dist=False)(pc0, pc1)
104-
print(f"Chamfer Distance Cal time: {(time.time() - start_time)*1000:.3f} ms")
105102
print("loss: ", loss)
103+
print(f"Chamfer Distance Cal time: {(time.time() - start_time)*1000:.3f} ms")
106104
print()
107105

108106
"""
@@ -124,7 +122,7 @@ def faiss_knn(pc1, pc2):
124122
mmcv Chamfer Distance Cal time: 651.510 ms
125123
126124
------ START CUDA Chamfer Distance Cal ------
127-
Chamfer Distance Cal time: 1.667 ms
125+
Chamfer Distance Cal time: 14.308 ms
128126
loss: tensor(0.1710, device='cuda:0', grad_fn=<AddBackward0>)
129127
130128
"""

0 commit comments

Comments
 (0)