Food Classification using Convolutional Neural Network (CNN) and deployed using TensorFlow Serving.
Notebook: MamMates Food Classification
Dataset: MamMates Dataset
Using Mammates Food Classification, you can categorize food images into 10 classes.
Class | Label |
---|---|
0 | bika_ambon |
1 | dadar_gulung |
2 | donat |
3 | kue_cubit |
4 | kue_klepon |
5 | kue_lapis |
6 | kue_lumpur |
7 | kue_risoles |
8 | putu_ayu |
9 | roti |
- TensorFlow 2.14.0 or higher
- Docker 24.0.7 or higher
If you already have Docker installed, you only need to run the following command:
- Pull the image from Docker Hub:
docker pull putuwaw/mammates-food-classification
- Run the image:
docker run -p 8501:8501 --name ml-clf putuwaw/mammates-food-classification
-
You can check that the model is already running by opening the browser and go to http://localhost:8501/v1/models/food_clf
-
To do prediction, you can use the following command:
curl -s https://raw.githubusercontent.com/MamMates/ml-food-classification/main/example.json | curl -X POST -d @- http://localhost:8501/v1/models/food_clf:predict
- You will get the following response:
{
"predictions": [
[
6.28405522e-11, 7.40732e-6, 0.998946607, 1.49191326e-8, 0.000139753625,
2.86315444e-5, 0.000863699941, 6.22894277e-7, 1.15933371e-5, 1.64414064e-6
]
]
}
If you want to develop this model, you can follow the steps below:
- Clone this repository:
git clone https://github.com/MamMates/ml-food-classification.git
-
Update the model by changing the saved model in the model folder.
-
Build the Docker image:
docker build -t mammates-food-classification .
- Run the image:
docker run -p 8501:8501 --name ml-clf mammates-food-classification
-
You can check that the model is already running by opening browser and go to http://localhost:8501/v1/models/food_clf
-
To do prediction, you can use the following command:
curl -d @example.json -X POST http://localhost:8501/v1/models/food_clf:predict
- To stop the container:
docker stop ml-clf
Note
If you want to learn more about TensorFlow Serving, you can read the REST API documentation here.
Our sincere gratitude goes to the creators and maintainers of these datasets. Their generosity in sharing these resources has been instrumental in driving the progress and success of this project.
- Deteksi Makanan Daerah Dataset
- Indonesian Food Dataset
- Food 101 Dataset
- Food-5K Dataset
- Food-11 Dataset
This project is licensed under the MIT License. See the LICENSE file for details.