How we keep an AI character's face the same across image and video models (no training)

2026-11-28来源 dev.toEnglish

One of our users had created a character with two tattoos. Both were on the same arm, although the user had originally asked for one on each arm. When we passed the character's photo and the user's notes to a vision model to get a description, it wrote that there was a tattoo on each arm.

Every subsequent generation received the photo along with that description. We'd introduced a contradiction before the image model had even started generating anything.

I work on Influverse AI's character generator. Users can make a character with one model and generate more images of it with another, or use it in a video. I didn't want people to have to wait for a model to be trained whenever they created a character. Using image references also lets us add new compatible models without retraining the characters already in the application. The alternative, training a separate LoRA, is covered in our AI character generator guide.

What's in a character

We store a front-facing portrait, a separate image of the character from several angles (including full-body views), and a description that's normally 80 to 150 words. The second image is similar to a model sheet in animation; a portrait alone gives you very little information about someone's build or what their hair looks like from behind.

Most people are fairly brief when they describe the character they want to make. A typical input is "a woman in her twenties with dark hair". There's no mention of her nose or eyebrows, but once we've generated her, those are the features of a particular face that the user wants to keep. We use a vision model to describe the actual images.

In the tattoo case, the vision model had followed our instructions correctly. The prompt told it to treat the user's input as authoritative. We changed the instruction and ran the same model again on the same character. It got the placement of both tattoos right that time.

Here's the relevant extract:

THE IMAGE IS THE TRUTH. - Describe what is actually visible in the image. - Creator notes fill in only what the image cannot settle. Where a note contradicts something clearly visible, describe WHAT YOU SEE. - State every mark by the PERSON'S OWN left and right, not the side of the picture it appears on. - If you cannot tell which side a mark is on, say so rather than guessing. - NEVER name, compare to, or identify any real person. 

The left/right instruction is easy to overlook when writing a prompt for this. A tattoo on the right of a front-facing photo is on the person's left arm. If our description says "right arm", that's what the next model will try to reproduce. We also require the model to write "no distinguishing marks" when it can't find any. I need to know whether a blank field means it missed something or there was nothing to describe.

Some of this depends on the quality of the uploaded photo. If I can't see the details in a blurry photo, I can't expect the vision model to describe them reliably enough to use later.

For a while, we had the description from the photo available during sheet generation and weren't using it. The sheet prompt took the user's original text, cut it at 500 characters, and included instructions about the arrangement of the different views. There were three routes for generating sheets, with different character limits.

All three routes now call a function that puts the description from the photo at the beginning of the prompt. A typical one is 500 to 900 characters long, so a combined limit of 1,200 gives us some space to include the creator's notes as well. The instructions for the layout follow the description. When I look at a character reference sheet, I'm more concerned with whether each panel shows the same face than whether every panel is correctly arranged. We'll be reusing the image.

A user can also create a character from a product or logo. We had to account for that in the prompts, since keep this exact person consistent could result in a person appearing next to a product. The subject type is now part of the identity prompt builder:

function identityPromptBlock(identity: { subjectKind?: 'person' | 'object'; description?: string }) { if (!identity.description) return ''; if (identity.subjectKind === 'object') { return `SUBJECT IDENTITY (keep this exact object consistent: same form, proportions, colours, materials and surface markings): ${identity.description}`; } return `CHARACTER IDENTITY (keep this exact person consistent): ${identity.description}`; } 

For an object, the vision prompt asks about its shape, proportions, materials, colours and any printed text.

Sending the pictures to the models

function identityRefPlan(refs: { profileMediaId?: string; sheetMediaId?: string }) { const plan: string[] = []; if (refs.profileMediaId) plan.push(refs.profileMediaId); if (refs.sheetMediaId) plan.push(refs.sheetMediaId); return plan; } 

The order of those two references matters if the user adds their own pictures or selects an outfit, because we can end up with more references than a particular provider accepts. The frontend and backend share the function that counts them. If we have to trim the list at submission time, the character's pictures have priority, with the clearest facial reference first.

Someone entering a text prompt with an existing character enabled expects to get a new image. To the provider, the request includes images and can't go to a text-only endpoint. In model families with separate creation and editing variants, we need to call the editing variant in that case.

function effectiveVariant(signals: { identity: boolean; uploadCount: number; wardrobe: boolean }) { const needsReferences = signals.identity || signals.uploadCount > 0 || signals.wardrobe; return needsReferences ? 'edit' : 'create'; } 

The generation page, price preview and server all use this function. I don't want the price preview using one variant and the server choosing another.

identityRefPlan() returns media IDs. We keep user files in private storage, and a provider can access a reference only with a signed URL that expires. It's possible for a job to be queued or retried after a URL signed at job creation has expired. So the job stores the IDs and we resolve them again, including the ownership check, each time we submit to the provider.

async function identityRefUrls(mediaIds: string[], userId: string) { const docs = await getMediaDocs(mediaIds); return docs .filter((d) => d && d.userId === userId && d.type === 'image') .map((d) => signedUrlFor(d.storagePath)); } 

HEIC photos from iPhones are converted to JPEG during upload. The models we use can't read HEIC.

If a user deletes a character or switches it off, the resolver returns nothing. The same happens if the character belongs to another user or its media is inaccessible: the generation goes ahead without the character. If the vision model fails to write a character description, we fall back to the text we already have.

I still have trouble keeping small scars and tattoos consistent in video. They can disappear or change shape from one frame to the next even when they're visible in the reference and correctly described. Running identical inputs through different models can also give you two recognisable but slightly different faces.

Has anyone managed to keep a tattoo consistent over an entire video using reference images alone?

原文:https://www.a8q9.cn/en/article/how-we-keep-an-ai-character-s-face-the-same-across-image-and-video-models-no-tra-2bf7a6.html

相关文章