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
7bcf0851
Commit
7bcf0851
authored
Sep 30, 2020
by
I.K Seneviratne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing the implementation of the Gaze estimation period statistics in Lecturer Home Page
parent
0e91389b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
266 additions
and
2 deletions
+266
-2
FirstApp/admin.py
FirstApp/admin.py
+2
-1
FirstApp/api.py
FirstApp/api.py
+21
-0
FirstApp/logic/head_gaze_estimation.py
FirstApp/logic/head_gaze_estimation.py
+55
-1
FirstApp/templates/FirstApp/Home.html
FirstApp/templates/FirstApp/Home.html
+188
-0
No files found.
FirstApp/admin.py
View file @
7bcf0851
...
@@ -11,4 +11,5 @@ admin.site.register(LecturerSubject)
...
@@ -11,4 +11,5 @@ admin.site.register(LecturerSubject)
admin
.
site
.
register
(
LecturerCredentials
)
admin
.
site
.
register
(
LecturerCredentials
)
admin
.
site
.
register
(
FacultyTimetable
)
admin
.
site
.
register
(
FacultyTimetable
)
admin
.
site
.
register
(
LectureVideo
)
admin
.
site
.
register
(
LectureVideo
)
admin
.
site
.
register
(
LectureActivity
)
admin
.
site
.
register
(
LectureActivity
)
\ No newline at end of file
admin
.
site
.
register
(
LectureGazeEstimation
)
\ No newline at end of file
FirstApp/api.py
View file @
7bcf0851
...
@@ -668,10 +668,15 @@ class GetStudentBehaviorSummaryForPeriod(APIView):
...
@@ -668,10 +668,15 @@ class GetStudentBehaviorSummaryForPeriod(APIView):
isRecordFound
=
False
isRecordFound
=
False
activity_percentages
=
{}
activity_percentages
=
{}
emotion_percentages
=
{}
emotion_percentages
=
{}
gaze_estimation_percentages
=
{}
individual_lec_activties
=
[]
individual_lec_activties
=
[]
individual_lec_emotions
=
[]
individual_lec_emotions
=
[]
individual_lec_gaze_estimations
=
[]
activity_labels
=
[]
activity_labels
=
[]
emotion_labels
=
[]
emotion_labels
=
[]
gaze_estimation_labels
=
[]
current_date
=
datetime
.
datetime
.
now
()
.
date
()
current_date
=
datetime
.
datetime
.
now
()
.
date
()
...
@@ -705,13 +710,29 @@ class GetStudentBehaviorSummaryForPeriod(APIView):
...
@@ -705,13 +710,29 @@ class GetStudentBehaviorSummaryForPeriod(APIView):
emotion_percentages
,
individual_lec_emotions
,
emotion_labels
=
ed
.
get_student_emotion_summary_for_period
(
emotion_data
)
emotion_percentages
,
individual_lec_emotions
,
emotion_labels
=
ed
.
get_student_emotion_summary_for_period
(
emotion_data
)
# retrieving lecture gaze estimations
lec_gaze_estimation
=
LectureGazeEstimation
.
objects
.
filter
(
lecture_video_id__date__gte
=
previous_date
,
lecture_video_id__date__lte
=
current_date
,
lecture_video_id__lecturer
=
lecturer
)
# if there are gaze estimation data
if
len
(
lec_gaze_estimation
)
>
0
:
gaze_estimation_serializer
=
LectureGazeEstimationSerializer
(
lec_gaze_estimation
,
many
=
True
)
gaze_estimation_data
=
gaze_estimation_serializer
.
data
gaze_estimation_percentages
,
individual_lec_gaze_estimations
,
gaze_estimation_labels
=
hge
.
get_student_gaze_estimation_summary_for_period
(
gaze_estimation_data
)
return
Response
({
return
Response
({
"activity_response"
:
activity_percentages
,
"activity_response"
:
activity_percentages
,
"emotion_response"
:
emotion_percentages
,
"emotion_response"
:
emotion_percentages
,
"gaze_estimation_response"
:
gaze_estimation_percentages
,
"individual_activities"
:
individual_lec_activties
,
"individual_activities"
:
individual_lec_activties
,
"individual_emotions"
:
individual_lec_emotions
,
"individual_emotions"
:
individual_lec_emotions
,
"individual_gaze_estimations"
:
individual_lec_gaze_estimations
,
"activity_labels"
:
activity_labels
,
"activity_labels"
:
activity_labels
,
"emotion_labels"
:
emotion_labels
,
"emotion_labels"
:
emotion_labels
,
"gaze_estimation_labels"
:
gaze_estimation_labels
,
"isRecordFound"
:
isRecordFound
"isRecordFound"
:
isRecordFound
})
})
FirstApp/logic/head_gaze_estimation.py
View file @
7bcf0851
...
@@ -554,4 +554,58 @@ def get_lecture_gaze_esrimation_for_frames(video_name):
...
@@ -554,4 +554,58 @@ def get_lecture_gaze_esrimation_for_frames(video_name):
return
frame_detections
,
frame_rate
return
frame_detections
,
frame_rate
\ No newline at end of file
def
get_student_gaze_estimation_summary_for_period
(
gaze_estimation_data
):
# declare variables to add percentage values
phone_checking_perct_combined
=
0.0
listening_perct_combined
=
0.0
note_taking_perct_combined
=
0.0
looking_up_right_perct_combined
=
0.0
looking_up_left_perct_combined
=
0.0
looking_down_right_perct_combined
=
0.0
looking_down_left_perct_combined
=
0.0
looking_front_perct_combined
=
0.0
# get the number of activties to calculate average
no_of_gaze_estimations
=
len
(
gaze_estimation_data
)
individual_lec_gaze_estimations
=
[]
gaze_estimation_labels
=
[
"looking_up_and_right_perct"
,
"looking_up_and_left_perct"
,
"looking_down_and_right_perct"
,
"looking_down_and_left_perct"
,
"looking_front_perct"
]
# iterate through the activities
for
gaze_estimation
in
gaze_estimation_data
:
individual_gaze_estimation
=
{}
individual_gaze_estimation
[
"looking_up_and_right_perct"
]
=
float
(
gaze_estimation
[
'looking_up_and_right_perct'
])
individual_gaze_estimation
[
"looking_up_and_left_perct"
]
=
float
(
gaze_estimation
[
'looking_up_and_left_perct'
])
individual_gaze_estimation
[
"looking_down_and_right_perct"
]
=
float
(
gaze_estimation
[
'looking_down_and_right_perct'
])
individual_gaze_estimation
[
"looking_down_and_left_perct"
]
=
float
(
gaze_estimation
[
'looking_down_and_left_perct'
])
individual_gaze_estimation
[
"looking_front_perct"
]
=
float
(
gaze_estimation
[
'looking_front_perct'
])
looking_up_right_perct_combined
+=
float
(
gaze_estimation
[
'looking_up_and_right_perct'
])
looking_up_left_perct_combined
+=
float
(
gaze_estimation
[
'looking_up_and_left_perct'
])
looking_down_right_perct_combined
+=
float
(
gaze_estimation
[
'looking_down_and_right_perct'
])
looking_down_left_perct_combined
+=
float
(
gaze_estimation
[
'looking_down_and_left_perct'
])
looking_front_perct_combined
+=
float
(
gaze_estimation
[
'looking_front_perct'
])
# append to the list
individual_lec_gaze_estimations
.
append
(
individual_gaze_estimation
)
# calculate the average percentages
looking_up_right_average_perct
=
round
((
looking_up_right_perct_combined
/
no_of_gaze_estimations
),
1
)
looking_up_left_perct
=
round
((
looking_up_left_perct_combined
/
no_of_gaze_estimations
),
1
)
looking_down_right_average_perct
=
round
((
looking_down_right_perct_combined
/
no_of_gaze_estimations
),
1
)
looking_down_left_average_perct
=
round
((
looking_down_left_perct_combined
/
no_of_gaze_estimations
),
1
)
looking_front_average_perct
=
round
((
looking_front_perct_combined
/
no_of_gaze_estimations
),
1
)
percentages
=
{}
percentages
[
"looking_up_and_right_perct"
]
=
looking_up_right_average_perct
percentages
[
"looking_up_and_left_perct"
]
=
looking_up_left_perct_combined
percentages
[
"looking_down_and_right_perct"
]
=
looking_down_right_perct_combined
percentages
[
"looking_down_and_left_perct"
]
=
looking_down_left_perct_combined
percentages
[
"looking_front_perct"
]
=
looking_front_average_perct
return
percentages
,
individual_lec_gaze_estimations
,
gaze_estimation_labels
\ No newline at end of file
FirstApp/templates/FirstApp/Home.html
View file @
7bcf0851
This diff is collapsed.
Click to expand it.
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