We provide a Pytorch implementation of gender classification, you can achieve gender classification based on photo or video, and also you can use your computer camera to achieve it.
- Ubuntu or Windows
- Python3
- NVIDIA GPU + CUDA CuDNN
To use the real-time gender classification, run realtime.py
To get the gender classification based on photo, run photo.py --input_photo_path --output_photo_path
To get the gender classification based on video, run video.py --input_video_path --output_video_path
- The pre-trained model we used in
realtime.pyis based on AlexNet, and the model we used inphoto.pyis based on ResNet, if you want to train your model, you can run thegenderClassifyRes.py - In
realtime.pyandvideo.py, we use the mtcnn to detect the face, it can get a great result in dynamic video. And in
photo.py, we use the face detector in Opencv. You can replace it accord to the actual effect.




