メインコンテンツへスキップ

10.4.1 画像分割ロードマップ:ピクセル単位の領域

Segmentation は detection より細かいです。box ではなく mask を出力し、どの pixels が class または instance に属するかを示します。

まず mask workflow を見る

Image segmentation 章の学習順序図

Semantic segmentation mask example

Semantic segmentation IoU and boundary map

この章の中心 object は mask です。よくある failure は boundary quality、small objects、occlusion、class confusion です。

Mask IoU check を動かす

この script は 2 つの小さな binary masks を比較します。

truth = [
[1, 1, 0],
[1, 0, 0],
[0, 0, 0],
]

pred = [
[1, 0, 0],
[1, 1, 0],
[0, 0, 0],
]

intersection = 0
union = 0
for y in range(3):
for x in range(3):
intersection += truth[y][x] == 1 and pred[y][x] == 1
union += truth[y][x] == 1 or pred[y][x] == 1

print("mask_iou:", round(intersection / union, 3))

出力:

mask_iou: 0.5

Segmentation report では mask、metrics、boundary errors を示します。colored overlay だけで終わらせないでください。

この順番で学ぶ

手順読む内容実践アウトプット
1Semantic segmentationすべての pixel に 1 つの class を予測する
2Instance segmentation同じ class の別 object を分ける
3Segmentation practicemasks、IoU/Dice、boundary errors、failed samples を比較する

合格ライン

mask を作成または inspect し、簡単な overlap metric を計算し、boundary または class-confusion failure を説明できれば、この章は合格です。