Commit abb7e19d authored by Wanigasinghe N.T. | IT18229912's avatar Wanigasinghe N.T. | IT18229912

Merge branch 'revert-63320e11' into 'develop'

Revert "Merge branch 'feat/it18227550' into 'develop'"

See merge request !56
parents 63320e11 69f40faa
......@@ -5,7 +5,7 @@ import sys
import pandas as pd
import numpy as np
location_videofile = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\media\\video\\22\\testvideo.mp4"
location_videofile = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\media\\video\\22\\publicspeech.mp4"
cascPath = "F:\\CDAP-PRESENTLY\\21_22-j-02\\Presently\\presently\\users\\models\\abc.xml"
def _get_labels():
......@@ -68,11 +68,9 @@ from collections import OrderedDict
from matplotlib import pyplot as plt
import cv2
from tensorflow.keras.models import load_model
def detect_emotions(location_videofile, NumberofFrames):
PADDING = 40
NumberofFrames = 50
emotion_labels = _get_labels()
arry = {}
......@@ -128,7 +126,7 @@ def detect_emotions(location_videofile, NumberofFrames):
except Exception as e:
continue
#gray_face = __preprocess_input(gray_face, True)
gray_face = __preprocess_input(gray_face, True)
gray_face = np.expand_dims(np.expand_dims(gray_face, 0), -1)
emotion_prediction = model.predict(gray_face)[0]
......@@ -152,8 +150,8 @@ def detect_emotions(location_videofile, NumberofFrames):
vidcap.release()
break
if len(arry) == 0:
return "Neutral"
return "Cannot detect emotion", arry
else:
return max(arry, key=arry.get)
return max(arry, key=arry.get), arry
emo, arr1 = detect_emotions(location_videofile, 300)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment