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

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

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

0 前言

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

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

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

?? 更多資料, 項(xiàng)目分享:

https://gitee.com/dancheng-senior/postgraduate文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-695986.html


1 技術(shù)介紹

1.1 技術(shù)概括

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

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

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

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

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

2 實(shí)現(xiàn)效果

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

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

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

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

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

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

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

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

3.2 數(shù)據(jù)

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

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

3.3 實(shí)現(xiàn)流程

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

3.4 部分實(shí)現(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 最后

?? 更多資料, 項(xiàng)目分享:

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

到了這里,關(guān)于計(jì)算機(jī)競(jìng)賽 基于深度學(xué)習(xí)的人臉表情識(shí)別的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

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

相關(guān)文章

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

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

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

    2024年02月07日
    瀏覽(888)
  • 計(jì)算機(jī)設(shè)計(jì)大賽 深度學(xué)習(xí)人臉表情識(shí)別算法 - opencv python 機(jī)器視覺(jué)

    計(jì)算機(jī)設(shè)計(jì)大賽 深度學(xué)習(xí)人臉表情識(shí)別算法 - opencv python 機(jī)器視覺(jué)

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

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

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

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

    2024年02月07日
    瀏覽(84)
  • 計(jì)算機(jī)競(jìng)賽 深度學(xué)習(xí) 機(jī)器視覺(jué) 人臉識(shí)別系統(tǒng) - opencv python

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

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

    2024年02月07日
    瀏覽(101)
  • 機(jī)器視覺(jué) opencv 深度學(xué)習(xí) 駕駛?cè)四樒跈z測(cè)系統(tǒng) -python 計(jì)算機(jī)競(jìng)賽

    機(jī)器視覺(jué) opencv 深度學(xué)習(xí) 駕駛?cè)四樒跈z測(cè)系統(tǒng) -python 計(jì)算機(jī)競(jìng)賽

    ?? 優(yōu)質(zhì)競(jìng)賽項(xiàng)目系列,今天要分享的是 ?? 機(jī)器視覺(jué) opencv 深度學(xué)習(xí) 駕駛?cè)四樒跈z測(cè)系統(tǒng) 該項(xiàng)目較為新穎,適合作為競(jìng)賽課題方向,學(xué)長(zhǎng)非常推薦! ??學(xué)長(zhǎng)這里給一個(gè)題目綜合評(píng)分(每項(xiàng)滿分5分) 難度系數(shù):3分 工作量:3分 創(chuàng)新點(diǎn):4分 ?? 更多資料, 項(xiàng)目分享: https:/

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

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

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

    2024年02月07日
    瀏覽(97)
  • 計(jì)算機(jī)競(jìng)賽 基于Django與深度學(xué)習(xí)的股票預(yù)測(cè)系統(tǒng)

    計(jì)算機(jī)競(jìng)賽 基于Django與深度學(xué)習(xí)的股票預(yù)測(cè)系統(tǒng)

    ?? 優(yōu)質(zhì)競(jìng)賽項(xiàng)目系列,今天要分享的是 ?? **基于Django與深度學(xué)習(xí)的股票預(yù)測(cè)系統(tǒng) ** 該項(xiàng)目較為新穎,適合作為競(jìng)賽課題方向,學(xué)長(zhǎng)非常推薦! ??學(xué)長(zhǎng)這里給一個(gè)題目綜合評(píng)分(每項(xiàng)滿分5分) 難度系數(shù):3分 工作量:3分 創(chuàng)新點(diǎn):5分 ?? 更多資料, 項(xiàng)目分享: https://gitee.com

    2024年02月11日
    瀏覽(108)
  • 計(jì)算機(jī)競(jìng)賽 基于CNN實(shí)現(xiàn)謠言檢測(cè) - python 深度學(xué)習(xí) 機(jī)器學(xué)習(xí)

    計(jì)算機(jī)競(jìng)賽 基于CNN實(shí)現(xiàn)謠言檢測(cè) - python 深度學(xué)習(xí) 機(jī)器學(xué)習(xí)

    ?? 優(yōu)質(zhì)競(jìng)賽項(xiàng)目系列,今天要分享的是 基于CNN實(shí)現(xiàn)謠言檢測(cè) 該項(xiàng)目較為新穎,適合作為競(jìng)賽課題方向,學(xué)長(zhǎng)非常推薦! ?? 更多資料, 項(xiàng)目分享: https://gitee.com/dancheng-senior/postgraduate 社交媒體的發(fā)展在加速信息傳播的同時(shí),也帶來(lái)了虛假謠言信息的泛濫,往往會(huì)引發(fā)諸多不

    2024年02月12日
    瀏覽(92)
  • 計(jì)算機(jī)競(jìng)賽 基于深度學(xué)習(xí)的植物識(shí)別算法 - cnn opencv python

    計(jì)算機(jī)競(jìng)賽 基于深度學(xué)習(xí)的植物識(shí)別算法 - cnn opencv python

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

    2024年02月09日
    瀏覽(92)
  • 計(jì)算機(jī)競(jìng)賽 基于GRU的 電影評(píng)論情感分析 - python 深度學(xué)習(xí) 情感分類

    計(jì)算機(jī)競(jìng)賽 基于GRU的 電影評(píng)論情感分析 - python 深度學(xué)習(xí) 情感分類

    ?? 優(yōu)質(zhì)競(jìng)賽項(xiàng)目系列,今天要分享的是 基于GRU的 電影評(píng)論情感分析 該項(xiàng)目較為新穎,適合作為競(jìng)賽課題方向,學(xué)長(zhǎng)非常推薦! ?? 更多資料, 項(xiàng)目分享: https://gitee.com/dancheng-senior/postgraduate 其實(shí),很明顯這個(gè)項(xiàng)目和微博謠言檢測(cè)是一樣的,也是個(gè)二分類的問(wèn)題,因此,我們

    2024年02月11日
    瀏覽(22)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包