private void onDownloadCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { Stopwatch watch = Stopwatch.StartNew(); var result = _mobilenet.MostLikely(_image[0]); watch.Stop(); String resStr = String.Format("Object is {0} with {1}% probability. Recognition completed in {2} milliseconds.", result.Label, result.Probability * 100, watch.ElapsedMilliseconds); SetImage(_image[0]); SetMessage(resStr); }
public void TestMobilenet() { using (Mobilenet mobilenet = new Mobilenet()) { bool processCompleted = false; mobilenet.OnDownloadCompleted += (sender, e) => { var result = mobilenet.MostLikely("grace_hopper.jpg"); processCompleted = true; }; mobilenet.Init(); while (!processCompleted) { Thread.Sleep(1000); } } }