def test_CaffePostprocessing(pixel, caffe_mean, caffe_std): processing = enc.CaffePostprocessing() expected = pixel input = pixel.sub(caffe_mean).div(caffe_std).mul(255).flip(1) actual = processing(input) ptu.assert_allclose(actual, expected, rtol=1e-6)
def postprocessor(impl_params: bool = True) -> nn.Module: r"""Postprocessor from :cite:`JAL2016`. Args: impl_params: If ``True``, the input is postprocessed from models trained with the Caffe framework. If ``False``, the postprocessor performs the identity operation. .. seealso:: - :class:`pystiche.enc.CaffePostprocessing` """ # https://github.com/pmeier/fast-neural-style/blob/813c83441953ead2adb3f65f4cc2d5599d735fa7/fast_neural_style/preprocess.lua#L66-L71 # https://github.com/pmeier/fast-neural-style/blob/813c83441953ead2adb3f65f4cc2d5599d735fa7/fast_neural_style.lua#L89 return enc.CaffePostprocessing() if impl_params else Identity()
def postprocessor() -> nn.Module: return enc.CaffePostprocessing()
def postprocessor() -> enc.CaffePostprocessing: r"""Postprocessor from :cite:`LW2016`.""" return enc.CaffePostprocessing()
def postprocessor() -> enc.CaffePostprocessing: return enc.CaffePostprocessing()