From 4f42dda2cf07290a8eff8ed540be7affcef5ea22 Mon Sep 17 00:00:00 2001 From: Qing Date: Sat, 12 Nov 2022 22:01:45 +0800 Subject: [PATCH] fix skimage import color https://github.com/Sanster/lama-cleaner/issues/121 --- lama_cleaner/model/zits.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lama_cleaner/model/zits.py b/lama_cleaner/model/zits.py index 597839c..b26981b 100644 --- a/lama_cleaner/model/zits.py +++ b/lama_cleaner/model/zits.py @@ -3,6 +3,7 @@ import time import cv2 import skimage +from skimage import color, feature import torch import torch.nn.functional as F @@ -157,8 +158,8 @@ def load_image(img, mask, device, sigma256=3.0): # https://scikit-image.org/docs/stable/api/skimage.feature.html#skimage.feature.canny # low_threshold: Lower bound for hysteresis thresholding (linking edges). If None, low_threshold is set to 10% of dtype’s max. # high_threshold: Upper bound for hysteresis thresholding (linking edges). If None, high_threshold is set to 20% of dtype’s max. - gray_256 = skimage.color.rgb2gray(img_256) - edge_256 = skimage.feature.canny(gray_256, sigma=sigma256, mask=None).astype(float) + gray_256 = color.rgb2gray(img_256) + edge_256 = feature.canny(gray_256, sigma=sigma256, mask=None).astype(float) # cv2.imwrite("skimage_gray.jpg", (_gray_256*255).astype(np.uint8)) # cv2.imwrite("skimage_edge.jpg", (_edge_256*255).astype(np.uint8))