def resize_all(output_shape):
    resizer_1 = ds.resize(u.mul_shape(output_shape, 4))
    resizer_2 = ds.resize(u.mul_shape(output_shape, 2))
    resizer_3 = ds.resize(output_shape)

    def f(x):
        x = resizer_1(x)
        y = resizer_2(x)
        z = resizer_3(y)
        return x, y, z

    return f
def resize_all(output_shape):
    resizer_0 = ds.resize(u.mul_shape(output_shape, 16))
    resizer_1 = ds.resize(u.mul_shape(output_shape, 8))
    resizer_2 = ds.resize(u.mul_shape(output_shape, 4))
    resizer_3 = ds.resize(u.mul_shape(output_shape, 2))
    resizer_4 = ds.resize(output_shape)

    def f(x):
        w = resizer_0(x)
        x = resizer_1(x)
        y = resizer_2(x)
        z = resizer_3(y)
        v = resizer_4(x)

        return w, x, y, z, v

    return f
def prepare(dataset, input_shape, output_shape):
    resizer = ds.resize(u.mul_shape(output_shape, 32))

    stream = ds.epochs(dataset.image_ids, epochs=1)
    stream = ds.stream(
        lambda x: (dataset._img_filenames[x], resizer(dataset.load_image(x))),
        stream)

    return stream
def resize_all(output_shape):
    resizer_orig = ds.resize(u.mul_shape(output_shape, 32))
    resizer_0 = ds.resize(u.mul_shape(output_shape, 16))
    resizer_1 = ds.resize(u.mul_shape(output_shape, 8))
    resizer_2 = ds.resize(u.mul_shape(output_shape, 4))
    resizer_3 = ds.resize(u.mul_shape(output_shape, 2))
    resizer_4 = ds.resize(output_shape)

    def f(input_):
        input_ = resizer_orig(input_)
        w = resizer_0(input_)
        x = resizer_1(w)
        y = resizer_2(x)
        z = resizer_3(y)
        v = resizer_4(z)

        return input_, w, x, y, z, v

    return f
Example #5
0
def resize_all(dataset, output_shape):
    out_shape_1 = u.mul_shape(output_shape, 4)
    resizer_1 = ds.resize(out_shape_1)
    resizer_2 = ds.resize(u.mul_shape(output_shape, 2))
    resizer_3 = ds.resize(output_shape)

    def f((image_id, img)):
        cat = dataset.to_categorical(image_id)
        result = np.zeros(out_shape_1 + [cat.shape[2]])
        for i in range(0, cat.shape[2]):
            result[:, :, i] = resizer_1(cat[:, :, i])
        x = resizer_1(img)
        y = resizer_2(x)
        z = resizer_3(y)

        x = x.reshape(x.shape + (1, ))
        y = y.reshape(y.shape + (1, ))
        z = z.reshape(z.shape + (1, ))
        return result, x, y, z

    return f