Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
21_22-J-02
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J-02
21_22-J-02
Commits
69f40faa
Commit
69f40faa
authored
May 02, 2022
by
Wanigasinghe N.T. | IT18229912
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'feat/it18227550' into 'develop'"
This reverts merge request
!55
parent
63320e11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
Presently/presently/users/emotiondetectionvideo.py
Presently/presently/users/emotiondetectionvideo.py
+4
-6
No files found.
Presently/presently/users/emotiondetectionvideo.py
View file @
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment