Single-label image classification / cheat sheet
Target audience: Data scientists and developers
Problem formulation
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. |
Images of skin lesions that are either benign or malignant. |
|
Images of solar panels that are either defective or functional. |
|
Images that contain exactly one handwritten number from
0 to 9. |
Data preparation
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.

Structure of index.csv
You need to structure the data so that each image is labeled with one class in the index.csv file.
image | class |
---|---|
image_1.jpg |
class 1 |
image_2.jpg |
class 2 |
Use same sized images
All of your images need to be the same size. If they are different sizes, you will need to resize them before creating the zip file, e.g., by using the Pillow package with this script.
Most of the best-performing deep learning models for images were constructed based on images sized 256x256 or 224x224. If your images are bigger than that, we recommend resizing your images to around this size to maximize the likelihood of getting good performance on your data.
Change preprocessing in the Datasets view
Once uploaded to the platform, choose Preprocessing as No pre-processing for the image column, and One-hot encoding for the class column.

Modeling
Snippets are pre-built neural network architectures available on the platform. Several are good for image classification.
Image size | Recommended snippet |
---|---|
Between 10x10 and 96x96 pixels |
ResNetV2 Small |
Between 96x96 and 320x320 pixels |
DenseNet |
Above 320x320 pixels |
We recommend you to resize them to max 320x320. |
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 toward increasingly deep models in later experiments.
The second number next to the snippet name represents the depth of the model; the deeper the model, the more complex it is.
Changes in the Modeling view
On the last Dense block change the number of nodes to the number of classes in your data, and set the Activation to Softmax. In this instance, we set softmax because it models the fact that labels are mutually exclusive (one and only one of them is right).
On the Target block, make sure the loss function is Categorical crossentropy.
