okankop / vidaug

Effective Video Augmentation Techniques for Training Convolutional Neural Networks
MIT License
387 stars 78 forks source link

RandomResize does not work with ndarray #22

Open zhaoyig opened 1 year ago

zhaoyig commented 1 year ago
\lib\site-packages\vidaug\augmentors\affine.py in __call__(self, clip)
     90         new_size = (new_h, new_w)
     91         if isinstance(clip[0], np.ndarray):
---> 92             return [scipy.misc.imresize(img, size=(new_h, new_w),interp=self.interpolation) for img in clip]
     93         elif isinstance(clip[0], PIL.Image.Image):
     94             return [img.resize(size=(new_w, new_h), resample=self._get_PIL_interp(self.interpolation)) for img in clip]

\site-packages\vidaug\augmentors\affine.py in <listcomp>(.0)
     90         new_size = (new_h, new_w)
     91         if isinstance(clip[0], np.ndarray):
---> 92             return [scipy.misc.imresize(img, size=(new_h, new_w),interp=self.interpolation) for img in clip]
     93         elif isinstance(clip[0], PIL.Image.Image):
     94             return [img.resize(size=(new_w, new_h), resample=self._get_PIL_interp(self.interpolation)) for img in clip]

AttributeError: module 'scipy.misc' has no attribute 'imresize'

When trying to use RandomResize it gives the above error. Seems to be caused by deprecated scipy API.

imresize is deprecated! imresize is deprecated in SciPy 1.0.0, and will be removed in 1.3.0. Use Pillow instead: numpy.array(Image.fromarray(arr).resize()).