Deploying MobileNet With TensorFlow.js and Flask


This project guides you through creating a web application using Flask and TensorFlow.js to classify images with a pre-trained MobileNetV2 model, directly in the browser. Learn to convert the model, set up the server, and implement in-browser preprocessing and classification, culminating in a seamless image classification web app.

CSSHTMLPythonLinuxFlaskJavaScriptMachine Learning


This project guides you through the process of deploying a pre-trained MobileNetV2 model using TensorFlow.js within a Flask web application. MobileNetV2 is a lightweight deep neural network used primarily for image classification. TensorFlow.js enables running machine learning models directly in the browser, allowing for interactive web applications. Flask, a Python web framework, will serve as the backend to host our application. By the end of this project, you will have a running web application that classifies images on the fly using the MobileNetV2 model.

👀 Preview

🎯 Tasks

In this project, you will learn:

  • How to export a pre-trained MobileNetV2 model from Keras to a TensorFlow.js compatible format.
  • How to create a simple Flask application to serve your web content and model.
  • How to design an HTML page to upload and display images for classification.
  • How to use TensorFlow.js to load the exported model in the browser.
  • How to preprocess images in the browser to match the input requirements of MobileNetV2.
  • How to run the model in the browser to classify images and display the results.

🏆 Achievements

After completing this project, you will be able to:

  • Convert a pre-trained Keras model into a format that can be used with TensorFlow.js, enabling ML models to run in the browser.
  • Set up a Flask application and serve HTML content and static files.
  • Integrate TensorFlow.js into a web application to perform machine learning tasks client-side.
  • Preprocess images in JavaScript to make them compatible with the input requirements of deep learning models.
  • Make predictions using a deep learning model in the browser and display the results dynamically on the web page.




Labby is the LabEx teacher.