Skip to content

Commit

Permalink
https://github.com/kohya-ss/sd-scripts/pull/1741
Browse files Browse the repository at this point in the history
[2] aspect ratios compared in log-space have the desirable property that a 1:1 aspect ratio can be equidistant
from buckets 2:1 and 1:2, each of which fit an equal proportion of its area. - https://arxiv.org/abs/2409.15997
  • Loading branch information
67372a committed Nov 16, 2024
1 parent 9340043 commit 74a0a60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/train_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def select_bucket(self, image_width, image_height):
if reso in self.predefined_resos_set:
pass
else:
ar_errors = self.predefined_aspect_ratios - aspect_ratio
ar_errors = np.log(self.predefined_aspect_ratios) - np.log(aspect_ratio)
predefined_bucket_id = np.abs(ar_errors).argmin() # 当該解像度以外でaspect ratio errorが最も少ないもの
reso = self.predefined_resos[predefined_bucket_id]

Expand Down

0 comments on commit 74a0a60

Please sign in to comment.