Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-060
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
2021-060
2021-060
Commits
8ca84f52
Commit
8ca84f52
authored
Nov 23, 2021
by
Dhananjaya Jayashanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changers done
parent
65f680f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
Emotion/emotions.txt
Emotion/emotions.txt
+2
-0
Emotion/videoAnalyzing.py
Emotion/videoAnalyzing.py
+5
-7
UI/application.js
UI/application.js
+4
-2
No files found.
Emotion/emotions.txt
View file @
8ca84f52
...
...
@@ -20,7 +20,9 @@
'oppressed': 'Angry',
'anguished': 'Sad',
'animated': 'Happy',
'happen': 'Sad',
'annoyed': 'Angry',
'simply': 'Angry',
'appalled': 'Angry',
'beatific': 'Happy',
'bereaved': 'Sad',
...
...
Emotion/videoAnalyzing.py
View file @
8ca84f52
#
from skimage import io
#
Import useful libraries
import
cv2
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
tensorflow
as
tf
from
keras.preprocessing
import
image
#Load the trained model
Saved_model
=
tf
.
keras
.
models
.
load_model
(
'emotion_lts.h5'
)
Saved_model
.
summary
()
#Prediction categories
objects
=
(
'Angry'
,
'Happy'
,
'Sad'
,
'Neutral'
)
vid
=
cv2
.
VideoCapture
(
0
)
...
...
@@ -21,16 +23,15 @@ def emotion_analysis(emotions):
plt
.
ylabel
(
'percentage'
)
plt
.
title
(
'emotion'
)
#Predict facial expressions
def
get_emotions
(
filePath
):
cap
=
cv2
.
VideoCapture
(
filePath
)
emotions
=
[]
emotions
=
[]
#Define emotion list
while
(
cap
.
isOpened
()):
try
:
ret
,
frame
=
cap
.
read
()
# img = image.load_img(frame,grayscale=True, target_size=(48, 48))
frame
=
cv2
.
resize
(
frame
,
(
48
,
48
))
frame
=
cv2
.
cvtColor
(
frame
,
cv2
.
COLOR_BGR2GRAY
)
x
=
image
.
img_to_array
(
frame
)
...
...
@@ -39,12 +40,9 @@ def get_emotions(filePath):
x
/=
255
custom
=
Saved_model
.
predict
(
x
)
# print(custom[0])
emotion_analysis
(
custom
[
0
])
x
=
np
.
array
(
x
,
'float32'
)
x
=
x
.
reshape
([
48
,
48
]);
m
=
0.000000000000000000001
a
=
custom
[
0
]
for
i
in
range
(
0
,
len
(
a
)):
...
...
UI/application.js
View file @
8ca84f52
...
...
@@ -53,6 +53,7 @@ app.controller('MainController', ['$scope', '$rootScope', '$location', '$route',
});
}
//facial expression diagram
$scope
.
selectVideoFile
=
function
(
e
)
{
$scope
.
chartLabels
=
[];
$scope
.
chartdata
=
[];
...
...
@@ -136,7 +137,7 @@ app.controller('MainController', ['$scope', '$rootScope', '$location', '$route',
console
.
log
(
error
);
});
//emotion graph
//emotion graph text analyzing
MainFactory
.
emotionSentence
({
text
:
$scope
.
audioText
})
.
then
(
function
(
response
)
{
console
.
log
(
response
.
data
);
...
...
@@ -152,7 +153,6 @@ app.controller('MainController', ['$scope', '$rootScope', '$location', '$route',
$scope
.
chartdata
=
[];
for
(
let
i
=
0
;
i
<
$scope
.
emotions
.
length
;
i
++
)
{
// $scope.chartLabels.push(i+1);
if
(
$scope
.
emotions
[
i
]
==
'
Angry
'
)
{
$scope
.
chartdata
.
push
(
1
);
$scope
.
emotionScore
+=
0.25
;
...
...
@@ -288,6 +288,8 @@ app.controller('MainController', ['$scope', '$rootScope', '$location', '$route',
console
.
log
(
error
);
});
//comparison between the expression prediction results and emotional moment results
MainFactory
.
textAnalyzeEmotion
({
text
:
$scope
.
audioText
})
.
then
(
function
(
response
)
{
console
.
log
(
response
);
...
...
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