Fotos: Fotowand je Verband + Gesichtssuche (lokales SCRFD/MobileFaceNet via onnxruntime)

This commit is contained in:
Nicolas Gruber
2026-10-19 11:28:59 +02:00
parent 32b4dc4823
commit d97164cddc
12 changed files with 640 additions and 2 deletions
+74
View File
@@ -0,0 +1,74 @@
{% extends "base.html" %}
{% block title %}Gesichtssuche{% endblock %}
{% block content %}
<h1 class="page-title">Gesichtssuche
{% if stg %}<span class="badge">{{ stg.code }} - {{ stg.name }}</span>{% endif %}
</h1>
<div class="card">
<form class="form-row" method="get" action="/fotos">
<div class="field">
<label>Studiengang</label>
<select name="kz">
{% for s in meta.stgs %}
<option value="{{ s.kz }}" {{ 'selected' if s.kz == kz }}>{{ s.code }} - {{ s.name }}</option>
{% endfor %}
</select>
</div>
<div class="field">
<label>Studien-Semester</label>
<select name="sem">
{% for n in range(1, 9) %}
<option value="{{ n }}" {{ 'selected' if (n | string) == sem }}>{{ n }}</option>
{% endfor %}
</select>
</div>
<div class="field">
<label>Verband</label>
<select name="ver">
{% for v in verbands %}
<option value="{{ v }}" {{ 'selected' if v == ver }}>{{ v }}{{ verband_label(v) }}</option>
{% endfor %}
</select>
</div>
<button class="btn btn-primary" type="submit">Zurück zur Fotowand</button>
</form>
</div>
{% if error %}
<div class="card">
<p class="empty" style="color:#b3261e">{{ error }}</p>
</div>
{% else %}
<div class="card">
<h2>
Ergebnisse
<span class="count-pill">{{ results | selectattr('sim', 'ge', 0.35) | list | length }} Treffer</span>
{% if took is defined %}<span class="badge badge-muted">{{ took }} s</span>{% endif %}
</h2>
{% if results | selectattr('sim', 'ge', 0.35) | list | length %}
<div class="match-grid">
{% for r in results[:30] %}
<div class="match-tile {{ 'match-strong' if r.sim >= 0.5 else ('match-mid' if r.sim >= 0.35 else '') }}">
<img src="{{ r.img }}" alt="{{ r.nachname }}">
<div class="match-name">
<a href="/plan?uid={{ r.matrikel }}">{{ r.nachname }}{% if r.vorname %}, {{ r.vorname }}{% endif %}</a>
</div>
<div class="match-sim">
<div class="sim-bar"><div style="width: {{ [r.sim * 100, 0] | max | round(0) }}%"></div></div>
<span class="sim-num">{{ [r.sim * 100, 0] | max | round(0) }} %</span>
</div>
</div>
{% endfor %}
</div>
<p class="hint" style="margin-top:12px">
<strong>Hinweis:</strong> Hohe Werte (grün, &ge; 50 %) deuten auf dieselbe Person hin.
Werte um 35–50 % (gelb) sind mögliche Treffer - bitte prüfen. Unter 35 % wird nicht als Treffer gezählt.
</p>
{% else %}
<p class="empty">Kein Treffer mit &ge; 35 % Ähnlichkeit gefunden.
Prüfe, ob das richtige Semester/Verband gewählt ist und das Foto ein klar sichtbares Gesicht zeigt.</p>
{% endif %}
</div>
{% endif %}
{% endblock %}