Yolo Vision Shenzhen
Shenzhen
Únete ahora
Glosario

CPU

Explore el papel vital de CPU en la IA y el aprendizaje automático. Infórmate sobre su uso en la preparación de datos, la inferencia y su comparación con las GPU/TPU.

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.

El papel de las CPU en los flujos de trabajo de IA

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.
  • Inferencia periférica: para la implementación en el mundo real, no siempre es viable ejecutar modelos en servidores masivos. Las CPU permiten una implementación eficiente de modelos en hardware de consumo, como la ejecución Ultralytics en un ordenador portátil o una 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

Comprender el panorama del hardware es fundamental para optimizar las operaciones de aprendizaje automático (MLOps). Estos procesadores difieren significativamente en su arquitectura y casos de uso ideales.

  • 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 unidad de procesamiento gráfico): Originalmente destinadas a los gráficos, las GPU tienen miles de núcleos más pequeños diseñados para el procesamiento paralelo. Son el estándar para el entrenamiento de modelos porque pueden realizar multiplicaciones matriciales mucho más rápido que una CPU.
  • 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.

Aplicaciones en el mundo real

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. Automatización industrial: En las fábricas, los sistemas de mantenimiento predictivo utilizan CPU para supervisar los datos de los sensores de la maquinaria. Estos sistemas analizan las vibraciones o los picos de temperatura en tiempo real para predecir fallos, lo que garantiza una automatización de la fabricación fluida sin necesidad de costosos GPU .

Ejecución de inferencias en CPU Ultralytics

Los desarrolladores suelen probar los modelos en CPU para verificar la compatibilidad con entornos informáticos sin servidor o dispositivos de bajo consumo . La Ultralytics permite orientar fácilmente la CPU, lo que garantiza que la aplicación se ejecute en cualquier lugar.

El siguiente ejemplo muestra cómo cargar un modelo ligero y ejecutar la inferencia específicamente en la CPU:

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.

Únase a la comunidad Ultralytics

Únete al futuro de la IA. Conecta, colabora y crece con innovadores de todo el mundo

Únete ahora