Answers.Body: <p>The scenario you're describing seems to initially suggest an object detection approach. However, given the complexity of objects being stacked and the necessity to count individual instances accurately, object detection alone, even with a robust model like YOLOv8, may not deliver the level of precision you need.</p>
  <p>For greater accuracy, particularly where objects are partially obscured or in contact with one another, instance segmentation could be the more appropriate technique. Although it is more computationally intensive, instance segmentation models can provide the pixel-level detail required for precise identification and counting of object instances in challenging scenarios.</p>
  <p><a href="https://i.sstatic.net/nWV7p.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nWV7p.png" alt="enter image description here" /></a>
  (<a href="https://nirmalamurali.medium.com/image-classification-vs-semantic-segmentation-vs-instance-segmentation-625c33a08d50" rel="nofollow noreferrer">source</a>)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-11T16:06:01.693Z
Answers.LastActivityDate: 2024-01-11T16:06:01.693Z
Answers.UserDisplayName: Aray Karjauv
Answers.Body: <p>If I understand your requirement correctly, you're looking to tally the occurrences of each class in an image. I would suggest considering a detection approach as it might provide a more effective solution. Segmentation assigns labels to individual pixels, and in the presence of obstructions, it can be challenging to determine whether clusters of pixels belong to the same object or represent distinct instances of the same class.</p>
  <p>Opting for a detection method offers additional advantages in your scenario. Since you lack a labeled dataset, the labeling process becomes more efficient with bounding box annotations compared to pixel-wise classification. Additionally, detection allows for accommodating obstructions by creating larger bounding boxes for obstructed objects.</p>
  <p>I hope this perspective is helpful for your use case.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-11T18:53:13.087Z
Answers.Text: Can you please demonstrate how to label the red object? https://s20.directupload.net/images/240111/mivn9jno.png - for segmentation I would create a polygon follwing my red 'drawing'. for detection I would create a rectangle. but then the other object will be inside my label-rectangle
Answers.UserDisplayName: Ef Ge
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-11T15:59:12.870Z
Answers.LastActivityDate: 2024-01-11T15:59:12.870Z
Answers.UserDisplayName: David Santiago Morales Norato
Body: <p>I have a problem and have to decide wether it's an object detection or object segmentation problem. I want to use Yolov8 for training. We already have hundrets of images but they aren't labeled yet. So before we start labeling we have to clearfy what we want. Maybe you can help me. I will provide the facts:</p>
  <ul>
  <li>8 classes of objects</li>
  <li>every class occurs 0 to n times per image</li>
  <li>objects can be partially hidden by other classes or random objects (sometimes only 10% are visible)</li>
  <li>if they are partially hidden, the visible part is contiguos, so no object is splitted apart</li>
  <li>the objects are stacked, so they will touch each other (maybe it's a stack of objects of the same class)</li>
  </ul>
  <p>As the result I want to know how often the classes occurs on the image. Like class1: 0 times, class2: 3 times, class3: 1 time, ....</p>
  <p>At first it sounds like a detection problem. But since the objects are stacked and yolov8 uses rectangles for training, 90% of the labels will contain (small) parts of other classes - or only very small fractions of the classes can be labeled. If using augmentation like rotation, it will be not possible to avoid class-mixtures in labeling.</p>
  <p>What does it sounds like? Segmentation or detection. Are there pros/cons?
  I lean towards segmentation.</p>
  <p>And:
  Does it make a big change for yolo if I use segmentation instead detection? I know, the pixels were classified but has the labeling process to be different?
  Thanks in advance</p>
  
Tags: <comparison><object-detection><image-segmentation><yolo>
Title: Should I define my problem as image segmentation or detection?
UserDisplayName: Ef Ge
ThreadText: # Should I define my problem as image segmentation or detection?
  
  (Asked by: username_0 on 2024-01-11)
  
  I have a problem and have to decide wether it's an object detection or object segmentation problem. I want to use Yolov8 for training. We already have hundrets of images but they aren't labeled yet. So before we start labeling we have to clearfy what we want. Maybe you can help me. I will provide the facts:
  
  * 8 classes of objects
  * every class occurs 0 to n times per image
  * objects can be partially hidden by other classes or random objects (sometimes only 10% are visible)
  * if they are partially hidden, the visible part is contiguos, so no object is splitted apart
  * the objects are stacked, so they will touch each other (maybe it's a stack of objects of the same class)
  
  As the result I want to know how often the classes occurs on the image. Like class1: 0 times, class2: 3 times, class3: 1 time, ....
  
  At first it sounds like a detection problem. But since the objects are stacked and yolov8 uses rectangles for training, 90% of the labels will contain (small) parts of other classes - or only very small fractions of the classes can be labeled. If using augmentation like rotation, it will be not possible to avoid class-mixtures in labeling.
  
  What does it sounds like? Segmentation or detection. Are there pros/cons?
  I lean towards segmentation.
  
  And:
  Does it make a big change for yolo if I use segmentation instead detection? I know, the pixels were classified but has the labeling process to be different?
  Thanks in advance
  
  **Tags:** comparison, object-detection, image-segmentation, yolo
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-01-11. Score: 1
  
  The scenario you're describing seems to initially suggest an object detection approach. However, given the complexity of objects being stacked and the necessity to count individual instances accurately, object detection alone, even with a robust model like YOLOv8, may not deliver the level of precision you need.
  
  For greater accuracy, particularly where objects are partially obscured or in contact with one another, instance segmentation could be the more appropriate technique. Although it is more computationally intensive, instance segmentation models can provide the pixel-level detail required for precise identification and counting of object instances in challenging scenarios.
  
  [![enter image description here](https://i.sstatic.net/nWV7p.png)](https://i.sstatic.net/nWV7p.png)
  ([source](https://nirmalamurali.medium.com/image-classification-vs-semantic-segmentation-vs-instance-segmentation-625c33a08d50))
  
  
  ---
  
  ### Answer by username_2 on 2024-01-11. Score: 0
  
  If I understand your requirement correctly, you're looking to tally the occurrences of each class in an image. I would suggest considering a detection approach as it might provide a more effective solution. Segmentation assigns labels to individual pixels, and in the presence of obstructions, it can be challenging to determine whether clusters of pixels belong to the same object or represent distinct instances of the same class.
  
  Opting for a detection method offers additional advantages in your scenario. Since you lack a labeled dataset, the labeling process becomes more efficient with bounding box annotations compared to pixel-wise classification. Additionally, detection allows for accommodating obstructions by creating larger bounding boxes for obstructed objects.
  
  I hope this perspective is helpful for your use case.
  
  > **Comments:**
  > **username_0**: Can you please demonstrate how to label the red object? https://s20.directupload.net/images/240111/mivn9jno.png - for segmentation I would create a polygon follwing my red 'drawing'. for detection I would create a rectangle. but then the other object will be inside my label-rectangle  
  
  ---
  
  