Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
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
Sachith Fernando
2020-101
Commits
7358e49a
Commit
7358e49a
authored
Jan 09, 2021
by
I.K Seneviratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing the corrections in the logic files.
parent
069680f0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
31 deletions
+32
-31
FirstApp/emotion_detector.py
FirstApp/emotion_detector.py
+5
-5
FirstApp/logic/activity_recognition.py
FirstApp/logic/activity_recognition.py
+3
-3
FirstApp/logic/head_gaze_estimation.py
FirstApp/logic/head_gaze_estimation.py
+5
-5
FirstApp/templates/FirstApp/video_results.html
FirstApp/templates/FirstApp/video_results.html
+16
-18
FirstApp/views.py
FirstApp/views.py
+3
-0
No files found.
FirstApp/emotion_detector.py
View file @
7358e49a
...
...
@@ -523,11 +523,11 @@ def emotion_frame_groupings(video_name, frame_landmarks, frame_group_dict):
group_detection_count
=
frame_group_details
[
'detection_count'
]
# calculate the frame group emotion percentages
frame_group_happy_perct
=
float
(
frame_group_happy_count
/
group_detection_count
)
*
100
frame_group_sad_perct
=
float
(
frame_group_sad_count
/
group_detection_count
)
*
100
frame_group_angry_perct
=
float
(
frame_group_angry_count
/
group_detection_count
)
*
100
frame_group_surprise_perct
=
float
(
frame_group_surprise_count
/
group_detection_count
)
*
100
frame_group_neutral_perct
=
float
(
frame_group_neutral_count
/
group_detection_count
)
*
100
frame_group_happy_perct
=
float
(
frame_group_happy_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_sad_perct
=
float
(
frame_group_sad_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_angry_perct
=
float
(
frame_group_angry_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_surprise_perct
=
float
(
frame_group_surprise_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_neutral_perct
=
float
(
frame_group_neutral_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
# assign the values to the same dictionary
frame_group_dict
[
key
][
'happy_perct'
]
=
round
(
frame_group_happy_perct
,
1
)
...
...
FirstApp/logic/activity_recognition.py
View file @
7358e49a
...
...
@@ -615,9 +615,9 @@ def activity_frame_groupings(video_name, frame_landmarks, frame_group_dict):
group_detection_count
=
frame_group_details
[
'detection_count'
]
frame_group_phone_perct
=
float
(
frame_group_phone_count
/
group_detection_count
)
*
100
frame_group_listen_perct
=
float
(
frame_group_listen_count
/
group_detection_count
)
*
100
frame_group_note_perct
=
float
(
frame_group_note_count
/
group_detection_count
)
*
100
frame_group_phone_perct
=
float
(
frame_group_phone_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_listen_perct
=
float
(
frame_group_listen_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_note_perct
=
float
(
frame_group_note_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
# assign the values to the same dictionary
frame_group_dict
[
key
][
'phone_perct'
]
=
round
(
frame_group_phone_perct
,
1
)
...
...
FirstApp/logic/head_gaze_estimation.py
View file @
7358e49a
...
...
@@ -854,11 +854,11 @@ def gaze_estimation_frame_groupings(video_name, frame_landmarks, frame_group_dic
frame_group_upright_perct
=
float
(
frame_group_upright_count
/
group_detection_count
)
*
100
frame_group_upleft_perct
=
float
(
frame_group_upleft_count
/
group_detection_count
)
*
100
frame_group_downright_perct
=
float
(
frame_group_downright_count
/
group_detection_count
)
*
100
frame_group_downleft_perct
=
float
(
frame_group_downleft_count
/
group_detection_count
)
*
100
frame_group_front_perct
=
float
(
frame_group_front_count
/
group_detection_count
)
*
100
frame_group_upright_perct
=
float
(
frame_group_upright_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_upleft_perct
=
float
(
frame_group_upleft_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_downright_perct
=
float
(
frame_group_downright_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_downleft_perct
=
float
(
frame_group_downleft_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
frame_group_front_perct
=
float
(
frame_group_front_count
/
group_detection_count
)
*
100
if
group_detection_count
>
0
else
0
# assign the values to the same dictionary
frame_group_dict
[
key
][
'upright_perct'
]
=
round
(
frame_group_upright_perct
,
1
)
...
...
FirstApp/templates/FirstApp/video_results.html
View file @
7358e49a
...
...
@@ -40,7 +40,7 @@
$
(
document
).
ready
(
function
()
{
let
folder
=
''
;
$
(
'
#activity_loader
'
).
attr
(
'
hidden
'
,
false
);
{
#
$
(
'
#activity_loader
'
).
attr
(
'
hidden
'
,
false
);
#
}
{
#
$
(
'
#emotion_loader
'
).
attr
(
'
hidden
'
,
false
);
#
}
{
#
$
(
'
#gaze_loader
'
).
attr
(
'
hidden
'
,
false
);
#
}
...
...
@@ -224,6 +224,12 @@
let
video_id
=
$
(
this
).
attr
(
"
data-video-id
"
);
let
video_name
=
$
(
this
).
attr
(
"
data-video-name
"
);
//display the 'processing' message
$
(
'
#processing
'
).
attr
(
'
hidden
'
,
false
);
//hide the button
$
(
this
).
hide
();
//display the activity loader
$
(
'
#activity_loader
'
).
attr
(
"
hidden
"
,
false
);
...
...
@@ -278,7 +284,7 @@
//sending the get request to process the lecture gaze estimations
fetch
(
'
http://127.0.0.1:8000/process-lecture-gaze-estimation/?lecture_video_name=
'
+
global_video_name
+
'
&lecture_video_id=
'
+
global_lecture_video_id
)
.
then
((
res
)
=>
res
.
json
())
.
then
((
out
)
=>
handleGazeResponse
(
out
.
response
,
e
))
.
then
((
out
)
=>
handleGazeResponse
(
out
.
response
))
.
catch
((
error
)
=>
alert
(
'
error:
'
+
error
));
}
}
...
...
@@ -297,16 +303,8 @@
}
}
/*
setInterval(() => {
let time = new Date().getTime();
alert('time: ', time);
}, 5000);
*/
/*
//this is a test function (delete later)
//get the due lecture video name
var due_lecture_video_name = "{{ due_lecture_video_name }}";
...
...
@@ -367,7 +365,7 @@
}
*/
});
...
...
@@ -451,12 +449,12 @@
<td
class=
"font-weight-bolder"
>
{{ lecture.start_time }}
</td>
<td
class=
"font-weight-bolder"
>
{{ lecture.end_time }}
</td>
<td>
<span
class=
"font-italic text-success"
>
Processing
</span>
{#
<button
type=
"button"
class=
"btn btn-success batch_process"
#
}
{
#
data-video-id=
"{{ lecture.video_id }}"
#
}
{
#
data-video-name=
"{{ lecture.video_name }}"
#
}
{
#
id=
"{{ lecture.subject }}"
>
Process#}
{#
</button>
#}
<span
class=
"font-italic text-success"
id=
"processing"
hidden
>
Processing
</span>
<button
type=
"button"
class=
"btn btn-success batch_process"
data-video-id=
"{{ lecture.video_id }}"
data-video-name=
"{{ lecture.video_name }}"
id=
"{{ lecture.subject }}"
>
Process
</button>
{#
<span
class=
"font-italic font-weight-bolder text-success"
>
Processing
</span>
#}
</td>
</tr>
...
...
FirstApp/views.py
View file @
7358e49a
...
...
@@ -245,6 +245,9 @@ def video_result(request):
for
item
in
to_do_lecture_list
:
isDate
=
item
[
'date'
]
==
str
(
day_timetable
[
'date'
])
# print('item date: ', item['date'])
# print('timetable date: ', str(day_timetable['date']))
# isLecturer = item['lecturer'] ==
# check for the particular lecture on the day
if
isDate
:
...
...
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