{"id":19321117,"url":"https://github.com/smahesh29/gender-and-age-detection","last_synced_at":"2025-04-05T12:07:31.891Z","repository":{"id":37710360,"uuid":"226574233","full_name":"smahesh29/Gender-and-Age-Detection","owner":"smahesh29","description":"A Python project which can detect gender and age using OpenCV of the person (face) in a picture or through webcam.","archived":false,"fork":false,"pushed_at":"2023-07-02T06:15:46.000Z","size":92901,"stargazers_count":394,"open_issues_count":9,"forks_count":177,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-02-14T21:14:58.391Z","etag":null,"topics":["age","age-detection","age-prediction","gender","gender-detection","gender-prediction","opencv","opencv-python","python","webcam"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smahesh29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-07T20:49:21.000Z","updated_at":"2024-08-01T16:31:41.565Z","dependencies_parsed_at":"2024-08-01T16:41:43.146Z","dependency_job_id":null,"html_url":"https://github.com/smahesh29/Gender-and-Age-Detection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smahesh29%2FGender-and-Age-Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smahesh29%2FGender-and-Age-Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smahesh29%2FGender-and-Age-Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smahesh29%2FGender-and-Age-Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smahesh29","download_url":"https://codeload.github.com/smahesh29/Gender-and-Age-Detection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332609,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["age","age-detection","age-prediction","gender","gender-detection","gender-prediction","opencv","opencv-python","python","webcam"],"created_at":"2024-11-10T01:35:36.595Z","updated_at":"2025-04-05T12:07:31.856Z","avatar_url":"https://github.com/smahesh29.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gender-and-Age-Detection   \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/smahesh29/Gender-and-Age-Detection\"\u003e\n\n\n\u003ch2\u003eObjective :\u003c/h2\u003e\n\u003cp\u003eTo build a gender and age detector that can approximately guess the gender and age of the person (face) in a picture or through webcam.\u003c/p\u003e\n\n\u003ch2\u003eAbout the Project :\u003c/h2\u003e\n\u003cp\u003eIn this Python Project, I had used Deep Learning to accurately identify the gender and age of a person from a single image of a face. I used the models trained by \u003ca href=\"https://talhassner.github.io/home/projects/Adience/Adience-data.html\"\u003eTal Hassner and Gil Levi\u003c/a\u003e. The predicted gender may be one of ‘Male’ and ‘Female’, and the predicted age may be one of the following ranges- (0 – 2), (4 – 6), (8 – 12), (15 – 20), (25 – 32), (38 – 43), (48 – 53), (60 – 100) (8 nodes in the final softmax layer). It is very difficult to accurately guess an exact age from a single image because of factors like makeup, lighting, obstructions, and facial expressions. And so, I made this a classification problem instead of making it one of regression.\u003c/p\u003e\n\n\u003ch2\u003eDataset :\u003c/h2\u003e\n\u003cp\u003eFor this python project, I had used the Adience dataset; the dataset is available in the public domain and you can find it \u003ca href=\"https://www.kaggle.com/ttungl/adience-benchmark-gender-and-age-classification\"\u003ehere\u003c/a\u003e. This dataset serves as a benchmark for face photos and is inclusive of various real-world imaging conditions like noise, lighting, pose, and appearance. The images have been collected from Flickr albums and distributed under the Creative Commons (CC) license. It has a total of 26,580 photos of 2,284 subjects in eight age ranges (as mentioned above) and is about 1GB in size. The models I used had been trained on this dataset.\u003c/p\u003e\n\n\u003ch2\u003eAdditional Python Libraries Required :\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003eOpenCV\u003c/li\u003e\n  \n       pip install opencv-python\n\u003c/ul\u003e\n\u003cul\u003e\n \u003cli\u003eargparse\u003c/li\u003e\n  \n       pip install argparse\n\u003c/ul\u003e\n\n\u003ch2\u003eThe contents of this Project :\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003eopencv_face_detector.pbtxt\u003c/li\u003e\n  \u003cli\u003eopencv_face_detector_uint8.pb\u003c/li\u003e\n  \u003cli\u003eage_deploy.prototxt\u003c/li\u003e\n  \u003cli\u003eage_net.caffemodel\u003c/li\u003e\n  \u003cli\u003egender_deploy.prototxt\u003c/li\u003e\n  \u003cli\u003egender_net.caffemodel\u003c/li\u003e\n  \u003cli\u003ea few pictures to try the project on\u003c/li\u003e\n  \u003cli\u003edetect.py\u003c/li\u003e\n \u003c/ul\u003e\n \u003cp\u003eFor face detection, we have a .pb file- this is a protobuf file (protocol buffer); it holds the graph definition and the trained weights of the model. We can use this to run the trained model. And while a .pb file holds the protobuf in binary format, one with the .pbtxt extension holds it in text format. These are TensorFlow files. For age and gender, the .prototxt files describe the network configuration and the .caffemodel file defines the internal states of the parameters of the layers.\u003c/p\u003e\n \n \u003ch2\u003eUsage :\u003c/h2\u003e\n \u003cul\u003e\n  \u003cli\u003eDownload my Repository\u003c/li\u003e\n  \u003cli\u003eOpen your Command Prompt or Terminal and change directory to the folder where all the files are present.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eDetecting Gender and Age of face in Image\u003c/b\u003e Use Command :\u003c/li\u003e\n  \n      python detect.py --image \u003cimage_name\u003e\n\u003c/ul\u003e\n  \u003cp\u003e\u003cb\u003eNote: \u003c/b\u003eThe Image should be present in same folder where all the files are present\u003c/p\u003e \n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eDetecting Gender and Age of face through webcam\u003c/b\u003e Use Command :\u003c/li\u003e\n  \n      python detect.py\n\u003c/ul\u003e\n\u003cul\u003e\n  \u003cli\u003ePress \u003cb\u003eCtrl + C\u003c/b\u003e to stop the program execution.\u003c/li\u003e\n\u003c/ul\u003e\n\n# Working:\n[![Watch the video](https://img.youtube.com/vi/ReeccRD21EU/0.jpg)](https://youtu.be/ReeccRD21EU)\n\n\u003ch2\u003eExamples :\u003c/h2\u003e\n\u003cp\u003e\u003cb\u003eNOTE:- I downloaded the images from Google,if you have any query or problem i can remove them, i just used it for Educational purpose.\u003c/b\u003e\u003c/p\u003e\n\n    \u003epython detect.py --image girl1.jpg\n    Gender: Female\n    Age: 25-32 years\n    \n\u003cimg src=\"Example/Detecting age and gender girl1.png\"\u003e\n\n    \u003epython detect.py --image girl2.jpg\n    Gender: Female\n    Age: 8-12 years\n    \n\u003cimg src=\"Example/Detecting age and gender girl2.png\"\u003e\n\n    \u003epython detect.py --image kid1.jpg\n    Gender: Male\n    Age: 4-6 years    \n    \n\u003cimg src=\"Example/Detecting age and gender kid1.png\"\u003e\n\n    \u003epython detect.py --image kid2.jpg\n    Gender: Female\n    Age: 4-6 years  \n    \n\u003cimg src=\"Example/Detecting age and gender kid2.png\"\u003e\n\n    \u003epython detect.py --image man1.jpg\n    Gender: Male\n    Age: 38-43 years\n    \n\u003cimg src=\"Example/Detecting age and gender man1.png\"\u003e\n\n    \u003epython detect.py --image man2.jpg\n    Gender: Male\n    Age: 25-32 years\n    \n\u003cimg src=\"Example/Detecting age and gender man2.png\"\u003e\n\n    \u003epython detect.py --image woman1.jpg\n    Gender: Female\n    Age: 38-43 years\n    \n\u003cimg src=\"Example/Detecting age and gender woman1.png\"\u003e\n              \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmahesh29%2Fgender-and-age-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmahesh29%2Fgender-and-age-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmahesh29%2Fgender-and-age-detection/lists"}