123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- #ifndef SemSegContextTree3DINCLUDE
- #define SemSegContextTree3DINCLUDE
- #include <core/vector/VVector.h>
- #include <vislearning/classifier/fpclassifier/gphik/FPCGPHIK.h>
- #include <segmentation/RegionSegmentationMethod.h>
- #include "SemanticSegmentation.h"
- #include "operations/SimpleOperationPool.h"
- #include "operations/RegionOperationPool.h"
- #include "operations/RectangleOperationPool.h"
- namespace OBJREC
- {
- class SemSegContextTree3D : public SemanticSegmentation
- {
- private:
-
- RegionSegmentationMethod *segmentation;
-
- std::vector<std::vector<TreeNode> > forest;
-
- bool useFeat0, useFeat1, useFeat2, useFeat3, useFeat4;
-
- std::vector<int> featTypes;
-
- int nbTrees;
-
- int maxSamples;
-
- int windowSize;
-
- int featsPerSplit;
-
-
-
- std::map<int, int> labelmap;
-
- std::map<int, int> labelmapback;
-
- std::vector<double> a;
-
- int minFeats;
-
- int maxDepth;
-
- int depth;
-
- int randomTests;
- int labelIncrement;
-
- std::vector<OperationPool*> ops;
-
- bool useShannonEntropy;
-
- ClassNames classnames;
-
- std::set<int> forbidden_classes;
-
- const NICE::Config *conf;
-
- bool pixelWiseLabeling;
-
- bool useAltTristimulus;
-
- bool useGradient;
-
- bool useAdditionalLayer;
-
- int numAdditionalLayer;
-
- bool useCategorization;
-
- std::string cndir;
-
- std::vector<std::vector<int> > channelsPerType;
-
-
- bool saveLoadData;
-
- std::string fileLocation;
-
- bool firstiteration;
-
- int rawChannels;
-
- OBJREC::FPCGPHIK *fasthik;
-
- int uniquenumber;
-
-
- void initOperations();
-
- void updateProbabilityMaps ( const NICE::MultiChannelImage3DT<unsigned short int> &nodeIndices, NICE::MultiChannelImage3DT<double> &feats, int firstChannel );
-
- void computeRayFeatImage ( NICE::MultiChannelImage3DT<double> &feats, int firstChannel );
-
- void addFeatureMaps ( NICE::MultiChannelImage3DT<double> &imgData, const std::vector<std::string> &filelist, int &amountRegions );
-
- double getBestSplit ( std::vector<NICE::MultiChannelImage3DT<double> > &feats, std::vector<NICE::MultiChannelImage3DT<unsigned short int> > &nodeIndices, const std::vector<NICE::MultiChannelImageT<int> > &labels, int node, Operation3D *&splitop, double &splitval, const int &tree, std::vector<std::vector<std::vector<double> > > ®ionProbs );
-
- inline double getMeanProb ( const int &x, const int &y, const int &z, const int &channel, const NICE::MultiChannelImage3DT<unsigned short int> &nodeIndices );
- public:
-
- SemSegContextTree3D ();
-
- SemSegContextTree3D ( const NICE::Config *conf,
- const ClassNames *classNames );
-
- virtual ~SemSegContextTree3D();
-
- void classify ( const std::vector<std::string> & filelist,
- NICE::MultiChannelImageT<int> & segresult,
- NICE::MultiChannelImage3DT<double> & probabilities );
-
- void train ( const LabeledSet * trainp );
-
- void train ( const MultiDataset *md );
-
- void semanticseg ( CachedExample *ce,
- NICE::ImageT<int> & segresult,
- NICE::MultiChannelImageT<double> & probabilities )
- {}
- void semanticseg ( CachedExample *ce,
- NICE::MultiChannelImageT<int> & segresult,
- NICE::MultiChannelImage3DT<double> & probabilities )
- {}
- void printFeatureStatistics();
-
- bool active3DMode ()
- {
- return run3Dseg;
- }
-
- virtual void restore ( std::istream & is, int format = 0 );
-
- virtual void store ( std::ostream & os, int format = 0 ) const;
-
- virtual void clear () {}
- };
- }
- #endif
|