araffin / learning-to-drive-in-5-minutes

Implementation of reinforcement learning approach to make a car learn to drive smoothly in minutes
https://towardsdatascience.com/learning-to-drive-smoothly-in-minutes-450a7cdb35f4
MIT License
287 stars 85 forks source link

DDPG, ValueError: cannot reshape array of size 1 into shape (1,52) [question] #10

Closed KangIH closed 4 years ago

KangIH commented 5 years ago

Hello I am trying to run on Real Donkeycar with DDPG. SAC was OK to run but when I tried with DDPG, there is something problem.

First of all, I ran with same hyperparams/ddpg.yml as yours, but there was an error as below. (VAE z-size=32) And then I tried different noise_type: ornstein-uhlenbeck --> adaptive-param, it worked but the donkey drove only 2 step and stop, repeat.

Do I have to modify something like input size? Plz help me. Thanks.


Traceback (most recent call last): File "train.py", line 214, in model.learn(n_timesteps, **kwargs) File "/home/pi/mycar_rl/learning-to-drive-in-5-minutes/algos/custom_ddpg.py", line 57, in learn action, q_value = self._policy(obs, apply_noise=True, compute_q=True) File "/usr/local/lib/python3.5/dist-packages/stable_baselines/ddpg/ddpg.py", line 569, in _policy obs = np.array(obs).reshape((-1,) + self.observation_space.shape) ValueError: cannot reshape array of size 1 into shape (1,52)

araffin commented 5 years ago

Hello, Please fill up the issue template.

I tried with the DDPG with a trained VAE and could not reproduce your issue.:

python train.py --algo ddpg -vae logs/vae-32.pkl -n 5000  --seed 1