-
Notifications
You must be signed in to change notification settings - Fork 1
/
RMS_angle_error.py
48 lines (37 loc) · 1.23 KB
/
RMS_angle_error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import numpy as np
import os
from open3d import *
import h5py
# plane no noise
# f = h5py.File('data/test_plane_no_noise.h5')
# points = f['data'][:]
# gt = f['label'][:]
# pred = np.load('results/plane_no_noise_pred.npy')
# plane with noise 0.1
# f = h5py.File('data/test_plane_noise0.1.h5')
# points = f['data'][:]
# gt = f['label'][:]
# pred = np.load('results/plane_noise0.1_pred.npy')
# plane with noise 0.3
# f = h5py.File('data/test_plane_noise0.3.h5')
# points = f['data'][:]
# gt = f['label'][:]
# pred = np.load('results/plane_noise0.3_pred.npy')
# curv no noise
f = h5py.File('data/test_curv_no_noise.h5')
points = f['data'][:]
gt = f['label'][:]
pred = np.load('results/curv_no_noise_pred.npy')
pred = pred / np.linalg.norm(pred, axis=2, keepdims=True)
cos_angle = np.abs(np.sum(np.multiply(gt, pred), axis=2))
cos_angle = np.clip(cos_angle, 0, 1.0)
angle_dif = np.arccos(cos_angle) / 3.14 * 180
loss = np.sqrt(np.mean(np.square(angle_dif)))
print("RMS angle error:", loss)
pcd = PointCloud()
pcd.points = Vector3dVector(points[10])
estimate_normals(pcd, search_param = KDTreeSearchParamHybrid(radius = 0.1, max_nn = 5000))
POINT_NUM = points.shape[1]
for i in range(POINT_NUM):
pcd.normals[i] = pred[10,i,:]
draw_geometries([pcd])