本文整理汇总了Python中trainer.Trainer.do_the_train方法的典型用法代码示例。如果您正苦于以下问题:Python Trainer.do_the_train方法的具体用法?Python Trainer.do_the_train怎么用?Python Trainer.do_the_train使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trainer.Trainer
的用法示例。
在下文中一共展示了Trainer.do_the_train方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_face_set
# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import do_the_train [as 别名]
imgs = []
# for each person grab a training set of images
# and generate a list of labels.
for name in names:
myStr = "Training for : " + name
iset = get_face_set(cam, myStr)
imgs += iset
labels += [name for i in range(0,len(iset))]
time.sleep(waitTime)
# Create, train, and save the recognizer.
t = Trainer()
t.labels = labels
t.images = imgs
f = t.do_the_train()
# f = FaceRecognizer()
# print f.train(imgs, labels)
# f.save("test.csv")
# show the results
disp = Display((640,480))
while disp.isNotDone():
try:
img = cam.getImage()
fs = img.findHaarFeatures('face.xml')
if fs is not None and fs != []:
fs = fs.sortArea()
face = fs[-1].crop().resize(100,100)
fs[-1].draw()