mirror of
https://github.com/vladmandic/automatic
synced 2026-09-09 06:18:43 +02:00
Submodule extensions-builtin/sdnext-modernui updated: 357985697d...4edd7fc8be
@@ -14,10 +14,10 @@ import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
from transformers.activations import QuickGELUActivation
|
||||
import torchvision
|
||||
import torchvision.transforms.functional as TVF
|
||||
import einops
|
||||
from einops.layers.torch import Rearrange
|
||||
import huggingface_hub
|
||||
from modules import images_sharpfin
|
||||
from modules import shared, devices, sd_models
|
||||
|
||||
|
||||
@@ -1035,8 +1035,8 @@ def prepare_image(image: Image.Image, target_size: int) -> torch.Tensor:
|
||||
padded_image.paste(image, (pad_left, pad_top))
|
||||
if max_dim != target_size:
|
||||
padded_image = padded_image.resize((target_size, target_size), Image.Resampling.LANCZOS)
|
||||
image_tensor = images_sharpfin.to_tensor(padded_image)
|
||||
image_tensor = images_sharpfin.normalize(image_tensor, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711])
|
||||
image_tensor = TVF.pil_to_tensor(padded_image) / 255.0
|
||||
image_tensor = TVF.normalize(image_tensor, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711])
|
||||
return image_tensor
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user