mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-08 22:35:09 +00:00
init
This commit is contained in:
@@ -1405,11 +1405,11 @@ class BaseDataset(torch.utils.data.Dataset):
|
|||||||
image_size = imagesize.get(image_path)
|
image_size = imagesize.get(image_path)
|
||||||
if image_size[0] <= 0:
|
if image_size[0] <= 0:
|
||||||
# imagesize doesn't work for some images, so use cv2
|
# imagesize doesn't work for some images, so use cv2
|
||||||
img = cv2.imread(image_path)
|
try:
|
||||||
if img is not None:
|
with Image.open(image_path) as img:
|
||||||
image_size = (img.shape[1], img.shape[0])
|
image_size = img.size
|
||||||
else:
|
except Exception as e:
|
||||||
logger.warning(f"failed to get image size: {image_path}")
|
logger.warning(f"failed to get image size: {image_path}, error: {e}")
|
||||||
image_size = (0, 0)
|
image_size = (0, 0)
|
||||||
return image_size
|
return image_size
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user