A collage of images, showing people with open and closed eyes to visualize the content of this article.

Find Photos with Closed Eyes Using IMatch AutoTagger

Do you often photograph groups of people, e.g. weddings, celebrations, choirs, clubs, and teams? Then you know the problem: in many otherwise good shots, at least one person has their eyes closed.

This article shows how to use the IMatch AutoTagger feature in the digital asset management system IMatch from photools.com to automatically flag images where one or more people may have closed eyes. The goal is simple: find problem shots faster when you manage large photo sets.

The Problem

Even if you explain the routine as “I’ll count to three and take the photo on three” someone will blink. That’s just how it is. The usual cure is to take many photos, often using burst shots or bracketing, and repeat the process several times.

The more people are in the photo, the more likely it is that one or more people have their eyes closed. Shooting ensembles or, worse, choirs, can be a nightmare at times.

The Solution

Thanks to recent advances in AI, we can often “open” eyes later in editing. But the first challenge is identifying the photos with closed eyes in larger batches. In this article, I’ll show how you can use IMatch AutoTagger to identify these images automatically.

IMatch AutoTagger

AutoTagger enables IMatch users to automatically add descriptions and keywords to images using cloud-based or on-device AI. This tool has revolutionized how IMatch users describe and tag large amounts of photos without any manual labor.

AI Traits

A distinctive feature of IMatch AutoTagger is AI Traits, custom metadata tags designed to hold information produced by AI. IMatch users can decide whether to use official XMP metadata like “Description” to store AI-generated descriptions, or to separate human-made descriptions and AI-generated descriptions by storing the AI output in the AI.Description trait tag instead.

AI Traits also come in handy when you ask the AI to analyze specific aspects or properties of images. Storing the results in trait tags makes them available to all IMatch features that work with tags, from searching and sorting to data-driven categories. The IMatch help offers several examples of this.

Detecting Closed Eyes

To solve the closed-eyes problem, we’ll use AutoTagger with a custom prompt and store the result in a custom trait tag named AI.ClosedEyes.

As always with AI, a good prompt is the key to success. The model must understand what you expect from it and how to determine the relevant facts from the images AutoTagger sends to it.

Ask the Model for Help with the Prompt

In my experience, it is a good idea to ask the AI model how to write and structure the prompt. Explain what you want it to do, provide details, and include example results if you have them. Make sure the model understands the task and the expected output. Then ask it to write a prompt that produces exactly that outcome.

Every AI model is slightly different. A prompt that works well with ChatGPT may not produce equally good results with a Gemini, Mistral, Qwen, or a local model.

The Prompt

I’ve asked the model:

“I need Gemma 4 26B to analyze all faces in images and to return a Boolean value if at least one of the faces in the image has partially or fully closed eyes. I’m using the API.
What would an ideal prompt be?”

In a first attempt, Gemma 4 26B came up with this prompt:

And for the system prompt:

A First Test

I collected a set of 30 images, with 18 images including persons with partially or fully closed eyes. The mages show individuals and groups of up to 14 people.

Then I created a new AutoTagger setting, set all standard tags (description, keywords, and landscape) to “Don’t Use,” and created a trait from the prompt. The name of the trait tag is AI.ClosedEyes.

Gemma identified 15 of the 30 images as “CLOSED” and all other photos as “OPEN”, missing three photos with closed eyes. Not bad for a first attempt.

Iterate and Improve

I discussed the results with Gemma 4, asking to improve the prompt based on my test and considering the model Gemma 4 26B specifically. It came up with a new, much simpler, user prompt:

The suggested system prompt has changed substantially and does most of the work:

The Second Test

I updated my AutoTagger setting with the new system and user prompts and ran it again on the same 30 images. This time, all 18 images with closed eyes were identified correctly. Good result!

Here is a part of the sample images in an IMatch File Window. The layout shows the value of the tag AI.ClosedEyes in the right header in orange:

A screen shot of an IMatch File Window showing the images used for testing AutoTagger.

Adapting This Process to Your Favorite Model

I’ve used Gemma 4 26B for my test, because this is a very new local model and I had it under test already.

I then used the same process with Gemini 3.7 Flash and OpenAI GPT 5.6 Luna (both the latest models at the time of writing).

  1. Explain to the model what you want to do: detect faces with partially or fully closed eyes using model <NAME-OF-MODEL> via API calls
  2. Ask the model to construct an optimal prompt for the purpose
  3. Create an AutoTagger setting with the suggested prompt and run it with a test set of images
  4. Refine the prompt when needed, again with the help of the model itself

Both the Gemini and OpenAI models performed with 100% accuracy and classified 18 of the 30 images as “CLOSED.”

If your PC does not have the required hardware to run local models, or if you need to process thousands of images quickly, using a cloud-based model is always an option with IMatch AutoTagger.

Extra Tip: Grouping Images by the AI.ClosedEyes Tag

I created a data-driven category based on the AI.ClosedEyes tag to let IMatch group images by the tag value. The result looks like this for the test set of images:

When you process large batches of images, for example, after an event, wedding, or vacation, running this AutoTagger setting during initial onboarding lets you focus first on the likely keepers: the images where all eyes are open.

Summary

IMatch AutoTagger can do much more than create descriptions and keywords for your images. Combining IMatch trait tags with custom prompts lets you automatically analyze images for a wide range of properties and attributes.

In this article, I used local and cloud-based models to identify images showing people with partially or fully closed eyes. This can be a real time-saver when you come home with large batches of images and need to separate the likely keepers from the obvious problem shots.

You can use AutoTagger in the same way to classify images by lighting, subject type, visible objects, indorr/outdoor, type of motive, and more. Store the results in regular XMP tags or use IMatch trait tags to keep them separate while still making them fully available in IMatch.

Once the data is available in tags, you can search for it, use it for sorting images, and build data-driven categories that automatically group images by tag values.

A cute little red robot working on a computer, looking into the camera.

Mario M. Westphal is the developer of IMatch, the digital asset management system (DAM) for Windows. He has a strong background in software development and photography, gained through working for over 30 years in the field for many clients. His special interests are photography, music. literature and of course software development, with a strong focus on digital asset management, database systems and image metadata. He hails from Germany.
You can reach him in the IMatch user community and via support@photools.com.