国产无码免费,人妻口爆,国产V在线,99中文精品7,国产成人无码AA精品一,制度丝袜诱惑av,久久99免费麻辣视频,蜜臀久久99精品久久久久久酒店
        訂閱
        糾錯
        加入自媒體

        使用 OpenCV-SeventhSense SOTA 模型進行人臉識別

        2023-02-01 13:51
        磐創AI
        關注

        OpenCV 最近發布了與 SeventhSense 合作的人臉識別 SDK。它是 NIST 人臉識別挑戰賽(2022 年 3 月)的前 10 名模型,速度極快且無需 GPU。

        在 opencv-seventhsense FR webapp 中,你可以創建一個集合并將組織中的人員聚合到組中。添加到集合中的每個人都具有姓名、出生日期、國籍、性別等屬性,可用于識別此人。

        下面是 webapp 的鏈接和 UI 的快照。

        OpenCV — SeventhSense-人臉識別網絡應用程序

        Python 和 C++ SDK 可用于將圖像對象發布到 API 并檢索給定圖像的檢測響應。

        下面的代碼片段使你能夠將角色添加到集合中,并檢索給定測試圖像的檢測響應。

        我使用自己的舊照片來查看模型是否能夠準確檢測到我的臉。

        導入圖片到 FR Webapp

        # Import the packages

        from opencv.fr import FR

        from opencv.fr.persons.schemas import PersonBase,PersonGender

        from pathlib import Path

        import cv2

        import json

        # Define the region, and developer key

        BACKEND_URL = "https://us.opencv.fr"

        DEVELOPER_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

        # Initialize the SDK

        sdk = FR(BACKEND_URL, DEVELOPER_KEY)

        directory = "/imagepath"

        files = Path(directory).glob('*')

        # Here we get an existing collection, but this could also

        # be a collection you created

        all_collections = sdk.collections.list()

        all_collections = str(all_collections)

        all_collections = all_collections.replace("'", """)

        all_collections = json.loads(all_collections)

        col_id = all_collections['collections'][0]['id']

        print(f"The collection id is - {col_id}")

        my_collection = sdk.collections.get(col_id)

        for file in files:

           if Path(str(file)).suffix == ".jpg" :

               # Create PersonBase

               image = cv2.imread(str(file))

               person = PersonBase([image], name="Rajathithan Rajasekar",

                   gender=PersonGender("M"), nationality="Indian",)

               # Add collection to the person's collections

               person.collections.append(my_collection)

               # Create the person

               person = sdk.persons.create(person)

               print(f'Uploaded the image file - {file}')

        從 FR webapp 人物集合中檢測給定圖像

        from opencv.fr.search.schemas import DetectionRequest, SearchOptions

        from opencv.fr.api_error import APIError, APIDataValidationError

        from pathlib import Path

        from opencv.fr import FR

        import json

        from json import JSONDecodeError

        import cv2

        import numpy as np

        import imutils

        import time

        BACKEND_URL = "https://us.opencv.fr"

        DEVELOPER_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

        # Initialize the SDK

        sdk = FR(BACKEND_URL, DEVELOPER_KEY)

        image_base_path = Path("sample_images")

        image_path = "imagepath/test/test.jpg"

        sourceimage = "imagepath/rajathithan-rajasekar.jpg"

        # resize source image

        simg = cv2.imread(sourceimage)

        simg = imutils.resize(simg, width=640)

        simg = imutils.resize(simg, height=480)

        #Read old test image

        frame = cv2.imread(image_path)

        print(frame.shape)

        #Get collection id

        all_collections = sdk.collections.list()

        all_collections = str(all_collections)

        all_collections = all_collections.replace("'", """)

        all_collections = json.loads(all_collections)

        col_id = all_collections['collections'][0]['id']

        print(f"The collection id is - {col_id}")

        #Initilize the search options

        options = SearchOptions(

           collection_id=col_id,

           min_score = 0.8,



        #Detection request with search options

        detect_request_with_search = DetectionRequest(image_path,options)

        detectionObject = sdk.search.detect(detect_request_with_search)

        print(detectionObject)

        bbox = detectionObject[0].box

        print(bbox)

        personInfo = detectionObject[0].persons[0]

        print(f"Name:{personInfo.person.name}")

        print(f"Gender:{personInfo.person.gender}")

        print(f"Nationality:{personInfo.person.nationality}")

        print(f"Score:{personInfo.score}")

        def rec_frame_display(frame: np.ndarray, roi, personInfo) -> np.ndarray:

           diff1 = round((roi['bottom'] - roi['top'])/4)

           diff2 = round((roi['left'] - roi['right'])/4)
           

           cv2.line(frame, (roi['left'],roi['top']), (roi['left'],roi['top']+diff1), (0, 200, 0), 4)

           cv2.line(frame, (roi['left'],roi['bottom']), (roi['left'],roi['bottom']-diff1), (0, 200, 0), 4)
           

           cv2.line(frame, (roi['right'],roi['top']), (roi['right'],roi['top']+diff1), (0, 200, 0), 4)

           cv2.line(frame, (roi['right'],roi['bottom']), (roi['right'],roi['bottom']-diff1), (0, 200, 0), 4)
           
           

           cv2.line(frame, (roi['left'],roi['top']), (roi['left']-diff2,roi['top']), (0, 200, 0), 4)

           cv2.line(frame, (roi['left'],roi['bottom']), (roi['left']-diff2,roi['bottom']), (0, 200, 0), 4)
           

           cv2.line(frame, (roi['right'],roi['top']), (roi['right']+diff2,roi['top']), (0, 200, 0), 4)

           cv2.line(frame, (roi['right'],roi['bottom']), (roi['right']+diff2,roi['bottom']), (0, 200, 0), 4)

           cv2.putText(frame, "Name : " + personInfo.person.name, (50, 50),

               cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255),2,cv2.LINE_AA, False)
           

           cv2.putText(frame, "Gender : " + str(personInfo.person.gender), (50, 150),

               cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255),2,cv2.LINE_AA, False)
           

           cv2.putText(frame, "Nationality : " + str(personInfo.person.nationality), (50, 250),

               cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255),2,cv2.LINE_AA, False)
           

           cv2.putText(frame, "Confidence Score : " + str(round(personInfo.score * 100,2)) + " %", (50, 350),

               cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255),2,cv2.LINE_AA, False)
           

           return frame

        roi = json.loads(str(bbox).replace("'","""))

        frame = rec_frame_display(frame, roi, personInfo)

        frame = imutils.resize(frame, width = 640,height = 480)

        combine = np.concatenate((simg, frame), axis=1)

        cv2.imwrite("final.jpg",combine)

        cv2.imshow("Face recognition on an old pic",combine)

        cv2.waitKey(0)

        cv2.destroyAllWindows()

        左側照片是我當前的圖像,右側照片是我帶有檢測結果的舊圖像。

               原文標題 : 使用 OpenCV-SeventhSense SOTA 模型進行人臉識別

        聲明: 本文由入駐維科號的作者撰寫,觀點僅代表作者本人,不代表OFweek立場。如有侵權或其他問題,請聯系舉報。

        發表評論

        0條評論,0人參與

        請輸入評論內容...

        請輸入評論/評論長度6~500個字

        您提交的評論過于頻繁,請輸入驗證碼繼續

        暫無評論

        暫無評論

          掃碼關注公眾號
          OFweek人工智能網
          獲取更多精彩內容
          文章糾錯
          x
          *文字標題:
          *糾錯內容:
          聯系郵箱:
          *驗 證 碼:

          粵公網安備 44030502002758號

          主站蜘蛛池模板: 日本在线观看| 国产一区二区三区无码| 玛曲县| 色色资源平台| www.亚洲成人| 一区二区三区视频| 51自拍视频| 国产v自拍| 成人电影c.cc| 永昌县| 91热| 91在线小视频| 色色狠狠| 久久综合国产| 日韩在线一区二区三区| 国产成人精品无码免费看动漫| 亚洲最大成人综合网| canopen草棚类别9791怎么查| 亚洲日本三级| youjizz亚洲| 伊人色区| 久久久777| 18禁123| 桃花岛av| 超碰人人干| 韩日乱伦| 亚洲av二区| 怡红院亚洲| 鲁鲁AV| 亚洲成年网站| 色婷婷Av| 国产制服丝袜在线观看| 91碰碰| 尹人97| 最新A片| 蜜桃av秘?无码一区二区三区| 屄视频| 国产精品制度丝袜电影| 中文字幕日产乱码中| 丘北县| 无码免费一区二区三区|