Classifying Gender Based on Face Images Using Vision Transformer

Ganjar Tahyudin - Telkom University, Bandung 40257, Indonesia
Mahmud Sulistiyo - Telkom University, Bandung 40257, Indonesia
Muhammad Arzaki - Telkom University, Bandung 40257, Indonesia
Ema Rachmawati - Telkom University, Bandung 40257, Indonesia

Citation Format:



Due to various factors that cause visual alterations in the collected facial images, gender classification based on image processing continues to be a performance challenge for classifier models. The Vision Transformer model is used in this study to suggest a technique for identifying a person’s gender from their face images. This study investigates how well a facial image-based model can distinguish between male and female genders. It also investigates the rarely discussed performance on the variation and complexity of data caused by differences in racial and age groups. We trained on the AFAD dataset and then carried out same-dataset and cross-dataset evaluations, the latter of which considers the UTKFace dataset.  From the experiments and analysis in the same-dataset evaluation, the highest validation accuracy of  happens for the image of size  pixels with eight patches. In comparison, the highest testing accuracy of  occurs for the image of size  pixels with  patches. Moreover, the experiments and analysis in the cross-dataset evaluation show that the model works optimally for the image size  pixels with  patches, with the value of the model’s accuracy, precision, recall, and F1-score being , , , and , respectively. Furthermore, the misclassification analysis shows that the model works optimally in classifying the gender of people between 21-70 years old. The findings of this study can serve as a baseline for conducting further analysis on the effectiveness of gender classifier models considering various physical factors.


Gender; classification; face image; vision transformer

Full Text:



B. Moghaddam and M.-H. Yang, “Learning gender with support faces,” IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 707-711, 2002.

S. S. Liew, M. K. Hani, S. A. Radzi and R. Bakhteri, “Gender classification: a convolutional neural network approach,” Turkish Journal of Electrical Engineering and Computer Sciences, vol. 24, no. 3, pp. 1248-1264, 2016.

R. A. Asmara, B. S. Andjani, U. D. Rosiani and P. Choirina, “Klasifikasi Jenis Kelamin Pada Citra Wajah Menggunakan Metode Naive Bayes,” Jurnal Informatika Polinema, vol. 4, no. 3, pp. 212-217, 2018.

S. Mohamed, N. Nour and S. Viriri, “Gender identification from facial images using global features,” in 2018 Conference on Information Communications Technology and Society (ICTAS), 2018.

G. Azzopardi, P. Foggia, A. Greco, A. Saggese and M. Vento, “Gender recognition from face images using trainable shape and color features,” in 2018 24th International conference on pattern recognition (ICPR), 2018.

L. Tianyu, L. Fei and W. Rui, “Human face gender identification system based on MB-LBP,” in 2018 Chinese Control And Decision Conference (CCDC), 2018.

J. Singh and S. Shekhar, “Road damage detection and classification in smartphone captured images using mask R-CNN,” in IEEE BigData Cup 2018 Workshop, 2018.

A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold and S. Gelly, “An image is worth 16x16 words: Transformers for image recognition at scale,” in 2021 International Conference on Learning Representations , 2021.

A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser and I. Polosukhin, “Attention is all you need,” Advances in neural information processing systems, vol. 30, 2017.

S. Poornima, N. Sripriya, B. Vijayalakshmi and P. Vishnupriya, “Attendance monitoring system using facial recognition with audio output and gender classification,” in the 2017 International Conference on Computer, Communication and Signal Processing, 2017.

Y. Yu and T. Yao, “Gender classification of Chinese Weibo users,” in International Conference on E-commerce, E-Business and E-Government, 2017.

W. Kim, C. Di Benedetto and R. A. Lancioni, “The effects of country and gender differences on consumer innovativeness and decision processes in a highly globalized high‐tech product market,” Asia Pacific Journal of Marketing and Logistics, vol. 23, no. 5, pp. 714-744, 2011.

F. Lin, Y. Wu, Y. Zhuang, X. Long and W. Xu, “Human gender classification: A review,” International Journal of Biometrics, vol. 8, no. 3-4, pp. 275-300, 2016.

G. Levi and T. Hassner, “Age and gender classification using convolutional neural networks,” in Conference on Computer Vision and Pattern Recognition Workshops, 2015.

T. Jabid, M. H. Kabir and O. Chae, “Gender classification using local directional pattern (LDP),” in 20th International Conference on Pattern Recognition, 2010.

S. Gutta, H. Wechsler and P. J. Phillips, “Gender and ethnic classification of face images,” in Third IEEE International Conference on Automatic Face and Gesture Recognition, 1998.

N. Sun, W. Zheng, C. Sun, C. Zou and L. Zhao, “Gender classification based on boosting local binary pattern,” in Third International Symposium on Neural Networks, Chengdu, 2006.

A. B. A. Graf and F. A. Wichmann, “Gender classification of human faces,” in Biologically Motivated Computer Vision: Second International Workshop, Tübingen, 2002.

M. Afifi and A. Abdelhamed, “Afif4: Deep gender classification based on adaboost-based fusion of isolated facial features and foggy faces,” Journal of Visual Communication and Image Representation, vol. 62, pp. 77-86, 2019.

C. Shan, “Learning local binary patterns for gender classification on real-world face images,” Pattern Recognition Letters, vol. 33, no. 4, pp. 431-437, 2012.

D. Yaman, F. I. Eyiokur and H. K. Ekenel, “Multimodal age and gender classification using ear and profile face images,” in Conference on Computer Vision and Pattern Recognition Workshops, 2019.

C. Chen and A. Ross, “Evaluation of gender classification methods on thermal and near-infrared face images,” in International Joint Conference on Biometrics, 2011.

H.-C. Lian and B.-L. Lu, “Multi-view gender classification using local binary patterns and support vector machines,” in International Symposium on Neural Networks, 2006.

S. Yu, T. Tan, K. Huang, K. Jia and X. Wu, “A study on gait-based gender classification,” IEEE Transactions on Image Processing, vol. 18, no. 8, pp. 1905-1910, 2009.

P. Barra, C. Bisogni, M. Nappi, D. Freire-Obregón and M. Castrillón-Santana, “Gait analysis for gender classification in forensics,” in Dependability in Sensor, Cloud, and Big Data Systems and Applications: 5th International Conference, Guangzhou, 2019.

P. Barra, C. Bisogni, M. Nappi, D. Freire-Obregón and M. Castrillón-Santana, “Gender classification on 2D human skeleton,” in 3rd International Conference on Bio-engineering for Smart Technologies, 2019.

H. Mubarak, S. A. Chowdhury and F. Alam, “Arabgend: Gender analysis and inference on arabic twitter,” arXiv preprint arXiv:2203.00271, 2022.

F. Rangel, P. Rosso, M. Montes-y-Gómez, M. Potthast and B. Stein, “Overview of the 6th author profiling task at pan 2018: Multimodal gender identification in twitter,” Working notes papers of the CLEF 192, 2018.

K. Rakesh, S. Dutta and K. Shama, “Gender Recognition using speech processing techniques in LABVIEW,” International Journal of Advances in Engineering & Technology, vol. 1, no. 2, p. 51, 2011.

A. Tursunov, Mustaqeem, J. Y. Choeh and S. Kwon, “Age and gender recognition using a convolutional neural network with a specially designed multi-attention module through speech spectrograms,” Sensors, vol. 21, no. 17, p. 5892, 2021.

P. Rai and P. Khanna, “Gender classification techniques: A review,” in Advances in Computer Science, Engineering & Applications: Proceedings of the Second International Conference on Computer Science, Engineering and Applications, New Delhi, 2012.

B. Jaeger, W. W. A. Sleegers and A. M. Evans, “Automated classification of demographics from face images: A tutorial and validation,” Social and Personality Psychology Compass, vol. 14, no. 3, p. e12520, 2020.

C.-B. Ng, Y.-H. Tay and B.-M. Goi, “A review of facial gender recognition,” Pattern Analysis and Applications, vol. 18, pp. 739-755, 2015.

S. A. Khan, M. Ahmad, M. Nazir and N. Riaz, “A comparative analysis of gender classification techniques,” International Journal of Bio-Science and Bio-Technology, vol. 5, no. 4, pp. 223-244, 2013.

A. Hadid, J. Ylioinas, M. Bengherabi, M. Ghahramani and A. Taleb-Ahmed, “Gender and texture classification: A comparative analysis using 13 variants of local binary patterns,” Pattern Recognition Letters, vol. 68, pp. 231-238, 2015.

S. Amilia, M. D. Sulistiyo and R. N. Dayawati, “Face image-based gender recognition using complex-valued neural network,” in 3rd International Conference on Information and Communication Technology, 2015.

P. Guo, Z. Xue, L. R. Long and S. Antani, “Cross-dataset evaluation of deep learning networks for uterine cervix segmentation,” Diagnostics, vol. 10, no. 1, p. 44, 2020.

X. Ying, “An Overview of Overfitting and its Solutions,” in Journal of physics: conference series, 2019.

T.-C. Pham, C.-M. Luong, M. Visani and V.-D. Hoang, “Deep CNN and data augmentation for skin lesion classification,” in Intelligent Information and Database Systems: 10th Asian Conference, ACIIDS 2018, Dong Hoi, 2018.

B. Xia, H. Zhang, Q. Li and T. Li, “PETs: a stable and accurate predictor of protein-protein interacting sites based on extremely-randomized trees,” IEEE transactions on nanobioscience, vol. 14, no. 8, pp. 882-893, 2015.

T. Anwar and S. Zakir, “Deep learning based diagnosis of COVID-19 using chest CT-scan images,” in 2020 IEEE 23rd International Multitopic Conference, 2020.