-
Notifications
You must be signed in to change notification settings - Fork 196
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
能否改善涂善修復有淡淡灰色的狀況 #733
Comments
相同问题:使用 #在此前是正确的
img_inpainted = (img_inpainted_torch.to(device='cpu', dtype=torch.float32).squeeze_(0).permute(1, 2, 0).numpy() * 255)
#需使用math.floor
img_inpainted = np.clip(img_inpainted+0.5, 0, 255).astype(np.uint8) 验证: import torch
import numpy as np
# 创建一个示例张量,范围在 [0, 1],包含一些接近1.0的值
img_inpainted_torch = torch.tensor(
[[[[1.0, 0.9999], [0.99, 0.97]]]], dtype=torch.float32)
# 方法1:第一种处理方式
img_inpainted_raw = img_inpainted_torch.detach().squeeze_(
0).permute(1, 2, 0).cpu().numpy() * 255.0
img_inpainted_raw = np.clip(img_inpainted_raw+0.5, 0, 255).astype(np.uint8)
# 方法2:第二种处理方式
img_inpainted = (img_inpainted_torch.to(device='cpu', dtype=torch.float32).squeeze_(
0).permute(1, 2, 0).numpy() * 255).astype(np.uint8)
# 打印结果
print("原始张量 (范围 [0, 1]):")
print(img_inpainted_torch)
print("\n方法1结果 (浮点数,范围 [0, 255]):")
print(img_inpainted_raw)
print("\n方法2结果 (整数,范围 [0, 255]):")
print(img_inpainted) 原始张量 (范围 [0, 1]):
tensor([[[1.0000, 0.9999],
[0.9900, 0.9700]]])
方法1结果 (浮点数,范围 [0, 255]):
[[[255]
[255]]
[[252]
[247]]]
方法2结果 (整数,范围 [0, 255]):
[[[255]
[254]]
[[252]
[247]]] 修复结果:bug消失。 |
谢谢,还真是bug,之前反映多次都没人能找到bug的根本原因 |
这里找出的只是一个原因,还有别的。我暂时还认为自动修复流程里有对图片的不适当裁剪或者错误的遮罩会降低lama的修复质量,但还没看代码。 |
最近这两个月这个自动修复的bug反映普遍比较多,你的修复应该涵盖了大部分非不当使用导致的异常 之前是听说lama_large_512px对日漫比较友好所以试用了lama_large_512px,不知道是不是lama系一开始就有这个bug |
你给的这些 comment 都是膨胀开太大的原因,精度问题不会有那么夸张的色差 |
抱歉,他是用“使用GIMP的色阶工具增加对比度”,我误解了。 虽然但是,我确实注意到还是有残留淡淡的灰色的。而之前inpaint后都是完美纯白的 |
@ZzzzzzzSkyward @wagannan |
请问是否可以加个调节项弱化背景颜色的权重?就算取中值有时候权重还是太高了。 |
我已经关掉这个选项了。 遮罩 iopaint的结果 注意,虽然iopaint调用也会出现像素非纯白(rgb=254)的现象,但是总体上看是良好的。而此项目调用结果是较差的。我不清楚到底是模型参数不同还是什么其他原因。 |
啥叫弱化权重,你是说让程序判定用纯色涂抹的标准更严格吗 |
图一就是原来输入吗,你给的膨胀参数是啥 |
在传给lama模型前有一系列变换操作,为了剔除它们的影响,我展示的是_inpaint函数里,距离修复前后最直接的图像。膨胀开了3~10之间的数字吧,这不重要了,你看那个遮罩是覆盖文字,但没有碰到气泡边缘的,这种情况理应正确修复。 |
|
翻以前的issue发现这里的lama不会是iopaint的anime lama吧,我在iopaint调用的是原版lama。。。 |
我遍历了一下 iopaint 那个 anime lama 它用的是我们的模型。用 lama mpe 不会出这个问题,那大概是模型问题。 |
不論用哪種方式圖像修復 某些地方都會有這淡淡灰色的方框
The text was updated successfully, but these errors were encountered: