运行general_IRL时报错
githubkx opened this issue · 2 comments
您好,很感谢您的文章与代码的分享。
当我运行 python general_IRL.py
文件时,会出现以下错误:
Target Vehicle: 2617
Loading Data...
Timestep: 75
Timestep: 65
Timestep: 110
Timestep: 73
Timestep: 36
Timestep: 10
Timestep: 57
Timestep: 99
Timestep: 131
Timestep: 88
Traceback (most recent call last):
File "G:/GitHub/Driving_IRL_NGSIM/general_IRL.py", line 94, in <module>
max_v = np.max([traj[2] for traj in buffer_scene for buffer_scene in buffer], axis=0)
File "<__array_function__ internals>", line 6, in amax
File "C:\Users\Administrator\Anaconda3\envs\IRL\lib\site-packages\numpy\core\fromnumeric.py", line 2755, in amax
keepdims=keepdims, initial=initial, where=where)
File "C:\Users\Administrator\Anaconda3\envs\IRL\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity
Process finished with exit code 1
在我debug时,发现代码第79行 if terminated or features[-1] > 2.5: continue
,所有的features[-1]
值均在140左右,导致buffer恒为[],因此无法得到max_v的值造成错误。请问您知道是什么原因引起的吗,另外运行personal_IRL.py
也会造成这种错误。
期待您的解答,谢谢。
Hello, thank you for sharing your article and code.
When I run python general_IRL.py
file, the following error occurs:
Target Vehicle: 2617
Loading Data...
Timestep: 75
Timestep: 65
Timestep: 110
Timestep: 73
Timestep: 36
Timestep: 10
Timestep: 57
Timestep: 99
Timestep: 131
Timestep: 88
Traceback (most recent call last):
File "G:/GitHub/Driving_IRL_NGSIM/general_IRL.py", line 94, in <module>
max_v = np.max([traj[2] for traj in buffer_scene for buffer_scene in buffer], axis=0)
File "<__array_function__ internals>", line 6, in amax
File "C:\Users\Administrator\Anaconda3\envs\IRL\lib\site-packages\numpy\core\fromnumeric.py", line 2755, in amax
keepdims=keepdims, initial=initial, where=where)
File "C:\Users\Administrator\Anaconda3\envs\IRL\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity
Process finished with exit code 1
When I debug, I find that in line 79 of the code, if terminated or features [- 1] > 2.5: continue
, the values of all features[-1]
are about 140, resulting in a constant buffer= [], so max_v cannot be obtained. Do you know what caused it? Run personal_ IRL. py
can also cause this error.
Looking forward to your answer, thank you.
Hello, thanks for your question. For some rare circumstances, due to the noise in the dataset, a target vehicle could be invalid because it could collide with others at the initial state. So I would like to suggest changing the vehicle_id
under such circumstances. But I am not sure why the values of features[-1]
are about 140 as I am unable to reproduce this mistake, mostly under 2.5. You may want to render the environment to see what might go wrong.
Thank you for your answer. I have corrected the error,which is caused by data processing.