private void Start()
    {
        if (m_layerLengths[0] <= 0)
        {
            m_layerLengths[0] = m_sampleManager.GetInputLayerLengthDynamiclyScreenshot();
        }
        if (m_layerLengths[m_layerLengths.Length - 1] <= 0)
        {
            m_layerLengths[m_layerLengths.Length - 1] = ScreenshotManager.Instance().GetOutputNumber();
        }

        InitializeContainer(new NeuralNetwork(
                                m_layerLengths,
                                m_trainingManager.GetLearnRate(),
                                m_trainingManager.GetBatchSize(),
                                m_trainingManager.GetDropoutRate(),
                                m_trainingManager.GetWeightDecayRate(),
                                m_activisionType,
                                m_activisionTypeOutput,
                                m_costType,
                                m_initializationType,
                                m_initializationSeed,
                                m_activisionConstant,
                                m_initDropoutSeed));

        //SaveContainer(m_dataFileName);
    }
Esempio n. 2
0
    private float[] MoveToRaycastposition()
    {
        float[] inputData = new float[ScreenshotManager.Instance().GetOutputNumber()];
        if (!m_isMovingRight && !m_isMovingLeft)
        {
            m_changeDirectionTimer += Time.deltaTime;
            if (inputData.Length == 3)
            {
                inputData[2] = 1;
            }
            if (inputData.Length == 5)
            {
                inputData[4] = 1;
            }
            return(inputData);
        }
        m_position     = m_visualCapturePlayer.position.x - GetAreaStartPosition().x;
        m_wantPosition = m_pixelSize * (0.5f + (m_isMovingLeft ? m_moveToIndexPositionLeft : m_moveToIndexPositionRight));
        //Debug.Log(m_visualCapturePlayer.position.x - GetAreaStartPosition().x);
        //Debug.Log(m_moveToIndexPositionLeft + ", " + m_moveToIndexPositionRight);
        //Debug.DrawRay(m_visualCapturePlayer.position, Vector3.up * 10f, Color.red, 1);
        //Debug.DrawRay(m_visualCapturePlayer.position, Vector3.right * m_wantPosition, Color.blue);

        if (m_isMovingLeft)
        {
            if (m_position < m_wantPosition)
            {
                m_isMovingLeft = false;
            }
            else
            {
                inputData[0] = 1;
            }
        }
        if (m_isMovingRight)
        {
            if (m_position > m_wantPosition)
            {
                m_isMovingRight = false;
            }
            else
            {
                inputData[1] = 1;
            }
        }

        return(inputData);
    }
Esempio n. 3
0
    public float[] GenerateInputDataPlayer()
    {
        float[] input = new float[ScreenshotManager.Instance().GetOutputNumber()];

        if (Input.GetKey(m_keyLeft) || Input.GetAxis("LeftJoystickHorizontal") < -0.2f)
        {
            input[0] = 1;
        }
        if (Input.GetKey(m_keyRight) || Input.GetAxis("LeftJoystickHorizontal") > 0.2f)
        {
            input[1] = 1;
        }

        if (input[0] == 0 && input[1] == 0)
        {
            if (ScreenshotManager.Instance().GetOutputNumber() == 3)
            {
                input[2] = 1;
            }
            if (ScreenshotManager.Instance().GetOutputNumber() == 5)
            {
                input[4] = 1;
            }
        }
        if (ScreenshotManager.Instance().GetOutputNumber() >= 4)
        {
            if (Input.GetKey(m_keyUp))
            {
                input[2] = 1;
            }
            if (Input.GetKey(m_keyDown))
            {
                input[3] = 1;
            }
        }
        return(input);
    }