https://github.com/kazuhito00/mobilesam-onnx-sample
MobileSAM のエンコーダー/デコーダーをONNXに変換し、推論するサンプル
https://github.com/kazuhito00/mobilesam-onnx-sample
colaboratory mobile-sam mobilesam onnx python sam segment-anything segment-anything-model
Last synced: 13 days ago
JSON representation
MobileSAM のエンコーダー/デコーダーをONNXに変換し、推論するサンプル
- Host: GitHub
- URL: https://github.com/kazuhito00/mobilesam-onnx-sample
- Owner: Kazuhito00
- License: apache-2.0
- Created: 2024-04-11T00:10:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-11T00:21:40.000Z (over 1 year ago)
- Last Synced: 2025-04-23T00:44:22.372Z (6 months ago)
- Topics: colaboratory, mobile-sam, mobilesam, onnx, python, sam, segment-anything, segment-anything-model
- Language: Jupyter Notebook
- Homepage:
- Size: 38.3 MB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MobileSAM-ONNX-Sample
[ChaoningZhang/MobileSAM](https://github.com/ChaoningZhang/MobileSAM) のエンコーダー/デコーダーをONNXに変換し、推論するサンプルです。
推論スクリプトは、前処理、後処理を含めPyTorch依存の処理は使用しない方針です。https://github.com/Kazuhito00/MobileSAM-ONNX-Sample/assets/37477845/b5396e29-6435-4152-b6ab-d2d05dc971ea
# Usage
#### ONNX変換、推論テスト
[](https://colab.research.google.com/github/Kazuhito00/MobileSAM-ONNX-Sample/blob/main/MobileSAM-ONNX.ipynb)
Colaboratoryでノートブックを開き、上から順に実行してください。#### 簡易デモ
以下コマンドでデモを起動してください。
左クリックでプロンプト座標を追加、右クリックでプロンプト座標を削除します。
また、キーボード1~3で、クリック時に追加する座標のタイプを変更します(1:対象座標、2:非対象座標、3:対象バウンディングボックス)
```
python demo.py
```
* --image
画像ファイルの指定
デフォルト:sample.png
* --encoder
エンコーダーONNXファイルのパス
デフォルト:onnx_model/vit_t_encoder.onnx
* --decoder
デコーダーONNXファイルのパス
デフォルト:onnx_model/vit_t_decoder.onnx# Note
サンプルの画像は[ぱくたそ](https://www.pakutaso.com/)様の「[トゲトゲのサボテンとハリネズミ](https://www.pakutaso.com/20190257050post-19488.html)」を使用しています。# License
MobileSAM-ONNX-Sample is under [Apache-2.0 license](LICENSE).# Author
高橋かずひと(https://twitter.com/KzhtTkhs)