finetune_alexnet_with_tensorflow icon indicating copy to clipboard operation
finetune_alexnet_with_tensorflow copied to clipboard

data pre-processing before finetuning, divide by 255?

Open qiyang77 opened this issue 5 years ago • 2 comments

Hello, I use python 3.6 + tensorflow 1.9.0 to do a classification task by finetuning Alexnet. In kratzert's srouce code, the range of data is [0,255] and the image is substracted by meanfile[103,116,123]. However, in my case, I perform better accrucy when the input images divide by 255 after substracted mean(distribution is [-0.5,0.5]). If the input images did not divide by 255 (distrubution is [-128, 128]), the results is bad and more easily to suffer Nan problem in summary operation when the learning rate is higher then 0.001. The question is should I scale the image ?

qiyang77 avatar Apr 14 '19 07:04 qiyang77

You probably should, yes. Not sure why I missed to do this here, since I'm doing this usually. But better than dividing by 255 you should divide by the per-channel standard deviation.

kratzert avatar Apr 14 '19 08:04 kratzert

Thank u very much!

qiyang77 avatar Apr 14 '19 08:04 qiyang77