public void TrainNetwork(NetworkModel network, NetworksStorageModel storage, QueryDataFormat dataFormat, TaskProgressVM taskProgressVM = null)
        {
            if (taskProgressVM != null)
            {
                taskProgressVM.EndValue = TrainDatas.Count;
                taskProgressVM.TaskName = "Training network";
            }

            if (network.Generation == 0)
            {
                SaveHistory(network);
            }

            Parallel.ForEach(TrainDatas, (model) =>
            {
                var trainData = new MNIST28x28TrainData(model);
                network.Train(trainData);


                if (taskProgressVM != null)
                {
                    taskProgressVM.Value++;
                }
            });

            network.Generation++;
            SaveHistory(network);
            _workshopModel.SaveStorageAsync(storage.Id.ToString());
        }
Esempio n. 2
0
        public async void CreateStorage(NetworkStorageVM storagePrototype)
        {
            var storageModel = new NetworksStorageModel()
            {
                Name = storagePrototype.Name
            };

            Storages.Add(storageModel);
            await SaveStorageAsync(storageModel.Id.ToString());
        }
Esempio n. 3
0
        private async void InitializeDefaultStorage()
        {
            try
            {
                var defStorageModel = await _fileService.ReadFromFileAsync <NetworksStorageModel>(_defaultStorageMetaFileName, new StorageModelReadStrategy());

                DefaultStorage = defStorageModel;
                Storages.Add(defStorageModel);
            }
            catch
            {
                var defStorageModel = new NetworksStorageModel(false)
                {
                    Name = DefaultStorageName
                };

                DefaultStorage = defStorageModel;
                Storages.Add(defStorageModel);

                await SaveStorageAsync(defStorageModel.Id.ToString());
            }
        }