pytorch-coviar icon indicating copy to clipboard operation
pytorch-coviar copied to clipboard

Question about pre-processing mv and res

Open gbyy422990 opened this issue 6 years ago • 2 comments

Hi man, thanks for ur good work, but i have some questions about mv and res normalization, could u pls explain in more detail about the code below?

      img = clip_and_scale(img, 20)                            Why u use size=20?
      img += 128
      img = (np.minimum(np.maximum(img, 0), 255)).astype(np.uint8)
elif self._representation == 'residual':
      img += 128
      img = (np.minimum(np.maximum(img, 0), 255)).astype(np.uint8)       
if self._representation == 'iframe':
     input = (input - self._input_mean) / self._input_std
elif self._representation == 'residual':
    input = (input - 0.5) / self._input_std           why 0.5?
elif self._representation == 'mv':
     input = (input - 0.5)

gbyy422990 avatar Feb 20 '19 07:02 gbyy422990

Yes, this is to normalize the input range to match that of the pre-trained model.

The "clip" part is to make sure that the range of MV doesn't go too big (within 20 pixels). This follows prior work (e.g. https://github.com/zbwglory/MV-release/tree/master/MV_extract/MV-code-release), and I think this usually helps training.

Subtracting 0.5 is to make the input zero-mean. This again is just to make it match pre-training.

chaoyuaw avatar May 08 '19 22:05 chaoyuaw

how did you calculate self._input_mean and self._input_std? I want to do this for a different dataset now, so i need my own values.

ShristiDasBiswas avatar Mar 04 '24 18:03 ShristiDasBiswas