Keep top human/machine legacy categories below 0.5 for privacy blocking
The portal blocks images whose top ICU category is human or machine for non-admins. With the 0.5 threshold, 103 such images would have lost their detection and become visible. Those categories are now migrated when they were the image's top category, regardless of score. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,9 @@ ON CONFLICT (source_ref) WHERE source = 'entrance' DO NOTHING;
|
||||
-- step: detection
|
||||
-- remote_cam.category ist ein Score-Vektor ueber alle Klassen, detection haelt nur Erkanntes:
|
||||
-- uebernommen werden Klassen ab Score 0.5, ohne '' und 'none' (leeres Bild = keine Detection).
|
||||
-- Ausnahme Datenschutz: war 'human' oder 'machine' die Top-Kategorie des Bildes, wird sie auch
|
||||
-- unter 0.5 uebernommen -- das Portal sperrt solche Bilder fuer Nicht-Admins (wie bisher ueber
|
||||
-- die Top-Kategorie). Tiebreaker wie die fruehere image_top_category: Score, dann Name.
|
||||
INSERT INTO remote_cam.detection (image_uuid, category, confidence, model_version, source)
|
||||
SELECT i.image_uuid, c.category, c.score, c.version, 'entrance'
|
||||
FROM _mig_batch b
|
||||
@@ -91,7 +94,12 @@ JOIN remote_cam.category c ON c.image_uuid = b.metadata_uuid
|
||||
JOIN remote_cam.image i ON i.image_uuid = b.metadata_uuid::uuid
|
||||
WHERE c.category IS NOT NULL
|
||||
AND c.category NOT IN ('', 'none')
|
||||
AND c.score >= 0.5
|
||||
AND (c.score >= 0.5
|
||||
OR (c.category IN ('human', 'machine')
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM remote_cam.category c2
|
||||
WHERE c2.image_uuid = c.image_uuid
|
||||
AND (c2.score > c.score OR (c2.score = c.score AND c2.category < c.category)))))
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM remote_cam.detection d
|
||||
WHERE d.image_uuid = i.image_uuid AND d.source = 'entrance'
|
||||
|
||||
Reference in New Issue
Block a user