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

Commit dad4ade

Browse files
changed the flow from directory interface to expose resizing function
1 parent 7887114 commit dad4ade

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

keras_preprocessing/image/image_data_generator.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ def flow_from_directory(self,
447447
save_format='png',
448448
follow_links=False,
449449
subset=None,
450-
interpolation='nearest'):
450+
interpolation='nearest',
451+
resizing_function=None):
451452
"""Takes the path to a directory & generates batches of augmented data.
452453
453454
# Arguments
@@ -515,6 +516,11 @@ class subdirectories (default: False).
515516
supported. If PIL version 3.4.0 or newer is installed,
516517
`"box"` and `"hamming"` are also supported.
517518
By default, `"nearest"` is used.
519+
resizing_function: function, used to resize the loaded images to the
520+
target size. this will overrule interpolation. If None, then
521+
interpolation will happen. The input is an image in the specified
522+
data format, and the output has to be an image in the specified
523+
data format with the target size.
518524
519525
# Returns
520526
A `DirectoryIterator` yielding tuples of `(x, y)`
@@ -539,7 +545,8 @@ class subdirectories (default: False).
539545
follow_links=follow_links,
540546
subset=subset,
541547
interpolation=interpolation,
542-
dtype=self.dtype
548+
dtype=self.dtype,
549+
resizing_function=resizing_function
543550
)
544551

545552
def flow_from_dataframe(self,

0 commit comments

Comments
 (0)