0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

COCO-Annotatorを用いたアノテーション作成の流れ

Posted at

基本トピック

COCO-Annotatorの概要

COCO-AnnotatorはCOCO formatというアノテーションの形式に基づいてアノテーションを行うツールです。

{
	"images": [
		{...},{...},{...},{...}
	],
	"categories": [
		{...},{...},{...}
	],
	"annotations": [
		{...},{...},{...},{...},{...},{...},{...},{...},{...}
	]
}

COCO formatは基本的には上記のように構成されます。imagesにはデータセットに含まれる画像の情報、categoriesにはデータセットに含まれるカテゴリの情報、annotationsにはデータセットに含まれるアノテーションの情報をそれぞれ保存します。

COCO-Annotatorのインストールと起動

$ git clone https://github.com/jsbroks/coco-annotator

まず上記によってCOCO-Annotatorのリポジトリを取得します。

$ cd coco-annotator
$ docker-compose up

上記によってCOCO-Annotatorを起動した後にブラウザからhttp://localhost:5000/にアクセスすると下記のような画面が確認できます。

COCO_Annotator1.png

上記にログインすると下記のような画面が確認できます。

COCO_Annotator2.png

COCO-Annotatorを停止する際は下記のコマンドを実行すれば良いです。

$ docker-compose down

アノテーションの作成

sample.png

以下では上図をcoco-annotator/datasets/test1/以下に配置し、アノテーションを作成します。

bounding box

当項ではObject Detectionに用いるアノテーション(bounding box)の作成の流れについて確認します。

COCO_Annotator3.png
http://localhost:5000/#/categories

まず上記のcreateボタンをクリックし、下記のようにカテゴリを入力しCreate Categoryボタンを選択します。
COCO_Annotator_sub.png
COCO_Annotator4.png

次にデータセットの作成を行います。

COCO_Annotator2.png

まず上図のCreateボタンを選択し、下記のようにカテゴリを入力しCreate Datasetボタンを選択します。

COCO_Annotator5.png
COCO_Annotator6.png

次に上記のEditを選択し、作成したカテゴリよりcatを選択しSaveボタンを押します。

COCO_Annotator7.png
COCO_Annotator8.png
COCO_Annotator9.png

データセットのtest1を選択すると上図のような画面が現れるのでScanボタンを押しリロードすると下図のように画像をロードすることができます。

COCO_Annotator10.png

画像をクリックすると下図のような画面が出てきます。

COCO_Annotator11.png

上図に対し、右上のcatの横の+ボタン、左上のBBoxの順に押し、下図のようにバウンディングボックスを描画します。

COCO_Annotator12.png

左下のSaveボタンを押しhttp://localhost:5000/#/datasetsにアクセスすると下図のような画面になります。

COCO_Annotator13.png
COCO_Annotator14.png

このときDownload COCOを選択すると下記のようなファイルが得られます。

{
    "images":[{"id":61,"dataset_id":19,"category_ids":[9],"path":"/datasets/test1/sample.png","width":512,"height":384,"file_name":"sample.png","annotated":true,"annotating":[],"num_annotations":1,"metadata":{},"milliseconds":---,"events":[{"_cls":"SessionEvent","user":"---","milliseconds":---,"tools_used":[]},{"_cls":"SessionEvent","user":"---","milliseconds":---,"tools_used":[]},{"_cls":"SessionEvent","user":"---","milliseconds":---,"tools_used":[]}],"regenerate_thumbnail":false,"is_modified":false}],
    "categories":[{"id":9,"name":"cat","supercategory":"","color":"#3584e4","metadata":{},"creator":"---","keypoint_colors":[]}],
    "annotations":[{"id":44,"image_id":61,"category_id":9,"dataset_id":19,"segmentation":[[342,206.8,342,284.3,265,284.3,265,206.8]],"area":5929,"bbox":[265,207,77,77],"iscrowd":false,"isbbox":true,"creator":"---","width":512,"height":384,"color":"#3da1f9","metadata":{},"milliseconds":---,"events":[{"_cls":"SessionEvent","created_at":{"$date":---},"user":"---","milliseconds":---,"tools_used":["BBox"]}]}]}

segmentation

keypoints

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?