You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話Yusuke Uchida
第7回全日本コンピュータビジョン勉強会「CVPR2021読み会」(前編)の発表資料です
https://kantocv.connpass.com/event/216701/
You Only Look One-level Featureの解説と、YOLO系の雑談や、物体検出における関連する手法等を広く説明しています
研究室の輪講で使った古いスライド。物体検出の黎明期からシングルショット系までのまとめ。
Old slides used in a lab lecture. A summary of object detection from its early days to single-shot systems.
フォント不足による表示崩れがあります(筑紫A丸ゴシック、Montserratを使用)。
You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話Yusuke Uchida
第7回全日本コンピュータビジョン勉強会「CVPR2021読み会」(前編)の発表資料です
https://kantocv.connpass.com/event/216701/
You Only Look One-level Featureの解説と、YOLO系の雑談や、物体検出における関連する手法等を広く説明しています
研究室の輪講で使った古いスライド。物体検出の黎明期からシングルショット系までのまとめ。
Old slides used in a lab lecture. A summary of object detection from its early days to single-shot systems.
フォント不足による表示崩れがあります(筑紫A丸ゴシック、Montserratを使用)。
3. 2
はじめに
• ゴール
1. YOLO_v1の特徴を理解する。
2. YOLO_v1の推論の仕組みを理解する。
3. YOLO_v1の学習の仕組みを理解する。特に損失関数。
➜ 解説は1章の特徴、2章の仕組みにフォーカス。
• スコープ
• Abstract
• 1.Introdauction
• 2.Unified detection
• 3.Comparison to Other Detections Systems
• 4.Experiments
• 5.Real-Time Detection In The Wild
• 6.Conclusion
本日、解説する範囲
ConclusionはAbstractと同じため省略
4. 3
Abstract
• Prior work on object detection repurposes classifiers to perform
detection. Instead, we frame object detection as a regression
problem to spatially separated bounding boxes and associated class
probabilities.
➜ 従来のモデルは分類機を物体検出に再利用。私達は物体検出を空間に離散化
されたバウンディングボックスとそのクラス確率を回帰問題として組み立てた。
• Our unified architecture is extremely fast.~while still achieving
double the mAP of other real-time detectors.
➜ YOLOは速い(45FPS) しかし、mAPは他のリアルタイム検出器の2倍(Table1)
• Compared to state-of-the-art detection systems, YOLO makes more
localization errors but is less likely to predict false positives on
background.
➜ R-CNNに比べ位置誤差は多い、しかし、背景に物体有りと誤認することは少ない。
5. 4
1.Introduction
• YOLO is refreshingly simple: see Figure 1. A single convolutional
network simultaneously predicts multiple bounding boxes and class
probabilities for those boxes.
➜ YOLOは図1を見て分かるとおり、すっきりでシンプルである。1個の畳み込みネット
ワークが複数のバウンディングボックスとそれらのクラス確率を推論する。
• This unified model has several benefits over traditional methods of
object detection. First, YOLO is extremely fast.
➜ この統合されたモデルは従来モデルよりも種々の利点がある。第1に、極端に速い。
6. 5
1.Introduction
• Second, YOLO reasons globally about the image when making
predictions. Unlike sliding window and region proposal-based
techniques, YOLO sees the entire image
➜ 第2に、YOLOは画像の全体像を見て推論する。従来のスライディングウィンドウや
領域提案の手法と異なり、 YOLOは画像全体を見る。
(Fast R-CNNの領域提案は画像の全体像が見えないため、背景の誤認が多い)
• Third, YOLO learns generalizable representations of objects.
➜ 第3に、 YOLOは物体の汎化性が高い表現を学ぶ。
(自然の画像で訓練し、美術品でテストした場合でもYOLOは他の方法より優秀。)
• While it can quickly identify objects in images it struggles to
precisely localize some objects, especially small ones.
➜ YOLOの位置推定は速いが、正確な位置推定が苦手(汗)。。。特に小さい物
体が複数個あると苦手。
7. 6
2.Unified Detection
• Our system divides the input image into an S × S grid. If the center
of an object falls into a grid cell, that grid cell is responsible for
detecting that object.
➜ YOLOは入力画像をS×Sのグリッドに分割する。物体の中心座標が存在するグリ
ッドが推論の責任を負う。(物体の中心座標があるグリッドだけがバウンディングボックス
を推論するようネットワークは訓練されている。(2.2で解説))
物体の中心がある3グリッドだけがバウンディングボックスを推論
8. 7
2.Unified Detection
• Each grid cell predicts B bounding boxes and confidence scores for
those boxes. These confidence scores reflect how confident the
model is that the box contains an object and also how accurate it
thinks the box is that it predicts.
➜ 各グリッドはB個のバウンディングボックスとその信頼度を推論する。信頼度はどの程
度ボックスが物体を含むか反映し、推論の正確性を表す。
青のグリッドが2個のバウンディングボックスを推論するイメージ(B=2)
9. 8
• Formally we define confidence as Pr(Object) ∗ IOUtruth pred . If no
object exists in that cell, the confidence scores should be zero.
Otherwise we want the confidence score to equal the intersection
over union (IOU) between the predicted box and the ground truth
① グリッドに物体がない:Pr(Object)=0のため、訓練時に信頼度=0 で学習
② グリッドに物体がある:Pr(Object)=1のため、訓練時に信頼度=IOUで学習
③ 但し、中心座標でないグリッドはPr(Object)=1ではあるが、訓練時にバウンディングボック
スを作成しないため、信頼度=0で学習
2.Unified Detection
②Pr(Object)=1のため、信頼度=IOU
①Pr(Object)=0のため、信頼度=0
③物体の中心でないため、信頼度=0
11. 10
• Each bounding box consists of 5 predictions: x, y, w, h, and
confidence. The (x, y) coordinates represent the center of the box
relative to the bounds of the grid cell. The width and height are
predicted relative to the whole image. Finally the confidence
prediction represents the IOU between the predicted box and any
ground truth box.
➜ バウンディングボックスは(x、y、w、h、F)から構成され、座標( x、y )はボック
スの中心の位置、(w、h)はボックスの大きさを表現。信頼度Fは位置の信頼度で
正解座標と推論座標のIOUで表現。
2.Unified Detection
バウンディングボックスの信頼度F = IOU
13. 12
2.Unified Detection
• Each grid cell ~. We only predict one set of class probabilities per
grid cell, regardless of the number of boxes B. At test time we
multiply the conditional class probabilities and the individual box
confidence predictions,
Pr(Classi|Object) ∗ Pr(Object) ∗ IOUtruth pred = Pr(Classi) ∗ IOUtruth pred
These scores encode both the probability of that class appearing in
the box and how well the predicted box fits the object.
➜ 1グリッドでB個のバウンディングボックスを作成する場合でも、グリッド毎に1つのクラ
ス確率のセットを推論する。(1グリッド内のB個のボックスは同じクラスになる。)
➜ 推論のとき、条件付きのクラス確率Pr(Classi)と物体の中心があるグリッドの信頼
度IOUの積を計算して、クラス確信度を推論する。
➜ これらのクラス確信度は物体の位置とクラス分類の精度をエンコードしたものである。
17. 16
2.2.Training
• YOLO predicts multiple bounding boxes per grid cell. At training
time we only want one bounding box predictor to be responsible for
each object. We assign one predictor to be “responsible” for
predicting an object based on which prediction has the highest
current IOU with the ground truth. This leads to specialization
between the bounding box predictors.
➜ YOLOはグリッド毎に2個のバウンディングボックスを推論する。しかし、訓練では1物
体に1個のバウンディングボックスが欲しい。そこで、物体の正解座標とのIOUが最も高
いバウンディングボックス1個を学習に使用する。これが、複数のバウンディングボックスか
らの絞り込む方法である。
19. 18
2.2.Training
• Note that the loss function only penalizes classification error if an
object is present in that grid cell.
➜ 5項目のクラス分類: グリッドに物体が存在するPr(Object)=1の場合に計算。
インディケーター関数はi番目のグリッドに物体があるときは1、ないときは0
(クラス分類は物体が存在する全グリッドが対象。)
推論のクラス確信度と正解
クラスが同じだと損失0
20. 19
2.2.Training
• It also only penalizes bounding box coordinate error if that predictor
is “responsible” for the ground truth box. (i.e. has the highest IOU
of any predictor in that grid cell).
➜ 1,2,3項目は物体中心があるグリッドの中で最大IOUのボックスを計算。
インディケーター関数は物体中心があるi番目のグリッドと最大IOUのj番目のボックスの
組み合わせが1で、それ以外は0。3項目は信頼度C^=1が正解で学習。
推論と正解の中心座
標が同じだと損失0
推論と正解の大きさ
が同じだと損失0
中心グリッドの信頼度の
推論が1だと損失0
22. 21
2.3.Inference
• The grid design enforces spatial diversity in the bounding box
predictions. Often it is clear which grid cell an object falls in to and
the network only predicts one box for each object. However, some
large objects or objects near the border of multiple cells can be well
localized by multiple cells. Non-maximal suppression can be used to
fix these multiple detections.
➜ グリッドのデザインの都合で複数の異なるバウンディングボックスが推論されることがあ
る。 通常、物体の中心点がどこのグリッドに落ちるか自明で、ネットワークは物体1個に
対して1個のバウンディングボックスを推論する。しかし、グリッドを跨ぐ大きな物体やグリッ
ドの狭間にある場合は物体1個に対して複数のバウンディングボックスを推論する。これ
らのボックスの絞り込みにNon-maximal suppression(NMS)が利用される。
※NMSは同じクラスのバウンディングボックス通しのIOUが閾値(0.5など)以上の場合
(被りがある場合)、最大のクラス確信度を持つバウンディングボックスを除いて削除す
る。
23. 22
2.4.Limitation of YOLO
• YOLO imposes strong spatial constraints on bounding box
predictions since each grid cell only predicts two boxes and can only
have one class. This spatial constraint limits the number of nearby
objects that our model can predict. Our model struggles with small
objects that appear in groups, such as flocks of birds.
➜ YOLOはバウンディングボックスの位置推定に強い制約を課している。各グリッドセル
は2つのバウンディングボックスと1つのクラスしか推論できないからだ。この位置の制約は
YOLOが物体周辺で推論可能な物体数を制限している。YOLOは鳥の群れのように
小さな物体の集合体の推論が苦手。
24. 23
2.4.Limitation of YOLO
• Finally, while we train on a loss function that approximates
detection performance, our loss function treats errors the same in
small bounding boxes versus large bounding boxes. A small error in
a large box is generally benign but a small error in a small box has a
much greater effect on IOU. Our main source of error is incorrect
localizations.
➜ 物体検出の結果を近似した損失関数を使って、ネットワークを訓練するので、損失
関数は大きい物体と小さい物体を同じ基準で扱ってしまう。大きい物体の誤差に比べ
て、小さい物体の誤差はIOUの影響で圧倒的に大きくなる。損失関数の主な原因は
不正な位置推定にある。