Exemplo n.º 1
0
 /// <summary>
 /// Sets the new value for the layer output blob.
 /// </summary>
 /// <param name="outputName">Descriptor of the updating layer output blob.</param>
 /// <param name="blob">New blob</param>
 public void SetBlob(String outputName, Blob blob)
 {
    using (CvString outputNameStr = new CvString(outputName))
       ContribInvoke.cveDnnNetSetBlob(_ptr, outputNameStr, blob);
 }
Exemplo n.º 2
0
      public void TestDnn()
      {
         Dnn.Net net = new Dnn.Net();
         using (Dnn.Importer importer = Dnn.Importer.CreateCaffeImporter("bvlc_googlenet.prototxt", "bvlc_googlenet.caffemodel"))
            importer.PopulateNet(net);
           
         Mat img = EmguAssert.LoadMat("space_shuttle.jpg");
         CvInvoke.Resize(img, img, new Size(224, 224));
         Dnn.Blob inputBlob = new Dnn.Blob(img);
         net.SetBlob(".data", inputBlob);
         net.Forward();
         Dnn.Blob probBlob = net.GetBlob("prob");
         int classId;
         double classProb;
         GetMaxClass(probBlob, out classId, out classProb);
         String[] classNames = ReadClassNames("synset_words.txt");

#if !NETFX_CORE
         Trace.WriteLine("Best class: " + classNames[classId] + ". Probability: " + classProb);
#endif

      }