Boring changes - ml.

This commit is contained in:
Roman Donchenko 2013-08-13 17:35:25 +04:00
parent 1eacb485c5
commit 345bc633cc
3 changed files with 13 additions and 13 deletions

View File

@ -2148,7 +2148,7 @@ typedef CvANN_MLP NeuralNet_MLP;
typedef CvGBTreesParams GradientBoostingTreeParams; typedef CvGBTreesParams GradientBoostingTreeParams;
typedef CvGBTrees GradientBoostingTrees; typedef CvGBTrees GradientBoostingTrees;
template<> CV_EXPORTS void Ptr<CvDTreeSplit>::delete_obj(); template<> CV_EXPORTS void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const;
CV_EXPORTS bool initModule_ml(void); CV_EXPORTS bool initModule_ml(void);
} }

View File

@ -126,7 +126,7 @@ void ForestTreeBestSplitFinder::operator()(const BlockedRange& range)
} }
if( res && bestSplit->quality < split->quality ) if( res && bestSplit->quality < split->quality )
memcpy( (CvDTreeSplit*)bestSplit, (CvDTreeSplit*)split, splitSize ); memcpy( bestSplit.get(), split.get(), splitSize );
} }
} }
} }

View File

@ -1882,7 +1882,7 @@ double CvDTree::calc_node_dir( CvDTreeNode* node )
namespace cv namespace cv
{ {
template<> CV_EXPORTS void Ptr<CvDTreeSplit>::delete_obj() template<> CV_EXPORTS void DefaultDeleter<CvDTreeSplit>::operator ()(CvDTreeSplit* obj) const
{ {
fastFree(obj); fastFree(obj);
} }
@ -1893,12 +1893,12 @@ DTreeBestSplitFinder::DTreeBestSplitFinder( CvDTree* _tree, CvDTreeNode* _node)
node = _node; node = _node;
splitSize = tree->get_data()->split_heap->elem_size; splitSize = tree->get_data()->split_heap->elem_size;
bestSplit = (CvDTreeSplit*)fastMalloc(splitSize); bestSplit.reset((CvDTreeSplit*)fastMalloc(splitSize));
memset((CvDTreeSplit*)bestSplit, 0, splitSize); memset(bestSplit.get(), 0, splitSize);
bestSplit->quality = -1; bestSplit->quality = -1;
bestSplit->condensed_idx = INT_MIN; bestSplit->condensed_idx = INT_MIN;
split = (CvDTreeSplit*)fastMalloc(splitSize); split.reset((CvDTreeSplit*)fastMalloc(splitSize));
memset((CvDTreeSplit*)split, 0, splitSize); memset(split.get(), 0, splitSize);
//haveSplit = false; //haveSplit = false;
} }
@ -1908,10 +1908,10 @@ DTreeBestSplitFinder::DTreeBestSplitFinder( const DTreeBestSplitFinder& finder,
node = finder.node; node = finder.node;
splitSize = tree->get_data()->split_heap->elem_size; splitSize = tree->get_data()->split_heap->elem_size;
bestSplit = (CvDTreeSplit*)fastMalloc(splitSize); bestSplit.reset((CvDTreeSplit*)fastMalloc(splitSize));
memcpy((CvDTreeSplit*)(bestSplit), (const CvDTreeSplit*)finder.bestSplit, splitSize); memcpy(bestSplit.get(), finder.bestSplit.get(), splitSize);
split = (CvDTreeSplit*)fastMalloc(splitSize); split.reset((CvDTreeSplit*)fastMalloc(splitSize));
memset((CvDTreeSplit*)split, 0, splitSize); memset(split.get(), 0, splitSize);
} }
void DTreeBestSplitFinder::operator()(const BlockedRange& range) void DTreeBestSplitFinder::operator()(const BlockedRange& range)
@ -1944,14 +1944,14 @@ void DTreeBestSplitFinder::operator()(const BlockedRange& range)
} }
if( res && bestSplit->quality < split->quality ) if( res && bestSplit->quality < split->quality )
memcpy( (CvDTreeSplit*)bestSplit, (CvDTreeSplit*)split, splitSize ); memcpy( bestSplit.get(), split.get(), splitSize );
} }
} }
void DTreeBestSplitFinder::join( DTreeBestSplitFinder& rhs ) void DTreeBestSplitFinder::join( DTreeBestSplitFinder& rhs )
{ {
if( bestSplit->quality < rhs.bestSplit->quality ) if( bestSplit->quality < rhs.bestSplit->quality )
memcpy( (CvDTreeSplit*)bestSplit, (CvDTreeSplit*)rhs.bestSplit, splitSize ); memcpy( bestSplit.get(), rhs.bestSplit.get(), splitSize );
} }
} }