fallenl commited on
Commit
73e8596
1 Parent(s): 2168969

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -13
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
- - ### Dataset preparation
12
- I'll disscuss several steps that I usually do when I prepare the dataset for a LoRA in order, and I'll skip the "How to Get Image Data" part since there're too many tools/methods available for you to use.
13
- 1. After getting all image data needed for a LoRA, remove all none-static image files (.mp4, .wav, .gif, etc). Then change all none-.png format images into .png.
14
- 2. Spend some time going through the images to see if there're any duplicated images and remove them. This will happen a lot if the dataset is large.
15
- 3. Upscale all low-resolution images to at least 2k resolution. But why? Let's see an example:
16
- We have two identical png images, one with 907x823 pixels, the other with 3624x3288 pixels using simple 4x-upscale from SD WebUI.
17
- <img src="imgs/upscale/comp.png"/>
18
- Now let's crop them into roughly 1k resolution (960x832 in this case) using SD WebUI's Auto-size Crop:
19
- <img src="imgs/upscale/cut-comp.png"/>
20
- See the differences? The image with 4x-upscale has a sharper edges comparing to the one without any upscale, and hence looks more clean and less blurry when getting cropped into 1k resolution. <br />
21
- So what does it translate to LoRA learning? <br />
22
- Inside the LoRA training script, we can see a function called [bucket](https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters#enable-buckets). <br />
23
- It'll automatically crop your image data into a size that's closed to the training resolution that we specify in training setup.
 
 
 
 
 
 
 
 
 
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