TFLite Deployment on iOS and Android

Hello everyone! Welcome to my new web site.

I’ve decided to create this web site where I can share my experiences as a Data Engineering Student for Artificial Intelligence here in France, and somehow incorporate my artworks in most (or maybe just some) of my posts. Although, how I will do that, I am not quite sure yet.

For starters, a week ago, I met with friends for our monthly watercolor painting session. It was also a birthday celebration of one of our artist friends. During this time, I took the opportunity to test the mobile phone application I was working on to try and deploy it on one of my friends’ Android phone. I do not have any Android device (boo!) at home. I was only able to test it with iPhones. My application, btw, is a Face Detection app using Tensorflow. There is a sample iOS and Android application on Github for this app. I have actually just downloaded, deployed it, and replaced the model and labels with our own. FYI, this is for our Python Machine Learning Lab‘s team project due in June, which our team has been working on since November last year.

Testing the app on my friends

Of course, it did not work out-of-the-box, like a plug-and-play thing. I had to tweak some configurations and make some minor changes on the codes to do this. For context, I never had any experience working on mobile applications. I had no prior experience on XCode, SwiftUI, Android Studio, and all that jazz. Although, SwiftUI very scarily reminded me of my early days programming in Unix C due to its syntax. Ugh, pointers!..

I managed to learn to understand what’s going on in the SwiftUI Code, create a sample application other than the Tensorflow App to familiarize myself with it, and finally build and deploy the application on several iPhones after a couple of weeks (minus the daily 5 hours I spend on my week-day classes). So, it’s not really that difficult, if you’re coming from Java, like myself. But don’t follow my example, I almost had a breakdown after trying to do all this in such a short span of time. Don’t forget to rest and drink water from time to time… and of course, sleep.

Oh, and also, a word of warning, Apple makes it super difficult to deploy mobile apps on other people’s phones. I had to sign up for a Developer Account, register ALL the iOS devices’ respective UDID‘s in my account (you have to have iTunes just to get this UDID), and I didn’t see any other option to very quickly install it over the browser (by browser I meant ONLY Safari, of course) except via installonair.com. Please comment, if you know of any other way.

As for the Android app, it was such a breeze to install on my friend’s phone. I just uploaded it on Google Drive. And then, the Android phone has to be configured to enable installing apps from Google Drive and / or Chrome. And that was it! Wow! Okay.

Although, I have yet to update the model and labels in the Android deployment. I have only tested the installation of the Tensorflow Object Detection app as it is on Github. I have not had much time working on the project lately, as I had been working on another individual project (Shiny App for R), which was quite a handful as well. More on this later, though.

Also, prior to the TFLITE conversion (from Python-generated model), I have also converted it to TFJS, and deployed it on react.js on Heroku: https://diversity-face-detection.herokuapp.com/ . This deployment was quite slow, though, and was definitely NOT the way to go as far as our project is concerned. But it was a good experience for me, flexing my new knowledge on CI/CD deployment via Github Workflow Actions from our recent DevOps class. Also, more on this later.

If you enjoy reading this, or interested to know more. Let me know in the comments and I can write a more detailed blog on this next time.

Thanks for dropping by.

P. S. My face app doodle feature image at the top of this page was done on Procreate following this Youtube tutorial. 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: