An innovative AI project for NextSapien, focusing on advanced facial analysis. This repository contains scripts and methodologies for gender identification, face rating, and comprehensive demographic insights using AI and computer vision techniques. The project showcases a unique blend of analytical rigor and creative problem-solving, aligning with NextSapien's ethos of pushing the boundaries in AI/ML applications.
- Developed a unique face rating system, integrating 40 facial attributes with a focus on Facial Symmetry, Skin Texture, and Expression Analysis.
- Successfully integrated the DeepFace framework for comprehensive demographic analysis, enhancing the depth of facial analysis.
- Overcame technical challenges, including the incompatibility with mxnet library, by switching to facenet for facial attribute extraction.
This project employs advanced algorithms for face detection and attribute recognition, demonstrating a deep level of analysis. The unique face rating system, a highlight of this project, exemplifies creativity and problem-solving skills. It rates faces on a scale of 1-10, considering various attributes like facial symmetry, skin texture, and expression analysis. These technical feats not only meet but set new standards in AI/ML applications, reflecting NextSapien's commitment to pioneering new frontiers in technology.
pre-trained_weights/
: Contains pre-trained model weights.screening_face_rating.py
: Core script for face rating and gender analysis.screening_deepface.py
: Alternative Script for advanced facial analysis using DeepFace library.dataset/
: Input images for processing.output/
: Stores processed images and analysis reports.demo.png
: Screenshot of expected output image.
This script leverages the DeepFace library, a comprehensive face recognition and facial attribute analysis framework. DeepFace is a hybrid framework wrapping state-of-the-art models like VGG-Face, Google FaceNet, OpenFace, Facebook DeepFace, DeepID, ArcFace, Dlib, and SFace. It simplifies complex processes in face recognition, including detection, alignment, normalization, representation, and verification. The library offers functionalities for face verification, recognition, embedding generation, and supports multiple face recognition models and similarity metrics. It also provides robust facial attribute analysis, including age, gender, emotion, and race predictions.
This script utilizes the Facial Attribute Recognition library, which is a Keras implementation for facial attribute recognition. The library is trained on the CelebFaces Attributes (CelebA) Dataset and supports models like Visual Transformer and FaceNet for facial attribute extraction. It offers precise facial attribute extraction, providing insights into various features such as age, gender, hair length, and more. The library is designed for both image processing and real-time video applications, enhancing them with accurate and comprehensive facial attribute analysis.
- Pre-trained Model: Automatically downloaded when running
screening_face_rating.py
alternatively, download from Google Drive Link and place it insidepre-trained_weights
folder.
- Install Dependencies:
pip install -r requirements.txt
. - Prepare Data: Place images in
dataset/
. - Execute: Run
python screening_face_rating.py
orpython screening_deepface.py
. - Results: Check
output/
for images and reports.
- Initial Challenge: The task was to rate faces on a 1-10 scale with a goal of 90% accuracy, a challenging objective considering the subjective nature of facial aesthetics.
- Research and Analysis: Extensive research was conducted on various facial attributes that could be quantitatively analyzed. This included studying facial symmetry, skin texture, expression analysis, and eye clarity, among others.
- Attribute Selection and Grouping: Based on research, 40 facial attributes were identified. These attributes were then grouped according to the nodes specified by NextSapien: Facial Symmetry, Skin Texture, Facial Proportions, Expression Analysis, and Eye Clarity. Some attributes, while present, did not align directly with these nodes but could become relevant in future tasks with additional nodes.
- Weight Assignment: Each attribute was assigned a weight based on its perceived impact on overall facial aesthetics. This step involved iterative testing and refinement to align the system with the project's accuracy goals.
- Integration with AI Models: The selected attributes were then integrated with AI models capable of detecting these features in facial images. This integration was key to automating the face rating process.
- Sample Calculation: For a face detected with 'High_Cheekbones' (0.4), 'Smiling' (0.5), and 'Big_Nose' (-0.2), the initial score of 5 would be adjusted as follows: 5 + 0.4 (High_Cheekbones) + 0.5 (Smiling) - 0.2 (Big_Nose) = 5.7. This score is then normalized to ensure it falls within the 1-10 range.
- Threshold Adjustment: To improve accuracy, the threshold for attribute detection was carefully adjusted. This ensured that only the most prominent features were considered in the rating, reducing the likelihood of false positives.
- Continuous Refinement: The system underwent continuous refinement, incorporating feedback and results from multiple test iterations. This iterative process was vital in fine-tuning the methodology to meet the desired accuracy levels.
- Innovative Solution: The developed face rating system is a testament to innovative thinking and technical proficiency. It stands as a unique solution in the realm of AI-driven facial analysis.
- Alignment with NextSapien's Vision: This methodology aligns with NextSapien's vision for pioneering new AI applications, demonstrating the potential for AI to venture into areas that require a blend of quantitative analysis and creative thinking.
- Incompatibility with mxnet library: Switched to facenet for facial attribute extraction.
- Objective Face Rating System: Developed a subjective system, emphasizing continuous refinement.
- Accuracy Improvement: Adjusted the threshold for attribute detection to enhance accuracy.
- Finalizing project for submission.
- Uploaded files to GitHub and Google Drive.
- Added
demo.png
to showcase expected output.
- View Image Post-Processing: Implement functionality to view images immediately after processing.
- Bias Mitigation: Address the current bias towards female faces in the rating system.
- Height Detection: Integrate height detection into the script.
- CelebA Dataset Testing: Test models on the CelebA dataset for broader validation.
- Additional Attributes: Incorporate more attributes from other nodes, particularly for height and age analysis.
- Age and Height Determination: Focus on task 2, which involves determining age (already achievable with DeepFace) and integrating a model for height detection.
- Day 1 (2023-11-10): Received the assignment, emphasizing the importance of advanced human face detection in AI/ML, a key area for NextSapien.
- Day 2 (2023-11-11): Researched acclaimed models for gender identification, aligning with NextSapien's focus on cutting-edge AI solutions.
- Day 3-4 (2023-11-12 to 2023-11-13): Overcame dependency issues by integrating Deep
Face, showcasing adaptability and technical skill, crucial for NextSapien's dynamic AI projects.
- Day 5 (2023-11-14): Explored face rating models, addressing NextSapien's requirement for innovative approaches in AI/ML.
- Day 6-7 (2023-11-15 to 2023-11-16): Focused on gender identification and integrated YOLOv5, demonstrating proficiency in utilizing advanced AI tools, a core requirement for NextSapien.
- Day 8-9 (2023-11-17 to 2023-11-18): Developed a unique face rating system, reflecting creativity and problem-solving skills, aligning with NextSapien's ethos of innovation in AI.
- Day 10-16 (2023-11-19 to 2023-11-25): Explored additional attribute detection and refined scripts, showcasing the ability to enhance AI models, crucial for NextSapien's evolving projects.
- Day 17-20 (2023-11-26 to 2023-11-29): Successfully integrated a comprehensive facial attributes analysis system, demonstrating the capability to merge different AI technologies, a skill highly valued at NextSapien.
- Day 21-23 (2023-11-30 to 2023-12-02): Refined the face rating system and finalized the project, showcasing a commitment to delivering high-quality, innovative AI solutions, in line with NextSapien's mission.
Gratitude to NextSapien for inspiring this project and to the developers of the tools and libraries used.
[email protected] | GitHub | LinkedIn
Under MIT License - LICENSE.md.
This project has been a journey of growth in AI and computer vision, aligning with my professional aspirations and NextSapien's innovative goals. I look forward to contributing to NextSapien's vision and being part of a team that transforms the technological landscape.