Forensic-Grade Smile Detection with Light Image Resizer i AI Vision
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.
Nauka stojąca za wykrywaniem: FACS i jednostki działania
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.
Przypadek użycia: analiza partii 1500 fotografii do dochodzenia prawnego
Aby zobrazować praktyczny zakres tego procesu, rozważmy następujący scenariusz. Śledztwo prawne wymaga przeanalizowania kolekcji 1500 fotografii, aby ustalić, czy osoba wykazywała niepokój lub zrelaksowany wyraz twarzy podczas sesji zdjęciowej. Ręczne przeglądanie 1500 plików jest czasochłonne i subiektywne. Dzięki skonfigurowaniu Light Image Resizer zgodnie z opisem w tym samouczku, cały pakiet jest przetwarzany automatycznie, a każdy plik otrzymuje ustrukturyzowany, maszynowo czytelny tag zapisany bezpośrednio w metadanych. Tag jest generowany przez model wizualny AI, który ma działać jako analityk mimiki sądowej. Efekt wygląda tak:
OLLAMA-MISTRAL-FORENSIC32-EXPERTV2:LATEST
[NO_SMILE:100]
No AU12 or AU6 activation detected. Neutral facial expression.
Pierwsza linia identyfikuje użyty model. Druga linia to standaryzowany tag z oceną pewności wyrażoną jako liczba całkowita w krokach do dziesięciu. Trzecie zdanie przedstawia krótkie uzasadnienie techniczne oparte na analizie mięśniowej i wykrywaniu artefaktów. Ten trzylinijowy wynik jest powtarzalny, analizowalny i audytowalny.
Możesz pobrać gotowy do użycia preset dla tego przypadku tutaj:
Download the Forensic Smile Detection Preset
Why Run the Model locally with 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.
Konfiguracja zakładki AI Vision
Otwórz panel zaawansowany i przejdź do zakładki AI Vision. Włącz tę funkcję za pomocą pola wyboru na górze panelu.
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
Wklej poniższy komunikat do pola Prompt zakładki AI Vision. Każdy element tego promptu jest celowy. Instrukcja systemowa eliminuje tekst konwersacyjny z wyjścia. Dyrektywa Protokołu Rozkładu Mięśniowego koncentruje model na AU6 i AU12. Klauzula wykrywania artefaktów zapobiega błędnej klasyfikacji spowodowanej przez brody, palce, cygara lub inne zasłony. Tezaurus wymusza stałe słownictwo, dzięki czemu wyniki partii są bezpośrednio porównywalne i przeszukiwalne.
[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:
Czas przetwarzania znacznie się różni w zależności od Twojej karty graficznej, ilości dostępnej pamięci VRAM oraz wybranego modelu. Na systemie wyposażonym w NVIDIA RTX 3090 lub 4060 Super można spodziewać się od 5 do 90 sekund na plik. Modele warte testowania do tego zadania to Qwen2.5-VL, Mistral Small 24B oraz Gemma 4B dla szybszej przepustowości na ograniczonym sprzęcie.
Przeglądanie wyników w Light Image Editor
Po zakończeniu przetwarzania partii otwórz dowolny plik w Light Image Editor, który jest dołączony do Light Image Resizer. W górnym menu przejdź do Narzędzi i wybierz Komentarz lub naciśnij Ctrl+T. Pole komentarza pokaże uporządkowany wynik każdego modelu, który został uruchomiony względem tego obrazu.
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.
Wyszukiwanie w bibliotece zdjęć za pomocą tagów generowanych przez AI
Po przetworzeniu partii zdjęć, strukturalne tagi zapisane w metadanych każdego pliku stają się natychmiast możliwe do wyszukania w Eksploratorze Windows. Otwórz folder zawierający przetworzone obrazy i użyj paska wyszukiwania, wpisując słowo kluczowe lub kombinację słów kluczowych. (Zobacz prawy górny róg zrzutu ekranu)
Eksplorator Windows obsługuje operatory AND i OR w polu wyszukiwania. W pokazanym przykładzie zapytanie MICRO_SMILE AND orbicularis zwraca tylko pliki, w których model wykrył uśmiech o niskiej intensywności z udokumentowanym udziałem orbicularis. To przekształca Twoją lokalną bibliotekę fotograficzną w uporządkowane, przeszukiwalne archiwum dowodów. To samo podejście dotyczy zupełnie innych dziedzin. Możesz napisać prompt, który identyfikuje kraj lub miasto widoczne na zdjęciu krajobrazu, klasyfikuje modele pojazdów, opisuje konfigurację pomieszczeń do dokumentacji nieruchomości lub analizuje wszelkie wizualne cechy istotne dla Twojego kontekstu zawodowego. Prompt to jedyny element, który wymaga zmiany.
Eksport metadanych do CSV do analizy agregacyjnej
For investigations requiring a statistical overview of an entire collection, a Python script is available on request that extracts the comment metadata from each processed file and consolidates it into a single CSV file. This CSV can then be imported into any spreadsheet application or submitted to a language model for higher-level pattern analysis, such as identifying the proportion of images containing genuine smiles versus neutral expressions across a timeline of photographs. To request the script, contact us with the subject line: AI Vision Smile python script.
Conclusion
Light Image Resizer zapewnia kompletny pipeline do analizy mimiki twarzy na poziomie kryminalistycznym na dużą skalę. Połączenie uporządkowanego promptu opartego na FACS, lokalnie hostowanego modelu wizji Ollama dla pełnej prywatności danych oraz bezpośredniego zapisu wyników w metadanych obrazowych tworzy workflow, który jest powtarzalny, audytowalny i możliwy do wdrożenia na dowolnym komputerze z Windows z wydajną kartą graficzną. Ta sama infrastruktura łatwo dostosowuje się do każdej dziedziny, która korzysta z automatycznej, eksperckiej adnotacji obrazów. Pobierz Light Image Resizer oraz preset wykrywania uśmiechu sądowego, aby zacząć.
