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

Mạng Capsule (CapsNet)

Explore Capsule Networks (CapsNets) and how they preserve spatial hierarchies to solve the "Picasso problem" in AI. Learn about dynamic routing and vector neurons.

Capsule Networks, often abbreviated as CapsNets, represent an advanced architecture in the field of deep learning designed to overcome specific limitations found in traditional neural networks. Introduced by Geoffrey Hinton and his team, CapsNets attempt to mimic the biological neural organization of the human brain more closely than standard models. Unlike a typical convolutional neural network (CNN), which excels at detecting features but often loses spatial relationships due to downsampling, a Capsule Network organizes neurons into groups called "capsules." These capsules encode not just the probability of an object's presence, but also its specific properties, such as orientation, size, and texture, effectively preserving the hierarchical spatial relationships within visual data.

The Limitation of Traditional CNNs

To understand the innovation of CapsNets, it is helpful to look at how standard computer vision models operate. A conventional CNN uses layers of feature extraction followed by pooling layers—specifically max pooling—to reduce computational load and achieve translational invariance. This means a CNN can identify a "cat" regardless of where it sits in the image.

However, this process often discards precise location data, leading to the "Picasso problem": a CNN might classify a face correctly even if the mouth is on the forehead, simply because all the necessary features are present. CapsNets address this by removing pooling layers and replacing them with a process that respects the spatial hierarchies of objects.

How Capsule Networks Work

The core building block of this architecture is the capsule, a nested set of neurons that outputs a vector rather than a scalar value. In vector mathematics, a vector has both magnitude and direction. In a CapsNet:

  • Magnitude (Length): Represents the probability that a specific entity exists in the current input.
  • Direction (Orientation): Encodes the instantiation parameters, such as the object's pose estimation, scale, and rotation.

Capsules in lower layers (detecting simple shapes like edges) predict the output of capsules in higher layers (detecting complex objects like eyes or tires). This communication is managed by an algorithm called "dynamic routing" or "routing by agreement." If a lower-level capsule's prediction aligns with the higher-level capsule's state, the connection between them is strengthened. This allows the network to recognize objects from different 3D viewpoints without requiring the massive data augmentation usually needed to teach CNNs about rotation and scale.

Những điểm khác biệt chính: Mạng nơ-ron tích chập (CNN) so với mạng nơ-ron truyền thống (CNN)

Mặc dù cả hai kiến trúc đều là nền tảng của thị giác máy tính (CV) , nhưng chúng khác nhau về cách xử lý và biểu diễn dữ liệu hình ảnh:

  • Scalar vs. Vector: CNN neurons use scalar outputs to signify feature presence. CapsNets use vectors to encode presence (length) and pose parameters (orientation).
  • Routing vs. Pooling: CNNs use pooling to downsample data, often losing location details. CapsNets use dynamic routing to preserve spatial data, making them highly effective for tasks requiring precise object tracking.
  • Data Efficiency: Because capsules implicitly understand 3D viewpoints and affine transformations, they can often generalize from less training data compared to CNNs, which may require extensive examples to learn every possible rotation of an object.

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

Mặc dù CapsNet thường tốn nhiều tài nguyên tính toán hơn so với các mô hình được tối ưu hóa như YOLO26 , nhưng chúng lại mang đến những lợi thế riêng biệt trong các lĩnh vực chuyên biệt:

  1. Phân tích hình ảnh y tế: Trong lĩnh vực chăm sóc sức khỏe, định hướng và hình dạng chính xác của một dị thường là vô cùng quan trọng. Các nhà nghiên cứu đã áp dụng mạng nơ-ron capsule (CapsNet) vào việc phân đoạn khối u não , trong đó mô hình phải phân biệt khối u với các mô xung quanh dựa trên các cấu trúc không gian tinh tế mà các mạng nơ-ron tích chập (CNN) tiêu chuẩn có thể bỏ qua. Bạn có thể tìm hiểu thêm các nghiên cứu liên quan về mạng nơ-ron capsule trong hình ảnh y tế .
  2. Overlapping Digit Recognition: CapsNets achieved state-of-the-art results on the MNIST dataset specifically in scenarios where digits overlap. Because the network tracks the "pose" of each digit, it can disentangle two overlapping numbers (e.g., a '3' on top of a '5') as distinct objects rather than merging them into a single confused feature map.

Bối cảnh thực tiễn và triển khai

Mạng Capsule (CapsNet) chủ yếu là một kiến trúc phân loại. Mặc dù về mặt lý thuyết chúng có độ bền vững cao, nhưng các ứng dụng công nghiệp hiện đại thường ưu tiên các mạng CNN tốc độ cao hoặc Transformer để đạt hiệu suất thời gian thực tốt hơn. Tuy nhiên, việc hiểu rõ các tiêu chuẩn phân loại được sử dụng cho CapsNet, chẳng hạn như... MNIST Nó rất hữu ích.

Ví dụ sau đây minh họa cách huấn luyện một hệ thống hiện đại. YOLO mô hình phân loại trên MNIST tập dữ liệu sử dụng ultralytics gói này tương tự như nhiệm vụ đánh giá chuẩn chính được sử dụng để xác thực Mạng Capsule.

from ultralytics import YOLO

# Load a YOLO26 classification model (optimized for speed and accuracy)
model = YOLO("yolo26n-cls.pt")

# Train the model on the MNIST dataset
# This dataset helps evaluate how well a model learns handwritten digit features
results = model.train(data="mnist", epochs=5, imgsz=32)

# Run inference on a sample image
# The model predicts the digit class (0-9)
predict = model("https://docs.ultralytics.com/datasets/classify/mnist/")

Tương lai của viên nang và trí tuệ nhân tạo thị giác

Các nguyên tắc đằng sau Mạng Capsule tiếp tục ảnh hưởng đến nghiên cứu về an toàn và khả năng giải thích của AI . Bằng cách mô hình hóa rõ ràng các mối quan hệ giữa bộ phận và toàn thể, các capsule cung cấp một giải pháp "hộp kính" thay thế cho bản chất "hộp đen" của mạng nơ-ron sâu, giúp các quyết định dễ giải thích hơn. Các phát triển trong tương lai hướng đến việc kết hợp tính mạnh mẽ về không gian của capsule với tốc độ suy luận của các kiến trúc như YOLO11 hoặc YOLO26 mới hơn để cải thiện hiệu suất trong phát hiện vật thể 3D và robot. Các nhà nghiên cứu cũng đang khám phá Matrix Capsules với EM Routing để giảm hơn nữa chi phí tính toán của thuật toán đồng thuận.

For developers looking to manage datasets and train models efficiently, the Ultralytics Platform provides a unified environment to annotate data, train in the cloud, and deploy models that balance the speed of CNNs with the accuracy required for complex vision tasks.

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