Meta-YOLOv8: multi-scale few-shot object detection for Chinese medicinal decoction pieces

Kai Hu, Chin‐Teng Lin, Xing Jin, Hangjuan LinJournal of King Saud University - Computer and Information Sciences 2025 · DOI

Abstract

Deep learning has revolutionized the identification of Chinese Medicinal Decoction Pieces (CMDP), yet the scarcity of labeled data for thousands of herb varieties remains a significant hurdle. This paper introduces Meta-YOLOv8, a few-shot object detection framework that integrates meta-learning with the anchor-free YOLOv8 architecture. By employing a Multi-Scale Class Feature Extraction Module (CFEM), Heterogeneous Graph Convolutional Networks (HGCN), and a Classification Auxiliary Module (CAM), the model learns to identify novel herb classes from as few as one to thirty examples. Experimental results on the CMDP4K dataset show that Meta-YOLOv8 improves mean average precision ($mAP_{0.5}$) by up to 20.4% over standard YOLOv8 with only a 6.6% increase in inference time, offering a robust solution for real-time pharmaceutical automation.

The Challenge of Herb Identification

Identifying Chinese Medicinal Decoction Pieces (CMDP)—the processed slices of herbs—is traditionally a labor-intensive task requiring significant expertise. While standard deep learning models can automate this, they typically require massive datasets. In the context of TCM, where thousands of species exist, collecting thousands of labeled images for every variety is impractical.

Few-Shot Object Detection (FSOD) addresses this by training models to recognize new categories from a limited "support set" of examples. However, traditional FSOD methods often struggle with the multi-scale nature of small herb slices or rely on slower, region-proposal-based architectures.

The few-shot learning setup for CMDP, showing support and query sets for training and testing tasks.

Methods: Meta-Learning Meets YOLOv8

Meta-YOLOv8 adapts the popular YOLOv8 pipeline into a meta-learning framework. The core innovation lies in how the model processes class-specific information across multiple scales to create robust "prototypes" for each herb.

Core Architecture Modules

  1. Multi-Scale Class Feature Extraction Module (CFEM): This module uses Task Alignment Learning to pinpoint the most representative features of an herb, ensuring that the extracted data captures the essential morphological traits rather than background noise.
  2. Heterogeneous Graph Convolutional Networks (HGCN): HGCN treats features as nodes in a graph. Intra-scale subgraphs share information between different samples of the same herb, while inter-scale subgraphs learn relationships across different resolutions. This creates scale-invariant class prototypes that help the model recognize a "Ginger" slice whether it appears large or small in the frame.
  3. Multi-Scale Classification Auxiliary Module (CAM): A lightweight branch that compares detected objects against learned prototypes. It acts as a "second opinion" for the main classification head, significantly boosting the recall of rare, novel classes.
The Meta-YOLOv8 workflow, illustrating the iterative parameter updates across training and testing tasks.

Experimental Results and Insights

The researchers evaluated Meta-YOLOv8 on standard benchmarks (VOC and COCO) and a specialized CMDP4K dataset containing 38 common medicinal pieces.

  • Performance Gains: Meta-YOLOv8 achieved a $mAP_{0.5}$ improvement ranging from 2.2% to 20.4% compared to the base YOLOv8 model, depending on the number of available samples (shots).
  • Efficiency: Despite the added complexity of graph networks, the model maintains high-speed performance. On an NVIDIA RTX 3080 Ti, inference takes approximately 3.3ms, making it suitable for mobile deployment in hospitals or pharmacies.
  • Scale Consistency: The use of inter-scale subgraphs proved critical. By forcing the model to maintain consistency across different image resolutions, the resulting class prototypes became much more reliable in low-data scenarios.

Conclusion

Meta-YOLOv8 demonstrates that meta-learning can be successfully integrated into high-speed, anchor-free detectors like YOLOv8. While the model still faces challenges in distinguishing between extremely similar-looking species (fine-grained differentiation), it provides a powerful technical foundation for the smart development of the Traditional Chinese Medicine industry. Future work will focus on integrating botanical taxonomic knowledge to further refine the model's discriminative capabilities.

Summary updated

Abstract

Recently, deep learning has been widely used in the field of Chinese Medicinal Decoction Pieces (CMDP) detection to address the limitations of inefficiency and subjectivity of professionals. However, deep learning networks typically require a large amount of data for training, and it is difficult to collect a large amount of labeled data for thousands of CMDP. This study aims to tackle the challenges posed by limited data availability in the context of CMDP detection. We propose Meta-YOLOv8, a novel few-shot object detection network based on YOLOv8. To effectively integrate YOLOv8 with meta-learning, we introduce three key modules: (i) Multi-Scale Class Feature Extraction Module (CFEM), (ii) Heterogeneous Graph Convolutional Networks (HGCN), and (iii) Multi-Scale Classification Auxiliary Module (CAM). The CFEM extracts high-quality class features at each scale through Task Alignment Learning. The HGCN facilitates context information enhancement and cross-sample information sharing via intra-scale subgraphs and learns intrinsic connections across scales using inter-scale subgraphs to create scale-specific class prototypes. Finally, the CAM leverages these scale-specific class prototypes to support multi-scale classification. We tested the proposed Meta-YOLOv8 model on two common image datasets, VOC and COCO, as well as a self-built CMDP image dataset. Compared to other few-shot object detection approaches, our proposed model achieves competitive results. Compared to YOLOv8, our method improves the mean average precision ( $$mAP_{0.5}$$ ) by 2.2% to 20.4% in different settings, with only a marginal increase in the inference time of 6.6%. The proposed approach integrates meta-learning with YOLOv8, enabling accurate identification of novel CMDPs with only a small number of samples. This capability significantly enhances the efficiency and feasibility of CMDP detection, thereby providing strong technical support for the smart development of the Traditional Chinese Medicine (TCM) industry.
BibTeX
@article{hu2025meta,
  author = {Kai Hu and Chin‐Teng Lin and Xing Jin and Hangjuan Lin},
  title = {{Meta-YOLOv8: multi-scale few-shot object detection for Chinese medicinal decoction pieces}},
  journal = {Journal of King Saud University - Computer and Information Sciences},
  year = {2025},
  doi = {10.1007/s44443-025-00232-x},
}
Figure