Skip to content

Commit

Permalink
Some more updates to datasets.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ragav committed Jan 25, 2017
1 parent 257b086 commit 85e726e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 1 addition & 5 deletions yann/special/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def cook_mnist_normalized( verbose = 1, **kwargs):
# parameters relating to preprocessing.
preprocess_params = {
"normalize" : True,
"GCN" : False,
"ZCA" : False,
"grayscale" : False,
"zero_mean" : False,
Expand Down Expand Up @@ -90,7 +89,6 @@ def cook_mnist_normalized_zero_mean( verbose = 1, **kwargs):
# parameters relating to preprocessing.
preprocess_params = {
"normalize" : True,
"GCN" : False,
"ZCA" : False,
"grayscale" : False,
"zero_mean" : True,
Expand Down Expand Up @@ -147,7 +145,6 @@ def cook_mnist_multi_load( verbose = 1, **kwargs):
# parameters relating to preprocessing.
preprocess_params = {
"normalize" : True,
"GCN" : False,
"ZCA" : False,
"grayscale" : False,
"zero_mean" : False,
Expand Down Expand Up @@ -200,10 +197,9 @@ def cook_cifar10_normalized(verbose = 1, **kwargs):
# parameters relating to preprocessing.
preprocess_params = {
"normalize" : True,
"GCN" : False,
"ZCA" : False,
"grayscale" : False,
"mean_subtract" : False,
"zero_mean" : False,
}
else:
preprocess_params = kwargs['preprocess_params']
Expand Down
9 changes: 5 additions & 4 deletions yann/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,7 @@ def preprocessing( data, height, width, channels, args):
args = {
"normalize" : <bool> True for normalize across batches
"GCN" : True for global contrast normalization
"normalize" : <bool> True for normalize across batches makes image go from 0 - 1
"ZCA" : True, kind of like a PCA representation (not fully tested)
"grayscale" : Convert the image to grayscale
"zero_mean" : Subtracts the mean of the image.
Expand All @@ -702,7 +701,6 @@ def preprocessing( data, height, width, channels, args):
"""
normalize = args [ "normalize" ]
GCN = args [ "GCN" ]
ZCA = args [ "ZCA" ]
gray = args [ "grayscale" ]
zero_mean = args [ "zero_mean" ]
Expand Down Expand Up @@ -735,9 +733,12 @@ def preprocessing( data, height, width, channels, args):
if normalize is True or ZCA is True:
data = data / (data.max() + 1e-7)

if zero_mean is True: # This will make the data go from (-1,1)
if normalize is True and zero_mean is True: # This will make the data go from (-1,1)
data = ( data - 0.5 ) * 2

elif zero_mean is True:
data = (data - data.mean())

if ZCA is True:

sigma = numpy.dot(data.T,data) / data.shape[1]
Expand Down

0 comments on commit 85e726e

Please sign in to comment.