Answers.Body: <p>I'd go with option 2 personally, given that you already have a model that can detect people and vests to a level you are comfortable with. YOLO will output a &quot;boxes&quot; variable that contains the dimensions and class of your boxes.  When boxes.cls indicates that this box contains a person, crop at the box dimensions given by boxes.xyxy, and look for a vest in the cropped image (or just check if boxes.xyxy when boxes.cls is a vest is contained by the boxes.xyxy for the person).  That way you know who is and isn't wearing a vest, rather than just whether there is difference in the number of person and vest detections, and don't have to train a whole new model to detect people with and without vests.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-06T18:44:37.207Z
Answers.LastActivityDate: 2023-12-06T18:44:37.207Z
Answers.UserDisplayName: Jeremiah
Answers.Body: <p>I would augment the model by adding a binary classification output for each detected object, which is responsible for predicting whether or not a person is wearing a vest. This approach requires data labeling, which can be automatically labeled using an existing pre-trained model that can accurately detect both people and vests in the images.</p>
  <p>The options 2 and 3 may require manual tuning of parameters, such as thresholds for object detection and classification. This can be achieved by training the DNN end-to-end. Also, option 2 may cause performance issues if the detector is invoked two times.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-08T23:29:57.493Z
Answers.LastActivityDate: 2024-01-08T23:29:57.493Z
Answers.UserDisplayName: Oleg
Body: <p>I want to detect the people that are NOT wearing PPE vests using a pre-trained object detection model like YOLO or Grounding Dino.</p>
  <p>The models are able to detect people and vests separately, but I am not sure how to detect person WITHOUT a vest.</p>
  <p>How do I go about doing this in the general sense? Below are the options that I could think of:</p>
  <ol>
  <li><p>Collect datasets of people wearing vests and not wearing vests, annotate them, and train the model for these. I am unsure because I think the differences are minor.</p>
  </li>
  <li><p>Detect person, get the bounding box. Inside that box, detect a vest. If it does not exist, it's a person without a vest. Not sure if there is a term for this or how I'd code it.</p>
  </li>
  <li><p>Detect &quot;person&quot; and &quot;vest&quot;. If number of people &gt; number of vests detected, then there is a person without a vest. Not sure how to detect which person is without a vest. Perhaps find a person that has no overlap with a vest</p>
  </li>
  </ol>
  <p>Which of the above options is a viable solution? Any other suggestions are also welcome. I am new to this, so I don't know if this is a common problem or how to solve it. If anyone could guide me towards the correct direction, I'd greatly appreciate it.</p>
  
Tags: <machine-learning><deep-learning><computer-vision><object-detection><yolo>
Title: How to detect negative (absence of) an object?
UserDisplayName: Krithik Roshan
ThreadText: # How to detect negative (absence of) an object?
  
  (Asked by: username_0 on 2023-11-22)
  
  I want to detect the people that are NOT wearing PPE vests using a pre-trained object detection model like YOLO or Grounding Dino.
  
  The models are able to detect people and vests separately, but I am not sure how to detect person WITHOUT a vest.
  
  How do I go about doing this in the general sense? Below are the options that I could think of:
  
  1. Collect datasets of people wearing vests and not wearing vests, annotate them, and train the model for these. I am unsure because I think the differences are minor.
  2. Detect person, get the bounding box. Inside that box, detect a vest. If it does not exist, it's a person without a vest. Not sure if there is a term for this or how I'd code it.
  3. Detect "person" and "vest". If number of people > number of vests detected, then there is a person without a vest. Not sure how to detect which person is without a vest. Perhaps find a person that has no overlap with a vest
  
  Which of the above options is a viable solution? Any other suggestions are also welcome. I am new to this, so I don't know if this is a common problem or how to solve it. If anyone could guide me towards the correct direction, I'd greatly appreciate it.
  
  **Tags:** machine-learning, deep-learning, computer-vision, object-detection, yolo
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-12-06. Score: 0
  
  I'd go with option 2 personally, given that you already have a model that can detect people and vests to a level you are comfortable with. YOLO will output a "boxes" variable that contains the dimensions and class of your boxes. When boxes.cls indicates that this box contains a person, crop at the box dimensions given by boxes.xyxy, and look for a vest in the cropped image (or just check if boxes.xyxy when boxes.cls is a vest is contained by the boxes.xyxy for the person). That way you know who is and isn't wearing a vest, rather than just whether there is difference in the number of person and vest detections, and don't have to train a whole new model to detect people with and without vests.
  
  
  ---
  
  ### Answer by username_2 on 2024-01-08. Score: 0
  
  I would augment the model by adding a binary classification output for each detected object, which is responsible for predicting whether or not a person is wearing a vest. This approach requires data labeling, which can be automatically labeled using an existing pre-trained model that can accurately detect both people and vests in the images.
  
  The options 2 and 3 may require manual tuning of parameters, such as thresholds for object detection and classification. This can be achieved by training the DNN end-to-end. Also, option 2 may cause performance issues if the detector is invoked two times.
  
  
  ---
  
  