Skip to main content

Utility Command Line Interface for AnnoFab

Project description

annofab-cli

AnnofabのCLI(Command Line Interface)ツールです。 「タスクの一括差し戻し」や、「タスク一覧出力」など、Annofabの画面で実施するには時間がかかる操作を、コマンドとして提供しています。

PyPI version Python Versions Documentation Status

注意

  • 作者または著作権者は、ソフトウェアに関してなんら責任を負いません。
  • 予告なく互換性のない変更がある可能性をご了承ください。
  • Annofabプロジェクトに大きな変更を及ぼすコマンドも存在します。間違えて実行してしまわないよう、注意してご利用ください。

廃止予定

  • TODO

Requirements

  • Python 3.11+

Install

$ pip install annofabcli

https://pypi.org/project/annofabcli/

Windows用の実行ファイルを利用する場合

GitHubのリリースページからannofabcli-vX.X.X-windows.zipをダウンロードしてください。 zipの中にあるannofabcli.exeが実行ファイルになります。

Annofabの認証情報の設定

https://annofab-cli.readthedocs.io/ja/latest/user_guide/configurations.html 参照

使い方

https://annofab-cli.readthedocs.io/ja/latest/user_guide/index.html 参照

コマンド一覧

https://annofab-cli.readthedocs.io/ja/latest/command_reference/index.html

よくある使い方

受入完了状態のタスクを差し戻す

"car"ラベルの"occluded"属性のアノテーションルールに間違いがあったため、以下の条件を満たすタスクを一括で差し戻します。

  • "car"ラベルの"occluded"チェックボックスがONのアノテーションが、タスクに1つ以上存在する。

前提条件

  • プロジェクトのオーナが、annofabcliコマンドを実行する
# 受入完了のタスクのtask_id一覧を、acceptance_complete_task_id.txtに出力する。
$ annofabcli task list --project_id prj1  --task_query '{"status": "complete","phase":"acceptance"}' \
 --format task_id_list --output acceptance_complete_task_id.txt

# 受入完了タスクの中で、 "car"ラベルの"occluded"チェックボックスがONのアノテーションの個数を出力する。
$ annofabcli annotation list_count --project_id prj1 --task_id file://task.txt --output annotation_count.csv \
 --annotation_query '{"label_name_en": "car", "attributes":[{"additional_data_definition_name_en": "occluded", "flag": true}]}'

# annotation_count.csvを表計算ソフトで開き、アノテーションの個数が1個以上のタスクのtask_id一覧を、task_id.txtに保存する。

# task_id.txtに記載されたタスクを差し戻す。検査コメントは「carラベルのoccluded属性を見直してください」。
# 差し戻したタスクには、最後のannotation phaseを担当したユーザを割り当てる(画面と同じ動き)。
$ annofabcli task reject --project_id prj1 --task_id file://tasks.txt --cancel_acceptance \
  --comment "carラベルのoccluded属性を見直してください"

既存ラベルの field_values を更新する

アノテーション仕様に登録済みのラベルに対して、field_values を更新できます。 field_values には、サイズ制約、誤差許容、エディタ機能など、ラベルごとの設定をJSONオブジェクトで指定します。

まず現在の設定を確認したい場合は、annotation_specs list_labelfield_values 列を出力します。

$ annofabcli annotation_specs list_label --project_id prj1 --output label.csv

既定動作はマージです。指定したキーだけを更新し、それ以外のキーは保持します。

$ annofabcli annotation_specs update_label_field_values --project_id prj1 \
  --label_name_en car bus \
  --field_values_json '{"margin_of_error_tolerance":{"_type":"MarginOfErrorTolerance","max_pixel":3}}'

--replace を指定すると、field_values 全体を指定したJSONオブジェクトで置換します。

$ annofabcli annotation_specs update_label_field_values --project_id prj1 \
  --label_name_en car \
  --field_values_json '{"display_line_direction":{"_type":"DisplayLineDirection","value":true}}' \
  --replace

--clear を指定すると、対象ラベルの field_values を空辞書に更新します。

$ annofabcli annotation_specs update_label_field_values --project_id prj1 \
  --label_name_en car \
  --clear

対象ラベルは --label_name_en の代わりに --label_id でも指定できます。 また、--field_values_json には file:// を付けてJSONファイルを渡すこともできます。

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

annofabcli-1.120.5.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

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

annofabcli-1.120.5-py3-none-any.whl (710.7 kB view details)

Uploaded Python 3

File details

Details for the file annofabcli-1.120.5.tar.gz.

File metadata

  • Download URL: annofabcli-1.120.5.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for annofabcli-1.120.5.tar.gz
Algorithm Hash digest
SHA256 1fc12b8f7dbc4d996e27c48d2272b8e107b0e4d7bf58f2eb19e09f40716be8b0
MD5 0f39e98b481a7b2a641894dbb69238aa
BLAKE2b-256 a1e1c70d7edb36a64bf24eaf064b407973cb90d7412162f878468e1b3e830b06

See more details on using hashes here.

File details

Details for the file annofabcli-1.120.5-py3-none-any.whl.

File metadata

  • Download URL: annofabcli-1.120.5-py3-none-any.whl
  • Upload date:
  • Size: 710.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for annofabcli-1.120.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6fe081f70f843e86082ad5fc70dc15d20f1f8218bb669d9d5b7b7b9766fde24e
MD5 f5b583d586106f92f4b5f1464fcaa3d4
BLAKE2b-256 244c0d1c685f7817fc13631073c5bde52e309fc6a9fdce4a1ce0ffbcba6efbae

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