0

So I am stuck on how can I fix the import error for imresize. I installed all the things I needed like installing Pillow but I haven't been able to find a solution. Also the code that I trying to run is from this github link https://github.com/CSAILVision/IBD Also side note I do not own this code nor was not the original arthor of it. This is for a research project that I am apart of. In addition I try asked the original arthor with a fix but haven't heard back from them at all.

Installing Pillow, Replacing with code: from scipy.misc.pilutil import imread, installing Pillow-3.3.1-cp27-cp27m-win32.whl, Unninstall Pil and installing Pillow, Reinstalling Pillow.

from util.image_operation import *
from PIL import Image
import numpy as np
from imageio import imresize, imread
from visualize.plot import random_color
from torch.autograd import Variable as V
import torch

I expect it to run but print out the image but it doesn't.

Traceback (most recent call last):


     File "test.py", line 4, in <module>
        from loader.model_loader import loadmodel

      File "/home/joshuayun/Desktop/IBD/loader/model_loader.py", line 5, in <module>


     from util.feature_operation import hook_feature, hook_grad
      File "/home/joshuayun/Desktop/IBD/util/feature_operation.py", line 6, in <module>
        from imageio import imresize, imread, imsave
    ImportError: cannot import name 'imresize'
alift
  • 1,855
  • 2
  • 13
  • 28
Joshua
  • 717
  • 1
  • 6
  • 7
  • 1
    [https://stackoverflow.com/questions/56260998/how-to-fix-cannot-import-name-imresize-error-while-this-function-importing-fr](https://stackoverflow.com/questions/56260998/how-to-fix-cannot-import-name-imresize-error-while-this-function-importing-fr) – Cooper May 29 '19 at 19:29
  • Hey Cooper, I was wondering how would I fix the imread function because now I am getting error for the imread? – Joshua May 29 '19 at 20:07
  • Why not using: `from skimage.transform import resize` Are you bound to imageio? – Eskapp May 29 '19 at 22:43

3 Answers3

0

If you want to work with the code as is, i would recommend creating a new environment, and installing an old version of scipy (0.19.1 should do the trick). In your new environment, assuming you are using conda, do:

conda install scipy==0.19.1

If you use pip instead:

pip install scipy==0.19.1
Juan Carlos Ramirez
  • 2,054
  • 1
  • 7
  • 22
0

Since scipy 1.3.0rc1 resize has been removed.

Phoenix666
  • 183
  • 1
  • 14
0

I had the same problem, I had scipy 1.4. I did the following and it worked -

pip install scipy==1.1.0
Malgo
  • 1,871
  • 1
  • 17
  • 30