mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 14:22:51 +08:00
[data] use bicubic resampler (#7143)
Former-commit-id: bc298c60b7d3fdc4d116a79b535d7e9b11f4aa65
This commit is contained in:
parent
392533e139
commit
caef0a8937
@ -125,12 +125,12 @@ class MMPluginMixin:
|
|||||||
if (image.width * image.height) > image_max_pixels:
|
if (image.width * image.height) > image_max_pixels:
|
||||||
resize_factor = math.sqrt(image_max_pixels / (image.width * image.height))
|
resize_factor = math.sqrt(image_max_pixels / (image.width * image.height))
|
||||||
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
||||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
image = image.resize((width, height))
|
||||||
|
|
||||||
if (image.width * image.height) < image_min_pixels:
|
if (image.width * image.height) < image_min_pixels:
|
||||||
resize_factor = math.sqrt(image_min_pixels / (image.width * image.height))
|
resize_factor = math.sqrt(image_min_pixels / (image.width * image.height))
|
||||||
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
width, height = int(image.width * resize_factor), int(image.height * resize_factor)
|
||||||
image = image.resize((width, height), resample=Image.Resampling.NEAREST)
|
image = image.resize((width, height))
|
||||||
|
|
||||||
if image.mode != "RGB":
|
if image.mode != "RGB":
|
||||||
image = image.convert("RGB")
|
image = image.convert("RGB")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user