Unity ml-agents - Ray Perception Sensor not registering observations

Viewed 1508

I have a car set up with raycasts using the ray perception sensor to detect 3 tags. For some reason, I am getting the warning in unity: Fewer observations (0) made than vector observation size (45).

I think because there are no observations, it is not learning. Why does this have 0 observations? I thought the Ray Perception Sensor automatically collected observations and passed them to the behavior parameters?

Here is a screenshot of the scripts:

Ray Perception Sensor:

Text

Behaviour Parameters:

Text

2 Answers

This problem will cause another problem; when using the trained model for testing you probably will get this error: Unknown tensorProxy expected as input : obs_0.

According to this link

The solution is using max_steps = 0. can't believe it was causing the problem in agent observation!

maybe They will fix this bug in later versions of mlagents.

I'm relatively new to ML-Agents myself, but I think the problem lies within your Behaviour Parameters component.

Under Vector Observation, Space Size defines the number of observations that you feed directly to the agent via the code, within the CollectObservations function. You have set this to 45, and i'm assuming you're not providing providing 45 values in CollectObservations. Setting space size to 0 should solve this issue.

As for the raycasts, make sure you set the Ray Layer Masks correctly. This had me confused for a while.

Related