The Dish Classifier model is designed to identify food in an image. It’s based on the MobileNet model, a general-purpose object detection model.
Already included in the SD card image
Demo: What’s on my plate?
Time: 15 minutes
What you’ll need
- Assembled Vision Kit
- Connection to your device
Your Vision Kit doesn’t eat, but it’s pretty good at guessing what’s on your plate. This project uses machine learning to turn your Vision Kit into a food detector: send an image to the demo and it’ll try to guess the food in the image.
Step 1: Get connected
First, make sure you’re connected to your device and have a terminal open. Otherwise you can’t tell your kit to start identifying food.
Step 2: Stop your current demo
Your Vision Kit may already have another demo running, like the Smile Detector which runs by default when your kit is turned on. You’ll need to turn off any demos that are currently running. To do that, press Control-C.
Step 3: Find an image
Before you can try out the demo, you need an image that the model can look at. Learn how you can use an online image.
Step 4: Run command
Enter the following command into your terminal application:
~/AIY-projects-python/src/examples/vision/dish_classifier.py --input <input image>
If you ran into an error, check Help.
Try it out
After you enter the command, the food detector application will look at the image. The model will take a guess at the food and give you an answer on your terminal screen. Try to stump the kit by using different kinds of images. Here’s some more ideas:
- Try foods like fruits or vegetables. Then try a food like cereal. Which one works better?
- Try one object, like one apple, then a whole bunch. Is the kit still right?
When you’re done with the demo, remember to stop it before trying another demo by pressing Control-C.
Finding an image to use with your model
You can find an image online using the Wget program. When you have an image in mind, here’s how to use it:
- Make sure you’re connected to your kit via SSH or through peripherals and have a terminal window open
- Make sure you also have the image’s URL available
- In your terminal, enter: wget
- For example: wget https://www.example.com/example.jpg
- The file will be downloaded to the current directory