123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /**
- * @file ImageNetData.h
- * @author Erik Rodner
- * @date 02/03/2012
- */
- #ifndef _NICE_IMAGENETDATAINCLUDE
- #define _NICE_IMAGENETDATAINCLUDE
- #include <string>
- #include <core/vector/VectorT.h>
- #include <core/vector/SparseVector.h>
- #include <core/matlabAccess/MatFileIO.h>
- #include "vislearning/cbaselib/LabeledSet.h"
- namespace NICE {
-
- /** @class ImageNetData
- * wrapper class for matlab IO with ImageNet data
- *
- * @author Erik Rodner
- */
- class ImageNetData
- {
- protected:
- std::string imageNetRoot;
- std::vector< SparseVector > XPreload;
- Vector yPreload;
- public:
- /** simple constructor */
- ImageNetData( const std::string & imageNetRoot = "/home/dbv/bilder/imagenet/devkit-1.0/demo/" );
-
- /** simple destructor */
- virtual ~ImageNetData();
- /**
- * @brief get a bulk of (training) data with labels
- *
- * @param data feature vectors
- * @param y label vector
- * @param fileTag demo.<tag>.mat will be accessed
- * @param variableTag variables are named <tag>_instance_matrix and <tag>_label_vector
- */
- void getBatchData ( sparse_t & data, Vector & y, const std::string & fileTag = "train", const std::string & variableTag = "training" );
- /**
- * @brief load the data specified for later access using the get functions
- *
- * @param fileTag
- * @param variableTag
- */
- void preloadData ( const std::string & fileTag = "val", const std::string & variableTag = "testing" );
-
- /**
- * @brief load the data specified for later access using the get functions, give everything as a LabeledSetVector object which is usefull for objects of type KernelClassifier (as used in vislearning)
- *
- * @date 23-05-2012 (dd-mm-yyyy)
- * @param fileTag
- * @param variableTag
- * @param lsVector
- */
- void loadDataAsLabeledSetVector( OBJREC::LabeledSetVector & lsVector, const std::string & fileTag = "train", const std::string & variableTag = "training" );
- /**
- * @brief get a specific feature vector
- *
- * @param index index of the example
- * @return constant reference to the SparseVector
- */
- const SparseVector & getPreloadedExample ( int index ) const;
- /**
- * @brief get the label of a specific example
- *
- * @param index index of the example
- *
- * @return label of the example (can be continous)
- */
- double getPreloadedLabel ( int index ) const;
- /**
- * @brief get number of examples
- */
- int getNumPreloadedExamples () const;
-
- /**
- * @brief load external labels
- *
- * @param fn file name of the external labels
- * @param n number of examples, if this parameter is set to -1 we assume that
- * the data is already loaded
- */
- void loadExternalLabels ( const std::string & fn, int n = -1 );
-
- std::vector< SparseVector > getPreloadedData() { return XPreload;};
- NICE::Vector getPreloadedLabels()const {return yPreload;};
- };
- }
- #endif
|