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

10.3.1 Object Detection ロードマップ:Class plus Box

Object detection は classification に location を加えます。どの object があり、image のどこにあるかを答えます。

まず box workflow を見る

Object detection 章の学習フローチャート

Object detection output diagram

Detection output IoU error map

重要概念は bounding box、class、confidence、IoU、threshold、false positive、false negative、mAP です。

IoU check を動かす

IoU は predicted box と ground-truth box の重なりを測ります。

truth = (10, 10, 50, 50)
pred = (20, 20, 60, 60)

def area(box):
x1, y1, x2, y2 = box
return max(0, x2 - x1) * max(0, y2 - y1)

ix1 = max(truth[0], pred[0])
iy1 = max(truth[1], pred[1])
ix2 = min(truth[2], pred[2])
iy2 = min(truth[3], pred[3])
intersection = area((ix1, iy1, ix2, iy2))
union = area(truth) + area(pred) - intersection

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

出力:

iou: 0.391

Detection debug は boxes と metrics の表示から始めます。きれいな screenshot 1 枚だけで detection quality を判断しないでください。

この順番で学ぶ

手順読む内容実践アウトプット
1Detection overviewbox、class、confidence、IoU、mAP を説明する
2Classic detectorstwo-stage と one-stage の考え方を比較する
3YOLOgrid prediction、threshold、NMS、speed trade-off を理解する
4Detection practicefalse positives、missed detections、threshold changes を記録する

合格ライン

boxes、confidence、IoU、少なくとも 1 つの false-positive または false-negative case で detection result を説明できれば、この章は合格です。