text stringlengths 1 93.6k |
|---|
The function should take one argument:
|
one image (Numpy tensor with rank 3),
|
and should output a Numpy tensor with the same shape.
|
data_format: 'channels_first' or 'channels_last'. In 'channels_first' mode, the channels dimension
|
(the depth) is at index 1, in 'channels_last' mode it is at index 3.
|
It defaults to the `image_data_format` value found in your
|
Keras config file at `~/.keras/keras.json`.
|
If you never set it, then it will be "channels_last".
|
"""
|
def __init__(self,
|
featurewise_center=False,
|
samplewise_center=False,
|
featurewise_std_normalization=False,
|
samplewise_std_normalization=False,
|
zca_whitening=False,
|
rotation_range=0.,
|
width_shift_range=0.,
|
height_shift_range=0.,
|
shear_range=0.,
|
zoom_range=0.,
|
channel_shift_range=0.,
|
fill_mode='nearest',
|
cval=0.,
|
horizontal_flip=False,
|
vertical_flip=False,
|
rescale=None,
|
preprocessing_function=None,
|
data_format=None):
|
if data_format is None:
|
data_format = K.image_data_format()
|
self.featurewise_center = featurewise_center
|
self.samplewise_center = samplewise_center
|
self.featurewise_std_normalization = featurewise_std_normalization
|
self.samplewise_std_normalization = samplewise_std_normalization
|
self.zca_whitening = zca_whitening
|
self.rotation_range = rotation_range
|
self.width_shift_range = width_shift_range
|
self.height_shift_range = height_shift_range
|
self.shear_range = shear_range
|
self.zoom_range = zoom_range
|
self.channel_shift_range = channel_shift_range
|
self.fill_mode = fill_mode
|
self.cval = cval
|
self.horizontal_flip = horizontal_flip
|
self.vertical_flip = vertical_flip
|
self.rescale = rescale
|
self.preprocessing_function = preprocessing_function
|
if data_format not in {'channels_last', 'channels_first'}:
|
raise ValueError('data_format should be "channels_last" (channel after row and '
|
'column) or "channels_first" (channel before row and column). '
|
'Received arg: ', data_format)
|
self.data_format = data_format
|
if data_format == 'channels_first':
|
self.channel_axis = 1
|
self.row_axis = 2
|
self.col_axis = 3
|
if data_format == 'channels_last':
|
self.channel_axis = 3
|
self.row_axis = 1
|
self.col_axis = 2
|
self.mean = None
|
self.std = None
|
self.principal_components = None
|
if np.isscalar(zoom_range):
|
self.zoom_range = [1 - zoom_range, 1 + zoom_range]
|
elif len(zoom_range) == 2:
|
self.zoom_range = [zoom_range[0], zoom_range[1]]
|
else:
|
raise ValueError('zoom_range should be a float or '
|
'a tuple or list of two floats. '
|
'Received arg: ', zoom_range)
|
def flow(self, x, y=None, batch_size=32, shuffle=True, seed=None,
|
save_to_dir=None, save_prefix='', save_format='jpeg'):
|
return NumpyArrayIterator(
|
x, y, self,
|
batch_size=batch_size,
|
shuffle=shuffle,
|
seed=seed,
|
data_format=self.data_format,
|
save_to_dir=save_to_dir,
|
save_prefix=save_prefix,
|
save_format=save_format)
|
def flow_from_directory(self, directory,
|
target_size=(256, 256), color_mode='rgb',
|
classes=None, class_mode='categorical',
|
batch_size=32, shuffle=True, seed=None,
|
save_to_dir=None,
|
save_prefix='',
|
save_format='jpeg',
|
follow_links=False,
|
file_name_to_y=None,
|
output_function=None,
|
):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.