91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 12.77MB
    文件類(lèi)型: .zip
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-07-30
  • 語(yǔ)言: Python
  • 標(biāo)簽: python??dlib??

資源簡(jiǎn)介

python dlib庫(kù),訓(xùn)練人臉的68個(gè)特征點(diǎn)檢測(cè)器。包含數(shù)據(jù)集,源碼。詳細(xì)可以參考我的博客:http://blog.csdn.net/hongbin_xu/article/details/78511923

資源截圖

代碼片段和文件信息

#?coding:?utf-8
#?
#???This?example?program?shows?how?to?use?dlib‘s?implementation?of?the?paper:
#???One?Millisecond?Face?Alignment?with?an?Ensemble?of?Regression?Trees?by
#???Vahid?Kazemi?and?Josephine?Sullivan?CVPR?2014

import?os
import?cv2
import?dlib
import?glob

current_path?=?os.getcwd()
faces_path?=?current_path?+?‘/examples/faces‘

#?訓(xùn)練部分
#?參數(shù)設(shè)置
options?=?dlib.shape_predictor_training_options()
options.oversampling_amount?=?300
options.nu?=?0.05
options.tree_depth?=?2
options.be_verbose?=?True

#?導(dǎo)入打好了標(biāo)簽的xml文件
training_xml_path?=?os.path.join(faces_path?“training_with_face_landmarks.xml“)
#?進(jìn)行訓(xùn)練,訓(xùn)練好的模型將保存為predictor.dat
dlib.train_shape_predictor(training_xml_path?“predictor.dat“?options)
#?打印在訓(xùn)練集中的準(zhǔn)確率
print?“\nTraining?accuracy:{0}“.format(dlib.test_shape_predictor(training_xml_path?“predictor.dat“))

#?導(dǎo)入測(cè)試集的xml文件
testing_xml_path?=?os.path.join(faces_path?“testing_with_face_landmarks.xml“)
#?打印在測(cè)試集中的準(zhǔn)確率
print?“\Testing?accuracy:{0}“.format(dlib.test_shape_predictor(testing_xml_path?“predictor.dat“))

#?測(cè)試部分
predictor?=?dlib.shape_predictor(“predictor.dat“)
detector?=?dlib.get_frontal_face_detector()
print(“Showing?detections?and?predictions?on?the?images?in?the?faces?folder...“)
for?f?in?glob.glob(os.path.join(faces_path?“*.jpg“)):
print(“Processing?file:?{}“.format(f))
img?=?cv2.imread(f)
img2?=?cv2.cvtColor(img?cv2.COLOR_BGR2GRAY)
dets?=?detector(img2?1)
print(“Number?of?faces?detected:?{}“.format(len(dets)))
for?index?face?in?enumerate(dets):
print(‘face?{};?left?{};?top?{};?right?{};?bottom?{}‘.format(index?face.left()?face.top()?face.right()?face.bottom()))

#?left?=?face.left()
#?top?=?face.top()
#?right?=?face.right()
#?bottom?=?face.bottom()
#?cv2.rectangle(img?(left?top)?(right?bottom)?(0?255?0)?3)
#?cv2.namedWindow(f?cv2.WINDOW_AUTOSIZE)
#?cv2.imshow(f?img)

shape?=?predictor(img?face)
#?print(shape)
#?print(shape.num_parts)
for?index?pt?in?enumerate(shape.parts()):
print(‘Part?{}:?{}‘.format(index?pt))
pt_pos?=?(pt.x?pt.y)
cv2.circle(img?pt_pos?2?(255?0?0)?1)
#print(type(pt))
#print(“Part?0:?{}?Part?1:?{}?...“.format(shape.part(0)?shape.part(1)))
cv2.namedWindow(f?cv2.WINDOW_AUTOSIZE)
cv2.imshow(f?img)

cv2.waitKey(0)
cv2.destroyAllWindows()

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-12?14:34??train_shpe_detector\
?????目錄???????????0??2017-11-12?14:23??train_shpe_detector\examples\
?????目錄???????????0??2017-11-02?21:02??train_shpe_detector\examples\faces\
?????文件???????89619??2017-11-02?21:02??train_shpe_detector\examples\faces\2007_007763.jpg
?????文件???????41770??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_001009.jpg
?????文件???????65344??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_001322.jpg
?????文件???????92641??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_002079.jpg
?????文件???????91349??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_002470.jpg
?????文件???????79316??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_002506.jpg
?????文件???????93821??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_004176.jpg
?????文件??????110034??2017-11-02?21:02??train_shpe_detector\examples\faces\2008_007676.jpg
?????文件???????79462??2017-11-02?21:02??train_shpe_detector\examples\faces\2009_004587.jpg
?????文件??????648373??2017-11-02?21:02??train_shpe_detector\examples\faces\bald_guys.jpg
?????文件??????175216??2017-11-02?21:02??train_shpe_detector\examples\faces\dogs.jpg
?????文件????????4166??2017-11-02?21:02??train_shpe_detector\examples\faces\image_metadata_stylesheet.xsl
?????文件????????1879??2017-11-02?21:02??train_shpe_detector\examples\faces\testing.xml
?????文件???????71586??2017-11-02?21:02??train_shpe_detector\examples\faces\testing_with_face_landmarks.xml
?????文件????????1445??2017-11-02?21:02??train_shpe_detector\examples\faces\training.xml
?????文件???????51828??2017-11-02?21:02??train_shpe_detector\examples\faces\training_with_face_landmarks.xml
?????文件????16601169??2017-11-12?15:23??train_shpe_detector\predictor.dat
?????文件????????2425??2017-11-12?14:50??train_shpe_detector\train_shpe_detector.py

評(píng)論

共有 條評(píng)論