-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error fixing color in A1111 v1.6.0 #49
Comments
I roll back to version 1.5.1... |
I confirm using Automatic1111 ver 1.5.1 resolves the color issue. I did this with StabilityMatrix so I did not have to roll back the 1.6 version or flop between git checkouts. You can install both in Packages side by side. Small annoyance is you do have to copy the StableSR model webui_768v_139.ckpt to the extension in both copies of the SR plugin. |
init_img which functions as the color style correction guide to colorfix, is now being passed to colorfix with 4 channels. This appears to be due to something having changed in how p StableDiffusionProcessingImg2Img prepares the source image. as a possible fix is check all in bound tensors to colorfix and set their channel to 3 keep in mind, I have no idea what I am really doing, but this seems to work, added to the top of colorfix.py:
|
借助这位大佬的代码,在我这还是会报错,于是继续修改了一下,修改后就正常了1.6和1.7都能用,代码如下,可以直接替换colorfix.py中的内容, from torchvision.transforms import ToTensor, ToPILImage def channel_four_to_three(image: Tensor): def adain_color_fix(target: Image, source: Image):
def wavelet_color_fix(target: Image, source: Image):
#加的结束 #def adain_color_fix(target: Image, source: Image): # Convert images to tensorsto_tensor = ToTensor()target_tensor = to_tensor(target).unsqueeze(0)source_tensor = to_tensor(source).unsqueeze(0)# Apply adaptive instance normalizationresult_tensor = adaptive_instance_normalization(target_tensor, source_tensor)# Convert tensor back to imageto_image = ToPILImage()result_image = to_image(result_tensor.squeeze(0).clamp_(0.0, 1.0))return result_image#def wavelet_color_fix(target: Image, source: Image): # Convert images to tensorsto_tensor = ToTensor()target_tensor = to_tensor(target).unsqueeze(0)source_tensor = to_tensor(source).unsqueeze(0)# Apply wavelet reconstructionresult_tensor = wavelet_reconstruction(target_tensor, source_tensor)# Convert tensor back to imageto_image = ToPILImage()result_image = to_image(result_tensor.squeeze(0).clamp_(0.0, 1.0))return result_imagedef calc_mean_std(feat: Tensor, eps=1e-5): def adaptive_instance_normalization(content_feat:Tensor, style_feat:Tensor): def wavelet_blur(image: Tensor, radius: int): def wavelet_decomposition(image: Tensor, levels=5):
def wavelet_reconstruction(content_feat:Tensor, style_feat:Tensor): ` |
亲测有效,就是格式乱七八糟 |
|
+1 |
Since the 1.6 update of A1111 the color correction no longer works, this error is occurring:
[StableSR] Error fixing color with default method: Given groups=3, weight of size [3, 1, 3, 3], expected input[1, 4, 2474, 3722] to have 3 channels, but got 4 channels instead
The text was updated successfully, but these errors were encountered: