Commit 7358e49a authored by I.K Seneviratne's avatar I.K Seneviratne

Committing the corrections in the logic files.

parent 069680f0
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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>
......
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment