반응형
def image_normalization(image_batch, batch_size):
for i in range(0, batch_size):
# get i-th image from the input mini-batch
tmp = image_batch[i, :, :, :]
# calculate std and mean of the image
std = np.sqrt(np.var(tmp.astype("float32"))) + 0.00000001
mean = np.mean(tmp.astype("float32"))
# normalization
image_batch[i, :, :, :] = (tmp.astype("float32") - mean) / std
return image_batch
'Deep Learning' 카테고리의 다른 글
[tensorflow] training specific variables (0) | 2017.11.14 |
---|---|
[tensorflow] batch normalization code (0) | 2017.11.14 |
[data augmentation] random image flip left/right (0) | 2017.11.13 |
[tensorflow] how to use the pre-trained network (0) | 2017.09.22 |
[tensorflow] how to save the filter weights of the trained network as matfile (0) | 2017.09.22 |