博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Write and read opencv3.0 ml files(random forest)
阅读量:2089 次
发布时间:2019-04-29

本文共 1010 字,大约阅读时间需要 3 分钟。

using namespace cv;using namespace std;int main(){
{
auto rtrees = cv::ml::RTrees::create(); rtrees->setMaxDepth(10); rtrees->setMinSampleCount(2); rtrees->setRegressionAccuracy(0); rtrees->setUseSurrogates(false); rtrees->setMaxCategories(16); rtrees->setPriors(cv::Mat()); rtrees->setCalculateVarImportance(false); rtrees->setActiveVarCount(0); rtrees->setTermCriteria({
cv::TermCriteria::MAX_ITER, 100, 0 }); // Some dummy stuff here... Mat1f feat(1, 5, 0.f); Mat1f labels = (Mat1f(1, 5) << 1, 0, 1, 0, 1); rtrees->train(feat, cv::ml::ROW_SAMPLE, labels); rtrees->write(cv::FileStorage("smoke_classifier.xml", cv::FileStorage::WRITE)); } {
auto rtrees2 = cv::ml::RTrees::create(); cv::FileStorage read("smoke_classifier.xml", cv::FileStorage::READ); rtrees2->read(read.root()); int a = rtrees2->getMinSampleCount(); } return 0;}

转载地址:http://fgmqf.baihongyu.com/

你可能感兴趣的文章
【托业】【新东方全真模拟】01~02-----P5~6
查看>>
【托业】【新东方全真模拟】03~04-----P5~6
查看>>
【托业】【新东方托业全真模拟】TEST05~06-----P5~6
查看>>
【托业】【新东方托业全真模拟】TEST09~10-----P5~6
查看>>
【托业】【新东方托业全真模拟】TEST07~08-----P5~6
查看>>
solver及其配置
查看>>
JAVA多线程之volatile 与 synchronized 的比较
查看>>
Java集合框架知识梳理
查看>>
笔试题(一)—— java基础
查看>>
Redis学习笔记(三)—— 使用redis客户端连接windows和linux下的redis并解决无法连接redis的问题
查看>>
Intellij IDEA使用(一)—— 安装Intellij IDEA(ideaIU-2017.2.3)并完成Intellij IDEA的简单配置
查看>>
Intellij IDEA使用(二)—— 在Intellij IDEA中配置JDK(SDK)
查看>>
Intellij IDEA使用(三)——在Intellij IDEA中配置Tomcat服务器
查看>>
Intellij IDEA使用(四)—— 使用Intellij IDEA创建静态的web(HTML)项目
查看>>
Intellij IDEA使用(五)—— Intellij IDEA在使用中的一些其他常用功能或常用配置收集
查看>>
Intellij IDEA使用(六)—— 使用Intellij IDEA创建Java项目并配置jar包
查看>>
Eclipse使用(十)—— 使用Eclipse创建简单的Maven Java项目
查看>>
Eclipse使用(十一)—— 使用Eclipse创建简单的Maven JavaWeb项目
查看>>
Intellij IDEA使用(十三)—— 在Intellij IDEA中配置Maven
查看>>
面试题 —— 关于main方法的十个面试题
查看>>