annotation_zip list_polyline_annotation#

Description#

アノテーションZIPからポリラインアノテーションの座標情報と属性情報を出力します。

Annofabではポリラインとポリゴンの区別がないため、ポリゴンも含まれる可能性があります。

Examples#

出力例(CSV形式)#

$ annofabcli annotation_zip list_polyline_annotation --project_id prj1 --format csv --output out.csv
out.csv#

project_id

task_id

task_phase

task_phase_stage

task_status

input_data_id

input_data_name

updated_datetime

label

annotation_id

annotation_editor_url

point_count

length

start_point.x

start_point.y

end_point.x

end_point.y

midpoint.x

midpoint.y

bounding_box_width

bounding_box_height

attributes.color

attributes.type

prj1

task_00

annotation

1

complete

i1

i1.jpg

2023-10-01T12:00:00.000+09:00

road

ann1

https://annofab.com/projects/prj1/tasks/task_00/editor?#i1/ann1

5

72.55832815336873

10.0

20.0

50.0

80.0

30.0

47.0

40.0

60.0

white

dashed

出力例(JSON形式)#

$ annofabcli annotation_zip list_polyline_annotation --project_id prj1 --output out.json --format pretty_json
out.json#
[
  {
    "project_id": "prj1",
    "task_id": "task_00",
    "task_status": "complete",
    "task_phase": "annotation",
    "task_phase_stage": 1,
    "input_data_id": "i1",
    "input_data_name": "i1.jpg",
    "updated_datetime": "2023-10-01T12:00:00.000+09:00",
    "label": "road",
    "annotation_id": "ann1",
    "annotation_editor_url": "https://annofab.com/projects/prj1/tasks/task_00/editor?#i1/ann1",
    "point_count": 5,
    "length": 72.55832815336873,
    "start_point": {"x": 10.0, "y": 20.0},
    "end_point": {"x": 50.0, "y": 80.0},
    "midpoint": {"x": 30.0, "y": 47.0},
    "bounding_box_width": 40.0,
    "bounding_box_height": 60.0,
    "attributes": {
      "type": "dashed",
      "color": "white"
    },
    "points": [{"x": 10, "y": 20}, {"x": 20, "y": 30}, {"x": 30, "y": 45}, {"x": 40, "y": 60}, {"x": 50, "y": 80}]
  }
]

特定のラベルのみ出力#

$ annofabcli annotation_zip list_polyline_annotation --project_id prj1 --label_name road lane --output out.csv

出力項目について#

基本情報#

  • project_id : プロジェクトID

  • task_id : タスクID

  • task_status : タスクのステータス(not_started, working, complete, など)

  • task_phase : タスクのフェーズ(annotation, inspection, acceptance)

  • task_phase_stage : タスクのフェーズステージ(1から始まる整数)

  • input_data_id : 入力データID

  • input_data_name : 入力データ名

  • updated_datetime : アノテーションJSONの更新日時(ISO 8601形式)

  • label : ラベル名

  • annotation_id : アノテーションID

  • annotation_editor_url : アノテーションエディタのURL。対象のアノテーションを直接開くことができます。

ポリライン情報#

  • point_count : ポリラインの頂点数

  • length : ポリラインの総長(各線分の長さの合計、単位はピクセル)

  • start_point : 始点の座標(x, y)

  • end_point : 終点の座標(x, y)

  • midpoint : 中点(全頂点の座標平均、x, y)

  • bounding_box_width : 外接矩形の幅(単位はピクセル)

  • bounding_box_height : 外接矩形の高さ(単位はピクセル)

  • points : ポリラインの頂点リスト

属性情報#

attributes 配下に、アノテーションに設定された属性情報が含まれます。 CSV出力時は attributes.<属性名> の形式で列が作成されます。

See also#

タスクメタデータを出力する#

--with_task_metadata を指定すると、タスクのメタデータをすべて出力します。

CSVでは task_id の直後に、対象タスクのいずれかに存在するキーを task_metadata.<key> 形式の列として出力します。キーがタスクに存在しない場合、そのセルは空になります。

JSONでは、タスクのメタデータ全体を task_metadata オブジェクトに出力します。

Usage Details#

アノテーションZIPからポリラインアノテーションの座標情報と属性情報を出力します。

usage: annofabcli annotation_zip list_polyline_annotation [-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)
                                                          [-f {csv,json,pretty_json}]
                                                          [-o OUTPUT]
                                                          [-tq TASK_QUERY]
                                                          [-t TASK_ID [TASK_ID ...]]
                                                          [--label_name LABEL_NAME [LABEL_NAME ...]]
                                                          [--with_task_metadata]
                                                          [--latest]
                                                          [--temp_dir TEMP_DIR]
                                                          [--use_japanese_name]

Named Arguments#

--annotation

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

-p, --project_id

project_id。アノテーションZIPをダウンロードします。

-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の一覧が記載されたファイルを指定できます。ファイルを読み込む場合は、ファイル指定を1個だけ渡してください。直接指定するIDや別のファイル指定とは併用できません。

--label_name

指定したラベル名のポリラインアノテーションのみを対象にします。複数指定できます。 file:// を先頭に付けると、改行区切りの一覧ファイルを指定できます。 ファイルを読み込む場合は、ファイル指定を1個だけ渡してください。直接指定する値や別のファイル指定とは併用できません。

--with_task_metadata

タスクメタデータを出力します。CSVでは task_metadata.<key> 列、JSONでは task_metadata キーに出力します。

--latest

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

--temp_dir

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

--use_japanese_name

ラベル名、属性名、選択肢名をアノテーション仕様に登録されている日本語名で出力します。日本語名がない場合は英語名を出力します。

common options (after the subcommand)#

--yes

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

--endpoint_url

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

--annofab_user_id

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

--annofab_password

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

--annofab_pat

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

--logdir

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

Default: .log

--disable_log

ログを無効にします。

--debug

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

アノテーションZIPをダウンロードする場合は、オーナロールまたはアノテーションユーザロールを持つユーザで実行してください。