Professional Documents
Culture Documents
Week 05
Week 05
Week 05
IoT Applications
AI on Embedded Device
Woojin Jeong
Object Detection
2
Object Detection
How about it?
ANN for MNIST CNN for CIFAR-10
Classify handwritten
Classify handwritten How can I classify
image to airplane,
image to 0 ~ 9 this image?
automobile, … truck
3
Object Detection
● Task of detecting instances of objects of a specific class within an image
or video.
○ locates the existence of objects in an image using a bounding box →
Localization
○ assigns the types or classes of the objects found → Classification
Classified to “dog”
Localization using
bounding box
4
Object Detection Methods
5
Object Detection Methods
● Neural-network based method
○ Region-Based CNN (R-CNN, Fast R-CNN, etc.)
○ Single Shot Detector (SSD)
○ Retina-Net
○ You Only Look Once (YOLO)
2-stage detector
6
YOLO
7
YOLO
● You Only Look Once
○ A single neural network predicts bounding boxes and class probabilities
directly from full images in one evaluation. Since the whole detection pipeline
is a single network, it can be optimized end-to-end directly on detection
performance.
○ 1-stage detector
8
YOLO - Unified detection
9
YOLO - Unified detection
● Assume
○ Divide image to 4x4 grids (S = 4)
○ Predict 2 bounding boxes(BB) for each grid (B = 2)
○ Classify 20 objects (C = 20)
Predicted BB
11
YOLO - Unified detection x
Pc
(x, y)
h/H 1 : Object exists in the cell
0 : No object
w/W
Predicted BB
12
YOLO - Unified detection
(x, y)
Predicted BB
13
YOLO - Unified detection x
Pc
x
(x, y) h/H
y
h
w/W
Pc
Predicted BB
C1
C2
Conditional class probabilities
C20 of the cell
14
YOLO - Unified detection x
h
Output for the cell
Pc
Pc
C1
C2
C20
15
YOLO - Unified detection
5*2 + 20 = 30
S=4 (B=2, C= 20)
S=4
Output tensor
16
YOLO - Unified detection
30
4
4
Resize image
Predict 2 BB of a grid Output tensor
Divide to 4x4 grids
17
YOLO - Network design
18
YOLO - Network design
Output : 7x7x30
S=7, B=2, C=20
Input : 448x448
RGB image
YoloV2 use PASCAL
VOC (20 classes)
19
YOLO - Network design
21
YOLO - Inference
C2
x y w h Pc x y w h Pc C1 C2
0
C2
Pc x C1 C2
0
C2
Pc x C1 C2
0
y
w
Output tensor
h
Pc
x
y
w
h
Pc
C1 C1
C2 C2
C2 C2
0 0 22
BBox1 BBox2 BBox31 BBox32
YOLO - Inference
x
y
w
h
Pc
x
y
w
h
Pc
Confidence for “Cat” class of each
C1 C1
BBox.
C2 C2
C2 C2
0 0
24
YOLO - Inference
25
YOLO - Inference
26
YOLO - Inference
27
YOLO - Inference
28
YOLO - Demo
https://www.youtube.com/@yoloobjectdetection3460
29
YOLOv8
30
YOLOv1 ~ YOLOv8
● YOLOv1 ~ YOLOv3
○ by Joseph Redmond
● YOLOv4
○ by Alexey Bochkovskiy (Apr. 2020)
● YOLOv5
○ by Glenn Jocher from Ultralytics (Jun. 2020)
● YOLOv6
○ by Meituan Vision AI Department (Sep. 2022)
● YOLOv7
○ by Alexey Bochkovskiy (Jul. 2022)
● YOLOv8
○ by Glenn Jocher from Ultralytics (Jan. 2023)
https://www.youtube.com/watch?v=QOC6vgnWnYo
31
YOLOv8
32
Use YOLOv8
● Documents for YOLOv8
○ https://docs.ultralytics.com/
● Prepare environment
○ Install Anaconda : https://www.anaconda.com/download
○ Use Powershell
○ Create Virtual Environment
○ Install package for YOLOv8 (use pip in virtual environment)
■ Ultralytics
■ Pytorch
33
Use YOLOv8
34
Use YOLOv8
35
Use YOLOv8
36
Use YOLOv8
37
Use YOLOv8
38