代码拉取完成,页面将自动刷新
同步操作将从 KX/疲劳驾驶预测 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# -*- coding: utf-8 -*-
import dlib
# options用于设置训练的参数和模式
options = dlib.simple_object_detector_training_options()
# Since faces are left/right symmetric we can tell the trainer to train a
# symmetric detector. This helps it get the most value out of the training
# data.
# 将训练集扩大一倍
options.add_left_right_image_flips = True
# 支持向量机的C参数,通常默认取为5.自己适当更改参数以达到最好的效果
options.C = 20
options.epsilon = 0.01
# 线程数,你电脑有4核的话就填4
options.num_threads = 8
#显示输出信息
options.be_verbose = True
# 获取路径
current_path = 'E:/dlib-master/tools/imglab/build/Release'
train_folder = current_path + '/cats_train/'
test_folder = current_path + '/cats_test/'
train_xml_path = train_folder + 'mydata1.xml'
test_xml_path = test_folder + 'phone.xml'
print("training file path:" + train_xml_path)
# print(train_xml_path)
print("testing file path:" + test_xml_path)
# print(test_xml_path)
# 开始训练
print("start training:")
dlib.train_simple_object_detector(train_xml_path, 'detector.svm', options)
print("Testing accuracy: {}".format(
dlib.test_simple_object_detector(test_xml_path, "detector.svm")))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。