image-preprocessing

Numpy:zero mean data and standardization

依然范特西╮ 提交于 2019-12-05 03:18:54
I saw in tutorial (there were no further explanation) that we can process data to zero mean with x -= np.mean(x, axis=0) and normalize data with x /= np.std(x, axis=0) . Can anyone elaborate on these two pieces on code, only thing I got from documentations is that np.mean calculates arithmetic mean calculates mean along specific axis and np.std does so for standard deviation. This is a so called zscore . SciPy has a utility for it: >>> from scipy import stats >>> stats.zscore([ 0.7972, 0.0767, 0.4383, 0.7866, 0.8091, ... 0.1954, 0.6307, 0.6599, 0.1065, 0.0508]) array([ 1.1273, -1.247 , -0.0552

Is this the correct way of whitening an image in python?

我与影子孤独终老i 提交于 2019-12-01 06:11:07
I am trying to zero-center and whiten CIFAR10 dataset, but the result I get looks like random noise! Cifar10 dataset contains 60,000 color images of size 32x32 . The training set contains 50,000 and test set contains 10,000 images respectively. The following snippets of code show the process I did to get the dataset whitened : # zero-center mean = np.mean(data_train, axis = (0,2,3)) for i in range(data_train.shape[0]): for j in range(data_train.shape[1]): data_train[i,j,:,:] -= mean[j] first_dim = data_train.shape[0] #50,000 second_dim = data_train.shape[1] * data_train.shape[2] * data_train

Is this the correct way of whitening an image in python?

倖福魔咒の 提交于 2019-12-01 05:12:16
问题 I am trying to zero-center and whiten CIFAR10 dataset, but the result I get looks like random noise! Cifar10 dataset contains 60,000 color images of size 32x32 . The training set contains 50,000 and test set contains 10,000 images respectively. The following snippets of code show the process I did to get the dataset whitened : # zero-center mean = np.mean(data_train, axis = (0,2,3)) for i in range(data_train.shape[0]): for j in range(data_train.shape[1]): data_train[i,j,:,:] -= mean[j] first

How to implement ZCA Whitening? Python

天大地大妈咪最大 提交于 2019-11-27 23:09:15
Im trying to implement ZCA whitening and found some articles to do it, but they are a bit confusing.. can someone shine a light for me? Any tip or help is appreciated! Here is the articles i read : http://courses.media.mit.edu/2010fall/mas622j/whiten.pdf http://bbabenko.tumblr.com/post/86756017649/learning-low-level-vision-feautres-in-10-lines-of I tried several things but most of them i didnt understand and i got locked at some step. Right now i have this as base to start again : dtype = np.float32 data = np.loadtxt("../inputData/train.csv", dtype=dtype, delimiter=',', skiprows=1) img = (