qqc1989 commited on
Commit
d6c8064
·
verified ·
1 Parent(s): e01c900

Upload 23 files

Browse files
.gitattributes CHANGED
@@ -37,3 +37,22 @@ depth_anything_v2_vits_ax620e.axmodel filter=lfs diff=lfs merge=lfs -text
37
  depth_anything_v2_vits_ax650.axmodel filter=lfs diff=lfs merge=lfs -text
38
  python/examples/demo19.jpg filter=lfs diff=lfs merge=lfs -text
39
  python/output.png filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  depth_anything_v2_vits_ax650.axmodel filter=lfs diff=lfs merge=lfs -text
38
  python/examples/demo19.jpg filter=lfs diff=lfs merge=lfs -text
39
  python/output.png filter=lfs diff=lfs merge=lfs -text
40
+ python/examples/demo01.jpg filter=lfs diff=lfs merge=lfs -text
41
+ python/examples/demo02.jpg filter=lfs diff=lfs merge=lfs -text
42
+ python/examples/demo03.jpg filter=lfs diff=lfs merge=lfs -text
43
+ python/examples/demo04.jpg filter=lfs diff=lfs merge=lfs -text
44
+ python/examples/demo05.jpg filter=lfs diff=lfs merge=lfs -text
45
+ python/examples/demo06.jpg filter=lfs diff=lfs merge=lfs -text
46
+ python/examples/demo07.jpg filter=lfs diff=lfs merge=lfs -text
47
+ python/examples/demo08.jpg filter=lfs diff=lfs merge=lfs -text
48
+ python/examples/demo09.jpg filter=lfs diff=lfs merge=lfs -text
49
+ python/examples/demo10.jpg filter=lfs diff=lfs merge=lfs -text
50
+ python/examples/demo11.jpg filter=lfs diff=lfs merge=lfs -text
51
+ python/examples/demo12.jpg filter=lfs diff=lfs merge=lfs -text
52
+ python/examples/demo13.jpg filter=lfs diff=lfs merge=lfs -text
53
+ python/examples/demo14.jpg filter=lfs diff=lfs merge=lfs -text
54
+ python/examples/demo15.jpg filter=lfs diff=lfs merge=lfs -text
55
+ python/examples/demo16.jpg filter=lfs diff=lfs merge=lfs -text
56
+ python/examples/demo17.jpg filter=lfs diff=lfs merge=lfs -text
57
+ python/examples/demo18.jpg filter=lfs diff=lfs merge=lfs -text
58
+ python/examples/demo20.jpg filter=lfs diff=lfs merge=lfs -text
python/examples/demo01.jpg CHANGED

Git LFS Details

  • SHA256: 35ef1bbb63f6540e49aa9b6302b9b938be4fe8b9c08c07c3694b02396b0e87e0
  • Pointer size: 131 Bytes
  • Size of remote file: 488 kB
python/examples/demo02.jpg CHANGED

Git LFS Details

  • SHA256: c1f116034aa5abd5b5470226be2bb03bd938c8affe90389c52d10fe8b1ac7e21
  • Pointer size: 131 Bytes
  • Size of remote file: 511 kB
python/examples/demo03.jpg CHANGED

Git LFS Details

  • SHA256: 764dffd4d97bbacd620bc005fa86837018393ccb5ffd1059c2245a3cacff7782
  • Pointer size: 131 Bytes
  • Size of remote file: 465 kB
python/examples/demo04.jpg CHANGED

Git LFS Details

  • SHA256: 3a301f4e0361fe75ca4d256a35062f87eecc3f7655d747c9def3259c86e26a45
  • Pointer size: 131 Bytes
  • Size of remote file: 300 kB
python/examples/demo05.jpg CHANGED

Git LFS Details

  • SHA256: 50e7e2f057c5a2d27bb09b0b3e814147966e30139ddaf54362c72746a5320339
  • Pointer size: 131 Bytes
  • Size of remote file: 353 kB
python/examples/demo06.jpg CHANGED

Git LFS Details

  • SHA256: 0fd815bddeab139e7477c948a22fffdf84d9b87f81d77dcf6fd8ef39ebaaafb5
  • Pointer size: 131 Bytes
  • Size of remote file: 783 kB
python/examples/demo07.jpg CHANGED

Git LFS Details

  • SHA256: 345bec735adc4c238bf14ddf1d182c4881f8ba08814c4f4074c1d79e9e4adc52
  • Pointer size: 131 Bytes
  • Size of remote file: 400 kB
python/examples/demo08.jpg CHANGED

Git LFS Details

  • SHA256: d32b480349013be5f84521b0df1d6590139163aef8457f051076ed03c7371e6f
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB
python/examples/demo09.jpg CHANGED

Git LFS Details

  • SHA256: 6a64033ba69bb408c092dbff811abfbcb0196f1f87541902d03d2a909a0b8ea9
  • Pointer size: 131 Bytes
  • Size of remote file: 410 kB
python/examples/demo10.jpg CHANGED

Git LFS Details

  • SHA256: bc77f215081f58de8d079e821e2808f6ee2727dfa729c10a5921c186a32c7638
  • Pointer size: 131 Bytes
  • Size of remote file: 487 kB
python/examples/demo11.jpg CHANGED

Git LFS Details

  • SHA256: 150ef98e997ee6ff705bd06105c343f76a8f181ef93ff9ceebbd62a3ab6b592b
  • Pointer size: 131 Bytes
  • Size of remote file: 244 kB
python/examples/demo12.jpg CHANGED

Git LFS Details

  • SHA256: 264458adcf5af6e3733dfda7ef4628c4a1dc49ed249aa8896256d9534a8377c4
  • Pointer size: 131 Bytes
  • Size of remote file: 263 kB
python/examples/demo13.jpg CHANGED

Git LFS Details

  • SHA256: 9168fc752a002d50138a56621e8de5fab7fed125a978dd293319d28d30993564
  • Pointer size: 131 Bytes
  • Size of remote file: 421 kB
python/examples/demo14.jpg CHANGED

Git LFS Details

  • SHA256: 01480d952bc950332f0eea31da0777f66d5f285d8edfe2a5f47508f4b260a99f
  • Pointer size: 131 Bytes
  • Size of remote file: 643 kB
python/examples/demo15.jpg CHANGED

Git LFS Details

  • SHA256: bf60ce3879f627e8886280cc61442174c91908894a5b059681341fed600f7db3
  • Pointer size: 131 Bytes
  • Size of remote file: 769 kB
python/examples/demo16.jpg CHANGED

Git LFS Details

  • SHA256: a92e51732b38ad8b21b5cbbc6883374bd5ab56bb4907d6c4f1e13307970480ee
  • Pointer size: 131 Bytes
  • Size of remote file: 378 kB
python/examples/demo17.jpg CHANGED

Git LFS Details

  • SHA256: 7174dcfbbb95a2e581ebf1e14cfbb4bef7a1295ae9cece405c87145223dcb32d
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
python/examples/demo18.jpg CHANGED

Git LFS Details

  • SHA256: 4deeb16dbee40108f194bd87c8621416110427c8ab5fc5ad6a1d9002b2b620c2
  • Pointer size: 131 Bytes
  • Size of remote file: 179 kB
python/examples/demo20.jpg CHANGED

Git LFS Details

  • SHA256: 2958fd1b7018e40b68ccc8d74ff8e50bf143f5046711d57c54eec2a479550ace
  • Pointer size: 131 Bytes
  • Size of remote file: 498 kB
python/python/infer.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import cv2
3
+ import numpy as np
4
+ import axengine as axe
5
+
6
+ def parse_args() -> argparse.Namespace:
7
+ parser = argparse.ArgumentParser()
8
+ parser.add_argument(
9
+ "--img",
10
+ type=str,
11
+ required=True,
12
+ help="Path to input image.",
13
+ )
14
+ parser.add_argument(
15
+ "--model",
16
+ type=str,
17
+ required=True,
18
+ help="Path to axmodel model.",
19
+ )
20
+
21
+ return parser.parse_args()
22
+
23
+
24
+ def infer(img: str, model: str, viz: bool = False):
25
+ img_raw = cv2.imread(img)
26
+ image = cv2.cvtColor(img_raw, cv2.COLOR_BGR2RGB)
27
+ orig_h, orig_w = image.shape[:2]
28
+ image = cv2.resize(image, (518,518))
29
+ image = image[None]
30
+
31
+ session = axe.InferenceSession(model)
32
+
33
+ depth = session.run(None, {"input": image})[0]
34
+
35
+ depth = cv2.resize(depth[0, 0], (orig_w, orig_h))
36
+ depth = (depth - depth.min()) / (depth.max() - depth.min()) * 255.0
37
+ depth = depth.astype(np.uint8)
38
+
39
+ depth_color = cv2.applyColorMap(depth, cv2.COLORMAP_INFERNO)
40
+
41
+ combined_result = cv2.hconcat([img_raw, depth_color])
42
+
43
+ cv2.imwrite("output-ax.png", combined_result)
44
+
45
+ return depth
46
+
47
+
48
+ if __name__ == "__main__":
49
+ args = parse_args()
50
+ infer(**vars(args))
python/python/infer_onnx.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import cv2
3
+ import numpy as np
4
+ import onnxruntime as ort
5
+
6
+ def parse_args() -> argparse.Namespace:
7
+ parser = argparse.ArgumentParser()
8
+ parser.add_argument(
9
+ "--img",
10
+ type=str,
11
+ required=True,
12
+ help="Path to input image.",
13
+ )
14
+ parser.add_argument(
15
+ "--model",
16
+ type=str,
17
+ required=True,
18
+ help="Path to ONNX model.",
19
+ )
20
+
21
+ return parser.parse_args()
22
+
23
+
24
+ def infer(img: str, model: str, viz: bool = False):
25
+ img_raw = cv2.imread(img)
26
+ image = cv2.cvtColor(img_raw, cv2.COLOR_BGR2RGB)
27
+ orig_h, orig_w = image.shape[:2]
28
+ image = cv2.resize(image, (518,518) )
29
+ mean = np.array([123.675, 116.28, 103.53],dtype=np.float32).reshape(1,1,3)
30
+ std = np.array([58.395, 57.12, 57.375],dtype=np.float32).reshape(1,1,3)
31
+
32
+ image = (image-mean)/std
33
+ image = image.transpose(2,0,1)
34
+ image = image[None]
35
+
36
+ session = ort.InferenceSession(
37
+ model, providers=["CUDAExecutionProvider", "CPUExecutionProvider"]
38
+ )
39
+ depth = session.run(None, {"input": image})[0]
40
+
41
+ depth = cv2.resize(depth[0, 0], (orig_w, orig_h))
42
+ depth = (depth - depth.min()) / (depth.max() - depth.min()) * 255.0
43
+ depth = depth.astype(np.uint8)
44
+
45
+ depth_color = cv2.applyColorMap(depth, cv2.COLORMAP_INFERNO)
46
+
47
+ combined_result = cv2.hconcat([img_raw, depth_color])
48
+
49
+ cv2.imwrite("output-onnx.png", combined_result)
50
+
51
+ return depth
52
+
53
+
54
+ if __name__ == "__main__":
55
+ args = parse_args()
56
+ infer(**vars(args))
python/python/requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ onnx
2
+ onnxruntime
3
+ opencv-python