Emproto

Hard hat and Non-hard hat Helmet Detection Using Tensorflow

Video Surveillance has gained importance across the world with changing society.Video Analytics play a very important role because it offers various applications like security, monitoring, and motion sensing. Video Analytics not only offers a view of what is  happening, It also provides practical solutions to real-world problems that are often addressed with a group of entire data.

Video Analytics Applications – 

  • Facial Detection. 
  • People Counting
  • Autotomatic License Plate Detection. 
  • Object Detection & Recognition and many more 

Usually, these systems perform real-time monitoring within which objects, object attributes, movement patterns, or behavior associated with

the monitored environment are detected.

 

Object Detection is one such application that deals with detecting instances of semantic objects of a certain class (such as humans, building, cars, animals, etc ) [1].

It has the power to classify one or several objects with in an image/video at once  [2]. 

For example – Figure 1 shows image with three objects – Potted plant, cup and a bottle . 

Figure 1 

 

How does Object detection work ?

The steps involved in object detection process are as follows  – 

1) The image is split into various regions.

2) Each region is taken into account as a separate image.

3) These regions are fed to a CNN(Convolutional Neural Network – a deep learning approach widely used for detecting objects) where they’re classified into various classes (Human, Pen, Bottle, Pot ,etc).

4) These regions are all combined to get the original image with detected objects.

Hard hat and Non-Hard hard helmet detection Use Case 

A hard hat is a type of helmet predominantly used in workplace environments such as industrial or construction sites to protect the head from injury due to falling objects, impact with other objects, debris, rain, and electric shock. [3] Automatic Hard hat and Non-Hard hat detection technology plays a vital role. This system detects in real-time   those workers and employees who are wearning helmets and not wearing helmets (violating workplace safety ).

Approach 

Tools /Libraries Used. 

  • Ubuntu 18.04
  • Opencv 4
  • FFMPEG
  • Python 3
  • LabelImg
  • Tensorflow library, pre-trained model Used- Faster R-CNN inception
  1. Collection of Videos involving individuals wearing helmets,and no helmets .
  2. The video files are converted into sequence of image frames by using a tool FFMPEG . FFMPEG is a collection of libraries that helps to process multimedia content like audio, video, images, etc. 
  3. The image frames are fed to a tool LabelImg to perform Annotaion/Labelling. 

Annotation/Labelling is a process that helps us to draw bounding boxes around the object of interest and give a label (Ex Dog, Cat, Person, etc). LabelImg is a graphical annotation tool written in python that helps us to perform annotation. 

  1. The labelled image datasets can be used for training the model using an algorithm .
  2. Training Process – Library used : Tensorflow
  3. Splitting of datasets – The labelled images must be split into train datasets and test datasets
  4. Datasets(Ratio – 80%-20% or 90%-10%). The labelled datasets must be stored in a directory.
  5. Convert the Train and Test datasets into tfrecords (Tensorflow’s own binary storage format. 
  6. Select a Pre-trained Model and configure the training process. The model chosen in this use case is Faster R-CNN inception . 
  7. Train the model and export the model once it is trained. Test the model using new datasets. 

Figure 2 and 3 shows the detection of people wearing and not wearing helmets along with the confidence score. 

Figure 2

Figure 3

 

References 

[1] https://en.wikipedia.org/wiki/Object_detection
[2] https://www.panacast.com/object-detection-what-is-it-and-how-is-it-useful/
[3] https://en.wikipedia.org/wiki/Hard_hat