本文整理汇总了C++中Booster::setModel方法的典型用法代码示例。如果您正苦于以下问题:C++ Booster::setModel方法的具体用法?C++ Booster::setModel怎么用?C++ Booster::setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booster
的用法示例。
在下文中一共展示了Booster::setModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: predictWithChannel
// Prediction
// Accepts a single integral image/channel, thus only to be used for testing
// Assumes that predPtr is already allocated, of same size as imgPtr
DLL_EXPORT
void predictWithChannel( void *modelPtr, ImagePixelType *imgPtr,
IntegralImagePixelType *chImgPtr,
int width, int height, int depth,
PredictionPixelType *predPtr )
{
Matrix3D<PredictionPixelType> predMatrix;
predMatrix.fromSharedData( predPtr, width, height, depth );
// create roi for image, no GT available
ROIData roi;
roi.init( imgPtr, 0, 0, 0, width, height, depth );
// get the precomputed integral images
ROIData::IntegralImageType ii;
ii.fromSharedData(chImgPtr, width, height, depth);
roi.addII( ii.internalImage().data() );
MultipleROIData allROIs;
allROIs.add( shared_ptr_nodelete(ROIData, &roi) );
Booster adaboost;
adaboost.setModel( *((BoosterModel *) modelPtr) );
adaboost.predict<false>( allROIs, &predMatrix );
}
示例2: predictWithChannels
// Prediction for a single ROI
// Accepts an arbitrary number of integral images/channels.
// Assumes that predPtr is already allocated, of same size as imgPtr
// Returns 0 if ok
DLL_EXPORT
int predictWithChannels( void *modelPtr, ImagePixelType *imgPtr,
void *eigVecImgPtr,
int width, int height, int depth,
IntegralImagePixelType **chImgPtr,
int numChannels, double zAnisotropyFactor,
int useEarlyStopping,
int useROI, int x1, int y1, int z1, int x2, int y2, int z2, // used only if useROI != 0
PredictionPixelType *predPtr )
{
Matrix3D<PredictionPixelType> predMatrix;
predMatrix.fromSharedData( predPtr, width, height, depth );
// create roi for image, no GT available
ROIData roi;
roi.init( imgPtr, 0, 0, 0, width, height, depth, zAnisotropyFactor, 0.0, (const ROIData::RotationMatrixType *) eigVecImgPtr );
std::unique_ptr<ROIData::IntegralImageType[]> ii(new ROIData::IntegralImageType[numChannels]); // TODO: remove
for (int ch=0; ch < numChannels; ch++)
{
ii[ch].fromSharedData(chImgPtr[ch], width, height, depth);
roi.addII( ii[ch].internalImage().data() );
}
MultipleROIData allROIs;
allROIs.add( shared_ptr_nodelete(ROIData, &roi) );
try
{
Booster adaboost;
adaboost.setModel( *((BoosterModel *) modelPtr) );
if(useEarlyStopping != 0)
{
if (useROI)
{
ROICoordinates subROI;
subROI.x1 = x1; subROI.y1 = y1; subROI.z1 = z1;
subROI.x2 = x2; subROI.y2 = y2; subROI.z2 = z2;
adaboost.predictWithFeatureOrdering<true>( allROIs, &predMatrix, 0, IIBOOST_NUM_THREADS, &subROI );
}
else
adaboost.predictWithFeatureOrdering<true>( allROIs, &predMatrix );
}
else
adaboost.predictWithFeatureOrdering<false>( allROIs, &predMatrix );
}
catch( std::exception &e )
{
printf("Error in prediction: %s\n", e.what());
return -1;
}
return 0;
}
示例3: predictIndividualWeakLearnersWithChannels
DLL_EXPORT
int predictIndividualWeakLearnersWithChannels( void *modelPtr, ImagePixelType *imgPtr,
void *eigVecImgPtr,
int width, int height, int depth,
IntegralImagePixelType **chImgPtr,
int numChannels, double zAnisotropyFactor,
WLPredictionPixelType **predPtr)
{
BoosterModel* model = static_cast<BoosterModel*>(modelPtr);
int numWL = model->size();
Matrix3D<WLPredictionPixelType> predMatrix[numWL]; // TODO: remove
for(int i=0; i < numWL; ++i)
predMatrix[i].fromSharedData(predPtr[i], width, height, depth);
// create roi for image, no GT available
ROIData roi;
roi.init( imgPtr, 0, 0, 0, width, height, depth, zAnisotropyFactor, 0.0, (const ROIData::RotationMatrixType *) eigVecImgPtr );
ROIData::IntegralImageType ii[numChannels]; // TODO: remove
for (int ch=0; ch < numChannels; ch++)
{
ii[ch].fromSharedData(chImgPtr[ch], width, height, depth);
roi.addII( ii[ch].internalImage().data() );
}
MultipleROIData allROIs;
allROIs.add( shared_ptr_nodelete(ROIData, &roi) );
try
{
Booster adaboost;
adaboost.setModel(*model);
adaboost.predictIndividualWeakLearners(allROIs, predMatrix);
}
catch( std::exception &e )
{
printf("Error in prediction: %s\n", e.what());
return -1;
}
return 0;
}