使用opencv训练分类器时,traincascade训练报错:Train dataset for temp stage can not be filled.解决方法
opencv分类器训练中,出错一般都是路径出错,例如,
1.opencv_traincascade.exe路径
2.负样本路径文件,neg.dat中的样本前路径是否正确
3.移植到别的电脑并修改完路径后,最好重新生成正样本描述文件,pos.vec
4.同时修改cmd命令中的相关路径
5.我总感觉cmd命令或者opencv训练程序有记忆功能,修改了参数还是训练报错,我一般会重启电脑,或者将cmd命令薄.bat文件修改个名字
6.附录训练时的各种参数
Command line arguments of opencv_traincascade application grouped by purposes:
- Common arguments:
-data <cascade_dir_name>
: Where the trained classifier should be stored. This folder should be created manually beforehand.-vec <vec_file_name>
: vec-file with positive samples (created by opencv_createsamples utility).-bg <background_file_name>
: Background description file. This is the file containing the negative sample images.-numPos <number_of_positive_samples>
: Number of positive samples used in training for every classifier stage.-numNeg <number_of_negative_samples>
: Number of negative samples used in training for every classifier stage.-numStages <number_of_stages>
: Number of cascade stages to be trained.-precalcValBufSize <precalculated_vals_buffer_size_in_Mb>
: Size of buffer for precalculated feature values (in Mb). The more memory you assign the faster the training process, however keep in mind that-precalcValBufSize
and-precalcIdxBufSize
combined should not exceed you available system memory.-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb>
: Size of buffer for precalculated feature indices (in Mb). The more memory you assign the faster the training process, however keep in mind that-precalcValBufSize
and-precalcIdxBufSize
combined should not exceed you available system memory.-baseFormatSave
: This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format. This is only available for backwards compatibility reasons and to allow users stuck to the old deprecated interface, to at least train models using the newer interface.-numThreads <max_number_of_threads>
: Maximum number of threads to use during training. Notice that the actual number of used threads may be lower, depending on your machine and compilation options. By default, the maximum available threads are selected if you built OpenCV with TBB support, which is needed for this optimization.-acceptanceRatioBreakValue <break_value>
: This argument is used to determine how precise your model should keep learning and when to stop. A good guideline is to train not further than 10e-5, to ensure the model does not overtrain on your training data. By default this value is set to -1 to disable this feature.
- Cascade parameters:
-stageType <BOOST(default)>
: Type of stages. Only boosted classifiers are supported as a stage type at the moment.-featureType<{HAAR(default), LBP}>
: Type of features: HAAR - Haar-like features, LBP - local binary patterns.-w <sampleWidth>
: Width of training samples (in pixels). Must have exactly the same value as used during training samples creation (opencv_createsamples utility).-h <sampleHeight>
: Height of training samples (in pixels). Must have exactly the same value as used during training samples creation (opencv_createsamples utility).
- Boosted classifer parameters:
-bt <{DAB, RAB, LB, GAB(default)}>
: Type of boosted classifiers: DAB - Discrete AdaBoost, RAB - Real AdaBoost, LB - LogitBoost, GAB - Gentle AdaBoost.-minHitRate <min_hit_rate>
: Minimal desired hit rate for each stage of the classifier. Overall hit rate may be estimated as (min_hit_rate ^ number_of_stages), [180] §4.1.-maxFalseAlarmRate <max_false_alarm_rate>
: Maximal desired false alarm rate for each stage of the classifier. Overall false alarm rate may be estimated as (max_false_alarm_rate ^ number_of_stages), [180] §4.1.-weightTrimRate <weight_trim_rate>
: Specifies whether trimming should be used and its weight. A decent choice is 0.95.-maxDepth <max_depth_of_weak_tree>
: Maximal depth of a weak tree. A decent choice is 1, that is case of stumps.-maxWeakCount <max_weak_tree_count>
: Maximal count of weak trees for every cascade stage. The boosted classifier (stage) will have so many weak trees (<=maxWeakCount), as needed to achieve the given-maxFalseAlarmRate
.
- Haar-like feature parameters:
-mode <BASIC (default) | CORE | ALL>
: Selects the type of Haar features set used in training. BASIC use only upright features, while ALL uses the full set of upright and 45 degree rotated feature set. See [103] for more details.
- Local Binary Patterns parameters: Local Binary Patterns don't have parameters.
After the opencv_traincascade application has finished its work, the trained cascade will be saved in cascade.xml
file in the -data
folder. Other files in this folder are created for the case of interrupted training, so you may delete them after completion of training.
Training is finished and you can test your cascade classifier!
Visualising Cascade Classifiers
From time to time it can be usefull to visualise the trained cascade, to see which features it selected and how complex its stages are. For this OpenCV supplies a opencv_visualisation application. This application has the following commands:
--image
(required) : path to a reference image for your object model. This should be an annotation with dimensions [-w
,-h
] as passed to both opencv_createsamples and opencv_traincascade application.--model
(required) : path to the trained model, which should be in the folder supplied to the-data
parameter of the opencv_traincascade application.--data
(optional) : if a data folder is supplied, which has to be manually created beforehand, stage output and a video of the features will be stored.
知识付费时代,觉得对您有帮助的,别忘了打赏,附微信收款码
使用opencv训练分类器时,traincascade训练报错:Train dataset for temp stage can not be filled.解决方法的更多相关文章
- 输入指令npx webpack-dev-server报错:Error: Cannot find module ‘webpack-cli/bin/config-yargs‘的解决方法
输入指令npx webpack-dev-server报错:Error: Cannot find module 'webpack-cli/bin/config-yargs'的解决方法 输入指令:npx ...
- 运行python脚本时,报错InsecurePlatformWarning: A true SSLContext object is not available,解决方法
今天,要在新环境里运行一个python脚本,遇到下面的报错: /usr/lib/python2.7/site-packages/urllib3/util/ssl_.py:160: InsecurePl ...
- 小程序报错Do not have xx handler in current page的解决方法
看到小程序这一大串的“Do not have bindName handler in current page: pages/card/card. Please make sure that bind ...
- phpmyadmin登录报错crypt_random_string requires at least one symmetric cipher be loaded 解决方法
通过phpmyadmin登陆时提示以下错误: phpmyadmin crypt_random_string requires at least one symmetric cipher be load ...
- Myeclipse运行报错:an out of memory error has occurred的解决方法
不知道怎么了,重装的myeclipse2013,里边就放了一个项目,启动myeclipse就报 an out of memory error has occurred....... 一点yes就退出 ...
- centos在yum install报错:Another app is currently holding the yum lock解决方法
centos在yum install报错:Another app is currently holding the yum lock,这个问题可能是很多的新手经常遇到问题,之前也有人问我,包括本人在刚 ...
- Oracle 安装报错 [INS-06101] IP address of localhost could not be determined 解决方法[转]
--安装Oracle 11gR2,报错:[INS-06101] IP address of localhost could not be determined--------------------- ...
- JMeter3.0启动日志报错WARN - org.jmeterplugins.repository.Plugin: Unable to load class解决方法
解决方法: 通过sh find-in-jars 'HlsSampler' -d /data/apache-jmeter-3.0/lib/ext/确定这个class文件在哪个jar包 由于find-in ...
- Oracle 安装报错 [INS-06101] IP address of localhost could not be determined 解决方法
安装Oracle 11gR2,报错:[INS-06101] IP address of localhost could not be determined 出现这种错误是因为主机名和/etc/host ...
随机推荐
- 从输入URL到浏览器显示页面发生了哪些事情---个人理解
经典面试题:从输入URL到页面显示发生了哪些事情 以前一直都记不住,这次自己理解了一下 用自己的话总结了一次,不对的地方希望大佬给我指出来 1.主机通过DHCP协议获取客户端的IP地址.子网掩码和DN ...
- java之面向对象详解
#############java面向对象详解#############1.面向对象基本概念2.类与对象3.类和对象的定义格式4.对象与内存分析5.封装性6.构造方法7.this关键字8.值传递与引用 ...
- Elasticsearch由浅入深(一)
什么是Elasticsearch 什么是搜索 百度:我们比如说想找寻任何的信息的时候,就会上百度去搜索一下,比如说找一部自己喜欢的电影,或者说找一本喜欢的书,或者找一条感兴趣的新闻(提到搜索的第一印象 ...
- 最小生成树模板题-----P3366 【模板】最小生成树
题目描述 如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出orz 输入格式 第一行包含两个整数N.M,表示该图共有N个结点和M条无向边.(N<=5000,M<=200000) ...
- Sqlserver 锁表查询代码记录
--方法1WITH CTE_SID ( BSID, SID, sql_handle ) AS ( SELECT blocking_session_id , session_id , sql_handl ...
- SpringBoot Mybatis解决使用PageHelper一对多分页问题
一般来说使用 PageHelper 能解决绝大多数的分页问题,相关使用可在博客园上搜索,能找到很多资料. 之前我在做SpringBoot 项目时遇到这样一个问题,就是当一对多联合查询时需要分页的情况下 ...
- keras的get_value运行越来越慢的问题解决
https://blog.csdn.net/mingshili/article/details/81941677?utm_source=blogxgwz5
- Egret白鹭开发微信小游戏程序跳转功能(由一个小游戏跳转到另一个小游戏)
假设我们要实现的功能是从小游戏A跳转到小游戏B 对于小游戏A: (1)在platform.ts中添加代码如下: /** * 平台数据接口. * 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一 ...
- Leetcode之二分法专题-852. 山脉数组的峰顶索引(Peak Index in a Mountain Array)
Leetcode之二分法专题-852. 山脉数组的峰顶索引(Peak Index in a Mountain Array) 我们把符合下列属性的数组 A 称作山脉: A.length >= 3 ...
- Keras(四)CNN 卷积神经网络 RNN 循环神经网络 原理及实例
CNN 卷积神经网络 卷积 池化 https://www.cnblogs.com/peng8098/p/nlp_16.html 中有介绍 以数据集MNIST构建一个卷积神经网路 from keras. ...