Unity ML Agent 설치
Unity ML Agent 사용시 Python, Tensorflow 가 필요하다.
Miniconda를 설치한다.
https://docs.conda.io/en/latest/miniconda.html
Miniconda — Conda documentation
Miniconda Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others. Use th
docs.conda.io
Conda 설치 후 Anaconda Prompt를 통하여 python 환경을 만든다.
conda create -n [환경이름]
pip를 통해 tensorflow 를 설치한다.
pip install tensorflow
MLAgents 패키지도 설치한다.
pip install mlagents
다 설치가 되었으면 확인해본다.
mlagents-learn
이쁜 유니티 로고가 나온다.
아래 ml-agent를 git clone을 받는다.
https://github.com/Unity-Technologies/ml-agents
Unity-Technologies/ml-agents
Unity Machine Learning Agents Toolkit. Contribute to Unity-Technologies/ml-agents development by creating an account on GitHub.
github.com
클론 받은 폴더로 가서 UnitySDK Project를 Unity 로 오픈하고 Assets\ML-Agents\Examples\3DBall\Scenes\3DBall Scene 을 연다.
Conda CMD창에서 클론 받은 폴더로 가서
mlagents-learn config/trainer_config.yaml --run-id=firstRun --train 를 입력하여 훈련준비를 한다.
훈련준비가 완료되었다.
Unity의 PlayButton을 누르면 훈련을 진행한다.
Cmd창에 Ctrl + C를 누르면 훈련을 종료하고 훈련된 모델을 저장한다.(저장위치가 나온다.)
저장된 모델을 Unity로 가져와 Model에 적용하면 Agent가 작동한다.