kontext Training

Differences between Kontext training and conventional LoRA training:

Comparison

Training Principle

Number of Training Images

Applicable Scenarios

Generalization Ability

LoRA

Traditional low-rank adaptation training, mainly learning visual features

Generally requires 50-100 images or more

Style transfer, character/object feature learning

Strong generalization ability with similar visual features

Kontext LoRA

Context-based training method, focusing on semantic associations

Usually 20-50 pairs can achieve good results

Creative scenarios requiring precise semantic control, image modification, and partial transfer

Strong generalization ability in similar semantic scenarios

Basic Concepts and Architecture

- Difference from Flux Dev:

Flux Dev is Text to Image (prompt → target image), Kontext is image conversion (prompt + original image → target image).

- Application Scenarios: Image editing, style conversion, content modification, etc.

Flux LoRA

Kontext LoRA

Flux.Kontext and Kontext.Fast differ only in training speed, and the consumption is relatively higher for Kontext.Fast than Flux.Kontext

Dataset Preparation

Image Screening

● Kontext training dataset images must be in pairs: each group includes one original image, one result image, and annotations.

● Number of image sets: 20-50 groups recommended, maximum upload limit: 100 groups.

● Image selection: Multiple types of original images, watermarked images need watermark removal.

Example: For conversion to ink style, original images can include realistic style, line art style, people, objects, and landscapes to increase generalization.

Image Annotation

● Annotation language: English annotations are recommended to avoid translation errors.

● Default annotation: Can be filled in when no annotation is available. Not needed if all groups are annotated.

● Annotation Content:

Correct annotations: Describe the difference between the original and the result images with simple descriptions.

Correct examples: Convert image to ink style; Transform into fisheye lens; Turn character into a cat.

Incorrect annotations: Like regular image model training annotations, which describe the image content.

Incorrect example: A slim young Asian woman with long black hair, wearing a pink tank top and blue denim shorts, standing on a green railing by the river with a bridge in the background.

Dataset Upload

Dataset Upload

● Dataset naming format: "filename_start.png", "filename_end.png", "filename.txt".

● If not named in a fixed format, manual matching of images and re-annotation is required.

Image Upload

● Upload all images and fill each group in order. If the original and result images don't match correctly, manually move the images to the corresponding groups.

Flux.Kontext Upload Dataset

l The dataset naming format: ctrl0, target

l ctrl0, refers to the folder where the original image is placed. target, refers to the folder where the result image and annotation are placed.

l Note: You need to compress the ctrl0 and target folders together into a dataset package for successful upload.

descript

l Original images in "ctrl0" should be named as: 1_0.png, 2_0.png, 3_0.png

descript

l Result images and annotations in "target" should be named as: 1.png, 1.txt, 2.png, 2.txt, 3.png, 3.txt

descript

Note: Regarding the dataset upload method, Flux.Kontext uses the same format as qwen image edit for uploading datasets; both require uploading compressed packages.

Image Upload

l Click to upload images. Up to 50 images can be uploaded at once. Those beyond this limit cannot be uploaded successfully.

l Select all images to upload. If there is no fixed naming format, they will be placed in the unmatched images section directly below the matching group. Up to 50 unmatched images are allowed, and you can manually move them to the corresponding groups.

Parameter Setting

Training Steps

● Training steps optimization: The model needs to show proper effects across all images, maintaining better generalization. This requires more dataset images and increased steps.

For limited specific use, choose fewer dataset images and reduce steps.

● Recommended steps: Default is 1,500 steps, for a dataset of 20-50 groups, 2,000-5,000 steps are recommended.

Training Epoch

l Times per Image Repeat: Calculated based on the number of groups, indicating training times per group.

l Cycles Epoch: When all groups complete training according to the Times per Image Repeat count, one Cycles Epoch is completed. This is consistent with the Epoch and Repeat concepts in image training.

l In most cases, using the default parameters for training is sufficient. Generally, when there are more groups, you can select fewer Times per Image Repeat and Cycles Epoch.

Learning Rate

● For a dataset of 20-50 groups, the default learning rate should be fine. If there are more image groups and steps, and you want the model to be effective consistently, increase the learning rate.

Default Annotation

● If all or any image groups lack annotations, the default annotation will be used to avoid missing annotations.

● Example 1:

Change the photo of green stalks with yellow bananas to black and white line drawings.

● Example 2:

Change the woman in the picture into a cat, keeping the background the same, the clothing and decorations the same.

Model Testing

Model Saving

● After training completion, only one model is produced. Click to save the model.

Testing Method

● We recommend testing via a workflow.

SeaArt AI | Kontext

● Test Parameter Settings:

Please select the LoRA name: Select the saved model.

Please enter the model strength: Generally, use the default value 1.

Please enter the width: The output image's width.

Please enter the height: The output image's height.

Please select an image: Select the image to be modified.

Please enter text: The prompt, a short sentence similar to or identical to the annotation content.

Qwen-Image-Edit Training

Comparison

Base Model

Core Feature

Multi-image Editing

Kontext

FLUX.1

Context-Aware Image Generation

1

Qwen-Image-Edit

Qwen-Image

Image Editing and Understanding

1

Qwen-Image-Edit-2509

Qwen-Image (Enhanced)

Enhanced Image Editing

1-3

Dataset Preparation

Image Screening

l Qwen-Image-Edit training dataset images must be in pairs: each group includes one original image, one result image, and one annotation.

l Number of image sets: 10-30 groups recommended, maximum upload limit: 100 groups.

l Image selection: Multiple types of original images, watermarked images need watermark removal.

Example: For conversion to ink style, original images can include realistic style, line art style, people, objects, and landscapes to increase generalization.

Image Annotation

l Annotation language: English annotations are recommended to avoid translation errors.

l Default annotation: Can be filled in when no annotation is available. Not needed if all groups are annotated.

l Annotation content:

Correct annotations should describe the differences between the original and the result images with simple descriptions.

Correct examples: Convert image to ink style; Transform into fisheye lens; Turn character into a cat.

Describing the image content like regular image model training annotations is incorrect.

Incorrect example: A slim young Asian woman with long black hair, wearing a pink tank top and blue denim shorts, standing on a green railing by the river with a bridge in the background.

l The image annotation is consistent with Kontext dataset annotation, with the only difference being that Qwen-Image-Edit supports Chinese annotation.

Dataset Upload

Qwen-Image-Edit Single Image Dataset Upload Method

l The dataset naming format: ctrl0, target

l ctrl0, refers to the folder where the original image is placed. target, refers to the folder where the result image and annotation are placed.

l Note: You need to compress the ctrl0 and target folders together into a dataset package for successful upload.

descript

l Original images in "ctrl0" should be named as: 1_0.png, 2_0.png, 3_0.png

descript

l Result images and annotations in "target" should be named as: 1.png, 1.txt, 2.png, 2.txt, 3.png, 3.txt

descript

Qwen-Image-Edit 2509 Dual Image Dataset Upload Method

l The dataset naming format: ctrl0, ctrl1, target

l ctrl0, refers to the folder where the original image is placed.ctrl1, refers to the folder where the original image 2 is placed. target, refers to the folder where the result image and annotation are placed.

l Note: You need to compress the ctrl0, ctrl1, and target folders together into a dataset package for successful upload.

descript

l Original images in "ctrl0" should be named as: 1_0.png, 2_0.png, 3_0.png

descript

l Original images in "ctrl1" should be named as: 1_1.png, 2_1.png, 3_1.png

descript

l Result images and annotations in "target" should be named as: 1.png, 1.txt, 2.png, 2.txt, 3.png, 3.txt

descript

l First, set the group picture quantity to dual image training.

descript

Under the dual image training group, select a compressed package containing the ctrl0, ctrl1, and target folders.

descript

This will complete the dataset upload.

descript

Qwen-Image-Edit 2509 Three Image Dataset Upload Method

l The dataset naming format: ctrl0, ctrl1, ctrl2, target.

l ctrl0, refers to the folder where the original image is placed.ctrl1, refers to the folder where the original image 2 is placed.ctrl2, refers to the folder where the original image 3 is placed. target, refers to the folder where the result image and annotation are placed.

l Note: You need to compress the ctrl0, ctrl1, ctrl2, and target folders together into a dataset package for successful upload.

descript

l Original images in "ctrl0" should be named as: 1_0.png, 2_0.png, 3_0.png

descript

l Original images in "ctrl1" should be named as: 1_1.png, 2_1.png, 3_1.png

descript

l Original images in "ctrl2" should be named as: 1_2.png, 2_2.png, 3_2.png

descript

l Result images and annotations in "target" should be named as: 1.png, 1.txt, 2.png, 2.txt, 3.png, 3.txt

descript

l If not named in a fixed format, manual matching of images and re-annotation is required.

Image Upload

l Click to upload images. Up to 50 images can be uploaded at once. Those beyond this limit cannot be uploaded successfully.

l Select all images to upload. If there is no fixed naming format, they will be placed in the unmatched images section directly below the matching group. Up to 50 unmatched images are allowed, and you can manually move them to the corresponding groups.

descript

Parameter Settings

Training Epoch

l Times per Image Repeat: Calculated based on the number of groups, indicating training times per group.

l Cycles Epoch: When all groups complete training according to the Times per Image Repeat count, one Cycles Epoch is completed. This is consistent with the Epoch and Repeat concepts in image training.

l In most cases, using the default parameters for training is sufficient. Generally, when there are more groups, you can select fewer Times per Image Repeat and Cycles Epoch.

Learning Rate

l For a dataset of 20-50 groups, the default learning rate should be fine. If there are more image groups and steps, and you want the model to be effective consistently, increase the learning rate.

Default Annotation

l If all or any image groups lack annotations, the default annotation will be used to avoid missing annotations.

l For example, if the annotation for Group 3 is missing, but we have set a default annotation, then it will be automatically added to Group 3 when training begins.

descript

Model Effect Preview Original Image

For preview images, use the original images (upload as many original images as you have).

descript

Model Effect Preview Annotation

The preview annotation needs to be consistent with the dataset annotation.

descript

Complete all settings and click "Start Training" to begin (The training methods for Qwen Image Edit, Qwen Image Edit 2509, and Flux.kontext are basically the same).

Model Testing

Model Saving

l The number of saved models is calculated based on epochs. There will be as many models saved as there are epochs. Select the one with the best sample image effect, and proceed with testing once the model synchronization is complete.

descript

Testing Method

l We recommend testing via a workflow.

l Qwen Image Edit LoRA Test Workflow

SeaArt AI | Qwen Edit

descript

l Test Parameter Settings

Please select an image: Input the image that requires editing.

Please select the LoRA name: Select the trained LoRA.

Please enter the model strength: LoRA's weight, which usually doesn't need adjustment.

Please enter prompt: Enter the prompts (you can directly enter prompts from training tags).

l Qwen Image Edit 2509 LoRA Test Workflow (Single Image Editing Test)

SeaArt AI AI | Qwen Edit 2509

descript

l Test Parameter Settings

Please select an image: Input the image that requires editing.

Please select the LoRA name: Select the trained LoRA.

Please enter the model strength: LoRA's weight, which usually doesn't need adjustment.

Please enter prompt: Enter the prompts (you can directly enter prompts from training tags).

l Qwen Image Edit 2509 LoRA Test Workflow (Dual Image Editing Test)

SeaArt AI | Dual Image Editor Qwen Edit 2509

descript

l Test Parameter Settings

Please select an image: Input the image that requires editing (the two images need to maintain type consistency with the dataset content).

Please select the LoRA name: Select the trained LoRA.

Please enter the model strength: LoRA's weight, which usually doesn't need adjustment.

Please enter prompt: Enter the prompts (you can directly enter prompts from training tags).

l Qwen Image Edit 2509 LoRA Test Workflow (Three Image Editing Test)

SeaArt AI | Three Image Editor Qwen Edit 2509

descript

l Test Parameter Settings

Please select an image: Input the image that requires editing (the three images need to maintain type consistency with the dataset content).

Please select the LoRA name: Select the trained LoRA.

Please enter the model strength: LoRA's weight, which usually doesn't need adjustment.

Please enter prompt: Enter the prompts (you can directly enter prompts from training tags).

Last updated