annotation change_attributes_per_annotation#
Description#
各アノテーションの属性値を変更します。
作業中状態のタスクに含まれるアノテーションは変更できません。
Examples#
変更する属性値をJSON形式で指定する#
引数 --json に、変更対象のアノテーションの情報( task_id , input_data_id , annotation_id )と変更後の属性値( attributes )をJSON形式で指定します。
attributes のフォーマットは、 Command line options の attributes キーの値と同じフォーマットです。
変更したい属性名と値を指定します。
[
{
"task_id": "t1",
"input_data_id": "i1",
"annotation_id": "a1",
"attributes": {"occluded": true}
}
]
$ annofabcli annotation change_attributes_per_annotation --project_id p1 \
--json file://annotations.json \
--backup backup_dir/ \
変更する属性値をCSVで指定する#
引数 --csv に、変更対象のアノテーションの情報と変更後の属性値が記載されたCSVファイルのパスを指定します。
CSVのフォーマットは以下の通りです。
ヘッダ行あり
カンマ区切り
列名 |
必須 |
備考 |
|---|---|---|
task_id |
Yes |
|
input_data_id |
Yes |
|
annotation_id |
Yes |
|
attributes |
Yes |
変更したい属性名と値のオブジェクト(JSON形式) |
以下はCSVファイルのサンプルです。
task_id,input_data_id,annotation_id,attributes
t1,i1,a1,"{""comment"":""bar"",""number"":3}"
$ annofabcli annotation change_attributes_per_annotation --project_id p1 \
--csv annotations.csv \
--backup backup_dir/ \
その他のオプション#
--backup にディレクトリを指定すると、変更対象のフレームに含まれるアノテーション情報を、指定したディレクトリに保存します。
アノテーション情報の復元は、 annofabcli annotation restore コマンドで実現できます。
注釈
間違えてアノテーションを変更したときに復元できるようにするため、--backup を指定することを推奨します。
デフォルトでは完了状態のタスクに含まれるアノテーションは変更できません。完了状態のタスクに含まれるアノテーションも変更する場合は、 --include_complete_task を指定してください。
ただし、オーナーロールのユーザーで実行する必要があります。
Usage Details#
各アノテーションの属性値を変更します。
usage: annofabcli annotation change_attributes_per_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] -p PROJECT_ID
(--json JSON | --csv CSV) [--include_complete_task] [--backup BACKUP]
Named Arguments#
- -p, --project_id
対象のプロジェクトのproject_idを指定します。
- --json
各アノテーションごとに変更内容を記載したJSONリストを指定します。
file://を先頭に付けるとJSON形式のファイルを指定できます。 (例) '[{"task_id": "t1", "input_data_id": "i1", "annotation_id": "a1", "attributes": {"occluded": true}}]'- --csv
各アノテーションごとに変更内容を記載したCSVファイルを指定します。 * task_id, input_data_id, annotation_id, attributes の4つのカラムが必要です。 attributes カラムには、属性名と値を '{"occluded": true}' のようにJSON形式で指定します。
- --include_complete_task
指定した場合は、完了状態のタスクのアノテーションも属性値を変更します。ただし、完了状態のタスクのアノテーションを変更するには、オーナーロールを持つユーザーが実行する必要があります。
- --backup
アノテーションのバックアップを保存するディレクトリのパス。アノテーションの復元は
annotation restoreコマンドで実現できます。
global optional arguments#
- --yes
処理中に現れる問い合わせに対して、常に
yesと回答します。- --endpoint_url
Annofab WebAPIのエンドポイントを指定します。
Default:
'https://annofab.com'- --annofab_user_id
Annofabにログインする際のユーザーID
- --annofab_password
Annofabにログインする際のパスワード
- --annofab_pat
Annofabにログインする際のパーソナルアクセストークン
- --logdir
ログファイルを保存するディレクトリを指定します。
Default:
.log- --disable_log
ログを無効にします。
- --debug
HTTPリクエストの内容やレスポンスのステータスコードなど、デバッグ用のログが出力されます。
オーナロールまたはチェッカーロールを持つユーザで実行してください。