haar+adaboost训练过程及遇到的问题

训练过程主要参考了一个博客
http://blog.csdn.net/wuxiaoyao12/article/details/39227189
训练过程中遇到很多问题。
1、运行了一会儿就结束了,当时忘记截屏,大概是这样的:提示:parameters cannt be written.the data/param.xml cannt be opened.查了一些资料说,这种情况要自己创建一个data文件夹,很多情况下data文件夹是自动创建的。果然,自己创建了一个data文件夹就好了。
2、
这里写图片描述


训练过程到7-stage就结束了。看了很多资料,感觉分类器是训练好了,不是出错,但是因为设置的-minHitRate不高,所以提早达到了要求就结束了,但是分类器的检测效果可能不会很好。另一方面训练样本也不多。
在一个网站看到的这段话,感觉讲的很有道理:
If you have a small number of data, you need less number of stages to achieve the required false alarm rate you set up. This means that the cascade classifier is “good enough” so it doesn’t have to grow further. The total false positive ratio is actually multiplied by every stage’s ratio, so after a point, the value is achieved.

In your options you set it up to 0.9. Consider making it higher, like 0.95 or more.

Apart from that, your datasets are small, so it’s easier for the algorithm to get good results when validating on them during training. The smaller the dataset, the easier for the classifier to be trained, so less stages are required. But this doesn’t mean that it’s better when running on real data. Also, if you keep the training size low and set a higher ratio, consider that the classifier will need more stages to finish and will be more complicated, but it’s very possible that it will be over-trained on the training set.

To conclude, if the nature of your positive and negatives that you have, is making them easy to seperate, then you don’t need so many samples. Of course that depends on what you are training the algorithm for. With your amount of samples, the 10 stages you put are a lot, so the algorithm terminates earlier (it’s not necessarily bad).

When I was training faces, I think I had around 1 thousand of positive (including all the rotations/deviations) and 2-3 thousands of negatives, to need a classifier of around 11-13 levels, if I remember correctly.

The tutorial of Naotoshi Neo had helped me a lot.

Also, what I noticed now, as Safir mentioned, you have too few negative samples comparing to the positive ones. The should be at least equal in number, preferably around 1.5 - 2 times more than the positives.
3、还有一种情况:训练到第6stage就卡住了,像死循环,后来退出来增加了一些负样本进去,好了。
这里写图片描述

最后训练好的cascade.xml拿来检测,发现效果不好
原因可能有(1)训练样本还不够多吧,我这里用了819张正样本,1060张负样本,训练的numStage =10
(2)detectmultiscale()这个函数的使用还要切磋

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Go语言(也称为Golang)是由Google开发的一种静态强类型、编译型的编程语言。它旨在成为一门简单、高效、安全和并发的编程语言,特别适用于构建高性能的服务器和分布式系统。以下是Go语言的一些主要特点和优势: 简洁性:Go语言的语法简单直观,易于学习和使用。它避免了复杂的语法特性,如继承、重载等,转而采用组合和接口来实现代码的复用和扩展。 高性能:Go语言具有出色的性能,可以媲美C和C++。它使用静态类型系统和编译型语言的优势,能够生成高效的机器码。 并发性:Go语言内置了对并发的支持,通过轻量级的goroutine和channel机制,可以轻松实现并发编程。这使得Go语言在构建高性能的服务器和分布式系统时具有天然的优势。 安全性:Go语言具有强大的类型系统和内存管理机制,能够减少运行时错误和内存泄漏等问题。它还支持编译时检查,可以在编译阶段就发现潜在的问题。 标准库:Go语言的标准库非常丰富,包含了大量的实用功能和工具,如网络编程、文件操作、加密解密等。这使得开发者可以更加专注于业务逻辑的实现,而无需花费太多时间在底层功能的实现上。 跨平台:Go语言支持多种操作系统和平台,包括Windows、Linux、macOS等。它使用统一的构建系统(如Go Modules),可以轻松地跨平台编译和运行代码。 开源和社区支持:Go语言是开源的,具有庞大的社区支持和丰富的资源。开发者可以通过社区获取帮助、分享经验和学习资料。 总之,Go语言是一种简单、高效、安全、并发的编程语言,特别适用于构建高性能的服务器和分布式系统。如果你正在寻找一种易于学习和使用的编程语言,并且需要处理大量的并发请求和数据,那么Go语言可能是一个不错的选择。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值