One simple way is using FiLM (Feature-wise layer modulation)

  
      arxiv.org
  
  
    
1709.07871.pdf 2

6.12 MB

  
  
    
    
  
  


Sooo if you are using a U-Net this has already been done for audio
Here you have code.https://github.com/gabolsgabs/cunet 1
This way you can simply condition inner layers of U-Net with a one-hot vector (or any tensor if you have some spatial info)
Anyway you have the new visual transformers, they just encode the position of the image patches before feeding them into the nn.
You can try and approach like this too.

  
      
      Who is Nnamdi? – 4 Oct 20
  
  
    

(Paper Explained) An Image is Worth 16x16 Words: Transformers for Image... 2

Large Transformer trained on large datasets outperform CNN-based architectures and achieve state of the art results on image recognition tasks