DOI: 10.3390/electronics15122731 ISSN: 2079-9292

MoLi-Net: A Lightweight Brightness-Aware Model for Chinese Herbal Materials Recognition with an Auxiliary Module for Impurity Detection

Zilong Xu, Changcheng Jiang, Jianhui Ding, Weiyang Ding, Zhenping Wan

Object detection in complex industrial environments is prone to being affected by insufficient dynamic weighting of local and global features, as well as illumination variations and impurities. Moreover, existing models suffer from excessive model complexity, which directly impairs computational efficiency. To more accurately distinguish Chinese herbal materials with diverse morphologies, this paper proposes the MobileAttn module. Drawing on the idea of token representation in the Transformer architecture, this module extracts contextual information through global feature compression, fuses it with tokens to generate a spatial attention map, and realizes dynamic recalibration of convolutional features. This process enhances the feature weights of key semantic regions, suppresses redundant background information, and improves feature discriminability. To address illumination interference, brightness-aware weights are combined with dual-path (channel and spatial) attention for global control, dynamically reducing the impact of illumination; this component is named LightAttn. When Chinese herbal materials contain common industrial unknown impurities (e.g., small stones and weeds), an impurity detection auxiliary module, a post-processing step independent of the main detection network, is proposed. This module refines Non-Maximum Suppression (NMS) logic to distinguish target Chinese herbal materials from interfering impurities. Subsequently, it accurately locates and marks impurities on the conveyor belt, thereby achieving effective unknown impurity detection. Experimental results demonstrate that, compared with the original YOLOv11 on the Chinese herbal materials detection task, the optimized model achieves a 1.7% improvement in the overall mean Average Precision (mAP@0.5:0.95). On a per-class basis, gains are particularly pronounced for certain challenging high-aspect-ratio Chinese herbal materials. Prunella vulgaris and orange peel achieve respective AP improvements of 5.8% and 4.1%. Meanwhile, the model parameter count is reduced by 23.1% and the computational complexity by 20.3%. The F1-Score of the impurity detection results is 86.38%, verifying the effectiveness of the impurity detection auxiliary module.

More from our Archive