Answers.Body: <p>The quick answer: yes you can, just add images without labels, just make sure that in the negative samples there are no cars or you will make the AI crazy (i.e. convergence &amp; instability issues).</p>
  <p>However that might not be the better approach to go. Why? Because your dataset  already have enough negative examples. This was pointed out by the famous paper <a href="https://arxiv.org/pdf/1708.02002.pdf" rel="nofollow noreferrer">Focal Loss for Dense Object Detection</a>. The paper basically proposes to think that each pixel of a dataset image is a training signal. Then for each image there are lots of pixels with negative signal (nothing in it: sky, ground, trees...) and only a few with positive signal (the actual car).</p>
  <p>So if each image of the dataset have more negative signals (pixels) than positive, then, the problem might not be in the negative examples. So that leaves you with 2 ways to go:</p>
  <ul>
  <li>Use a loss function that focus more on positive signal (car pixels) than in the negative examples (not car pixels) such <strong>focal loss</strong> or derivatives</li>
  <li>Add  more <strong>positive examples</strong> in the dataset</li>
  </ul>
  <p>I can confirm what this paper stated in my every day experiments. We have a battery of experiments right now that performs best with focal loss &amp; no negative examples VS other experiments without focal loss &amp; negative examples.</p>
  <p>Just for reference this is what happens when there are lots of negative examples:</p>
  <p><a href="https://i.sstatic.net/f7Bdy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/f7Bdy.png" alt="enter image description here" /></a></p>
  <p>The AI took a while to figure out that negative samples are not useful (1M steps) in this experiment. From them on it just focused on the positive samples and this training started to converge (and inference started to show something meaningful)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-23T14:51:59.730Z
Answers.LastActivityDate: 2021-06-23T14:51:59.730Z
Answers.UserDisplayName: JVGD
Body: <p>My question is: how to add certain negative samples to the training dataset to suppress those samples that are recognized as the object.</p>
  <p>For example, if I want to train a car detector. All my training images are outdoor images with at least one car. However, when I use the trained detector on indoor images, sometimes I got the wrong object detected (false positive). How can I add more indoor images (negative samples) to the training dataset to improve the accuracy? Can I just add them without any labeling?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-23T10:02:20.503Z
Comments.Text: What do you mean by "Can I just add them without any labeling?"? How are you training your neural network? Aren't you training your model in a supervised way?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-23T13:49:13.433Z
Comments.Text: I am training a SSD model for object detection. Each of my training images contains at least one object and the objects are labeled (bounding box) manually. When I test my model on certain scenario (not in the training set) I got many false positive results. I am just wondering how should I improve model? Can I add those failure images to the training set without labeling (because no object on those images)? Hopes it is clear
Comments.UserDisplayName: fnhdx
Tags: <deep-learning><object-detection><data-labelling>
Title: How to add negative samples for object detection?
UserDisplayName: fnhdx
ThreadText: # How to add negative samples for object detection?
  
  (Asked by: username_0 on 2021-06-22)
  
  My question is: how to add certain negative samples to the training dataset to suppress those samples that are recognized as the object.
  
  For example, if I want to train a car detector. All my training images are outdoor images with at least one car. However, when I use the trained detector on indoor images, sometimes I got the wrong object detected (false positive). How can I add more indoor images (negative samples) to the training dataset to improve the accuracy? Can I just add them without any labeling?
  
  **Tags:** deep-learning, object-detection, data-labelling
  > **Comments:**
  > **username_1**: What do you mean by "Can I just add them without any labeling?"? How are you training your neural network? Aren't you training your model in a supervised way?  
  > **username_0**: I am training a SSD model for object detection. Each of my training images contains at least one object and the objects are labeled (bounding box) manually. When I test my model on certain scenario (not in the training set) I got many false positive results. I am just wondering how should I improve model? Can I add those failure images to the training set without labeling (because no object on those images)? Hopes it is clear  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-06-23. Score: 4 | Accepted answer
  
  The quick answer: yes you can, just add images without labels, just make sure that in the negative samples there are no cars or you will make the AI crazy (i.e. convergence & instability issues).
  
  However that might not be the better approach to go. Why? Because your dataset already have enough negative examples. This was pointed out by the famous paper [Focal Loss for Dense Object Detection](https://arxiv.org/pdf/1708.02002.pdf). The paper basically proposes to think that each pixel of a dataset image is a training signal. Then for each image there are lots of pixels with negative signal (nothing in it: sky, ground, trees...) and only a few with positive signal (the actual car).
  
  So if each image of the dataset have more negative signals (pixels) than positive, then, the problem might not be in the negative examples. So that leaves you with 2 ways to go:
  
  * Use a loss function that focus more on positive signal (car pixels) than in the negative examples (not car pixels) such **focal loss** or derivatives
  * Add more **positive examples** in the dataset
  
  I can confirm what this paper stated in my every day experiments. We have a battery of experiments right now that performs best with focal loss & no negative examples VS other experiments without focal loss & negative examples.
  
  Just for reference this is what happens when there are lots of negative examples:
  
  [![enter image description here](https://i.sstatic.net/f7Bdy.png)](https://i.sstatic.net/f7Bdy.png)
  
  The AI took a while to figure out that negative samples are not useful (1M steps) in this experiment. From them on it just focused on the positive samples and this training started to converge (and inference started to show something meaningful)
  
  
  ---
  
  