Deteção de Sorrisos de Nível Forense com Light Image Resizer e AI Vision

Temos o prazer de anunciar uma nova versão do Light Image Resizer, incorporando testes extensivos da funcionalidade AI Vision como um etiquetador de imagens inteligente e capaz de processamento em lote. Pode consultar o historial completo aqui. 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 de Uso: Análise em Lote de 1500 Fotografias para uma Investigação Legal

Para ilustrar o âmbito prático deste fluxo de trabalho, considere o seguinte cenário. Uma investigação legal exige a revisão de uma coleção de 1500 fotografias para determinar se um sujeito humano demonstrava angústia ou uma expressão relaxada durante uma sessão fotográfica. Rever manualmente 1500 ficheiros é demorado e subjetivo. Com o Light Image Resizer configurado conforme descrito neste tutorial, todo o lote é processado automaticamente, e cada ficheiro recebe uma etiqueta estruturada e legível por máquina, escrita diretamente nos seus metadados. A etiqueta é gerada por um modelo visual de IA instruído a atuar como um analista forense de expressões faciais. O resultado é o seguinte:

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

A primeira linha identifica o modelo utilizado. A segunda linha é a etiqueta padronizada com uma pontuação de confiança expressa como um inteiro em passos de dez. A terceira linha fornece uma breve justificação técnica baseada na análise muscular e deteção de artefactos. Esta saída de três linhas é repetível, analisável e auditável.

Pode descarregar o preset pronto a usar para este caso de utilização aqui:

Descarregar o Preset de Detecção Forense de Sorriso

Por que Executar o Modelo Localmente com 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.

Captura de ecrã da interface de definições de redimensionamento de software.
O separador AI Vision no Light Image Resizer configurado para processamento local Ollama com o prompt forense de deteção de sorrisos.

Configurar o separador AI Vision

Abrir o painel Avançado e navegar até ao separador AI Vision. Ativar a funcionalidade usando a caixa de seleção no topo do painel.

Interface da funcionalidade AI Vision com opções de definições

No menu suspenso de Serviço, selecione Ollama para processamento totalmente local. Se preferir um modelo baseado na cloud, o Gemini (Gemini 3 Flash) e o ChatGPT (GPT-5 Mini) também são suportados e exigem apenas que introduza a sua chave API no painel de Configuração. Defina o tamanho máximo para 896 pixels. Esta resolução é suficiente para análise facial na grande maioria dos sujeitos fotográficos e mantém o tempo de processamento razoável em grandes lotes. No campo Política, Append adiciona cada novo resultado de IA ao campo de comentário existente sem apagar entradas anteriores, o que é útil quando executa o mesmo lote por vários modelos para comparação. Substituir irá sobrescrever o campo de comentários cada vez.

O Prompto Forense

Paste the following prompt into the Prompt field of the AI Vision tab. Every element of this prompt is intentional. The system instruction eliminates conversational text from the output. The Muscular Decomposition Protocol directive focuses the model on AU6 and AU12. The artifact detection clause prevents misclassification caused by beards, fingers, cigars, or other occlusions. The thesaurus enforces a fixed vocabulary, making batch results directly comparable and searchable.

[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:

O tempo de processamento varia consideravelmente consoante a sua GPU, a quantidade de VRAM disponível e o modelo selecionado. Num sistema equipado com uma NVIDIA RTX 3090 ou 4060 Super, espere entre 5 e 90 segundos por ficheiro. Modelos que valem a pena testar para esta tarefa incluem Qwen2.5-VL, Mistral Small 24B e Gemma 4B para maior throughput em hardware restrito.

Revisão de Resultados no Light Image Editor

Assim que o lote terminar o processamento, abra qualquer ficheiro no Light Image Editor, que está incluído com o Light Image Resizer. Navegue até Ferramentas no menu superior e selecione Comentário, ou pressione Ctrl+T. O campo de comentários irá mostrar a saída estruturada de cada modelo que foi executada em relação a essa imagem.

Mulher a usar chapéu de crochet e biquíni na praia.
Light Image Editor displaying the AI Vision comment field after running the forensic smile detection batch. Each entry corresponds to a different language model tested during the development of this article.

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.

Procurar na Sua Biblioteca de Fotos por Etiquetas Geradas por IA

Após processar um lote, as etiquetas estruturadas escritas nos metadados de cada ficheiro tornam-se imediatamente pesquisáveis a partir do Windows Explorer. Abra a pasta que contém as suas imagens processadas e utilize a barra de pesquisa para inserir uma palavra-chave ou uma combinação de palavras-chave. (Veja o canto superior direito do ecrã)

Pasta de imagens com fotos de gatos e ficheiro Excel.
Pesquisa no Windows Explorer filtrada por MICRO_SMILE E orbicularis. O operador AND restringe os resultados a ficheiros onde ambos os termos aparecem nos metadados de comentário.

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

Para investigações que exigem uma visão estatística de toda uma coleção, está disponível, mediante pedido, um script Python que extrai os metadados dos comentários de cada ficheiro processado e os consolida num único ficheiro CSV. Este CSV pode depois ser importado para qualquer aplicação de folhas de cálculo ou submetido a um modelo de linguagem para uma análise de padrões de nível superior, como a identificação da proporção de imagens com sorrisos genuínos versus expressões neutras ao longo de uma cronologia de fotografias. Para solicitar o script, contacte-nos com a linha de assunto: Script Python AI Vision Smile.

Conclusão

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.

Baixar Light Image Resizer

View the full version history