国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽

這篇具有很好參考價值的文章主要介紹了基于深度學(xué)習(xí)的人臉表情識別 計算機競賽。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

0 前言

?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是

基于深度學(xué)習(xí)的人臉表情識別

該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦!

?? 更多資料, 項目分享:

https://gitee.com/dancheng-senior/postgraduate文章來源地址http://www.zghlxwxcb.cn/news/detail-736264.html


1 技術(shù)介紹

1.1 技術(shù)概括

面部表情識別技術(shù)源于1971年心理學(xué)家Ekman和Friesen的一項研究,他們提出人類主要有六種基本情感,每種情感以唯一的表情來反映當(dāng)時的心理活動,這六種情感分別是憤怒(anger)、高興(happiness)、悲傷
(sadness)、驚訝(surprise)、厭惡(disgust)和恐懼(fear)。

盡管人類的情感維度和表情復(fù)雜度遠不是數(shù)字6可以量化的,但總體而言,這6種也差不多夠描述了。

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

1.2 目前表情識別實現(xiàn)技術(shù)

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java
基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

2 實現(xiàn)效果

廢話不多說,先上實現(xiàn)效果

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java
基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

3 深度學(xué)習(xí)表情識別實現(xiàn)過程

3.1 網(wǎng)絡(luò)架構(gòu)

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java
面部表情識別CNN架構(gòu)(改編自 埃因霍芬理工大學(xué)PARsE結(jié)構(gòu)圖)

其中,通過卷積操作來創(chuàng)建特征映射,將卷積核挨個與圖像進行卷積,從而創(chuàng)建一組要素圖,并在其后通過池化(pooling)操作來降維。

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

3.2 數(shù)據(jù)

主要來源于kaggle比賽,下載地址。
有七種表情類別: (0=Angry, 1=Disgust, 2=Fear, 3=Happy, 4=Sad, 5=Surprise, 6=Neutral).
數(shù)據(jù)是48x48 灰度圖,格式比較奇葩。
第一列是情緒分類,第二列是圖像的numpy,第三列是train or test。

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

3.3 實現(xiàn)流程

基于深度學(xué)習(xí)的人臉表情識別 計算機競賽,python,java

3.4 部分實現(xiàn)代碼

?



    import cv2
    import sys
    import json
    import numpy as np
    from keras.models import model_from_json


    emotions = ['angry', 'fear', 'happy', 'sad', 'surprise', 'neutral']
    cascPath = sys.argv[1]
    
    faceCascade = cv2.CascadeClassifier(cascPath)
    noseCascade = cv2.CascadeClassifier(cascPath)


    # load json and create model arch
    json_file = open('model.json','r')
    loaded_model_json = json_file.read()
    json_file.close()
    model = model_from_json(loaded_model_json)
    
    # load weights into new model
    model.load_weights('model.h5')
    
    # overlay meme face
    def overlay_memeface(probs):
        if max(probs) > 0.8:
            emotion = emotions[np.argmax(probs)]
            return 'meme_faces/{}-{}.png'.format(emotion, emotion)
        else:
            index1, index2 = np.argsort(probs)[::-1][:2]
            emotion1 = emotions[index1]
            emotion2 = emotions[index2]
            return 'meme_faces/{}-{}.png'.format(emotion1, emotion2)
    
    def predict_emotion(face_image_gray): # a single cropped face
        resized_img = cv2.resize(face_image_gray, (48,48), interpolation = cv2.INTER_AREA)
        # cv2.imwrite(str(index)+'.png', resized_img)
        image = resized_img.reshape(1, 1, 48, 48)
        list_of_list = model.predict(image, batch_size=1, verbose=1)
        angry, fear, happy, sad, surprise, neutral = [prob for lst in list_of_list for prob in lst]
        return [angry, fear, happy, sad, surprise, neutral]
    
    video_capture = cv2.VideoCapture(0)
    while True:
        # Capture frame-by-frame
        ret, frame = video_capture.read()
    
        img_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY,1)


        faces = faceCascade.detectMultiScale(
            img_gray,
            scaleFactor=1.1,
            minNeighbors=5,
            minSize=(30, 30),
            flags=cv2.cv.CV_HAAR_SCALE_IMAGE
        )
    
        # Draw a rectangle around the faces
        for (x, y, w, h) in faces:
    
            face_image_gray = img_gray[y:y+h, x:x+w]
            filename = overlay_memeface(predict_emotion(face_image_gray))
    
            print filename
            meme = cv2.imread(filename,-1)
            # meme = (meme/256).astype('uint8')
            try:
                meme.shape[2]
            except:
                meme = meme.reshape(meme.shape[0], meme.shape[1], 1)
            # print meme.dtype
            # print meme.shape
            orig_mask = meme[:,:,3]
            # print orig_mask.shape
            # memegray = cv2.cvtColor(orig_mask, cv2.COLOR_BGR2GRAY)
            ret1, orig_mask = cv2.threshold(orig_mask, 10, 255, cv2.THRESH_BINARY)
            orig_mask_inv = cv2.bitwise_not(orig_mask)
            meme = meme[:,:,0:3]
            origMustacheHeight, origMustacheWidth = meme.shape[:2]
    
            roi_gray = img_gray[y:y+h, x:x+w]
            roi_color = frame[y:y+h, x:x+w]
    
            # Detect a nose within the region bounded by each face (the ROI)
            nose = noseCascade.detectMultiScale(roi_gray)
    
            for (nx,ny,nw,nh) in nose:
                # Un-comment the next line for debug (draw box around the nose)
                #cv2.rectangle(roi_color,(nx,ny),(nx+nw,ny+nh),(255,0,0),2)
    
                # The mustache should be three times the width of the nose
                mustacheWidth =  20 * nw
                mustacheHeight = mustacheWidth * origMustacheHeight / origMustacheWidth
    
                # Center the mustache on the bottom of the nose
                x1 = nx - (mustacheWidth/4)
                x2 = nx + nw + (mustacheWidth/4)
                y1 = ny + nh - (mustacheHeight/2)
                y2 = ny + nh + (mustacheHeight/2)
    
                # Check for clipping
                if x1 < 0:
                    x1 = 0
                if y1 < 0:
                    y1 = 0
                if x2 > w:
                    x2 = w
                if y2 > h:
                    y2 = h


                # Re-calculate the width and height of the mustache image
                mustacheWidth = (x2 - x1)
                mustacheHeight = (y2 - y1)
    
                # Re-size the original image and the masks to the mustache sizes
                # calcualted above
                mustache = cv2.resize(meme, (mustacheWidth,mustacheHeight), interpolation = cv2.INTER_AREA)
                mask = cv2.resize(orig_mask, (mustacheWidth,mustacheHeight), interpolation = cv2.INTER_AREA)
                mask_inv = cv2.resize(orig_mask_inv, (mustacheWidth,mustacheHeight), interpolation = cv2.INTER_AREA)
    
                # take ROI for mustache from background equal to size of mustache image
                roi = roi_color[y1:y2, x1:x2]
    
                # roi_bg contains the original image only where the mustache is not
                # in the region that is the size of the mustache.
                roi_bg = cv2.bitwise_and(roi,roi,mask = mask_inv)
    
                # roi_fg contains the image of the mustache only where the mustache is
                roi_fg = cv2.bitwise_and(mustache,mustache,mask = mask)
    
                # join the roi_bg and roi_fg
                dst = cv2.add(roi_bg,roi_fg)
    
                # place the joined image, saved to dst back over the original image
                roi_color[y1:y2, x1:x2] = dst
    
                break
    
        #     cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)
        #     angry, fear, happy, sad, surprise, neutral = predict_emotion(face_image_gray)
        #     text1 = 'Angry: {}     Fear: {}   Happy: {}'.format(angry, fear, happy)
        #     text2 = '  Sad: {} Surprise: {} Neutral: {}'.format(sad, surprise, neutral)
        #
        # cv2.putText(frame, text1, (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 0, 0), 3)
        # cv2.putText(frame, text2, (50, 150), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 0, 0), 3)
    
        # Display the resulting frame
        cv2.imshow('Video', frame)
    
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    
    # When everything is done, release the capture
    video_capture.release()
    cv2.destroyAllWindows()



4 最后

?? 更多資料, 項目分享:

https://gitee.com/dancheng-senior/postgraduate

到了這里,關(guān)于基于深度學(xué)習(xí)的人臉表情識別 計算機競賽的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 計算機競賽 深度學(xué)習(xí) 機器視覺 人臉識別系統(tǒng) - opencv python

    計算機競賽 深度學(xué)習(xí) 機器視覺 人臉識別系統(tǒng) - opencv python

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 ?? 深度學(xué)習(xí) 機器視覺 人臉識別系統(tǒng) 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ??學(xué)長這里給一個題目綜合評分(每項滿分5分) 難度系數(shù):3分 工作量:3分 創(chuàng)新點:3分 ?? 更多資料, 項目分享: https://gitee.com/dancheng

    2024年02月07日
    瀏覽(103)
  • 計算機競賽 深度學(xué)習(xí) python opencv 實現(xiàn)人臉年齡性別識別

    計算機競賽 深度學(xué)習(xí) python opencv 實現(xiàn)人臉年齡性別識別

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 ?? 基于深度學(xué)習(xí)的人臉年齡性別識別算法實現(xiàn) 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ??學(xué)長這里給一個題目綜合評分(每項滿分5分) 難度系數(shù):4分 工作量:4分 創(chuàng)新點:3分 ?? 更多資料, 項目分享: https://gitee

    2024年02月07日
    瀏覽(87)
  • 計算機競賽 基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn

    計算機競賽 基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 ?? 基于深度學(xué)習(xí)的人臉專注度檢測計算算法 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ??學(xué)長這里給一個題目綜合評分(每項滿分5分) 難度系數(shù):3分 工作量:3分 創(chuàng)新點:5分 ?? 更多資料, 項目分享: https://gitee.co

    2024年02月10日
    瀏覽(648)
  • 基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn 計算機競賽

    基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn 計算機競賽

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 ?? 基于深度學(xué)習(xí)的人臉專注度檢測計算算法 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ??學(xué)長這里給一個題目綜合評分(每項滿分5分) 難度系數(shù):3分 工作量:3分 創(chuàng)新點:5分 ?? 更多資料, 項目分享: https://gitee.co

    2024年02月07日
    瀏覽(915)
  • 畢業(yè)設(shè)計-基于深度學(xué)習(xí)的人臉表情識別

    畢業(yè)設(shè)計-基于深度學(xué)習(xí)的人臉表情識別

    目錄 前言 課題背景和意義 實現(xiàn)技術(shù)思路 一、深度學(xué)習(xí)理論基礎(chǔ) ?二、AdaBoost 結(jié)合 SVM 算法表情識別 ?三、基于 MTCNN 算法的人臉表情識別 實現(xiàn)效果圖樣例 最后 ? ? ??大四是整個大學(xué)期間最忙碌的時光,一邊要忙著備考或?qū)嵙?xí)為畢業(yè)后面臨的就業(yè)升學(xué)做準(zhǔn)備,一邊要為畢業(yè)設(shè)計

    2024年02月01日
    瀏覽(87)
  • 計算機畢設(shè) 基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn

    計算機畢設(shè) 基于深度學(xué)習(xí)的人臉專注度檢測計算系統(tǒng) - opencv python cnn

    ?? 這兩年開始畢業(yè)設(shè)計和畢業(yè)答辯的要求和難度不斷提升,傳統(tǒng)的畢設(shè)題目缺少創(chuàng)新和亮點,往往達不到畢業(yè)答辯的要求,這兩年不斷有學(xué)弟學(xué)妹告訴學(xué)長自己做的項目系統(tǒng)達不到老師的要求。 為了大家能夠順利以及最少的精力通過畢設(shè),學(xué)長分享優(yōu)質(zhì)畢業(yè)設(shè)計項目,今天

    2024年02月11日
    瀏覽(98)
  • 【計算機視覺|人臉建?!繉W(xué)習(xí)從4D掃描中獲取的面部形狀和表情的模型

    【計算機視覺|人臉建模】學(xué)習(xí)從4D掃描中獲取的面部形狀和表情的模型

    本系列博文為深度學(xué)習(xí)/計算機視覺論文筆記,轉(zhuǎn)載請注明出處 標(biāo)題: Learning a model of facial shape and expression from 4D scans 鏈接:Learning a model of facial shape and expression from 4D scans | ACM Transactions on Graphics Permission to make digital or hard copies of part or all of this work for personal or classroom use is

    2024年02月07日
    瀏覽(99)
  • 【計算機視覺|人臉建?!繉W(xué)習(xí)從圖像中回歸3D面部形狀和表情而無需3D監(jiān)督

    【計算機視覺|人臉建?!繉W(xué)習(xí)從圖像中回歸3D面部形狀和表情而無需3D監(jiān)督

    本系列博文為深度學(xué)習(xí)/計算機視覺論文筆記,轉(zhuǎn)載請注明出處 標(biāo)題: Learning to Regress 3D Face Shape and Expression from an Image without 3D Supervision 鏈接:[1905.06817] Learning to Regress 3D Face Shape and Expression from an Image without 3D Supervision (arxiv.org) 從單張圖像估計3D面部形狀必須對光照、頭部姿勢

    2024年02月07日
    瀏覽(94)
  • 計算機競賽 題目:基于深度學(xué)習(xí)的手勢識別實現(xiàn)

    計算機競賽 題目:基于深度學(xué)習(xí)的手勢識別實現(xiàn)

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 基于深度學(xué)習(xí)的手勢識別實現(xiàn) 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ?? 更多資料, 項目分享: https://gitee.com/dancheng-senior/postgraduate 手勢識別在深度學(xué)習(xí)項目是算是比較簡單的。這里為了給大家會更好的訓(xùn)練。其中

    2024年02月07日
    瀏覽(100)
  • 計算機競賽 基于深度學(xué)習(xí)的動物識別 - 卷積神經(jīng)網(wǎng)絡(luò) 機器視覺 圖像識別

    計算機競賽 基于深度學(xué)習(xí)的動物識別 - 卷積神經(jīng)網(wǎng)絡(luò) 機器視覺 圖像識別

    ?? 優(yōu)質(zhì)競賽項目系列,今天要分享的是 基于深度學(xué)習(xí)的動物識別算法研究與實現(xiàn) 該項目較為新穎,適合作為競賽課題方向,學(xué)長非常推薦! ?? 更多資料, 項目分享: https://gitee.com/dancheng-senior/postgraduate 目前,由于計算機能力和相關(guān)理論的發(fā)展獲得了重大突破,基于深度學(xué)

    2024年02月09日
    瀏覽(98)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包