Fixed issue with omitting square pictures
This commit is contained in:
1 parent
33267e117c
commit
addf024630
1 file changed
+9
-3
@@ -105,8 +105,13 @@ class BucketsMixin:
|
||||
# determine new resolution to have the same number of pixels
|
||||
current_pixels = width * height
|
||||
if current_pixels == total_pixels:
|
||||
# no change
|
||||
continue
|
||||
file_item.scale_to_width = width
|
||||
file_item.scale_to_height = height
|
||||
file_item.crop_width = width
|
||||
file_item.crop_height = height
|
||||
new_width = width
|
||||
new_height = height
|
||||
else:
|
||||
|
||||
aspect_ratio = width / height
|
||||
new_height = int(math.sqrt(total_pixels / aspect_ratio))
|
||||
@@ -154,7 +159,8 @@ class BucketsMixin:
|
||||
|
||||
# print the buckets
|
||||
self.build_batch_indices()
|
||||
print(f'Bucket sizes for {self.__class__.__name__}:')
|
||||
name = f"{os.path.basename(self.dataset_path)} ({self.resolution})"
|
||||
print(f'Bucket sizes for {self.dataset_path}:')
|
||||
for key, bucket in self.buckets.items():
|
||||
print(f'{key}: {len(bucket.file_list_idx)} files')
|
||||
print(f'{len(self.buckets)} buckets made')
|
||||
|
||||
Reference in new issue
Block a user