As I struggle to find any literature online about this, I wanted to create a discussion that other would be able to learn from.

My question is inspired from a Yolo GitHub issue.

In this example we have 2 objects, here a plate and an egg, with one object being inside the other one.

enter image description here

The question is how to annotate the plate (aka the outer object).

  1. Annotate full contour of outer object. Some pixels belong to 2 classes.
  2. Make a little bridge to the inner object so that the contour of the outer object excludes the inner object.

This question arose while using Yolo but can be extended to other instance segmentation models.

Any more information regarding good practices in instance segmentation is more than welcome.


1 Answer 1


I recommend the first option: "Annotate the full contour of the outer object. Some pixels belong to 2 classes." This option is easier to implement and better matches the human intuitive world model.

How to do it

I don't know what software implements this, but something I did in the 90s for this problem was to have one grayscale image per object being annotated. The pixel's intensity is the posterior probability of the pixel belonging to that object.

You can make each object's probabilities a frame with modern animation formats (APNG, lossless WebP). Other image formats allow multiple layers (for example, PAM with DEPTH=#layers and MAXVAL=# values in a pixel in a layer). And you can use 1-bit layers if you have binary rather than probabilistic classification.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .