Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
amgawishx opened this issue Jan 23, 2023 · 2 comments

Comments

@amgawishx
Copy link

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?

@Song-z-h
Copy link

same issue here

@amrgasser
Copy link

amrgasser commented Mar 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants