skip to content
Blog by Hafid
Table of Contents

For my thesis project, I decided to build something around a topic I had been interested in for a while: machine learning. The project was an application for detecting apple leaf diseases using a Convolutional Neural Network.

Beyond Just Making the Model Work

At first, I mainly focused on getting the model to work. But as I worked on it, I became more interested in what happened behind the model. I started experimenting with the architecture, customizing some of the layers, and trying different training configurations to see how much they could affect the results.

So the project became more than just training a model once and putting it into an application. There was quite a bit of experimenting and tweaking along the way.

Comparing Optimizers

I also compared several optimizers, including Lion, AdamW, and Adam. I wanted to understand how each optimizer behaved during training and which configuration worked better for my dataset.

Building an Offline-First Mobile App

For the mobile application, I used Kotlin with Jetpack Compose. One of the things I cared about from the beginning was making the application work offline. I didn’t want every prediction to depend on a backend server or an internet connection.

That requirement also affected the model I chose. I needed something lightweight enough to run directly on a phone, so I went with MobileNetV2 as the base model. It gave me a good starting point for building a model that could run on mobile devices without requiring too much computation.

From Training to TensorFlow Lite

After training and experimenting with the model, I exported it to TensorFlow Lite and integrated it into the Android application.

The final flow was pretty simple. Users could take a photo of an apple leaf or select one from their gallery, and the application would run the model directly on the device and return the prediction.

What I Learned

What I found interesting about this project was that it wasn’t just about training a machine learning model. I had to think about the whole process, from the dataset and model architecture to optimization, model conversion, and finally getting the model to actually run inside a mobile application.

It was a good experience for me because I got to work on both sides of the project. I could experiment with AI/ML during development, while also dealing with the practical problems that come with deploying a model into a real application.