I am learning deep learning with Pytorch and I have understood how to train a classification. Now I would like to learn the instance segmentation from scratch by training my own models (a simple model for understand the basics) to learn and understand all the steps.
I tried to find a tutorial that shows how to train step by step from scratch but I could not find it.
Can someone please show me how to train step by step an instance segmentation with custom datasets, or if you know a website that shows how to train step by step an instance segmentation.

The challenge is that instance segmentation is a rather difficult
problem. Instance segmentation has a number of logical steps to
it, and instance-segmentation models (at least as practiced) are
built out of a number of submodules – so such a model might not
meet your definition of “simple.”

The best I can recommend – and it’s definitely not completely from
scratch with all the steps – is this pytorch tutorial:

It uses pytorch’s prebuilt Mask R-CNN model. (There are other
instance-segmentation models but they all share similar complexity.)

Here is the original Mask R-CNN article. It will give you a sense of the
complexity and submodules involved.

You could certainly build an instance-segmentation model totally from
scratch, but it would be a lot of work. If you want to, I would suggest
that you work through the original Mask R-CNN paper and references
therein (or similar paper about some other model), building the
submodules one by one (from scratch) and then put them together.

But, even if you decide to do this from scratch, I would recommend
first working through the not-from-scratch pytorch tutorial to get an
overview of hos things work and how some of the pieces fit together.

First of all thanks a lot for your answer. I will try to see Mask R-CNN model.

However if I want to use Mask R-CNN model, can you please show me how to train the model because I could not understand how to train a model for instance segmentation in pytorch.

The tutorial can be rather terse in places, and I think that some of the
code might be a bit out of date with respect to the current pytorch. If
you decide to work through it, please feel free to post specific questions
about steps you’re having trouble with.

I read a lot about Mask R-CNN model and I’m starting to understand but I also did a little research on other models and the one that I can understand the most is:

PolarMask: Single Shot Instance Segmentation with Polar Representation

This model I have understood very well.

I have a question, can you please show me how to train this model with a simple program, because now I would like to understand how to train an instance segmentation. I know how to train a model for a classification or GAN but I don’t know how to train an instance segmentation.

Depending on the task, the conceptually simpler U-Nets might also work very well. Our book, which used to be available for download from the PyTorch website, uses it to find nodules in CT scans.
The disadvantage is that U-Nets don’t deal with overlap etc. and you need a connected component finding step to get the sites.