Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Change default fill_mode from nearest to constant #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions keras_preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@


def random_rotation(x, rg, row_axis=1, col_axis=2, channel_axis=0,
fill_mode='nearest', cval=0.):
fill_mode='constant', cval=0.):
"""Performs a random rotation of a Numpy image tensor.

# Arguments
Expand All @@ -68,7 +68,7 @@ def random_rotation(x, rg, row_axis=1, col_axis=2, channel_axis=0,


def random_shift(x, wrg, hrg, row_axis=1, col_axis=2, channel_axis=0,
fill_mode='nearest', cval=0.):
fill_mode='constant', cval=0.):
"""Performs a random spatial shift of a Numpy image tensor.

# Arguments
Expand Down Expand Up @@ -96,7 +96,7 @@ def random_shift(x, wrg, hrg, row_axis=1, col_axis=2, channel_axis=0,


def random_shear(x, intensity, row_axis=1, col_axis=2, channel_axis=0,
fill_mode='nearest', cval=0.):
fill_mode='constant', cval=0.):
"""Performs a random spatial shear of a Numpy image tensor.

# Arguments
Expand All @@ -121,7 +121,7 @@ def random_shear(x, intensity, row_axis=1, col_axis=2, channel_axis=0,


def random_zoom(x, zoom_range, row_axis=1, col_axis=2, channel_axis=0,
fill_mode='nearest', cval=0.):
fill_mode='constant', cval=0.):
"""Performs a random spatial zoom of a Numpy image tensor.

# Arguments
Expand Down Expand Up @@ -249,7 +249,7 @@ def transform_matrix_offset_center(matrix, x, y):

def apply_affine_transform(x, theta=0, tx=0, ty=0, shear=0, zx=1, zy=1,
row_axis=0, col_axis=1, channel_axis=2,
fill_mode='nearest', cval=0.):
fill_mode='constant', cval=0.):
"""Applies an affine transformation specified by the parameters given.

# Arguments
Expand Down Expand Up @@ -537,7 +537,7 @@ class ImageDataGenerator(object):
If a float, `[lower, upper] = [1-zoom_range, 1+zoom_range]`.
channel_shift_range: Float. Range for random channel shifts.
fill_mode: One of {"constant", "nearest", "reflect" or "wrap"}.
Default is 'nearest'.
Default is 'constant'.
Points outside the boundaries of the input are filled
according to the given mode:
- 'constant': kkkkkkkk|abcd|kkkkkkkk (cval=k)
Expand Down Expand Up @@ -689,7 +689,7 @@ def __init__(self,
shear_range=0.,
zoom_range=0.,
channel_shift_range=0.,
fill_mode='nearest',
fill_mode='constant',
cval=0.,
horizontal_flip=False,
vertical_flip=False,
Expand Down