dkebudi commited on
Commit
c954ee0
·
verified ·
1 Parent(s): 7d5b9b0

crop based on hard coded resolution: 1080 (h) x 1920 (w) effectively resulting in no crop

Browse files
train_dreambooth_lora_sdxl_advanced.py CHANGED
@@ -1092,17 +1092,11 @@ class DreamBoothDataset(Dataset):
1092
  if not single_image and args.random_flip and random.random() < 0.5:
1093
  # flip
1094
  image = train_flip(image)
1095
- if args.center_crop or single_image:
1096
- pass
1097
- #y1 = max(0, int(round((image.height - args.resolution) / 2.0)))
1098
- #x1 = max(0, int(round((image.width - args.resolution) / 2.0)))
1099
- #image = train_crop(image)
1100
- else:
1101
- pass
1102
- #y1, x1, h, w = train_crop.get_params(image, (args.resolution, args.resolution))
1103
- #image = crop(image, y1, x1, h, w)
1104
- #crop_top_left = (y1, x1)
1105
- #self.crop_top_lefts.append(crop_top_left)
1106
  image = train_transforms(image)
1107
  self.pixel_values.append(image)
1108
 
@@ -1127,17 +1121,11 @@ class DreamBoothDataset(Dataset):
1127
  if args.random_flip and random.random() < 0.5:
1128
  # flip
1129
  image = train_flip(image)
1130
- if args.center_crop:
1131
- pass
1132
- #y1 = max(0, int(round((image.height - args.resolution) / 2.0)))
1133
- #x1 = max(0, int(round((image.width - args.resolution) / 2.0)))
1134
- #image = train_crop(image)
1135
- else:
1136
- pass
1137
- #y1, x1, h, w = train_crop.get_params(image, (args.resolution, args.resolution))
1138
- #image = crop(image, y1, x1, h, w)
1139
- #crop_top_left = (y1, x1)
1140
- #self.crop_top_lefts_class_imgs.append(crop_top_left)
1141
  image = train_transforms(image)
1142
  self.pixel_values_class_imgs.append(image)
1143
 
 
1092
  if not single_image and args.random_flip and random.random() < 0.5:
1093
  # flip
1094
  image = train_flip(image)
1095
+ y1 = max(0, int(round((image.height - 1080) / 2.0)))
1096
+ x1 = max(0, int(round((image.width - 1920) / 2.0)))
1097
+ image = train_crop(image)
1098
+ crop_top_left = (y1, x1)
1099
+ self.crop_top_lefts.append(crop_top_left)
 
 
 
 
 
 
1100
  image = train_transforms(image)
1101
  self.pixel_values.append(image)
1102
 
 
1121
  if args.random_flip and random.random() < 0.5:
1122
  # flip
1123
  image = train_flip(image)
1124
+ y1 = max(0, int(round((image.height - 1080) / 2.0)))
1125
+ x1 = max(0, int(round((image.width - 1920) / 2.0)))
1126
+ image = train_crop(image)
1127
+ crop_top_left = (y1, x1)
1128
+ self.crop_top_lefts_class_imgs.append(crop_top_left)
 
 
 
 
 
 
1129
  image = train_transforms(image)
1130
  self.pixel_values_class_imgs.append(image)
1131