private Model(string modelbasefilename, int batch) { string readtoend = string.Empty; using (var fs = new System.IO.StreamReader(modelbasefilename)) { readtoend = fs.ReadToEnd(); } string[] basesplit = readtoend.Split(new string[] { "!!!!!!!!!!!!!!!>" }, StringSplitOptions.RemoveEmptyEntries); string modelparam = basesplit[0]; #region ModelParmeter string[] mpsegment = modelparam.Split('\n'); var modelname = mpsegment[0]; var glparam = mpsegment[1]; var sizeparam = mpsegment[2]; int readtmp; #region globalparam var gppsplit = glparam.Split(' '); int.TryParse(gppsplit[0], out readtmp); Epoch = readtmp; Console.WriteLine("Epoch : {0}", Epoch); int.TryParse(gppsplit[1], out readtmp); Generation = readtmp; int.TryParse(gppsplit[2], out readtmp); ReverseStartBlock = readtmp; #endregion #region sizeparam BatchCount = batch; var szsplit = sizeparam.Split(' '); int.TryParse(szsplit[0], out readtmp); InputChannels = readtmp; int.TryParse(szsplit[1], out readtmp); InputWidth = readtmp; int.TryParse(szsplit[2], out readtmp); InputHeight = readtmp; #endregion #endregion List <string> layerparams = new List <string>(basesplit[1].Split(new string[] { "!!!!!!!!!!>" }, StringSplitOptions.RemoveEmptyEntries)); #region LayerParameter for (int i = 0; i < layerparams.Count; i++) { AddLayer(LayerBase.Decode(new System.IO.FileInfo(modelbasefilename).DirectoryName + @"\parameter", layerparams[i], Instance, batch)); } #endregion }