Closed TDClarke closed 1 year ago
apologies for the long delay, also i'm not doing much java atm., but looking here
the classification should be easy to do in java, similar to:
Net net = Dnn.readNet(modelConfiguration, modelWeights);
Mat image = Imgcodecs.imread("face.jpg");
Mat blob = Dnn.blobFromImage(image, 1.0, new Size(256, 256), new Scalar(104, 117, 123), false);
net.setInput(blob, "data");
Mat out = net.forward();
Mat scores = out.reshape(1,1); // to horizontal 1d
Core.MinMaxLocResult mm = Core.minMaxLoc(scores);
int classId = mm.maxLoc.x;
links to the models are o this page: https://talhassner.github.io/home/publication/2015_CVPR
I came across your github and opencv_smallfry examples and have a potential nice example project in java for you!
It would combine a Haar Cascade and 2x DNN networks predicting the images faces, gender and age, This is more elegant than the face angle or anthropomorphic methods and yields better results.