---
title: 'COCO Annotator'
tags: CS
---
# Table of Contents
[TOC]
## 建立資料集
- 啟動server,-在coco-annotator資料夾下輸入以下指令
> docker-compose up
>

- 註冊一個帳號

- 建立新的資料集
- 建立category

- 建立資料集,選擇剛剛的category

- 新增圖片:將圖片複製到對應資料夾(default:coco-annotator/datasets/YOUR_DATASETNAME),重新整理之後就能在web上面看到圖片

## 開放多人連線以進行標記
### 連線到 COCO Annotator (Connect to COCO Annotator)
- 登入畫面 (Login interface)

- 首次登入先註冊一組帳號密碼
> Register an account
>

- 登入之後點擊 swimming dataset
> After log in, click "swimming" dataset
>

- 根據自己分配到的圖片編號,點擊圖片開始 label
> According to your allocated frame Id, click the images and start labeling

### Label Tutorial
- 接續上一步驟,進入 label 頁面
> Next step, enter in the label interface
>

- 新增一個標記
> Add a new mark
>

若成功會出現 Empty 字樣
> If you successfully add a new mark, the "Empty" will be showed.
>

- 接著開始標記,請依照下圖順序
鼻子->左眼->右眼->左耳->右耳->左肩->右肩->左手肘->右手肘->左手腕->右手腕->左髖關節->右髖關節->左膝->右膝->左腳踝->右腳踝
> Start labeling following the order as the image shown below:
> Nose->L-Eye->R-Eye->L-Ear->R-Ear->L-Shoulder->R-Shoulder->L-Elbow->R-Elbow->L-Wrist->R-Wrist->L-Hip->R-Hip->L-Knee->R-Knee->L-Ankle->R-Ankle
>

先點擊按鍵 k ,再點擊滑鼠左鍵就可以點上一點
> First, press 'k' and then click left mouse button for marking a point on the image
>

在標記點上雙擊之後可以看到 Visibility 的屬性,有 ==**NOT LABELED**==, ==**LABEL NOT_VISIBLE**==, ==**LABEL VISIBLE**== 三種,預設為==**LABEL VISIBLE**==,若有需要改變,**請於每次點擊完身體部位的點之後選取**,屬性的選取規則如下:
1. NOT LABELED:如果要標記的那個身體部位看不到也無法判斷位置時選取
ex. 圖片中正臉完全看不到,那鼻子, 眼睛和耳朵都選取此選項
2. LABEL NOT_VISIBLE:如果要標記的那個身體部位看不到但可以判斷位置時選取
ex. 圖片中右邊肩膀雖然看不到但可以判斷位置,則選取此選項
3. LABEL VISIBLE:如果要標記的那個身體部位看得到時選取
ex. 圖片中左邊肩膀可以看到位置,選取此選項
> Then, double-click left mouse button on the point. You will see "Visibility" attribute and ==**LABEL VISIBLE**== as default. If the change is needed, **please modify it after you mark each point immediately.** The rule is described as following:
> 1. NOT LABELED: Choose this attribute when the body part is invisible and indistinguishable.
> ex. The face is invisible in this picture, so after each marking points of nose, eyes and ears, choose this attribute.
2. LABEL NOT_VISIBLE:Choose this attribute when the body part is invisible and but distinguishable.
ex. Right shoulder in this picture is invisible but the position can be determined.
3. LABEL VISIBLE:Choose this attribute when the body part is visible.
ex. Left shoulder in this picture.

若位置有標錯,直接使用滑鼠就可以拉動
> Click the point using left mouse button and hold, you can move it.
**依照順序**完成 17 個點的標記
> **Follow the order** to complete the body part labeling work. 17 points for each picture.
>

- 接著標記 segmentation ,點擊左邊工具列的 Polygon Tool 或是點擊按鍵 v
> For segmentation part, click "Polygon Tool" on the tool bar in your left-hand side or directly press 'v'.
>

- 按住滑鼠左鍵描出人體,結果如下
> Then hold left mouse button to draw the contour of the swimmer.
>

- 完成後點擊下一張即可
> After the keypoints and the segmetation are labelled, click the right arrow for next image
>

- 示範影片 (Demo Video)
{%youtube lM1Brb7hQBI %}
## 輸出所有標記
- 點選左邊功能列的Export button,然後新增category(person)

- 輸出完成後下載即可

最後,記得使用makeCOCOjson.ipynb來確認標記資料有無錯誤
- 常見問題
- Export error
1. 同時有多種 visible 標注時, export 會出現 error

Sol:
重新點入已標註的圖片,就可以順利 export