Beispiel #1
0
        /// <summary>
        /// Logic to collect examples. Needs to be called in an Update loop
        /// </summary>
        private void CollectExamplesLogic()
        {
            if (m_CollectData)
            {
                if (Application.isPlaying && m_TimeToStopCapture > 0 && Time.time >= m_TimeToStopCapture)
                {
                    m_CollectData = false;
                    //Debug.Log("end recording");
                }
                else if (!Application.isPlaying || Time.time >= m_TimeToNextCapture)
                {
                    // We check which modality of collection is selected
                    switch (ModeOfCollection)
                    {
                    case CollectionMode.SingleExample:
                        AddTrainingExamplePrivate();
                        break;

                    case CollectionMode.Series:
                        AddInputsToSeries(InputFeatures,
                                          IMLDataSerialization.ParseIMLFeatureToJSON(DesiredOutputFeatures),
                                          ref m_SingleSeries);
                        break;

                    default:
                        break;
                    }

                    ////Debug.Log ("recording");
                    m_TimeToNextCapture = Time.time + 1.0f / CaptureRate;
                }
            }
        }
        public override void LoadDataFromDisk()
        {
            // Load IML Series Collection from disk
            var auxTrainingSeriesCollection = IMLDataSerialization.LoadTrainingSeriesCollectionFromDisk(GetJSONFileName());

            if (!Lists.IsNullOrEmpty(ref auxTrainingSeriesCollection))
            {
                TrainingSeriesCollection = auxTrainingSeriesCollection;
            }
        }
Beispiel #3
0
 private void SetInputData(IMLBaseDataType newInputData)
 {
     if (InputData == null)
     {
         IMLDataSerialization.InstantiateIMLData(ref InputData, newInputData);
     }
     // Make sure we are instantiating a new copy, not a reference
     InputData.Values = new float[newInputData.Values.Length];
     Array.Copy(newInputData.Values, InputData.Values, newInputData.Values.Length);
 }
Beispiel #4
0
        public override void LoadDataFromDisk()
        {
            //Load training data from disk
            var auxTrainingExamplesVector = IMLDataSerialization.LoadTrainingSetFromDisk(GetJSONFileName());

            if (!Lists.IsNullOrEmpty(ref auxTrainingExamplesVector))
            {
                TrainingExamplesVector = auxTrainingExamplesVector;
                //Debug.Log("Training Examples Vector loaded!");
            }
        }
 public virtual void SaveDataToDisk()
 {
     if (ModeOfCollection == CollectionMode.SingleExample)
     {
         IMLDataSerialization.SaveTrainingSetToDisk(TrainingExamplesVector, GetJSONFileName());
     }
     else if (ModeOfCollection == CollectionMode.Series)
     {
         IMLDataSerialization.SaveTrainingSeriesCollectionToDisk(TrainingSeriesCollection, GetJSONFileName());
     }
     else
     {
         Debug.LogWarning("No data collection set");
     }
 }
Beispiel #6
0
        public void LoadDataFromDisk()
        {
            //Load training data from disk
            var auxTrainingExamplesVector = IMLDataSerialization.LoadTrainingSetFromDisk(GetJSONFileNameExamples());

            if (!Lists.IsNullOrEmpty(ref auxTrainingExamplesVector))
            {
                TrainingExamplesVector = auxTrainingExamplesVector;
                //Debug.Log("Training Examples Vector loaded!");
            }

            // Load IML Series Collection from disk
            var auxTrainingSeriesCollection = IMLDataSerialization.LoadTrainingSeriesCollectionFromDisk(GetJSONFileNameSeries());

            if (!Lists.IsNullOrEmpty(ref auxTrainingSeriesCollection))
            {
                TrainingSeriesCollection = auxTrainingSeriesCollection;
            }
        }
 public override void SaveDataToDisk()
 {
     IMLDataSerialization.SaveTrainingSeriesCollectionToDisk(TrainingSeriesCollection, GetJSONFileName());
 }
Beispiel #8
0
 public void SaveDataToDisk()
 {
     IMLDataSerialization.SaveTrainingSetToDisk(TrainingExamplesVector, GetJSONFileNameExamples());
     IMLDataSerialization.SaveTrainingSeriesCollectionToDisk(TrainingSeriesCollection, GetJSONFileNameSeries());
 }
Beispiel #9
0
 public override void SaveDataToDisk()
 {
     IMLDataSerialization.SaveTrainingSetToDisk(TrainingExamplesVector, GetJSONFileName());
 }