当前位置: 首页>>代码示例>>C++>>正文


C++ Booster::model方法代码示例

本文整理汇总了C++中Booster::model方法的典型用法代码示例。如果您正苦于以下问题:C++ Booster::model方法的具体用法?C++ Booster::model怎么用?C++ Booster::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Booster的用法示例。


在下文中一共展示了Booster::model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: trainWithChannels

    // input: multiple imgPtr, gtPtr (arrays of pointers)
    //          multiple img sizes
    // returns a BoosterModel *
    // -- BEWARE: this function is a mix of dirty tricks right now
    DLL_EXPORT
    void * trainWithChannels( ImagePixelType **imgPtr, 
                             void **evecPtr,
                             GTPixelType **gtPtr,
                             int *width, int *height, int *depth,
                             int numStacks,
                             IntegralImagePixelType **chImgPtr,
                             int numChannels, double zAnisotropyFactor,
                             int numStumps,
                             int gtNegativeLabel, int gtPositiveLabel,
                             int debugOutput )
    {

        BoosterModel *modelPtr = 0;

        try
        {
            std::unique_ptr<ROIData[]> rois(new ROIData[numStacks]);  // TODO: remove
            MultipleROIData allROIs;
            std::unique_ptr<ROIData::IntegralImageType[]> ii(new ROIData::IntegralImageType[numStacks*numChannels]);  // TODO: remove

            for (int i=0; i < numStacks; i++)
            {
                rois[i].setGTNegativeSampleLabel(gtNegativeLabel);
                rois[i].setGTPositiveSampleLabel(gtPositiveLabel);
                rois[i].init( imgPtr[i], gtPtr[i], 0, 0, width[i], height[i], depth[i], 
                              zAnisotropyFactor, 0.0, (const ROIData::RotationMatrixType *) evecPtr[i] );

                for (int ch=0; ch < numChannels; ch++)
                {
                   ii[i*numChannels+ch].fromSharedData(chImgPtr[i*numChannels+ch], width[i], height[i], depth[i]);

                   rois[i].addII( ii[i*numChannels+ch].internalImage().data() );
                }

                allROIs.add( shared_ptr_nodelete(ROIData, &rois[i]) );
            }

            BoosterInputData bdata;
            bdata.init( shared_ptr_nodelete(MultipleROIData, &allROIs) );
            bdata.showInfo();

            Booster adaboost;
            adaboost.setShowDebugInfo( debugOutput != 0 );

            adaboost.train( bdata, numStumps );

            // create by copying
            modelPtr = new BoosterModel( adaboost.model() );
        }
        catch( std::exception &e )
        {
            printf("Error training: %s\n", e.what());
            delete modelPtr;

            return 0;
        }

        return modelPtr;
    }
开发者ID:quimnuss,项目名称:iiboost,代码行数:64,代码来源:iiboost_python.cpp

示例2: train

    // input: multiple imgPtr, gtPtr (arrays of pointers)
    //        multiple img sizes
    // returns a BoosterModel *
    // -- BEWARE: this function is a mix of dirty tricks right now
    DLL_EXPORT
    void * train( ImagePixelType **imgPtr, GTPixelType **gtPtr, 
                  int *width, int *height, int *depth,
                  int numStacks,
                  int numStumps, int debugOutput )
    {
        BoosterModel *modelPtr = 0;

        try
        {
            std::unique_ptr<ROIData[]> rois(new ROIData[numStacks]);  // TODO: remove
            std::unique_ptr<ROIData::IntegralImageType[]> ii(new ROIData::IntegralImageType[numStacks]);  // TODO: remove
            MultipleROIData allROIs;

            for (int i=0; i < numStacks; i++)
            {
                rois[i].init( imgPtr[i], gtPtr[i], 0, 0, width[i], height[i], depth[i] );

                // raw image to integral image
                // TODO: this should be removed and passed directly to train()
                ii[i].compute( rois[i].rawImage );
                rois[i].addII( ii[i].internalImage().data() );

                allROIs.add( shared_ptr_nodelete(ROIData, &rois[i]) );
            }

            BoosterInputData bdata;
            bdata.init( shared_ptr_nodelete(MultipleROIData, &allROIs) );
            bdata.showInfo();

            Booster adaboost;
            adaboost.setShowDebugInfo( debugOutput != 0 );

            adaboost.train( bdata, numStumps );

            // create by copying
            modelPtr = new BoosterModel( adaboost.model() );
        }
        catch( std::exception &e )
        {
            printf("Error training: %s\n", e.what());
            delete modelPtr;
            
            return 0;
        }

        return modelPtr;
    }
开发者ID:quimnuss,项目名称:iiboost,代码行数:52,代码来源:iiboost_python.cpp


注:本文中的Booster::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。