Key takeaways
- Image classification assigns one or more labels to a whole image, such as 'cat' or 'damaged leaf'.
- Models learn visual features from labelled examples and output a probability for each class.
- CNNs suit images because convolutions detect local patterns efficiently; vision transformers now rival them.
- YOLO has classification models, and multimodal LLMs can classify images zero-shot from a text prompt.
- In GIS, image classification labels each pixel of satellite imagery as land cover, such as water, forest or urban.
Image classification is the computer vision task of assigning a label, or several labels, to an entire image: this photo shows a dog, this leaf is diseased, this X-ray looks normal. A trained model looks at the image and outputs probabilities for each class. It is the foundation of visual AI, and I work with related vision tasks in FaceVision and DocuLens AI. This page covers how classification works, models, why CNNs suit it, YOLO and LLMs, whether it is NLP, and classification in GIS and QGIS.
What is image classification?
Image classification is predicting which category an image belongs to from a fixed set of classes. Single-label classification picks one class; multi-label classification can assign several, such as "beach" and "sunset" together.
Also asked as: why cnn is best for image classification · how cnn works for image classification
It differs from object detection, which finds and boxes each object, and segmentation, which labels every pixel. Applications include sorting products in e-commerce, detecting crop diseases from leaf photos, flagging defects in manufacturing, medical image screening, content moderation and organising photo libraries. It is usually the first computer vision task students learn, with datasets such as CIFAR-10 and ImageNet.
How does image classification work?
A model converts the image into numbers, extracts visual features through many layers, and ends with a layer that outputs a probability for each class. It learns by training on labelled images, adjusting its weights to reduce prediction errors.
Steps in a typical project:
- Collect and label images for each class.
- Resize and normalise images; apply augmentations like flips and crops.
- Start from a pretrained model and fine-tune it on your data.
- Validate on held-out images and inspect mistakes.
- Deploy, and monitor accuracy on real inputs.
Transfer learning from models pretrained on large datasets lets you get strong results with a few hundred images per class.
What are image classification models?
Common models include convolutional networks such as ResNet, EfficientNet and MobileNet, vision transformers such as ViT and its variants, and hybrid designs such as ConvNeXt. Libraries like PyTorch, timm and Hugging Face provide pretrained versions.
Choose by deployment target and accuracy needs: MobileNet and EfficientNet-Lite suit phones and browsers; ResNet-50 is a reliable baseline; vision transformers excel with large data and pretraining. Foundation models such as CLIP classify images by comparing them to text labels without task-specific training. For small datasets, fine-tuning a pretrained model almost always beats training from scratch.
Why are CNNs good for image classification?
CNNs suit images because convolution layers detect local patterns, such as edges and textures, with small filters that slide across the image, sharing weights so the same pattern is recognised anywhere. This makes them efficient and data-friendly.
Stacking layers builds a hierarchy: early layers find edges, middle layers find shapes and parts, and deep layers find objects. Pooling adds tolerance to small shifts. ResNet's residual connections, introduced in 2015, made very deep CNNs trainable. Vision transformers now match or beat CNNs at large scale, but CNNs remain excellent for small datasets, edge devices and real-time applications, so "best" depends on context.
How do CNNs work for image classification?
A CNN passes the image through convolution layers that apply learned filters, activation functions that add non-linearity, and pooling layers that reduce size. The resulting feature maps are flattened or pooled and fed to a final layer that outputs class probabilities.
During training, the network compares predictions to correct labels with a loss function such as cross-entropy, and backpropagation adjusts filter weights to reduce the loss. Over many examples, filters specialise in useful patterns. Techniques such as batch normalisation, dropout and data augmentation improve training and reduce overfitting. Visualisation tools like Grad-CAM show which image regions influenced a prediction, helping you debug.
Can YOLO do image classification?
Yes. Although YOLO is best known for object detection, Ultralytics YOLO releases include classification models that label whole images, trained and used with the same simple interface as detection.
Use YOLO classification when you want fast training, easy deployment and a consistent toolkit across detection and classification. If you need to know where objects are, or count them, use detection instead. For example, classify whether a factory image contains a defect at all, then run detection only on flagged images to locate the defects. Compare accuracy and speed with other classifiers on your own data.
Can an LLM do image classification?
Multimodal LLMs, which accept images, can classify images from a prompt such as "Is this leaf healthy or diseased? Answer with one word", without training. Text-only LLMs cannot see images, though they can classify image descriptions.
Also asked as: can llm do image classification
Zero-shot classification with multimodal models or CLIP is great for prototypes, many categories and changing labels. Trade-offs: higher cost per image, slower responses and less consistent outputs than a fine-tuned classifier. For high-volume, fixed-category tasks, a small fine-tuned model is cheaper and more reliable. A practical pattern is labelling an initial dataset with a multimodal model, reviewing labels by hand, then training a compact classifier.
Is image classification NLP?
No. Image classification belongs to computer vision; NLP, natural language processing, deals with text and speech. Both are branches of machine learning and share techniques, especially transformers.
The boundary has blurred with multimodal models, which process images and text together. CLIP learns to match images with captions, enabling classification by text prompts, and vision language models answer questions about images in natural language. Document AI also combines both: OCR reads text from images, then NLP understands it. Still, classifying an image's content is a vision task.
What is image classification in GIS?
In GIS and remote sensing, image classification labels pixels or objects in satellite or aerial imagery into land cover classes, such as water, forest, farmland, urban and bare soil, creating thematic maps from raw imagery.
Supervised classification uses training samples drawn by an analyst for each class, with algorithms such as random forest, support vector machines, maximum likelihood or deep learning. Unsupervised classification groups pixels by spectral similarity, and the analyst names the clusters afterwards. Uses include monitoring deforestation, urban growth, crop mapping and flood extent. Accuracy is checked against ground truth with a confusion matrix.
How do I do image classification in QGIS?
The common route is the Semi-Automatic Classification Plugin: install it, load satellite imagery such as Sentinel-2 or Landsat bands, create training samples for each land cover class, run a classifier, then assess accuracy.
Also asked as: how to do image classification in qgis
Steps:
- Install the plugin from QGIS's plugin manager.
- Download and preprocess imagery, including atmospheric correction.
- Build a band set from the relevant bands.
- Draw training polygons for each class.
- Run a classification algorithm such as random forest.
- Validate with separate reference samples and refine.
QGIS also offers tools through the Orfeo Toolbox and processing algorithms. ArcGIS Pro provides a similar workflow with its Image Classification Wizard.
Sources
- Stanford CS231n, Convolutional Neural Networks for Visual Recognitioncs231n.github.io
- He et al., Deep Residual Learning for Image Recognition (2015)arxiv.org
- Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale (2020)arxiv.org
- Ultralytics, Image classification taskdocs.ultralytics.com
- Radford et al., Learning Transferable Visual Models From Natural Language Supervision (CLIP, 2021)arxiv.org
- QGIS, Semi-Automatic Classification Plugin documentationsemiautomaticclassificationmanual.readthedocs.io




