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
2020-101
2020-101
Commits
195f9fcd
Commit
195f9fcd
authored
Sep 22, 2020
by
I.K Seneviratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing to the new branch .
parent
20fd8ccb
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
382 additions
and
362 deletions
+382
-362
FirstApp/api.py
FirstApp/api.py
+1
-2
FirstApp/emotion_detector.py
FirstApp/emotion_detector.py
+5
-5
FirstApp/logic/activity_recognition.py
FirstApp/logic/activity_recognition.py
+4
-4
FirstApp/templates/FirstApp/Home.html
FirstApp/templates/FirstApp/Home.html
+129
-16
FirstApp/templates/FirstApp/activity.html
FirstApp/templates/FirstApp/activity.html
+3
-3
FirstApp/templates/FirstApp/emotion.html
FirstApp/templates/FirstApp/emotion.html
+91
-91
FirstApp/templates/FirstApp/template.html
FirstApp/templates/FirstApp/template.html
+44
-44
FirstApp/templates/FirstApp/video_results.html
FirstApp/templates/FirstApp/video_results.html
+98
-195
FirstApp/views.py
FirstApp/views.py
+7
-2
No files found.
FirstApp/api.py
View file @
195f9fcd
...
...
@@ -561,7 +561,6 @@ class GetLectureGazeEstimationAvailaibility(APIView):
serializer
=
LectureVideoSerializer
(
lecturer_video
,
many
=
True
)
lecture_video_id
=
serializer
.
data
[
index
][
'lecture_video_id'
]
print
(
'lecture video id: '
,
lecture_video_id
)
gaze_estimation
=
LectureGazeEstimation
.
objects
.
filter
(
lecture_video_id__lecture_video_id
=
lecture_video_id
)
isGazeEstimationFound
=
(
len
(
gaze_estimation
)
>
0
)
...
...
@@ -665,7 +664,7 @@ class GetStudentBehaviorSummaryForPeriod(APIView):
lecturer
=
request
.
query_params
.
get
(
'lecturer'
)
int_lecturer
=
int
(
lecturer
)
int_option
=
int
(
option
)
int_option
=
150
#
int_option = 150
isRecordFound
=
False
activity_percentages
=
{}
emotion_percentages
=
{}
...
...
FirstApp/emotion_detector.py
View file @
195f9fcd
...
...
@@ -319,11 +319,11 @@ def get_frame_emotion_recognition(video_name):
# calculating the percentages for the frame
happy_perct
=
float
(
happy_count
/
detection_count
)
*
100
sad_perct
=
float
(
sad_count
/
detection_count
)
*
100
angry_perct
=
float
(
angry_count
/
detection_count
)
*
100
neutral_perct
=
float
(
neutral_count
/
detection_count
)
*
100
surprise_perct
=
float
(
surprise_count
/
detection_count
)
*
100
happy_perct
=
float
(
happy_count
/
detection_count
)
*
100
if
detection_count
>
0
else
0
sad_perct
=
float
(
sad_count
/
detection_count
)
*
100
if
detection_count
>
0
else
0
angry_perct
=
float
(
angry_count
/
detection_count
)
*
100
if
detection_count
>
0
else
0
neutral_perct
=
float
(
neutral_count
/
detection_count
)
*
100
if
detection_count
>
0
else
0
surprise_perct
=
float
(
surprise_count
/
detection_count
)
*
100
if
detection_count
>
0
else
0
# this dictionary will be returned
frame_details
[
'happy_perct'
]
=
happy_perct
...
...
FirstApp/logic/activity_recognition.py
View file @
195f9fcd
...
...
@@ -129,10 +129,10 @@ def activity_recognition(video_path):
p
.
write
(
"yes"
)
# calculating the percentages for each label
phone_perct
=
float
(
phone_checking_count
/
total_detections
)
*
100
talking_perct
=
float
(
talking_count
/
total_detections
)
*
100
note_perct
=
float
(
note_taking_count
/
total_detections
)
*
100
listening_perct
=
float
(
listening_count
/
total_detections
)
*
100
phone_perct
=
float
(
phone_checking_count
/
total_detections
)
*
100
if
total_detections
>
0
else
0
talking_perct
=
float
(
talking_count
/
total_detections
)
*
100
if
total_detections
>
0
else
0
note_perct
=
float
(
note_taking_count
/
total_detections
)
*
100
if
total_detections
>
0
else
0
listening_perct
=
float
(
listening_count
/
total_detections
)
*
100
if
total_detections
>
0
else
0
# assigning the percentages to the dictionary
percentages
[
"phone_perct"
]
=
phone_perct
...
...
FirstApp/templates/FirstApp/Home.html
View file @
195f9fcd
This diff is collapsed.
Click to expand it.
FirstApp/templates/FirstApp/activity.html
View file @
195f9fcd
...
...
@@ -221,12 +221,12 @@
//sending the POST request to process the lecture activities
fetch
(
'
http://127.0.0.1:8000/process-lecture-activity/?lecture_video_name=
'
+
global_video_name
+
'
&lecture_video_id=
'
+
global_lecture_video_id
)
.
then
((
res
)
=>
res
.
json
())
.
then
((
out
)
=>
handleResponse
(
out
.
response
,
e
))
.
then
((
out
)
=>
handle
Activity
Response
(
out
.
response
,
e
))
.
catch
((
error
)
=>
alert
(
'
error:
'
+
error
));
});
//this is to
change the button from 'process' to 'results'
function
handleResponse
(
response
,
e
)
{
//this is to
detect the response gained from activity recognition porcess
function
handle
Activity
Response
(
response
,
e
)
{
//change the button, if the response is positive
if
(
response
)
{
e
.
target
.
parentNode
.
parentNode
.
lastChild
.
innerHTML
=
'
<button type="button" class="btn btn-primary" id="result_btn">Results</button>
'
;
...
...
FirstApp/templates/FirstApp/emotion.html
View file @
195f9fcd
This diff is collapsed.
Click to expand it.
FirstApp/templates/FirstApp/template.html
View file @
195f9fcd
...
...
@@ -54,11 +54,11 @@
<!-- Divider -->
<hr
class=
"sidebar-divider my-0"
>
<!-- Nav Item -
Dashboard
-->
<!-- Nav Item -
Home
-->
<li
class=
"nav-item active"
>
<a
class=
"nav-link"
href=
"/"
>
<i
class=
"fas fa-fw fa-tachometer-alt"
></i>
<span>
Dashboard
</span></a>
<span>
Home
</span></a>
</li>
<!-- Divider -->
...
...
@@ -78,7 +78,7 @@
<div
id=
"collapseTwo"
class=
"collapse"
aria-labelledby=
"headingTwo"
data-parent=
"#accordionSidebar"
>
<div
class=
"bg-white py-2 collapse-inner rounded"
>
<h6
class=
"collapse-header"
>
Components:
</h6>
<a
class=
"collapse-item"
href=
"/pose"
>
Pose
</a>
{#
<a
class=
"collapse-item"
href=
"/pose"
>
Pose
</a>
#}
<a
class=
"collapse-item"
href=
"/gaze"
>
Gaze
</a>
<a
class=
"collapse-item"
href=
"/emotion"
>
Emotion
</a>
<a
class=
"collapse-item"
href=
"/activity"
>
Activity
</a>
...
...
@@ -95,10 +95,10 @@
<div
id=
"collapseUtilities"
class=
"collapse"
aria-labelledby=
"headingUtilities"
data-parent=
"#accordionSidebar"
>
<div
class=
"bg-white py-2 collapse-inner rounded"
>
<h6
class=
"collapse-header"
>
Custom Utilities:
</h6>
<a
class=
"collapse-item"
href=
"/extract"
>
Video Extractor
</a>
{#
<a
class=
"collapse-item"
href=
"/extract"
>
Video Extractor
</a>
#}
<a
class=
"collapse-item"
href=
"/video_result"
>
Video Results
</a>
<a
class=
"collapse-item"
href=
"utilities-animation.html"
>
Animations
</a>
<a
class=
"collapse-item"
href=
"utilities-other.html"
>
Other
</a>
{#
<a
class=
"collapse-item"
href=
"utilities-animation.html"
>
Animations
</a>
#}
{#
<a
class=
"collapse-item"
href=
"utilities-other.html"
>
Other
</a>
#}
</div>
</div>
</li>
...
...
@@ -106,44 +106,44 @@
<!-- Divider -->
<hr
class=
"sidebar-divider"
>
<!-- Heading -->
<div
class=
"sidebar-heading"
>
Addons
</div>
<!-- Nav Item - Pages Collapse Menu -->
<li
class=
"nav-item"
>
<a
class=
"nav-link collapsed"
href=
"#"
data-toggle=
"collapse"
data-target=
"#collapsePages"
aria-expanded=
"true"
aria-controls=
"collapsePages"
>
<i
class=
"fas fa-fw fa-folder"
></i>
<span>
Pages
</span>
</a>
<div
id=
"collapsePages"
class=
"collapse"
aria-labelledby=
"headingPages"
data-parent=
"#accordionSidebar"
>
<div
class=
"bg-white py-2 collapse-inner rounded"
>
<h6
class=
"collapse-header"
>
Login Screens:
</h6>
<a
class=
"collapse-item"
href=
"/login"
>
Login
</a>
<a
class=
"collapse-item"
href=
"/register"
>
Register
</a>
<a
class=
"collapse-item"
href=
"/forgot-password"
>
Forgot Password
</a>
<div
class=
"collapse-divider"
></div>
<h6
class=
"collapse-header"
>
Other Pages:
</h6>
<a
class=
"collapse-item"
href=
"/404"
>
404 Page
</a>
<a
class=
"collapse-item"
href=
"/blank"
>
Blank Page
</a>
</div>
</div>
</li>
<!-- Nav Item - Charts -->
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"charts.html"
>
<i
class=
"fas fa-fw fa-chart-area"
></i>
<span>
Charts
</span></a>
</li>
<!-- Nav Item - Tables -->
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"/tables"
>
<i
class=
"fas fa-fw fa-table"
></i>
<span>
Tables
</span></a>
</li>
{#
<!-- Heading -->
#}
{#
<div
class=
"sidebar-heading"
>
#}
{# Addons#}
{#
</div>
#}
{#
<!-- Nav Item - Pages Collapse Menu -->
#}
{#
<li
class=
"nav-item"
>
#}
{#
<a
class=
"nav-link collapsed"
href=
"#"
data-toggle=
"collapse"
data-target=
"#collapsePages"
aria-expanded=
"true"
aria-controls=
"collapsePages"
>
#}
{#
<i
class=
"fas fa-fw fa-folder"
></i>
#}
{#
<span>
Pages
</span>
#}
{#
</a>
#}
{#
<div
id=
"collapsePages"
class=
"collapse"
aria-labelledby=
"headingPages"
data-parent=
"#accordionSidebar"
>
#}
{#
<div
class=
"bg-white py-2 collapse-inner rounded"
>
#}
{#
<h6
class=
"collapse-header"
>
Login Screens:
</h6>
#}
{#
<a
class=
"collapse-item"
href=
"/login"
>
Login
</a>
#}
{#
<a
class=
"collapse-item"
href=
"/register"
>
Register
</a>
#}
{#
<a
class=
"collapse-item"
href=
"/forgot-password"
>
Forgot Password
</a>
#}
{#
<div
class=
"collapse-divider"
></div>
#}
{#
<h6
class=
"collapse-header"
>
Other Pages:
</h6>
#}
{#
<a
class=
"collapse-item"
href=
"/404"
>
404 Page
</a>
#}
{#
<a
class=
"collapse-item"
href=
"/blank"
>
Blank Page
</a>
#}
{#
</div>
#}
{#
</div>
#}
{#
</li>
#}
{##}
{#
<!-- Nav Item - Charts -->
#}
{#
<li
class=
"nav-item"
>
#}
{#
<a
class=
"nav-link"
href=
"charts.html"
>
#}
{#
<i
class=
"fas fa-fw fa-chart-area"
></i>
#}
{#
<span>
Charts
</span></a>
#}
{#
</li>
#}
{##}
{#
<!-- Nav Item - Tables -->
#}
{#
<li
class=
"nav-item"
>
#}
{#
<a
class=
"nav-link"
href=
"/tables"
>
#}
{#
<i
class=
"fas fa-fw fa-table"
></i>
#}
{#
<span>
Tables
</span></a>
#}
{#
</li>
#}
<!-- Divider -->
<hr
class=
"sidebar-divider d-none d-md-block"
>
...
...
FirstApp/templates/FirstApp/video_results.html
View file @
195f9fcd
This diff is collapsed.
Click to expand it.
FirstApp/views.py
View file @
195f9fcd
...
...
@@ -371,6 +371,7 @@ def video_result(request):
data
=
serializer
.
data
# iterate through the existing lecture videos for the lecturer
for
video
in
data
:
video_id
=
video
[
'id'
]
date
=
video
[
'date'
]
...
...
@@ -382,7 +383,9 @@ def video_result(request):
to_do_lecture_list
.
append
({
"lecturer"
:
lecturer
,
"date"
:
date
,
"subject"
:
subject
"subject"
:
subject
,
"video_id"
:
video
[
'id'
],
"video_name"
:
video
[
'video_name'
]
})
# once the lectures that needs to be processed are found out, extract the corresponding timetable details
...
...
@@ -405,7 +408,6 @@ def video_result(request):
# loop through the to-do lecture list
for
item
in
to_do_lecture_list
:
print
(
'item date: '
,
item
[
'date'
])
isDate
=
item
[
'date'
]
==
str
(
day_timetable
[
'date'
])
# isLecturer = item['lecturer'] ==
# check for the particular lecture on the day
...
...
@@ -422,8 +424,11 @@ def video_result(request):
obj
=
{}
obj
[
'date'
]
=
item
[
'date'
]
obj
[
'subject'
]
=
slot
[
'subject'
][
'subject_code'
]
obj
[
'subject_name'
]
=
slot
[
'subject'
][
'name'
]
obj
[
'start_time'
]
=
slot
[
'start_time'
]
obj
[
'end_time'
]
=
slot
[
'end_time'
]
obj
[
'video_id'
]
=
item
[
'video_id'
]
obj
[
'video_name'
]
=
item
[
'video_name'
]
# append to the list
due_lecture_list
.
append
(
obj
)
...
...
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