Glossary

Kalman Filter (KF)

Discover how Kalman Filters optimize state estimation in AI, tracking, sensor fusion, robotics, and more, even with noisy data.

Train YOLO models simply
with Ultralytics HUB

Learn more

The Kalman Filter (KF) is a powerful and widely used algorithm in machine learning (ML) and various engineering fields for estimating the state of a dynamic system from a series of noisy and incomplete measurements over time. Imagine trying to pinpoint the exact location and speed of a drone using slightly inaccurate GPS readings; the Kalman Filter provides a statistically optimal way to combine the predicted movement with the noisy measurements to get the best possible estimate. It's particularly valued for its efficiency and effectiveness in real-time applications.

How Kalman Filters Work

At its core, the Kalman Filter operates recursively on streams of noisy input data to produce a statistically optimal estimate of the underlying system state. It works in a two-step cycle:

  1. Predict: The filter predicts the next state of the system based on its current state estimate and a mathematical model of how the system changes over time (e.g., based on known physics or movement patterns). This prediction inherently includes some uncertainty.
  2. Update: When a new measurement arrives (e.g., a new GPS coordinate), the filter uses this measurement to correct or update its prediction. It intelligently weights the prediction and the measurement based on their respective uncertainties – trusting a more certain value more. This update step yields a new state estimate that is more accurate than either the prediction or the measurement alone.

This predict-update cycle repeats for each new measurement, continuously refining the state estimate. The filter is considered "optimal" for linear systems with Gaussian noise because it minimizes the mean squared error of the state estimate. This makes it a fundamental tool in state estimation and signal processing. For a more visual explanation, see How a Kalman Filter Works, in Pictures.

Key Characteristics

  • Optimality: Provides optimal estimates for linear systems assuming Gaussian noise characteristics.
  • Recursive: Processes measurements one at a time as they arrive, without needing to store all past data, making it suitable for real-time inference.
  • Computational Efficiency: Relatively low computational requirements compared to other estimation methods.
  • State Estimation: Estimates internal system states that may not be directly measurable.
  • Noise Handling: Effectively filters out noise from sensor measurements.

Real-World Applications

Kalman Filters are indispensable in numerous AI and ML applications:

Kalman Filter Vs. Extended Kalman Filter

The standard Kalman Filter assumes that the system dynamics and measurement models are linear. However, many real-world systems are non-linear. For such cases, variants like the Extended Kalman Filter (EKF) are used. The EKF approximates the non-linear system by linearizing it around the current state estimate at each time step. While powerful, this linearization introduces approximation errors, meaning the EKF may not be as optimal or stable as the standard KF is for purely linear problems. Other variants like the Unscented Kalman Filter (UKF) offer different approaches to handling non-linearities.

Kalman Filters in Ultralytics

The principles of Kalman filtering are incorporated into tracking algorithms supported by Ultralytics, such as BoT-SORT and ByteTrack, which can be used alongside Ultralytics YOLO object detectors. The Ultralytics framework provides implementations, like the one found in reference/trackers/utils/kalman_filter/, enabling robust object tracking capabilities. You can manage and train models for such applications using tools like Ultralytics HUB.

Read all