|
@@ -8,17 +8,24 @@
|
|
|
#ifndef SEMANTICSEGMENTATIONINCLUDE
|
|
|
#define SEMANTICSEGMENTATIONINCLUDE
|
|
|
|
|
|
+// standard library includes
|
|
|
+#include <vector>
|
|
|
+
|
|
|
// nice-core includes
|
|
|
#include <core/basics/Persistent.h>
|
|
|
-
|
|
|
-#include <vector>
|
|
|
#include "core/image/MultiChannelImage3DT.h"
|
|
|
+
|
|
|
+// nice-vislearning includes
|
|
|
#include "vislearning/cbaselib/MultiDataset.h"
|
|
|
#include "vislearning/cbaselib/LocalizationResult.h"
|
|
|
#include "vislearning/cbaselib/CachedExample.h"
|
|
|
#include "vislearning/cbaselib/Example.h"
|
|
|
|
|
|
|
|
|
+#define ROADWORKSADD fthrow(NICE::Exception, "addNewExample(const NICE::Vector & newExample, const int & newClassNo): not yet implemented!");
|
|
|
+#define ROADWORKSADDNOVEL fthrow(NICE::Exception, "addNovelExamples(): not yet implemented!");
|
|
|
+#define ROADWORKSGETNOVEL fthrow(NICE::Exception, "getNovelExamples(): not yet implemented!");
|
|
|
+
|
|
|
namespace OBJREC
|
|
|
{
|
|
|
|
|
@@ -27,6 +34,13 @@ class SemanticSegmentation : public NICE::Persistent
|
|
|
{
|
|
|
|
|
|
protected:
|
|
|
+
|
|
|
+ /////////////////////////
|
|
|
+ /////////////////////////
|
|
|
+ // PROTECTED VARIABLES //
|
|
|
+ /////////////////////////
|
|
|
+ /////////////////////////
|
|
|
+
|
|
|
/** accessible class names and information about
|
|
|
number of classes etc. */
|
|
|
const ClassNames *classNames;
|
|
@@ -43,13 +57,22 @@ class SemanticSegmentation : public NICE::Persistent
|
|
|
|
|
|
int iterationCountSuffix;
|
|
|
|
|
|
+ /////////////////////////
|
|
|
+ /////////////////////////
|
|
|
+ // PROTECTED METHODS //
|
|
|
+ /////////////////////////
|
|
|
+ /////////////////////////
|
|
|
+
|
|
|
public:
|
|
|
|
|
|
///////////////////// ///////////////////// /////////////////////
|
|
|
// CONSTRUCTORS / DESTRUCTORS
|
|
|
///////////////////// ///////////////////// /////////////////////
|
|
|
|
|
|
- /** default constructor */
|
|
|
+ /** default constructor
|
|
|
+ * @author Alexander Freytag
|
|
|
+ * @date 06-02-2014 ( dd-mm-yyy )
|
|
|
+ */
|
|
|
SemanticSegmentation ( );
|
|
|
|
|
|
/** simple constructor
|
|
@@ -74,6 +97,22 @@ class SemanticSegmentation : public NICE::Persistent
|
|
|
// SEGMENTATION STUFF
|
|
|
///////////////////// ///////////////////// /////////////////////
|
|
|
|
|
|
+ /** load img from file call localize(CachedExample *ce) etc. */
|
|
|
+ void semanticseg ( const std::string & filename,
|
|
|
+ NICE::Image & segresult,
|
|
|
+ NICE::MultiChannelImageT<double> & probabilities );
|
|
|
+
|
|
|
+ /** this function has to be overloaded by all subclasses
|
|
|
+ @param ce image data
|
|
|
+ @param segresult result of the semantic segmentation with a label for each
|
|
|
+ pixel
|
|
|
+ @param probabilities multi-channel image with one channel for each class and
|
|
|
+ corresponding probabilities for each pixel
|
|
|
+ */
|
|
|
+ virtual void semanticseg ( OBJREC::CachedExample *ce,
|
|
|
+ NICE::Image & segresult,
|
|
|
+ NICE::MultiChannelImageT<double> & probabilities ) = 0;
|
|
|
+
|
|
|
/**
|
|
|
* @brief Classification function (has to be overloaded by all subclasses)
|
|
|
* @author Sven Sickert
|
|
@@ -113,13 +152,44 @@ class SemanticSegmentation : public NICE::Persistent
|
|
|
void convertVVectorToExamples ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
|
|
|
void convertExamplesToVVector ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
|
|
|
void convertExamplesToLSet ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
|
|
|
- void convertLSetToExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
|
|
|
+ void convertLSetToExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec, const bool & removeOldDataPointer=false );
|
|
|
void convertLSetToSparseExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ///////////////////// ///////////////////// /////////////////////
|
|
|
+ // ONLINE LEARNING
|
|
|
+ ///////////////////// ///////////////////// /////////////////////
|
|
|
+
|
|
|
+ virtual void addNewExample(const NICE::Vector & newExample, const int & newClassNo)
|
|
|
+ {
|
|
|
+ ROADWORKSADD;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @brief Add those examples, which belong to the most novel region seen so far
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ **/
|
|
|
+ virtual void addNovelExamples()
|
|
|
+ {
|
|
|
+ ROADWORKSADDNOVEL;
|
|
|
+ }
|
|
|
+
|
|
|
///////////////////// ///////////////////// /////////////////////
|
|
|
// GET / SET
|
|
|
///////////////////// ///////////////////// /////////////////////
|
|
|
|
|
|
+ /**
|
|
|
+ * @brief Get a pointer to the examples extracted from the most novel region seen so far
|
|
|
+ *
|
|
|
+ * @return Examples *
|
|
|
+ **/
|
|
|
+ virtual const Examples * getNovelExamples() const
|
|
|
+ {
|
|
|
+ ROADWORKSGETNOVEL;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @brief Collect information about the depth of 3d images
|
|
|
* @author Sven Sickert
|