VGG モデルの Tensorflow 実装を読んでいるときに、著者が入力 RGB 画像に対して次のようなスケーリング操作を実行していることに気付きました。質問が 2 つVGG_MEAN
あります。意味と、その設定を取得する方法を教えてください。第二に、これらの平均値を減算して取得する必要がある理由bgr
VGG_MEAN = [103.939, 116.779, 123.68]
ef build(self, rgb):
"""
load variable from npy to build the VGG
:param rgb: rgb image [batch, height, width, 3] values scaled [0, 1]
"""
start_time = time.time()
print("build model started")
rgb_scaled = rgb * 255.0
# Convert RGB to BGR
red, green, blue = tf.split(3, 3, rgb_scaled)
assert red.get_shape().as_list()[1:] == [224, 224, 1]
assert green.get_shape().as_list()[1:] == [224, 224, 1]
assert blue.get_shape().as_list()[1:] == [224, 224, 1]
bgr = tf.concat(3, [
blue - VGG_MEAN[0],
green - VGG_MEAN[1],
red - VGG_MEAN[2],
])
assert bgr.get_shape().as_list()[1:] == [224, 224, 3]