Update README.md
Browse files
README.md
CHANGED
|
@@ -1,102 +1,108 @@
|
|
| 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 |
-
[INFO]
|
| 49 |
-
|
| 50 |
-
[INFO] Using provider: AxEngineExecutionProvider
|
| 51 |
-
[INFO]
|
| 52 |
-
[INFO]
|
| 53 |
-
[INFO]
|
| 54 |
-
[INFO] Model type: 2 (triple core)
|
| 55 |
-
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 56 |
-
[INFO] Using provider: AxEngineExecutionProvider
|
| 57 |
-
[INFO] Model type: 2 (triple core)
|
| 58 |
-
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
[
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
[INFO]
|
| 81 |
-
|
| 82 |
-
[INFO] Using provider: AxEngineExecutionProvider
|
| 83 |
-
[INFO]
|
| 84 |
-
[INFO]
|
| 85 |
-
[INFO]
|
| 86 |
-
[INFO] Model type: 2 (triple core)
|
| 87 |
-
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 88 |
-
[INFO] Using provider: AxEngineExecutionProvider
|
| 89 |
-
[INFO] Model type: 2 (triple core)
|
| 90 |
-
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 91 |
-
[
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |

|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: afl-3.0
|
| 3 |
+
base_model:
|
| 4 |
+
- facebook/EdgeTAM
|
| 5 |
+
pipeline_tag: image-segmentation
|
| 6 |
+
---
|
| 7 |
+
# EdgeTAM
|
| 8 |
+
基于EdgeSAM的图像分割Pipeline,支持多种输入提示(框、点、掩码),支持650N系列平台的模型推理。
|
| 9 |
+
|
| 10 |
+
支持芯片:
|
| 11 |
+
- AX650N
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
支持硬件
|
| 15 |
+
|
| 16 |
+
- [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 17 |
+
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 18 |
+
|
| 19 |
+
原始模型请参考
|
| 20 |
+
- [EdgeTAM Github](https://github.com/facebookresearch/EdgeTAM)
|
| 21 |
+
- [EdgeTAM Huggingface](https://huggingface.co/facebook/EdgeTAM)
|
| 22 |
+
|
| 23 |
+
## 性能对比
|
| 24 |
+
|
| 25 |
+
- 输入图片大小 512x512
|
| 26 |
+
|
| 27 |
+
| Models | Latency (ms) | CMM Usage (MB) |
|
| 28 |
+
| --------------------- | ---------------------- | -------------- |
|
| 29 |
+
| edgetam_image_encoder | 22.348 | 29.124 |
|
| 30 |
+
| edgetam_prompt_encoder | 0.055 | 0.023 |
|
| 31 |
+
| edgetam_prompt_mask_encoder | 0.457 | 0.037 |
|
| 32 |
+
| edgetam_mask_decoder | 4.729 | 16.730 |
|
| 33 |
+
|
| 34 |
+
## 模型转换
|
| 35 |
+
- 模型转换工具链[Pulsar2](https://huggingface.co/AXERA-TECH/Pulsar2)
|
| 36 |
+
- 转换文档[TODO]
|
| 37 |
+
|
| 38 |
+
## 环境准备
|
| 39 |
+
- NPU Python API: [pyaxengine](https://github.com/AXERA-TECH/pyaxengine)
|
| 40 |
+
|
| 41 |
+
安装需要的python库
|
| 42 |
+
```pip install -r requirements.txt```
|
| 43 |
+
|
| 44 |
+
## 运行
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
(myenv) root@ax650:~/EdgeTAM# python3 image_prediction_ax.py --input_box 75,275,1725,850
|
| 48 |
+
[INFO] Available providers: ['AxEngineExecutionProvider']
|
| 49 |
+
Loading EdgeTAM Onnx models...
|
| 50 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 51 |
+
[INFO] Chip type: ChipType.MC50
|
| 52 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 53 |
+
[INFO] Engine version: 2.12.0s
|
| 54 |
+
[INFO] Model type: 2 (triple core)
|
| 55 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 56 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 57 |
+
[INFO] Model type: 2 (triple core)
|
| 58 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 59 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 60 |
+
[INFO] Model type: 2 (triple core)
|
| 61 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 62 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 63 |
+
[INFO] Model type: 2 (triple core)
|
| 64 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 65 |
+
Get prompts:
|
| 66 |
+
input_box: [ 75 275 1725 850]
|
| 67 |
+
input_point_coords: None
|
| 68 |
+
input_point_labels: None
|
| 69 |
+
Only box input provided
|
| 70 |
+
Get dense_embeddings_no_mask
|
| 71 |
+
[0.9777304]
|
| 72 |
+
✅ Saved: ./results/mask_1.png
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
保存结果在 `./results` 目录下:
|
| 76 |
+

|
| 77 |
+
|
| 78 |
+
```
|
| 79 |
+
(myenv) root@ax650:~/EdgeTAM# python3 image_prediction_ax.py --image_path ./examples/images/truck.jpg --input_box 425,600,700,875 --input_point_coords 575,750 --input_point_labels 0
|
| 80 |
+
[INFO] Available providers: ['AxEngineExecutionProvider']
|
| 81 |
+
Loading EdgeTAM Onnx models...
|
| 82 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 83 |
+
[INFO] Chip type: ChipType.MC50
|
| 84 |
+
[INFO] VNPU type: VNPUType.DISABLED
|
| 85 |
+
[INFO] Engine version: 2.12.0s
|
| 86 |
+
[INFO] Model type: 2 (triple core)
|
| 87 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 88 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 89 |
+
[INFO] Model type: 2 (triple core)
|
| 90 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 91 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 92 |
+
[INFO] Model type: 2 (triple core)
|
| 93 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 94 |
+
[INFO] Using provider: AxEngineExecutionProvider
|
| 95 |
+
[INFO] Model type: 2 (triple core)
|
| 96 |
+
[INFO] Compiler version: 5.0-patch1-dirty a512c95e-dirty
|
| 97 |
+
['575,750']
|
| 98 |
+
575,750
|
| 99 |
+
Get prompts:
|
| 100 |
+
input_box: [425 600 700 875]
|
| 101 |
+
input_point_coords: [[575 750]]
|
| 102 |
+
input_point_labels: [0]
|
| 103 |
+
Get dense_embeddings_no_mask
|
| 104 |
+
[0.90291053]
|
| 105 |
+
✅ Saved: ./results/mask_1.png
|
| 106 |
+
|
| 107 |
+
```
|
| 108 |

|