From 1cfb07903bb0d125d852c04f8af74e480f1923b6 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 1 Jul 2021 21:54:26 +1000 Subject: [PATCH] slightly improve ai stats --- ai.py | 13 ++++++++++++- templates/aistats.html | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ai.py b/ai.py index 9112953..ea56faf 100644 --- a/ai.py +++ b/ai.py @@ -23,7 +23,18 @@ from face import Face, FaceFileLink, FaceRefimgLink @login_required def aistats(): stats = db.session.execute( "select p.tag, count(f.id) from person p, face f, face_file_link ffl, face_refimg_link frl, person_refimg_link prl where p.id = prl.person_id and prl.refimg_id = frl.refimg_id and frl.face_id = ffl.face_id and ffl.face_id = f.id group by p.tag" ) - return render_template("aistats.html", page_title='AI Statistics', stats=stats) + fstats={} + fstats['files_with_a_face'] = db.session.execute( "select count(distinct file_eid) as count from face_file_link" ).first()[0] + fstats['files_with_a_match'] = db.session.execute( "select count(distinct ffl.file_eid) as count from face_file_link ffl, face_refimg_link frl where frl.face_id = ffl.face_id" ).first()[0] + fstats['files_with_missing_matches'] = db.session.execute( "select count(distinct ffl.file_eid) from face f left join face_refimg_link frl on f.id = frl.face_id join face_file_link ffl on f.id = ffl.face_id where frl.refimg_id is null" ).first()[0] + + # files_with_no_matches? + + fstats['all_faces'] = db.session.execute( "select count(distinct face_id) as count from face_file_link" ).first()[0] + fstats['all_matched_faces'] = db.session.execute( "select count(distinct face_id) as count from face_refimg_link" ).first()[0] + fstats['all_unmatched_faces'] = db.session.execute( "select count(f.id) from face f left join face_refimg_link frl on f.id = frl.face_id where frl.refimg_id is null" ).first()[0] + + return render_template("aistats.html", page_title='AI Statistics', stats=stats, fstats=fstats ) ################################################################################ diff --git a/templates/aistats.html b/templates/aistats.html index 5af9c62..963c781 100644 --- a/templates/aistats.html +++ b/templates/aistats.html @@ -2,6 +2,16 @@ {% block main_content %}

Basic AI stats

+ + + + + + + + +
WhatAmount
Files with a face{{fstats['files_with_a_face']}}
Files with a matched face{{fstats['files_with_a_match']}}
Files with missing matches{{fstats['files_with_missing_matches']}}
All faces found{{fstats['all_faces']}}
All faces matched{{fstats['all_matched_faces']}}
All faces unmatched{{fstats['all_unmatched_faces']}}
+ {% for s in stats %}
Person (tag)Number of files matched