- Saved searches
- Use saved searches to filter your results more quickly
- KeplerInCoding/Age-and-Gender-Detection
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Face Age & Gender detection tool
- How
- TODO:
- Tests
- Dependencies
- Model
- License
- Определяем возраст и пол человека используя нейронную сеть
- Модель для определения формы лица (shape_predictor_5_face_landmarks.dat)
- Модель для предсказывания возраста (dnn_age_predictor_v1.dat)
- Модель для определения пола человека по лицу (dnn_gender_classifier_v1.dat)
- Перенос C++ кода на Python
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
KeplerInCoding/Age-and-Gender-Detection
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
To build a gender and age detector that can approximately guess the gender and age of the person (face) in a picture or through webcam.
In this Python Project, we had used Deep Learning to accurately identify the gender and age of a person from a single image of a face.We used the models trained by Tal Hassner and Gil Levi. 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, we further made an extension which can be used with various systems to provide additional features
For this python project, we had used the Adience dataset; the dataset is available in the public domain and you can find it here. 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 we used had been trained on this dataset.
Additional Python Libraries Required :
The contents of this Project :
- opencv_face_detector.pbtxt
- opencv_face_detector_uint8.pb
- age_deploy.prototxt
- age_net.caffemodel
- gender_deploy.prototxt
- gender_net.caffemodel
- a few pictures to try the project on
- gad.py
For 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.
NOTE:- Reference images are from Google,if you have any query or problem we can remove them.
>python gad.py --image Detecting age and gender girl1.png Gender: Female Age: 25-32 years
>python gad.py --image Detecting age and gender girl2.png Gender: Female Age: 8-12 years
>python gad.py --image Detecting age and gender kid1.png Gender: Male Age: 4-6 years
>python gad.py --image Detecting age and gender kid2.png Gender: Female Age: 4-6 years
>python gad.py --image Detecting age and gender man1.png Gender: Male Age: 38-43 years
>python gad.py --image Detecting age and gender man2.png Gender: Male Age: 25-32 years
>python gad.py --image Detecting age and gender woman1.png Gender: Female Age: 38-43 years
NOTE:- Our website which will provide link to download the extension, is still in progress. We’ll keep updating to the contents of this Repository, and thank you for your time.
Face Age & Gender detection tool
Simple opencv & tensorflow solution to estimate Age and Gender in your next project. Command line or Python DIY style.
Good enough for pet-projects and prototypes, but not ready for production real-life applications
How
pip3 install py-agender[cpu] # for the cpu version of TensorFlow pip3 install py-agender[gpu] # for the gpu version of TensorFlow
Warning: ~190MB download (pretrained network is heavy).
Don’t forget to download pretrained weights if using source code DIY style.
TODO:
- add options (like STDIN input, output formatters etc.) for useful commandline applications
- add help output
- train better network with higher image resolution
- train another (more compact & precise) network architecture
Tests
Dependencies
- Python 3.5, 3.6, 3.7
- numpy ~> 1.15
- Keras ~> 2.2
- tensorflow or tensorflow-gpu ~> 1.10
- opencv-python ~> 3.4.2+contrib
Model
These weigts are from https://github.com/yu4u/age-gender-estimation on first console version run they are cached in ./pyagender.pretrained_models folder:
License
This project is released under the MIT license.
However, the IMDB-Wiki dataset used for pretrained network above is originally provided under the following conditions:
Please notice that this dataset is made available for academic research purpose only. All the images are collected from the Internet, and the copyright belongs to the original owners. If any of the images belongs to you and you would like it removed, please kindly inform us, we will remove it from our dataset immediately.
Refer to fresh IMDB-Wiki dataset License and act accordingly.
Определяем возраст и пол человека используя нейронную сеть
У нас была задача отсортировать профили людей по возрасту и полу. Нам нужно было сегментировать базу потенциальных клиентов для запуска тестовых рекламных компаний, для каждой рекламной компании мы подбирали индивидуальные видео которые лучше всего подошли бы людям определенного возраста и пола.
Если вам интересны такие темы и вы хотите и дальше видеть новые публикации и развитие данного модуля, то просим вас поставить нам звездочку ⭐ на Github!
Ссылка на модуль: https://github.com/mowshon/age-and-gender
После анализа доступных библиотек, мы нашли интересный репозиторий на Github: https://github.com/davisking/dlib-models
Автор Davis E. King @davisking, он же создатель замечательной библиотеки dlib, предоставил уже натренированную модель на несколько тысяч лиц людей. Но, вот беда… код написан на C++ а рабочей альтернативы на Python мы не нашли.
Модель для определения формы лица (shape_predictor_5_face_landmarks.dat)
Это 5-точечная модель, которая определяет уголки глаз и дно носа. Она обучена на наборе данных из 5-точечных ориентиров от 7198 лиц людей. Автор @davisking создал этот набор данных, загружая изображения из Интернета и комментируя их с помощью инструмента imglab от dlib.
Модель для предсказывания возраста (dnn_age_predictor_v1.dat)
Первоначальный источник для создания модели пришел из документа Z. Qawaqneh: «Глубокая сверточная нейронная сеть для оценки возраста на основе модели VGG-Face». Тем не менее, наши исследования привели нас к значительным улучшениям в CNN модели, что позволило нам оценить возраст человека, превосходящего существующие результаты, с точки зрения точности результата.
Есть вопросы по Python?
На нашем форуме вы можете задать любой вопрос и получить ответ от всего нашего сообщества!
Telegram Чат & Канал
Вступите в наш дружный чат по Python и начните общение с единомышленниками! Станьте частью большого сообщества!
Одно из самых больших сообществ по Python в социальной сети ВК. Видео уроки и книги для вас!
Таким образом, эта модель является определителем возраста, использующим архитектуру ResNet-10, и обучается с использованием частного набора данных из примерно 110 тыс. различных изображений людей с комментарием в виде их возраста.
Эта модель прогнозирования возраста предоставляется компанией Cydral Technology бесплатно и распространяется по лицензии Creative Commons Zero v1.0 Universal.
Модель для определения пола человека по лицу (dnn_gender_classifier_v1.dat)
Эта модель является гендерным классификатором, обученным с использованием частного набора данных из примерно 200 000 различных изображений лиц, и она была сгенерирована в соответствии с определением сети и настройками, заданными в «Минималистической модели на основе CNN для прогнозирования пола по изображениям лиц«. Даже если набор данных, использованный для обучения, отличается от того, который использовался Г. Антиповым, результаты классификации по оценке LFW в целом схожи (± 97,3%).
Эта гендерная модель предоставляется бесплатно компанией Cydral Technology и распространяется по лицензии Creative Commons Zero v1.0 Universal.
Перенос C++ кода на Python
Изначально, @davisking предоставил два C++ файла которые показывали как работать с натренированными им моделями:
Они выводили результат сразу в консоль, но вот использовать код в рабочем проекте даже на C++ было крайне неудобно. Используя pybind11 мы имеем возможность применить код на C++ в нашем коде на Python. Мы не будем акцентироваться долго на pybind11, но если вы хотите ознакомиться с ним, то рекомендуем статью: Создаем С++ Python расширения с помощью pybind11