예제 #1
0
        private LabelMap loadLabelMap()
        {
            string   strFile = getDataFile(dataset_name, "labelmap_voc.prototxt");
            RawProto proto   = RawProtoFile.LoadFromFile(strFile);

            return(LabelMap.FromProto(proto));
        }
예제 #2
0
        public void TestLoadingFiles()
        {
            string strPath = TestBase.GetTestPath("\\MyCaffe\\test_data\\models", true, true);

            string[] rgstrDir = Directory.GetDirectories(strPath);

            foreach (string strDir in rgstrDir)
            {
                string[] rgstrFiles = Directory.GetFiles(strDir);

                foreach (string strFile in rgstrFiles)
                {
                    FileInfo fi = new FileInfo(strFile);

                    if (fi.Extension == ".prototxt")
                    {
                        Trace.WriteLine("Loading '" + fi.FullName + "...");

                        RawProto proto1    = RawProtoFile.LoadFromFile(fi.FullName);
                        string   strProto1 = proto1.ToString();

                        RawProto proto2    = RawProto.Parse(strProto1);
                        string   strProto2 = proto2.ToString();

                        Assert.AreEqual(strProto1, strProto2);
                    }
                }
            }
        }
        private ProjectEx getProject()
        {
            ProjectEx p = new ProjectEx("AlexNet Project");

            DatasetFactory    factory = new DatasetFactory();
            DatasetDescriptor ds      = factory.LoadDataset("CIFAR-10");

            p.SetDataset(ds);

            string strModelFile  = getTestPath("\\MyCaffe\\test_data\\models\\alexnet\\cifar\\alexnet_cifar_train_val.prototxt");
            string strSolverFile = getTestPath("\\MyCaffe\\test_data\\models\\alexnet\\cifar\\alexnet_cifar_solver.prototxt");

            p.LoadModelFile(strModelFile);
            RawProto proto = RawProtoFile.LoadFromFile(strSolverFile);

            RawProto iter = proto.FindChild("max_iter");

            iter.Value = m_nMaxIteration.ToString();

            p.SolverDescription = proto.ToString();

            return(p);
        }