🖼️

Generating photos with your own face using the FLUX model

As I mentioned in the email, our goal is to achieve this effect using the FLUX model.

image

For this purpose, we will use the platform https://fal.ai. It is a cloud that allows using models, sharing your own, and training them (fine-tuning) using the LoRA method. I encourage you to browse through the available models on this platform: https://fal.ai/models. You will find many models useful for SEO there, such as those improving photo quality or changing backgrounds.

Step 1. Your selfie

To train the model, you will need about 5 of your authentic selfies. If you don't have them, take a few photos with your phone, placing your face in different positions. Remember — the more photos you provide, the more accurate the model will be.

Step 2. Fine-tuning and configuration

On the platform, we find the model we want to train. In our case, it's the model available at: https://fal.ai/models/fal-ai/flux-general. We click on "Training".

image

Then we insert the previously prepared selfies and make additional settings.

image

In the additional settings, we configure:

  • Steps – the more steps you set (this will be the number of steps in the training), the better results you'll get, but the training will also cost more
  • Trigger Word – this can be your name. After training the model, adding this word to the prompt will cause the model to generate an image with your face

Step 3. Training

After configuration, click "Start." The trained model will appear on the list.

image

It will have the status "queue." The training will take about 30 minutes. After this time, the model's status will change to "completed." At this point, the model will be ready for use.

Step 4. Generating Images

After the model's status changes to "completed," click "Run Inference." This button will take you to the image generation interface.

image

Next, we can proceed to generating images. We need to use a few settings here.

image
  1. Prompt - Here, we enter what we want the image to depict (I will go over how to create prompts further on). If we want a picture with our face, we must include a trigger word in the prompt (in my case, it's "Damian"). The placement of this word in the prompt does not matter.
  2. Image Size - The size in which the image will be generated.
image
  1. Seed – If we want the model to generate an image based on a specific photo, we enter its ID here.
  2. Guidance Scale – A metric that determines how closely the model should adhere to the instructions in the prompt.
  3. Num Images – We specify how many images the model should generate (from my experience, 3 is the optimal number).

The remaining settings are not important in the context of generating portraits. After configuring all the options, click "Run." Our image should appear after about 45 seconds.

Here is the result:

image

The result isn't stunning, but I didn't focus on the prompt, which we'll address shortly.

You can also access this model via API: https://fal.ai/models/fal-ai/flux-general/api — this allows you to integrate the image generation process into your own projects.

I conducted the training based on my own photos, but nothing stops you from fine-tuning the model to generate images in a specific style (for example, you could use graphics from your website).

Creating Prompts

When working with language models, prompts play a crucial role. For creating prompts for image generation, I usually use the Claude (Sonnet 3.5) model (available at https://claude.ai/new), but you can also use other solutions.

I've prepared a prompt for you that will help you create prompts for generating graphics.

Act as an expert prompt engineer for AI image generation models, specializing in creating prompts for realistic portrait photography. Your task is to generate detailed, comprehensive prompts that will result in high-quality, lifelike portrait images.

When a user provides this prompt to you, follow these steps:

1. Ask the user for the following details about the portrait they want to create:
   - Subject description (e.g., age, gender, ethnicity, notable features)
   - Facial expression and emotion
   - Pose and body language
   - Clothing and accessories
   - Background or setting
   - Lighting conditions (e.g., natural light, studio lighting, time of day)
   - Any specific mood or atmosphere they want to convey

2. Inquire about the preferred style or artistic technique, if any (e.g., photorealistic, cinematic, editorial, fine art)

3. Ask if they want to include any specific compositional elements (e.g., close-up, full body, rule of thirds)

4. Once you have gathered all the necessary information, construct a detailed prompt using the following structure:

   "Generate a highly detailed, realistic portrait photograph of [subject description]. The subject should have [facial expression] and convey [emotion]. They are posed [describe pose and body language], wearing [describe clothing and accessories]. The background features [describe setting]. The lighting is [describe lighting conditions], creating [describe mood/atmosphere]. Style: [mention preferred style if specified]. Composition: [describe compositional elements if specified]."

5. Add specific details to enhance realism, such as:
   - Skin texture and complexion details
   - Hair style and texture
   - Eye color and expression
   - Any unique features or characteristics

6. Include relevant photography terms to guide the image generation, such as:
   - Focal length (e.g., 85mm for portraits)
   - Aperture (e.g., f/2.8 for a shallow depth of field)
   - ISO and shutter speed for specific lighting conditions

7. End the prompt with: "Ensure high detail, photorealistic quality, and natural-looking features."

8. After generating the prompt, ask the user if they would like to make any adjustments or add any specific details.

Remember to create prompts that are clear, specific, and tailored to the user's requirements while maintaining a focus on generating realistic portrait photographs.

Paste this prompt into your preferred tool; it should ask you additional questions.

image

Ultimately, my prompt looks like this.

Generate a highly detailed, realistic portrait photograph of a Jedi Knight named Damian. The subject should have a serene yet determined expression, conveying wisdom and inner strength. He is posed in a confident stance, one hand resting on the hilt of an ignited lightsaber. Damian is wearing traditional Jedi robes in earth tones, with a brown cloak draped over his shoulders. The background features a futuristic sci-fi setting, with sleek metallic surfaces and distant stars visible through a large viewport. The lighting is a mix of cool blue tones from the starship interior and the warm glow of the lightsaber, creating a dramatic and otherworldly atmosphere. Style: Cinematic and photorealistic with strong sci-fi elements. Composition: Three-quarter body shot, emphasizing the character's presence and the sci-fi environment.
Add specific details to enhance realism:

Subtle facial hair and a few small scars to suggest experience
Windswept hair with natural-looking texture
Piercing, focused eyes with a hint of otherworldly glow
Fabric textures of the Jedi robes, showing wear and movement

Include relevant photography and sci-fi terms:

Shot with a 50mm lens at f/4 to balance subject focus with environmental detail
High-contrast lighting to emphasize the sci-fi mood
Subtle lens flares from the lightsaber and starship lights

Ensure high detail, photorealistic quality, and natural-looking features while maintaining the iconic Star Wars Jedi aesthetic with a strong sci-fi emphasis.

And the final result looks like this:

image

As you can see, a good prompt is the foundation of a good image! :)

How Much Does It Cost?

The cost depends on the size of the generated images and the model we choose. The three images I generated above cost 22 cents. The model training itself cost about $12 (this is a one-time cost).

We've reached the end 🙂. I wish you beautifully generated images. If you appreciate our work, feel free to share information about our newsletter: https://lpen.sensai.academy/

Thanks,

Damian.