mirror of
https://github.com/open-mmlab/mmselfsup.git
synced 2025-06-03 14:59:38 +08:00
replace opencv blur to pil blur
This commit is contained in:
parent
06220225ce
commit
98151b985a
@ -1,7 +1,8 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import inspect
|
import inspect
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image, ImageFilter
|
||||||
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torchvision import transforms as _transforms
|
from torchvision import transforms as _transforms
|
||||||
@ -87,9 +88,8 @@ class GaussianBlur(object):
|
|||||||
|
|
||||||
def __call__(self, img):
|
def __call__(self, img):
|
||||||
sigma = np.random.uniform(self.sigma_min, self.sigma_max)
|
sigma = np.random.uniform(self.sigma_min, self.sigma_max)
|
||||||
img = cv2.GaussianBlur(
|
img = img.filter(ImageFilter.GaussianBlur(radius=sigma))
|
||||||
np.array(img), (self.kernel_size, self.kernel_size), sigma)
|
return img
|
||||||
return Image.fromarray(img.astype(np.uint8))
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
repr_str = self.__class__.__name__
|
repr_str = self.__class__.__name__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user