in ludwig/utils/image_utils.py [0:0]
def resize_image(img, new_size_typle, resize_method):
try:
from skimage import img_as_ubyte
from skimage.transform import resize
except ImportError:
logger.error(
' scikit-image is not installed. '
'In order to install all image feature dependencies run '
'pip install ludwig[image]'
)
sys.exit(-1)
if tuple(img.shape[:2]) != new_size_typle:
if resize_method == CROP_OR_PAD:
return crop_or_pad(img, new_size_typle)
elif resize_method == INTERPOLATE:
return img_as_ubyte(resize(img, new_size_typle))
raise ValueError(
'Invalid image resize method: {}'.format(resize_method))
return img