ValeriyV
ValeriyV

Reputation: 11

I can't load pretrained CNTK model on C#

I use Microsoft CNTK technology to create a simple neural network. I managed to train the network, but I have problems with saving the model to a file and then loading it.

Step-by-step

First run program:

1) Create model structure

2) Train model on training samples

3) Save model to file

model.Save();

4) Evaluate model on test samples and get about 80% correct answers - OK

5) Rebuild model and load file :

model = new Function.Load(fileBytes, DeviceDescriptor.CPUDevice) 

6) Evaluate model on test samples, I get 80% correct answer again, it's good, I think that model file really contains weights

Second run program:

1) Create model structure

2) Load previously saved model from file

 model = Function.Load(modelFile, DeviceDescriptor.CPUDevice);
 featuresVariable  = model.Arguments[0];
 labelVariable = model.Output;

3) Evaluate model on test samples and get 1-2% correct answers

Actually questions:

How to load model correctly from the file?

Why when the model is first launched it loads and gives the correct answers, but this does not happen when the program is restarted.

Upvotes: 1

Views: 205

Answers (0)

Related Questions