forked from asgsaeid/PointMask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
36 lines (25 loc) · 815 Bytes
/
test.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
# -*- coding: utf-8 -*-
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
import matplotlib
matplotlib.use('TkAgg')
import h5py
from data_loader import *
from model_cls import *
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 7})
from sklearn.metrics import accuracy_score
f = h5py.File('./ModelNet40/ply_data_test.h5', mode='r')
probs = []
y_pred = np.zeros(len(f['data']))
labels = f['label']
model = point_mask(40)
model.load_weights('PATH/results/pointmask.h5')
for i in range(0, len(f['data'])):
print(str(i) + ' / ' + str(len(f['data'])))
ps = f['data'][i]
l_ps = f['label'][i]
model_output = model.predict(np.expand_dims(ps, 0))
y_pred[i] = np.argmax(model_output, axis=1)
print(accuracy_score(labels, y_pred))