私の見解では、画像の正規化はすべてのピクセルを0と1の間の値で正規化することです。画像の正規化
しかし、次のコードは何を意味していますか?
image_size = 28 # Pixel width and height.
pixel_depth = 255.0 # Number of levels per pixel.
for image in image_files:
image_file = os.path.join(folder, image)
try:
image_data = (ndimage.imread(image_file).astype(float) -
pixel_depth/2)/pixel_depth # WHY ??
if image_data.shape != (image_size, image_size):
raise Exception('Unexpected image shape: %s' % str(image_data.shape))
dataset[num_images, :, :] = image_data
num_images = num_images + 1
except IOError as e:
print('Could not read:', image_file, ':', e, '- it\'s ok, skipping.')
正規化は多くのことを意味する可能性があります。必ずしも0から1である必要はありません。ヒント:-0.5から0.5にならないのはなぜですか? – kazemakase
右しかし、違いは何ですか? – WeiJay
このコードのように、いくつかのハイパー/マルチスペクトルイメージングの一部です。これらの手法では、これは正規化を行う方法ではありません。コードが何をするかは、いくつかのpixcelをデータキューブに変換し、8ビットイメージから-0.5と0.5の間の64/32ビット浮動小数点数を持つ配列に変換することです。さらに解像度が同じかどうかをチェックします。 –