Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if object is missing in Image using Tensorflow?

Tags:

tensorflow

I want to check if a person is not worn Gloves, Hard Hat or Reflective Vest, etc. For example, at the construction site, if a person did not wear any of the above things then I want to detect.

like image 210
Dharmesh Prajapati Avatar asked Dec 01 '25 01:12

Dharmesh Prajapati


1 Answers

Basically, you will need two models for this task.

  1. The 1st model which detects whether the subject has worn either of the following items - Gloves, Hard Hat or Reflective Vest, or not.
  2. If the above yields a positive result then which gear is the subject wearing.

For model 1:

You can use anomaly detection for this. This means that you train a model on images of various subjects which are wearing the required gear. Now, when the model is shown an image of a person not wearing the required gear, it will produce a huge loss value.

The model hasn't learnt to reconstruct images which do not possess the required gear and hence the loss is larger.

References :

https://www.quora.com/What-are-the-best-anomaly-detection-methods-for-images https://towardsdatascience.com/anomaly-detection-in-images-777534980aeb

For model 2:

This is a simple classification problem. The model needs to classify whether the image contains Gloves, Hard Hat or Reflective Vest. You can try hands-on Convolutional Neural Networks ( CNNs ) which excel image classification.

References:

https://towardsdatascience.com/building-a-convolutional-neural-network-cnn-in-keras-329fbbadc5f5 https://adventuresinmachinelearning.com/keras-tutorial-cnn-11-lines/ https://www.learnopencv.com/image-classification-using-convolutional-neural-networks-in-keras/

like image 112
Shubham Panchal Avatar answered Dec 08 '25 21:12

Shubham Panchal