From de1470f43bd785776f0caa2a4bed00c938646021 Mon Sep 17 00:00:00 2001 From: harubaru Date: Thu, 22 Sep 2022 19:49:08 -0700 Subject: [PATCH] fix downloader --- danbooru_data/download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danbooru_data/download.py b/danbooru_data/download.py index 1abce8e..cdb14b5 100644 --- a/danbooru_data/download.py +++ b/danbooru_data/download.py @@ -17,13 +17,14 @@ from PIL import Image, ImageOps import argparse import shutil +import numpy as np parser = argparse.ArgumentParser() parser.add_argument('--file', '-f', type=str, required=False, default='links.json') parser.add_argument('--out_file', '-o', type=str, required=False, default='dataset-%06d.tar') parser.add_argument('--max_size', '-m', type=int, required=False, default=4294967296) parser.add_argument('--threads', '-p', required=False, default=16, type=int) -parser.add_argument('--resize', '-r', required=False, default=768, type=int) +parser.add_argument('--resize', '-r', required=False, default=512, type=int) args = parser.parse_args() def resize_image(image: Image, max_size=(512,512), center_crop=True): @@ -45,7 +46,6 @@ def resize_image(image: Image, max_size=(512,512), center_crop=True): else: if not image.mode == "RGB": image = image.convert("RGB") - if center_crop: img = np.array(image).astype(np.uint8) crop = min(img.shape[0], img.shape[1]) h, w, = img.shape[0], img.shape[1]