Unity/ML-Agents

05. ML-Agents - Imitation Learning

๐Ÿ”ท ์‹ค์Šต 5 - ๋ชจ๋ฐฉํ•™์Šต

- ๊ฐ•ํ™”ํ•™์Šต๋งŒ์„ ์‚ฌ์šฉํ•˜๋ฉด ํšจ์œจ์ด ์•ˆ๋‚˜์˜ค๋Š” ๊ฒฝ์šฐ

- ์‚ฌ๋žŒ์ด ์‹œ๋ฒ”๋ณด์ด๋Š” ๊ฒƒ์„ ๋ ˆ์ฝ”๋”ฉ์„ ๋– ์„œ, ๋…นํ™”ํŒŒ์ผ์„ ์คŒ

 

- ์ปดํฌ๋„ŒํŠธ : Demonstration Recorder

 

- Hint์˜ ์ƒ‰์ƒ๊ณผ ๊ฐ™์€ ์ƒ‰์ƒ์˜ ํ๋ธŒ๋กœ ์ด๋™

 

 

 

๐Ÿ”ท ํŠธ๋ ˆ์ด๋‹ ํ™˜๊ฒฝ ๊ตฌ์ถ•

- ์”ฌ ์ƒ์„ฑ : MummyIL

 

 

 

- ๋นˆ๊ฒŒ์ž„์˜ค๋ธŒ์ ํŠธ : Stage

- ํ๋ธŒ : Floor

    - Scale : 10, 0.1, 10

 

 

 

- ๋นˆ๊ฒŒ์ž„์˜ค๋ธŒ์ ํŠธ : Walls

- ํ๋ธŒ : Wall

    - Scale : 10, 1, 1

- ๋ฒฝ์„ธ์šฐ๊ธฐ

- Tag ๋ถ€์—ฌ : WALL

 

 

 

- agent ์ถ”๊ฐ€

    - position : 0, 0.05, 0

 

 

 

- cube ์ƒ์„ฑ : Hint

    - position : 0, 0.55, 0

 

 

 

- cube : Black, Red, Green, Blue

    - Scale : 2, 1, 2

    - ๋ชจ์„œ๋ฆฌ์— ์œ„์น˜

 

 

 

- ํƒœ๊ทธ ์ถ”๊ฐ€ : BLACK, RED, BLUE, GREEN

- ๊ฐ ํ๋ธŒ์— ํ•ด๋‹นํ•˜๋Š” ํƒœ๊ทธ ๋ถ€์—ฌ

 

 

 

- ์Šคํฌ๋ฆฝํŠธ ์ƒ์„ฑ : StageManagerIL.cs

- Stage์— StageManagerIL ์Šคํฌ๋ฆฝํŠธ ์ถ”๊ฐ€

 

 

 

 

๐Ÿ”ถ StageManagerIL.cs

- Hint์˜ ์ƒ‰์ƒ์„ ๋žœ๋ค์œผ๋กœ ๋ณ€๊ฒฝ์‹œํ‚ด

- ์ด์ „์— ๋‚˜์™”๋˜ ์ƒ‰์ƒ์€ ์•ˆ๋‚˜์˜ค๋„๋ก ์„ธํŒ…

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StageManagerIL : MonoBehaviour
{
    public enum HINT_COLOR
    {
        BLACK, BLUE, GREEN, RED
    }

    // ํžŒํŠธ์˜ ์ƒ‰์ƒ
    public HINT_COLOR hintColor = HINT_COLOR.BLACK;

    public Material[] hintMt;

    private new Renderer renderer;


    void Start()
    {
        renderer = transform.Find("Hint").GetComponent<Renderer>();
    }

    public void InitStage()
    {
        int idx = Random.Range(0, hintMt.Length);
        renderer.material = hintMt[idx];

        // ๋ชฉํ‘œํƒ€๊ฒŸ์˜ ์ƒ‰์ƒ์„ ์ง€์ •
        hintColor = (HINT_COLOR)idx;
    }



}

- Hint์— ์ƒ‰์ƒ ๋ถ€์—ฌ

 

 

 

- ์ˆœ์„œ ๋™์ผํ•˜๊ฒŒ ๋จธํ‹ฐ๋ฆฌ์–ผ ๋„ฃ์–ด์ฃผ๊ธฐ

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StageManagerIL : MonoBehaviour
{
    public enum HINT_COLOR
    {
        BLACK, BLUE, GREEN, RED
    }

    // ํžŒํŠธ์˜ ์ƒ‰์ƒ
    public HINT_COLOR hintColor = HINT_COLOR.BLACK;

    public Material[] hintMt;

    private new Renderer renderer;

    // ๋ฐ”๋กœ ์ „์— ๋‚˜์™”๋˜ ์ƒ‰์ƒ์„ ์ €์žฅํ•  ๋ณ€์ˆ˜
    private int prevTag = -1;


    void Start()
    {
        renderer = transform.Find("Hint").GetComponent<Renderer>();
    }

    public void InitStage()
    {
        int idx = 0;
        do
        {
            idx = Random.Range(0, hintMt.Length);
        } while (idx == prevTag);
        prevTag = idx;

        renderer.material = hintMt[idx];

        // ๋ชฉํ‘œํƒ€๊ฒŸ์˜ ์ƒ‰์ƒ์„ ์ง€์ •
        hintColor = (HINT_COLOR)idx;
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            InitStage();
        }
    }



}

- ๊ฐ™์€ ์ƒ‰์ƒ์œผ๋กœ ์ค‘๋ณต๋˜์ง€ ์•Š๋„๋ก ์„ธํŒ…

 

 

 

- Tag ์ถ”๊ฐ€ : HINT_BLACK, HINT_RED, HINT_BLUE, HINT_GREEN

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StageManagerIL : MonoBehaviour
{
    public enum HINT_COLOR
    {
        BLACK, BLUE, GREEN, RED
    }

    // ํžŒํŠธ์˜ ์ƒ‰์ƒ
    public HINT_COLOR hintColor = HINT_COLOR.BLACK;

    public Material[] hintMt;
    public string[] hintTag;

    private new Renderer renderer;

    // ๋ฐ”๋กœ ์ „์— ๋‚˜์™”๋˜ ์ƒ‰์ƒ์„ ์ €์žฅํ•  ๋ณ€์ˆ˜
    private int prevTag = -1;


    void Start()
    {
        renderer = transform.Find("Hint").GetComponent<Renderer>();
    }

    public void InitStage()
    {
        int idx = 0;
        do
        {
            idx = Random.Range(0, hintMt.Length);
        } while (idx == prevTag);
        prevTag = idx;

        renderer.material = hintMt[idx];

        // ๋ชฉํ‘œํƒ€๊ฒŸ์˜ ์ƒ‰์ƒ์„ ์ง€์ •
        hintColor = (HINT_COLOR)idx;
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            InitStage();
        }
    }



}

- public string[] hintTag; ์ถ”๊ฐ€

 

 

 

- ์œ„์˜ ๋จธํ‹ฐ๋ฆฌ์–ผ๊ณผ ๋™์ผํ•œ ์ˆœ์„œ๋กœ Tag๊ฐ’ ์ž…๋ ฅ

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StageManagerIL : MonoBehaviour
{
    public enum HINT_COLOR
    {
        BLACK, BLUE, GREEN, RED
    }

    // ํžŒํŠธ์˜ ์ƒ‰์ƒ
    public HINT_COLOR hintColor = HINT_COLOR.BLACK;

    public Material[] hintMt;
    public string[] hintTag;

    private new Renderer renderer;

    // ๋ฐ”๋กœ ์ „์— ๋‚˜์™”๋˜ ์ƒ‰์ƒ์„ ์ €์žฅํ•  ๋ณ€์ˆ˜
    private int prevTag = -1;


    void Start()
    {
        renderer = transform.Find("Hint").GetComponent<Renderer>();
    }

    public void InitStage()
    {
        int idx = 0;
        do
        {
            idx = Random.Range(0, hintMt.Length);
        } while (idx == prevTag);
        prevTag = idx;

        // Hint์˜ ๋จธํ‹ฐ๋ฆฌ์–ผ ๊ต์ฒด
        renderer.material = hintMt[idx];
        // Hint์˜ ํƒœ๊ทธ๋ฅผ ์ง€์ •
        renderer.gameObject.tag = hintTag[idx];
        // ๋ชฉํ‘œํƒ€๊ฒŸ์˜ ์ƒ‰์ƒ์„ ์ง€์ •
        hintColor = (HINT_COLOR)idx;
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            InitStage();
        }
    }



}

- Hint์— ์ƒ‰์ƒ๊ณผ ๋™์ผํ•œ Tag ๋ถ€์—ฌ

 

 

 

๐Ÿ”ถ Agent ์„ธํŒ…

- Capsule Collider ์ถ”๊ฐ€

    - Center : 0, 0.5, 0

    - Radius : 0.3

- Rigidbody ์ถ”๊ฐ€

    - Collision Detection : Continuous

    - Freeze Rotation

 

 

 

- animator controller ์—ฐ๊ฒฐ

 

 

 

- MummyILAgent.cs ์ƒ์„ฑ

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

public class MummyILAgent : Agent
{
    private StageManagerIL stageManager;

    public override void Initialize()
    {
        stageManager = transform.parent.GetComponent<StageManagerIL>();
    }

    public override void OnEpisodeBegin()
    {
        stageManager.InitStage();
    }

    public override void CollectObservations(VectorSensor sensor)
    {
    }

    public override void OnActionReceived(ActionBuffers actions)
    {
    }

    public override void Heuristic(in ActionBuffers actionsOut)
    {
    }

}

- ๊ธฐ๋ณธ ํ•จ์ˆ˜ ์ž‘์„ฑ

- ์—ํ”ผ์†Œ๋“œ๊ฐ€ ์‹œ์ž‘ํ•  ๋•Œ๋งˆ๋‹ค InitStage() ํ˜ธ์ถœ

 

 

 

- Agent์— MummyILAgent ์Šคํฌ๋ฆฝํŠธ ์ถ”๊ฐ€

 

 

 

- Max step : 10 : hint์˜ ์ƒ‰์ƒ๊ณผ ํƒœ๊ทธ๊ฐ€ ๋ณ€ํ•˜๋Š”์ง€ ํ™•์ธ

    - ๋‹ค์‹œ 0์œผ๋กœ ๋˜๋Œ๋ ค๋†“๊ธฐ

 

 

 

๐Ÿ”ถ MummyILAgent.cs : ์ด๋™๋กœ์ง

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

public class MummyILAgent : Agent
{
    private new Transform transform;
    private new Rigidbody rigidbody;

    public float moveSpeed = 1.5f;
    public float turnSpeed = 200.0f;

    private StageManagerIL stageManager;
    private Renderer floorRd;
    private Material originMt;

    public Material goodMt, badMt;

    public override void Initialize()
    {
        MaxStep = 2000;
        transform = GetComponent<Transform>();
        rigidbody = GetComponent<Rigidbody>();

        floorRd = transform.parent.Find("Floor").GetComponent<Renderer>();
        originMt = floorRd.material;

        stageManager = transform.parent.GetComponent<StageManagerIL>();
    }

    public override void OnEpisodeBegin()
    {
        stageManager.InitStage();
        // ๋ฌผ๋ฆฌ๋ ฅ ์ดˆ๊ธฐํ™”
        rigidbody.velocity = rigidbody.angularVelocity = Vector3.zero;
        // Agent์˜ ์œ„์น˜๋ฅผ ์ดˆ๊ธฐํ™”
        transform.localPosition = new Vector3(0, 0.0f, -2.5f);
        transform.localRotation = Quaternion.identity;
    }

    public override void CollectObservations(VectorSensor sensor)
    {
    }

    public override void OnActionReceived(ActionBuffers actions)
    {
        var action = actions.DiscreteActions;
        Debug.Log($"[0] = {action[0]}, [1]: {action[1]}");

        Vector3 dir = Vector3.zero;
        Vector3 rot = Vector3.zero;

        // Branch 0 : ์ •์ง€ / ์ „์ง„ / ํ›„์ง„
        switch (action[0])
        {
            case 1: dir = transform.forward; break;
            case 2: dir = -transform.forward; break;
        }

        // Branch 1 : ์ •์ง€ / ์ขŒํšŒ์ „ / ์šฐํšŒ์ „
        switch (action[1])
        {
            case 1: rot = -transform.up; break;
            case 2: rot = transform.up; break;
        }

        transform.Rotate(rot, Time.fixedDeltaTime * turnSpeed);
        rigidbody.AddForce(dir * moveSpeed, ForceMode.VelocityChange);

        // ๋งˆ์ด๋„ˆ์Šค ํŽ˜๋„ํ‹ฐ๋ฅผ ์ ์šฉ
        // ๋ชจ๋ฐฉํ•™์Šต์„ ํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ตณ์ด ํŒจ๋„ํ‹ฐ ์•ˆ์ค˜๋„ ๋จ
        AddReward(-1 / (float)MaxStep);
    }

    public override void Heuristic(in ActionBuffers actionsOut)
    {
        var action = actionsOut.DiscreteActions;

        actionsOut.Clear();
        if (Input.GetKey(KeyCode.W))
        {
            action[0] = 1;
        }
        if (Input.GetKey(KeyCode.S))
        {
            action[0] = 2;
        }

        if (Input.GetKey(KeyCode.A))
        {
            action[1] = 1;
        }
        if (Input.GetKey(KeyCode.D))
        {
            action[1] = 2;
        }
    }

}

- ์ด๋™ ์ฒ˜๋ฆฌ

 

 

 

- Space Size : 0

- Discrete Branches : 2

    - Branch 0 : 3

    - Branch 1 :  3

 

 

 

- ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ : Decision Requester

 

 

 

๐Ÿ”ถ ๋ฆฌ์›Œ๋“œ ๋ถ€์—ฌ ๋ฐ floor ์ƒ‰์ƒ ๋ณ€๊ฒฝ

 

 

- ๋จธํ‹ฐ๋ฆฌ์–ผ ์—ฐ๊ฒฐ

 

 

 

- ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ : Ray Perception Sensor 3D

    - Ray๋กœ ์ธ์ง€ํ•ด์•ผํ•  ๋Œ€์ƒ์„ ์ž…๋ ฅ

 

 

 

- Hint์™€ 4๊ฐœ์˜ ๋ธ”๋Ÿญ์„ ์ธ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ์กฐ์ ˆ

    - Max Ray Degrees : 90

    - Start Vertical Offset : 0.5   

    - End Vertical Offset : 0.5

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

public class MummyILAgent : Agent
{
    private new Transform transform;
    private new Rigidbody rigidbody;

    public float moveSpeed = 1.5f;
    public float turnSpeed = 200.0f;

    private StageManagerIL stageManager;
    private Renderer floorRd;
    private Material originMt;

    public Material goodMt, badMt;

    public override void Initialize()
    {
        MaxStep = 2000;
        transform = GetComponent<Transform>();
        rigidbody = GetComponent<Rigidbody>();

        floorRd = transform.parent.Find("Floor").GetComponent<Renderer>();
        originMt = floorRd.material;

        stageManager = transform.parent.GetComponent<StageManagerIL>();
    }

    public override void OnEpisodeBegin()
    {
        stageManager.InitStage();
        // ๋ฌผ๋ฆฌ๋ ฅ ์ดˆ๊ธฐํ™”
        rigidbody.velocity = rigidbody.angularVelocity = Vector3.zero;
        // Agent์˜ ์œ„์น˜๋ฅผ ์ดˆ๊ธฐํ™”
        transform.localPosition = new Vector3(0, 0.0f, -3.5f);
        transform.localRotation = Quaternion.identity;
    }

    public override void CollectObservations(VectorSensor sensor)
    {
    }

    public override void OnActionReceived(ActionBuffers actions)
    {
        var action = actions.DiscreteActions;
        Debug.Log($"[0] = {action[0]}, [1]: {action[1]}");

        Vector3 dir = Vector3.zero;
        Vector3 rot = Vector3.zero;

        // Branch 0 : ์ •์ง€ / ์ „์ง„ / ํ›„์ง„
        switch (action[0])
        {
            case 1: dir = transform.forward; break;
            case 2: dir = -transform.forward; break;
        }

        // Branch 1 : ์ •์ง€ / ์ขŒํšŒ์ „ / ์šฐํšŒ์ „
        switch (action[1])
        {
            case 1: rot = -transform.up; break;
            case 2: rot = transform.up; break;
        }

        transform.Rotate(rot, Time.fixedDeltaTime * turnSpeed);
        rigidbody.AddForce(dir * moveSpeed, ForceMode.VelocityChange);

        // ๋งˆ์ด๋„ˆ์Šค ํŽ˜๋„ํ‹ฐ๋ฅผ ์ ์šฉ
        // ๋ชจ๋ฐฉํ•™์Šต์„ ํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ตณ์ด ํŒจ๋„ํ‹ฐ๋ฅผ ๋ถ€์—ฌํ•  ํ•„์š”๋Š” ์—†์Œ
        AddReward(-1 / (float)MaxStep);
    }

    public override void Heuristic(in ActionBuffers actionsOut)
    {
        var action = actionsOut.DiscreteActions;

        actionsOut.Clear();
        if (Input.GetKey(KeyCode.W))
        {
            action[0] = 1;
        }
        if (Input.GetKey(KeyCode.S))
        {
            action[0] = 2;
        }

        if (Input.GetKey(KeyCode.A))
        {
            action[1] = 1;
        }
        if (Input.GetKey(KeyCode.D))
        {
            action[1] = 2;
        }
    }

    private void OnCollisionEnter(Collision coll)
    {
        if (coll.collider.tag == stageManager.hintColor.ToString())
        {
            SetReward(+1.0f);
            EndEpisode();

            StartCoroutine(ReverMaterial(goodMt));
        }
        else
        {
            if (coll.collider.CompareTag("WALL") || coll.gameObject.name == "Hint")
            {
                AddReward(-0.05f);
            }
            else
            {
                SetReward(-1.0f);
                EndEpisode();

                StartCoroutine(ReverMaterial(badMt));
            }
        }
    }

    IEnumerator ReverMaterial(Material changeMt)
    {
        floorRd.material = changeMt;
        yield return new WaitForSeconds(0.2f);
        floorRd.material = originMt;
    }

}

- ๋ฆฌ์›Œ๋“œ ๋ถ€์—ฌ, floor ์ƒ‰์ƒ ๋ณ€๊ฒฝ

 

 

 

๐Ÿ”ท ๋ ˆ์ฝ”๋”ฉ

๐Ÿ”ถ ์ฝ”๋“œ ์ˆ˜์ •

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Actuators;
using Unity.MLAgents.Sensors;

public class MummyILAgent : Agent
{
    private new Transform transform;
    private new Rigidbody rigidbody;

    public float moveSpeed = 1.5f;
    public float turnSpeed = 200.0f;

    private StageManagerIL stageManager;
    private Renderer floorRd;
    private Material originMt;

    public Material goodMt, badMt;

    public override void Initialize()
    {
        MaxStep = 2000;
        transform = GetComponent<Transform>();
        rigidbody = GetComponent<Rigidbody>();

        floorRd = transform.parent.Find("Floor").GetComponent<Renderer>();
        originMt = floorRd.material;

        stageManager = transform.parent.GetComponent<StageManagerIL>();
    }

    public override void OnEpisodeBegin()
    {
        stageManager.InitStage();
        // ๋ฌผ๋ฆฌ๋ ฅ ์ดˆ๊ธฐํ™”
        rigidbody.velocity = rigidbody.angularVelocity = Vector3.zero;
        // Agent์˜ ์œ„์น˜๋ฅผ ์ดˆ๊ธฐํ™”
        transform.localPosition = new Vector3(0, 0.0f, -3.5f);
        transform.localRotation = Quaternion.identity;
    }

    public override void CollectObservations(VectorSensor sensor)
    {
    }

    public override void OnActionReceived(ActionBuffers actions)
    {
        var action = actions.DiscreteActions;
        Debug.Log($"[0] = {action[0]}, [1]: {action[1]}");

        Vector3 dir = Vector3.zero;
        Vector3 rot = Vector3.zero;

        // Branch 0 : ์ •์ง€ / ์ „์ง„ / ํ›„์ง„
        switch (action[0])
        {
            case 1: dir = transform.forward; break;
            case 2: dir = -transform.forward; break;
        }

        // Branch 1 : ์ •์ง€ / ์ขŒํšŒ์ „ / ์šฐํšŒ์ „
        switch (action[1])
        {
            case 1: rot = -transform.up; break;
            case 2: rot = transform.up; break;
        }

        transform.Rotate(rot, Time.fixedDeltaTime * turnSpeed);
        rigidbody.AddForce(dir * moveSpeed, ForceMode.VelocityChange);

        // ๋งˆ์ด๋„ˆ์Šค ํŽ˜๋„ํ‹ฐ๋ฅผ ์ ์šฉ
        // ๋ชจ๋ฐฉํ•™์Šต์„ ํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ตณ์ด ํŒจ๋„ํ‹ฐ๋ฅผ ๋ถ€์—ฌํ•  ํ•„์š”๋Š” ์—†์Œ
        // AddReward(-1 / (float)MaxStep);
    }

    public override void Heuristic(in ActionBuffers actionsOut)
    {
        var action = actionsOut.DiscreteActions;

        actionsOut.Clear();
        if (Input.GetKey(KeyCode.W))
        {
            action[0] = 1;
        }
        if (Input.GetKey(KeyCode.S))
        {
            action[0] = 2;
        }

        if (Input.GetKey(KeyCode.A))
        {
            action[1] = 1;
        }
        if (Input.GetKey(KeyCode.D))
        {
            action[1] = 2;
        }
    }

    private void OnCollisionEnter(Collision coll)
    {
        if (coll.gameObject.name == "Floor") return;

        if (coll.collider.tag == stageManager.hintColor.ToString())
        {
            SetReward(+1.0f);
            EndEpisode();

            StartCoroutine(ReverMaterial(goodMt));
        }
        else
        {
            if (coll.collider.CompareTag("WALL") || coll.gameObject.name == "Hint")
            {
                SetReward(-0.05f);
            }
            else
            {
                SetReward(-1.0f);
                EndEpisode();

                StartCoroutine(ReverMaterial(badMt));
            }
        }
    }

    IEnumerator ReverMaterial(Material changeMt)
    {
        floorRd.material = changeMt;
        yield return new WaitForSeconds(0.2f);
        floorRd.material = originMt;
    }

}

 

- AddReward(-1 / (float)MaxStep) : ์ฃผ์„์ฒ˜๋ฆฌ

- ๋ฒฝ๊ณผ Hint์— ๋ถ€๋”ชํ˜”์„ ๋•Œ : AddReward(-0.05f) -> SetReward(-0.05f) : ๋ณ€๊ฒฝ

 

 

 

๐Ÿ”ถ ๋ ˆ์ฝ”๋”ฉ ์„ธํŒ…

- ํด๋” ์ƒ์„ฑ : MummyIL

- Stage ํ”„๋ฆฌํŒนํ™”

 

 

 

- ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ : Demonstration Recorder

 

 

 

- ํด๋” ์ถ”๊ฐ€ : Demo : ๋ ˆ์ฝ”๋”ฉํ•œ ํŒŒ์ผ์„ ์ €์žฅํ•  ํด๋”

 

 

 

- Record : ์ฒดํฌ

- Num Steps To Record : 0 : ๋ช‡ ์Šคํ…๊นŒ์ง€ ๋ ˆ์ฝ”๋”ฉํ• ์ง€ : 0์ด๋ฉด ๋ฌด์ œํ•œ

- Name : MummyIL : ์ €์žฅํ•  ํŒŒ์ผ๋ช…

- Directory : Assets/Demo : ํŒŒ์ผ์„ ์ €์žฅํ•  ์œ„์น˜

 

 

 

- ํ”Œ๋ ˆ์ด

- ๋  ์ˆ˜ ์žˆ์œผ๋ฉด ์‹ค์ˆ˜ํ•˜๋ฉด ์•ˆ๋จ

 

 

 

- ๋ ˆ์ฝ”๋”ฉ ํ›„ Record ์–ธ์ฒดํฌ

- Apply All

 

 

 

๐Ÿ”ท ํŠธ๋ ˆ์ด๋‹

- ์Šคํ…Œ์ด์ง€ ๋ณต์‚ฌ

 

 

 

- PushBlock.yaml ๋ณต์‚ฌ

 

 

 

- behavior ์ด๋ฆ„ ๋ณ€๊ฒฝ

- demo_path : MummyIL.demo

- max_steps : 30๋งŒ๋ฒˆ

 

 

 

 

- recordingํ•œ ํŒŒ์ผ์„ imitation ํด๋”๋กœ ๊ฐ€์ ธ์˜ด

 

 

 

- ํŠธ๋ ˆ์ด๋‹ ์‹œ์ž‘

 

 

 

- ์œ ๋‹ˆํ‹ฐ์—์„œ play

 

 

 

๐Ÿ”ถ ํŠธ๋ ˆ์ด๋‹ summary

 

 

 

๐Ÿ”ถ ํŠธ๋ ˆ์ด๋‹ ๊ฒฐ๊ณผ ํ™•์ธํ•ด๋ณด๊ธฐ

- ํ•™์Šต๋œ ๋ชจ๋ธ(.onnx)์„ ํ”„๋กœ์ ํŠธ์ฐฝ์— ๋Œ์–ด๋‹ค๋†“๊ธฐ

 

 

 

- ๋ชจ๋ธ ์—ฐ๊ฒฐํ•˜๊ธฐ

- Apply to Prefab

 

 

 

- Play

'Unity > ML-Agents' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

07. ML-Agents - Soccer (2)  (0) 2021.08.03
06. ML-Agents - Soccer (1)  (1) 2021.08.02
04. ML-Agents - Camera Sensor  (0) 2021.08.01
03. ML-Agents - Ray Perception Sensor 3D  (0) 2021.07.30
02. ML-Agents - position,rigidbody ๊ด€์ธก  (0) 2021.07.30