Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Image Classification

Image classification assigns a whole image one label from a fixed set of classes. How classifiers turn pixels into probabilities, key models, and uses.

Image classification is a computer vision task in which a model looks at an entire image and assigns it one label from a fixed set of classes, along with a confidence score for every class. It answers the question "what is this image of?": cat or dog, defective or good, pneumonia or normal. It is the simplest of the core vision tasks and also the foundation of the others, because backbones first trained to classify images on large datasets are reused as feature extractors for detection and segmentation through transfer learning.

How Image Classification Works#

A classifier turns pixels into class probabilities in three stages. A backbone, either a convolutional neural network (CNN) or a vision transformer (ViT), extracts features layer by layer, from edges and textures in early layers to object parts and whole objects in deeper ones. A pooling step collapses the final feature maps into a single vector that summarizes the whole image. A fully connected layer then produces one score, or logit, per class, and the softmax function converts those scores into probabilities that sum to 1.

Models learn this mapping through supervised learning on labeled images, minimizing cross-entropy loss between predicted probabilities and the true class. Single-label (multi-class) classification picks exactly one class per image with softmax. Multi-label classification, used when an image can show several things at once, scores each class independently with a sigmoid and keeps every class above a threshold.

Ultralytics YOLO26 classification models, marked by the -cls suffix, are single-label classifiers pretrained on ImageNet at 224×224 pixels, where the smallest, YOLO26n-cls, reaches 71.4% top-1 accuracy with 2.8 million parameters. They train on any dataset arranged as one folder of images per class:

from ultralytics import YOLO

# Load a YOLO26 classification model pretrained on the 1,000 ImageNet classes
model = YOLO("yolo26n-cls.pt")

# Classify the whole image
results = model("https://ultralytics.com/images/bus.jpg")
probs = results[0].probs

# Show the five most likely classes and their softmax probabilities
for class_id, confidence in zip(probs.top5, probs.top5conf.tolist()):
    print(f"{results[0].names[class_id]}: {confidence:.2f}")

The five probabilities come from one softmax over all 1,000 classes, so they show how confident the model is in its top choice relative to similar classes.

Classification vs. Detection and Segmentation#

Classification describes the whole image and says nothing about where things are or how many there are:

  • Object detection: Finds each object, labels it, and locates it with a bounding box, so it can count three cars in one photo.
  • Image segmentation: Labels pixels, tracing the exact outline of each object or region.
  • Image recognition: A broader umbrella term for identifying content in images, often used loosely as a synonym for classification.

Choosing between them depends on how much spatial detail an application needs:

Real-World Applications#

  • Manufacturing inspection: Cameras on a production line photograph each part, and a classifier labels it pass or fail so defective items are rejected automatically.
  • Medical triage: Models triage chest X-rays, skin lesion photos, and retinal scans into normal and abnormal categories so clinicians review urgent cases first.
  • Agriculture: Farmers photograph leaves with a phone, and a classifier identifies the crop disease or nutrient deficiency.
  • Content organization: Photo libraries and marketplaces tag millions of images by scene and product category so they can be searched and moderated.

Benchmarks and Models#

Classifiers are compared by top-1 accuracy, the share of images whose highest-probability class is correct, and top-5 accuracy, the share whose true class appears among the five most likely. Modern classification grew out of the ImageNet Large Scale Visual Recognition Challenge, whose 1,000-class subset with about 1.28 million training images remains the standard benchmark. In 2012, AlexNet cut the top-5 error rate to 15.3% from 26.2% for the runner-up, starting the deep learning era in vision. ResNet made networks with more than 100 layers trainable in 2015, and Vision Transformers showed in 2020 that attention-based models match or beat CNNs once pretrained on 14 million to 300 million images.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Turn drone and aerial imagery into real-time insights for agriculture, aquaculture, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Apply computer vision in aerospace with Ultralytics YOLO for aircraft inspection, runway FOD detection, airport ground operations, and composite defect detection.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning