Machine Vision: First Face Recognition App
On 18th March 2019, a senior colleague invited all coders in our organization to contribute to ongoing internal research centered on machine vision technologies. The stated goal of the research was to create a demo app that grants access to a secure resource, e.g. a protected homepage, based on facial recognition. Further, the app needed to be able to initially register a face, subsequently use the face to authenticate a user, and it should not be tricked by using a photograph.
At that time I was on my way to completing an online course on machine learning and data science using Python. A friend of mine who knew I was interested in AI encouraged me to take up the challenge. Well, I decided I was going to give it a try. Luckily, my ignorance in the field of AI was such that I could not even anticipate what difficulties I would face along the way. So I was kind of pumped up with a naive optimism that I could get it to work. Besides, I hoped that an old, know-it-all friend of mine, Google, could carry me through any obstacles.
I started by reaching out to the colleague and asked for an update on what had been learned, done, or tried thus far in the area of machine vision within the company. I did not want to redo work that had already been done nor walk directly into foreknown pitfalls. Unfortunately, not much had been done and I was directed to start from scratch.
As you may well imagine, it is not easy beginning from scratch when you are clueless. The first week was spent browsing innumerable web pages trying to bring together disjoint ideas and concepts. It is at this stage of the research that I decided I was not going to do the actual face recognition on the device itself. Back-end authentication of passwords makes life more difficult for hackers as opposed to on-device authentication. This seemed equally true for faces and it seemed wise to stick to conventional wisdom.
Slowly, the project started to take shape. Clearly, an app was needed that could detect and scan a face using the camera and forward that image to the backend for registration or verification. In the backend, I needed to be able to receive a face and other user data for registration. Subsequently, the backend should also be able to receive a face and authenticate it against an existing database of registered users.
Now, to authenticate a face, the image of the face is converted into faceprints. Simply put, faceprints are just numbers. The reason for converting to faceprints is that it is easier for a computer to meaningfully compare numbers to numbers than it is to compare pixels to pixels. Essentially, if a computer directly compared the pixels in one image of your face to the pixels in another image of your face, it might fail to match the two just because one image was taken at midday and another at dusk.
Therefore, I used an open-source AI model to convert face images to their corresponding faceprints. During registration, I store the submitted face’s prints in a database. Later, when a user tries to log in, I convert the face they are trying to log in with into faceprints. I then compare this against what I have in the database. If they match, I let the user proceed to log in to the app. As far as I can tell, no one has open-sourced the kind of complete, end-to-end solution that I was working on. And this is why it took over two months to get it to work I could not find any examples on Google. I had to pull ideas from many separate sources to get it to work like this.
Now, this is just the layman’s version of the process it took to complete Eclectic’s first face recognition project. I shall be writing a more technical series of articles that chronicle the journey from setting up a CentOS droplet on Digital Ocean and installing Nginx, MariaDB, Docker, TensorFlow, Python, TensorFlow Serving, etc. I shall also write an article on what was involved on the Android end of this project: configuring the NDK for OpenCV, working with Retrofit, Moshi, Timber, Nammu, and other really cute libraries.
In conclusion, amazing things are happening every day in tech. And the only way to keep up is to walk out to the frontline and start working with the latest technologies. When we do this, we may spend a lot of time on things, but then we also risk coming up with something no one else has before.
16 years experience in Tech, Pre-Sales, Products & Relationship management . Innovator, critical thinker & design thinking. Believer in Positive Team spirit and Attitude.
5 年Well done Sir, this is a powerful article
I am a Rockstar dynamic go-getter, a self-starter, passionate and highly motivated. An entrepreneur with a commercial acumen, intellectual curiosity, analytical, technical and professional skills, a team builder & player
5 年What a research and innovation. The last two paragraphs somehow took me to a tech roller coaster....
Aspiring PHD Candidate - AI
5 年Good stuff sir.