Abstract:Fishmeal, a high-value and necessary protein feed raw material, confronts difficulties in assessing authenticity. The conventional identification process is rendered challenging due to the sophistication of visual discrimination and the inefficacy of microscopic testing techniques by inspector, particularly in the presence of subtle and multiple adulterants. These issues were tackled by proposing an end-to-end segmentation model based on the Masked-attention Mask Transformer (Mask2Former) architecture. Focused on identifying multi-target adulteration feature in complex fishmeal backgrounds under high-resolution conditions to realize automatic recognition and segmentation. Fishmeal was used and adulterated with animal-derived meat powder as an example, an adulterated fishmeal microscopic image dataset was created and the adulteration characteristics were classified into five types of tissues: abnormal muscle, bone, skin, blood, and hair based on morphological analysis. Then an interactive annotation program that utilized color threshold similarity to provide pixel-by-pixel suggestive annotations was developed. The updated Mask2Former model integrated ResNet50, multi-head Attention mechanisms, and multi-scale feature processing mechanisms to extract global information and multi-resolution features. Bidirectional feature pyramid network (BiFPN) enhanced the pixel decoder, thereby improving the model’s performance in processing small-scale targets. The incorporation of the Masked Attention module limited the scope of cross-attention calculations, enabling the model to more effectively focus on the target areas within the mask. The implementation of learnable scale-level embeddings and the reordering of self-attention and cross-attention within the decoder section bolstered the model’s feature learning capabilities. Furthermore, by adding dropout operations after the multi-head Attention layer, the improved Fishmeal-Mask2Former model achieved the overall accuracy rate of 98.56% in distinguishing genuine or adulterated samples. In the fine segmentation stage, the mean average precision of abnormal adulteration feature recognition reached 80.52 %, the mean average recall reached 76.01%, the mean F1 score reached 78.86%, and the segmentation mean accuracy was improved to 82.08%. The method proposed had significant advantages over traditional methods. Finally, a visual strategy with its interface of the segmentation results was designed, aimed to provide an intuitive, accurate, and efficient microscopic visual automated identification method for the fishmeal adulteration in its quality detection.