Microsoft has released a tool called Lobe. This tool makes it very easy to create machine learning models for image classification.
Two models, "ResNet-50 V2" and "MobileNet V2", can be used for Lobe image classification. Each model has its own characteristics, and it is necessary to use them properly according to the purpose and execution environment.
High prediction accuracy can be achieved with ResNet-50 V2, but the prediction time is longer and more memory is used. MobileNetV2 has a fast prediction speed and low memory usage, but the prediction accuracy is not high.
Use ResNet-50 V2 when high accuracy is required in an environment with a certain amount of machine power. I think that MobileNet V2 will be used for smartphones and Raspberry Pi.
Regardless of which model you use, you can train better with less data by using transfer learning.
This time, I would like to write a procedure to learn the image classification model using the dog / cat images published on kaggle. ResNet-50 V2 is used as the base model.
You can download it from the official page below Lobe
This time we will use the data published on kaggle. Dogs vs. Cats
Launch Lobe and select New Project.
Set the base model before you start learning. Select [File]-[Project Settings]-[Optimize for Accuracy]
Click Import in the upper right and select Images.
First, load the cat image from the learning data downloaded from kaggle.
Label the loaded image. At this time, if you select all the images (command + A on mac), you can attach Lbel at once.
Next, read the dog image in the same way and attach the label.
Training will start automatically when you load two types of images.
After training, click Play and drag and drop the test image to load the prediction result.
If the correct answer prediction of the loaded image is incorrect, click the location shown in the image below to correct the Label and train again.
In this way, you can create a model of image classification very easily. Instead of importing the image, you can also capture and use the image from the webc camera.
In the official video below, we take several images with a webcam and create a model that identifies "Drinking" and "not Drinking" based on them.
Introducing Lobe | Build your first machine learning model in ten minutes.
In Lobe, the learned model can be exported and used in CoreML and TensorFlow. See the article below for how to export a model and use it in Python. How to use the model learned in Lobe in Python
I made a REST API in combination with TensorFlow Serving. Create a REST API using the model learned in Lobe and TensorFlow Serving.
Recommended Posts