tidalove commited on
Commit
bcbdf9f
·
verified ·
1 Parent(s): e891261

Update square_crop.py

Browse files
Files changed (1) hide show
  1. square_crop.py +3 -0
square_crop.py CHANGED
@@ -47,6 +47,8 @@ def crop_annotation(img_path, ann, out_dir, pad_color=0):
47
  # Perform crop (may be smaller than 'side' at edges)
48
  crop = img.crop((left, top, left + side, top + side))
49
 
 
 
50
  # If we lost pixels at the edge, pad back to full square
51
  if crop.size != (side, side):
52
  delta_w = side - crop.size[0]
@@ -78,4 +80,5 @@ def run_square_crop(input_dir, coco_json_path, cropped_dir):
78
  # except Exception as e:
79
  # print(f"Error on {img_path}.")
80
 
 
81
  return os.listdir(cropped_dir)
 
47
  # Perform crop (may be smaller than 'side' at edges)
48
  crop = img.crop((left, top, left + side, top + side))
49
 
50
+ print(f"final image {crop.size} from original image {img.size}")
51
+
52
  # If we lost pixels at the edge, pad back to full square
53
  if crop.size != (side, side):
54
  delta_w = side - crop.size[0]
 
80
  # except Exception as e:
81
  # print(f"Error on {img_path}.")
82
 
83
+ print(os.listdir(cropped_dir))
84
  return os.listdir(cropped_dir)