loader image

Human Crowd Detection With Public Webcam Part 3

Introduction To YOLO — You Only Look Once

All of the previous object detection algorithms use regions to localize the object within the image. The network does not look at the complete image. Instead:

  1. It Intakes an image and divides it in a grid of S X S (where S is a natural number)
  2. Each pixel in the image can be responsible for a finite number of (5 in our case) bounding box predictions. A pixel is taken responsible for prediction when it is the center of the object detected. Out of all detected boxes, It is taken responsible for the detection of only one object, and other detections are rejected.
  3. It predicts C conditional class probabilities (one per class for the likeliness of the object class).


Total detections to be done per image=S X S((B*5)+C)

  1. S X S= Total number of images YOLO divides the Input
  2. B is the Number of Bounding boxes Detected all over the image(Without any threshold consideration).
  3. B*5= For each bounding box, 5 elements are detected:
    1. Detected Objects Center coordinates(x,y)
    2. Height and Width
    3. Confidence score.
  4. C=Conditional probability for the Number of Classes.

– What is the Confidence threshold?

The threshold for minimum confidence the model has on a detected object (box confidence score)

– How is the box confidence score calculated?

However, most of these boxes have low confidence scores and if we set a threshold say 30% confidence, we can remove most of them as shown in the example below

YOLO requires a Neural Network framework for training and for this we have used DarkNet

Let’s Learn about different YOLO versions:

– YOLOv1:

has 26 layers in total, with 24 Convolution Layers followed by 2 Fully Connected layers. The major problem with YOLOv1 is
its inability to detect very small objects.

– YOLO9000 / YOLOv2:

  1. Inclusion of batch Normalization layers after each Conv Layer
  2. It has 30 layers in comparison to YOLOv1’s 26 layers.
  3. Anchor Boxes were introduced.


Anchor boxes are predefined boxes provided by the user to Darknet which gives the network an idea about the relative position and
dimensions of the objects to be detected. It must be calculated using the training set Objects.

  1. No fully connected layer present
  2. Random dimensions were taken for training images ranging from 320–608
  3. Multiple labels might be provided to the same objects, but still a multiclass problem (WordTree concept)
    i.e. either the parent or child be the final label and not both.
  4. Still bad with small objects

– YOLOv3:

  1. 106 layers neural network
  2. Detection on 3 scales for detecting objects of small to very large size
  3. 9 anchor boxes taken; 3 per scale. Hence more bounding boxes are predicted than YOLOv2 & YOLOv1
  4. Multi-class problem turned into Multi-Label problem
  5. Certain changes in the Error function.
  6. Quite good with small objects

– YOLOv4:

  1. There are a huge number of features
  2. Some features operate on certain models exclusively and for certain problems exclusively, or only for small-scale datasets:
    1. There are a huge number of features
    2. Some features operate on certain models exclusively and for certain problems exclusively, or only for small-scale datasets
    3. ~65 frames per second (FPS)

– YOLOv5:

  1. 0.007 seconds per image
  2. ~140 frames per second (FPS)


YOLOv5 is orders of magnitude faster (~140 frames per second) than other object detection algorithms. The limitation of the YOLO algorithm is that it struggles with small objects within the image, for example, it might have difficulties in detecting a flock of birds.
This is due to the spatial constraints of the algorithm.

In the next part, we will learn about the Implementation of HUMAN CROWD DETECTION and How to solve the problem of Detection Small Objects in YOLOv5


  1. Official repository – declares the latest version of YOLOv4 / Scaled-YOLOv4: https://github.com/pjreddie/darknet#darknet
  2. Official YOLOv4 repository: https://github.com/AlexeyAB/darknet
  3. Official paper – YOLOv4: https://arxiv.org/abs/2004.10934
  4. Official paper – Scaled-YOLOv4: https://arxiv.org/abs/2011.08036
  5. Taiwanese government uses YOLOV4: https://www.taiwannews.com.tw/en/news/3957400
  6. Official paper – YOLOv5: https://docs.ultralytics.com/
  7. Official repository – YOLOv5: https://github.com/ultralytics/yolov5


Leave a Reply

Your email address will not be published. Required fields are marked *

Unlimited access to educational materials for subscribers

Ask ChatGPT
Set ChatGPT API key
Find your Secret API key in your ChatGPT User settings and paste it here to connect ChatGPT with your Tutor LMS website.
Hi, Welcome back!
Don't have an account?  Register Now