statistics list_annotation_count

Description

各ラベルまたは各属性値のアノテーション数を出力します。

Examples

基本的な使い方

ラベルごと/属性値ごとのアノテーション数が記載されたファイルを出力します。 アノテーション数は、ダウンロードしたアノテーションZIPから算出します。

$ annofabcli statistics list_annotation_count --project_id prj1 --output out.json --format pretty_json
out.json
[
{
    "annotation_count": 130,
    "annotation_count_by_label": {
        "car": 60,
        "bike": 10,
    },
    "annotation_count_by_attribute": {
        "car": {
            "occlusion": {
                "false": 10,
                "true": 20
            },
            "type": {
                "normal": 10,
                "bus":20
            }
        },
        "bike": {
            "occlusion": {
                "false": 10,
                "true": 20
            }
        }
    },
    "task_id": "task1",
    "status": "complete",
    "phase": "acceptance",
    "phase_stage": 1,
    "input_data_count": 10
}
]
  • annotation_count_by_label : ラベルごとのアノテーション数( {label_name: annotation_count}

  • annotation_count_by_attribute : 属性値ごとのアノテーション数( {label_name: {attribute_name: {attribute_value: annotation_count}}}

集計対象の属性の種類は以下の通りです。

  • ドロップダウン

  • ラジオボタン

  • チェックボックス

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

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

$ annofabcli statistics list_annotation_count --project_id prj1 --output_dir out_dir/ \
--annotation annotation.zip

CSV出力

CSVを出力する場合は、--type でラベルごとのアノテーション数(--type label)か、属性値ごとのアノテーション数(--type attribute)かを指定してください。 デフォルトでは、ラベルごとのアノテーション数が出力されます。

出力結果

JSON出力

タスクごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by task_id \
--format pretty_json --output out_by_task.json
out_by_task.json
[
{
    "annotation_count": 130,
    "annotation_count_by_label": {
        "car": 60,
        "bike": 10,
    },
    "annotation_count_by_attribute": {
        "car": {
            "occlusion": {
                "false": 10,
                "true": 20
            },
            "type": {
                "normal": 10,
                "bus":20
            }
        },
        "bike": {
            "occlusion": {
                "false": 10,
                "true": 20
            }
        }
    },
    "task_id": "task1",
    "status": "complete",
    "phase": "acceptance",
    "phase_stage": 1,
    "input_data_count": 10
}
]

入力データごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by input_data_id \
--format pretty_json --output out_by_input_data.json
out_by_input_data.json
[
{
    "annotation_count": 130,
    "annotation_count_by_label": {
        "car": 60,
        "bike": 10,
    },
    "annotation_count_by_attribute": {
        "car": {
            "occlusion": {
                "false": 10,
                "true": 20
            },
            "type": {
                "normal": 10,
                "bus":20
            }
        },
        "bike": {
            "occlusion": {
                "false": 10,
                "true": 20
            }
        }
    },
    "task_id": "task1",
    "status": "complete",
    "phase": "acceptance",
    "phase_stage": 1,
    "input_data_id": "input1",
    "input_data_name": "input1"
}
]

CSV出力

タスクごとラベルごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by task_id \
--format csv --type label --output out_by_task_label.csv
out_by_task_label.csv

task_id

status

phase

phase_stage

input_data_count

annotation_count

car

bike

task1

break

annotation

1

5

100

20

10

task2

complete

acceptance

1

5

80

12

5

タスクごと属性ごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by task_id \
--format csv --type attribute --output out_by_task_attribute.csv
out_by_task_attribute.csv

task_id

status

phase

phase_stage

input_data_count

annotation_count

car

car

occlusion

occlusion

true

false

task2

complete

acceptance

1

10

80

12

5

入力データごとラベルごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by input_data_id \
--format csv --type label --output out_by_input_data_label.csv
out_by_input_data_label.csv

task_id

status

phase

phase_stage

input_data_id

input_data_name

annotation_count

car

bike

task1

break

annotation

1

input1

input1

100

20

10

task2

complete

acceptance

1

input2

input2

80

12

5

入力データごと属性ごとのアノテーション数

$ annofabcli statistics list_annotation_count --project_id prj1 --group_by input_data_id \
--format csv --type attribute --output out_by_input_data_attribute.csv
out_by_input_data_attribute.csv

task_id

status

phase

phase_stage

input_data_id

input_data_name

annotation_count

car

car

occlusion

occlusion

true

false

task2

complete

acceptance

1

input2

input2

80

12

5

Usage Details

各ラベル、各属性値のアノテーション数を、タスクごと/入力データごとに出力します。

usage: annofabcli statistics list_annotation_count [-h] [--yes]
                                                   [--endpoint_url ENDPOINT_URL]
                                                   [--logdir LOGDIR]
                                                   [--disable_log] [--debug]
                                                   -p PROJECT_ID
                                                   [--annotation ANNOTATION]
                                                   [--group_by {task_id,input_data_id}]
                                                   [--type {label,attribute}]
                                                   [-f {csv,json,pretty_json}]
                                                   [-o OUTPUT]
                                                   [-tq TASK_QUERY]
                                                   [-t TASK_ID [TASK_ID ...]]
                                                   [--latest]

Named Arguments

-p, --project_id

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

--annotation

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

--group_by

Possible choices: task_id, input_data_id

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

Default: "task_id"

--type

Possible choices: label, attribute

出力するCSVの種類を指定してください。 --format csv を指定したときのみ有効なオプションです。

  • label: ラベルごとにアノテーション数が記載されているCSV

  • attribute: 属性値ごとにアノテーション数が記載されているCSV

Default: "label"

-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を更新するのに数分待ちます。

global optional arguments

--yes

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

--endpoint_url

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

Default: "https://annofab.com"

--logdir

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

Default: .log

--disable_log

ログを無効にします。

--debug

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