1515
1616from io import BytesIO
1717from collections import namedtuple
18+ import warnings
1819
1920# 3rd party
2021import numpy as np
@@ -173,6 +174,8 @@ def createResizeImageUDF(size):
173174 :param size: tuple, target size of new image in the form (height, width).
174175 :return: udf, a udf for resizing an image column to `size`.
175176 """
177+ warnings .warn ("createResizeImageUDF() will be removed in the next release of sparkdl. "
178+ "Please use Pandas UDF instead." , DeprecationWarning )
176179 if len (size ) != 2 :
177180 raise ValueError (
178181 "New image size should have format [height, width] but got {}" .format (size ))
@@ -212,6 +215,8 @@ def PIL_decode(raw_bytes):
212215 :param raw_bytes:
213216 :return: image data as an array in CV_8UC3 format
214217 """
218+ warnings .warn ("PIL_decode() will be removed in the next release of sparkdl. "
219+ "Please use pillow and Pandas UDF instead." , DeprecationWarning )
215220 return PIL_to_imageStruct (Image .open (BytesIO (raw_bytes )))
216221
217222
@@ -237,6 +242,8 @@ def readImagesWithCustomFn(path, decode_f, numPartition=None):
237242 :param numPartition: [optional] int, number or partitions to use for reading files.
238243 :return: DataFrame with schema == ImageSchema.imageSchema.
239244 """
245+ warnings .warn ("readImagesWithCustomFn() will be removed in the next release of sparkdl. "
246+ "Please use pillow and Pandas UDF instead." , DeprecationWarning )
240247 return _readImagesWithCustomFn (path , decode_f , numPartition , sc = SparkContext .getOrCreate ())
241248
242249
0 commit comments