updated stats to use new face tables and be more useful now amount of matches is in the thousands
This commit is contained in:
15
ai.py
15
ai.py
@@ -5,12 +5,13 @@ from main import db, app, ma
|
||||
from sqlalchemy import Sequence
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from status import st, Status
|
||||
from files import Entry, File, FileRefimgLink
|
||||
from files import Entry, File
|
||||
from person import Person, PersonRefimgLink
|
||||
from refimg import Refimg
|
||||
from flask_login import login_required, current_user
|
||||
|
||||
from job import Job, JobExtra, Joblog, NewJob
|
||||
from face import Face, FaceFileLink, FaceRefimgLink
|
||||
|
||||
|
||||
# pylint: disable=no-member
|
||||
@@ -21,16 +22,8 @@ from job import Job, JobExtra, Joblog, NewJob
|
||||
@app.route("/aistats", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def aistats():
|
||||
tmp=db.session.query(Entry,Person).join(File).join(FileRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(FileRefimgLink.matched==True).all()
|
||||
entries=[]
|
||||
last_fname=""
|
||||
for e, p in tmp:
|
||||
if last_fname != e.name:
|
||||
entry = { 'name': e.name, 'people': [] }
|
||||
entries.append( entry )
|
||||
last_fname = e.name
|
||||
entry['people'].append( { 'tag': p.tag } )
|
||||
return render_template("aistats.html", page_title='Placeholder', entries=entries)
|
||||
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)
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -3,13 +3,9 @@
|
||||
{% block main_content %}
|
||||
<h3>Basic AI stats</h3>
|
||||
<table class="table table-striped table-sm">
|
||||
<tbody><thead class="thead-light"><tr><th>File</th><th>AI Matched people</th></thead>
|
||||
{% for e in entries %}
|
||||
<tr><td>{{e.name}}</td><td>
|
||||
{% for p in e.people %}
|
||||
{{p.tag}}
|
||||
{% endfor %}
|
||||
</td></tr>
|
||||
<tbody><thead class="thead-light"><tr><th>Person (tag)</th><th>Number of files matched</th></thead>
|
||||
{% for s in stats %}
|
||||
<tr><td>{{s[0]}}</td><td>{{s[1]}}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody></table>
|
||||
{% endblock main_content %}
|
||||
|
||||
Reference in New Issue
Block a user