We provide a Pytorch implementation of gender classification, you can achieve gender classification based on photo or video, and also you can use you conputer 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.py
is based on AlexNet, and the model we used inphoto.py
is based on ResNet, if you want to train your model, you can run thegenderClassifyRes.py
- In
realtime.py
andvideo.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.