Yolo Vision Shenzhen
Shenzhen
Jetzt beitreten
Glossar

CPU

Erforschen Sie die wichtige Rolle der CPU bei KI und maschinellem Lernen. Erfahren Sie mehr über ihre Verwendung bei der Datenvorbereitung, Inferenz und wie sie im Vergleich zu GPUs/TPUs abschneidet.

A Central Processing Unit (CPU) is the primary component of a computer that acts as its "brain," responsible for interpreting and executing instructions from hardware and software. In the context of artificial intelligence (AI), the CPU plays a fundamental role in data handling, system orchestration, and executing inference, particularly on edge devices where power efficiency is critical. While specialized hardware like GPUs are often associated with the heavy lifting of training deep learning models, the CPU remains indispensable for the overall machine learning (ML) pipeline.

Die Rolle von CPUs in KI-Workflows

Although GPUs are celebrated for their massive parallelism during training, the CPU is the workhorse for many essential stages of the computer vision (CV) lifecycle. Its architecture, typically based on x86 (Intel, AMD) or ARM designs, is optimized for sequential processing and complex logic control.

  • Data Preprocessing: Before a neural network can learn, data must be prepared. CPUs excel at tasks such as file loading, data cleaning, and complex transformations using libraries like NumPy and OpenCV.
  • Edge-Inferenz: Für den Einsatz in der Praxis ist es nicht immer möglich, Modelle auf massiven Servern auszuführen. CPUs ermöglichen eine effiziente Modellbereitstellung auf Verbraucherhardware, z. B. die Ausführung von Ultralytics auf einem Laptop oder einem Raspberry Pi.
  • Post-Processing: After a model outputs raw probabilities, the CPU often handles the final logic, such as Non-Maximum Suppression (NMS) in object detection, to filter out duplicate predictions and refine results.

CPU vs. GPU vs. TPU

Das Verständnis der Hardware-Landschaft ist entscheidend für die Optimierung von Machine Learning Operations (MLOps). Diese Prozessoren unterscheiden sich erheblich in ihrer Architektur und ihren idealen Anwendungsfällen.

  • CPU: Designed for versatility and complex logic. It features a few powerful cores that process tasks sequentially. It is best for data augmentation, pipeline management, and low-latency inference on small batches.
  • GPU Grafikprozessor): Ursprünglich für Grafiken entwickelt, verfügen GPUs über Tausende kleinerer Kerne, die für die parallele Verarbeitung ausgelegt sind. Sie sind der Standard für das Modelltraining, da sie Matrixmultiplikationen viel schneller als eine CPU durchführen können.
  • TPU (Tensor Processing Unit): A specialized circuit (ASIC) developed by Google Cloud specifically for tensor math. While highly efficient for specific workloads, it lacks the general-purpose flexibility of a CPU.

Anwendungsfälle in der Praxis

CPUs are frequently the hardware of choice for applications where cost, availability, and energy consumption outweigh the need for massive raw throughput.

  1. Smart Security Cameras: In security alarm systems, cameras often process video feeds locally. A CPU-based object detection model can identify a person or vehicle and trigger an alert without sending video to the cloud, preserving bandwidth and user privacy.
  2. Industrielle Automatisierung: In Fabrikhallen überwachen vorausschauende Wartungssysteme mithilfe von CPUs die Sensordaten von Maschinen. Diese Systeme analysieren Vibrationen oder Temperaturspitzen in Echtzeit, um Ausfälle vorherzusagen, und gewährleisten so eine reibungslose Fertigungsautomatisierung, ohne dass teure GPU erforderlich sind.

Ausführen von Inferenz auf CPU Ultralytics

Entwickler testen Modelle häufig auf CPUs, um die Kompatibilität mit serverlosen Computing-Umgebungen oder Geräten mit geringem Stromverbrauch zu überprüfen. Mit der Ultralytics können Sie die CPU einfach ansprechen und so sicherstellen, dass Ihre Anwendung überall läuft.

Das folgende Beispiel zeigt, wie ein leichtgewichtiges Modell geladen und die Inferenz speziell auf der CPU ausgeführt wird:

from ultralytics import YOLO

# Load the lightweight YOLO26 nano model
# Smaller models are optimized for faster CPU execution
model = YOLO("yolo26n.pt")

# Run inference on an image, explicitly setting the device to 'cpu'
results = model.predict("https://ultralytics.com/images/bus.jpg", device="cpu")

# Print the detection results (bounding boxes)
print(results[0].boxes.xywh)

To further improve performance on Intel CPUs, developers can export their models to the OpenVINO format, which optimizes the neural network structure specifically for x86 architecture. For managing datasets and orchestrating these deployments, tools like the Ultralytics Platform simplify the workflow from annotation to edge execution.

Werden Sie Mitglied der Ultralytics

Gestalten Sie die Zukunft der KI mit. Vernetzen Sie sich, arbeiten Sie zusammen und wachsen Sie mit globalen Innovatoren

Jetzt beitreten