introtodeeplearning icon indicating copy to clipboard operation
introtodeeplearning copied to clipboard

IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

Open amgawishx opened this issue 2 years ago • 2 comments

In Lab 3 the RL_Solution for autonomous driving, always when I get to this part of the notebook:

## Render and inspect a human trace ##

vista_reset()
stream = VideoStream()

for i in tqdm(range(100)):
    vista_step()
    
    # Render and save the display
    vis_img = display.render()
    stream.write(vis_img[:, :, ::-1], index=i)
    if car.done: 
        break

print("Saving trajectory of human following...")
stream.save("human_follow.mp4")      
mdl.lab3.play_video("human_follow.mp4")

I got the following error stack:

/usr/local/lib/python3.8/dist-packages/ffio/ffio.py:78: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
  self.image =  np.fromstring(raw_image, dtype='uint8')
/usr/local/lib/python3.8/dist-packages/OpenGL/images.py:137: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  return data.tostring()
  0%|          | 0/100 [00:00<?, ?it/s]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[<ipython-input-22-221ad19af3ff>](https://localhost:8080/#) in <module>
      8 
      9     # Render and save the display
---> 10     vis_img = display.render()
     11     stream.write(vis_img[:, :, ::-1], index=i)
     12     if car.done:

3 frames
[/usr/local/lib/python3.8/dist-packages/descartes/patch.py](https://localhost:8080/#) in <listcomp>(.0)
     61 
     62     vertices = concatenate([
---> 63         concatenate([asarray(t.exterior)[:, :2]] +
     64                     [asarray(r)[:, :2] for r in t.interiors])
     65         for t in polygon])

IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed

Any idea why?

amgawishx avatar Jan 23 '23 09:01 amgawishx

same issue here

Song-z-h avatar Mar 22 '23 10:03 Song-z-h

It is a problem with the descartes package that was last updated i think in 2017

run the following two commands pip uninstall shapely pip install shapely==1.8.5

amrgasser avatar Mar 24 '23 09:03 amrgasser