Yolo Tầm nhìn Thâm Quyến
Thâm Quyến
Tham gia ngay
Bảng chú giải thuật ngữ

CPU

Khám phá CPU Vai trò quan trọng của nó trong AI và Học máy. Tìm hiểu về ứng dụng của nó trong chuẩn bị dữ liệu, suy luận và so sánh với 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.

Vai trò của CPU trong quy trình làm việc AI

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.
  • Suy luận trên thiết bị biên: Đối với việc triển khai thực tế, việc chạy các mô hình trên các máy chủ lớn không phải lúc nào cũng khả thi. CPU cho phép triển khai mô hình hiệu quả trên phần cứng tiêu dùng, chẳng hạn như chạy Ultralytics YOLO26 trên máy tính xách tay hoặc 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

Hiểu rõ về cấu trúc phần cứng là rất quan trọng để tối ưu hóa các hoạt động học máy (MLOps) . Các bộ xử lý này khác nhau đáng kể về kiến trúc và trường hợp sử dụng lý tưởng.

  • 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 (Bộ xử lý đồ họa) : Ban đầu được thiết kế cho đồ họa, GPU có hàng nghìn lõi nhỏ hơn được thiết kế để xử lý song song. Chúng là tiêu chuẩn cho việc huấn luyện mô hình vì chúng có thể thực hiện phép nhân ma trận nhanh hơn nhiều so với bộ xử lý đồ họa thông thường. 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.

Các Ứng dụng Thực tế

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. Tự động hóa công nghiệp: Trong các nhà máy, hệ thống bảo trì dự đoán sử dụng CPU để giám sát dữ liệu cảm biến từ máy móc. Các hệ thống này phân tích độ rung hoặc sự tăng đột biến nhiệt độ trong thời gian thực để dự đoán sự cố, đảm bảo quá trình sản xuất tự động diễn ra suôn sẻ mà không cần đến các thiết bị đắt tiền. GPU các cụm.

Đang thực hiện suy luận trên CPU với Ultralytics

Các nhà phát triển thường thử nghiệm các mô hình trên CPU để xác minh khả năng tương thích với môi trường điện toán phi máy chủ hoặc các thiết bị tiêu thụ điện năng thấp. Ultralytics API cho phép bạn dễ dàng nhắm mục tiêu vào CPU , đảm bảo ứng dụng của bạn có thể chạy ở mọi nơi.

Ví dụ sau đây minh họa cách tải một mô hình nhẹ và chạy suy luận cụ thể trên... 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.

Tham gia Ultralytics cộng đồng

Tham gia vào tương lai của AI. Kết nối, hợp tác và phát triển cùng với những nhà đổi mới toàn cầu

Tham gia ngay