Detección de sonrisas de grado forense con redimensionador de imagen de luz y visión con IA

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 de uso: Análisis por lotes de 1500 fotografías para una investigación legal

Para ilustrar el alcance práctico de este flujo de trabajo, consideremos el siguiente escenario. Una investigación legal requiere revisar una colección de 1500 fotografías para determinar si un sujeto humano mostraba angustia o expresión relajada durante una sesión de fotos. Revisar manualmente 1500 archivos es lento y subjetivo. Con Light Image Resizer configurado como se describe en este tutorial, todo el lote se procesa automáticamente y cada archivo recibe una etiqueta estructurada y legible por máquina escrita directamente en sus metadatos. La etiqueta es generada por un modelo visual de IA instruido para actuar como analista forense de expresiones faciales. El resultado es este :

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

La primera línea identifica el modelo utilizado. La segunda línea es la etiqueta estandarizada con una puntuación de confianza expresada como un número entero en pasos de diez. La tercera línea proporciona una breve justificación técnica basada en el análisis muscular y la detección de artefactos. Esta salida de tres líneas es repetible, parseable y auditable.

Puedes descargar el preset listo para usar para este caso aquí:

Descargar el preset de detección de sonrisa forense

Por qué ejecutar el modelo 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.

Captura de pantalla de la interfaz de configuración de configuración de software.
La pestaña de AI Vision en Light Image Resizer configurada para el procesamiento local de Ollama con el aviso forense de detección de sonrisas.

Configurando la pestaña de AI Vision

Abre el panel avanzado y ve a la pestaña AI Vision. Activa la función usando la casilla de verificación en la parte superior del panel.

Interfaz de funciones de AI Vision con opciones de configuración

In the Service dropdown, select Ollama for fully local processing. If you prefer a cloud-based model, Gemini (Gemini 3 Flash) and ChatGPT (GPT-5 Mini) are also supported and require only that you enter your API key in the Config panel. Set Max Size to 896 pixels. This resolution is sufficient for facial analysis in the vast majority of photographic subjects and keeps processing time reasonable across large batches. For the Policy field, Append will add each new AI result to the existing comment field without erasing previous entries, which is useful when you run the same batch through multiple models for comparison. Replace will overwrite the comment field each time.

The Forensic Prompt

Pega el siguiente prompt en el campo de Prompt de la pestaña de Visión de IA. Cada elemento de esta consigna es intencionado. La instrucción del sistema elimina el texto conversacional de la salida. La directiva del Protocolo de Descomposición Muscular centra el modelo en AU6 y AU12. La cláusula de detección de artefactos previene la clasificación errónea causada por barbas, dedos, puros u otras oclusiones. El tesauro impone un vocabulario fijo, haciendo que los resultados de lote sean directamente comparables y buscables.

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

El tiempo de procesamiento varía considerablemente según tu GPU, la cantidad de VRAM disponible y el modelo seleccionado. En un sistema equipado con una NVIDIA RTX 3090 o 4060 Super, espera entre 5 y 90 segundos por archivo. Los modelos que merece la pena probar para esta tarea incluyen Qwen2.5-VL, Mistral Small 24B y Gemma 4B para un mayor rendimiento en hardware restringido.

Revisando resultados en Light Image Editor

Una vez que el lote haya terminado de procesar, abre cualquier archivo en Light Image Editor, que viene incluido con Light Image Resizer. Navega a Herramientas en el menú superior y selecciona Comentar, o pulsa Ctrl+T. El campo de comentarios mostrará la salida estructurada de cada modelo que se ha ejecutado junto a esa imagen.

Mujer con gorro y bikini de ganchillo en la playa.
Light Image Editor mostrando el campo de comentarios de AI Vision tras ejecutar el lote forense de detección de sonrisas. Cada entrada corresponde a un modelo de lenguaje diferente probado durante el desarrollo de este artículo.

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.

Buscar en tu biblioteca de fotos mediante etiquetas generadas por IA

Después de procesar un lote, las etiquetas estructuradas escritas en los metadatos de cada archivo se vuelven inmediatamente buscables desde el Explorador de Windows. Abre la carpeta que contiene tus imágenes procesadas y usa la barra de búsqueda para ingresar una palabra clave o una combinación de palabras clave. (Ver la esquina superior derecha de la captura de pantalla)

Carpeta de imágenes con fotos de gatos y archivo de Excel.
Búsqueda en el Explorador de Windows filtrada por MICRO_SMILE Y orbicularis. El operador Y reduce los resultados a archivos donde ambos términos aparecen en los metadatos de comentarios.

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 investigaciones que requieren una visión estadística de toda una colección, está disponible bajo solicitud un script en Python que extrae los metadatos de los comentarios de cada archivo procesado y los consolida en un único archivo CSV. Este CSV luego puede ser importado en cualquier aplicación de hoja de cálculo o enviado a un modelo de lenguaje para un análisis de patrones más avanzado, como identificar la proporción de imágenes que contienen sonrisas genuinas frente a expresiones neutras a lo largo de una línea de tiempo de fotografías. Para solicitar el script, contáctenos con el asunto: Script de Python AI Vision Smile.

Conclusión

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.

Descargar Light Image Resizer

View the full version history