-
Notifications
You must be signed in to change notification settings - Fork 53
/
acnet.patch
36 lines (36 loc) · 1.13 KB
/
acnet.patch
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
diff -x .git -x .gitignore -x '*.DS_Store' -r -N -r -u ./to_onnx.py esanet/src/models/external_code/ACNet/to_onnx.py
--- ./to_onnx.py 1970-01-01 01:00:00.000000000 +0100
+++ esanet/src/models/external_code/ACNet/to_onnx.py 2020-12-06 11:45:33.000000000 +0100
@@ -0,0 +1,32 @@
+import os
+
+import torch
+
+from ACNet_models_V1 import ACNet
+
+
+if __name__ == '__main__':
+ H = 480
+ W = 640
+ N_CLASSES = 40
+
+ rgb = torch.rand(size=(1, 3, H, W), dtype=torch.float32)
+ depth = torch.rand(size=(1, 1, H, W), dtype=torch.float32)
+
+ out_dir = '../onnx_models'
+ os.makedirs(out_dir, exist_ok=True)
+ onnx_file_path_acnet = os.path.join(out_dir, 'acnet.onnx')
+
+ acnet = ACNet(num_class=N_CLASSES)
+ acnet.eval()
+
+ torch.onnx.export(acnet,
+ (rgb, depth),
+ onnx_file_path_acnet,
+ export_params=True,
+ input_names=['rgb', 'depth'],
+ output_names=['output'],
+ do_constant_folding=True,
+ verbose=False,
+ opset_version=10
+ )