Brief Review: YOLOv5 for Object Detection

Brief Explanation of YOLOv5, It Outperforms

Sik-Ho Tsang
5 min readJun 9, 2023

--

,
YOLOv5, by Ultralytics,
Jun 26, 2020, GitHub (Sik-Ho Tsang @ Medium)

Object Detection
2014 … 2020 [] [] [] [] [] [] [] [] 2021 [] [] [] [] 2022 [] [] [] 2023 []

  • YOLOv5 version v1 is published on Jun 26, 2020. The latest version is v7, which is published on Nov 22, 2022. Yet, it seems that there is no paper or tech report provided talking about it.
  • (One way is to read the codes directly, which is cumbersome. Or finding blogs/vlogs which explains about it. To me, one of the famous blogs to explain YOLOv5 is from , which is in Chinese language.)
  • (Thus, I decide to write one on my own so that I can easily review it again later. To do this, I’ve found some papers that enhance YOLOv5. Based on these papers, I summarize the basic YOLOv5 as below.)

Outline

  1. YOLOv5: Overall Architecture
  2. YOLOv5: Backbone
  3. YOLOv5: Neck
  4. YOLOv5: Head
  5. YOLOv5: Model Variants
  6. Results

1. YOLOv5: Overall Architecture

YOLOv5: Overall Architecture
  • The image was processed through a input layer (input) and sent to the backbone for feature extraction.
  • The backbone obtains feature maps of different sizes, and then fuses these features through the feature fusion network (neck) to finally generate three feature maps P3, P4, and P5 (in the YOLOv5, the dimensions are expressed with the size of 80×80, 40×40 and 20×20) to detect small, medium, and large objects in the picture, respectively.
  • After the three feature maps were sent to the prediction head (head), the confidence calculation and bounding-box regression were executed for each pixel in the feature map using the preset prior anchor, so as to obtain a multi-dimensional array (BBoxes) including object class, class confidence, box coordinates, width, and height information.
  • By setting the corresponding thresholds (confthreshold, objthreshold) to filter the useless information in the array, and performing a non-maximum suppression (NMS) process, the final detection information can be output.

2. YOLOv5: Backbone

YOLOv5: Model Architecture
Parameters of YOLOv5 Backbone
  • The backbone is Darknet53.
  • The main structure is the stacking of multiple CBS (Conv + + ) modules and s, and finally one SPPF module is connected.
  • CBS module is used to assist in feature extraction, while SPPF module enhances the feature expression ability of the backbone.
Structure of SPPF
  • SPPF avoided the repeated operation of as in , by max pooling the previous max pooled features.
  • This can significantly improved the running speed of the module.

3. YOLOv5: Neck

(a) Without Feature Fusion, (b) and (c) .
YOLOv5: Neck (Within Dashed Box)
  • YOLOv5 uses the methods of and .
  • The basic idea of is to up-sampling the output feature map (C3, C4, and C5) generated by multiple convolution down sampling operations from the feature extraction network to generate multiple new feature maps (P3, P4, and P5) for detecting different scales targets.

4. YOLOv5: Head

YOLOv5: Head
Bounding Box Regression
  • The coordinate value of the upper left corner of the feature map is set to (0, 0).
  • rx and ry are the unadjusted coordinates of the predicted center point.
  • gx, gy, gw, gh represent the information of the adjusted prediction box.
  • pw and ph are for the information of the prior anchor.
  • sx and sy represent the offsets calculated by the model.
  • The process of adjusting the center coordinate and size of the preset prior anchor to the center coordinate and size of the final prediction box.

5. YOLOv5: Model Variants

Five versions of YOLOv5
  • There are 5 versions of YOLOv5, namely YOLOv5x, YOLOv5l, YOLOv5m, YOLOv5s, and YOLOv5n.
  • There are also 5 corresponding larger versions, YOLOv5x6, YOLOv5l6, YOLOv5m6, YOLOv5s6, and YOLOv5n6.
YOLOv5l: Detailed Architecture ()
  • YOLOv5l model architectures are in details as above.

6. Results

6.1. Larger Models

YOLOv5n6 to YOLOv5x6 on MS COCO

All YOLOv5 larger models outperforms by large margin.

6.2. Smaller Models

YOLOv5n to YOLOv5x on MS COCO
  • Similar to smaller models, all YOLOv5 smaller models outperforms by large margin as well, with even faster speed.

6.3. Detailed Results

Detailed Performance (TTA: Test Time Augmentation)
  • The detailed results are shown above.

References

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Sik-Ho Tsang
Sik-Ho Tsang

Written by Sik-Ho Tsang

PhD, Researcher. I share what I learn. :) Linktree: for Twitter, LinkedIn, etc.

Responses (2)

Write a response