Update README.md
Browse files
README.md
CHANGED
@@ -8,17 +8,26 @@ license: mit
|
|
8 |
To start with, LoRA training could be easy and quick with simple dataset preparation and training setup; but surely that's not what I'm satisfied with.
|
9 |
Based on my personal experience, preparing a LoRA's dataset properly is more important than using complicated and fancy training techniques. Just like cooking, you can't make any tasty dishes using materials without good quality.
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
|
|
8 |
To start with, LoRA training could be easy and quick with simple dataset preparation and training setup; but surely that's not what I'm satisfied with.
|
9 |
Based on my personal experience, preparing a LoRA's dataset properly is more important than using complicated and fancy training techniques. Just like cooking, you can't make any tasty dishes using materials without good quality.
|
10 |
|
11 |
+
### Dataset Preparation
|
12 |
+
|
13 |
+
In this section, I'll outline the steps I typically follow to prepare the dataset for a LoRA model. I'll skip the "How to Get Image Data" part since there are numerous tools and methods available for obtaining image data.
|
14 |
+
|
15 |
+
1. Remove Non-Static Image Files:
|
16 |
+
After gathering all the necessary image data for a LoRA, remove all non-static image files (e.g., .mp4, .wav, .gif, etc.). Then, convert all non-.png format images into .png.
|
17 |
+
|
18 |
+
2. Remove Duplicates:
|
19 |
+
Take some time to go through the images and remove any duplicates. This is particularly important for large datasets, as duplicates can occur frequently.
|
20 |
+
|
21 |
+
3. Upscale Low-Resolution Images:
|
22 |
+
Upscale all low-resolution images to at least 2k resolution. This step is crucial for improving image quality and ensuring better performance during training. Let's consider an example:
|
23 |
+
- We have two identical PNG images, one with dimensions 907x823 pixels and the other with dimensions 3624x3288 pixels, achieved by a simple 4x upscale from SD WebUI.
|
24 |
+
![Comparison](imgs/upscale/comp.png)
|
25 |
+
- Now, let's crop them to roughly 1k resolution (960x832 pixels in this case) using SD WebUI's Auto-size Crop:
|
26 |
+
![Cropped Comparison](imgs/upscale/cut-comp.png)
|
27 |
+
- Notice the difference? The image with 4x upscale has sharper edges compared to the one without any upscale, resulting in a cleaner and less blurry appearance when cropped into 1k resolution.
|
28 |
+
|
29 |
+
- So, why is this important for LoRA learning?
|
30 |
+
Inside the LoRA training script, there's a function called [bucket](https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters#enable-buckets) that automatically crops your image data to a size close to the training resolution specified in the training setup.
|
31 |
+
In this case, the pattern inside a clean image could be learned quickly; and for a somewhat low-resolution image that comes in the first place, upscaling helps sharpen the blurry lines so that the object inside is more easier to be recognized.
|
32 |
+
4. To be Continued ...
|
33 |
|