void InternalInitialize(Action initializeCallback) { modelBuilder = new SvmModelBuilder(); this.featureVector = new List<double[]>(); // init omp this.imgFeature = new ImageFeature(GestureStudio.GestureLib_DictionartyPath); // update GestureInfo.data if (this.problemFile == null || this.problemFile.Equals(GestureStudio.FeatureFileEmpty)) Gestures.loadData(GestureStudio.GesturesDataPathEmpty); else if (this.problemFile.Equals(GestureStudio.FeatureFileNew)) Gestures.loadData(GestureStudio.GesturesDataPathNew); else // demo version, this will take a long time. So avoid this in the demo. Gestures.loadData(GestureStudio.GesturesDataPathDemo); // done initialization if (initializeCallback != null) { initializeCallback(); } // display trainer form SynchronizationContext ctx = SynchronizationContext.Current; GestureStudio.DisplayTrainerForm(() => { // count down finished, begin this.initialized = true; }); }
// Load in the prediction model. May take couple of seconds. void LoadModel() { this.modelBuilder = new SvmModelBuilder(); if (!this.modelBuilder.LoadFromFile(this.modelFile)) { // first time usage, train from feature file this.modelBuilder.TrainModel(this.problemFile); //Console.WriteLine("Training finished. Saving Model as {0}", modelFileName); this.modelBuilder.SaveModel(modelFile); } }
void InternalInitialize(Action initializeCallback) { modelBuilder = new SvmModelBuilder(); this.featureVector = new List <double[]>(); // init omp this.imgFeature = new ImageFeature(GestureStudio.GestureLib_DictionartyPath); // update GestureInfo.data if (this.problemFile == null || this.problemFile.Equals(GestureStudio.FeatureFileEmpty)) { Gestures.loadData(GestureStudio.GesturesDataPathEmpty); } else if (this.problemFile.Equals(GestureStudio.FeatureFileNew)) { Gestures.loadData(GestureStudio.GesturesDataPathNew); } else // demo version, this will take a long time. So avoid this in the demo. { Gestures.loadData(GestureStudio.GesturesDataPathDemo); } // done initialization if (initializeCallback != null) { initializeCallback(); } // display trainer form SynchronizationContext ctx = SynchronizationContext.Current; GestureStudio.DisplayTrainerForm(() => { // count down finished, begin this.initialized = true; }); }