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 import Sequence
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
from sqlalchemy.exc import SQLAlchemyError
|
||||||
from status import st, Status
|
from status import st, Status
|
||||||
from files import Entry, File, FileRefimgLink
|
from files import Entry, File
|
||||||
from person import Person, PersonRefimgLink
|
from person import Person, PersonRefimgLink
|
||||||
from refimg import Refimg
|
from refimg import Refimg
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
|
|
||||||
from job import Job, JobExtra, Joblog, NewJob
|
from job import Job, JobExtra, Joblog, NewJob
|
||||||
|
from face import Face, FaceFileLink, FaceRefimgLink
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
@@ -21,16 +22,8 @@ from job import Job, JobExtra, Joblog, NewJob
|
|||||||
@app.route("/aistats", methods=["GET", "POST"])
|
@app.route("/aistats", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def aistats():
|
def aistats():
|
||||||
tmp=db.session.query(Entry,Person).join(File).join(FileRefimgLink).join(Refimg).join(PersonRefimgLink).join(Person).filter(FileRefimgLink.matched==True).all()
|
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" )
|
||||||
entries=[]
|
return render_template("aistats.html", page_title='AI Statistics', stats=stats)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -3,13 +3,9 @@
|
|||||||
{% block main_content %}
|
{% block main_content %}
|
||||||
<h3>Basic AI stats</h3>
|
<h3>Basic AI stats</h3>
|
||||||
<table class="table table-striped table-sm">
|
<table class="table table-striped table-sm">
|
||||||
<tbody><thead class="thead-light"><tr><th>File</th><th>AI Matched people</th></thead>
|
<tbody><thead class="thead-light"><tr><th>Person (tag)</th><th>Number of files matched</th></thead>
|
||||||
{% for e in entries %}
|
{% for s in stats %}
|
||||||
<tr><td>{{e.name}}</td><td>
|
<tr><td>{{s[0]}}</td><td>{{s[1]}}</td></tr>
|
||||||
{% for p in e.people %}
|
|
||||||
{{p.tag}}
|
|
||||||
{% endfor %}
|
|
||||||
</td></tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
{% endblock main_content %}
|
{% endblock main_content %}
|
||||||
|
|||||||
Reference in New Issue
Block a user