Skip to content

BASNet(Salient Object Detection)のPythonでのONNX推論サンプル

License

Notifications You must be signed in to change notification settings

Kazuhito00/BASNet-ONNX-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BASNet-ONNX-Sample



BASNet(Salient Object Detection)のPythonでのONNX推論サンプルです。
ONNXに変換したモデルも同梱しています。
変換自体を試したい方はColaboratoryなどでBASNet_Convert2ONNX.ipynbを使用ください。

Requirement(ONNX変換)

  • Pytorch 1.9.0 or later
  • onnx 1.10.2 or later
  • onnx-simplifier 0.3.6 or later

Requirement(ONNX推論)

  • gdown 4.2.0 or later
  • OpenCV 4.5.3.56 or later
  • onnxruntime-gpu 1.9.0 or later
    ※onnxruntimeでも動作しますが、推論時間がかかるのでGPUをお勧めします

Demo

デモの実行方法は以下です。
デモ実行前に、Googleドライブからbasnet.onnxをダウンロードし、modelディレクトリに格納してください。
basnet.onnxが格納されていない場合、gdownを用いたダウンロードが実行されます(gdownインストール必要)

python sample_onnx.py
  • --device
    カメラデバイス番号の指定
    デフォルト:0
  • --movie
    動画ファイルの指定 ※指定時はカメラデバイスより優先
    デフォルト:指定なし
  • --width
    カメラキャプチャ時の横幅
    デフォルト:640
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:360
  • --model
    ロードするモデルの格納パス
    デフォルト:model/basnet.onnx
  • --input_shape
    モデルの入力サイズ
    デフォルト:256

Reference

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

BASNet-ONNX-Sample is under MIT License.

License(Image)

猫の画像はフリー素材ぱくたそ様の写真を利用しています。

About

BASNet(Salient Object Detection)のPythonでのONNX推論サンプル

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published