deepsense-ai / carla-birdeye-view

Bird-eye's view for CARLA simulator
https://micmarty.github.io
MIT License
182 stars 25 forks source link

could not broadcast input array from shape #4

Closed arashroomi closed 4 years ago

arashroomi commented 4 years ago

I am using the library in my code to read the birdview array:

self.birdview_producer = BirdViewProducer( self.client, # carla.Client target_size=PixelDimensions(150, 336), pixels_per_meter=4, crop_type=BirdViewCropType.FRONT_AND_REAR_AREA )

and then I call it in a class: self.birdview = self.birdview_producer.produce(agent_vehicle=self.vehicle)

The code runs but outputs this error:

ValueError: could not broadcast input array from shape (3730,3993) into shape (368,368) ` File "blabla", line 154, in process_depth self.birdview = self.birdview_producer.produce(agent_vehicle=self.vehicle) File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 234, in produce masks = self._render_actors_masks(agent_vehicle, segregated_actors, masks) File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 274, in _render_actors_masks segregated_actors.vehicles ValueError: could not broadcast input array from shape (3730,3993) into shape (368,368)

self.birdview = self.birdview_producer.produce(agent_vehicle=self.vehicle) File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 234, in produce masks = self._render_actors_masks(agent_vehicle, segregated_actors, masks) File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 277, in _render_actors_masks segregated_actors.pedestrians ValueError: could not broadcast input array from shape (3730,3993) into shape (368,368)

File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 234, in produce masks = self._render_actors_masks(agent_vehicle, segregated_actors, masks) File "/usr/local/lib/python3.7/site-packages/carla_birdeye_view/init.py", line 274, in _render_actors_masks segregated_actors.vehicles ValueError: could not broadcast input array from shape (3730,3993) into shape (368,368) `

Seams somewhere in the code it cannot reduce the render size.

Operating system: Ubuntu 16.04, Carla 0.9.9

arashroomi commented 4 years ago

It was solved by calling the birdview_producer one time in the init to setup the pixel dimentations. If not, seems like it picks up different dimentions and this causes error.