Open stdex opened 9 years ago
Hello. How do you present these pictures to the neural network?
private static File file; ... Mat image = Imgcodecs.imread(file.getPath()); ... MatOfByte byteMat = new MatOfByte(); Imgcodecs.imencode(".jpg", image, byteMat); byte[] bytes = byteMat.toArray(); BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes)); ... GenderRecognition genderOutput = new GenderRecognition(); String gender = genderOutput.recognize(img);
In order to present your image to the neural network, you must detect face on image, resize detected face to 125x127 pixels and then grayscale it. Valid sample image for the neural network attached below P.S: reference for all the steps mentioned above you can find in source file VideoCam.java.
Oh, sorry. However, there were problems with recognition.
I'm use swing wrapper, for load images, code and image datasets here: https://github.com/stdex/FaceRecognition
Thank you for pointing this out. I had some similar outputs when I tested this neural network. Problem is in training set. I had only 294 faces of woman and man respectively to train the neural network, learning rate was 0.2 and momentum was 0.7; total neural network error is 0.01. What I've discovered, that output of this neural network depends mostly on picture's brightness, facial hair (not only beards and moustache, but bangs). If you want more precise output, you need to train a neural network with more diverse data set. P.S: It's a good thing using histogram equalization on image before training, but with mine data set it didn't work out very well.
In due time, I was looking for the face datasets, maybe it will help to improve the neural network.
Thank you a lot! I'll try to train new network and I'll commit it to this repository later.
How about percentage of good recognition? I'm try it and there are many wrong recognitions in it. For example: