duckietown / gym-duckietown

Self-driving car simulator for the Duckietown universe
http://duckietown.org
Other
45 stars 16 forks source link

ImportError: cannot import name 'imresize' #162

Closed maivincent closed 5 years ago

maivincent commented 5 years ago

When running in gym-duckietown conda environment

python -m reinforcement.pytorch.train_reinforcement

I get this error:

 File "/home/vincent/gym-duckietown/learning/utils/wrappers.py", line 18, in observation
    from scipy.misc import imresize
ImportError: cannot import name 'imresize'

I looked a bit and it seems that imresize is deprecated in scipy as written here in Backwards incompatible changes: https://github.com/scipy/scipy/releases/tag/v1.3.0rc1

Could this be the source of the problem?

bhairavmehta95 commented 5 years ago

Yeah likely; let me see if there's a fix for this in the new ones.

bhairavmehta95 commented 5 years ago

image

Good catch.

maivincent commented 5 years ago

Fix did induce a new bug:

    return np.array(Image.fromarray(observation).resize(shape))
NameError: name 'shape' is not defined
maivincent commented 5 years ago

@bhairavmehta95 : return np.array(Image.fromarray(observation).resize([self.shape[0:1]])) should be the fix.

bhairavmehta95 commented 5 years ago

Wouldn't it be self.shape? The splice (means: from index 0 to 1 exclusive, so just 0) above would resize to a single dimension = square of shape[0] x shape[0]

maivincent commented 5 years ago

Woops, then it should be self.shape[0:2] sorry. It does not accept the 3 args of self.shape, as resize takes in only 2. I figured that shape being defined as shape=(120, 160, 3)), only 120 and 160 are needed.

bhairavmehta95 commented 5 years ago

do0o0o0pe thanks!