21 #ifndef _BOOST_CLASSIFIER_H
22 #define _BOOST_CLASSIFIER_H
38 template<ClassifierType type,
class T>
60 template<
class Classifier >
87 template<
class R,
class P0,
class P1,
class P2>
90 m_weak_classifiers.reserve(src.
size() );
98 template<
class R,
class P1,
class P2>
101 m_weak_classifiers.reserve(src.
size() );
107 template<
class R,
class P1>
110 m_weak_classifiers.reserve(src.
size() );
120 return m_weak_classifiers.size();
126 return m_weak_classifiers;
129 return m_weak_classifiers;
134 return "additive-" + BoostedClassifierType::signature();
139 template<
class DataType>
143 for(
typename ClassifierListType::const_iterator i = m_weak_classifiers.begin(); i != m_weak_classifiers.end(); i++)
150 template<
class DataType,
class Param1>
151 inline float operator()(
const DataType data, Param1 p1)
const {
154 for(
typename ClassifierListType::const_iterator i = m_weak_classifiers.begin(); i != m_weak_classifiers.end(); i++)
155 acc += (*i)(data, p1);
160 template<
class FeatureType>
163 for(
typename ClassifierListType::const_iterator i = m_weak_classifiers.begin(); i != m_weak_classifiers.end(); i++)
164 i->export_features(out);
168 void load(std::istream & in);
171 void save(std::ostream & out)
const;
184 for(
typename ClassifierListType::const_iterator i = m_weak_classifiers.begin(); i != m_weak_classifiers.end(); i++)
191 m_weak_classifiers.push_back(classifier);
200 std::ostream & operator << (std::ostream & out, const BoostClassifier<T> & src);
214 std::ostream & operator << (std::ostream & out, const BoostClassifier<T> & src)
241 m_weak_classifiers.push_back(h);
263 std::sort(m_weak_classifiers.begin(), m_weak_classifiers.end(), sort_by_alpha<T> );
269 m_weak_classifiers.resize(size);
float operator()(const DataType data) const
Definition: BoostClassifier.h:140
a Voting Boostable classifier
BoostClassifier(const BoostClassifier< R > &src, P0 scale, P1 p1, P2 p2)
genera un BoostClassifier partendo da un altro BoostClassifier, ed eseguendo un rescaling di tutti i ...
Definition: BoostClassifier.h:88
ClassifierListType & list()
Return the inner list of classifier.
Definition: BoostClassifier.h:125
~BoostClassifier()
dtor
Definition: BoostClassifier.h:224
void resize(int size)
Reduce number of classifiers (remove the last or, after sort(), the low influence ones) ...
Definition: BoostClassifier.h:267
Definition: BoostClassifier.h:61
image/size TODO namespace
Definition: Types.h:39
void export_features(std::vector< FeatureType > &out) const
export all features;
Definition: BoostClassifier.h:161
void save(std::ostream &out) const
Definition: BoostClassifier.h:247
a traits to change the inner classifier form, to use or not a weighted one
Definition: BoostClassifier.h:39
int size() const
return the number of weak classifiers
Definition: BoostClassifier.h:119
BoostClassifier(const BoostClassifier< R > &src, const P1 &p1)
create and convert a classifier
Definition: BoostClassifier.h:108
BoostClassifier< typename Classifier::OptimizedType > OptimizedType
An Optimized Classifier.
Definition: BoostClassifier.h:72
float alpha
Weight associated to this classifier.
Definition: BoostableClassifier.h:43
BoostClassifier()
ctor
Definition: BoostClassifier.h:221
void load(std::istream &in)
Definition: BoostClassifier.h:233
float max_response() const
Definition: BoostClassifier.h:182
detail::traits< Classifier::Type, Classifier >::Boosted BoostedClassifierType
A Boosted Classifier (must be a "Real" Classifier)
Definition: BoostClassifier.h:66
static std::string signature()
propagate signature
Definition: BoostClassifier.h:133
void sort()
Definition: BoostClassifier.h:261
BoostClassifier(const BoostClassifier< R > &src, P1 p1, P2 p2)
create and convert a classifier
Definition: BoostClassifier.h:99
a real classifier return a number between -1,+1
Definition: Types.h:34
Definition: BoostableClassifier.h:40
a dicrete classifier returns {-1,+1}
Definition: Types.h:32
std::vector< BoostedClassifierType > ClassifierListType
List of Boosted classifier.
Definition: BoostClassifier.h:69
float operator()(const DataType data, Param1 p1) const
Definition: BoostClassifier.h:151