Method for constructing camouflage pest segmentation model based on double-granularity orthogonal contrast semantics

CN122473796BActive Publication Date: 2026-10-09GUIZHOU UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202610981888.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-02
Publication Date
2026-10-09
Estimated Expiration
2046-07-02

AI Technical Summary

Technical Problem

[0006]为解决以上现有技术在复杂自然背景下对伪装害虫分割中前景-背景判别不足、近缘类别语义纠缠及多模态浅层融合难以抑制干扰的技术问题,本发明提供了一种基于双粒度正交对比语义的伪装害虫分割模型构建方法,包括以下步骤:

Benefits of technology

[0016] The beneficial effects of this invention are as follows: This invention targets insect pest monitoring and precision pesticide application scenarios. Based on a dual-modal dataset containing pixel-level masks and fine-grained text, it establishes a dual-granularity orthogonal contrastive semantic segmentation framework (DOCS-CPS): spatial location and boundaries are represented by multi-scale visual features, and image-level text descriptions and category-level prototypes constitute dual-granularity semantic priors, significantly improving foreground-background differentiation in camouflaged scenarios. Gated nonlinear enhancement and the most difficult negative sample orthogonal projection (GNEBlock+HNO) suppress interference from closely related categories, effectively alleviating fine-grained confusion among pests of the same family and genus. Semantic alignment is then used to complete pixel-text matching and instance mask generation, thereby achieving high-precision and robust segmentation in complex camouflaged fields, demonstrating good engineering application potential.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122473796B_ABST
    Figure CN122473796B_ABST
Patent Text Reader

Abstract

The present application relates to the field of agricultural computer vision and image target detection technology, and discloses a camouflage pest segmentation model construction method based on double-granularity orthogonal contrast semantics, comprising: preparing a camouflage pest original image sample set; constructing a camouflage pest double-modal data set, and the data structure is image-mask-text; defining a segmentation model of double-granularity orthogonal contrast semantics, and the segmentation model comprises a visual branch, a text branch, a shared space and a mask generation module; the visual branch is used for extracting multi-scale visual features from the image; the text branch is used for extracting purified category-level prototypes from the text; the shared space is used for calculating similarity; the mask generation module is used for pixel-text alignment to output pixel-level instance masks; the camouflage pest double-modal data set is classified into a training set and a validation set, a loss function is introduced, the segmentation model is trained, and a camouflage pest segmentation model is constructed. The present application realizes high-precision and high-robustness segmentation in a complex camouflage field scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural computer vision and image target detection technology, specifically to a method for constructing a segmentation model for camouflaged pests based on dual-granularity orthogonal contrast semantics. Background Technology

[0002] Pest monitoring is a crucial foundation for precision agriculture. Traditional inspection and experience-based identification methods suffer from high labor costs, slow response times, and strong subjectivity, making them unsuitable for large-scale, real-time field control. While advancements in deep learning have led to progress in pest identification technologies based on target detection or segmentation, stability issues remain in complex natural environments.

[0003] The difficulty in segmenting camouflaged pests in the field mainly lies in two aspects: Firstly, the pests are highly similar in color and texture to the background, such as the host's leaves, branches, and soil, resulting in unclear boundaries between the foreground and background. Secondly, pests of the same family and genus exhibit subtle differences in body shape and textural details, easily leading to semantic aliasing between categories. Existing purely visual methods are sensitive to such fine-grained confusion, and shallow splicing or simple attention fusion, commonly used in multimodal methods, are also insufficient to eradicate interfering components from the feature space.

[0004] Currently, some existing technologies exist, such as patent document CN120599219A, which discloses a method and system for detecting crop pests based on multi-scale features and cross-level feature interaction. First, multi-scale features of the input image are utilized to obtain high-level and low-level fusion features through adaptive pooling and multi-scale convolution operations. These features are then processed through cross-level feature interaction to strengthen the contextual association between features, resulting in multiple collaboratively fused features. Next, the collaboratively fused features are optimized to further enhance their representational ability, resulting in multiple optimized features. Finally, a feature fusion strategy is used to merge the multiple optimized features to form a localization prediction map of the camouflaged object. This method achieves the identification and localization of crop pests, but it fails to solve the aforementioned difficulties.

[0005] Therefore, there is an urgent need for a technical solution for detecting camouflaged pests in fields that can take into account both fine-grained semantic modeling and feature decoupling capabilities, so as to improve the robustness and segmentation accuracy of target detection and recognition in strongly camouflaged field scenarios. Summary of the Invention

[0006] To address the technical problems of insufficient foreground-background discrimination, semantic entanglement of closely related categories, and difficulty in suppressing interference in multimodal shallow fusion during the segmentation of camouflaged pests in complex natural backgrounds, the present invention provides a method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics, comprising the following steps: Prepare a sample set of original images of camouflaged pests, perform preprocessing, and form a standardized image set of camouflaged pests; Based on the standardized image set of camouflaged pests, image-level masking is initially annotated and fine-grained text descriptions are generated. A bimodal dataset of camouflaged pests is constructed; the data structure of the bimodal dataset of camouflaged pests is image-mask-text; A segmentation model with dual-granularity orthogonal contrastive semantics is defined, comprising a visual branch, a text branch, a shared space, and a semantically guided mask generation module; the visual branch is used to extract multi-scale visual features from images in the camouflaged pest bimodal dataset. The text branch is used to extract and purify category-level prototypes from the text in the camouflaged pest bimodal dataset. The shared space is used to compute multi-scale visual features. and purification category-level prototype The similarity; the semantically guided mask generation module is used to perform semantic guidance through pixel-text alignment and output pixel-level instance masks; The camouflaged pest bimodal dataset is classified into a training set and a validation set. A loss function is introduced to train the segmentation model and construct a camouflaged pest segmentation model. The pixel-level instance mask features include shape features and color features. The shape features represent the appearance of the disguised pest, and the color features represent the type of disguised pest. The loss function includes semantic contrast loss. With segmentation loss .

[0007] Furthermore, each sample image in the original image sample set of camouflaged pests includes the pest's body area and its habitat background area, which belongs to a strongly camouflaged field environment; the strongly camouflaged field environment refers to a field environment in which the individual pest is highly similar to the host's leaves, stems and soil in terms of color, texture and outline. The preprocessing of the original image sample set of camouflaged pests includes: filtering according to the degree of camouflage and category requirements, image deduplication, removal of blurred and misclassified samples, and uniform adjustment of resolution and naming format to form a standardized image set of camouflaged pests.

[0008] Furthermore, the construction of the bimodal dataset of camouflaged pests includes: Using the SAM2 model and an open-source annotation platform, the standardized image set of camouflaged pests was initially annotated with instance-level masks to obtain pixel-level masks that correspond one-to-one with the images. Based on entomological knowledge description templates and combined with the open-source multimodal model Qwen3-VL, fine-grained text descriptions are generated in batches from the standardized image set of the camouflaged pests. This forms high-quality image-text pairs; the high-quality image-text pairs refer to each text that semantically corresponds to the local area of ​​the image in terms of category, body color, texture, shape and habitat background, has no illusionary representation, and can be combined with a mask; Based on the pixel-level mask and fine-grained text description The camouflaged pest bimodal dataset is constructed using an image-mask-text data structure.

[0009] Furthermore, the visual branch includes a visual backbone and a path aggregation network; the visual backbone adopts a YOLO11 backbone network; and the path aggregation network adopts a PAN network.

[0010] Furthermore, the extraction of multi-scale visual features include: Image X from the camouflaged pest bimodal dataset is input into the visual branch, and multi-scale encoding is performed by the YOLO11 backbone network and path aggregation network to obtain multi-scale visual features. ; The extraction process is represented as follows: ; in, For multi-scale visual features, This indicates an emphasis on fine-grained edge detail features. This indicates an emphasis on mesoscale morphological and structural features. This indicates an emphasis on high-level semantic context features.

[0011] Furthermore, the text branch includes a text encoder, a prototype construction module, and an orthogonal feature purification module; the text encoder is used to refine the fine-grained text description. Encode to obtain image-level text vectors This constitutes a set of image-level text vectors. The prototype construction module is used for the image-level text vector set. Perform category prototype aggregation to obtain category-level semantic prototypes. This constitutes a category-level prototype set. The orthogonal feature purification module is used to orthogonally purify the dual-granularity semantic representation and extract and purify the category-level prototype. The dual-granularity semantic representation is derived from the category-level semantic prototype. and image-level text vectors constitute.

[0012] Furthermore, the acquisition of image-level text vectors include: The fine-grained text description The input text branch is processed using a text encoder with frozen parameters to describe the fine-grained text. Encode to obtain a d-dimensional embedding vector. ; For the d-dimensional embedding vector Performing L2 normalization yields image-level text vectors. ; Each text corresponds to an image-level text vector. This constitutes a set of image-level text vectors. ; in, A fine-grained text description of the i-th text. This represents the set of image-level text vectors representing the c-th type of camouflaged pests.

[0013] Furthermore, the acquisition of category-level semantic prototypes include: Based on the image-level text vector set Set the corresponding frequency weight. ; Frequency-weighted spherical K-Means learning semantic prototype ; The image-level text vector set and the corresponding frequency weight As clustering input, samples of each pest category are aggregated using temperature scaling based on cosine distance and frequency, and then normalized by L2 to obtain category-level semantic prototypes. By summarizing various prototypes, a category-level prototype set is obtained. ; in, Express the frequency weight of the i-th text. Represents the j-th semantic prototype. This represents the j-th category-level semantic prototype of the c-th camouflaged pest.

[0014] Furthermore, the calculation of multi-scale visual features and purification category-level prototype Similarity includes: Employing a multi-prototype maximum matching strategy For the multi-scale visual features and purification category-level prototype Perform L2 normalization; Based on the normalized multi-scale visual features and purification category-level prototype Calculate the cosine similarity to complete the similarity calculation.

[0015] Furthermore, the semantically guided mask generation module includes a mask prototype network and a prediction head, wherein the mask prototype network is used to output the multi-scale visual features. The corresponding pixel mask, the prediction head is used to determine the type of disguised pest; the output pixel-level instance mask includes: The multi-scale visual features Input the mask prototype network and output multiple corresponding pixel mask prototypes; Based on the multi-scale visual features Based on the similarity, the type of disguised pest is obtained through the prediction head; By combining the pixel mask prototype and the disguised pest type, pixel-text alignment is performed, and the maximum response of the pixel mask prototype at each pixel position is used as the category confidence value. When the category confidence value is greater than the preset confidence threshold, the corresponding pixel-level mask is output to obtain a continuous and closed pixel-level instance mask.

[0016] The beneficial effects of this invention are as follows: This invention targets insect pest monitoring and precision pesticide application scenarios. Based on a dual-modal dataset containing pixel-level masks and fine-grained text, it establishes a dual-granularity orthogonal contrastive semantic segmentation framework (DOCS-CPS): spatial location and boundaries are represented by multi-scale visual features, and image-level text descriptions and category-level prototypes constitute dual-granularity semantic priors, significantly improving foreground-background differentiation in camouflaged scenarios. Gated nonlinear enhancement and the most difficult negative sample orthogonal projection (GNEBlock+HNO) suppress interference from closely related categories, effectively alleviating fine-grained confusion among pests of the same family and genus. Semantic alignment is then used to complete pixel-text matching and instance mask generation, thereby achieving high-precision and robust segmentation in complex camouflaged fields, demonstrating good engineering application potential. Attached Figure Description

[0017] Figure 1 This is a flowchart of the method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrast semantics provided by the present invention; Figure 2 This is an overall structural diagram of the camouflaged pest segmentation model provided by the present invention. Detailed Implementation

[0018] The technical solution of the present invention is further described below, but the scope of protection is not limited to what is described.

[0019] This invention provides a method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics, such as... Figure 1 As shown, it includes the following steps: Step S100: Prepare a sample set of original images of camouflaged pests, perform preprocessing, and form a standardized image set of camouflaged pests. The image samples in the original image sample set of camouflaged pests come from the following sources: 1. Public datasets—agricultural pest identification datasets (such as IP102, Pest24, AgriPest), and segmentation datasets for camouflaged pests (such as Locust-Seg, Bollworm-Seg). The samples are publicly available natural field images with pest category labels or detection / segmentation box labels; 2. Online images, obtained by searching the Internet using the keywords "camouflaged pests" and "field pests." These are real photos taken in the fields of rice and corn crops, showing the natural state of pests attached to leaves or hidden in the canopy; 3. Field samples, collected by researchers in the field using cameras or drones, covering real insect images under different growth stages, light, and shading conditions. The above samples all belong to strongly camouflaged field environments: the individual pests are highly similar to the host leaves, stems, and soil in color, texture, and outline, the target area is small, and they cover multiple types of pests from Lepidoptera, Hemiptera, Coleoptera, and Hymenoptera (such as rice leaf rollers, locusts, leafhoppers, cutworms, etc.); in terms of content, each image simultaneously contains the pest's own area and its habitat background area (leaves, stems, soil, crop residues, etc.). After screening according to the degree of camouflage and category requirements, image deduplication, removal of blurred and misclassified samples, and expert review, the resolution and naming format were uniformly adjusted to form a standardized image set—that is, an image library with consistent format, no duplication, clear category labels, and suitable for subsequent masking and text annotation.

[0020] Therefore, each sample image in the original image sample set of camouflaged pests includes the pest's own body area and its habitat background area, which belongs to a strongly camouflaged field environment. The strongly camouflaged field environment refers to a field environment in which the individual pest is highly similar to the host's leaves, stems, and soil in terms of color, texture, and outline. The preprocessing of the original image sample set of camouflaged pests includes: filtering according to the degree of camouflage and category requirements, image deduplication, removal of blurred and misclassified samples, and uniform adjustment of resolution and naming format to form a standardized image set of camouflaged pests.

[0021] Step S200: Based on the standardized image set of camouflaged pests, perform initial image-level masking and fine-grained text description. A bimodal dataset of camouflaged pests is constructed; the data structure of the bimodal dataset of camouflaged pests is image-mask-text; The construction of the bimodal dataset of camouflaged pests includes: Using the SAM2 model and an open-source annotation platform, the standardized image set of camouflaged pests is initially annotated with instance-level masks to obtain pixel-level masks that correspond one-to-one with the images. The open-source annotation platform is X-AnyLabeling. A three-level mechanism of "SAM2 model pre-annotation + manual correction + expert review" is adopted: first, candidate masks are generated by SAM2, then the annotators correct the boundary adhesion and occlusion areas, and finally, domain experts are introduced for review.

[0022] Based on entomological knowledge description templates and combined with the open-source multimodal model Qwen3-VL, fine-grained text descriptions are generated in batches from the standardized image set of the camouflaged pests. This process forms high-quality image-text pairs. A high-quality image-text pair refers to each text that semantically corresponds to a local area of ​​the image in terms of category, body color, texture, morphology, and habitat background, is free of hallucinations, and can be combined with a mask. The entomological knowledge description template includes descriptions of target category, body color features, texture features, location features, and habitat background. This step is necessary to achieve visual-linguistic bimodal alignment and can significantly reduce the cost of manual writing.

[0023] Based on the pixel-level mask and fine-grained text description The camouflaged pest bimodal dataset is constructed using an image-mask-text data structure.

[0024] Step S300: Define a segmentation model with dual-granularity orthogonal contrast semantics. The segmentation model includes a visual branch, a text branch, a shared space, and a semantically guided mask generation module. The visual branch is used to extract multi-scale visual features from images in the camouflaged pest dual-modal dataset. The text branch is used to extract and purify category-level prototypes from the text in the camouflaged pest bimodal dataset. The shared space is used to compute multi-scale visual features. and purification category-level prototype The similarity; the semantically guided mask generation module is used to perform semantic guidance through pixel-text alignment and output pixel-level instance masks; The visual branch (multi-scale visual representation) includes a visual backbone and a path aggregation network; the visual backbone adopts a YOLO11 backbone network; the path aggregation network adopts a PAN network. The extraction of multi-scale visual features include: The image X from the camouflaged pest bimodal dataset is input into the visual branch, and multi-scale encoding is performed by the YOLO11 backbone network and the path aggregation network (PAN) to obtain multi-scale visual features. The YOLO11 backbone network extracts P3-P5 features; the image size of image X is... It can also be configured according to the deployed computing power. or .remember H represents the dimensionality of the input image, while H and W represent spatial resolutions at different scales. The extraction process is represented as follows: (1) in, For multi-scale visual features, , d represents the embedding dimension. , For the first Spatial resolution at each scale This indicates an emphasis on fine-grained edge detail features. This indicates an emphasis on mesoscale morphological and structural features. This indicates an emphasis on high-level semantic context features.

[0025] The multi-scale visual features Used for cross-modal alignment with purified text prototypes, multi-scale fusion can alleviate the significant fluctuations of camouflaged targets at different scales and improve the segmentation stability of small targets and weakly textured regions.

[0026] The text branch (text semantic construction) includes a text encoder, a prototype construction module, and an orthogonal feature purification module; the text encoder is used for fine-grained text description. Encode to obtain image-level text vectors This constitutes a set of image-level text vectors. The prototype construction module is used for the image-level text vector set. Perform category prototype aggregation to obtain category-level semantic prototypes. This constitutes a category-level prototype set. The orthogonal feature purification module is used to orthogonally purify the dual-granularity semantic representation and extract and purify the category-level prototype. The dual-granularity semantic representation is derived from the category-level semantic prototype. and image-level text vectors constitute.

[0027] The acquisition of image-level text vectors include: The fine-grained text description The input text branch is processed using a text encoder with frozen parameters to describe the fine-grained text. Encode to obtain a d-dimensional embedding vector. The text encoder is such as MobileCLIP; The d-dimensional embedding vector The expression is: (2) For the d-dimensional embedding vector Performing L2 normalization yields image-level text vectors. The L2 normalization is performed to normalize the vector. The modulus is scaled to 1 to eliminate length differences and facilitate subsequent similarity calculations; the image-level text vector The expression is: (3) Each text corresponds to an image-level text vector. This constitutes a set of image-level text vectors. ; in, A fine-grained text description of the i-th text. This represents the set of image-level text vectors representing the c-th type of camouflaged pests.

[0028] The acquisition of category-level semantic prototypes include: Based on the image-level text vector set , ,in, The number of unique texts; set the frequency weight for each unique text. (The resulting frequency weight set is denoted as) ); Frequency-weighted spherical K-Means learning semantic prototype (The resulting set of semantic prototypes is denoted as) The semantic center is constructed; the learning process is represented as follows: (4) Where M is the number of prototypes per class (range 1-16). The image-level text vector set and the corresponding frequency weight As clustering input, samples of each pest category are aggregated using temperature scaling based on cosine distance and frequency, and then normalized by L2 to obtain category-level semantic prototypes. By summarizing various prototypes, a category-level prototype set is obtained. The category-level semantic prototype The expression is: (5) in, Express the frequency weight of the i-th text. Represents the j-th semantic prototype. This represents the j-th category-level semantic prototype of the c-th type of camouflaged pest. This represents a learnable parameter that adjusts the aggregation weights.

[0029] The category-level semantic prototype and image-level text vectors Constructing a two-granularity semantic representation, image-level text vectors Preserving detailed differences between samples; category-level semantic prototypes Strengthen the distinction between classes; The orthogonal feature purification module is used to perform orthogonal purification on the dual-granularity semantic representation and extract and purify the category-level prototype. include: Let the category to which the current sample belongs be . The corresponding image-level text vector is From the category-level prototype set Select all non-target category prototypes to form a negative prototype set. .

[0030] The two are concatenated to construct a unified and purified input, which is then used as the text embedding: (6) in, For splicing text features ( (its dimensional size) For the number of categories, For the embedded dimension.

[0031] Will The input-gated nonlinear enhancement module GNEBlock amplifies the discriminative semantics related to pest morphology and texture through a dual-path gating structure, while suppressing redundant background descriptions such as leaves and soil. This process is represented as follows: (7) in, The projection matrices of the gated branches and the feature branches are given. To output the mapping matrix, For element-wise multiplication, This is the enhanced text semantic feature matrix.

[0032] right Perform hard negative sample orthogonalization (HNO): first perform... Perform L2 normalization on each line: (8) in, represent The semantic features of the m-th line of text; Next, calculate the mask cosine similarity matrix: (9) in, , For the number of categories, For the dediagonal mask matrix: (10) Where m represents The row represents A, and n represents the column of A; Subsequently through Top- Mechanism for extracting the direction of difficult negative interference: (11) in, Difficult to withstand interference direction, Keep the largest value in each row of the similarity matrix Values ​​( The preferred values ​​are 1 to 3, with 1 being the most desirable. Then, perform residual orthogonal projection along the less negative direction: (12) in, Residual orthogonal projection For the Sigmoid function, Learnable parameters for adjusting the intensity of residual projection.

[0033] Depend on The extracted purified category-level prototype (purified text embedding) is denoted as As output, the purified class-level prototype obtained at this point has weakened the projected components in the direction of near-marginal class interference. HNO is only enabled during the training phase and removed during the inference phase to reduce computational overhead.

[0034] The calculation of multi-scale visual features and purification category-level prototype Similarity includes: Employing a multi-prototype maximum matching strategy For the multi-scale visual features and purification category-level prototype L2 normalization is performed; the multi-prototype maximum matching strategy Represented as: (13) Based on the normalized multi-scale visual features and purification category-level prototype Calculate the cosine similarity to complete the similarity calculation.

[0035] The semantically guided mask generation module includes a mask prototype network and a prediction head, wherein the mask prototype network is used to output the multi-scale visual features. The corresponding pixel mask, the prediction head is used to determine the type of disguised pest; The output pixel-level instance mask includes: The multi-scale visual features Input the mask prototype network and output multiple corresponding pixel mask prototypes; Based on the multi-scale visual features Based on the similarity, the type of disguised pest is obtained through the prediction head; By combining the pixel mask prototype and the disguised pest type, pixel-text alignment is performed, and the maximum response of the pixel mask prototype at each pixel position is used as the category confidence value. When the category confidence value is greater than the preset confidence threshold, the corresponding pixel-level mask is output to obtain a continuous and closed pixel-level instance mask.

[0036] Step S400: Classify the camouflaged pest bimodal dataset into a training set and a validation set, and introduce a loss function. The segmentation model is trained to construct a camouflaged pest segmentation model (DOCS-CPS segmentation model); the ratio of the training set to the validation set is, for example, 8:2. After training, inference is performed on the edge of the test field image (such as a new field image obtained from the field sample) for pest location and precise pesticide application. The overall structure of the camouflaged pest segmentation model (DOCS-CPS segmentation model) is as follows: Figure 2 As shown.

[0037] The pixel-level instance mask is continuous and closed. The features of the pixel-level instance mask include shape features and color features. The shape features represent the appearance of the disguised pest, and the color features distinguish the type of disguised pest. The loss function includes semantic contrast loss. With segmentation loss .

[0038] Its shape reflects the appearance of camouflaged pests, and its color distinguishes the types of camouflaged pests. The loss function Including semantic contrast loss With segmentation loss The expression is: (14) in, and This is the loss weighting coefficient.

[0039] The training phase adopts a phased strategy: in the early stage, segmentation supervision is the main focus to ensure convergence stability, and in the later stage, contrastive constraints are gradually strengthened to improve inter-class separability.

[0040] During the inference phase, the input field image to be tested and its corresponding fine-grained text description are used, and MobileCLIP encoding is used to obtain the current sample image-level vector. and the purified class-level prototype saved offline during the training phase. They jointly participate in cross-modal alignment; the HNO module is disabled to reduce computational overhead.

[0041] Based on the constructed bimodal camouflaged pest dataset, the DOCS-CPS camouflaged pest segmentation model provided in this invention was compared with several existing models (YOLO11-L, YOLOv8-L, Mask R-CNN, Mask2Former (R101), Mask2Former (Swin-S), QueryInst, Cascade Mask R-CNN, RTMDet-Ins, Remamber) in a main comparative experiment. The experimental environment was NVIDIA A40, with 500 epochs of training. The evaluation metrics included mAP@50, mAP@75, and mAP@50-90. The experimental data are shown in Table 1. Table 1 Comparison results of the main control experiment

[0042] As shown in Table 1, the DOCS-CPS camouflage pest segmentation model provided by this invention achieves the best performance in all three main accuracy indicators, especially in mAP@50-90, which is significantly improved compared with the mainstream methods. This indicates that dual-granularity semantic modeling and orthogonal feature purification have a significant effect on suppressing camouflage interference.

[0043] The above-disclosed embodiments are merely specific examples of the present invention. However, the present invention is not limited thereto, and any variations that can be conceived by those skilled in the art should fall within the protection scope of the present invention.

Claims

1. A method for constructing a segmentation model for camouflaged pests based on dual-granularity orthogonal contrastive semantics, characterized in that, Includes the following steps: Prepare a sample set of original images of camouflaged pests, perform preprocessing, and form a standardized image set of camouflaged pests; Based on the standardized image set of camouflaged pests, image-level masking is initially annotated and fine-grained text descriptions are generated. A bimodal dataset of camouflaged pests is constructed; the data structure of the bimodal dataset of camouflaged pests is image-mask-text; A segmentation model with dual-granularity orthogonal contrastive semantics is defined, wherein the segmentation model includes visual branches, text branches, a shared space, and a semantically guided mask generation module; The visual branch is used to extract multi-scale visual features from images in the camouflaged pest bimodal dataset. The text branch is used to extract and purify category-level prototypes from the text in the camouflaged pest bimodal dataset. The shared space is used to compute multi-scale visual features. and purification category-level prototype The similarity; the semantically guided mask generation module is used to perform semantic guidance through pixel-text alignment and output pixel-level instance masks; The camouflaged pest bimodal dataset is classified into a training set and a validation set. A loss function is introduced to train the segmentation model and construct a camouflaged pest segmentation model. The text branch includes a text encoder, a prototype construction module, and an orthogonal feature purification module; the text encoder is used to refine the fine-grained text description. Encode to obtain image-level text vectors This constitutes a set of image-level text vectors. The prototype construction module is used for the image-level text vector set. Perform category prototype aggregation to obtain category-level semantic prototypes. This constitutes a category-level prototype set. The orthogonal feature purification module is used to orthogonally purify the dual-granularity semantic representation and extract and purify the category-level prototype. The dual-granularity semantic representation is derived from the category-level semantic prototype. and image-level text vectors constitute; The acquisition of category-level semantic prototypes Includes: based on the image-level text vector set Set the corresponding frequency weight. Frequency-weighted spherical K-Means learning is employed. semantic prototype The image-level text vector set and the corresponding frequency weight As clustering input, samples of each pest category are aggregated using temperature scaling based on cosine distance and frequency, and then normalized by L2 to obtain category-level semantic prototypes. By summarizing various prototypes, a category-level prototype set is obtained. ;in, Express the frequency weight of the i-th text. Represents the j-th semantic prototype. The j-th category-level semantic prototype represents the c-th type of camouflaged pest; The semantically guided mask generation module includes a mask prototype network and a prediction head, wherein the mask prototype network is used to output the multi-scale visual features. The corresponding pixel mask, the prediction head is used to determine the type of disguised pest; the output pixel-level instance mask includes: the multi-scale visual features The input to the mask prototype network outputs multiple corresponding pixel mask prototypes; based on the multi-scale visual features... Based on the similarity, the disguised pest type is obtained through the prediction head; pixel-text alignment is performed by combining the pixel mask prototype and the disguised pest type, and the maximum response of the pixel mask prototype at each pixel position is used as the category confidence value; when the category confidence value is greater than the preset confidence threshold, the corresponding pixel-level mask is output to obtain a continuous and closed pixel-level instance mask. The pixel-level instance mask features include shape features and color features. The shape features represent the appearance of the disguised pest, and the color features represent the type of disguised pest. The loss function includes semantic contrast loss. With segmentation loss .

2. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics as described in claim 1, characterized in that, Each sample image in the original image sample set of camouflaged pests includes the pest's body area and its habitat background area, which belongs to a strongly camouflaged field environment; the strongly camouflaged field environment refers to a field environment in which the individual pest is highly similar to the host's leaves, stems and soil in color, texture and outline. The preprocessing of the original image sample set of camouflaged pests includes: filtering according to the degree of camouflage and category requirements, image deduplication, removal of blurred and misclassified samples, and uniform adjustment of resolution and naming format to form a standardized image set of camouflaged pests.

3. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics as described in claim 2, characterized in that, The construction of the bimodal dataset of camouflaged pests includes: Using the SAM2 model and an open-source annotation platform, the standardized image set of camouflaged pests was initially annotated with instance-level masks to obtain pixel-level masks that correspond one-to-one with the images. Based on entomological knowledge description templates and combined with the open-source multimodal model Qwen3-VL, fine-grained text descriptions are generated in batches from the standardized image set of the camouflaged pests. This forms high-quality image-text pairs; the high-quality image-text pairs refer to each text that semantically corresponds to the local area of ​​the image in terms of category, body color, texture, shape and habitat background, has no illusionary representation, and can be combined with a mask; Based on the pixel-level mask and fine-grained text description The camouflaged pest bimodal dataset is constructed using an image-mask-text data structure.

4. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics as described in claim 3, characterized in that, The visual branch includes a visual backbone and a path aggregation network; the visual backbone adopts a YOLO11 backbone network; the path aggregation network adopts a PAN network.

5. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrast semantics as described in claim 4, characterized in that, The extraction of multi-scale visual features include: Image X from the camouflaged pest bimodal dataset is input into the visual branch, and multi-scale encoding is performed by the YOLO11 backbone network and path aggregation network to obtain multi-scale visual features. ; The extraction process is represented as follows: ; in, For multi-scale visual features, This indicates an emphasis on fine-grained edge detail features. This indicates an emphasis on mesoscale morphological and structural features. This indicates an emphasis on high-level semantic context features.

6. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics as described in claim 1, characterized in that, The acquisition of image-level text vectors include: The fine-grained text description The input text branch is processed using a text encoder with frozen parameters to describe the fine-grained text. Encode to obtain a d-dimensional embedding vector. ; For the d-dimensional embedding vector Performing L2 normalization yields image-level text vectors. ; Each text corresponds to an image-level text vector. This constitutes a set of image-level text vectors. ; in, A fine-grained text description of the i-th text. This represents the set of image-level text vectors representing the c-th type of camouflaged pests.

7. The method for constructing a camouflaged pest segmentation model based on dual-granularity orthogonal contrastive semantics as described in claim 1, characterized in that, The calculation of multi-scale visual features and purification category-level prototype Similarity includes: Employing a multi-prototype maximum matching strategy For the multi-scale visual features and purification category-level prototype Perform L2 normalization; Based on the normalized multi-scale visual features and purification category-level prototype Calculate the cosine similarity to complete the similarity calculation.

Citation Information

Patent Citations

  • Crop pest target detection method and system based on multi-scale feature and cross-level feature interaction

    CN120599219A

  • Self-decoupling image increment segmentation method guided by text data

    CN120355923A

  • Zero sample semantic segmentation method and device based on adaptive prompt and dynamic query

    CN121582588A