Answers.Body: <blockquote>
  <p>I am currently using MSE to predict the center of ROI coordinates and its width and height. All values are relative to image size. I think that such an approach does not put enough pressure on the fact those coordinates are related.</p>
  </blockquote>
  <p>At first glance, this looks quite reasonable. Computer vision is not really my main area of expertise, so I did some googling around, and <a href="https://github.com/lars76/object-localization" rel="nofollow noreferrer">one of the first repositories I ran into does something very similar</a>. It may be interesting for you to look into the code and the references in that repository in more detail.</p>
  <p>It looks to me like they're also using the <a href="https://github.com/lars76/object-localization/blob/master/train_model.py#L90" rel="nofollow noreferrer">MSE</a> loss function. I'm not 100% sure how they define the bounding boxes, maybe you can figure it out by digging through the code. You currently define bounding boxes by:</p>
  <ol>
  <li>X coordinate of center of bounding box</li>
  <li>Y coordinate of center of bounding box</li>
  <li>Width of bounding box</li>
  <li>Height of bounding box</li>
  </ol>
  <p>You are right in that these coordinates are quite closely related. If the center is incorrect (for example, a bit too far to the right), that mistake could partially be &quot;fixed&quot; by taking a greater width (the bounding box would go a bit too far to the right, but still encapsulate the object). I don't know if this is necessarily a problem, or a fact that should be exploited in some way or something that should be &quot;put pressure on&quot;. If this is something you are concerned about, I suppose you could alternatively define the bounding box as follows (I'm not sure whether or not this is what's done in the repository linked above):</p>
  <ol>
  <li>X coordinate of top-left corner of bounding box</li>
  <li>Y coordinate of top-left corner of bounding box</li>
  <li>X coordinate of bottom-right corner of bounding box</li>
  <li>Y coordinate of bottom-right corner of bounding box</li>
  </ol>
  <p>Intuitively, I suspect the relation between those two corner points will be less strong than the relation you identified exists between center + width + height. A &quot;mistake&quot; in coordinates of the top-left corner cannot be partially &quot;fixed&quot; by placing the bottom-right corner somewhere else.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-24T15:09:13.823Z
Answers.Text: I will try out this kind of loss and compare it with mine on same architecture, maybe there will be difference in convergence time.
Answers.UserDisplayName: don_pablito
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-24T12:49:41.107Z
Answers.LastActivityDate: 2022-01-02T12:48:19.607Z
Answers.LastEditDate: 2022-01-02T12:48:19.607Z
Answers.UserDisplayName: Dennis Soemers
Body: <p>What loss function should one use, knowing that the input image contains exactly one target object?</p>
  <p>I am currently using MSE to predict the center of ROI coordinates and its width and height. All values are relative to image size. I think that such an approach does not put enough pressure on the fact those coordinates are related.</p>
  <p>I am aware of the existence of algorithms like YOLO or UnitBox, and am just wondering if there might be some shortcut for such particular case.</p>
  
Tags: <convolutional-neural-networks><objective-functions><object-detection>
Title: What loss function should one use for object detection, knowing that the input image contains exactly one target object?
UserDisplayName: don_pablito
ThreadText: # What loss function should one use for object detection, knowing that the input image contains exactly one target object?
  
  (Asked by: username_0 on 2018-07-20)
  
  What loss function should one use, knowing that the input image contains exactly one target object?
  
  I am currently using MSE to predict the center of ROI coordinates and its width and height. All values are relative to image size. I think that such an approach does not put enough pressure on the fact those coordinates are related.
  
  I am aware of the existence of algorithms like YOLO or UnitBox, and am just wondering if there might be some shortcut for such particular case.
  
  **Tags:** convolutional-neural-networks, objective-functions, object-detection
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-07-24. Score: 1
  
  > I am currently using MSE to predict the center of ROI coordinates and its width and height. All values are relative to image size. I think that such an approach does not put enough pressure on the fact those coordinates are related.
  
  At first glance, this looks quite reasonable. Computer vision is not really my main area of expertise, so I did some googling around, and [one of the first repositories I ran into does something very similar](https://github.com/lars76/object-localization). It may be interesting for you to look into the code and the references in that repository in more detail.
  
  It looks to me like they're also using the [MSE](https://github.com/lars76/object-localization/blob/master/train_model.py#L90) loss function. I'm not 100% sure how they define the bounding boxes, maybe you can figure it out by digging through the code. You currently define bounding boxes by:
  
  1. X coordinate of center of bounding box
  2. Y coordinate of center of bounding box
  3. Width of bounding box
  4. Height of bounding box
  
  You are right in that these coordinates are quite closely related. If the center is incorrect (for example, a bit too far to the right), that mistake could partially be "fixed" by taking a greater width (the bounding box would go a bit too far to the right, but still encapsulate the object). I don't know if this is necessarily a problem, or a fact that should be exploited in some way or something that should be "put pressure on". If this is something you are concerned about, I suppose you could alternatively define the bounding box as follows (I'm not sure whether or not this is what's done in the repository linked above):
  
  1. X coordinate of top-left corner of bounding box
  2. Y coordinate of top-left corner of bounding box
  3. X coordinate of bottom-right corner of bounding box
  4. Y coordinate of bottom-right corner of bounding box
  
  Intuitively, I suspect the relation between those two corner points will be less strong than the relation you identified exists between center + width + height. A "mistake" in coordinates of the top-left corner cannot be partially "fixed" by placing the bottom-right corner somewhere else.
  
  > **Comments:**
  > **username_0**: I will try out this kind of loss and compare it with mine on same architecture, maybe there will be difference in convergence time.  
  
  ---
  
  