ML-Agent Penguin 예제로 얻은 훈련 팁
2022. 3. 16. 11:04ㆍUnityMLAgent/수업 내용
2, 3번째 줄은 빠른 속도로 장시간 훈련할 경우 예상치 못한 일이
발생할 수 있기 때문에 재배치할 때마다 강체속도를 0으로 설정한다.
예를 들어 펭귄의 위치가 재설정될 때 하향 속도가 재설정되지 않으면
펭귄이 땅속으로 뚫고 날아갈 수 있다.
4번째 줄은 재배치되는 위치를 지정해주는 것으로,
아래 그림처럼 특정 범위 안에서 랜덤한 위치를 설정해준다.
아래는 ChooseRandomPosition 메서드의 전문
/// Choose a random position on the X-Z plane within a partial donut shape
/// </summary>
/// <param name="center">The center of the donut</param>
/// <param name="minAngle">Minimum angle of the wedge</param>
/// <param name="maxAngle">Maximum angle of the wedge</param>
/// <param name="minRadius">Minimum distance from the center</param>
/// <param name="maxRadius">Maximum distance from the center</param>
/// <returns>A position falling within the specified region</returns>
public static Vector3 ChooseRandomPosition(Vector3 center, float minAngle, float maxAngle, float minRadius, float maxRadius)
{
float radius = minRadius;
float angle = minAngle;
if (maxRadius > minRadius)
{
// Pick a random radius
radius = UnityEngine.Random.Range(minRadius, maxRadius);
}
if (maxAngle > minAngle)
{
// Pick a random angle
angle = UnityEngine.Random.Range(minAngle, maxAngle);
}
// Center position + forward vector rotated around the Y axis by "angle" degrees, multiplies by "radius"
return center + Quaternion.Euler(0f, angle, 0f) * Vector3.forward * radius;
}
마지막 줄은 재배치될 때마다 바라보는 각도를 랜덤하게 주는 기능을 한다
config .yaml 파일의 하이퍼 파라미터
GitHub - Unity-Technologies/ml-agents: Unity Machine Learning Agents Toolkit
Unity Machine Learning Agents Toolkit. Contribute to Unity-Technologies/ml-agents development by creating an account on GitHub.
github.com
각 하이퍼 파라미터들의 정의를 볼 수 있다.
'UnityMLAgent > 수업 내용' 카테고리의 다른 글
22.03.11 ML-Agent 롤러볼 예제 실습하기 (0) | 2022.03.14 |
---|---|
22.03.10 [ML-Agent] Agent 클래스의 핵심 메서드 (0) | 2022.03.10 |