src/data.py
def crappfier(factor, noise=True):
    """A simple function to get a bilinear resizer with given factor"""

    # Do nothing if we're not crappifying
    if factor == 1.0:
        return lambda x: x

    def crappify_img(npimg):
        npimg = imresize(
            imresize(npimg, factor, interp="bilinear"), 1 / factor, interp="bilinear"
        )
        if noise:
            npimg = random_noise(npimg)
        else:
            # convert to float
            npimg = npimg / 255.0

        return npimg

    return lambda x: batch_apply(crappify_img, x)
A simple function to get a bilinear resizer with given factor
A simple function to get a bilinear resizer with given factor
A simple function to get a bilinear resizer with given factor
def crappfier(factor, noise=True):
    if factor == 1.0:
        return lambda x: x
    def crappify_img(npimg):
        npimg = imresize(
            imresize(npimg, factor, interp="bilinear"), 1 / factor, interp="bilinear"
        )
        if noise:
            npimg = random_noise(npimg)
        else:
            npimg = npimg / 255.0
        return npimg
    return lambda x: batch_apply(crappify_img, x)
def crappfier ( factor , noise = True ) : if factor == 1.0 : return lambda x : x def crappify_img ( npimg ) : npimg = imresize ( imresize ( npimg , factor , interp = "bilinear" ) , 1 / factor , interp = "bilinear" ) if noise : npimg = random_noise ( npimg ) else : npimg = npimg / 255.0 return npimg return lambda x : batch_apply ( crappify_img , x )
A simple function to get a bilinear resizer with given factor
A simple function to get a bilinear resizer with given factor
"""A simple function to get a bilinear resizer with given factor""" # Do nothing if we're not crappifying # convert to float
factor
noise