Dv stabilized and adaptive feature enhanced hash retrieval method for agricultural diseases

By combining the DFFormer backbone network and AFEBlock, the problems of complexity and fine-grained variability in agricultural disease image retrieval are solved, and efficient and accurate disease image retrieval is achieved.

CN121278128BActive Publication Date: 2026-02-24SHANDONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511843780.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-02-24
Estimated Expiration
2045-12-09

AI Technical Summary

Technical Problem

Existing deep hashing methods struggle to effectively fit the complexity and fine-grained variability of agricultural disease images in retrieval, resulting in insufficient retrieval efficiency and accuracy.

Method used

The DFFormer backbone network and the adaptive feature enhancement module (AFEBlock) are adopted. By combining channel grouping comparison, feature sparsification and local-global contrast enhancement mechanisms, the network parameters are optimized through the DV stabilization loss function to generate stable and discriminable hash codes.

Benefits of technology

It significantly improves the efficiency and accuracy of agricultural disease image retrieval, enhances the stability and discriminability of hash codes, and can effectively cope with the complexity and fine-grained variability of agricultural disease images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121278128B_ABST
    Figure CN121278128B_ABST
Patent Text Reader

Abstract

The application discloses a kind of DV stabilization and adaptive feature enhancement agricultural disease hash retrieval method, belong to agricultural disease image retrieval and depth hash technology field, including the following steps: step 1, obtain original disease image as the input of backbone network;Step 2, utilize backbone network to extract disease image feature;Step 3, based on adaptive feature enhancement module, enhance disease image feature, obtain adaptive image feature;Step 4, optimize network parameters by total loss function containing DV stabilization;Step 5, obtain binary hash code by hash layer;Step 6, the obtained hash code and the hash code of all images in the retrieval set obtained by the same method are sorted by hamming distance, return multiple disease images less than preset hamming distance.The application effectively improves the efficiency and precision of agricultural disease image retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural disease image retrieval, and more particularly to an agricultural disease hash retrieval method using DV stabilization and adaptive feature enhancement. Background Technology

[0002] Agricultural diseases are a key factor affecting grain yield and quality. Early detection and rapid response are of direct and significant importance for reducing losses and ensuring food security. With the widespread use of data acquisition methods such as mobile devices and drones, the agricultural sector has generated and accumulated a large number of disease images, providing a solid data foundation for image-based analysis in plant pathology research and practical agricultural applications. In this context, efficient and reliable content-based disease image retrieval has become a crucial bridge between data resources and intelligent diagnostic systems. On the one hand, retrieval systems can quickly locate similar lesion samples from a large number of historical cases, providing visual reference evidence for agricultural experts and assisting in diagnostic and treatment decisions. On the other hand, retrieval mechanisms support open set category expansion and few-sample identification, enabling the detection and identification of newly emerging or rare diseases without requiring complete model retraining. This capability is particularly important for field monitoring and rapid field response.

[0003] Compared to natural scenes or general classification images, agricultural disease images exhibit greater fine-grained variability and complexity. Their visual representations are influenced by factors such as crop species, disease type, ambient lighting, and imaging equipment, limiting the effectiveness of traditional depth features in disease scenes. Specifically, agricultural disease image retrieval faces the following three challenges: First, lesion areas exhibit significant channel heterogeneity; second, the salience distribution of lesion areas is highly unbalanced; and finally, the relationship between local patterns and global structure in disease images is complex.

[0004] Traditional content-based image retrieval systems are often limited by high computational complexity and large storage requirements. Hash techniques address these limitations by mapping high-dimensional data to a low-dimensional binary hash space, thus significantly improving computational and storage efficiency. Deep hashing methods utilize deep neural networks to automatically learn discriminative image features, achieving significant enhancements in retrieval accuracy and operational efficiency. However, these methods still have inherent limitations when applied to agricultural disease images.

[0005] In summary, current technologies, particularly deep hashing-based networks, still struggle to accurately capture the challenges of agricultural disease image retrieval. Therefore, there is an urgent need to develop an efficient method for retrieving agricultural disease images. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention discloses an agricultural disease hash retrieval method based on DV stabilization and adaptive feature enhancement. This method consists of a DFFormer backbone network and an adaptive feature enhancement module (AFEBlock). AFEBlock integrates three mechanisms: (1) channel grouping comparison enhances lesion-sensitive representation through inter-group weighting; (2) feature sparsity uses soft Top-K masks to suppress redundancy and highlight key responses; and (3) local-global contrast enhancement improves the separability of lesions from the background through local and contextual interaction. Furthermore, to enhance the stability and discriminability of the learned hash codes, a novel DV stabilization loss function is introduced.

[0007] To achieve the above objectives, the present invention adopts the following technical solution:

[0008] A method for hash-based retrieval of agricultural diseases using DV stabilization and adaptive feature enhancement includes the following steps:

[0009] Step 1: Obtain the original disease images as input to the backbone network;

[0010] Step 2: Extract disease image features using a backbone network;

[0011] Step 3: Based on the adaptive feature enhancement module, enhance the features of the disease image to obtain adaptive image features;

[0012] Step 4: Optimize network parameters using a total loss function with DV stabilization;

[0013] Step 5: Obtain the hash code through the hash layer;

[0014] Step 6: Sort the obtained hash codes with the hash codes of all images in the retrieval set obtained in the same way by Hamming distance, and return multiple disease images with a distance less than the preset Hamming distance.

[0015] Further, in step 2, the backbone network gradually reduces the feature map size to 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original disease image through four stages of downsampling. Each stage includes a downsampling block and a DFFormer block. The calculation process of each DFFormer block is as follows: the input feature tensor is first normalized and then fed into a dynamic filter to generate adaptive feature weights; the output after dynamic filter processing is added element-wise to the original input of the current DFFormer block through a residual connection to form the primary fusion feature; thereafter, the primary fusion feature is normalized again and then fed into a channel multilayer perceptron for nonlinear transformation; the output of the channel multilayer perceptron is finally added to the primary fusion feature through a second residual connection to form the final output of the current DFFormer block; the input of the first DFFormer block is the original disease image feature, the input of the second to fourth DFFormer blocks is the feature tensor output of the previous DFFormer block after downsampling, and the output of the fourth DFFormer block is the disease image feature. .

[0016] Furthermore, the specific process of step 3 is as follows:

[0017] Step 3.1: Analyze the image features of the disease. Three lightweight branches are performed to generate three complementary representations, namely the key vectors. Value vector Gating diagram :

[0018] ;

[0019] ;

[0020] ;

[0021] in, , , These are the length, height, and width, respectively. express Depthwise separable convolution operation; Represents the ReLU activation function; This represents the Sigmoid activation function;

[0022] Step 3.2: Employ a channel grouping comparison mechanism to enhance the value vector. This results in an enhanced multi-head feature;

[0023] Step 3.3: Obtain the multi-head features enhanced twice by the Top-K sparse selection mechanism;

[0024] Step 3.4: Perform local-global contrast enhancement on the secondary enhanced multi-head features.

[0025] Furthermore, the specific process of step 3.2 is as follows:

[0026] Step 3.2.1: Calculate the average vector for each group along the spatial dimension. :

[0027] ;

[0028] in, In dimension Calculate the mean along the direction; For multi-head attention vectors, the value vectors are... It is divided according to the attention points; Indicates the number of attention heads; This indicates the number of channels in each group; Represents spatial size, and dimension Correspondingly;

[0029] Step 3.2.2: The channel dimension is first divided into... Group; then, calculate the average in each group. Subsequently, the Softmax activation function was used to model the importance between groups, resulting in group weights. ;

[0030] ;

[0031] ;

[0032] in, In dimension Calculate the mean along the direction; for Grouped vectors after grouping; This represents the number of channels in each group, relative to the dimension. Correspondingly; Use the Softmax activation function;

[0033] The group weights are broadcast to each channel within the group, resulting in enhanced channel descriptors. :

[0034] ;

[0035] in, It is a scaling factor;

[0036] Step 3.2.3: Generate a scaling factor based on the channel descriptor. :

[0037] ;

[0038] in, It is a small constant;

[0039] Step 3.2.4: Finally, adjust the original multi-head attention vector:

[0040] ;

[0041] in, This is an enhanced multi-head feature.

[0042] Furthermore, the specific process of step 3.3 is as follows:

[0043] Step 3.3.1: Given a multi-head feature enhancement, firstly calculate the channel energy of each head by averaging the squares of the activation values ​​in the spatial dimension; then, based on the scaling parameter... Choose the one with the highest energy. One channel;

[0044] ;

[0045] ;

[0046] ;

[0047] in, For channel energy; The number of channels with the highest energy; A function to find the strongest channel index;

[0048] Step 3.3.2: Construct a soft mask:

[0049] ;

[0050] in, The first in the matrix Line number The soft mask corresponding to the column, the first The row corresponds to the first The first channel, the... Column corresponding to the first One channel; For the front The highest energy channel Index of each channel; It is the residual weight;

[0051] Then, the soft mask is normalized to obtain the soft mask matrix:

[0052] ;

[0053] in, This is the total soft mask matrix; for The The soft mask corresponding to the row;

[0054] Finally, the soft mask matrix is ​​broadcast to the spatial dimension and applied to the first-enhanced multi-head features to obtain the second-enhanced multi-head features. :

[0055] .

[0056] Furthermore, the specific process of step 3.4 is as follows:

[0057] Step 3.4.1: Obtain the multi-head features with secondary enhancement. Then, it is reconstructed back to the original channel dimension to obtain the global features. global features Encode the overall semantic representation of the disease image, capturing the consistent texture and structural patterns of the entire diseased area:

[0058] ;

[0059] in, A function for readjusting the shape of features;

[0060] Step 3.4.2: Convert the key vector As a local feature, a local-global contrast enhancement mechanism is used to adaptively fuse the key vector. and global features Meanwhile, using gating graphs An adaptive weighting is applied to the fusion of local and global features to obtain an enhanced gating graph. :

[0061] ;

[0062] ;

[0063] in, This is a comparison chart;

[0064] Step 3.4.3: Combining the local and global features of the enhanced gating graph modulation, a refined feature representation is obtained. And apply a learnable hierarchical scaling factor. Perform stability optimization:

[0065] ;

[0066] ;

[0067] in, This is the final adaptive image feature.

[0068] Furthermore, in step 4, the total loss function is defined as follows:

[0069] ;

[0070] in, This is the total loss function; For the new DV stabilization loss; Loss at the center; To quantify the loss; and It is a hyperparameter that balances the contribution of each loss component;

[0071] The formula for the new DV stabilization loss is as follows:

[0072] ;

[0073] in, Indicates batch size; For the first The positive sample pairs corresponding to the images; For the first The expected value of the negative sample pairs corresponding to the images;

[0074] The formula for center loss is as follows:

[0075] ;

[0076] in, Total number of images; Indicates the first The final sample hash code of the image; For the first The predefined hash center for each category of the image;

[0077] The formula for quantization loss is as follows:

[0078] ;

[0079] in, Represents the first consecutive hash code dimension; It is the length of the hash code.

[0080] Furthermore, in step 5, the hash layer consists of a linear layer, through which the obtained adaptive image features are processed. Mapped to a hash code of the corresponding length.

[0081] Furthermore, in step 6, the retrieval set is a dataset pre-divided from the agricultural disease image database; the same method refers to processing all images in the retrieval set according to the same process as in steps 1-5.

[0082] The beneficial effects of this invention are as follows: This invention addresses the challenges of agricultural disease image retrieval. Existing image hashing models are mostly applied in the public domain and cannot accurately fit the difficulties inherent in agricultural disease images. To solve this problem, this invention proposes a novel agricultural disease image hashing framework that integrates DFFormer, AFEBlock, and DV stabilization loss. This framework effectively addresses the difficulties in agricultural disease image retrieval tasks, significantly improving the efficiency and accuracy of agricultural disease image retrieval. Attached Figure Description

[0083] Figure 1 This is a flowchart of the agricultural disease hash retrieval method with DV stabilization and adaptive feature enhancement of the present invention. Detailed Implementation

[0084] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0085] The method of this invention consists of a DFFormer backbone network and an adaptive feature enhancement module (AFEBlock). AFEBlock first groups and models feature channels through a channel grouping and comparison mechanism, introducing weighted comparisons between groups to strengthen the channel responses sensitive to lesion areas, thereby improving the expressive power of disease-related semantics. Then, through a feature sparsity mechanism based on soft Top-K masks, redundant channels are suppressed and salient structures are highlighted, allowing key discriminative information of lesion areas to be highlighted in high-dimensional features. Finally, a local-global contrast enhancement mechanism interactively models local fine-grained cues with global context to improve the separability between lesion structures and background areas. Furthermore, to improve the stability and discriminative power of hash codes, this invention proposes a novel DV stabilization loss function to reduce inconsistencies caused by representation perturbations and enhance cross-sample discrimination.

[0086] A DV-stabilized and adaptive feature-enhanced agricultural disease hash retrieval method, such as Figure 1 As shown, it includes the following steps:

[0087] Step 1: Obtain the original disease images as input to the backbone network;

[0088] Step 2: Extract disease image features using a suitable backbone network. ;

[0089] This invention specifically selects DFFormer as the backbone network. It progressively reduces the feature map size to 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original disease image size through four stages of downsampling. Each stage includes a downsampling block and a DFFormer Block. The computation process of each DFFormer Block is as follows: the input feature tensor is first normalized and then fed into a dynamic filter to generate adaptive feature weights. The output after dynamic filtering is added element-wise to the original input of the current DFFormer Block through a residual connection to form the primary fusion feature. Subsequently, the primary fusion feature is normalized again and then fed into a channel multilayer perceptron for nonlinear transformation to enhance inter-channel information interaction. The output of the channel multilayer perceptron is finally added to the primary fusion feature through a second residual connection to form the final output of the current DFFormer Block. The input of the first DFFormer Block is the original disease image features; the input of the second to fourth DFFormer Blocks is the feature tensor output from the previous DFFormer Block after downsampling; and the output of the fourth DFFormer Block is the disease image features. .

[0090] Step 3: Based on the adaptive feature enhancement module, enhance the features of the disease image to obtain adaptive image features; specifically including:

[0091] Step 3.1: Analyze the image features of the disease. Three lightweight branches are performed to generate three complementary representations, namely the key vectors. Value vector Gating diagram :

[0092] (1);

[0093] (2);

[0094] (3);

[0095] in, , , These are the length, height, and width, respectively. express Depthwise separable convolution operation; Represents the ReLU activation function; This represents the Sigmoid activation function.

[0096] Step 3.2: Employ a channel grouping comparison mechanism to enhance the value vector. This yields an enhanced multi-head feature; the specific process is as follows:

[0097] Step 3.2.1: Calculate the average vector for each group along the spatial dimension. :

[0098] (4);

[0099] in, In dimension Calculate the mean along the direction; For multi-head attention vectors, the value vectors are... It is divided according to the attention points; Indicates the number of attention heads; This indicates the number of channels in each group; Represents spatial size, and dimension Correspondingly, .

[0100] Step 3.2.2: The channel dimension is first divided into... Group the data (with zero-padding if the data is indivisible); then calculate the average within each group. Subsequently, the Softmax activation function was used to model the importance between groups, resulting in group weights. ;

[0101] (5);

[0102] (6);

[0103] in, In dimension Calculate the mean along the direction; for Grouped vectors after grouping; This represents the number of channels in each group, relative to the dimension. Correspondingly, ; Use the Softmax activation function;

[0104] These group weights are broadcast to each channel within the group and used to amplify the channel group with greater information content; after reorganizing the channel groups, enhanced channel descriptors are obtained. :

[0105] (7);

[0106] in, It is a scaling factor.

[0107] Step 3.2.3: Generate a scaling factor based on the channel descriptor. :

[0108] (8);

[0109] in, It is a small constant used to prevent division by zero.

[0110] Step 3.2.4: Finally, adjust the original multi-head attention vector:

[0111] (9);

[0112] in, This is an enhanced multi-head feature;

[0113] Step 3.3: Obtain multi-head features enhanced twice by the Top-K sparse selection mechanism; the specific process is as follows:

[0114] Step 3.3.1: Given a multi-head feature enhancement, firstly calculate the channel energy of each head by averaging the squares of the activation values ​​in the spatial dimension; then, based on the scaling parameter... Choose the one with the highest energy. One channel;

[0115] (10);

[0116] (11);

[0117] (12);

[0118] in, For channel energy; The number of channels with the highest energy; A function to find the strongest channel index;

[0119] Step 3.3.2: This invention constructs a soft mask to retain a small portion of information from non-Top-K channels:

[0120] (13);

[0121] in, The first in the matrix Line number The soft mask corresponding to the column, the first The row corresponds to the first The first channel, the... Column corresponding to the first One channel; For the front The highest energy channel Index of each channel; This is the index of the current channel; This is the residual weight, which is usually very small; in this invention, it is set to 0.05.

[0122] Then, the soft mask is normalized to obtain the soft mask matrix to ensure energy balance:

[0123] (14);

[0124] in, This is the total soft mask matrix; for The The soft mask corresponding to the row.

[0125] Finally, the soft mask matrix is ​​broadcast to the spatial dimension and applied to the first-enhanced multi-head features to obtain the second-enhanced multi-head features. :

[0126] (15);

[0127] Step 3.4: Perform local-global contrast enhancement on the secondary enhanced multi-head features; the specific process is as follows:

[0128] Step 3.4.1: Obtain the multi-head features with secondary enhancement. Then, it is reconstructed back to the original channel dimension to obtain the global features. global features Encode the overall semantic representation of the disease image, capturing the consistent texture and structural patterns of the entire diseased area:

[0129] (16);

[0130] in, A function for readjusting the shape of features;

[0131] Step 3.4.2: Local-global contrast enhancement mechanism adaptively fuses key vectors. (As local features) and global features Meanwhile, using gating graphs An adaptive weighting is applied to the fusion of local and global features to obtain an enhanced gating graph. :

[0132] (17);

[0133] (18);

[0134] in, This comparison image highlights areas where local and global features differ significantly.

[0135] Step 3.4.3: Finally, by combining the local and global features of the enhanced gating graph modulation, a refined feature representation is obtained. And apply a learnable layer scale factor. Perform stability optimization:

[0136] (19);

[0137] (20);

[0138] in, This is the final adaptive image feature;

[0139] This local-global fusion scheme dynamically balances detail preservation and semantic consistency, allowing the network to maintain robustness to changes in background and lighting while emphasizing subtle lesion textures.

[0140] Step 4: Optimize network parameters using a total loss function with DV stabilization; details are as follows:

[0141] The overall loss function of the deep hashing framework proposed in this invention incorporates the novel DV stabilization loss. Central loss and quantification loss Total loss function Defined as:

[0142] (twenty one);

[0143] in, and It is a hyperparameter that balances the contribution of each loss component.

[0144] The new DV stabilization loss is learned by employing the Donsker-Varadhan (DV) lower bound estimate to obtain the set of image hash codes. With the corresponding set of semantic tags Mutual information between the two. Mutual information provides a principled measure of statistical dependence, and therefore serves as a theoretical goal for maintaining semantic consistency in the learned representations. The lower bound of DV is expressed as:

[0145] (twenty two);

[0146] in, For image hash code set Its corresponding semantic tag set Mutual information; In joint distribution Calculate the expectation above; For distribution at the edge and Calculate the expectation on the product; Represents a learnable evaluation function; It is a hash code; For semantic tags.

[0147] In practice, directly optimizing this lower bound often leads to severe numerical instability. (Exponential term) right The scale and variance are highly sensitive; as the hash dimension (bit length) increases, the evaluator output becomes increasingly dispersed, leading to... This growth is exponential, leading to numerical overflow and gradient explosion, which hinders stable training and convergence. To overcome this limitation, this invention proposes a novel DV stabilization loss, introducing two complementary improvements.

[0148] First, use The reparameterization mechanism for numerical stability reformulates the negative expectation term, allowing computation to remain in the logarithmic domain, thus avoiding direct exponentiation. In the case of mini-batch processing, let... The positive and negative pairs are represented as:

[0149] (twenty three);

[0150] (twenty four);

[0151] in, Indicates batch size; For the first Zhang Image and the Negative sample pairs formed from Zhang's images; An adaptive scaling control network, used for adaptive adjustment Size and variance; For the first The hash code of the image; For the first Semantic tags for the images; For the first The positive sample pairs formed by the image and itself; For the first The positive sample pairs corresponding to the images; For the first The expected value of the negative sample pairs corresponding to the images; To calculate the logarithmic function of the exponential sum of a set of numbers;

[0152] Secondly The output size is dynamically adjusted. Specifically, the tanh activation function is first applied to constrain the range of the hash output, and then the bounded hash vector and label vector are concatenated. , The length of the hash code. Let be the number of image categories. Then map these categories to a compact multilayer perceptron. :

[0153] (25);

[0154] in, Linear layer;

[0155] This small yet effective evaluator dynamically adjusts its output size during training to ensure... Keep the numbers within a stable range.

[0156] By integrating these two mechanisms— Numerical stability reparameterization and adaptive scaling control networks The proposed new DV stabilization loss preserves the theoretical rigor of the DV bound while effectively suppressing gradient explosion in high-bit hashing. The final new DV stabilization loss function is defined as:

[0157] (26);

[0158] The above design significantly improves convergence stability, training robustness, and retrieval performance.

[0159] Center loss enhances the discriminative power of learned hash codes by limiting the distance between feature vectors and their corresponding class centers. This method predefines a hash center for each class and drives hash codes of the same class to cluster towards that center, while distancing them from other class centers. Its formula can be defined as:

[0160] (27);

[0161] in, Total number of images; Indicates the first The final sample hash code of the image is generated by another... dimensional hash code Through linear transformation What was obtained Dimension and length of hash code Correspondingly; similarly, the first Predefined hash centers for each image category It is also obtained in the same way, i.e., by the hash center. Through linear transformation The calculation yielded the result.

[0162] Quantization loss introduces a quantization loss term, constraining the continuous outputs of the hash network to approximate binary values. Due to gradient optimization, the hash code output by the network... Since they are continuous, directly thresholding them would introduce quantization error. Quantization loss mitigates this problem by explicitly minimizing the deviation of each hash element from its nearest binary state, and can be expressed as:

[0163] (28);

[0164] in, Represents the first consecutive hash code dimension; It is the length of the hash code.

[0165] Step 5: Obtain the binary hash code through the hash layer;

[0166] The hash layer consists of a linear layer that generates adaptive image features. Mapped to a hash code of the corresponding length.

[0167] Step 6: Sort the obtained hash codes with the hash codes of all images in the retrieval set obtained by the same method using Hamming distance, and return multiple disease images with a distance less than the preset Hamming distance; the retrieval set is a dataset pre-divided from the agricultural disease image database; the same method refers to processing all images in the retrieval set according to the same process as steps 1-5.

[0168] To demonstrate the feasibility and superiority of this invention, the following experiment is presented.

[0169] Taking the agricultural disease-specific dataset ADTV68 and two public datasets, Stanford Cars (fine-grained dataset) and CIFAR10 (coarse-grained dataset), as examples, the mean average precision (mAP) was calculated. Table 1 shows the comparison of retrieval performance of different deep hashing methods on the agricultural disease-specific dataset ADTV68. The best results are highlighted in bold, and the second best results are shown underlined. HashNet uses a continuation strategy to gradually transition from smooth activation to sign activation to directly learn accurate binary hash codes; DCH designs pairwise loss and quantization terms based on Cauchy distribution, emphasizing strong penalties for similar pairs within a given Hamming radius to generate more compact, concentrated hash codes suitable for Hamming space retrieval; DPN introduces bit-by-bit polarization loss to push channel outputs away from 0 polarization states, making the representation naturally approximate ±1 and reducing dependence on additional quantization terms; DBDH directly learns binary codes within a discrete optimization framework, while adding balance constraints to ensure uniform distribution of bits, thereby improving retrieval and representation performance; CSQ proposes a "hash center" metric, using a pre-defined hash center to cluster codes of similar samples towards a common center to improve intra-class consistency and global discriminative power; DICTH, through Transformer... Internally, a cross-layer internal connection structure is constructed to enhance local-global semantic interaction, thereby learning more stable and discriminative binary hash codes; Center-Hashing strictly constrains the inter-class structure through learnable hash centers with minimum distance separation, so that hash codes of the same class converge to the center and different classes maintain maximum separation; CFBH combines causal feature learning and binary injection mechanism to suppress class bias and training overfitting in fine-grained retrieval, thereby generating more generalizable hash representations.

[0170] As shown in Table 1, the method proposed in this invention achieves the highest mAP score across all hash lengths, demonstrating its superior ability to learn more discriminative and robust hash codes for agricultural disease images. Compared to CSQ, this method improves performance by 0.7% with a hash code length of 16 bits, 0.8% with a hash code length of 32 bits, and 0.6% with a hash code length of 64 bits.

[0171] Table 1. Comparison of retrieval performance of different depth hashing methods on the ADTV68 dataset.

[0172] .

[0173] Table 2 shows a comparison of the retrieval performance of different deep hashing methods on the Stanford Cars and CIFAR-10 datasets. The best results are highlighted in bold, and the second best results are shown underlined. The proposed method achieves the highest mAP score on both datasets for all hash lengths. On the Stanford Cars dataset, the method achieves an mAP of 0.878 for 32-bit hashing and 0.894 for 64-bit hashing, which are 0.5% and 1.3% higher than the second-best center hashing method, respectively. On the CIFAR-10 dataset, the proposed method achieves mAPs of 0.933 and 0.930 for 32-bit and 64-bit hashing, respectively, which are 8.5% and 8.2% higher than the second-best center hashing method, respectively. These results confirm the effectiveness and versatility of the proposed deep hashing framework in various image retrieval tasks.

[0174] Table 2. Comparison of retrieval performance of different depth hashing methods on the Stanford Cars and CIFAR10 datasets.

[0175] .

[0176] The experimental results above demonstrate that the agricultural disease image hashing method proposed in this invention is not only applicable to agricultural disease image retrieval tasks, but also exhibits strong generalization ability on other public domain datasets.

[0177] Of course, the above description is not intended to limit the present invention, and the present invention is not limited to the examples given above. Any changes, modifications, additions or substitutions made by those skilled in the art within the scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. A DV stabilization and adaptive feature enhancement method for agricultural disease hash retrieval, characterized in that, Includes the following steps: Step 1: Obtain the original disease images as input to the backbone network; Step 2: Extract disease image features using a backbone network; the backbone network gradually reduces the feature map size to 1 / 4, 1 / 8, 1 / 16 and 1 / 32 of the original disease image through four stages of downsampling. Each stage includes a downsampling block and a DFFormer block; the calculation process of each DFFormer block is as follows: the input feature tensor is first normalized and then fed into a dynamic filter to generate adaptive feature weights; The output after dynamic filtering is added element-wise to the original input of the current DFFormer block through a residual connection to form the primary fusion feature. This primary fusion feature is then normalized again and fed into a channel multilayer perceptron for nonlinear transformation. The output of the channel multilayer perceptron is finally added to the primary fusion feature through a second residual connection to form the final output of the current DFFormer block. The input to the first DFFormer block is the original disease image feature; the inputs to the second to fourth DFFormer blocks are the feature tensors output from the previous DFFormer block after downsampling; and the output of the fourth DFFormer block is the disease image feature. ; Step 3: Based on the adaptive feature enhancement module, enhance the features of the disease image to obtain adaptive image features; the specific process is as follows: Step 3.1: Analyze the image features of the disease. Three lightweight branches are performed to generate three complementary representations, namely the key vectors. Value vector Gating diagram : ; ; ; in, , , These are the length, height, and width, respectively. express Depthwise separable convolution operation; Represents the ReLU activation function; This represents the Sigmoid activation function; Step 3.2: Employ a channel grouping comparison mechanism to enhance the value vector. This yields an enhanced multi-head feature; the specific process is as follows: Step 3.2.1: Calculate the average vector for each group along the spatial dimension. : ; in, In dimension Calculate the mean along the direction; For multi-head attention vectors, the value vectors are... It is divided according to the attention points; Indicates the number of attention heads; This indicates the number of channels in each group; Represents spatial size, and dimension Correspondingly; Step 3.2.2: The channel dimension is first divided into... Group; then, calculate the average in each group. Subsequently, the Softmax activation function was used to model the importance between groups, resulting in group weights. ; ; ; in, In dimension Calculate the mean along the direction; for Grouped vectors after grouping; This represents the number of channels in each group, relative to the dimension. Correspondingly; Use the Softmax activation function; The group weights are broadcast to each channel within the group, resulting in enhanced channel descriptors. : ; in, It is a scaling factor; Step 3.2.3: Generate a scaling factor based on the channel descriptor. : ; in, It is a small constant; Step 3.2.4: Finally, adjust the original multi-head attention vector: ; in, This is an enhanced multi-head feature; Step 3.3: Obtain multi-head features enhanced twice by the Top-K sparse selection mechanism; the specific process is as follows: Step 3.3.1: Given a multi-head feature enhancement, firstly calculate the channel energy of each head by averaging the squares of the activation values ​​in the spatial dimension; then, based on the scaling parameter... Choose the one with the highest energy. One channel; ; ; ; in, For channel energy; The number of channels with the highest energy; A function to find the strongest channel index; Step 3.3.2: Construct a soft mask: ; in, The first in the matrix Line number The soft mask corresponding to the column, the first The row corresponds to the first The first channel, the... Column corresponding to the first One channel; For the front The highest energy channel Index of each channel; It is the residual weight; Then, the soft mask is normalized to obtain the soft mask matrix: ; in, This is the total soft mask matrix; for The The soft mask corresponding to the row; Finally, the soft mask matrix is ​​broadcast to the spatial dimension and applied to the first-enhanced multi-head features to obtain the second-enhanced multi-head features. : ; Step 3.4: Perform local-global contrast enhancement on the secondary enhanced multi-head features; the specific process is as follows: Step 3.4.1: Obtain the multi-head features with secondary enhancement. Then, it is reconstructed back to the original channel dimension to obtain the global features. global features Encode the overall semantic representation of the disease image, capturing the consistent texture and structural patterns of the entire diseased area: ; in, A function for readjusting the shape of features; Step 3.4.2: Convert the key vector As a local feature, a local-global contrast enhancement mechanism is used to adaptively fuse the key vector. and global features Meanwhile, using gating graphs An adaptive weighting is applied to the fusion of local and global features to obtain an enhanced gating graph. : ; ; in, This is a comparison chart; Step 3.4.3: Combining the local and global features of the enhanced gating graph modulation, a refined feature representation is obtained. And apply a learnable hierarchical scaling factor. Perform stability optimization: ; ; in, The final adaptive image features; Step 4: Optimize network parameters using a total loss function with DV stabilization; the total loss function is defined as follows: ; in, This is the total loss function; For the new DV stabilization loss; Loss at the center; To quantify the loss; and It is a hyperparameter that balances the contribution of each loss component; The formula for the new DV stabilization loss is as follows: ; in, Indicates batch size; For the first The positive sample pairs corresponding to the images; For the first The expected value of the negative sample pairs corresponding to the images; The formula for center loss is as follows: ; in, Total number of images; Indicates the first The final sample hash code of the image; For the first The predefined hash center for each category of the image; The formula for quantization loss is as follows: ; in, Represents the first consecutive hash code dimension; It is the length of the hash code; Step 5: Obtain the hash code through the hash layer; Step 6: Sort the obtained hash codes with the hash codes of all images in the retrieval set obtained in the same way by Hamming distance, and return multiple disease images with a distance less than the preset Hamming distance.

2. The agricultural disease hash retrieval method with DV stabilization and adaptive feature enhancement according to claim 1, characterized in that, In step 5, the hash layer consists of a linear layer, through which the obtained adaptive image features are processed. Mapped to a hash code of the corresponding length.

3. The agricultural disease hash retrieval method based on DV stabilization and adaptive feature enhancement according to claim 1, characterized in that, In step 6, the retrieval set is a dataset pre-divided from the agricultural disease image database; the same method refers to processing all images in the retrieval set according to the same process as in steps 1-5.

Citation Information

Patent Citations

  • Attribute perceptual hash coding learning method in large-scale fine-grained image retrieval

    CN113656632A

  • Scene understanding method and system for multi-level image feature extraction

    CN120070914A