Skip to content

Instantly share code, notes, and snippets.

@tomthetrainer
Created November 11, 2016 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomthetrainer/38b9f22dc067f66654dee9200207162c to your computer and use it in GitHub Desktop.
Save tomthetrainer/38b9f22dc067f66654dee9200207162c to your computer and use it in GitHub Desktop.
// How do I apply the same functionality that I have here in this code snippet of a DataSetIterator
DataNormalization scaler = new ImagePreProcessingScaler(0,1);
scaler.fit(dataIter);
dataIter.setPreProcessor(scaler);
// this was run when I trained the data
// took pixels from 0-255 to 0-1
// Now I read the data like this (Thanks Raver.)
File mf = new File(filechose);
NativeImageLoader loader = new NativeImageLoader(height, width, channels);
INDArray image = loader.asMatrix(mf);
// The INDArray image however has values 0-255
// How do I apply the scaler from the first example, to the INDArray from the second
// More general question , what is the difference between a DataSet and an INDArray
@eraly
Copy link

eraly commented Nov 11, 2016

scaler.transform(image) will work. Give that a try

@eraly
Copy link

eraly commented Nov 11, 2016

The dataset has features,labels and masks associated with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment