Pineapple seedling cross-domain classification method based on convolutional neural network and domain adaptation

CN122200128BActive Publication Date: 2026-10-27SOUTH SUBTROPICAL CROP RES INST CHINA ACAD OF TROPICAL AGRI SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610327420.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-03-18
Publication Date
2026-10-27
Estimated Expiration
2046-03-18

AI Technical Summary

Technical Problem

菠萝苗作为一种经济价值高的作物,其生长过程中的病虫害监测、幼苗管理及生长环境适应性分析,均依赖于对菠萝苗的准确识别与分类,传统的手工观察和人工分类方法效率低、误差大,难以满足大规模种植的需求,因此,迫切需要借助计算机视觉与深度学习等先进技术来实现对菠萝苗的自动化识别与分类

Benefits of technology

本方案采用双通路编码模型,能够有效融合田间环境特征与幼苗本体特征,分别提取全局环境特征和局部细节特征,从而实现对菠萝苗在不同生长环境下的准确分类,通过动态生成环境通道权重,模型能够自适应地关注不同环境下菠萝苗的关键特征,这一过程使得分类模型对变化环境的适应性大幅增强,能够有效处理不同气候条件、光照强度及土壤类型下的菠萝苗图像;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122200128B_ABST
    Figure CN122200128B_ABST
Patent Text Reader

Abstract

The application discloses a pineapple seedling cross-domain classification method based on a convolutional neural network and domain self-adaption, and relates to the technical field of image processing, and comprises the following steps: generating a simulation image of a field pineapple seedling as a source domain image, and performing regional labeling on the simulation image to form a source domain image dataset; a double-channel coding model is constructed to extract a global environment feature vector and a local detail feature map; based on the global environment feature vector, an environment channel weight is dynamically generated to perform channel weighting on the local detail feature map to obtain an environment self-adaptive fusion feature map; the global environment feature vector is used to determine an environment difficulty level, and an environment weighted source domain segmentation loss is calculated; the initial source domain image and the fusion feature map are used as input to train a cross-domain classification model, and domain self-adaptive segmentation of an actual field pineapple seedling image is realized, a relatively high recognition rate can be maintained, and the learning efficiency of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, specifically to a cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation. Background Technology

[0002] In agriculture, especially in modern planting management, precise plant monitoring and classification techniques are crucial for improving crop yield and quality. As a high-value crop, pineapple seedlings rely heavily on accurate identification and classification for pest and disease monitoring, seedling management, and environmental adaptability analysis. Traditional manual observation and classification methods are inefficient and prone to errors, making them unsuitable for large-scale planting. Therefore, there is an urgent need to utilize advanced technologies such as computer vision and deep learning to automate the identification and classification of pineapple seedlings.

[0003] Existing technologies primarily utilize convolutional neural networks for image classification and recognition, achieving significant results in image analysis of various plants. By training models to identify the characteristics of specific plants, existing technologies can effectively classify and segment plants. However, the performance of existing deep learning models degrades under different growth environments and climate changes, requiring a large amount of training data from various environments. In reality, it is difficult to obtain complete images of pineapple seedlings in different environments, resulting in insufficient adaptability of the trained classification models. This leads to difficulties in practical applications, especially when environmental characteristics change significantly, resulting in a significant decrease in classification accuracy.

[0004] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this invention is to provide a cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation, so as to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: A cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation, comprising the following steps: Several simulated images of pineapple seedlings in the field are generated and denoted as the initial source domain images. The pineapple seedling regions in the source domain images are labeled, and the labeled source domain images are mapped one by one with the initial source domain images before labeling to form a source domain image dataset. A dual-path coding model is constructed, which includes a field environment perception pathway and a seedling ontology analysis pathway. The dual-path coding model is based on a convolutional neural network framework. Based on the dual-path coding model, global environmental features and local seedling features are extracted from the initial source domain image to generate a global environmental feature vector and a local detail feature map. Based on the global environment feature vector, environment channel weights are dynamically generated. Using the environment channel weights, the local detail feature map is subjected to channel weighting processing to obtain an environment-adaptive fusion feature map. Based on the global environment feature vector, the difficulty level of the environment is determined, and a corresponding loss scaling factor is assigned accordingly. The standard segmentation loss of the initial source domain image is weighted using the loss scaling factor to obtain the environment-weighted source domain segmentation loss. A cross-domain classification model is constructed, taking the initial source domain image and the corresponding fused feature map as input, the environment-weighted source domain segmentation loss as the loss function, and the labeled source domain image as the label. The cross-domain classification model is trained, and the actual image of pineapple seedlings in the field is recorded as the target domain image to be identified and input into the cross-domain classification model to achieve domain-adaptive pineapple seedling segmentation.

[0007] Furthermore, several simulated images of pineapple seedlings in the field are generated, and the generated simulated images are preprocessed. The image preprocessing specifically includes size and pixel channel unification, image denoising, and edge enhancement preprocessing. The image denoising specifically involves denoising the source domain image using a wavelet transform denoising method, and the edge enhancement preprocessing specifically involves enhancing the edges of the source domain image using bilateral filtering. The specific method for annotating the pineapple seedling region in the source domain image is as follows: use manual annotation, select the annotation tool, and use polygon regions to annotate the outline of the pineapple seedling region in each source domain image.

[0008] Furthermore, the field environment perception pathway is constructed using a lightweight convolutional neural network to extract overall field environment features; the seedling ontology parsing pathway is constructed using a ResNet network structure to extract local features of pineapple seedlings. The global environmental feature vector includes overall lighting conditions, background type, and occlusion degree. The occlusion degree specifically refers to the proportion of occluded area in the pineapple seedling region. The overall lighting conditions specifically include overexposure, shadow, and natural light. The background type specifically includes soil, mulch film, and weed leaves. The local detail feature map includes the regional morphology, texture, and spectral data of the pineapple seedling.

[0009] Furthermore, the specific method for dynamically generating environmental channel weights is as follows: based on the number of fully connected layers in the field environment perception pathway, the global environmental feature vector is extracted in parallel into the corresponding environmental semantic representation, which is specifically represented as follows: In the formula, To pass the first The environmental semantic representation extracted by each fully connected layer The input is the global environment feature vector. For the first The weight matrix of each fully connected layer For the first The bias vector of each fully connected layer This represents the activation function, where i is the index of the fully connected layer; Based on the feature channel dimension of the global environment feature vector, the feature channels of the global environment feature vector are grouped. Based on the environmental semantic representations output by different fully connected layers, these groups are concatenated on different feature channel groups to obtain the environment fusion feature vector. The environment fusion feature vector is specifically represented as follows: In the formula, Let j be the environmental fusion feature vector of the j-th feature channel group. This indicates a splicing operation. To fuse the weight matrix, Here, j is the index of the feature channel group; The global importance score for each feature channel group is determined based on the environmental fusion feature vector. The specific calculation method is as follows: In the formula, The global importance score of the j-th feature channel group is... This represents the activation function. For feature channel prediction weight matrix, Predict bias vectors for feature channels; Based on the global importance score of each feature channel group, and combined with the fine-grained weights of each feature channel group, the environment channel weight is the element-wise product of the global importance score and the fine-grained weights, specifically expressed as: In the formula, Let the environmental channel weights be those of the j-th feature channel group. For the fine-grained weights of the j-th feature channel group, This represents element-wise multiplication.

[0010] Furthermore, the specific method for obtaining the environment-adaptive fusion feature map is as follows: based on the environment channel weights of each feature channel, a channel-by-channel multiplication operation is performed with the local detail feature map to obtain a preliminary weighted feature map. The preliminary weighted feature map is then added element-by-element to the local detail feature map to obtain the final environment-adaptive fusion feature map. The specific formula used to calculate the environment-adaptive fusion feature map is as follows: In the formula, For environment-adaptive fusion feature maps, This is a preliminary weighted feature map. This represents channel-wise multiplication. This is the set of environmental channel weights, specifically representing the combination of environmental channel weights for each feature channel. Feature channels within the same feature channel group have the same environmental channel weight.

[0011] Furthermore, the specific method for determining the environmental difficulty level based on the global environmental feature vector includes: clustering the global environmental feature vector based on spectral clustering to determine the number of environmental pattern clusters, thereby obtaining multiple environmental pattern clusters; calculating the intra-cluster consistency component and the inter-cluster separation component based on the global environmental feature vector within each environmental pattern cluster; and analyzing the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster through the intra-cluster consistency component and the inter-cluster separation component to determine the environmental difficulty level of each global environmental feature vector.

[0012] Furthermore, within a preset range of cluster numbers, each cluster number is traversed. For any given cluster number, spectral clustering is performed on the global environmental feature vector. The average regional coefficient of the clustering results under that cluster number is calculated. The cluster number with the largest average regional coefficient is selected as the number of environmental pattern clusters. Spectral clustering is then performed on the global environmental feature vector based on the cluster number with the largest average regional coefficient to obtain multiple environmental pattern clusters.

[0013] Furthermore, the calculation logic of the intra-cluster consistency component is as follows: for any environment pattern cluster, calculate the average cosine similarity of all global environment feature vectors within it, and use the average cosine similarity as the intra-cluster consistency component of the environment pattern cluster to quantify the environmental differences within the environment pattern cluster. The calculation logic for the inter-cluster separability component is as follows: for any environment pattern cluster, calculate the proportion of the number of global environment feature vectors in it to the total number of global environment feature vectors, and calculate its inter-cluster separability component based on this proportion. The specific formula used to calculate the intra-cluster consistency component is as follows: In the formula, Let k be the intra-cluster consistency component of the k-th environment pattern cluster. The number of global environment feature vectors within the k-th environment pattern cluster. Let p be the global environment feature vector in the k-th environment pattern cluster. Let q be the global environment feature vector in the k-th environment pattern cluster. Let be the norm of the p-th global environment feature vector in the k-th environment pattern cluster. Let p be the norm of the q-th global environment feature vector in the k-th environment pattern cluster, where k is the index of the environment pattern cluster, and p and q are the indices of the global environment feature vectors within the environment pattern cluster. The specific formula used to calculate the inter-cluster separability component is as follows: In the formula, Let k be the inter-cluster separability component of the k-th environmental pattern cluster. This represents the total number of all global environment feature vectors.

[0014] Furthermore, the logic for determining the environmental difficulty level of the global environmental feature vector is as follows: based on the inter-cluster separability component and intra-cluster consistency component of each environmental model cluster, the environmental difficulty coefficient of the global environmental feature vector within each environmental model cluster is analyzed, and the formula for calculating the environmental difficulty coefficient is as follows: In the formula, The environment difficulty coefficient is the global environment feature vector within the k-th environment pattern cluster. As the balance factor, where ; The specific method for determining the environmental difficulty level of the global environmental feature vector within an environmental pattern cluster is as follows: Arrange each environmental pattern cluster in descending order of environmental difficulty coefficient to form an environmental pattern cluster sequence. According to the order of the environmental pattern cluster sequence, mark the first 30% of the environmental pattern clusters in the sequence as Level 1 environmental difficulty, mark the first 30% to the first 60% of the environmental pattern clusters in the sequence as Level 2 environmental difficulty, and mark the remaining environmental pattern clusters as Level 3 environmental difficulty. The logic behind assigning different loss scaling factors to samples with different environmental difficulty levels is as follows: the loss scaling factor is determined based on the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. This is obtained by normalizing the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. The specific calculation formula is as follows: In the formula, Let be the loss scaling factor for the global environment feature vector within the k-th environment pattern cluster. This represents the total number of environment pattern clusters.

[0015] Furthermore, the logic for calculating the environment-weighted source domain segmentation loss is as follows: determine the source domain image of the current training batch, determine the environment pattern cluster to which its global environment feature vector belongs, call the loss scaling factor of the global environment feature vector within the corresponding environment pattern cluster, and calculate the source domain segmentation loss using the weighted cross-entropy loss based on the basic form of the cross-entropy loss function. The logic underlying the construction of the cross-domain classification model is as follows: The cross-domain classification model is built based on a deep learning model architecture, specifically through the U-Net model. The logic underlying the training of the cross-domain classification model is as follows: The initial source domain image and the corresponding adaptive fused feature map of the environment are forward propagated through the cross-domain classification model to generate the predicted probability that each pixel in the initial source domain image belongs to the pineapple seedling region. The corresponding labeled source domain image is used as the label to calculate the source domain segmentation loss of the current batch. The gradient of the source domain segmentation loss with respect to the parameters of the cross-domain classification model is calculated through the backpropagation algorithm, and the feature parameters of the cross-domain classification model are updated to minimize the source domain segmentation loss. The feature parameters of the cross-domain classification model include the convolutional layer weights and biases, and the batch normalization layer scaling coefficients and offsets.

[0016] Compared with the prior art, the beneficial effects of the present invention are: This scheme adopts a dual-path coding model, which can effectively integrate field environmental features and seedling ontological features, extracting global environmental features and local detail features respectively, thereby achieving accurate classification of pineapple seedlings under different growth environments. By dynamically generating environmental channel weights, the model can adaptively focus on the key features of pineapple seedlings under different environments. This process greatly enhances the adaptability of the classification model to changing environments and can effectively process pineapple seedling images under different climatic conditions, light intensities and soil types. Furthermore, by analyzing the global environmental feature vectors, the difficulty level of different environments can be determined, and different loss scaling factors can be assigned to samples accordingly. This allows the model to pay more attention to samples that perform poorly under specific environmental conditions during training, thereby improving the overall classification effect. The environment-weighted source domain segmentation loss, through this dynamic adjustment, enables the model to maintain a high recognition rate when facing different environmental challenges, reducing misclassification caused by environmental differences. This not only improves the model's learning efficiency but also makes the final classification results more reliable. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall method flow of the present invention; Figure 2 The fitted curve is the number of samples within a cluster versus the intra-cluster consistency component. Figure 3The curves showing the fitting of intra-cluster consistency components to intra-cluster segregation components. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.

[0019] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0020] Example: Please see Figures 1-3 The present invention provides a technical solution: A cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation, comprising the following steps: Step 1: Generate several simulated images of pineapple seedlings in the field, which are denoted as the initial source domain images. Label the pineapple seedling regions in the source domain images, and map the labeled source domain images one by one with the initial source domain images before labeling to form a source domain image dataset.

[0021] Simulated image data containing pineapple seedlings in the field are obtained through image acquisition, data augmentation, or computer-generated techniques. The generated images should cover different lighting conditions, viewing angles, and scene complexity to ensure the diversity and authenticity of the data.

[0022] Several simulated images of pineapple seedlings in the field are generated, and the generated simulated images are preprocessed. The image preprocessing specifically includes size and pixel channel unification, image denoising, and edge enhancement preprocessing. The specific method for unifying the size and number of pixel channels is as follows: adjust the size of all images to ensure that the height, width and resolution of the images are consistent. At the same time, adjust the number of pixel channels of the images, such as converting a single-channel grayscale image into a three-channel RGB image to meet the input requirements of subsequent processing. The image denoising specifically involves denoising the source domain image using a wavelet transform denoising method, and the edge enhancement preprocessing specifically involves enhancing the edges of the source domain image using bilateral filtering. The specific method for labeling the pineapple seedling areas in the source domain images is as follows: Manual labeling is used, selecting a labeling tool and using polygon regions to label the outlines of the pineapple seedling areas in each source domain image. Alternatively, professional image labeling software or tools, such as Labelme or LabelImg, can be used to label polygon regions. Using polygon labeling tools, the outer boundary of the pineapple seedlings is drawn point by point according to their shape and outline, accurately marking all pineapple seedling areas in the source domain images. Save the annotation results in a standard format, such as XML, JSON, or COCO, to provide direct input data for subsequent model training and evaluation.

[0023] Step 2: Construct a dual-path coding model that includes a field environment perception pathway and a seedling ontology analysis pathway. The dual-path coding model is based on a convolutional neural network framework. Based on the dual-path coding model, global environmental features and local seedling features are extracted from the initial source domain image to generate a global environmental feature vector and a local detail feature map.

[0024] The field environment perception pathway is constructed using a lightweight convolutional neural network to extract overall field environment features; the seedling ontology parsing pathway is constructed using a ResNet network structure to extract local features of pineapple seedlings. The specific construction method of the field environment perception pathway is as follows: Lightweight CNN architectures such as MobileNet, SqueezeNet, or EfficientNet are selected to balance model accuracy and computational efficiency, making them suitable for operation on resource-limited devices. The input layer receives the input image; multiple convolutional layers are used to extract image features, each typically followed by an activation function, specifically ReLU; pooling layers, such as max pooling or average pooling, are used to reduce the size of the feature maps while retaining important features; in the intermediate layers of the model, feature fusion techniques are added, specifically concatenating or weighting the feature maps from different convolutional layers to extract richer environmental features; finally, fully connected layers map the extracted features to a specific feature vector. The specific construction method for the seedling ontology parsing pathway is as follows: A specific ResNet model type is selected, such as ResNet-18, ResNet-34, or ResNet-50. The core of ResNet lies in its residual blocks, each consisting of two or three convolutional layers, which directly add the input and output through skip connections. This structure can alleviate the gradient vanishing problem in deep networks, thereby improving training performance. After multiple residual blocks, the network can effectively extract local features of the pineapple seedling. Each residual block is also followed by a ReLU activation function and pooling layer to enhance the features. In the last layer, the feature map is transformed into a fixed-size feature vector through a global average pooling layer to reduce the number of parameters and prevent overfitting.

[0025] The global environmental feature vector includes overall lighting conditions, background type, and occlusion degree. The occlusion degree specifically refers to the proportion of occluded area in the pineapple seedling region. The overall lighting conditions specifically include overexposure, shadow, and natural light. The background type specifically includes soil, mulch film, and weed leaves. The local detail feature map includes the regional morphology, texture, and spectral data of the pineapple seedling.

[0026] Step 3: Based on the global environment feature vector, dynamically generate environment channel weights, and use the environment channel weights to perform channel weighting processing on the local detail feature map to obtain an environment-adaptive fusion feature map.

[0027] The method for dynamically generating environmental channel weights is as follows: based on the number of fully connected layers in the field environment perception pathway, the global environmental feature vector is extracted in parallel into the corresponding environmental semantic representation. The environmental semantic representation is specifically expressed as follows: In the formula, To pass the first The environmental semantic representation extracted by each fully connected layer The input is the global environment feature vector. For the first The weight matrix of each fully connected layer For the first The bias vector of each fully connected layer This represents the activation function, where i is the index of the fully connected layer; It should be noted that each fully connected layer has a corresponding weight matrix used to perform a linear transformation on the input features. Different weight matrices can learn different feature representations and capture the complex relationship between environmental features and local details. Each layer has a bias term to help the model adjust the output value so that it is not limited to the range after the linear transformation, which helps to improve the model's expressive power. The ReLU activation function is used to introduce non-linearity, which enables the model to learn more complex features. ReLU can effectively solve the gradient vanishing problem and accelerate convergence. Different fully connected layers enable the learning of environmental information at different scales from global environmental feature vectors. By using different fully connected layers, multi-level environmental semantic representations can be extracted. Lower-level representations may focus on local details, such as the impact of occlusion on feature maps, while higher-level representations may focus on global features, such as overall lighting conditions and background type, thereby enhancing the robustness of the model. By combining environmental semantic representations with local detail feature maps, the influence of the environment on local features can be better captured, resulting in more representative fused feature maps, which in turn improves the accuracy of subsequent classification or detection.

[0028] Based on the feature channel dimension of the global environment feature vector, the feature channels of the global environment feature vector are grouped. Based on the environmental semantic representations output by different fully connected layers, these groups are concatenated on different feature channel groups to obtain the environment fusion feature vector. The environment fusion feature vector is specifically represented as follows: In the formula, Let j be the environmental fusion feature vector of the j-th feature channel group. This indicates a splicing operation. To fuse the weight matrix, Here, j is the index of the feature channel group; Based on the feature channel dimension of the global environment feature vector, the specific method for grouping the feature channels of the global environment feature vector is as follows: Specifically, the feature channels can be grouped according to feature categories, such as: Group 1 (lighting conditions): including overexposure, shadow, and natural light; Group 2 (background type): including soil, mulch film, and weed leaves; Group 3 (occlusion degree): quantitative analysis is performed based on the proportion of occlusion area. Alternatively, the dimension of the global environment feature vector can be determined based on the type and quantity of collected environmental data. Specifically, if the dimension of the environment feature vector is 256, considering the combined features of overall lighting conditions, background type, and occlusion degree, it can be expanded to a higher dimension, such as 512, to extract more environmental information. A suitable number of groups should be selected, generally greater than 3. The feature dimension of each group should be the total dimension of the feature vector divided by the number of groups. If the total dimension cannot be divided evenly by the number of groups, the remaining feature channels can be processed by adding zero values ​​or truncating. Then, the global environment feature vector is randomly divided into several sub-vectors, each representing a part of the environmental feature information. The dimension of each sub-vector should be consistent with the previously set feature dimension of each group. For each sub-vector, a corresponding contextual semantic representation is extracted through a fully connected layer. Each sub-vector is input into a fully connected layer, processed by linear transformation and activation functions, and finally yields the contextual semantic representation of that sub-vector. Each fully connected layer has independent weights and biases, which allows different layers to learn different feature representations and capture the complex relationship between contextual features and local details. It should be noted that concatenating the environmental semantics output from different fully connected layers makes full use of various environmental information, enabling the model to comprehensively consider local details and global environmental information, thereby improving the accuracy of recognition and analysis. The multi-environment semantic concatenation strategy effectively utilizes features extracted from different levels, allowing the model to learn complex and hierarchical information in the environment, enhancing the model's robustness when processing diverse data. By introducing weights and biases, the model can automatically adjust these parameters during the learning process, thereby optimizing feature fusion.

[0029] The global importance score for each feature channel group is determined based on the environmental fusion feature vector. The specific calculation method is as follows: In the formula, The global importance score of the j-th feature channel group is... This represents the activation function. For feature channel prediction weight matrix, Predict bias vectors for feature channels; Based on the global importance score of each feature channel group, and combined with the fine-grained weights of each feature channel group, the environment channel weight is the element-wise product of the global importance score and the fine-grained weights, specifically expressed as: In the formula, Let the environmental channel weights be those of the j-th feature channel group. For the fine-grained weights of the j-th feature channel group, This represents element-wise multiplication.

[0030] Fine-grained weights of a feature channel group typically refer to the average weight values ​​of the feature channels within the feature channel group in a deep learning model. They are used to determine the contribution of each feature channel to the final output under specific tasks or input conditions. Fine-grained weights can reflect how the model uses information from different channels to make decisions and are usually calculated and adjusted in convolutional neural networks or other neural network structures. The specific method for obtaining the fine-grained weights of the j-th feature channel group is as follows: During training, the fine-grained weights can be updated through the backpropagation algorithm. The gradient descent algorithm will automatically adjust the weights of the feature channels based on the feedback of the loss function to improve model performance.

[0031] By combining element-wise multiplication with two weights, the influence of each feature channel can be flexibly adjusted. The model automatically learns which feature channels are more important in specific scenarios, thereby achieving adaptive feature fusion. The specific method for obtaining the environment-adaptive fusion feature map is as follows: Based on the environment channel weights of each feature channel, multiply them with the local detail feature map channel by channel to obtain a preliminary weighted feature map. Then, add the preliminary weighted feature map element by element with the local detail feature map to obtain the final environment-adaptive fusion feature map. The specific formula used to calculate the environment-adaptive fusion feature map is as follows: In the formula, For environment-adaptive fusion feature maps, This is a preliminary weighted feature map. This represents channel-wise multiplication. This is the set of environmental channel weights, specifically representing the combination of environmental channel weights for each feature channel. Feature channels within the same feature channel group have the same environmental channel weight.

[0032] Through channel-wise multiplication, specific feature channels can be amplified or suppressed. The model learns which feature channels are important in a specific environment, effectively reducing the impact of noise and irrelevant information, highlighting features beneficial to the task, and emphasizing the improvement of model accuracy and efficiency. By introducing environmental channel weights, the model becomes more robust and can maintain high performance under different input conditions.

[0033] Step 4: Based on the global environment feature vector, determine the environment difficulty level to which it belongs, and assign a corresponding loss scaling factor accordingly. Use the loss scaling factor to weight the standard segmentation loss of the initial source domain image to obtain the environment-weighted source domain segmentation loss.

[0034] The specific method for determining the environmental difficulty level based on global environmental feature vectors includes: clustering global environmental feature vectors using spectral clustering to determine the number of environmental pattern clusters, thus obtaining multiple environmental pattern clusters; calculating intra-cluster consistency components and inter-cluster separation components based on the global environmental feature vectors within each environmental pattern cluster; and analyzing the environmental difficulty coefficient of the global environmental feature vectors within each environmental pattern cluster using the intra-cluster consistency components and inter-cluster separation components to determine the environmental difficulty level of each global environmental feature vector.

[0035] The logic behind clustering global environmental feature vectors is as follows: traverse all source domain images, obtain global environmental feature vectors of all source domain images through the field environment perception pathway, form an environmental feature set containing all global environmental feature vectors, and use a clustering algorithm to perform unsupervised clustering on the environmental feature set to generate several environmental pattern clusters. The specific method includes: using a spectral clustering algorithm, traversing each cluster number within a preset range, performing spectral clustering on the global environmental feature vectors for any given cluster number, calculating the average regional coefficient of the clustering results under that cluster number, selecting the cluster number with the largest average regional coefficient as the number of environmental pattern clusters, and performing spectral clustering on the global environmental feature vectors based on the cluster number with the largest average regional coefficient to obtain multiple environmental pattern clusters.

[0036] The region coefficient of the clustering results is an important indicator for evaluating the clustering effect. The calculation of the region coefficient considers the compactness of a sample within its own cluster and its separation from other clusters, reflecting the quality of the clustering. Specifically, the calculation method is as follows: First, calculate the average distance between each sample in the cluster and all other samples in its own cluster. This distance reflects the compactness of the sample within its cluster; the smaller the distance, the closer the sample is to other samples in its cluster, and the better the clustering effect. Then, calculate the average distance between the sample and samples from other clusters, finding the cluster closest to the current sample, reflecting the separation of the sample from other clusters. The degree of separation is considered when a sample is far from other clusters, indicating that it has been correctly assigned to its own cluster. The regional coefficient assesses the clustering quality by comparing the density of samples within their own cluster with their separation from other clusters. The closer a sample's regional coefficient is to 1, the stronger its relationship with samples within its own cluster and the greater the distance it maintains from other clusters, indicating a better clustering effect. The average regional coefficient is obtained by averaging the regional coefficients of all samples. A larger average regional coefficient indicates a better clustering effect; a low average or negative value indicates a poor clustering result. The calculation logic of the intra-cluster consistency component is as follows: For any environment pattern cluster, calculate the average cosine similarity of all global environment feature vectors within it, and use the average cosine similarity as the intra-cluster consistency component of the environment pattern cluster to quantify the environmental differences within the environment pattern cluster. The calculation logic for the inter-cluster separability component is as follows: for any environment pattern cluster, calculate the proportion of the number of global environment feature vectors in it to the total number of global environment feature vectors, and calculate its inter-cluster separability component based on this proportion. The specific formula used to calculate the intra-cluster consistency component is as follows: In the formula, Let k be the intra-cluster consistency component of the k-th environment pattern cluster. The number of global environment feature vectors within the k-th environment pattern cluster. Let p be the global environment feature vector in the k-th environment pattern cluster. Let q be the global environment feature vector in the k-th environment pattern cluster. Let be the norm of the p-th global environment feature vector in the k-th environment pattern cluster. Let p be the norm of the q-th global environment feature vector in the k-th environment pattern cluster, where k is the index of the environment pattern cluster, and p and q are the indices of the global environment feature vectors within the environment pattern cluster. It should be noted that the intra-cluster consistency component of the k-th environment pattern cluster... This reflects the similarity between environmental feature vectors within the cluster. The higher the value, the stronger the consistency between samples, i.e., feature vectors, within the cluster, and the smaller the environmental differences. Cosine similarity calculates the cosine of the angle between them, reflecting their directional similarity in the feature space. Cosine similarity is used to quantify intra-cluster consistency because it can effectively measure the directional similarity of feature vectors without being affected by their absolute magnitude, which is especially important when dealing with high-dimensional features.

[0037] The specific formula used to calculate the inter-cluster separability component is as follows: In the formula, Let k be the inter-cluster separability component of the k-th environmental pattern cluster. This represents the total number of all global environment feature vectors.

[0038] It should be noted that, Indicates the first The inter-cluster separability component of each environmental pattern cluster reflects the degree of difference between the number of samples in the cluster and the number of samples in other clusters. The higher the value, the more scarce the number of samples in the cluster, the less data is available for analysis and training, and the greater the difficulty in recognizing images similar to samples in the cluster. in It is the total number of all global environment feature vectors, which provides an overall context for computation, so that the relationship between the size of each cluster and the global feature space can be reflected; It is the first The number of global environmental feature vectors within each environmental pattern cluster is an important parameter used to calculate the inter-cluster separability, which directly affects the proportion of that cluster relative to the overall sample. use The form clearly indicates the first The size of each cluster is the reciprocal of its proportion in the overall feature space; that is, the smaller the proportion, the greater the dissociative component between clusters, and the more difficult it is to identify similar images. The natural logarithm is used in this form. This effectively avoids nonlinear problems caused by excessively large scale values, while ensuring that... When increased, the separable components The changes are smooth and gradual, avoiding drastic fluctuations in the segregating components when the sample size is very small or very large.

[0039] The logic for determining the environmental difficulty level of the global environmental feature vector is as follows: Based on the inter-cluster separability component and intra-cluster consistency component of each environmental model cluster, the environmental difficulty coefficient of the global environmental feature vector within each environmental model cluster is analyzed, and the formula for calculating the environmental difficulty coefficient is as follows: In the formula, The environment difficulty coefficient is the global environment feature vector within the k-th environment pattern cluster. As the balance factor, where ; It should be noted that the environmental difficulty coefficient of the global environmental feature vector within the k-th environmental pattern cluster is... This reflects the complexity or difficulty of the environmental feature vectors within the cluster; a larger value indicates a higher difficulty in environmental recognition. This measures the similarity between feature vectors within a cluster. A value closer to 1 indicates greater consistency in environmental feature vectors within the cluster, smaller environmental differences, and therefore lower difficulty in environmental recognition. Therefore, it is used in the formula. This reflects the impact of intra-cluster consistency on environmental difficulty: when intra-cluster consistency is high, the environmental difficulty coefficient is reduced; This reflects the degree of difference between the number of samples within a cluster and the number of samples within other clusters. A higher value indicates a scarcer number of samples within that cluster, less data available for analysis and training, and greater difficulty in recognizing images similar to those within the cluster. Proportional; The specific method for determining the environmental difficulty level of the global environmental feature vector within an environmental pattern cluster is as follows: Arrange each environmental pattern cluster in descending order of environmental difficulty coefficient to form an environmental pattern cluster sequence. According to the order of the environmental pattern cluster sequence, mark the first 30% of the environmental pattern clusters in the sequence as Level 1 environmental difficulty, mark the first 30% to the first 60% of the environmental pattern clusters in the sequence as Level 2 environmental difficulty, and mark the remaining environmental pattern clusters as Level 3 environmental difficulty. The logic behind assigning different loss scaling factors to samples with different environmental difficulty levels is as follows: the loss scaling factor is determined based on the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. This is obtained by normalizing the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. The specific calculation formula is as follows: In the formula, Let be the loss scaling factor for the global environment feature vector within the k-th environment pattern cluster. This represents the total number of environment pattern clusters.

[0040] It should be noted that by adjusting the environmental difficulty coefficient Normalized to loss scaling factor This ensures that more complex environmental pattern clusters have higher weights during training. The weighting mechanism makes the model pay more attention to those more complex samples during optimization, thereby improving the robustness and prediction performance of the model. The logic behind calculating the environment-weighted source domain segmentation loss is as follows: determine the source domain image of the current training batch, determine the environment pattern cluster affiliation of its global environment feature vector, call the loss scaling factor of the global environment feature vector within the corresponding environment pattern cluster, and calculate the source domain segmentation loss using the weighted cross-entropy loss based on the basic form of the cross-entropy loss function; the representation of the weighted cross-entropy loss function is a conventional technical feature, which will not be elaborated here.

[0041] Step 5: Construct a cross-domain classification model. Take the initial source domain image and the corresponding fused feature map as input, use the environment-weighted source domain segmentation loss as the loss function, and use the labeled source domain image as the label to train the cross-domain classification model. Record the actual image of pineapple seedlings in the field as the target domain image to be identified, and input it into the cross-domain classification model to achieve domain-adaptive pineapple seedling segmentation.

[0042] The logic behind calculating the environment-weighted source domain segmentation loss is as follows: determine the source domain image of the current training batch, determine the environment pattern cluster to which its global environment feature vector belongs, call the loss scaling factor of the global environment feature vector within the corresponding environment pattern cluster, and calculate the source domain segmentation loss using the weighted cross-entropy loss based on the basic form of the cross-entropy loss function. The logic behind constructing the cross-domain classification model is as follows: The cross-domain classification model is built on a deep learning model architecture, specifically through the U-Net model. The U-Net model is widely used in image segmentation tasks due to its encoding and decoding structure. Its key features include: Encoding part: Extracting contextual information of the image, extracting features through layer-by-layer convolution and pooling, and reducing the spatial dimension of the feature map; Decoding part: Gradually restoring the spatial resolution of the image, combining the features of the encoding part with the features of the decoding part through upsampling and skip connections for accurate localization; Output layer: Finally, generating the class prediction probability of each pixel through the softmax activation function.

[0043] The specific logic for training the cross-domain classification model is as follows: Collect source domain image data related to the target task. These images need to contain the pineapple seedling region and possess a certain degree of diversity to improve the model's generalization ability. Generate an environment-adaptive fusion feature map based on the source domain images. This image combines environmental features and image detail information, helping the model better understand the image content. Propagate the initial source domain image and the corresponding environment-adaptive fusion feature map forward through the cross-domain classification model to generate the predicted probability that each pixel in the initial source domain image belongs to the pineapple seedling region. Using the corresponding labeled source domain image as the label, calculate the source domain segmentation loss for the current batch. Calculate the gradient of the source domain segmentation loss with respect to the cross-domain classification model parameters through the backpropagation algorithm, specifically including the gradients of convolutional layer weights and biases, and the scaling coefficients and offsets of the batch normalization layer. During backpropagation, use optimization algorithms (such as Adam or SGD) to update the model's feature parameters to minimize the source domain segmentation loss. The feature parameters of the cross-domain classification model include convolutional layer weights and biases, and the scaling coefficients and offsets of the batch normalization layer.

[0044] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.

[0045] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.

[0046] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0047] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation, characterized in that, The specific steps include: Several simulated images of pineapple seedlings in the field are generated and denoted as the initial source domain images. The pineapple seedling regions in the source domain images are labeled, and the labeled source domain images are mapped one by one with the initial source domain images before labeling to form a source domain image dataset. A dual-path coding model is constructed, which includes a field environment perception pathway and a seedling ontology analysis pathway. The dual-path coding model is based on a convolutional neural network framework. Based on the dual-path coding model, global environmental features and local seedling features are extracted from the initial source domain image to generate a global environmental feature vector and a local detail feature map. Based on the global environment feature vector, environment channel weights are dynamically generated. Using the environment channel weights, the local detail feature map is subjected to channel weighting processing to obtain an environment-adaptive fusion feature map. Based on the global environment feature vector, the difficulty level of the environment is determined, and a corresponding loss scaling factor is assigned accordingly. The standard segmentation loss of the initial source domain image is weighted using the loss scaling factor to obtain the environment-weighted source domain segmentation loss. A cross-domain classification model is constructed, with the initial source domain image and the corresponding fused feature map as input, the environment-weighted source domain segmentation loss as the loss function, and the labeled source domain image as the label. The cross-domain classification model is trained, and the actual image of pineapple seedlings in the field is recorded as the target domain image to be identified and input into the cross-domain classification model to achieve domain-adaptive pineapple seedling segmentation. The method for dynamically generating environmental channel weights is as follows: based on the number of fully connected layers in the field environment perception pathway, the global environmental feature vector is extracted in parallel into the corresponding environmental semantic representation. The environmental semantic representation is specifically expressed as follows: In the formula, To pass the first The environmental semantic representation extracted by each fully connected layer The input is the global environment feature vector. For the first The weight matrix of each fully connected layer For the first The bias vector of each fully connected layer This represents the activation function, where i is the index of the fully connected layer; Based on the feature channel dimension of the global environment feature vector, the feature channels of the global environment feature vector are grouped. Based on the environmental semantic representations output by different fully connected layers, these groups are concatenated on different feature channel groups to obtain the environment fusion feature vector. The environment fusion feature vector is specifically represented as follows: In the formula, Let j be the environmental fusion feature vector of the j-th feature channel group. This indicates a splicing operation. To fuse the weight matrix, Here, j is the index of the feature channel group; The global importance score for each feature channel group is determined based on the environmental fusion feature vector. The specific calculation method is as follows: In the formula, The global importance score of the j-th feature channel group is... This represents the activation function. For feature channel prediction weight matrix, Predict bias vectors for feature channels; Based on the global importance score of each feature channel group, and combined with the fine-grained weights of each feature channel group, the environment channel weight is the element-wise product of the global importance score and the fine-grained weights, specifically expressed as: In the formula, Let the environmental channel weights be those of the j-th feature channel group. For the fine-grained weights of the j-th feature channel group, Indicates element-wise multiplication; The specific method for obtaining the environment-adaptive fusion feature map is as follows: Based on the environment channel weights of each feature channel, multiply them with the local detail feature map channel by channel to obtain a preliminary weighted feature map. Then, add the preliminary weighted feature map element by element with the local detail feature map to obtain the final environment-adaptive fusion feature map. The specific formula used to calculate the environment-adaptive fusion feature map is as follows: In the formula, For environment-adaptive fusion feature maps, This is a preliminary weighted feature map. This represents channel-wise multiplication. This is the set of environmental channel weights, specifically representing the combination of environmental channel weights for each feature channel. Feature channels within the same feature channel group have the same environmental channel weight. The specific method for determining the environmental difficulty level based on global environmental feature vectors includes: clustering global environmental feature vectors using spectral clustering to determine the number of environmental pattern clusters, thus obtaining multiple environmental pattern clusters; calculating intra-cluster consistency components and inter-cluster separation components based on the global environmental feature vectors within each environmental pattern cluster; and analyzing the environmental difficulty coefficient of the global environmental feature vectors within each environmental pattern cluster using the intra-cluster consistency components and inter-cluster separation components to determine the environmental difficulty level of each global environmental feature vector. The logic for determining the environmental difficulty level of the global environmental feature vector is as follows: Based on the inter-cluster separability component and intra-cluster consistency component of each environmental model cluster, the environmental difficulty coefficient of the global environmental feature vector within each environmental model cluster is analyzed, and the formula for calculating the environmental difficulty coefficient is as follows: In the formula, The environment difficulty coefficient is the global environment feature vector within the k-th environment pattern cluster. As the balance factor, where ; Let k be the intra-cluster consistency component of the k-th environment pattern cluster. This represents the inter-cluster separability component of the k-th environmental pattern cluster; The specific method for determining the environmental difficulty level of the global environmental feature vector within an environmental pattern cluster is as follows: Arrange each environmental pattern cluster in descending order of environmental difficulty coefficient to form an environmental pattern cluster sequence. According to the order of the environmental pattern cluster sequence, mark the first 30% of the environmental pattern clusters in the sequence as Level 1 environmental difficulty, mark the first 30% to the first 60% of the environmental pattern clusters in the sequence as Level 2 environmental difficulty, and mark the remaining environmental pattern clusters as Level 3 environmental difficulty. The logic behind assigning different loss scaling factors to samples with different environmental difficulty levels is as follows: the loss scaling factor is determined based on the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. This is obtained by normalizing the environmental difficulty coefficient of the global environmental feature vector within each environmental pattern cluster. The specific calculation formula is as follows: In the formula, Let be the loss scaling factor for the global environment feature vector within the k-th environment pattern cluster. This represents the total number of environment pattern clusters.

2. The cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation as described in claim 1, characterized in that: Several simulated images of pineapple seedlings in the field are generated, and the generated simulated images are preprocessed. The image preprocessing specifically includes size and pixel channel unification, image denoising, and edge enhancement preprocessing. The image denoising specifically involves: performing denoising processing on the source domain image using a wavelet transform denoising method; the edge enhancement preprocessing specifically involves: performing edge enhancement on the source domain image using bilateral filtering. The specific method for annotating the pineapple seedling region in the source domain image is as follows: use manual annotation, select the annotation tool, and use polygon regions to annotate the outline of the pineapple seedling region in each source domain image.

3. The cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation as described in claim 2, characterized in that: The field environment perception pathway is constructed using a lightweight convolutional neural network to extract overall field environment features; the seedling ontology parsing pathway is constructed using a ResNet network structure to extract local features of pineapple seedlings. The global environmental feature vector includes overall lighting conditions, background type, and occlusion degree. The occlusion degree specifically refers to the proportion of occluded area in the pineapple seedling region. The overall lighting conditions specifically include overexposure, shadow, and natural light. The background type specifically includes soil, mulch film, and weed leaves. The local detail feature map includes the regional morphology, texture, and spectral data of the pineapple seedling.

4. The cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation as described in claim 3, characterized in that: Within a preset range of cluster numbers, each cluster number is traversed. For any given cluster number, spectral clustering is performed on the global environmental feature vector. The average regional coefficient of the clustering results under that cluster number is calculated. The cluster number with the largest average regional coefficient is selected as the number of environmental pattern clusters. Spectral clustering is then performed on the global environmental feature vector based on the cluster number with the largest average regional coefficient to obtain multiple environmental pattern clusters.

5. The cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation according to claim 4, characterized in that, The calculation logic of the intra-cluster consistency component is as follows: For any environment pattern cluster, calculate the average cosine similarity of all global environment feature vectors within it, and use the average cosine similarity as the intra-cluster consistency component of the environment pattern cluster to quantify the environmental differences within the environment pattern cluster. The calculation logic for the inter-cluster separability component is as follows: for any environment pattern cluster, calculate the proportion of the number of global environment feature vectors in it to the total number of global environment feature vectors, and calculate its inter-cluster separability component based on this proportion. The specific formula used to calculate the intra-cluster consistency component is as follows: In the formula, The number of global environment feature vectors within the k-th environment pattern cluster. Let p be the global environment feature vector in the k-th environment pattern cluster. Let q be the global environment feature vector in the k-th environment pattern cluster. Let be the norm of the p-th global environment feature vector in the k-th environment pattern cluster. Let p be the norm of the q-th global environment feature vector in the k-th environment pattern cluster, where k is the index of the environment pattern cluster, and p and q are the indices of the global environment feature vectors within the environment pattern cluster. The specific formula used to calculate the inter-cluster separability component is as follows: In the formula, This represents the total number of all global environment feature vectors.

6. The cross-domain classification method for pineapple seedlings based on convolutional neural networks and domain adaptation as described in claim 5, characterized in that: The logic behind calculating the environment-weighted source domain segmentation loss is as follows: determine the source domain image of the current training batch, determine the environment pattern cluster to which its global environment feature vector belongs, call the loss scaling factor of the global environment feature vector within the corresponding environment pattern cluster, and calculate the source domain segmentation loss using the weighted cross-entropy loss based on the basic form of the cross-entropy loss function. The logic underlying the construction of the cross-domain classification model is as follows: The cross-domain classification model is built based on a deep learning model architecture, specifically through the U-Net model. The logic underlying the training of the cross-domain classification model is as follows: The initial source domain image and the corresponding adaptive fused feature map of the environment are forward propagated through the cross-domain classification model to generate the predicted probability that each pixel in the initial source domain image belongs to the pineapple seedling region. The corresponding labeled source domain image is used as the label to calculate the source domain segmentation loss of the current batch. The gradient of the source domain segmentation loss with respect to the parameters of the cross-domain classification model is calculated through the backpropagation algorithm, and the feature parameters of the cross-domain classification model are updated to minimize the source domain segmentation loss. The feature parameters of the cross-domain classification model include the convolutional layer weights and biases, and the batch normalization layer scaling coefficients and offsets.

Citation Information

Patent Citations

  • Ship re-identification method based on sample expansion

    CN120808250A

  • Image processing leather surface defect identification method and system

    CN121258970A