Skip to content

There is something wrong with \AirSim\PythonClient\car\DQNcar.py #1710

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

Closed
CaoYongshengcys opened this issue Jan 15, 2019 · 9 comments
Closed
Labels

Comments

@CaoYongshengcys
Copy link

My error is as follows, anyone can help me ?

(base) D:\Unreal Projects\AirSim\PythonClient\car>python DQNcar.py
Connected!
Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

Selected CPU as the process wide default device.
Traceback (most recent call last):
File "DQNcar.py", line 536, in
current_state = transform_input(responses)
File "DQNcar.py", line 434, in transform_input
img2d = np.reshape(img1d, (responses[0].height, responses[0].width))
File "D:\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 257, in reshape
return _wrapfunc(a, 'reshape', newshape, order=order)
File "D:\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 52, in _wrapfunc
return getattr(obj, method)(*args, **kwds)
ValueError: cannot reshape array of size 1 into shape (0,0)

@srivatsankrishnan
Copy link

srivatsankrishnan commented Jan 17, 2019

I am also running into the same issue but with my own code. Also it happens pretty randomly.
My stack trace is same as soon as it hits numpy call:

img2d = np.reshape(img1d, (responses[0].height, responses[0].width))
  File "/home/wxxx/.local/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 279, in reshape
    return _wrapfunc(a, 'reshape', newshape, order=order)
  File "/home/wxxx/.local/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 51, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
ValueError: cannot reshape array of size 1 into shape (0,0)

@srivatsankrishnan
Copy link

I think its a bug in Airsim client.simGetImages API. The issue is the responses[0].height and responses[0].width returns 0. So the numpy reshape errors out once it encounters that.

The workaround I have is to check for the condition where the responses[0].width and responses[0].height is "0" and once that condition occurs, I pass dummy image ( all 1's) and then reset airsim so it doesn't crash simulation.

@CaoYongshengcys
Copy link
Author

I will have a try, thanks

@Ahmad5112
Copy link

@CaoYongshengcys did you resolve the issue? If so how did you resolved

@CaoYongshengcys
Copy link
Author

@CaoYongshengcys did you resolve the issue? If so how did you resolved

I did not solve this problem

@annisanazi
Copy link

did anyone resolve this issue?

@TomAvrech
Copy link

Getting the same problem :(

@zimmy87
Copy link
Contributor

zimmy87 commented Jan 7, 2021

possibly related to #1009

@zimmy87
Copy link
Contributor

zimmy87 commented Jan 15, 2021

Hi, thank you for reporting this issue. This script was recently removed in #3215 and replaced with a new script at \AirSim\PythonClient\reinforcement_learning\dqn_car.py that uses the new OpenAI gym wrapper. I tested the new script locally and it runs for me. Can you retest with the new script and report back if you see any issues?

@zimmy87 zimmy87 closed this as completed Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants