Answers.Body: <p>If your interest is positional information, encode it!</p>
  
  <p>This could include learning an embedding for each position and leveraging that in your model. You could also use an approach to hard-encode rather than learn it (kinda like adding sinusoids in the transformer paper <a href="https://arxiv.org/abs/1706.03762" rel="nofollow noreferrer">Attention is All You Need</a></p>
  
  <p>an example of a paper that encodes the 2D positional info: <a href="https://arxiv.org/pdf/1904.09925.pdf" rel="nofollow noreferrer">Attention Augmented Convolutional Networks</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-29T12:42:35.913Z
Answers.LastActivityDate: 2019-05-29T12:42:35.913Z
Answers.UserDisplayName: mshlis
Body: <p>There is this problem I have encountered, I was trying to classify the pixels from input image into classes, sort of like segmentation, using a encoder-decoder CNN. The “interested” pixels usually locate in the top right corner of the input image, but the input images are too big, which I have to slice them in patches, by doing this, each input patch loses its “which region of the whole picture it’s from” information.</p>
  
  <p>I'm using pytorch, I thought of manually add this patch location info into the input, but then it will be convoluted, which does make sense to me since it's not a part of an image.</p>
  
  <p>I'm new to this, not sure if I'm thinking the whole thing right, how should I manually add this info into the input correctly or if there is some keywords I can do some researches, in order to let the CNN taking position into account? Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-28T01:28:16.950Z
Comments.Text: Is your problem that the tiling scheme is losing positional information (where it is in the image) or losing contextual information (whats in the image that wasn't in the tile)?
Comments.UserDisplayName: mshlis
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-29T08:36:25.897Z
Comments.Text: @mshlis The first one, where it is in the image, sorry I didn't express it clearly.
Comments.UserDisplayName: kdlsw
Tags: <convolutional-neural-networks><autoencoders><pytorch><image-segmentation>
Title: How to add some data input in a CNN?
UserDisplayName: kdlsw
ThreadText: # How to add some data input in a CNN?
  
  (Asked by: username_0 on 2019-05-27)
  
  There is this problem I have encountered, I was trying to classify the pixels from input image into classes, sort of like segmentation, using a encoder-decoder CNN. The “interested” pixels usually locate in the top right corner of the input image, but the input images are too big, which I have to slice them in patches, by doing this, each input patch loses its “which region of the whole picture it’s from” information.
  
  I'm using pytorch, I thought of manually add this patch location info into the input, but then it will be convoluted, which does make sense to me since it's not a part of an image.
  
  I'm new to this, not sure if I'm thinking the whole thing right, how should I manually add this info into the input correctly or if there is some keywords I can do some researches, in order to let the CNN taking position into account? Thank you.
  
  **Tags:** convolutional-neural-networks, autoencoders, pytorch, image-segmentation
  
  > **Comments:**
  > **username_1**: Is your problem that the tiling scheme is losing positional information (where it is in the image) or losing contextual information (whats in the image that wasn't in the tile)?  
  > **username_0**: @username_1 The first one, where it is in the image, sorry I didn't express it clearly.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-05-29. Score: 1 | Accepted answer
  
  If your interest is positional information, encode it!
  
  This could include learning an embedding for each position and leveraging that in your model. You could also use an approach to hard-encode rather than learn it (kinda like adding sinusoids in the transformer paper [Attention is All You Need](https://arxiv.org/abs/1706.03762)
  
  an example of a paper that encodes the 2D positional info: [Attention Augmented Convolutional Networks](https://arxiv.org/pdf/1904.09925.pdf)
  
  
  ---
  
  