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

Feature Extraction

Feature extraction turns raw data such as images into compact, informative features, using hand-designed methods or pretrained neural networks.

Feature extraction is the process of transforming raw data into a smaller set of numerical features that keep the information a task needs. A 640×480 RGB photo holds 921,600 pixel values, most of them redundant, and a feature extractor can reduce it to a vector of a few hundred numbers that describe its content. Classical machine learning relied on extractors designed by hand for each data type, and deep learning models learn their own in a backbone network whose output can be reused for search, clustering, and new classifiers. Fewer, more informative dimensions also ease the curse of dimensionality, so simpler models can generalize from less data.

Handcrafted vs. Learned Features#

Before deep learning, engineers built a feature extractor for each kind of data:

  • SIFT: Finds keypoints in an image and describes each one with a 128-dimensional histogram of gradient orientations that stays stable under changes in scale and rotation, which made it the standard tool for image matching and panorama stitching.
  • HOG: Histograms of oriented gradients computed over a grid of cells; paired with a linear support vector machine, HOG was introduced in 2005 for pedestrian detection and became a staple of classical object detection.
  • Principal component analysis (PCA): Projects data onto the directions of greatest variance, a general-purpose method for tabular data, faces, and spectra.
  • Mel-frequency cepstral coefficients (MFCCs): Summarize the short-term spectrum of audio on a scale matched to human hearing, long the default input for speech recognition.

Learned features have replaced most of these for images, audio, and text. A convolutional neural network (CNN) or vision transformer (ViT) trained on millions of images builds a hierarchy on its own: early layers detect edges and color blobs, middle layers detect textures and parts, and the last layers encode object-level concepts. These representations, stored in feature maps, carry over to new tasks, which is why pretrained backbones are the default starting point for transfer learning.

  • Feature engineering: The broader practice of creating, transforming, and choosing model inputs, often from domain knowledge, such as computing price per square foot from price and area. Feature extraction is one part of it, and in deep learning it is fully automated.
  • Feature selection: Keeps a subset of the original features unchanged and drops the rest. Feature extraction creates new features by transforming or combining the originals.
  • Dimensionality reduction: Overlaps heavily with feature extraction, and PCA counts as both. Methods built for plotting, such as t-SNE, reduce dimensions for human inspection and are rarely used as model inputs.
  • Embeddings: The feature vectors a learned extractor outputs. In deep learning, "extracted features" and "embeddings" usually refer to the same vectors.

Using a Pretrained Network as a Feature Extractor#

The common recipe takes a pretrained network, removes its task head, runs data through the frozen layers, and pools the last feature map into one vector per input. With labels, training only a linear classifier on those vectors, called linear probing, gives a strong baseline at a small fraction of the cost of training a network. Without labels, vector search finds visually similar images, k-means clustering groups a dataset for curation and deduplication, and distance from normal examples flags defects in anomaly detection. The backbone's weights never change during feature extraction, which separates it from fine-tuning.

YOLO26 models provide this through model.embed(), which runs the network up to a chosen layer and average-pools that layer's feature map into one vector per image, and embed=[10] stops at the last layer of the YOLO26 backbone.

from ultralytics import YOLO

# Load a pretrained YOLO26 model; its backbone ends at layer 10
model = YOLO("yolo26n.pt")

# Average-pool the backbone's final feature map into one vector per image
embeddings = model.embed("https://ultralytics.com/images/bus.jpg", embed=[10])
vector = embeddings[0]

print(vector.shape)

It prints torch.Size([256]): the whole bus photo reduced to 256 numbers, one per channel of YOLO26n's stride-32 backbone output, ready for vector search or clustering.

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