In this blog, we are going to discuss yet another mini-project for novice AI explorers. A gender detection model, as basic as it might appear, might just be exactly what we need in the 21st century where everybody seems confu- nope. Not getting cancelled already. Anyway.
A gender detection model is a simple classifier model built over any existing face detection module. It has a wide variety of uses like identity conformation, and forensics. Like most models, the mediapipe gender detection model is trained to identify the two biological genders – male and female – from the output of an independently operating face detection model . Let’s see how this classification is done by understanding the model architecture, as well as its deployment on Flo Edge One and its inferences.
Before we get into that, let’s take a quick look at the Flo Edge One,
a must-have in every AI and robotics engineer’s toolbox. Here are some
remarkable benchmarks that make it a top competitor in edge devices!
- Pre-installed with Ubuntu 22.04 and tools like ROS2, OpenCV, TFlite, etc.
- Qualcomm Adreno 630 GPU.
- 12 MP 4k camera at up to 30fps.
- Inferencing both models simultaneously at 43 milliseconds producing a smooth output of around 30 fps.
The model stack used here contains 2 models – a face detection model and a gender classification model. The face detection model is a very simple OpenCV Haar cascades model while the gender classification model is a readily available mediapipe model.
Like we saw in the age detection blog, the face detection model in this stack is replaceable as well. Haar cascades model is preferred for this use case because it is light and simple and this model does not require high accuracy in face detection.
Dataset and Model:
The use of Haar cascades for face detection has been described elaborately here. In breif, Haar cascade uses several different moving windows all across the image to capture features. The regions that contain majority of the features that make up a face are bounded by a box. This region is the face of a person, a.k.a., our region of interest.
Once we obtain our region of interest in the image, i.e., the face, A
basic classification model with 2 class labels is used for gender detection – Male and Female.
The classification model was trained on over 30,000 images of people labelled man or woman. This mediapipe classification model has an accuracy of around 97% but it is susceptible to scenarios like cross dressing, men with longer hair, women with sort hair, etc.
Another alternative to running this model efficiently is using the Flo Edge One GPU! What is Flo Edge One you ask? This impressive device boasts a light GPU that can deliver smooth results, all while maintaining a high level of accuracy. The Flo Edge One is truly a remarkable device, providing a plethora of impressive features that make it a must-have for tech enthusiasts. With its onboard camera, inbuilt IMU, and GNSS capabilities, this device truly has it all. It comes pre-installed with Ubuntu 22.04, ROS2, OpenCV, and various other tools, making it the perfect choice for your robotics ventures. The best part? Amidst the semiconductor crisis, the Flo Edge One is affordable and ready to ship! So you can get started ASAP, without breaking the bank.
Starting a new venture and wanna figure out what your target audience might be? Using the 12MP camera on your Flo Edge One, run the gender detection model real-time to and understand what gender groups your products appeal to.
The invoking time of this model was a mere 13 + 30 milliseconds on the Flo Edge One GPU. Here, invoking time can be interpreted as 13 milliseconds for the model to detect faces from the input image and 30 milliseconds for the model to classify all the faces into the two label classes. Overall, around 43 milliseconds is the inferencing time of this model stack along with a smooth output of 30 FPS.
This goes to show without a doubt, that haar cascades is a very light weight model. The only downside to this model as discussed in earlier blogs, is that it doesn’t yield accurate results since it relies on features like lines, edges, and orientation in input images to detect a face and similar features can be found in the background as well.
The Gender detection model yields incredibly accurate predictions when run on the Flo Edge GPU even after being compressed as a .tflite model architecture. Coupled with the 12 MP onboard camera a wide range of systems can be developed for use cases like surveillance, security, marketing and sales, and forensics.