第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我正在使用 OpenCV 制作蒙面人臉檢測應(yīng)用程序來檢測戴面具的人臉,但出現(xiàn)錯誤

我正在使用 OpenCV 制作蒙面人臉檢測應(yīng)用程序來檢測戴面具的人臉,但出現(xiàn)錯誤

胡子哥哥 2023-06-27 16:26:31
from tensorflow.keras.applications.mobilenet_v2 import preprocess_inputfrom tensorflow.keras.preprocessing.image import img_to_arrayfrom tensorflow.keras.models import load_modelfrom imutils.video import VideoStreamimport numpy as npimport argparseimport imutilsimport timeimport cv2import osdef detect_and_predict_mask(frame, faceNet, maskNet):    (h, w) = frame.shape[:2]    blob = cv2.dnn.blobFromImage(frame, 1.0, (300, 300),                                 (104.0, 177.0, 123.0))    faceNet.setInput(blob)    detections = faceNet.forward()    faces = []    locs = []    preds = []    for i in range(0, detections.shape[2]):        confidence = detections[0, 0, i, 2]        if confidence > args["confidence"]:            box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])            (startX, startY, endX, endY) = box.astype("int")            (startX, startY) = (max(0, startX), max(0, startY))            (endX, endY) = (min(w - 1, endX), min(h - 1, endY))            face = frame[startY:endY, startX:endX]            face = cv2.cvtColor(face, cv2.COLOR_BGR2RGB)            face = cv2.resize(face, (224, 224))            face = img_to_array(face)            face = preprocess_input(face)            face = np.expand_dims(face, axis=0)            faces.append(face)            locs.append((startX, startY, endX, endY))    if len(faces) > 0:        preds = maskNet.predict(faces)    return (locs, preds)ap = argparse.ArgumentParser()ap.add_argument("-f", "--face", type=str,                default="face_detector",                help="path to face detector model directory")ap.add_argument("-m", "--model", type=str,                default="mask_detector.model",                help="path to trained face mask detector model")ap.add_argument("-c", "--confidence", type=float, default=0.5,                help="minimum probability to filter weak detections")有沒有我需要導(dǎo)入的模塊或者是否全部正確導(dǎo)入。我不調(diào)試它我重新格式化文件一次。我已經(jīng)獲得了所有需要的 xml 和 jpg 文件。我已經(jīng)導(dǎo)入了所有需要的模塊......我想是的下面是錯誤你能幫我嗎?我是 OpenCV 新手,遇到了這樣的復(fù)雜錯誤
查看完整描述

1 回答

?
qq_花開花謝_0

TA貢獻1835條經(jīng)驗 獲得超7個贊

您要么不提供模型,要么模型的路徑不正確。打印 prototxtPath 和 WeightsPath 的值以檢查您是否提供了正確的模型路徑。



查看完整回答
反對 回復(fù) 2023-06-27
  • 1 回答
  • 0 關(guān)注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號