Files
004_comission/vinniesniper-54816/task1/_lab/007-train-beach-test2/step2.py
louiscklaw b3cc8e8323 update,
2025-01-31 22:57:47 +08:00

16 lines
887 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
# numPos和numNeg是训练时每一层的样本数numPos可以小于vec中的数目推荐numNeg可以大于实际数目
# maxFalseAlarmRate是训练时的FA只有小于它才会进入下一层
# 网上推荐numPosnumNeg=13
# 正样本用vec描述负样本用txt指明路径即可
# xml目录需要自己提前创建
# 训练时出现的列表中N训练层数HR命中率FA警告FA<maxFalseAlarmRate进入下一层
# 负样本不用指定图中:目标个数Xmin,Ymin,Xmax,Ymax。训练时会自动resize
# os.system("opencv_traincascade.exe -data xml -vec pos.vec -bg neg.txt -numPos 90 -numNeg 198 -numStages 20 -w 20 -h 20 -maxFalseAlarmRate 0.5 -mode ALL")
os.system(
"opencv_traincascade -data xml -vec pos.vec -bg neg.txt -numPos 90 -numNeg 198 -numStages 20 -w 20 -h 20 -maxFalseAlarmRate 0.5 -mode ALL"
)
os.system("pause")