在我看来,图像规范化是为了使每个像素都用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.')