In the following demo we will demonstrate how to use MLRun to create a mask detection app. We'll train a model that classifies an image of a person as wearing a mask or not, and serve it to an HTTP endpoint.
- Either TF.Keras or PyTorch to train and evaluate the model
- Horovod to run distributed training
- ONNX to optimize and accelerate the model's performance
- Nuclio to create a high-performance serverless Serving function
- MLRun to orchestrate the process
- The model is trained on a dataset containing images of people with or without masks. The data used was taken from Prajna Bhandary, github link.
- The training code is taken from Adrian Rosebrock, COVID-19: Face Mask Detector with OpenCV, Keras/TensorFlow, and Deep Learning, PyImageSearch, page link, accessed on 29 June 2021.
The demo is split among 3 notebooks and it is important to run them sequentially as each relies on the previous one:
-
Training and Evaluation - Build the mask detection model and run training and evaluation with MLRun's deep learning auto-logging and distributed training (using Horovod).
-
Serving - Serve the model we trained as an HTTP endpoint, demonstrating a serving graph where we preprocess the images before and after, inferring them through the model:
- Automatic Pipeline - Build an automatic pipeline, using the MLRun functions from notebooks 1 and 2 with an additional step: optimizing (using ONNX).
We hope you enjoy using MLRun!