Single-label image classification / cheat sheet

Target audience: Data scientists and developers

Use this cheat sheet

If your input data consists of labeled images containing exactly one of multiple classes. This is called single-label classification.

Example use cases

Note
Disclaimer
Please note that data sets, models and other content, including open source software, (collectively referred to as "Content") provided and/or suggested by Peltarion for use in the Platform, may be subject to separate third party terms of use or license terms. You are solely responsible for complying with the applicable terms. Peltarion makes no representations or warranties about Content and specifically disclaim all responsibility for any liability, loss, or risk, which is incurred as a consequence, directly or indirectly, of the use or application of any of the Content.

SkinLiasonMalignant BenignPA3

Images of skin lesions that are either benign or malignant.
(image source)

Cracks in solar panel PA4

Images of solar panels that are either defective or functional.
(image source)

MNIST tagged 8 5 PA2

Images that contain exactly one handwritten number from 0 to 9.
(image source)

Data preparation

You can add your dataset in several different ways in the Datasets view; Import from your data warehouse, directly from your local computer, via data API, or from an URL. Here we’ll show you how to add it directly from your computer.

Data input requirements

Prepare a zip file with a folder containing all your images and a corresponding index.csv.
The Peltarion Platform supports .jpg or .png.

index csv PA1

Structure of index.csv

The index.csv file is a simple text file where columns are separated by a comma: ",". Each column will be imported as a dataset feature, where the name of the feature is taken from the first line.

You need to give at least two features: the images and their target classes. To specify the images, write the name of the image file, together with their paths inside the zip file if they are located in subfolders.

image label

images/image_1.jpg

class 1

images/image_2.jpg

class 2

Modeling

Use the Experiment wizard to choose the best snippet. Snippets are pre-built neural network architectures available on the platform. Several are good for image classification.

Image size Recommended snippet

1-31 pixels

CNN

32-223 pixels

MobileNetV2 0.35
DenseNet 121
ResNetV2 small 29

224 - 332 pixels

EfficientNetB0
MobileNetV2 1.0
ResNetV2 large 101

333 - 400 pixels

EfficientNetB4
MobileNetV2 1.4
ResNetV2 large 152

401 - 499 pixels

EfficientNetB5
MobileNetV2 1.4
ResNetV2 large 152

500 - 560 pixels

EfficientNetB6
MobileNetV2 1.4
ResNetV2 large 152

Try the smallest depth model first

Try the smallest depth model first, since it will be faster to train and may already be complex enough to model your data well.

If the results are not good enough, you can move towards increasingly deep models in later experiments.

Initialize weights

If available you should use pretrained weights where the snippet has already learned the basic representations from the dataset it has been trained on and you can now train it on a small domain-specific dataset to provide value.

Run experiment

When you’ve created an experiment with the Experiment wizard, a ready-to-run model will populate the Modeling canvas. Everything needed will be set, input and target feature, weights (if you wanted those), loss function, activation, runtime settings, i.e., batch size, learning rate, number of epochs.

You can still edit/add/remove anything on the Modeling canvas or override all the existing choices, delete the snippet, and add a new one.

The only thing left to do is to press the Run button on the upper right corner to start the training process.

Deployment view

In the Deployment view, click New deployment.

Select your experiment and epoch for deployment.

Click the Enable switch to deploy the experiment.

Image Classifier web app

To make it easier to test your model, we have provided a Image Classifier web app.

Open the Image classifier: bit.ly/ImageClassifier, and copy-paste the following information from the Deployment view:

  • Deployment URL

  • Token

  • input parameter feature name.

Then add an image and press the Run button to predict!

Example:

Image webb app PA1
Was this page helpful?
YesNo