Correction de ToS et monotonie des poids

This commit is contained in:
François Merciol 2018-08-27 13:46:51 +02:00
parent 38debae01f
commit 68491d83ec
7 changed files with 45 additions and 42 deletions

View File

@ -73,7 +73,8 @@ testB: init $(APG_OUT)
perf: perfA
perfA: init $(PRF_OUT)
$(PRF_OUT) MIN 32 20 1000000
# $(PRF_OUT) MIN 32 20 1000000
$(PRF_OUT) MIN 4 20 100000
init:
mkdir -p $(OUT_DIR) $(OBJ_DIR) $(LIB_DIR)

View File

@ -10,11 +10,12 @@
** Fonctions intégré depuis la dernière version
*** depuis version 1.0
- copier les valeurs de géolocalisation (de input vers output)
- vérifier coupure (avec sens de la monotonie)
- faire coupures suivant (A>, W<>, SD>, MOI>)
- sort W thresholds
- faire les features-profiles (L, mean, SD, A, MOI)
- copie des valeurs de géolocalisation (de input vers output)
- vérification des coupures (avec sens de la monotonie)
- coupures suivant (A>, W<>, SD>, MOI>)
- tride W thresholds
- features-profiles (L, mean, SD, A, MOI)
- correction de la monotonie des ToS
** Infos concernant le pattern de git de Triskele

View File

@ -45,7 +45,7 @@ namespace otb {
};
// ========================================
/*! Structure intégrant la façon dont est géré un poids pour un MinTree */
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree car la fonction calcul le poids minimum */
template <typename PixelT, typename WeightT> struct MinWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB;
@ -63,7 +63,7 @@ namespace otb {
};
// ========================================
/*! Structure intégrant la façon dont est géré un poids pour un MaxTree */
/*! Structure intégrant la façon dont est géré un poids pour un MinTree car la fonction calcul le poids maximum. */
template <typename PixelT, typename WeightT> struct MaxWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB;
@ -76,10 +76,15 @@ namespace otb {
};
// ========================================
/*! Structure intégrant la façon dont est géré un poids pour un AlphaTree */
/*! Structure intégrant la façon dont est géré un poids pour un AlphaTree car la fonction calcul la distance minimum (0 dans les feuilles) */
template <typename PixelT, typename WeightT> struct DiffWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB;
inline bool getDecr () const;
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
static inline void sort (Edge<WeightT> *edges, DimEdge count);
inline DiffWeight ();
inline DiffWeight (const PixelT *pixels, const Size &size);
inline DiffWeight (const DiffWeight &model, const PixelT *pixels, const Size &size);
@ -89,7 +94,7 @@ namespace otb {
};
// ========================================
/*! Structure intégrant la façon dont est géré un poids pour un TreeOfShape */
/*! Structure intégrant la façon dont est géré un poids pour un TreeOfShape car la fonction calcul la distance à la médiane (distance maximum dans les feuilles) */
template <typename PixelT, typename WeightT> struct MedianWeight : public WeightBase<PixelT, WeightT> {
typedef WeightBase<PixelT, WeightT> WB;
protected:
@ -97,11 +102,6 @@ namespace otb {
WeightT thresholdWeight;
public:
inline bool getDecr () const;
static inline bool isWeightInf (const WeightT &a, const WeightT &b);
static inline bool isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b);
static inline void sort (Edge<WeightT> *edges, DimEdge count);
inline const PixelT &getMedian () const;
inline const PixelT &getThresholdPixel () const;
inline const WeightT &getThresholdWeight () const;

View File

@ -187,6 +187,30 @@ MaxWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
}
// ========================================
template <typename PixelT, typename WeightT>
inline bool
DiffWeight<PixelT, WeightT>::getDecr () const {
return true;
}
template <typename PixelT, typename WeightT>
inline bool
DiffWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
return a > b;
}
template <typename PixelT, typename WeightT>
inline bool
DiffWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
return isWeightInf (a.weight, b.weight);
}
template <typename PixelT, typename WeightT>
inline void
DiffWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
std::sort (edges, edges+count, isEdgeInf);
}
template <typename PixelT, typename WeightT>
inline
DiffWeight<PixelT, WeightT>::DiffWeight ()
@ -219,30 +243,6 @@ DiffWeight<PixelT, WeightT>::getWeight (const Point &a, const Point &b) const {
}
// ========================================
template <typename PixelT, typename WeightT>
inline bool
MedianWeight<PixelT, WeightT>::getDecr () const {
return true;
}
template <typename PixelT, typename WeightT>
inline bool
MedianWeight<PixelT, WeightT>::isWeightInf (const WeightT &a, const WeightT &b) {
return a > b;
}
template <typename PixelT, typename WeightT>
inline bool
MedianWeight<PixelT, WeightT>::isEdgeInf (const Edge<WeightT> &a, const Edge<WeightT> &b) {
return isWeightInf (a.weight, b.weight);
}
template <typename PixelT, typename WeightT>
inline void
MedianWeight<PixelT, WeightT>::sort (Edge<WeightT> *edges, DimEdge count) {
std::sort (edges, edges+count, isEdgeInf);
}
template <typename PixelT, typename WeightT>
inline const PixelT &
MedianWeight<PixelT, WeightT>::getMedian () const {

View File

@ -31,7 +31,7 @@ void
perf (const Raster<PixelT> &raster, const GraphWalker &graphWalker, const TreeType &treeType, const unsigned int &coreCount) {
ArrayTreeBuilder<PixelT, WeightT> atb (raster, graphWalker, treeType);
Tree tree (coreCount);
WeightAttributes<PixelT> weightAttributes (tree);
WeightAttributes<PixelT> weightAttributes (tree, getDecrFromTreetype (treeType));
atb.buildTree (tree, weightAttributes);
tree.check (graphWalker.border);
}

View File

@ -252,7 +252,7 @@ void test () {
debug = true;
ArrayTreeBuilder<PixelT, WeightT> atb (raster, graphWalker, treeType);
Tree tree (coreCount);
WeightAttributes<PixelT> weightAttributes (tree);
WeightAttributes<PixelT> weightAttributes (tree, getDecrFromTreetype (treeType));
atb.buildTree (tree, weightAttributes);
tree.check (border);

View File

@ -28,10 +28,11 @@ fLambda (DimImg &nbItem, const FunctId &functId/* functId (id) */) {
template<typename FunctId>
inline void
fThread (double &inDuration, const DimImg &nbItem, const FunctId &functId/* functId (id) */) {
// One thread
#if INTEL_TBB_THREAD
using namespace tbb;
#pragma warning(disable: 588)
parallel_for (size_t (0), size_t (1), [&nbItem, &functId] (size_t idCopyValInThread) {
parallel_for (size_t (0), size_t (1), [&nbItem, &functId, &inDuration] (size_t idCopyValInThread) {
auto start = high_resolution_clock::now ();
for (DimImg x = 0; x < nbItem; ++x)
functId (x);