Rilevamento del sorriso di livello forense con ridimensionatore di immagini luminose e visione AI

We are pleased to announce a new build of Light Image Resizer, incorporating extensive testing of the AI Vision feature as a smart, batch-capable image tagger. You can consult the full version history here. This article walks you through a concrete use case: configuring a preset that processes an entire folder of photographs and automatically detects the presence of a human subject along with a scientifically grounded smile intensity score. The methodology is inspired by the Facial Action Coding System (FACS) developed by Paul Ekman, which makes the output reproducible, structured, and suitable for professional or forensic applications.

AI smile detection using image resizer technology.

The Science Behind the Detection: FACS and Action Units

The Facial Action Coding System, originally developed by Swedish anatomist Carl-Herman Hjortsjö and later adopted and expanded by Paul Ekman and Wallace V. Friesen, is the international standard for describing facial muscle movements. Ekman, a psychologist and professor at the University of California, San Francisco, is recognized as one of the pioneers in the scientific study of emotions and their relationship to facial expressions. The system decomposes any facial expression into discrete Action Units (AU), each corresponding to the contraction of one or more specific muscles. For smile detection, the two critical units are AU6 (Orbicularis Oculi, cheek raiser) and AU12 (Zygomaticus Major, lip corner puller). A genuine Duchenne smile requires both AU6 and AU12 to activate simultaneously. A voluntary or posed smile typically involves AU12 alone. This distinction is precisely what the AI Vision prompt is designed to detect and report.

Caso d'Uso: Analisi a Loti di 1500 Fotografie per un'Indagine Legale

Per illustrare l'ampiezza pratica di questo flusso di lavoro, consideriamo il seguente scenario. Un'indagine legale richiede di esaminare una collezione di 1500 fotografie per determinare se un soggetto umano mostrasse disagio o un'espressione rilassata durante una sessione fotografica. Revisionare manualmente 1500 file richiede tempo e è soggettivo. Con Light Image Resizer configurato come descritto in questo tutorial, l'intero batch viene elaborato automaticamente e ogni file riceve un tag strutturato e leggibile da macchina scritto direttamente nei suoi metadati. Il tag è generato da un modello visivo AI istruito ad agire come analista forense delle espressioni facciali. Il risultato è così:

OLLAMA-MISTRAL-FORENSIC32-EXPERTV2:LATEST
[NO_SMILE:100]
No AU12 or AU6 activation detected. Neutral facial expression.

La prima riga identifica il modello utilizzato. La seconda riga è il tag standardizzato con un punteggio di fiducia espresso come numero intero in incrementi di dieci. La terza riga fornisce una breve giustificazione tecnica basata sull'analisi muscolare e sul rilevamento di artefatti. Questo output di tre righe è ripetibile, analizzabile e verificabile.

Puoi scaricare il preset pronto all'uso per questo caso d'uso qui:

Scarica il preset per il rilevamento del sorriso forense

Perché eseguire il modello localmente con Ollama

Privacy is a primary concern in any forensic or legal context. Uploading photographs of individuals to a third-party cloud API introduces risks that are unacceptable in sensitive investigations. Light Image Resizer now supports Ollama, which allows you to run vision language models entirely on your own machine, without any data leaving your network. There are no API costs, no usage limits, and no dependency on an internet connection. For this use case, running locally is not just a preference — it is a requirement. You can learn more about the Ollama integration introduced in Light Image Resizer on the official product page.

Configuring the Preset: General and File Type Settings

The key constraint in this use case is that the source images must not be altered. The preset is therefore configured to write only metadata, leaving the pixel content of each file completely untouched. In the General tab, set the action to Replace original and the destination to the same folder as the original. In the Advanced tab, the filter can remain at Lanczos and the policy at Always resize, but what matters is the File Type section: set Format to As Original, and under Compression, enable the Keep original quality option. This ensures that Light Image Resizer processes each file solely to write the AI Vision result as a comment in the image metadata, without re-encoding or degrading the image in any way. Resolution can be left at 96 DPI since it has no effect when the format is preserved as original.

Screenshot dell'interfaccia delle impostazioni di ridimensionamento software.
La scheda AI Vision in Light Image Resizer configurata per l'elaborazione locale Ollama con il prompt forense di rilevamento del sorriso.

Configurazione della scheda AI Vision

Apri il pannello Avanzato e naviga nella scheda AI Vision. Abilita la funzione usando la casella in alto nel pannello.

Interfaccia delle funzionalità AI Vision con opzioni di impostazioni

Nel menu a tendina del servizio, seleziona Ollama per un'elaborazione completamente locale. Se preferisci un modello basato su cloud, sono supportati anche Gemini (Gemini 3 Flash) e ChatGPT (GPT-5 Mini) e richiedono solo di inserire la chiave API nel pannello di configurazione. Imposta la dimensione massima a 896 pixel. Questa risoluzione è sufficiente per l'analisi facciale nella stragrande maggioranza dei soggetti fotografici e mantiene i tempi di elaborazione ragionevoli su grandi lotti. Per il campo Policy, Append aggiungerà ogni nuovo risultato AI al campo commento esistente senza cancellare le voci precedenti, cosa utile quando si esegue lo stesso lotto attraverso più modelli per confronto. Sostituire sovrascriverà ogni volta il campo commento.

Il Prompt Forense

Incolla il seguente prompt nel campo Prompt della scheda AI Vision. Ogni elemento di questo prompt è intenzionale. L'istruzione di sistema elimina il testo conversazionale dall'output. La direttiva sul Protocollo di Decomposizione Muscolare concentra il modello su AU6 e AU12. La clausola di rilevamento degli artefatti previene la classificazione errata causata da barbe, dita, sigari o altre occlusioni. Il thesaurus impone un vocabolario fisso, rendendo i risultati dei batch direttamente comparabili e ricercabili.

[SYSTEM] Act as a forensic facial expression analyst. Your mission is to translate facial muscle activity into a standardized tag with a confidence score. No prose. No conversational fillers. No 'think' tags. Apply the Muscular Decomposition Protocol (AU6/AU12) and identify mechanical artifacts (beard, cigar, finger) before concluding.

[OUTPUT STRUCTURE] Your response must consist of exactly three lines:

Line 1: %AISERVICE%-%AIMODEL%
Line 2: [TAG:SCORE]
Line 3: Brief technical justification (muscles vs artifacts).

[STRICT RULES]

1. SCORE: Must be an integer representing confidence from 0 to 100, strictly in steps of 10 (e.g., 60, 70, 80).
2. RELIABILITY GATE: If confidence is below 50, use the tag [UNSURE:SCORE] instead of a standard tag.
3. TAG SELECTION: Choose exactly one term from the THESAURUS below.
4. SYNTAX: Do not insert any characters, colons, or brackets between the TAG and the SCORE other than the specified [TAG:SCORE] format.

[THESAURUS]
NO_SMILE
MICRO_SMILE
SMILE
BROAD_SMILE
LAUGHING
UNSURE

[VALID EXAMPLE]
%AISERVICE%-%AIMODEL%
[UNSURE:90]
Artifact detected (beard shadow), insufficient AU6 activation.

verdict:

Il tempo di elaborazione varia notevolmente a seconda della GPU, della quantità di VRAM disponibile e del modello selezionato. Su un sistema dotato di NVIDIA RTX 3090 o 4060 Super, aspettati tra 5 e 90 secondi per file. I modelli da testare per questo compito includono Qwen2.5-VL, Mistral Small 24B e Gemma 4B per una velocità di maggiore velocità su hardware vincolato.

Revisione dei risultati in Light Image Editor

Una volta terminato l'elaborazione, apri qualsiasi file in Light Image Editor, incluso con Light Image Resizer. Naviga fino a Strumenti nel menu in alto e seleziona Commento, oppure premi Ctrl+T. Il campo commenti mostrerà l'output strutturato di ogni modello che è stato eseguito in base a quell'immagine.

Donna con cappello all'uncinetto e bikini sulla spiaggia.
Light Image Editor che mostra il campo commento di AI Vision dopo aver eseguito il batch forense di rilevamento sorrisi. Ogni voce corrisponde a un diverso modello linguistico testato durante lo sviluppo di questo articolo.

In the example shown above, the same photograph was analysed by seven different models, including a custom fine-tuned Mistral variant, Qwen3-VL 235B, Gemini 3 Flash Preview, GPT-5 Mini, and Kimi K2.5. The results vary in their precise classification between MICRO_SMILE and SMILE, but all agree on the absence of distress indicators and the presence of some degree of Zygomaticus Major activation. This kind of multi-model comparison is valuable when calibrating which model best suits your hardware constraints and your required output language. If you need results in French, Spanish, German, or another language, choosing a multilingual model such as Qwen or Mistral will produce the justification text in the target language without any modification to the prompt.

Ricerca nella tua libreria fotografica tramite tag generati dall'IA

Dopo aver elaborato un batch, i tag strutturati scritti nei metadati di ciascun file diventano immediatamente ricercabili da Esplora file di Windows. Apri la cartella contenente le immagini elaborate e usa la barra di ricerca per inserire una parola chiave o una combinazione di parole chiave. (Vedi l'angolo in alto a destra dello screenshot)

Cartella di immagini con foto di gatti e file Excel.
Ricerca in Esplora file filtrata da MICRO_SMILE E orbicularis. L'operatore AND restringe i risultati ai file in cui entrambi i termini compaiono nei metadati dei commenti.

Windows Explorer supports AND and OR operators in the search field. In the example shown, the query MICRO_SMILE AND orbicularis returns only the files where the model detected a low-intensity smile with documented orbicularis involvement. This transforms your local photo library into a structured, searchable evidence archive. The same approach extends to entirely different domains. You could write a prompt that identifies the country or city visible in a landscape photograph, classifies vehicle models, describes room configurations for real estate documentation, or analyses any visual attribute relevant to your professional context. The prompt is the only element that needs to change.

Exporting Metadata to CSV for Aggregate Analysis

Per indagini che richiedono una panoramica statistica di un'intera collezione, è disponibile su richiesta uno script Python che estrae i metadati dei commenti da ciascun file elaborato e li consolida in un unico file CSV. Questo CSV può poi essere importato in qualsiasi programma di foglio di calcolo oppure sottoposto a un modello linguistico per un'analisi di pattern di livello superiore, come identificare la proporzione di immagini contenenti sorrisi genuini rispetto a espressioni neutrali lungo una timeline di fotografie. Per richiedere lo script, contattaci con l'oggetto: Script Python AI Vision Smile.

Conclusione

Light Image Resizer provides a complete pipeline for forensic-grade facial expression analysis at scale. The combination of a structured FACS-based prompt, a locally hosted Ollama vision model for full data privacy, and the direct writing of results into image metadata creates a workflow that is reproducible, auditable, and deployable on any Windows machine with a capable GPU. The same infrastructure adapts readily to any domain that benefits from automated, expert-level image annotation. Download Light Image Resizer and the forensic smile detection preset to get started.

Scarica Light Image Resizer

View the full version history