访问ImageNet-C损坏函数
项目描述
ImageNet-C损坏函数
使用此包,可以使用ImageNet-C损坏对图像进行损坏。这些函数通过corrupt
函数公开。
尝试
from imagenet_c import corrupt
corrupt(<image>, corruption_number=0)
corrupt
函数看起来像
def corrupt(x, severity=1, corruption_name=None, corruption_number=-1):
"""
:param x: image to corrupt; a 224x224x3 numpy array in [0, 255]
:param severity: strength with which to corrupt x; an integer in [0, 5]
:param corruption_name: specifies which corruption function to call;
must be one of 'gaussian_noise', 'shot_noise', 'impulse_noise', 'defocus_blur',
'glass_blur', 'motion_blur', 'zoom_blur', 'snow', 'frost', 'fog',
'brightness', 'contrast', 'elastic_transform', 'pixelate', 'jpeg_compression',
'speckle_noise', 'gaussian_blur', 'spatter', 'saturate';
the last four are validation functions
:param corruption_number: the position of the corruption_name in the above list;
an integer in [0, 18]; useful for easy looping; 15, 16, 17, 18 are validation corruption numbers
:return: the image x corrupted by a corruption function at the given severity; same shape as input
"""
...
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
imagenet_c-0.0.3.tar.gz (2.1 MB 查看哈希值)
构建分发
imagenet_c-0.0.3-py3-none-any.whl (7.3 kB 查看哈希值)