Deep-Architecture Blog

ディープラーニング勉強中の建築学生のブログです.

画像における物体検出用のアノテーションデータ作成に便利なツール

先日,VATIC(Video Annotation Tool from Irvine, California)という動画アノテーションツールの紹介をしましたが,今回はVIA(VGG Image Annotator)という画像アノテーションツールの紹介をしたいと思います. 公式サイトはこちら:
VGG Image Annotator (VIA)

何に使うの?

用途としては,前回と同じく,ディープラーニングによる一般物体検出アルゴリズムの教師データ作成などが挙げられます.一般物体検出アルゴリズムの例としてはFast R-CNN, YOLO(You Only Look Once), SSD(Single Shot MultiBox Detector)などがあります.実際にこれらのアルゴリズムで学習を行うためには,どの画像にどのオブジェクトがどの位置にあるかの3要素(画像,タグ名,座標)の一覧を作成することができます.

VIAの特徴

アノテーションツール自体はとてもたくさんの種類があります. Wikipediaの一覧だけでも13種類あります.
List of Manual Image Annotation Tools - Wikipedia

これらのアノテーションツールを使うためには,ほとんどのツールでは環境構築をする必要があります.しかし,このVIAでは環境構築は一切必要ありません.
ダウンロードしてhtmlを開くだけで作業可能です.

また,私がVIAをおすすめする理由として,

  1. 複数枚同紙に作業可能
  2. 複雑な形のバウンディングボックスを作成可能
  3. 画像に紐づいたアノテーション情報をjson形式かcsv形式で出力可能
  4. 2017年4月に作られたばかりで,まだまだアップデートの余地がある

があります.

VIAの導入方法

公式サイトから最新バージョン(2017/09/26時点ではv1.03)のzipファイルをダウンロードしてください.
その後解凍すれば,導入完了です.

VIAの使い方

こちらが作業画面です. f:id:tsuchiya050505:20170926001805p:plain 左のサイドバーでは,バウンディングボックスの種類,画像を選択することができます."Region Attributes"をクリックするとボトムバーが現れ,バウンディングボックスにタグ名などの要素を追加することができます. 作業が完了したら,トップバーの"Annotation"から"Save as json"か"Save as csv"を選択することでアノテーション結果をまとめてダウンロードすることができます. 一度作業を終了したり,後日修正したいときはアノテーション結果をインポートすることで作業を継続することができます.

出力例(json):

{"swan_in_geneve.jpg62201":{"fileref":"","size":62201,"filename":"swan_in_geneve.jpg","base64_img_data":"","file_attributes":{"caption":"Swan in a lake"},
  "regions":{"0":{"shape_attributes":{"name":"polygon","all_points_x":[119,102,196,406,395,433,413,336,332,247,164,119],"all_points_y":[175,218,285,288,232,227,140,138,210,182,195,175]},
  "region_attributes":{"name":"Swan","color":"white"}}}},

"death_of_socrates_by_david.jpg71862":{"fileref":"","size":71862,"filename":"death_of_socrates_by_david.jpg","base64_img_data":"","file_attributes":{"caption":"The painting \"Death of Socrates\". Image source: https://commons.wikimedia.org/wiki/File:David_-_The_Death_of_Socrates.jpg"},
  "regions":{"0":{"shape_attributes":{"name":"rect","x":187,"y":141,"width":126,"height":253},
  "region_attributes":{"name":"Plato","color":"orange"}},"1":{"shape_attributes":{"name":"rect","x":358,"y":111,"width":104,"height":242},
  "region_attributes":{"name":"Socrates","color":"white"}}}},

"various_shapes.jpg21513":{"fileref":"","size":21513,"filename":"various_shapes.jpg","base64_img_data":"","file_attributes":{"caption":"Various geometric shapes"},
  "regions":{"0":{"shape_attributes":{"name":"polygon","all_points_x":[128,23,69,221,256,128],"all_points_y":[60,143,272,264,120,60]},
  "region_attributes":{"name":"pentagon","color":"blue"}},"1":{"shape_attributes":{"name":"circle","cx":476,"cy":529,"r":48},
  "region_attributes":{"name":"circle","color":"cyan"}},"2":{"shape_attributes":{"name":"ellipse","cx":351,"cy":315,"rx":46,"ry":88},
  "region_attributes":{"name":"ellipse","color":"yellow"}},"3":{"shape_attributes":{"name":"point","cx":115,"cy":365},
  "region_attributes":{"name":"triangle vertex","color":"pink"}},"4":{"shape_attributes":{"name":"point","cx":121,"cy":575},
  "region_attributes":{"name":"triangle vertex","color":"pink"}},"5":{"shape_attributes":{"name":"point","cx":300,"cy":467},
  "region_attributes":{"name":"triangle vertex","color":"pink"}}}}}

以上,画像アノテーションツールの紹介でした.