了解少样本学习如何使 AI 能够以最少的数据进行调整,从而改变医疗诊断和野生动物保护等领域。
Few-Shot Learning (FSL) is a specialized subfield of machine learning (ML) designed to train models to recognize and classify new concepts using a very small number of labeled examples. In traditional deep learning (DL), achieving high accuracy typically requires massive datasets containing thousands of images per category. However, FSL mimics the human cognitive ability to generalize rapidly from limited experience—much like a child can recognize a giraffe after seeing just one or two pictures in a book. This capability is essential for deploying artificial intelligence (AI) in scenarios where collecting large amounts of training data is prohibitively expensive, time-consuming, or practically impossible.
FSL的主要目标是通过利用先验知识来减少对大规模数据收集的依赖。 该模型无需从零开始学习模式,而是利用包含少量标注样本的"支持集"来理解新类别。这通常通过元学习(亦称"学习如何学习")等先进技术实现。在此范式下,模型通过训练多种任务来习得最优初始化或更新规则,从而能以最小调整适应新任务。
另一种常见方法是基于度量的学习,模型通过嵌入技术将输入数据映射到向量空间。 在此空间中,相似元素 被聚类至邻近位置,而相异元素则被推离。诸如 原型网络等算法会为每类计算均值表示(即原型), 并根据classify 查询样本与这些原型的距离classify 。该方法通常依赖于 在大型通用数据集预训练阶段 培养的特征提取能力。
少样本学习正在改变那些因数据稀缺而阻碍人工智能技术应用的行业。
In the field of medical image analysis, obtaining thousands of labeled scans for rare pathologies is often unfeasible. FSL allows researchers to train computer vision (CV) systems to detect rare tumor types or specific genetic anomalies using only a handful of annotated case studies. This capability democratizes access to advanced diagnostic tools, a goal pursued by institutions like Stanford Medicine, helping to identify conditions that would otherwise require specialized human expertise.
现代制造业人工智能高度依赖自动化检测。然而某些特定缺陷可能极为罕见,导致难以构建大规模的"不良"零件数据集。FSL技术使异常检测系统仅凭少量图像即可学习新型缺陷特征,使工厂操作员能够快速更新质量保证协议,无需停产收集数据,从而显著提升动态生产环境中的效率。
区分FSL与类似的低数据学习范式有助于理解其特定的应用领域:
In practice, one of the most effective ways to perform Few-Shot Learning is to leverage a highly robust pre-trained model. State-of-the-art models like the newer YOLO26 have learned rich feature representations from massive datasets like COCO or ImageNet. By fine-tuning these models on a tiny custom dataset, they can adapt to new tasks with remarkable speed and accuracy.
以下Python 演示了如何使用小数据集训练模型:
ultralytics 包,有效实现少样本适应:
from ultralytics import YOLO
# Load a pre-trained YOLO26 model (incorporates learned features)
model = YOLO("yolo26n.pt")
# Fine-tune on a tiny dataset (e.g., coco8 has only 4 images per batch)
# This leverages the model's prior knowledge for the new task
results = model.train(data="coco8.yaml", epochs=20, imgsz=640)
# The model adapts to detect objects in the small dataset
print("Few-shot adaptation complete.")
While powerful, FSL faces challenges regarding reliability. If the few provided examples are outliers or noisy, the model's performance can degrade, a problem known as overfitting. Research into data augmentation and synthetic data generation is critical for mitigating these risks. As foundation models become larger and more capable, and tools like the Ultralytics Platform simplify model training and management, the ability to create custom AI solutions with minimal data will become increasingly accessible to developers worldwide.