[PYTHON] I tried "Lobe" which can easily train the machine learning model published by Microsoft.

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.

Download Lobe

You can download it from the official page below Lobe

Prepare the data to be used for learning

This time we will use the data published on kaggle. Dogs vs. Cats

Learn model with Lobe

Launch Lobe and select New Project. スクリーンショット 2020-10-31 15.39.06.png

Set the base model before you start learning. Select [File]-[Project Settings]-[Optimize for Accuracy] スクリーンショット 2020-11-04 0.38.42.png

Click Import in the upper right and select Images. スクリーンショット 2020-10-31 15.41.58.png

First, load the cat image from the learning data downloaded from kaggle. スクリーンショット 2020-10-31 15.47.43.png

Label the loaded image. At this time, if you select all the images (command + A on mac), you can attach Lbel at once. スクリーンショット 2020-10-31 15.51.10.png

Next, read the dog image in the same way and attach the label. スクリーンショット 2020-10-31 15.53.54.png

Training will start automatically when you load two types of images. train_start.png

After training, click Play and drag and drop the test image to load the prediction result. スクリーンショット 2020-10-31 16.01.48.png

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. スクリーンショット 2020-10-31 16.07.08.png

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

I tried "Lobe" which can easily train the machine learning model published by Microsoft.
I tried calling the prediction API of the machine learning model from WordPress
I tried to visualize the model with the low-code machine learning library "PyCaret"
I tried to organize the evaluation indexes used in machine learning (regression model)
I tried to predict the presence or absence of snow by machine learning.
I tried to predict the change in snowfall for 2 years by machine learning
I tried to compress the image using machine learning
[Machine learning] I tried to summarize the theory of Adaboost
I tried to verify the yin and yang classification of Hololive members by machine learning
I tried Diagram as Code (Diagrams) which can manage the configuration diagram code
I tried using the trained model VGG16 of the deep learning library Keras
I tried using "Streamlit" which can do the Web only with Python
I tried to train the RWA (Recurrent Weighted Average) model in Keras
I tried to implement various methods for machine learning (prediction model) using scikit-learn.
I tried to process and transform the image and expand the data for machine learning
Implementation of a model that predicts the exchange rate (dollar-yen rate) by machine learning
I tried using the Datetime module by Python
Classify machine learning related information by topic model
Mitsuhiko "I can tell the criminal by introducing myself!"
[MNIST] I tried Fine Tuning using the ImageNet model.
I tried increasing or decreasing the number by programming
PyTorch Learning Note 2 (I tried using a pre-trained model)
I tried to compare the accuracy of machine learning models using kaggle as a theme.
Matching app I tried to take statistics of strong people & tried to create a machine learning model
Explain & actually move the SMIS model that can "virtually try on clothes" by deep learning
I made an API with Docker that returns the predicted value of the machine learning model
By arranging the difference between "statistics" and "machine learning", I can see the reason why "machine learning" cannot be used in many business companies!