Spaces:
Build error
Build error
Ren Jiawei
commited on
Commit
·
f26a234
1
Parent(s):
3090213
update
Browse files
app.py
CHANGED
@@ -20,11 +20,13 @@ with open('shape_names.txt') as f:
|
|
20 |
model_gda = GDANET()
|
21 |
model_gda = nn.DataParallel(model_gda)
|
22 |
model_gda.load_state_dict(torch.load('./GDANet_WOLFMix.t7', map_location=torch.device('cpu')))
|
|
|
23 |
model_gda.eval()
|
24 |
|
25 |
model_dgcnn = DGCNN()
|
26 |
model_dgcnn = nn.DataParallel(model_dgcnn)
|
27 |
model_dgcnn.load_state_dict(torch.load('./dgcnn.t7', map_location=torch.device('cpu')))
|
|
|
28 |
model_dgcnn.eval()
|
29 |
|
30 |
def pyplot_draw_point_cloud(points, corruption):
|
@@ -67,8 +69,10 @@ def load_dataset(corruption_idx, severity):
|
|
67 |
corruption_type = corruptions[corruption_idx]
|
68 |
if corruption_type == 'clean':
|
69 |
f = h5py.File(osp.join('modelnet_c', corruption_type + '.h5'))
|
|
|
70 |
else:
|
71 |
f = h5py.File(osp.join('modelnet_c', corruption_type + '_{}'.format(severity-1) + '.h5'))
|
|
|
72 |
data = f['data'][:].astype('float32')
|
73 |
label = f['label'][:].astype('int64')
|
74 |
f.close()
|
@@ -91,6 +95,22 @@ def run(seed, corruption_idx, severity):
|
|
91 |
output = 'visualization.png'
|
92 |
return output, recognize_pcd(model_dgcnn, pcd), recognize_pcd(model_gda, pcd)
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
if __name__ == '__main__':
|
95 |
iface = gr.Interface(
|
96 |
fn=run,
|
@@ -108,23 +128,13 @@ if __name__ == '__main__':
|
|
108 |
],
|
109 |
live=False,
|
110 |
allow_flagging='never',
|
111 |
-
title="
|
112 |
-
description=
|
113 |
-
|
114 |
-
Welcome to the demo of ModelNet-C! In this demo, you may:
|
115 |
-
|
116 |
-
- **Visualize** various types of corrupted point clouds in ModelNet-C,
|
117 |
-
|
118 |
-
- **Compare** our proposed techniques to the baseline in terms of prediction robustness.
|
119 |
-
|
120 |
-
For more details, checkout more our paper [Benchmarking and Analyzing Point Cloud Classification under Corruptions, ICML 2022](https://arxiv.org/abs/2202.03377)!
|
121 |
-
|
122 |
-
""",
|
123 |
examples=[
|
124 |
[0, 'Jitter', 5],
|
125 |
[999, 'Drop Local', 5],
|
126 |
],
|
127 |
-
|
128 |
-
article="<p style='text-align: center'><a href='https://github.com/
|
129 |
)
|
130 |
iface.launch()
|
|
|
20 |
model_gda = GDANET()
|
21 |
model_gda = nn.DataParallel(model_gda)
|
22 |
model_gda.load_state_dict(torch.load('./GDANet_WOLFMix.t7', map_location=torch.device('cpu')))
|
23 |
+
# model_gda.load_state_dict(torch.load('/Users/renjiawei/Downloads/pretrained_models/GDANet_WOLFMix.t7', map_location=torch.device('cpu')))
|
24 |
model_gda.eval()
|
25 |
|
26 |
model_dgcnn = DGCNN()
|
27 |
model_dgcnn = nn.DataParallel(model_dgcnn)
|
28 |
model_dgcnn.load_state_dict(torch.load('./dgcnn.t7', map_location=torch.device('cpu')))
|
29 |
+
# model_dgcnn.load_state_dict(torch.load('/Users/renjiawei/Downloads/pretrained_models/dgcnn.t7', map_location=torch.device('cpu')))
|
30 |
model_dgcnn.eval()
|
31 |
|
32 |
def pyplot_draw_point_cloud(points, corruption):
|
|
|
69 |
corruption_type = corruptions[corruption_idx]
|
70 |
if corruption_type == 'clean':
|
71 |
f = h5py.File(osp.join('modelnet_c', corruption_type + '.h5'))
|
72 |
+
# f = h5py.File(osp.join('/Users/renjiawei/Downloads/modelnet_c', corruption_type + '.h5'))
|
73 |
else:
|
74 |
f = h5py.File(osp.join('modelnet_c', corruption_type + '_{}'.format(severity-1) + '.h5'))
|
75 |
+
# f = h5py.File(osp.join('/Users/renjiawei/Downloads/modelnet_c', corruption_type + '_{}'.format(severity - 1) + '.h5'))
|
76 |
data = f['data'][:].astype('float32')
|
77 |
label = f['label'][:].astype('int64')
|
78 |
f.close()
|
|
|
95 |
output = 'visualization.png'
|
96 |
return output, recognize_pcd(model_dgcnn, pcd), recognize_pcd(model_gda, pcd)
|
97 |
|
98 |
+
|
99 |
+
description = """
|
100 |
+
|
101 |
+
Welcome to the demo of PointCloud-C! PointCloud-C is the very first test-suite for point cloud robustness analysis under corruptions.
|
102 |
+
|
103 |
+
In this demo, you may:
|
104 |
+
|
105 |
+
- __Visualize__ various types of corrupted point clouds in [ModelNet-C](https://github.com/jiawei-ren/ModelNet-C).
|
106 |
+
|
107 |
+
- __Compare__ our proposed techniques to the baseline in terms of prediction robustness.
|
108 |
+
|
109 |
+
For more details, checkout our paper [Benchmarking and Analyzing Point Cloud Classification under Corruptions, __ICML 2022__](https://arxiv.org/abs/2202.03377) and our [project page](https://pointcloud-c.github.io/home.html)!
|
110 |
+
|
111 |
+
"""
|
112 |
+
|
113 |
+
|
114 |
if __name__ == '__main__':
|
115 |
iface = gr.Interface(
|
116 |
fn=run,
|
|
|
128 |
],
|
129 |
live=False,
|
130 |
allow_flagging='never',
|
131 |
+
title="PointCloud-C",
|
132 |
+
description=description,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
examples=[
|
134 |
[0, 'Jitter', 5],
|
135 |
[999, 'Drop Local', 5],
|
136 |
],
|
137 |
+
css=".output-image, .image-preview {height: 100px !important}",
|
138 |
+
article="<p style='text-align: center'><a href='https://github.com/ldkong1205/PointCloud-C target='_blank'>PointNet-C @ GitHub</a></p> "
|
139 |
)
|
140 |
iface.launch()
|