Image Classification
Contents
Image Classification#
1. Load images#
To begin, we will load the images from an example dataset included in Piximi by pressing Open
in the top left. Select Open example project
> Open human U2OS-cells example project
to get started. Alternatively, if you would like to load your own images, press Open image
in the top right.
The images correspond to U2OS cells expressing arrestin-GFP, and a beta2-adrenergic receptor. Upon receptor stimulation arrestin-GFP is recruited to the plasma membrane and eventually endocytosed resulting in vesicle like structures.
2. Categorize images#
In the Categories
sub-menu on the right hand side you can see that there are already 3 classes defined for the U2OS example project. Click on the label to the left of these categories to turn on/off (/) the display of these images. The classes are:
Unknown
This represents the uncategorized images. Piximi will predict which class these images belong to later
Negative Control (cytoplasmic GFP)
Positive Control (vesicular GFP)
Single-click to select a 2-3 images from the unknown category that best fit the Negative Control
category. Once selected, click Categorize
in the top right and select Negative Control
. Do the same for 2-3 Positive Control
images.
3. Train model#
Click on the Classifier
button to open the sub-menu and then click on the Fit
settings icon. Within the menu that opens, you can select various parameters to adjust model training. Open the Dataset Settings
menu to find the Train percentage option
. This value controls what percentage of the images you have annotated will be used to train the model in Piximi. The remainder will be used to test how well Piximi can classify images not previously seen. We will use the default for now.
In the top right, press the to begin training. Piximi will now look at the training subset of the images you have annotated and try to learn what links the input image to a particular class. Then, Piximi will apply what it has learned by examining the testing subset of images and compare the models answers to the image class.
At the bottom of the fit settings page you will see two graphs update as Piximi trains the model which show the accuracy and loss of the model over incrementing epochs.
What is an epoch?
An epoch is a measure of how many times the entire training subset is studied by the deep learning model. As the number of epochs increases, the model optimizes itself to improve classification performance.
However, increasing the number of epochs does not necessarily lead to better results and can instead result in overfitting. Click here to read more about overfitting (needs link).
Accuracy
is a measure of how well the model has performed and is calculated as the ratio between the number of correct predictions and the total number of predictions. In this case, Accuracy
refers to the accuracy of the model at correctly determining the class of images in the training subset of images.
Validation Accuracy
is the accuracy when the model examines the testing subset of the data.
Validation accuracy vs accuracy
If you notice that your Validation accuracy
value decreases as epochs increase but your Accuracy
measurement continues to increase, this means that your model is fitting to the training subset of data better but your model is losing the ability to accurately predict on new data.
This is a result of overfitting as your model begins to pick up features within your image, such as noise, that are not relevant to classification. In essence, overfitting is when the model memorizes the answer to a specific question, rather than determining the answer from scratch itself.
Loss is another metric that is calculated on the training and test subsets of data and are depicted as loss and validation loss, respectively. Loss represents a summation of the errors the model has made during classification.
You can now exit the Fit
settings by clicking the in the top left.
4. Predict classes for unlabelled data#
Once your model has been trained you can press Predict
to run the trained model on the unannotated data. Once an image has been classified you will see the color on the image thumbnail update to that particular class.
Click Evaluate
to see in-depth metrics on how well the model performed.
See also
Link to our on guide, or a guide somewhere else. eg:
For further information on the evaluation metrics, see our evaluating a model guide.
Copyright
The BBBC016 images used here are licensed under a Creative Commons Attribution 3.0 Unported License by Ilya Ravkin.