mirror of
https://github.com/open-mmlab/mmclassification.git
synced 2025-06-03 21:53:55 +08:00
* Fix issue 1711. GaussianBlur. * Fix UT --------- Co-authored-by: mzr1996 <mzr1996@163.com>
This commit is contained in:
parent
60d780f99e
commit
2b8d8eecb2
@ -1169,7 +1169,7 @@ class GaussianBlur(BaseAugTransform):
|
|||||||
|
|
||||||
img = results['img']
|
img = results['img']
|
||||||
pil_img = Image.fromarray(img)
|
pil_img = Image.fromarray(img)
|
||||||
pil_img.filter(ImageFilter.GaussianBlur(radius=radius))
|
pil_img = pil_img.filter(ImageFilter.GaussianBlur(radius=radius))
|
||||||
results['img'] = np.array(pil_img, dtype=img.dtype)
|
results['img'] = np.array(pil_img, dtype=img.dtype)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
@ -1285,9 +1285,10 @@ class TestGaussianBlur(TestCase):
|
|||||||
|
|
||||||
def test_transform(self):
|
def test_transform(self):
|
||||||
transform_func = 'PIL.ImageFilter.GaussianBlur'
|
transform_func = 'PIL.ImageFilter.GaussianBlur'
|
||||||
|
from PIL.ImageFilter import GaussianBlur
|
||||||
|
|
||||||
# test params inputs
|
# test params inputs
|
||||||
with patch(transform_func, autospec=True) as mock:
|
with patch(transform_func, wraps=GaussianBlur) as mock:
|
||||||
cfg = {
|
cfg = {
|
||||||
**self.DEFAULT_ARGS,
|
**self.DEFAULT_ARGS,
|
||||||
'radius': 0.5,
|
'radius': 0.5,
|
||||||
@ -1297,7 +1298,7 @@ class TestGaussianBlur(TestCase):
|
|||||||
mock.assert_called_once_with(radius=0.5)
|
mock.assert_called_once_with(radius=0.5)
|
||||||
|
|
||||||
# test prob
|
# test prob
|
||||||
with patch(transform_func, autospec=True) as mock:
|
with patch(transform_func, wraps=GaussianBlur) as mock:
|
||||||
cfg = {
|
cfg = {
|
||||||
**self.DEFAULT_ARGS,
|
**self.DEFAULT_ARGS,
|
||||||
'radius': 0.5,
|
'radius': 0.5,
|
||||||
@ -1307,7 +1308,7 @@ class TestGaussianBlur(TestCase):
|
|||||||
mock.assert_not_called()
|
mock.assert_not_called()
|
||||||
|
|
||||||
# test magnitude_range
|
# test magnitude_range
|
||||||
with patch(transform_func, autospec=True) as mock:
|
with patch(transform_func, wraps=GaussianBlur) as mock:
|
||||||
cfg = {
|
cfg = {
|
||||||
**self.DEFAULT_ARGS,
|
**self.DEFAULT_ARGS,
|
||||||
'magnitude_range': (0.1, 2),
|
'magnitude_range': (0.1, 2),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user