public Video() { Camera = new CameraWrapper(0, null); Gender = new LibCaffeWrapper(0); Age = new LibCaffeWrapper(1); //ANG = new LibCaffeWrapper(0); Gender.Predict(StartLoc + "\\m\\deploy_gender.prototxt", StartLoc + "\\m\\gender_500001229.caffemodel", StartLoc + "\\m\\g_mean1229.binaryproto", StartLoc + "\\example_image.jpg"); Age.Predict(StartLoc + "\\m\\deploy_age.prototxt", StartLoc + "\\m\\age_net.caffemodel", StartLoc + "\\m\\g_mean1229.binaryproto", StartLoc + "\\example_image.jpg"); //ANG.ANGPredict(Application.StartupPath + "\\m\\deploy_age.prototxt", // Application.StartupPath + "\\m\\age_net.caffemodel", // Application.StartupPath + "\\m\\g_mean1229.binaryproto", // Application.StartupPath + "\\m\\deploy_gender.prototxt", // Application.StartupPath + "\\m\\gender_500001229.caffemodel", // Application.StartupPath + "\\m\\g_mean1229.binaryproto", // Application.StartupPath + "\\example_image.jpg"); //MessageBox.Show(Application.StartupPath); InitializeComponent(); axWindowsMediaPlayer2.windowlessVideo = false; axWindowsMediaPlayer2.uiMode = "none"; }
public void GenderPredict() { Gender.Predict(StartLoc + "\\m\\deploy_gender.prototxt", StartLoc + "\\m\\gender_500001229.caffemodel", StartLoc + "\\m\\g_mean1229.binaryproto", StartLoc + "\\1.png"); GenderClass = Gender.GetClassInfo(); //AgeClass = Age.GetClassInfo(); if (GenderClass == 0) { GenderString = "Male"; ManNum++; } else if (GenderClass == 1) { GenderString = "Female"; } else { GenderString = "Unknow"; } try { MethodInvoker methodInvokerDelegate = delegate() { label4.Text = GenderString; }; this.BeginInvoke(methodInvokerDelegate); } catch (System.Exception) { } }
public void AgePredict() { Age.Predict(StartLoc + "\\m\\deploy_age.prototxt", StartLoc + "\\m\\age_net.caffemodel", StartLoc + "\\m\\g_mean1229.binaryproto", StartLoc + "\\1.png"); AgeClass = Age.GetClassInfo(); if (AgeClass == 0) { AgeString = "(0-2)"; BabyNum++; } else if (AgeClass == 1) { AgeString = "(4-6)"; ChildNum++; } else if (AgeClass == 2) { AgeString = "(8-13)"; ChildNum++; } else if (AgeClass == 3) { AgeString = "(15-20)"; TeenNum++; } else if (AgeClass == 4) { AgeString = "(25-32)"; TeenNum++; } else if (AgeClass == 5) { AgeString = "(38-43)"; ZhongnianNum++; } else if (AgeClass == 6) { AgeString = "(48-53)"; ZhongnianNum++; } else if (AgeClass == 7) { AgeString = "(60- )"; TherNum++; } else { AgeString = "RECOGNIZATION FAILED!"; } try { MethodInvoker methodInvokerDelegate = delegate() { label1.Text = AgeString; watch.Stop(); label2.Text = (watch.ElapsedMilliseconds).ToString(); }; this.BeginInvoke(methodInvokerDelegate); } catch (System.Exception) { } }