1 #ifndef _FEATUREFILEIO_ 2 #define _FEATUREFILEIO_ 30 #if !defined(_FeatureVector_Defined_) 36 #if !defined(_FeatureVectorList_Defined_) 42 #if !defined(_FactoryFVProducer_Defined_) 167 const KKStr& _dirName,
168 const KKStr& _fileName,
169 MLClassPtr _unknownClass,
170 bool _useDirectoryNameForClassName,
201 bool _useDirectoryNameForClassName,
203 bool _rewiteRootFeatureFile,
226 MLClassListPtr _classes,
228 KKStr& _errorMessage,
255 KKStr& _errorMessage,
273 const KKStr& _fileName,
279 KKStr& _errorMessage,
332 const char* _delimiters,
339 void GetLine (std::istream& _in,
352 KKStr driverNameLower;
354 static void RegisterAllDrivers ();
355 static GoalKeeperPtr featureFileIOGoalKeeper;
358 static std::vector<FeatureFileIOPtr>* registeredDrivers;
360 static std::vector<FeatureFileIOPtr>* RegisteredDrivers ();
369 #define _FeatureFileIO_Defined_ void GetToken(std::istream &_in, const char *_delimiters, KKStr &_token, bool &_eof, bool &_eol)
Will retrieve the next token from the input stream.
FeatureVector * FeatureVectorPtr
FeatureNumList const FeatureNumListConst
virtual FileDescPtr GetFileDesc(const KKStr &_fileName, std::istream &_in, MLClassListPtr _classes, kkint32 &_estSize, KKStr &_errorMessage, RunLog &_log)=0
Create a FileDesc object from the input stream '_in'.
void GetLine(std::istream &_in, KKStr &_line, bool &_eof)
unsigned __int32 kkuint32
FeatureVectorListPtr LoadInSubDirectoryTree(FactoryFVProducerPtr _fvProducerFactory, KKStr _rootDir, MLClassList &_mlClasses, bool _useDirectoryNameForClassName, VolConstBool &_cancelFlag, bool _rewiteRootFeatureFile, RunLog &_log)
Creates a feature vector list of all images located in the specified sub-directory tree...
virtual FeatureVectorListPtr LoadFeatureFile(const KKStr &_fileName, MLClassList &_mlClasses, kkint32 _maxCount, VolConstBool &_cancelFlag, bool &_successful, bool &_changesMade, RunLog &_log)
Loads the contents of a feature data file and returns a ImageFeaturesList container object...
void SaveFeatureFileMultipleParts(const KKStr &_fileName, FeatureNumListConst &_selFeatures, FeatureVectorList &_examples, VolConstBool &_cancelFlag, bool &_successful, RunLog &_log)
Saves the feature file in multiple parts with no one single part larger that 64k examples.
static void FinalCleanUp()
Before you terminate your application and after all FeatureFileIO activity is done call this method t...
Container class for FeatureVector derived objects.
FeatureFileIO * FeatureFileIOPtr
Base class for all FeatureFileIO classes.
virtual void SaveFeatureFile(const KKStr &_fileName, FeatureNumListConst &_selFeatures, FeatureVectorList &_examples, kkuint32 &_numExamplesWritten, VolConstBool &_cancelFlag, bool &_successful, RunLog &_log)
Save examples to 'fileName'.
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
static VectorKKStr RegisteredDriverNames(bool canRead, bool canWrite)
virtual FeatureVectorListPtr LoadFile(const KKStr &_fileName, const FileDescPtr _fileDesc, MLClassList &_classes, std::istream &_in, kkint32 _maxCount, VolConstBool &_cancelFlag, bool &_changesMade, KKStr &_errorMessage, RunLog &_log)=0
To be implemented by derived classes; loads the contents of a feature data file and returns a ImageFe...
static void RegisterFeatureFileIODriver(FeatureFileIOPtr _driver)
For each feature file format register the appropriate driver through this static method.
static FeatureFileIOPtr FileFormatFromStr(const KKStr &_fileFormatStr)
static KKStr FileFormatsWrittenOptionsStr()
virtual void SaveFile(FeatureVectorList &_data, const KKStr &_fileName, FeatureNumListConst &_selFeatures, std::ostream &_out, kkuint32 &_numExamplesWritten, VolConstBool &_cancelFlag, bool &_successful, KKStr &_errorMessage, RunLog &_log)=0
To be implemented by derived classes; save examples to output stream '_out'.
Used for logging messages.
void EncodeProblem(const struct svm_paramater ¶m, struct svm_problem &prob_in, struct svm_problem &prob_out)
static KKStr FileFormatsReadOptionsStr()
FeatureFileIO * FeatureFileIOPtr
Responsible for creating a FeatureFectorProducer instance.
Maintains a list of MLClass instances.
static KKStr FileFormatsReadAndWriteOptionsStr()
FeatureVectorList * FeatureVectorListPtr
Represents a Feature Vector of a single example, labeled or unlabeled.
virtual FeatureVectorListPtr FeatureDataReSink(FactoryFVProducerPtr _fvProducerFactory, const KKStr &_dirName, const KKStr &_fileName, MLClassPtr _unknownClass, bool _useDirectoryNameForClassName, MLClassList &_mlClasses, VolConstBool &_cancelFlag, bool &_changesMade, KKB::DateTime &_timeStamp, RunLog &_log)
Synchronizes the contents of a feature data file with a directory of images.
static void RegisterDriver(FeatureFileIOPtr driver)
void AppendToFile(const KKStr &_fileName, FeatureNumListConst &_selFeatures, FeatureVectorList &_examples, kkuint32 &_numExamplesWritten, VolConstBool &_cancelFlag, bool &_successful, RunLog &log)
const KKStr & DriverName()
FactoryFVProducer * FactoryFVProducerPtr
FeatureFileIO(const KKStr &_driverName, bool _canRead, bool _canWrite)
static FeatureFileIOPtr FileFormatFromStr(const KKStr &_fileFormatStr, bool _canRead, bool _canWrite)
volatile const bool VolConstBool