UnityObservationException: observation did not have the expected shape error

Hi there!

I’m new to Unity-ML and got some error while working with visual observation. I followed the instruction in the Unity ML-Agent toolkit documentation (link), but I got the following error message.
mlagents_envs.exception.UnityObservationException: Decompressed observation did not have the expected shape - decompressed had (3, 46, 64) but expected [46, 64, 3]

What I did was attach a camera sensor component, drag the camera I want to use and set the width and height of the visual observation (I attached an image of the camera sensor component). If I understand the instruction correctly, there is not much I need to do to add a visual observation for my agent. No need to code or modify the training config yaml file.

Is there anything I’m missing or is this error a bug? If anyone could help me I would greatly appreciate it. I have been googling it for weeks but I found nothing.

9535279--1346059--CameraSensorSetting.png

if your agent already has a brain attached it is expecting the observations in a different order, best to train a new one with the new camera sensor

Thank you for your reply! I updated the ML-Agent package from version 2.0.1 to 3.0.0 and it solved the problem. The latest version cannot be installed from unity registry but has to be installed from github.

How did you install 3.0.0 version? Seems I have same issue

hit the + in the upper left of the package manager , install package from git url:

git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents#release_21

I had the same problem. By installing version 3.0.0 from the Unity editor I have been able to run the training. The problem is that when making a build with the project to make a training with different instances, the error appears again.

Sorry, it’s Monday and I’m a little sleepy. I was not adding the correct scene in the build so the configuration was not the same. Now it is working.

I have this problem and can’t solve it even install mlagents 3.0.0.
Use pathon 3.10.3 as recomended in mlagents installation guide. Has any one solution for it?