Training Images

images={,,,,,,,,,,,,,,,,,,,,,,,,,,,,,};

Label Faces

gender={"male","male","male","male","male","male","male","male","male","male","male","male","male","male","male","female","female","female","female","female","female","female","female","female","female","female","female","female","female","female"};

Trim the faces out of images

faces=ConformImages[HistogramTransform@ImageTrim[#,FindFaces[#][[1]]]&/@images,ColorSpace->"Grayscale"];

Define the training and test set

trainingSetSize=30;

trainingSet=Rule@@@Transpose@{faces,gender}[[All, ;;trainingSetSize]];

testSet=Rule@@@Transpose@{faces,gender}[[All,trainingSetSize+1;;]];

Create classifier

GenderClassifier=Classify[trainingSet,Method->"LogisticRegression"]

Measure the accuracy

ClassifierMeasurements[GenderClassifier,trainingSet,"Accuracy"]

Create Function to classify new images

GenderDetect[img_Image]:=With[{faces=FindFaces[img]},If[faces=!={},GenderClassifier[HistogramTransform[ImageTrim[ColorConvert[img,GrayLevel],faces[[1]]]]],"no face detected"]]
GenderDetect[images__Image]:=GenderDetect/@{images}

Sample test images

imgs={,,,,,,,};

Test the images

GenderDetect@@imgs

Real-time test image

snapic=CurrentImage[]

facet=FindFaces[snapic];

Show[{snapic,Graphics[{Text[Style[GenderDetect[snapic],Bold,Red,30],{0,0},{-5,-3}],EdgeForm[{Green,Thick}],FaceForm[],Rectangle@@@facet}
]}]

Real-time gender detector

Dynamic[
snapic=CurrentImage[];
facet=FindFaces[snapic];
Show[{snapic,Graphics[{Text[Style[GenderDetect[snapic],Bold,Red,30],{0,0},{-5,-3}],EdgeForm[{Green,Thick}],FaceForm[],Rectangle@@@facet}
]}]]