statistics list_annotation_duration#

Description#

ラベルごとまたは属性値ごとに区間アノテーションの長さ(秒)を出力します。 区間アノテーションは動画プロジェクト用のアノテーションです。

区間アノテーションの長さは、ダウンロードしたアノテーションZIPから算出します。

Examples#

JSON出力#

$ annofabcli statistics list_annotation_duration --project_id prj1 \
 --output out.json --format pretty_json
out.json#
[
{
    "task_id": "sample_task_00",
    "status": "not_started",
    "phase": "annotation",
    "phase_stage": 1,
    "input_data_id": "sample_video_00.mp4",
    "input_data_name": "sample_video_00.mp4",
    "annotation_duration_second": 21.333,
    "annotation_duration_second_by_label": {
        "traffic_light": 21.333
    },
    "annotation_duration_second_by_attribute": {
        "traffic_light": {
            "color": {
                "red": 13.2,
                "green": 8.133,
            }
        }
    }
}
]
  • annotation_duration_second : 区間アノテーションの合計の長さ(秒)

  • annotation_duration_second_by_label : ラベルごとの区間アノテーションの長さ(秒)( {label_name: annotation_duration}

  • annotation_duration_second_by_attribute : 属性値ごとの区間アノテーションの長さ(秒)( {label_name: {attribute_name: {attribute_value: annotation_duration}}}

annotation_duration_second_by_attribute に格納される属性の種類は以下の通りです。

  • ドロップダウン

  • ラジオボタン

  • チェックボックス

--project_id を指定しない場合は、上記以外の属性の種類(たとえばトラッキングID)も集計されます。

CSV出力#

CSVを出力する場合は、--type で列名をラベル( label )にするか属性値( attribute )にするかを指定してください。 デフォルトは label です。

$ annofabcli statistics list_annotation_count --project_id prj1 \
--format csv --type label --output out_by_task_label.csv
out_by_label.csv#

task_id

status

phase

phase_stage

input_data_id

input_data_name

annotation_duration_second

label-A

label-B

label-C

task1

not_started

acceptance

1

input_data1

input_data1

170

43

77

50

task2

complete

acceptance

1

input_data2

input_data2

64

35

9

20

$ annofabcli statistics list_annotation_count --project_id prj1 \
--format csv --type attribute --output out_by_attribute.csv
out_by_label.csv#

task_id

status

phase

phase_stage

input_data_id

input_data_name

annotation_duration_second

label-A

label-A

label-B

label-B

label-B

is_lighted

is_lighted

color

color

color

true

false

red

green

yellow

task1

not_started

acceptance

1

input_data1

input_data1

73

10

1

40

20

2

task2

on_hold

inspection

1

input_data2

input_data2

62

20

1

30

10

1

Usage Details#

ラベルごとまたは属性値ごとに区間アノテーションの長さ(秒)を出力します。

usage: annofabcli statistics list_annotation_duration [-h] [--yes]
                                                      [--endpoint_url ENDPOINT_URL]
                                                      [--annofab_user_id ANNOFAB_USER_ID]
                                                      [--annofab_password ANNOFAB_PASSWORD]
                                                      [--mfa_code MFA_CODE]
                                                      [--logdir LOGDIR]
                                                      [--disable_log]
                                                      [--debug]
                                                      [--annotation ANNOTATION]
                                                      [-p PROJECT_ID]
                                                      [--type {label,attribute}]
                                                      [-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。--annotation が未指定のときは必須です。--annotation が指定されているときに --project_id を指定すると、アノテーション仕様を参照して、集計対象の属性やCSV列順が決まります。

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

--temp_dir

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

global optional arguments#

--yes

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

--endpoint_url

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

Default: "https://annofab.com"

--annofab_user_id

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

--annofab_password

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

--mfa_code

Annofabにログインする際のMFAコード

--logdir

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

Default: .log

--disable_log

ログを無効にします。

--debug

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

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