// Create bag-of-words (BoW) with the given number of words // private BagOfVisualWords<CornerFeaturePointEx> m_bow = null; #endregion #region Public methods public void SaveTrainData(Stream stream, ConfigurationFieldClassifier config, string trainPath, double pageThreshold) { var model = new ModelFieldCLassify(); model.PageThreshold = pageThreshold; // m_bow.Save(model.Bow); m_ksvm.Save(model.Ksvm); BinaryFormatter f = new BinaryFormatter(); f.Serialize(model.TrainImageFeatureVectors, m_trainImageFeatureVectors); f.Serialize(model.ClassIdClassNameMap, m_classIdClassNameMap); model.Configuration = config; model.TrainPath = trainPath; ModelFieldCLassify.Save(model, stream); }
// Create bag-of-words (BoW) with the given number of words // private BagOfVisualWords<CornerFeaturePointEx> m_bow = null; #endregion #region Public methods public void SaveTrainData(Stream stream, ConfigurationFieldClassifier config, string trainPath, double pageThreshold, IEnumerable <IFieldFeature> features) { var model = new ModelFieldCLassify(); model.PageThreshold = pageThreshold; // m_bow.Save(model.Bow); (m_machine as MulticlassSupportVectorMachine).Save(model.Ksvm); //BinaryFormatter f = new BinaryFormatter(); //f.Serialize(model.TrainImageFeatureVectors, m_trainImageFeatureVectors); //f.Serialize(model.ClassIdClassNameMap, m_classIdClassNameMap); model.Configuration = config; model.TrainPath = trainPath; model.FeaturesScale = features.ToDictionary(x => x.Name, y => y.FieldScale); ModelFieldCLassify.Save(model, stream); }