Closed nikosdim1 closed 5 years ago
Is it Sequential Load or CNTK load function not working. Because Sequential load function internally call the CNTK load
thank u Deepak for your answer...can this be fixed or do you have any working example (with SIA) ?
Hi Nick,
This is one example which you can try:
model = new Sequential(); //Build model model.Add(new Dense(dim: 20, shape: 13, act: OptActivations.LeakyReLU)); model.Add(new Dense(dim: 13, act: OptActivations.LeakyReLU)); model.Add(new Dropout(rate: 0.2)); model.Add(new Dense(dim: 1, act: OptActivations.LeakyReLU));
//Save model model.SaveModel("Path to save model");
//Load and evaluate model = new Sequential(); model.LoadModel("Path to model file"); model.Evaluate(< Pass data Frame >);
yes, this indeed works..I wanted to instantiate a new model like this:
// Build and train a model Dim existingModel as new Sequential() //add layers etc...
if Accuracy > 0.90 then existingModel.SaveModel("Path")
// new model for evaluating Saved Best Model Dim Best_saved_model as new Sequential() Best_saved_model .LoadModel("Path") Best_saved_model.Evaluate("Dataframe")
The problem is in the last line of code where the Best_saved_model does not contain any layers inside.
Code updated to save and load layers as well. Please try and let me know if it works:
model = new Sequential(); //Build model model.Add(new Dense(dim: 20, shape: 13, act: OptActivations.LeakyReLU)); model.Add(new Dense(dim: 13, act: OptActivations.LeakyReLU)); model.Add(new Dropout(rate: 0.2)); model.Add(new Dense(dim: 1, act: OptActivations.LeakyReLU));
//Save model model.SaveModel("Path to save model"); model.SaveNetConfig("Path to layer config");
//Load and evaluate model = Sequential.LoadNetConfig("path to layer config") model.LoadModel("Path to model file"); model.Evaluate(< Pass data Frame >);
hm...I checked it:
although Layers have some data, the rest of the model is not loading and prompts error
: 'Object reference not set to an instance of an object.'
at
public IList
The model and the LoadedModel although it seems to have the same number of layers, the later lacks of important data that are inside the (training) model
Which method is still having the issue: LoadModel or LoadNetConfig
I have this same problem. It appears that if you load the model without training first the trainPredict variable is null and therefore Evaluate fails.
I changed this method in MNISTClassifier.cs to write the model and netconfig.
public static void Train()
{
//model.Compile(OptOptimizers.SGD, OptLosses.CrossEntropy, OptMetrics.Accuracy);
model.Compile(new SGD(0.01), OptLosses.CrossEntropy, OptMetrics.Accuracy);
model.Train(train, 10, 64, null);
model.SaveModel("mnist.model");
model.SaveNetConfig("mnist.netconfig");
}
Then in your example code I did this:
//MNIST Classification example
MNISTClassifier.LoadData();
MNISTClassifier.BuildModel();
MNISTClassifier.Train();
var seq = new Sequential();
var model = Sequential.LoadNetConfig("mnist.netconfig");
model.LoadModel("mnist.model");
var predictData = new DataFrame();
//predictData.LoadImage("[image path]", Tuple.Create(28, 28));
predictData.LoadFromCsv(@"C:\Path\To\data\cv.csv", false);
var result = model.Evaluate(predictData);
The csv file looks like this. It's just a csv formatted mnist file.
6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,213,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,232,223,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,253,224,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,254,253,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,203,253,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,254,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,252,213,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,142,0,0,0,0,0,0,0,0,82,173,253,193,30,0,0,0,0,0,0,0,0,0,0,0,0,132,252,102,0,0,0,0,0,0,0,82,243,253,252,253,131,0,0,0,0,0,0,0,0,0,0,0,0,152,253,102,0,0,0,0,0,11,213,254,253,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,152,252,102,0,0,0,0,0,213,252,253,252,253,252,253,252,0,0,0,0,0,0,0,0,0,0,0,0,152,253,123,0,0,0,0,102,254,253,244,162,31,92,254,151,0,0,0,0,0,0,0,0,0,0,0,0,193,252,243,40,0,0,62,203,253,252,223,142,233,252,233,50,0,0,0,0,0,0,0,0,0,0,0,0,152,253,254,253,193,152,132,253,254,253,254,253,254,253,203,20,0,0,0,0,0,0,0,0,0,0,0,0,71,252,253,252,253,252,253,252,253,252,253,252,253,252,20,0,0,0,0,0,0,0,0,0,0,0,0,0,21,183,255,253,254,253,254,253,254,253,254,213,142,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,232,253,252,253,252,253,171,91,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,102,173,253,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,252,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,77,130,130,130,130,215,254,254,254,254,254,254,209,80,0,0,0,0,0,0,0,0,0,0,0,0,1,86,253,253,253,253,253,253,253,253,253,253,253,253,249,146,0,0,0,0,0,0,0,0,0,0,0,0,7,253,253,253,253,253,253,253,253,249,235,235,235,235,88,0,0,0,0,0,0,0,0,0,0,0,0,0,80,253,253,251,228,149,105,105,105,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,253,253,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,253,171,33,24,38,38,126,161,128,74,62,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,233,253,253,253,243,222,253,253,253,253,253,253,253,224,167,59,26,0,0,0,0,0,0,0,0,0,0,0,130,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,220,120,3,0,0,0,0,0,0,0,0,0,104,253,253,253,253,218,197,197,197,136,197,197,197,197,245,253,253,253,126,2,0,0,0,0,0,0,0,0,2,134,182,68,68,25,0,0,0,0,0,0,0,0,104,246,253,253,253,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,247,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,253,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,239,253,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,250,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,253,253,192,0,0,0,0,0,0,0,0,0,121,223,223,147,37,0,0,0,0,0,0,0,0,0,40,239,253,253,204,0,0,0,0,0,0,0,0,6,242,253,253,253,238,230,230,202,106,106,54,106,106,151,239,253,253,204,15,0,0,0,0,0,0,0,0,7,253,253,253,253,253,253,253,253,253,253,245,253,253,253,253,253,149,15,0,0,0,0,0,0,0,0,0,1,79,144,253,253,253,253,253,253,253,253,253,253,253,253,207,84,1,0,0,0,0,0,0,0,0,0,0,0,0,1,5,82,129,129,214,253,253,159,129,190,129,129,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,134,253,183,184,127,121,121,121,121,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,248,252,252,252,253,252,252,252,252,252,250,240,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,173,252,252,202,159,158,158,158,158,158,158,218,246,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,203,252,119,0,0,0,0,0,0,0,25,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,252,252,119,0,26,27,139,55,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,252,196,147,247,252,252,252,230,56,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,252,252,253,252,252,252,252,252,252,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,253,253,253,255,139,85,0,137,253,253,239,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,248,252,252,195,83,1,0,0,4,63,252,252,161,0,0,0,0,0,0,0,0,0,164,5,0,0,0,54,252,252,247,75,0,0,0,0,0,54,252,252,238,0,0,0,0,0,0,0,0,0,253,126,0,0,0,54,252,243,93,0,0,0,0,0,0,54,252,252,196,0,0,0,0,0,0,0,0,0,253,230,81,11,0,12,143,96,0,0,0,0,0,0,0,89,252,252,106,0,0,0,0,0,0,0,0,0,129,249,252,196,81,14,0,0,0,0,0,0,0,0,148,235,252,232,28,0,0,0,0,0,0,0,0,0,0,131,248,252,252,193,152,41,41,41,41,41,41,153,236,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,83,205,246,252,252,252,252,252,253,252,252,252,252,246,133,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,241,252,252,252,252,253,252,252,248,238,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,119,203,252,252,253,195,119,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The key to reproducing this error is loading the config and model without training.
result is never populated because of the exception being thrown because trainPredict is null. Do you have any ideas how to work around this?
Hello,
The input will be an image and not a CSV file. I am a bit away from this project for now and will be back after a month. I remember there is an overload for Evaluate function to take image as well. Please check and try if that works.
On Wed, Feb 28, 2018 at 12:56 AM, Darren Schroeder <notifications@github.com
wrote:
I have this same problem. It appears that if you load the model without training first the trainPredict variable is null and therefore Evaluate fails.
I changed this method in MNISTClassifier.cs to write the model and netconfig.
public static void Train() { //model.Compile(OptOptimizers.SGD, OptLosses.CrossEntropy, OptMetrics.Accuracy); model.Compile(new SGD(0.01), OptLosses.CrossEntropy, OptMetrics.Accuracy); model.Train(train, 10, 64, null); model.SaveModel("mnist.model"); model.SaveNetConfig("mnist.netconfig"); }
Then in your example code I did this:
//MNIST Classification exampleMNISTClassifier.LoadData();MNISTClassifier.BuildModel();MNISTClassifier.Train(); var seq = new Sequential();var model = Sequential.LoadNetConfig("mnist.netconfig");model.LoadModel("mnist.model");var predictData = new DataFrame();//predictData.LoadImage("[image path]", Tuple.Create(28, 28));predictData.LoadFromCsv(@"C:\Path\To\data\cv.csv", false);var result = model.Evaluate(predictData);
The csv file looks like this. It's just a csv formatted mnist file.
6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,213,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,232,223,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,253,224,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,252,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,254,253,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,203,253,212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,254,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,92,252,213,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,253,142,0,0,0,0,0,0,0,0,82,173,253,193,30,0,0,0,0,0,0,0,0,0,0,0,0,132,252,102,0,0,0,0,0,0,0,82,243,253,252,253,131,0,0,0,0,0,0,0,0,0,0,0,0,152,253,102,0,0,0,0,0,11,213,254,253,254,253,254,253,0,0,0,0,0,0,0,0,0,0,0,0,152,252,102,0,0,0,0,0,213,252,253,252,253,252,253,252,0,0,0,0,0,0,0,0,0,0,0,0,152,253,123,0,0,0,0,102,254,253,244,162,31,92,254,151,0,0,0,0,0,0,0,0,0,0,0,0,193,252,243,40,0,0,62,203,253,252,223,142,233,252,233,50,0,0,0,0,0,0,0,0,0,0,0,0,152,253,254,253,193,152,132,253,254,253,254,253,254,253,203,20,0,0,0,0,0,0,0,0,0,0,0,0,71,252,253,252,253,252,253,252,253,252,253,252,253,252,20,0,0,0,0,0,0,0,0,0,0,0,0,0,21,183,255,253,254,253,254,253,254,253,254,213,142,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,232,253,252,253,252,253,171,91,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,102,173,253,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,252,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,77,130,130,130,130,215,254,254,254,254,254,254,209,80,0,0,0,0,0,0,0,0,0,0,0,0,1,86,253,253,253,253,253,253,253,253,253,253,253,253,249,146,0,0,0,0,0,0,0,0,0,0,0,0,7,253,253,253,253,253,253,253,253,249,235,235,235,235,88,0,0,0,0,0,0,0,0,0,0,0,0,0,80,253,253,251,228,149,105,105,105,79,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,253,253,228,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,253,253,171,33,24,38,38,126,161,128,74,62,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,233,253,253,253,243,222,253,253,253,253,253,253,253,224,167,59,26,0,0,0,0,0,0,0,0,0,0,0,130,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,220,120,3,0,0,0,0,0,0,0,0,0,104,253,253,253,253,218,197,197,197,136,197,197,197,197,245,253,253,253,126,2,0,0,0,0,0,0,0,0,2,134,182,68,68,25,0,0,0,0,0,0,0,0,104,246,253,253,253,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,247,253,253,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,193,253,253,165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,239,253,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,250,253,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,253,253,192,0,0,0,0,0,0,0,0,0,121,223,223,147,37,0,0,0,0,0,0,0,0,0,40,239,253,253,204,0,0,0,0,0,0,0,0,6,242,253,253,253,238,230,230,202,106,106,54,106,106,151,239,253,253,204,15,0,0,0,0,0,0,0,0,7,253,253,253,253,253,253,253,253,253,253,245,253,253,253,253,253,149,15,0,0,0,0,0,0,0,0,0,1,79,144,253,253,253,253,253,253,253,253,253,253,253,253,207,84,1,0,0,0,0,0,0,0,0,0,0,0,0,1,5,82,129,129,214,253,253,159,129,190,129,129,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,134,253,183,184,127,121,121,121,121,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,108,248,252,252,252,253,252,252,252,252,252,250,240,156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,173,252,252,202,159,158,158,158,158,158,158,218,246,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,203,252,119,0,0,0,0,0,0,0,25,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,252,252,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,125,252,252,119,0,26,27,139,55,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,252,196,147,247,252,252,252,230,56,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,173,252,252,252,253,252,252,252,252,252,252,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,253,253,253,255,139,85,0,137,253,253,239,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,248,252,252,195,83,1,0,0,4,63,252,252,161,0,0,0,0,0,0,0,0,0,164,5,0,0,0,54,252,252,247,75,0,0,0,0,0,54,252,252,238,0,0,0,0,0,0,0,0,0,253,126,0,0,0,54,252,243,93,0,0,0,0,0,0,54,252,252,196,0,0,0,0,0,0,0,0,0,253,230,81,11,0,12,143,96,0,0,0,0,0,0,0,89,252,252,106,0,0,0,0,0,0,0,0,0,129,249,252,196,81,14,0,0,0,0,0,0,0,0,148,235,252,232,28,0,0,0,0,0,0,0,0,0,0,131,248,252,252,193,152,41,41,41,41,41,41,153,236,252,252,133,0,0,0,0,0,0,0,0,0,0,0,0,83,205,246,252,252,252,252,252,253,252,252,252,252,246,133,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,241,252,252,252,252,253,252,252,248,238,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,119,203,252,252,253,195,119,82,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
result is never populated because of the exception being thrown because trainPredict is null. Do you have any ideas how to work around this?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/deepakkumar1984/SiaNet/issues/26#issuecomment-368895081, or mute the thread https://github.com/notifications/unsubscribe-auth/AGCQKTk6c8wFMLkSap0Ws8bJjsHmW4MYks5tZBCugaJpZM4RZ_mk .
-- Regards, Deepak
Thanks for the response.
Clearly I understand the difference between an Image and a CSV file however, as you know, the mnist handwriting digit set can be represented in a CSV, which is what I posted.
Also, I understand there is a DataFrame method called LoadImage for images, which is why it's commented out in the code I posted. There is no overload to Evaluate and image. You appear to only evaluate DataFrames.
Neither of these responses addressed the issue, which is what I said in the second sentence. The trainPredict variable, which seems to be required for Evaluation, is always null unless you're actively training a model. The question is what needs to change in order to make your code work in a real world situation. i.e. 1) Train a Model - we know how to do this 2) save a model - we know how to do this 3) load a model - we know how to do this 4) Use that loaded model to evaluate images/data - this is what is missing.
Darren
@deepakkumar1984 Any answer on how to set trainPredict when one is loading a model?
Closing it off as there is no activity in last 180 days
Model.load is not loading layers etc
Saving seems OK and this works :
Dim modelcntk As CNTK.Function = CNTK.Function.Load(modelfile, CNTK.DeviceDescriptor.GPUDevice(0))
But cant load in Sequential Model as it has to be a Sequential and above code loads a function