Image Repair Lora
After a long time,
I finally had both the time and the motivation to do another Lora training.
Goal: The "Image Repair" Lora is trained to fix issues like JPG compression artifacts and enhance low-quality images, especially those found on the web,
making them more suitable for training datasets.
The trigger phrase is: "make image high quality."
Training Details:
Flux.2 Klein Base 4b
Trained on 140 image pairs
7000 steps
Batchsize 2
Important: If you want to generate your final image at a resolution like 1024x1024,
make sure to scale the reference image to exactly 1024x1024 before using it.
If you don’t, the model may deviate from the concept
and either attempt to create its own image based on the reference or cause a pixel shift.
Longer Version:
The idea for this Lora came from my desire
to address the issue of poor-quality images in datasets,
particularly those with compression artifacts.
I initially trained a version with only 24 image pairs,
which showed promising results considering the small dataset.
However, I felt there was potential for improvement.
To enhance the training process,
I worked with ChatGPT to develop a Python script
that automatically resizes, compresses, and upscales images with random values,
and stores them for further use.
After running this script, I trained the model on 140 image pairs,
which significantly improved the results compared to the first test version.
While it's not perfect and may still benefit from a larger dataset
(perhaps a V2 version if there's enough interest),
I believe it’s already good enough to help others.
This Lora is not an typical "image-to-image" concept that generates entirely new visuals. Instead, it focuses on preserving the identity of the image,
minimizing hallucinations and alterations.
Its main goal is to repair and enhance the original image, not to create a new image.
In short, this was by far the most exciting Lora I've trained.
Especially since I’m not a tech-savvy guy, and after a lot of trial and error,
I was finally able to create a functional script with ChatGPT.
It was a challenging (for me :D ) but rewarding process,
and I hope you enjoy using this Lora as much as I enjoyed working on it.
_______________________________________________________________________________________________
Recommended Settings (settings i use):
Klein Base 4b with "Base to Turbo Lora" on Strength 0.5:
CFG Scale:
2
Sampling method and Schedule type:
UniPC - SGM Uniform
Steps:
15-30
Resolution/Aspect Ratio:
Only tested with (1024px) 1:1, 3:2, 2:3
Lora Strength:
1
Trigger Word/Sentence:
make image high quality
Prompting:
The trigger sentence is enough.
However, I've also had a few cases where a short sentence about the reference image helped.
_______________________________________________________________________________________________
Known Issues:
Does not help with all images.
(It may help to resize the reference image down again,
save it as a low-quality jpg, and then resize it back up again.)

