Depends on the model you’re using. For example if you implement the original UNET from the paper it clearly defines the dimensions for images and masks

I tried out UNET a while back where i implemented the model from the paper and used it in binary segmentation task.  (Have a look at the input and output dimensions)
I haven’t done anything complex in my training and the code is pretty straightforward:

Binary segmentation use case

  
      

      GitHub
  

  
    

GitHub - aryaman4152/Satellite-images-semantic-segmentation: Satellite... 2

  Satellite segmentation of satellite images to extract roads. - GitHub - aryaman4152/Satellite-images-semantic-segmentation: Satellite segmentation of satellite images to extract roads.


  

  
    
    
  

  



UNET in pytorch

  
      

      github.com
  

  
    model-implementations-PyTorch/UNET at main ·... 3

  main/UNET

  A collection of pytorch implementations of different models - model-implementations-PyTorch/UNET at main · aryaman4152/model-implementations-PyTorch

  

  
    
    
  

  


Hopefully this helps