The objective of this project was to identify a problem to work on and implement MLOps techniques to build an end-to-end solution, from model training to deployment. 🚀
It is important to note that this project is primarily an MLOps project rather than a model performance-driven study. The emphasis is on:
- Data collection and structuring
- Experiment Tracking with MLflow
- Model training pipeline automation
- Deployment and reproducibility
Accuracy, metrics, and model performance optimization were not the main objectives. Instead, the goal was to explore workflow automation.
Topic: Computer Vision
Field of Application: Healthcare
Use Case Description : After exploring various datasets online for this project, We decided to cross-reference different data sources to address the following research question:
How can we determine whether an MRI scan provides evidence of a specific disease?
The goal is to implement this pipeline:
-
Part 1: Aside from the resources collected from Kaggle, which were loaded locally as demonstrated in the notebook, the ideal solution would involve automating this part with Airflow, especially if we had access to a resource that gets updated regularly. In our case, we didn't automate it, but we still uploaded the data to AWS.
-
Part 2: Once the data was collected, we cleaned and processed it to make it suitable for the model. We used MLflow to track different executions and register the best model.
-
Part 3: We created an API using the FastAPI framework and connected it to the interface developed with Gradio.
We conducted experiments on model training and tracking using MLflow. We had two key experiments: the first focused on fine-tuning hyperparameters, and the second was dedicated to selecting and registering the best model.
In the first experiment, we explored hyperparameter tuning to optimize the model's performance. Below is a visual representation of the results:
The following chart compares the performance of different models during the experimentation process:
In the second experiment, we selected the final model based on the best performance and registered it for future use. Below is a representation of the registered model in this experiment:
For inference, we ensured that the latest registered model is used. If the MLflow runs are empty, we create a separate file to load the model from Google Drive.
We used Gradio to develop a simple UI that accepts an image, scans it, and makes a prediction using our model. We also incorporated model interpretability with the LIME library.
Below is a representation of our interface:
And here is an example in action:
git clone git@github.com:Biline-dev/MLops_Project.git
cd MLops_Projectdocker-compose up # Builds and runs the backend and frontend containersOR
Follow these steps to manually set up the environment for both the backend and frontend without Docker.
You'll need to run the backend and frontend separately.
cd backend/
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython main.pyOpen a second terminal and run:
cd frontend/
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython interface.py- Building the images or installing dependencies may take some time.
- We couldn't upload the model to GitHub or deploy MLflow to retrieve the latest registered model as we did locally.
- Instead, the model will be downloaded from Google Drive, which might take a few minutes.
Once the setup is complete, open your browser and go to:
This will allow you to test the app. 🚀
The next steps will involve testing the orchestration part, implementing monitoring, and enabling deployments across providers like AWS or GCP—something we couldn't complete due to time and resources constraints.