public void CreateVisualization(NeuralNetworkContainer networkContainer)//, Vector3 position, Vector3 rotation, float size)
    {
        if (!m_visualize)
        {
            return;
        }

        m_isDestroyed = false;

        m_manager    = NeuralNetworkVisualizationManager.Instance();
        m_network    = networkContainer.m_network;
        m_layerCount = m_network.m_layerCount;

        m_cameraCanvasSize.y = m_height;
        m_cameraCanvasSize.x = m_width;// m_cameraCanvasSize.y * Statics.GetMainCamera().aspect;


        CreateObjects();
        PositionObjects();
        UpdateVisualizationNetwork();

        m_parentTransform.position  = m_parentTransform.parent.transform.position;
        m_parentTransform.position += m_relativePosition;
        m_parentTransform.rotation  = m_parentTransform.parent.transform.rotation;
        m_parentTransform.Rotate(m_relativeRotation);
    }
Exemplo n.º 2
0
    //private NeuralNetworkContainer CreateNetwork(int[] layerLengths)
    //{
    //    if (layerLengths.Length < 2)
    //    {
    //        Debug.Log("Aborted: Tried to create a neural network with less than two layers! (" + layerLengths.Length + ")");
    //        return null;
    //    }
    //    if (layerLengths[0] < 1)
    //    {
    //        Debug.Log("Aborted: Tried to create a neural network with no nodes in the input layer! (" + layerLengths[0] + ")");
    //        return null;
    //    }
    //    if (layerLengths[layerLengths.Length - 1] < 1)
    //    {
    //        Debug.Log("Aborted: Tried to create a neural network with no nodes in the output layer! (" + layerLengths[layerLengths.Length - 1] + ")");
    //        return null;
    //    }

    //    GameObject networkObject = Instantiate(m_networkPrefab, m_parent);
    //    NeuralNetworkContainer networkContainer = networkObject.GetComponent<NeuralNetworkContainer>();
    //    if (networkContainer == null)
    //    {
    //        Debug.Log("Aborted: network prefab did not contain container script!");
    //        return null;
    //    }
    //    NeuralNetwork network = new NeuralNetwork(layerLengths);
    //    networkContainer.InitializeContainer(network);
    //    m_neuralNetworks.Add(networkContainer);

    //    return networkContainer;
    //}
    //private NeuralNetworkContainer CreateNetwork(GameObject networkContainerPrefab)
    //{
    //    GameObject networkContainerObject = Instantiate(networkContainerPrefab, m_parent);
    //    NeuralNetworkContainer networkContainer = networkContainerObject.GetComponent<NeuralNetworkContainer>();
    //    if (networkContainer == null)
    //    {
    //        Debug.Log("Aborted: network prefab did not contain container script!");
    //        return null;
    //    }
    //    //NeuralNetwork network = new NeuralNetwork(networkContainer.GetLayerLengths(), networkContainer.m_trainingManager.GetLearnRate(), networkContainer.m_trainingManager.GetBatchSize());
    //    //networkContainer.InitializeContainer(network);
    //    m_neuralNetworks.Add(networkContainer);

    //    return networkContainer;
    //}
    private void DestroyNetwork(NeuralNetworkContainer network)
    {
        m_neuralNetworks.Remove(network);
    }
 private void Awake()
 {
     m_networkContainer = GetComponent <NeuralNetworkContainer>();
 }