mirror of
https://github.com/brycedrennan/imaginAIry
synced 2024-10-31 03:20:40 +00:00
32b5175e0e
- use face enhancement in a smarter way that doesn't blur high-res images - use a different upscale model for composition images **Upscaling** RealESRGAN is great but it blurs parts of images it doesn't understand 4xUltrasharp is a finetune of RealESRGan that isn't as good but doesn't have this blurry patch problem. This makes it more suitable to use as part of the composition/upscale process. We still use realesrgan for any last-step upscales since it does look better. had to write a state dict translator to use the ultrasharp model **Face Enhancement** We no longer enhance faces that are larger than 512 pixels. They should already have enough details and the face enhancer doesn't produce faces at high enough resolution to look good at that size.
14 lines
494 B
Python
14 lines
494 B
Python
from PIL import Image
|
|
|
|
from imaginairy.enhancers.upscale_realesrgan import upscale_image
|
|
from tests import TESTS_FOLDER
|
|
from tests.utils import assert_image_similar_to_expectation
|
|
|
|
|
|
def test_upscale_textured_image(filename_base_for_outputs):
|
|
img = Image.open(f"{TESTS_FOLDER}/data/sand_upscale_difficult.jpg")
|
|
upscaled_image = upscale_image(img, ultrasharp=True)
|
|
assert_image_similar_to_expectation(
|
|
upscaled_image, f"{filename_base_for_outputs}.jpg", threshold=25000
|
|
)
|