DeepTrial / Retina-VesselNet

A Simple U-net model for Retinal Blood Vessel Segmentation based on tensorflow2
303 stars 76 forks source link

Question about dataset_normalized function #14

Closed ZiqianXie closed 5 years ago

ZiqianXie commented 5 years ago

I know this function is from orobix's retina-unet repo, but they don't seem to actively maintain that repo now. This function first does Z normalization and then rescale the image back to [0, 255], which is equivalent to just scale the image to [0, 255]? Should the mean and std be calculated only along the batch axis?

DeepTrial commented 5 years ago

i think that should be done along the batch axis.In my opinion,normlization is not equivalent to scale image to [0,255],it's hard to give u actual reason.I will take some time to adjust their orders and make a experiment.

ZiqianXie commented 5 years ago

In numpy, if you don't specify the axis, then mean and std are calculated with respect to the whole array. So they are just two constants, std is always positive, so rescale img to [0, 255] is equivalent to rescale (img - constA)/constB to [0, 255]. That being said, in your dataloader there's no preprocessing other than conversion from rgb to gray so it doesn't matter.