A mango grading and recognition method based on UpCPFNet model
By learning feature information in a deep network and integrating multi-scale features, the UpCPFNet model solves the problems of low manual grading efficiency and difficulty in level identification in traditional mango grading methods, and achieves efficient and accurate mango level identification.
Patent Information
- Application Number
- CN202410607710.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-05-16
AI Technical Summary
The traditional method relies on manual mango grading, which has the problems of high labor intensity, low efficiency, high cost and inconsistent standards, and deep learning is not effective in identifying similarity differences among mango levels.
The mango grading recognition method based on the UpCPFNet model is used to improve the level similarity discrimination ability by learning feature information in the deep network, aggregating shallow local features, and fusing multi-scale features.
It achieves more efficient mango level recognition, reduces level similarity discrimination errors, improves recognition efficiency and accuracy, and reduces labor costs.
Smart Images

Figure CN118470413B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer vision image processing and crop grade recognition, and particularly relates to a mango grading and recognition method based on an UpCPFNet model. Background Art
[0002] After the mangoes are picked, a series of measures will be taken to maintain and improve the product quality and transform them from agricultural products into commodities, including sorting and selection, pre-cooling, cleaning, waxing, grading, packaging, etc. At present, the grading of mangoes in the market mainly relies on mechanical engineering technology to sort the size and quality of mangoes, while the detection of shape, color, and skin defects is mostly done manually. However, with the mechanized planting of crops, the planting scale and output of agricultural products are constantly increasing. The traditional mango grading method based on manpower has many problems, such as high labor intensity, low efficiency, high cost, and errors in the grading standards due to different people. If intelligent machines are used to pick the fruits in a natural environment, the mangoes with skin defects can be separated from the mangoes with intact skins to complete the preliminary grading, which can avoid the pollution and waste of intact fruits. Therefore, the intelligent identification of mango fruit grading is a key problem that needs to be solved at present, which can save the time and labor cost of grading to a certain extent.
[0003] In recent years, with the rise of deep learning, a large number of research engineers and scholars have applied deep learning, especially convolutional neural networks, to agricultural product grading and identification. From relevant references, we can see the advantages of agricultural product grading and identification methods based on deep learning, such as: the amount of data that can be processed becomes larger, the speed is improved, and the processing effect is better for image data with complex backgrounds. However, the similarity and unclear differences in mango levels are still the main challenges for level identification. The present invention mainly aggregates the local features of the shallow network through the feature information learned in the deep network, and then fuses the feature information at multiple scales to obtain features with a relatively small receptive field and a higher resolution, which can improve the similarity identification of levels. Summary of the invention
[0004] Purpose of the invention: The present invention proposes a mango grading and recognition method based on the UpCPFNet model, which mainly aggregates the local features of the shallow network by using the feature information learned in the deep network, and then fuses the feature information at multiple scales, so as to obtain features with smaller receptive fields and higher resolution, thereby improving the similarity discrimination of levels.
[0005] Technical solution: The present invention proposes a mango grading and identification method based on the UpCPFNet model, comprising the following steps:
[0006] (1) The pre-acquired mango pictures are classified and made into a data set, and then divided into a training set and a test set according to a certain ratio;
[0007] (2) preprocessing the mango classification data set obtained in step (1);
[0008] (3) A mango grading recognition network based on the UpCPFNet model was constructed, including a preliminary feature extraction module Stem, three UpCFP modules, a DoDB module and four Stage blocks; the Stem module performs simple downsampling and increases the number of channels; the four Stage blocks stack the feature extraction backbone module ReHRSE in a 1:1:3:1 ratio for deep feature extraction; the first Stage block includes a ReHRSE module followed by an UpCFP module; the second Stage block includes a ReHRSE module followed by an UpCFP module, the third Stage block includes three ReHRSE modules followed by an UpCFP module, and the fourth Stage block includes a ReHRSE module; the UpCFP module extracts features of different scales in the basic network, and the DoDB module realizes feature aggregation and fuses features at different scales;
[0009] (4) The mango grading recognition network based on the UpCPFNet model built in the training step (3) is first trained on the training set after the image preprocessing in step (2), and the training parameters of the model are adjusted for multiple iterations until the optimal model weight is obtained. The data images in the test set are verified and the performance of the model is evaluated.
[0010] Furthermore, in step (1), the data images are divided into 8 categories according to the size, color, appearance, etc. of the mangoes.
[0011] Furthermore, the image preprocessing in step (2) is to perform data enhancement on all leaf images, including random horizontal rotation, size cropping and data format conversion.
[0012] Furthermore, the preliminary feature extraction module Stem in step (3) is composed of a 4×4 convolution kernel and a BatchNorm layer.
[0013] Furthermore, in the ReHRSE module of step (3), the first branch is introduced to undergo 7×7 convolution, the second branch structure introduces the channel attention mechanism, branches again, and the third branch undergoes 3×3 depthwise separable convolution and is residually connected to the second branch; the stacking operation is performed less than 2 times, the second branch undergoes 1×1 depthwise separable convolution, the third branch undergoes 3×3 depthwise separable convolution, and the second branch and the third branch are residually connected; then the second branch undergoes 1×1 depthwise separable convolution and is residually connected to the first branch.
[0014] Furthermore, in step (3), the first branch of the UpCFP module undergoes a 3×3 convolution, a 1×1 convolution, and two 2×2 convolutions in sequence; each second branch undergoes a 2×2 convolution, and then the features obtained from the two branches are concatenated on the channel.
[0015] Furthermore, in the DoDB module of step (3), the output features of the deep layer are respectively concatenated with the output of the third UpCFP module through two 1×1 convolutions to obtain the features of the minimum size, and then concatenated with the output of the second UpCFP module through 1×1 convolution to obtain the features of the intermediate size, and then concatenated with the output of the first UpCFP module through 1×1 convolution to obtain the features of the maximum size. The features of the maximum size are downsampled after 1×1 convolution and the features of the minimum size are upsampled after 1×1 convolution, and then concatenated with the features of the intermediate size after 1×1 convolution on the channel, the obtained features are downsampled, the output features of the deep layer are upsampled, and the features of the minimum size are fused on the channel, and then downsampled.
[0016] Furthermore, the specific implementation process of step (3) is as follows:
[0017] The data-enhanced features are used as the input of the convolutional network for a convolution operation with kernel_size=4, and then the feature vector S11 is obtained through the Relu activation function;
[0018] Enter the first Stage block, input S11 into the ReHRSE module, input S11 into the first branch, pass through the convolution of kernel_size=7, input S11 into the second branch structure through the channel attention mechanism, and then branch again, the third branch passes through the depth-separable convolution of kernel_size=3, and the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch performs the depth-separable convolution of kernel_size=3 again, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch performs the depth-separable convolution of kernel_size=3 again, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution of kernel_size=1 in the second branch, and the obtained features are residually connected with the first branch, and then the feature vector Y44 is obtained through the RELU activation layer;
[0019] Y44 is input into the UpCFP module, and Y44 is upsampled by 2 times, and then convolution with kernel_size=3 and convolution with kernel_size=1 is performed, and then it passes through the BatchNorm layer and the RELU activation layer, and then downsampled twice to obtain the feature vector UP1. Y44 is downsampled twice and UP1 is concatenated in the channel to obtain S22;
[0020] Enter the second Stage block to obtain the feature vector Z44; input Z44 into the UpCFP2 module to obtain the feature vectors UP2 and S33;
[0021] Enter the third Stage block, input S33 into the ReHRSE module to obtain the feature vector S44; input S44 into the ReHRSE module to obtain the feature vector S55; input S55 into the ReHRSE module to obtain the feature vector M44; input M44 into the UpCFP module to obtain the feature vectors UP3 and S66;
[0022] Enter the fourth Stage block and input S66 into the ReHRSE module to obtain the feature vector S77;
[0023] S77 is input into the DoDB module. S77 is upsampled twice and subjected to two 1×1 convolution operations to obtain the feature vector S771. UP3 is subjected to a 1×1 convolution operation to obtain the feature vector UP31. S771 and UP31 are concatenated on the channel to obtain the feature vector K22. S771 is upsampled twice and subjected to a 1×1 convolution operation to obtain the feature vector S772. UP2 is subjected to a 1×1 convolution operation to obtain the feature vector UP21. S772 and UP21 are concatenated on the channel to obtain K33. S772 is upsampled twice and subjected to a 1×1 convolution operation to obtain the feature vector UP21. After upsampling and 1×1 convolution operation, feature vector S773 is obtained. After 1×1 convolution operation on UP1, feature vector UP11 is obtained. S773 and UP11 are concatenated on the channel to obtain K44. K22 is convolved with 1×1 and downsampled twice to obtain K221. K44 is upsampled twice and then concatenated with K33 on the channel to obtain L11. L11 and S771 are downsampled and upsampled respectively, and then concatenated with K44 on the channel to obtain L22, and then downsampled twice more to obtain feature vector L33.
[0024] The L33 input undergoes two consecutive downsampling operations, an AvgPool1d layer, and a fully connected layer, and finally outputs the classification result F.
[0025] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects:
[0026] 1. The present invention proposes a method which is different from the general backbone network in that the UpCFP module is used after the Stage block in the network, and the method of upsampling first and then downsampling is used to obtain a smaller receptive field and more local features; extracting features of more sizes helps to reduce the loss of some feature information during the network downsampling process; due to the similarity of the levels, adding local features helps to improve the ability to distinguish the similarity of the network levels;
[0027] 2. The present invention proposes that three branches use 3×3 convolution to extract features and perform residual connection with 1×1 convolution features, and stack them three times. 1×1 convolution is used to obtain smaller receptive field features, and multiple layers of 3×3 convolution are stacked to obtain a larger receptive field. Then, residual connection is performed with 7×7 convolution, which enriches the local and global receptive fields and makes the model have better adaptability and feature extraction capabilities.
[0028] 3. The present invention proposes a method of using deep network global features to aggregate shallow local features, and then down-samples large-size features and up-samples small-size features to fuse them into intermediate-size features during multi-scale fusion, thereby reducing feature downsampling losses and aggregating network features. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flow chart of the present invention;
[0030] Figure 2 This is a schematic diagram of the network structure of mango grading recognition based on the UpCPFNet model proposed in the present invention;
[0031] Figure 3 This is a schematic diagram of the network structure of the ReHRSE module proposed in the present invention;
[0032] Figure 4 This is a schematic diagram of the network structure of the UpCFP module proposed in the present invention;
[0033] Figure 5 This is a schematic diagram of the network structure of the DoDB module proposed in the present invention. DETAILED DESCRIPTION
[0034] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art.
[0035] This embodiment involves a large number of variables, and each variable is described as follows, as shown in Table 1.
[0036] Table 1 Variable description table
[0037]
[0038]
[0039] The present invention proposes a mango grading and recognition method based on the UpCPFNet model. Figure 1 As shown, the specific steps include:
[0040] Step 1: Classify the pre-acquired mango images and make them into a dataset, which is then divided into a training set and a test set according to a certain ratio.
[0041] The data images are divided into 8 categories according to the size, color, and appearance of mangoes. They are divided into training set and test set in a ratio of 8:2. Data enhancement is performed on all leaf images, including random horizontal rotation, size cropping, and data format conversion.
[0042] Step 2: Build a mango grading recognition network based on the UpCPFNet model, such as Figure 2 As shown, a preliminary feature extraction module is first constructed, and then four Stage blocks are built as the backbone network, followed by a DoDB module. Specifically, it includes a preliminary feature extraction Stem module, three UpCFP modules, a DoDB module, and six feature extraction backbone modules ReHRSE. The Stem module performs simple downsampling and increases the number of channels. The four Stage blocks stack ReHRSE modules in a 1:1:3:1 ratio for deep feature extraction; the first Stage block includes a ReHRSE module, followed by an UpCFP module; the second Stage block includes a ReHRSE module, followed by an UpCFP module, and the third Stage block includes 3 ReHRSE modules, followed by an UpCFP module; the fourth Stage block includes a ReHRSE module; the purpose of adding the UpCFP module is to extract features of more scales on the backbone network. The DoDB module realizes feature aggregation and fuses features at different scales. The specific implementation process is as follows:
[0043] The preliminary feature extraction module consists of a 4×4 convolution kernel. First, in the preprocessing stage of the training sample image input model, the feature vector S0 is obtained after image preprocessing; S0 is input into the preliminary feature extraction module, and S0 is used as the input of the multi-convolutional network for convolution operation with a step size of 1 and kernel_size=4, and then the feature vector S11 is obtained through the BatchNorm layer.
[0044] The backbone module network Stage 1 structure consists of a ReHRSE module, such as Figure 3As shown, S11 is input into the ReHRSE module, S11 is input into the first branch, and after a convolution with a step size of 1 and padding to 3, kernel_size=7, S11 is input into the second branch structure through the channel attention mechanism, and then branched again. The third branch is padded to 1, kernel_size=3 depth-separable convolution, and the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch is padded to 1 again, kernel_size=3 depth-separable convolution, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch is padded to 1 again, kernel_size=3 depth-separable convolution, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch is padded to 1 again, kernel_size=3 depth-separable convolution, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-separable convolution of kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector Y44 is obtained through the RELU activation layer.
[0045] like Figure 4 As shown in the figure, the first branch of the UpCFP module undergoes a 3×3 convolution, a 1×1 convolution, and two 2×2 convolutions in sequence; the second branch undergoes a 2×2 convolution, and then the features obtained from the two branches are concatenated on the channel. After the UpCFP module, Y44 is upsampled by 2 times and then padded to 1, convolution with kernel_size=3 and convolution with kernel_size=1, and then passes through the BatchNorm layer and the RELU activation layer, and then downsampled twice to obtain the feature vector UP1. Y44 is downsampled twice and concatenated with UP1 on the channel to obtain S22.
[0046] The Stage2 block structure of the backbone module network consists of a ReHRSE module. S22 is input into the first branch, and after a convolution with a step size of 1 and a padding of 3, kernel_size=7, S11 is input into the second branch structure through the channel attention mechanism, and then branched again. The third branch is padded with a depth-separable convolution of 1 and kernel_size=3. The features of the second and third branches are residually connected; the obtained features are passed through a depth-separable convolution and RELU activation layer in the second branch, and the third branch is padded with 1 again, kernel_size=3. A depthwise separable convolution with el_size=3 is performed, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through a depthwise separable convolution with kernel_size=1 and a RELU activation layer in the second branch; the third branch is again padded with 1, and a depthwise separable convolution with kernel_size=3 is performed, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through a depthwise separable convolution with kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector Z44 is obtained through a RELU activation layer.
[0047] After the UpCFP module: Z44 is upsampled by 2 times and then padded to 1, convolution with kernel_size=3 and convolution with kernel_size=1 are performed, and then the BatchNorm layer and RELU activation layer are activated, and then downsampled twice to obtain the feature vector UP2. Z44 is downsampled twice and UP3 is spliced in the channel to obtain S33.
[0048] The backbone module network Stage3 structure consists of 3 ReHRSE modules. S33 is input into the first branch, and after convolution with a step size of 1 and padding to 3, kernel_size=7, S11 is input into the second branch structure through the channel attention mechanism, and then branched again. The third branch is padded to 1, kernel_size=3 depth separable convolution, and the features of the second and third branches are residually connected; the obtained features are passed through the depth separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch is padded to 1 again, kernel_size=3. A depthwise separable convolution with el_size=3 is performed, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through a depthwise separable convolution with kernel_size=1 and a RELU activation layer in the second branch; the third branch is again filled with 1, and a depthwise separable convolution with kernel_size=3 is performed, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through a depthwise separable convolution with kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector S44 is obtained through a RELU activation layer.
[0049] Input S44 into the ReHRSE module, input S44 into the first branch, and pass through the convolution with a step size of 1 and padding to 3, kernel_size=7. Input S11 into the second branch structure through the channel attention mechanism, and then branch again. The third branch passes through the depth-separable convolution with padding of 1 and kernel_size=3, and the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution with kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector S55 is obtained through the RELU activation layer.
[0050] Input S55 into the ReHRSE module, input S55 into the first branch, and pass through the convolution with a step size of 1 and padding to 3, kernel_size=7. Input S11 into the second branch structure through the channel attention mechanism, and then branch again. The third branch passes through the depth-separable convolution with padding of 1 and kernel_size=3, and the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch again passes through the depth-separable convolution with padding of 1 and kernel_size=3, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution with kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector M44 is obtained through the RELU activation layer.
[0051] After the UpCFP module: M44 is upsampled by 2 times and then padded to 1, convolution with kernel_size=3 and convolution with kernel_size=1 are performed, and then it passes through the BatchNorm layer and the RELU activation layer, and then downsampled twice to obtain the feature vector UP3. M44 is downsampled twice and UP3 is spliced in the channel to obtain S66.
[0052] The backbone module network Stage4 structure consists of ReHRSE. S66 is input into the first branch, and after convolution with a step size of 1 and padding to 3, kernel_size=7, S11 is input into the second branch structure through the channel attention mechanism, and then branched again. The third branch is padded to 1, kernel_size=3 depthwise separable convolution, and the features of the second and third branches are residually connected; the obtained features are passed through the depthwise separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch is padded to 1 again, kernel_size=3. _size=3 depth-wise separable convolution, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-wise separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch is again filled with 1, and the depth-wise separable convolution of kernel_size=3 is performed, and then the features of the second branch and the third branch are residually connected; the obtained features are passed through the depth-wise separable convolution of kernel_size=1 in the second branch, and the obtained features are residually connected to the first branch, and then the feature vector S77 is obtained through the RELU activation layer.
[0053] like Figure 5 As shown in FIG. 1 , through the DoDB module, S77 is subjected to two upsampling and 1×1 convolution operations to obtain the feature vector S771, UP3 is subjected to 1×1 convolution operations to obtain the feature vector UP31, and S771 and UP31 are concatenated on the channel to obtain K22; S771 is subjected to two upsampling and 1×1 convolution operations to obtain the feature vector S772, UP2 is subjected to 1×1 convolution operations to obtain the feature vector UP21, and S772 and UP21 are concatenated on the channel to obtain K33; S772 is subjected to two upsampling and After a 1×1 convolution operation, the feature vector S773 is obtained. After a 1×1 convolution operation on UP1, the feature vector UP11 is obtained. S773 and UP11 are concatenated on the channel to obtain K44; K22 is convolved with 1×1 and downsampled twice to obtain K221, K44 is upsampled twice, and then concatenated with K33 on the channel to obtain L11; L11 and S771 are downsampled and upsampled respectively, and then concatenated with K44 on the channel to obtain L22, and then downsampled twice more to obtain the feature vector L33.
[0054] Step 3: Input the feature vector L33 obtained in the above steps into two consecutive double downsampling operations, AvgPool2d layer, and fully connected layer in sequence. Then, the classification result and the true value are used as loss. Through continuous iteration of the forward and backward propagation processes, the model parameters are updated through the momentum gradient descent algorithm to optimize the network parameters until the best weight is obtained.
[0055] Step 4: Use the best training model weight as the pre-training model to verify the data images in the test set, and evaluate the performance of the model through four indicators: Accuracy, Precision, Recall, and F1-Measure.
[0056] The calculation formulas for each indicator are as follows:
[0057]
[0058]
[0059]
[0060]
[0061] Among them, TP (True Positives): true positive examples, predicted as positive examples and actually positive examples; FP (False Positives): false positive examples, predicted as positive examples but actually negative examples; FN (false Negatives): false negative examples, predicted as negative examples but actually positive examples; TN (True Negatives): true negative examples, predicted as negative examples but actually negative examples.
[0062] Table 2 Comparison of the experimental results of the present invention with those of the traditional model and the lightweight model
[0063] Model name Accuracy GoogleNet 98.72% Densenet 98.80% ConvNeXt 95.62% Mobilenet 99.10% UpCPFNet 99.37%
[0064] The experimental results of the UpCFPNet model proposed in the present invention are shown in Table 2. It can be seen that the recognition efficiency of the model proposed in the present invention reaches 99.37%, which has high robustness and practical application value, and has great prospects in the field of crop fruit grading and recognition.
Claims
1. A mango grading and identification method based on the UpCPFNet model, characterized in that: The following steps are involved: (1) The pre-acquired mango images are graded and made into a data set, which is then divided into a training set and a test set according to a certain ratio; (2) Preprocessing the mango grading dataset obtained in step (1); (3) A mango grading recognition network based on the UpCPFNet model was constructed, including a preliminary feature extraction module Stem, three UpCFP modules, a DoDB module and four Stage blocks; the Stem module performs simple downsampling and increases the number of channels; the four Stage blocks stack the feature extraction backbone module ReHRSE in a 1:1:3:1 ratio for deep feature extraction; the first Stage block includes a ReHRSE module followed by an UpCFP module; the second Stage block includes a ReHRSE module followed by an UpCFP module, the third Stage block includes three ReHRSE modules followed by an UpCFP module, and the fourth Stage block includes a ReHRSE module; the UpCFP module extracts features of different scales in the basic network, and the DoDB module realizes feature aggregation and fuses features at different scales; (4) The mango grading recognition network based on the UpCPFNet model built in step (3) is trained by first training the training set after image preprocessing in step (2) through the model, performing multiple iterations of training and adjusting the training parameters of the model until the optimal model weight is obtained. The data images in the test set are verified and the performance of the model is evaluated. Step (3) The preliminary feature extraction module Stem is composed of a 4×4 convolution kernel and a BatchNorm layer; In step (3), the ReHRSE module first introduces the first branch through 7×7 convolution, introduces the channel attention mechanism into the second branch structure, branches again, and the third branch undergoes 3×3 depthwise separable convolution and residual connection with the second branch; stacking is performed less than 2 times, the second branch performs 1×1 depthwise separable convolution, the third branch performs 3×3 depthwise separable convolution, and the second branch and the third branch perform residual connection; then the second branch performs 1×1 depthwise separable convolution and residual connection with the first branch; Step (3) The first branch of the UpCFP module undergoes a 3×3 convolution, a 1×1 convolution, and two 2×2 convolutions in sequence; the second branch undergoes a 2×2 convolution, and then the features obtained from the two branches are concatenated on the channel; In the DoDB module of step (3), the output features of the deep layer are respectively concatenated with the output of the third UpCFP module through two 1×1 convolutions to obtain the features of the minimum size, and then concatenated with the output of the second UpCFP module through 1×1 convolution to obtain the features of the intermediate size, and then concatenated with the output of the first UpCFP module through 1×1 convolution to obtain the features of the maximum size. The features of the maximum size are downsampled after 1×1 convolution and the features of the minimum size are upsampled after 1×1 convolution, and then concatenated with the features of the intermediate size after 1×1 convolution on the channel, the obtained features are downsampled, the output features of the deep layer are upsampled, and the features of the minimum size are fused on the channel, and then downsampled.
2. A mango grading recognition network based on the UpCPFNet model according to claim 1, characterized in that, Step (1) divides the data images into 8 categories according to the size, color, and appearance of mangoes.
3. A mango grading and identification method based on UpCPFNet model according to claim 1, characterized in that, The image preprocessing in step (2) is to perform data enhancement on all leaf images, including random horizontal rotation, size cropping and data format conversion.
4. A mango grading and identification method based on UpCPFNet model according to claim 1, characterized in that, The specific implementation process of step (3) is as follows: The preprocessed features are used as the input of the convolutional network for convolution operation with kernel_size=4, and then the feature vector S11 is obtained through the Relu activation function; Enter the first Stage block, input S11 into the ReHRSE module, input S11 into the first branch, pass through the convolution of kernel_size=7, input S11 into the second branch structure through the channel attention mechanism, and then branch again, the third branch passes through the depth-separable convolution of kernel_size=3, and the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch, and the third branch performs the depth-separable convolution of kernel_size=3 again, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution and RELU activation layer of kernel_size=1 in the second branch; the third branch performs the depth-separable convolution of kernel_size=3 again, and then the features of the second branch and the third branch are residually connected; the obtained features pass through the depth-separable convolution of kernel_size=1 in the second branch, and the obtained features are residually connected with the first branch, and then the feature vector Y44 is obtained through the RELU activation layer; Input Y44 into the UpCFP module, upsample Y44 by 2 times, perform convolution with kernel_size=3 and convolution with kernel_size=1, then pass through the BatchNorm layer and the RELU activation layer, and then downsample twice to obtain the feature vector UP1. Y44 is downsampled twice and concatenated with UP1 in the channel to obtain S22. Enter the second Stage block and obtain the feature vector Z44; input Z44 into the UpCFP2 module to obtain the feature vectors UP2 and S33; Enter the third Stage block, input S33 into the ReHRSE module to obtain the feature vector S44; input S44 into the ReHRSE module to obtain the feature vector S55; input S55 into the ReHRSE module to obtain the feature vector M44; input M44 into the UpCFP module to obtain the feature vectors UP3 and S66; Enter the fourth Stage block and input S66 into the ReHRSE module to obtain the feature vector S77; S77 is input into the DoDB module. S77 is upsampled twice and subjected to two 1×1 convolution operations to obtain the feature vector S771. UP3 is subjected to a 1×1 convolution operation to obtain the feature vector UP31. S771 and UP31 are concatenated on the channel to obtain the feature vector K22. S771 is upsampled twice and subjected to a 1×1 convolution operation to obtain the feature vector S772. UP2 is subjected to a 1×1 convolution operation to obtain the feature vector UP21. S772 and UP21 are concatenated on the channel to obtain K33. S772 is upsampled twice and subjected to a 1×1 convolution operation to obtain the feature vector UP21. After upsampling and 1×1 convolution operation, feature vector S773 is obtained. After 1×1 convolution operation on UP1, feature vector UP11 is obtained. S773 and UP11 are concatenated on the channel to obtain K44. K22 is convolved with 1×1 and downsampled twice to obtain K221. K44 is upsampled twice and then concatenated with K33 on the channel to obtain L11. L11 and S771 are downsampled and upsampled respectively, and then concatenated with K44 on the channel to obtain L22, and then downsampled twice more to obtain feature vector L33. The L33 input undergoes two consecutive downsampling operations, an AvgPool1d layer, and a fully connected layer, and finally outputs the classification result F.
Citation Information
Patent Citations
Remote sensing image classification method based on CNN-self-attention mechanism hybrid architecture
CN115641473A
Image semantic segmentation method based on multi-scale attention mechanism
CN115775316A
