Imagenet的std mean值

1)常用的一种归一化

imagenet的 RGB模式

              std标准差:[0.229, 0.224, 0.225]

              mean均值:[0.485, 0.456, 0.406]

new_img = img / 255.

std = [0.229, 0.224, 0.225]
mean = [0.485, 0.456, 0.406]

_std = np.array(std).reshape((1,1,3))
_mean = np.array(mean).reshape((1,1,3))

new_img = (new_img - _mean) / _std

2)有一种就是如下所示的归一化

_MEAN_RGB = [123.15, 115.90, 103.06]
def _preprocess_subtract_imagenet_mean(inputs):
    """Subtract Imagenet mean RGB value."""
    mean_rgb = tf.reshape(_MEAN_RGB, [1, 1, 1, 3])
    print("mean_rgb:\n", mean_rgb)
    return inputs - mean_rgb

inputs = tf.random.uniform(shape=[2, 448, 448, 3], maxval=255)
print("inputs:\n", inputs)
imgs_new = _preprocess_subtract_imagenet_mean(inputs)
print("imgs_sub:\n", imgs_new)
发布了190 篇原创文章 · 获赞 497 · 访问量 206万+

猜你喜欢

转载自blog.csdn.net/u013066730/article/details/104920671
std