annotation_zip count_annotation_by_label#

Description#

ラベルごとにアノテーション数を出力します。

アノテーション数は、ダウンロードしたアノテーションZIPから算出します。

Examples#

基本的な使い方#

$ annofabcli annotation_zip count_annotation_by_label --project_id prj1 --output out.json --format pretty_json
out.json#
[
{
    "annotation_count": 130,
    "annotation_count_by_label": {
        "car": 60,
        "bike": 10
    },
    "project_id": "project1",
    "task_id": "task1",
    "task_phase": "acceptance",
    "task_phase_stage": 1,
    "task_status": "complete",
    "input_data_count": 10
}
]

デフォルトではタスク単位でアノテーション数を集計します。入力データ単位に集計する場合は、 --group_by input_data_id を指定してください。

--annotation にアノテーションzipまたはzipを展開したディレクトリを指定できます。

$ annofabcli annotation_zip count_annotation_by_label --project_id prj1 --annotation annotation.zip --output out.csv

CSV出力#

$ annofabcli annotation_zip count_annotation_by_label --project_id prj1 --group_by task_id --output out_by_task_label.csv

--group_by input_data_id を指定すると、入力データごとラベルごとのアノテーション数を出力します。

Command line options#

ラベルごとにアノテーション数を出力します。

usage: annofabcli annotation_zip count_annotation_by_label [-h] [--yes]
                                                           [--endpoint_url ENDPOINT_URL]
                                                           [--annofab_user_id ANNOFAB_USER_ID]
                                                           [--annofab_password ANNOFAB_PASSWORD]
                                                           [--annofab_pat ANNOFAB_PAT]
                                                           [--logdir LOGDIR]
                                                           [--disable_log]
                                                           [--debug]
                                                           [--annotation ANNOTATION]
                                                           -p PROJECT_ID
                                                           [--group_by {task_id,input_data_id}]
                                                           [-f {csv,json,pretty_json}]
                                                           [-o OUTPUT]
                                                           [-tq TASK_QUERY]
                                                           [-t TASK_ID [TASK_ID ...]]
                                                           [--latest]
                                                           [--temp_dir TEMP_DIR]

Named Arguments#

--annotation

アノテーションzip、またはzipを展開したディレクトリを指定します。指定しない場合はAnnofabからダウンロードします。

-p, --project_id

対象のプロジェクトのproject_idを指定します。

--group_by

Possible choices: task_id, input_data_id

アノテーションの個数をどの単位で集約するかを指定してます。

Default: 'task_id'

-f, --format

Possible choices: csv, json, pretty_json

出力フォーマットを指定します。

Default: 'csv'

-o, --output

出力先のファイルパスを指定します。未指定の場合は、標準出力に出力されます。

-tq, --task_query

集計対象タスクを絞り込むためのクエリ条件をJSON形式で指定します。使用できるキーは task_id, status, phase, phase_stage です。 file:// を先頭に付けると、JSON形式のファイルを指定できます。

-t, --task_id

対象のタスクのtask_idを指定します。 file:// を先頭に付けると、task_idの一覧が記載されたファイルを指定できます。

--latest

--annotation を指定しないとき、最新のアノテーションzipを参照します。このオプションを指定すると、アノテーションzipを更新するのに数分待ちます。

Default: False

--temp_dir

指定したディレクトリに、アノテーションZIPなどの一時ファイルをダウンロードします。

global optional arguments#

--yes

処理中に現れる問い合わせに対して、常に yes と回答します。

Default: False

--endpoint_url

Annofab WebAPIのエンドポイントを指定します。

Default: 'https://annofab.com'

--annofab_user_id

Annofabにログインする際のユーザーID

--annofab_password

Annofabにログインする際のパスワード

--annofab_pat

Annofabにログインする際のパーソナルアクセストークン

--logdir

ログファイルを保存するディレクトリを指定します。

Default: .log

--disable_log

ログを無効にします。

Default: False

--debug

HTTPリクエストの内容やレスポンスのステータスコードなど、デバッグ用のログが出力されます。

Default: False

オーナロールまたはアノテーションユーザロールを持つユーザで実行してください。