コード例 #1
0
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)
コード例 #2
0
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()
コード例 #3
0
def postprocessor() -> nn.Module:
    return enc.CaffePostprocessing()
コード例 #4
0
def postprocessor() -> enc.CaffePostprocessing:
    r"""Postprocessor from :cite:`LW2016`."""
    return enc.CaffePostprocessing()
コード例 #5
0
def postprocessor() -> enc.CaffePostprocessing:
    return enc.CaffePostprocessing()