Skip to main content

iinfer: An application that executes AI model files in onnx or mmlab format.

Project description

iinfer (Image Inference Application)

  • onnx又はmmlabフォーマットのAIモデルファイルを実行するアプリケーションです。
  • ドキュメントはこちら
  • このアプリケーションはcmdboxをベースにしています。
  • iinferを使用することで、AIモデルを簡単に実行することが出来ます。
  • 動作確認したモデルは動作確認済みモデルに記載しています。
  • 主なAIタスクは、画像分類、物体検知、領域検知、顔検知、顔認識です。
  • 複数の iinfer コマンドの入出力をつなげる、パイプライン処理を行うことが出来ます。
  • GUIモードを使用することで、 iinfer コマンド操作を簡単に行うことが出来ます。

iinferの動作イメージ

iinferの動作イメージ

  1. iinfer clientimageファイルcamera から画像を取得し、 推論結果 predict.json を出力します。
  2. iinfer server は推論を行うサーバーです。 iinfer client からの要求に応えて、推論結果を iinfer client に返します。
  3. iinfer server は予め ai model をロードしておくことで、推論を高速化します。
  4. iinfer clientiinfer serverRedis 経由で通信します。
  5. iinfer serverRedisdockerコンテナ を使用して起動させることが出来ます。

インストール方法

  • 次のコマンドで iinfer をインストールしてください。
  • また、Docker 版の Redis サーバーもインストールしてください。
  • 詳細なインストール方法は こちら を参照してください。
docker run -p 6379:6379 --name redis -e REDIS_PASSWORD=password -it ubuntu/redis:latest
pip install iinfer
iinfer -v
  • WebモードでSAMLを使用する場合、依存関係のあるモジュールをインストールしてください。
pip install iinfer[saml]
apt-get install -y pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl build-essential libopencv-dev
  • Webモードで--agent useを使用する場合、依存関係のあるモジュールをインストールしてください。
pip install "pydantic>=2.0.0,<3.0.0"
pip install "fastmcp>=2.14.0" "mcp>=1.10.0,<2.0.0"
pip install "google-adk>=1.21.0" "litellm"

iinferの使用方法

iinferを使用するには、次のコマンドを実行します:

  1. guiモードで利用する場合:

guiモードのイメージ

iinfer -m gui -c start
  1. コマンドモードで利用する場合

    1. AIモデルのデプロイ:
    # 画像AIモデルのデプロイ
    # 推論タイプはモデルのAIタスクやアルゴリズムに合わせて指定する。指定可能なキーワードは"iinfer -m client -c predict_type_list"コマンド参照。
    iinfer -m client -c deploy -n <任意のモデル名> -f \
                               --model_file <モデルファイル> \
                               --model_conf_file <モデル設定ファイル> \
                               --predict_type <推論タイプ> \
                               --label_file <ラベルファイル>
    
    # デプロイされている画像AIモデルの一覧
    iinfer -m client -c deploy_list -f
    
    1. AIモデルのセッションを開始:
    # 画像AIモデルを起動させて推論可能な状態に(セッションを確保)する
    # use_trackを指定するとObjectDetectionタスクの結果に対して、MOT(Multi Object Tracking)を実行しトラッキングIDを出力する。
    iinfer -m client -c start -n <モデル名> -f \
                              --use_track
    
    1. 推論を実行:
    # 推論を実行する
    # output_previewを指定するとimshowで推論結果画像を表示する(GUI必要)
    iinfer -m client -c predict -n <モデル名> -f \
                                -i <推論させる画像ファイル> \
                                -o <推論結果の画像ファイル> \
                                --output_preview
    
    # カメラキャプチャー画像を元に推論を実行し、クラススコアが0.8以上の物体のみを検出する
    # --stdin --image_type capture で標準入力のキャプチャー画像を推論する
    iinfer -m client -c capture | \
    iinfer -m client -c predict -n <モデル名> \
                                --stdin \
                                --image_type capture \
                                --nodraw | \
    iinfer -m postprocess -c det_filter -f -P \
                                --stdin \
                                --score_th 0.8
    
    1. AIモデルのセッションを開放:
    # 画像AIモデルを停止させてセッションを開放
    iinfer -m client -c stop -n <モデル名> -f
    

Lisence

This project is licensed under the MIT License, see the LICENSE file for details

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iinfer-0.12.4.tar.gz (573.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iinfer-0.12.4-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file iinfer-0.12.4.tar.gz.

File metadata

  • Download URL: iinfer-0.12.4.tar.gz
  • Upload date:
  • Size: 573.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for iinfer-0.12.4.tar.gz
Algorithm Hash digest
SHA256 89fd7f24f636069fc5f6376d2a9a014334ec66e804a2695ff3cc609457cdbe0a
MD5 af94499fd62c4bdcf9cd6ecd93da5384
BLAKE2b-256 725ef221561801d9b6f8bf4037477d0e43b56e64cced6e25f5baadfad65c0fd1

See more details on using hashes here.

File details

Details for the file iinfer-0.12.4-py3-none-any.whl.

File metadata

  • Download URL: iinfer-0.12.4-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for iinfer-0.12.4-py3-none-any.whl
Algorithm Hash digest
SHA256 db9410a487c7482d76757ad6eec62c35a7771fa0a87c313c7384de1b047dc834
MD5 9c5279b7a42eb563282256fffb4a0000
BLAKE2b-256 69dcb9bf96773e828ecf4487607ffb04404e6fc71b1d3a30e5b8f6ca218d056e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page