idiap / attention-sampling

This Python package enables the training and inference of deep learning models for very large data, such as megapixel images, using attention-sampling
Other
98 stars 18 forks source link

MNIST noise overlaps signal #19

Open benjaminbergner opened 3 years ago

benjaminbergner commented 3 years ago

Hi,

when I create a dataset with make_mnist.py and size 500x500, I figured that noise is sometimes overlapping numbers.

image

This can be resolved by changing the order of signal/noise insertion, e.g. the high-dimensional image:

def high(self):
  ...
  if self._dataset._should_add_noise:
    for p, i in self.noise_positions_and_patterns:
        high[self._get_slice(p)] = \
            255*self._dataset._noise[i]

  for p, i in zip(self._positions, self._idxs):
      high[self._get_slice(p)] = \
          255*self._dataset._images[i]

instead of

def high(self):
  ...             
  for p, i in zip(self._positions, self._idxs):
      high[self._get_slice(p)] = \
          255*self._dataset._images[I]

  if self._dataset._should_add_noise:
    for p, i in self.noise_positions_and_patterns:
        high[self._get_slice(p)] = \
            255*self._dataset._noise[i]

Let me know in case I missed something.