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

Commit adb7bcf

Browse files
changed the flow from directory interface to expose resizing function
1 parent a04b86e commit adb7bcf

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
@@ -446,7 +446,8 @@ def flow_from_directory(self,
446446
save_format='png',
447447
follow_links=False,
448448
subset=None,
449-
interpolation='nearest'):
449+
interpolation='nearest',
450+
resizing_function=None):
450451
"""Takes the path to a directory & generates batches of augmented data.
451452
452453
# Arguments
@@ -514,6 +515,11 @@ class subdirectories (default: False).
514515
supported. If PIL version 3.4.0 or newer is installed,
515516
`"box"` and `"hamming"` are also supported.
516517
By default, `"nearest"` is used.
518+
resizing_function: function, used to resize the loaded images to the
519+
target size. this will overrule interpolation. If None, then
520+
interpolation will happen. The input is an image in the specified
521+
data format, and the output has to be an image in the specified
522+
data format with the target size.
517523
518524
# Returns
519525
A `DirectoryIterator` yielding tuples of `(x, y)`
@@ -537,7 +543,8 @@ class subdirectories (default: False).
537543
save_format=save_format,
538544
follow_links=follow_links,
539545
subset=subset,
540-
interpolation=interpolation
546+
interpolation=interpolation,
547+
resizing_function=resizing_function
541548
)
542549

543550
def flow_from_dataframe(self,

0 commit comments

Comments
 (0)