国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

sql網(wǎng)站模板拼多多代運營公司十大排名

sql網(wǎng)站模板,拼多多代運營公司十大排名,網(wǎng)站充值記賬憑證怎么做,seo聯(lián)盟平臺結(jié)合以下鏈接中的文章有助于理解此篇案例: OpenCV中的 cnn 模塊 https://blog.csdn.net/weixin_73504499/article/details/142965441?spm1001.2014.3001.5501 此案例是通過使用OpenCV中的cnn模塊來調(diào)用別人已經(jīng)訓(xùn)練好的深度學(xué)習(xí)模型,此篇案例中用到了…

結(jié)合以下鏈接中的文章有助于理解此篇案例:

  • OpenCV中的 cnn 模塊
    • https://blog.csdn.net/weixin_73504499/article/details/142965441?spm=1001.2014.3001.5501

此案例是通過使用OpenCV中的cnn模塊來調(diào)用別人已經(jīng)訓(xùn)練好的深度學(xué)習(xí)模型,此篇案例中用到了人臉檢測模型、年齡預(yù)測模型性別預(yù)測模型。

  • 以下鏈接中是這三種模型所需要的模型文件和配置文件

    • 鏈接: https://pan.baidu.com/s/1hzatG5CNVVULCA8TjEegag?pwd=iaeg
    • 提取碼: iaeg
  • 完整代碼如下:

    import cv2
    from PIL import Image, ImageDraw, ImageFont
    import numpy as np# ======模型初始化======
    # 模型(網(wǎng)絡(luò)模型/預(yù)訓(xùn)練模型):face/age/gender(臉、年齡、性別)
    faceProto = "model/opencv_face_detector.pbtxt"
    faceModel = "model/opencv_face_detector_uint8.pb"
    ageProto = "model/deploy_age.prototxt"
    ageModel = "model/age_net.caffemodel"
    genderProto = "model/deploy_gender.prototxt"
    genderModel = "model/gender_net.caffemodel"# 加載網(wǎng)絡(luò)
    ageNet = cv2.dnn.readNet(ageModel, ageProto)  # 模型的權(quán)重參數(shù)、模型的配置
    genderNet = cv2.dnn.readNet(genderModel, genderProto)
    faceNet = cv2.dnn.readNet(faceModel, faceProto)
    # ======年齡初始化======
    # 年齡段和性別  共有8個年齡區(qū)間,區(qū)間范圍可自行更改
    ageList = ['0-2歲', '4-6歲', '8-12歲', '15-22歲', '25-32歲', '38-43歲', '48-53歲', '60-100歲']
    genderList = ['男性', '女性']
    mean = (78.4263377603, 87.7689143744, 114.895847746)  # 模型均值# ======自定義函數(shù),獲取人臉包圍框======
    def getBoxes(net, frame):frameHeight, frameWidth = frame.shape[:2]  # 獲取高度、寬度# 實現(xiàn)圖像預(yù)處理,從原始圖像構(gòu)建一個符合人工神經(jīng)網(wǎng)絡(luò)輸入格式的四維塊。blob = cv2.dnn.blobFromImage(frame, 1.0, (300, 300), [104, 117, 123], True, False)net.setInput(blob)  # 調(diào)用網(wǎng)絡(luò)模型,輸入圖片進行人臉檢測detections = net.forward()faceBoxes = []  # 存儲檢測到的人臉xx = detections.shape[2]for i in range(detections.shape[2]):# confidence中每一行保存了7個數(shù)據(jù),第3個數(shù)據(jù)表示置信度,第4,5,6,7分別表示人臉歸一化后的坐標位置confidence = detections[0, 0, i, 2]if confidence > 0.7:  # 篩選一下,將置信度大于0.7的保留,其余不要了x1 = int(detections[0, 0, i, 3] * frameWidth)y1 = int(detections[0, 0, i, 4] * frameHeight)x2 = int(detections[0, 0, i, 5] * frameWidth)y2 = int(detections[0, 0, i, 6] * frameHeight)faceBoxes.append([x1, y1, x2, y2])  # 人臉框坐標# 繪制人臉框cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 255, 0), int(round(frameHeight / 150)), 6)# 返回繪制了人臉框的幀frame、人臉包圍框faceBoxesreturn frame, faceBoxes""" 向圖片中添加中文 """
    def cv2AddChineseText(img, text, position, textColor=(0, 255, 0), textSize=30):if (isinstance(img, np.ndarray)):  # 判斷是否是OpenCV圖片類型img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))  # 實現(xiàn) array 到 image 的轉(zhuǎn)換draw = ImageDraw.Draw(img)  # 在img圖片上創(chuàng)建一個繪圖的對象# 字體的格式                       C 盤中的 Windows/Fonts 中,復(fù)制到此文件夾下可看到文件名fontStyle = ImageFont.truetype("simsun.ttc", textSize, encoding="utf-8")draw.text(position, text, textColor, font=fontStyle)  # 繪制文本return cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)  # 轉(zhuǎn)換回 OpenCV 格式""" 打開攝像頭,將每一幀畫面?zhèn)魅肷窠?jīng)網(wǎng)絡(luò)中 """
    cap = cv2.VideoCapture(0)	# 0-->電腦自帶攝像頭,1-->電腦外接攝像頭while True:_, frame = cap.read()# frame = cv2.flip(frame,1) # 鏡像處理# 獲取人臉包圍框、繪制人臉包圍框(可能多個)frame, faceBoxes = getBoxes(faceNet, frame)if not faceBoxes:print("當前鏡頭中沒有人")continue# 遍歷每一個人臉包圍框for faceBoxe in faceBoxes:# 處理每一幀畫面frame,將其處理為符合DNN輸入的格式x, y, x1, y1 = faceBoxeface = frame[y:y1, x:x1]blob = cv2.dnn.blobFromImage(face, 1.0, (227, 227), mean)   # 模型輸入為227*277# 調(diào)用模型,預(yù)測性別genderNet.setInput(blob)genderOuts = genderNet.forward()gender = genderList[genderOuts[0].argmax()]# 調(diào)用模型,預(yù)測年齡ageNet.setInput(blob)ageOuts = ageNet.forward()age = ageList[ageOuts[0].argmax()]result = "{},{}".format(gender, age)    # 格式化文本(年齡、性別)frame = cv2AddChineseText(frame, result, (x, y - 30))   # 輸出中文性別和年齡cv2.imshow("result", frame)if cv2.waitKey(1) == 27:    # 按下ESc鍵,退出程序breakcv2.destroyAllWindows()
    cap.release()
    
http://aloenet.com.cn/news/33933.html

相關(guān)文章:

  • 在家做兼職的比較靠譜的網(wǎng)站互聯(lián)網(wǎng)銷售
  • 做地推的網(wǎng)站關(guān)鍵詞排名怎么做上首頁
  • 網(wǎng)絡(luò)廣告網(wǎng)站怎么做百度小說排行榜總榜
  • 微信小程序開發(fā)流程詳細東莞seo廣告宣傳
  • wordpress媒體庫全選優(yōu)化英文
  • 加強公司內(nèi)部網(wǎng)站建設(shè)佛山網(wǎng)站建設(shè)模板
  • 撫寧建設(shè)局網(wǎng)站網(wǎng)紅推廣接單平臺
  • 網(wǎng)站開發(fā)需要什么配置的電腦優(yōu)化外包服務(wù)公司
  • wordpress修改永久鏈接后無法訪問seo優(yōu)化方案
  • 做網(wǎng)站大概需要多少錢深圳最新疫情
  • 濟南科技市場做網(wǎng)站河南做網(wǎng)站優(yōu)化
  • 做h5哪些網(wǎng)站好 知乎百度小程序
  • 蕪湖企業(yè)做網(wǎng)站電商運營入門基礎(chǔ)知識
  • 個人網(wǎng)站好備案嗎東莞seo網(wǎng)站排名優(yōu)化
  • Linux做視頻網(wǎng)站網(wǎng)速均衡今日最新足球推薦
  • 互聯(lián)網(wǎng)app網(wǎng)站建設(shè)方案模板下載霸榜seo
  • 毛絨玩具 東莞網(wǎng)站建設(shè) 技術(shù)支持江西短視頻seo搜索報價
  • 莫鄰網(wǎng)站在線客服系統(tǒng)3步打造seo推廣方案
  • 哪些網(wǎng)站做的比較炫網(wǎng)頁設(shè)計個人主頁
  • 百度網(wǎng)盤可以做網(wǎng)站嗎英文網(wǎng)站設(shè)計公司
  • 如何評價小米的網(wǎng)站建設(shè)小程序開發(fā)平臺官網(wǎng)
  • 網(wǎng)站做302重定向網(wǎng)絡(luò)營銷的未來發(fā)展趨勢
  • 國外網(wǎng)站代理如何查詢網(wǎng)站收錄情況
  • 頁面設(shè)計在線seo搜狗
  • 網(wǎng)絡(luò)培訓(xùn)班靠譜嗎網(wǎng)站優(yōu)化哪家好
  • 網(wǎng)站建設(shè)的售后seo優(yōu)化服務(wù)是什么
  • 日本軟銀集團市值關(guān)鍵詞優(yōu)化公司排行
  • 做淘寶貨源網(wǎng)站seo關(guān)鍵詞優(yōu)化排名軟件
  • 網(wǎng)站的開發(fā)方法谷歌全球營銷
  • 定制做網(wǎng)站費用seo還有哪些方面的優(yōu)化