Yangcheng Lake hairy crab identification method using multi-channel AlexNet network structure

By employing techniques such as the multi-channel AlexNet network structure and residual Gaussian filtering, the problem of low recognition accuracy of Yangcheng Lake hairy crabs was solved, achieving efficient recognition in complex environments, reducing the risk of counterfeiting, and improving recognition accuracy and model performance.

CN121883901APending Publication Date: 2026-04-17王枝宝
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
王枝宝
Filing Date
2023-11-07
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing methods for identifying Yangcheng Lake hairy crabs are not very accurate and cannot effectively distinguish them from hairy crabs from other lakes. Counterfeiting is rampant in the market, and existing technologies suffer from problems such as confusion in identification subjects and low accuracy.

Method used

A multi-channel AlexNet network structure was adopted, which combined residual Gaussian filtering, ReLU activation function, Dropout operation and attention loss function. Through image preprocessing, feature extraction, feature fusion and classification layer methods, the characteristic features of Yangcheng Lake hairy crabs were identified, including the color features of the back, abdomen, crab legs and crab claws.

Benefits of technology

It improves the accuracy and convenience of identifying Yangcheng Lake hairy crabs, enabling accurate identification of hairy crabs in dimly lit environments with abundant water, reducing the risk of counterfeiting, and improving the model's operating efficiency and recognition effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883901A_ABST
    Figure CN121883901A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, in particular to a Yangcheng Lake hairy crab recognition method using a multi-channel AlexNet network structure, and the method comprises the steps: constructing a hairy crab image data set; the image data set comprises a plurality of data subsets, and the data subsets comprise four images of the same hairy crab, namely the back, the abdomen, the crab legs and the crab claws; performing image preprocessing on the image data set; training a Yangcheng Lake hairy crab identification model through the image set; after the data set is input into a Yangcheng Lake hairy crab recognition model, corresponding color threshold parameters are obtained according to color conditions of different parts of a hairy crab to be detected, weighted combination is performed on extracted data features, judgment is performed, and then a judgment result of the image is output. According to the method, the color characteristics of multiple parts of green backs, white bellies, yellow hairs and golden claws of the Yangcheng Lake hairy crabs are utilized, an image recognition technology is introduced into judgment of the hairy crabs, and the authenticity of the Yangcheng Lake hairy crabs is accurately judged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, specifically to a method for recognizing Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure. Background Technology

[0002] The Chinese mitten crab (Eriocheir sinensis) is a type of river crab. It is highly prized for its delicious meat, excellent taste, and high nutritional value. Common types of Chinese mitten crabs in China include those from Yangcheng Lake, Taihu Lake, Hongze Lake, Honghu Lake, and Gucheng Lake. Although these crabs are essentially the same species, differences in their habitat and farming methods result in variations in appearance, size, and taste. The Yangcheng Lake crab is considered the highest quality, a renowned brand in China, and is slightly larger and has better nutritional value and taste compared to other types.

[0003] Through long-term aquaculture development, Yangcheng Lake hairy crabs have developed four distinctive characteristics. First, their shells are bluish-gray, smooth, and glossy. Second, their bellies are white, slightly yellowish with a hint of moisture, unlike the gray of other crabs. Third, their leg hairs are yellow and upright. Fourth, their claws are golden and powerful, with tips resembling shredded tobacco. In terms of price, Yangcheng Lake hairy crabs far exceed those from other lakes. The market frequently sees crabs from other lakes being used to impersonate Yangcheng Lake crabs, and these crabs are generally similar with only minor differences, making differentiation a challenging task and requiring a scientifically effective method of identification.

[0004] Existing methods for identifying and preventing counterfeiting of Yangcheng Lake hairy crabs include laser engraving, information query, and image recognition technology.

[0005] Laser engraving and information query methods use pre-set unique labels associated with hairy crabs for anti-counterfeiting identification. However, these methods are confusing in terms of the identification subject and focus on the uniqueness of the bound labels, leaving room for counterfeiting.

[0006] Regarding the use of image recognition technology, patent CN201610691336.6 proposes an image recognition method for identifying river crabs, including steps such as acquiring river crab images, image preprocessing, constructing a river crab pattern diagram, calculating feature values, constructing a group pattern diagram, calculating group feature values, and identifying individual river crabs. This patented invention focuses on the identification of different varieties of river crabs, judging them by extracting images of the crab's cephalothorax. However, the identification of Yangcheng Lake hairy crabs is performed within the same variety of hairy crab. Therefore, when fewer or less obvious features are extracted, the accuracy remains low.

[0007] Given that the above-mentioned identification methods do not achieve high accuracy in identifying Yangcheng Lake hairy crabs, this invention proposes a Yangcheng Lake hairy crab identification method using a multi-channel AlexNet network structure. Summary of the Invention

[0008] The purpose of this invention is to provide a method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure, which uses image recognition technology to identify the authenticity of Yangcheng Lake hairy crabs.

[0009] To achieve the above objectives, the present invention provides the following technical solution, including:

[0010] Step 1: Collect images of mitten crabs and construct an image dataset.

[0011] The hairy crabs mentioned include two types of labels: Yangcheng Lake hairy crabs and non-Yangcheng Lake hairy crabs.

[0012] The image set of hairy crabs contains several data subsets, each containing four photos: a photo of the back, abdomen, legs, and claws of the same hairy crab.

[0013] Step two: Perform image preprocessing on the image dataset.

[0014] The image preprocessing process includes sharpening the image using residual Gaussian filtering.

[0015] During image preprocessing, several factors can negatively impact image quality when photographing crabs. These include: 1) the high-end nature of crabs, requiring them to be alive most of the time, which means their movement affects the photographing process; 2) crabs need to be kept in water to maintain their vitality, inevitably leading to water interference during image capture and identification; and 3) the often dimly lit environments used for selling crabs further affect the lighting. Therefore, image optimization is necessary to remove noise and increase contrast when acquiring crab images.

[0016] This invention selects residual Gaussian filtering for image optimization.

[0017] Classic Gaussian filtering is a commonly used image processing technique. Its working principle involves weighting the pixel to be calculated against its neighboring pixels and then using the weighted pixel value for optimization. The weights are closely related to the distance between the neighboring pixels and the pixel to be calculated. When the distance between the neighboring pixels and the pixel to be calculated increases, the weight of the neighboring pixel decreases; conversely, when the distance decreases, the weight of the neighboring pixel increases. Gaussian filtering only considers spatial distribution and does not pay much attention to the magnitude difference of pixel values, often resulting in poor edge optimization.

[0018] This invention proposes a residual Gaussian filter based on classical Gaussian filtering, with the following formula:

[0019]

[0020] Gau(m,n)=∑ (x,y)∈U G(x,y)T(x,y)

[0021] F(m,n,α)=p θ T(m,n)+(1-p) θ Gau(T(m,n))

[0022] In this invention, a 3x3 sliding window Gaussian template is used, where (m,n) is the center point of the sliding window, (x,y) are the coordinates of other points in the neighborhood with (m,n) as the origin, σ is the standard deviation of the Gaussian function, and U represents the range of the 3x3 sliding window. G(x,y) is the point weight calculated by Gaussian filtering, T(m,n) is the pixel input value, and Gau(m,n) is the Gaussian filtered transformation value of the pixel input value. F(m,n,α) is the final image output, and p and θ are dynamic factors that can be dynamically adjusted according to the learning results.

[0023] By adding the original features of the image to the features transformed by Gaussian filtering, and introducing a dynamic factor to adjust the original features and the Gaussian filtering transformation, we can enhance the representation of the size of the original image features while emphasizing spatial distribution in Gaussian filtering, and alleviate its insufficient optimization of image edge regions.

[0024] Step 3: Train the Yangcheng Lake hairy crab recognition model using the training set.

[0025] After the training set is input into the Yangcheng Lake hairy crab recognition model, it passes through the data input layer, feature extraction layer, feature fusion layer, and classification layer in sequence, and then outputs the judgment result of the image; the image judgment result is used to distinguish whether the hairy crab in the image is a Yangcheng Lake hairy crab.

[0026] The data input layer inputs multiple photos from each data subset into the corresponding input channels.

[0027] The feature extraction layer contains four independent AlexNet network models, each capable of recognizing multiple images in each dataset; it includes a loss function that is adjusted according to the different features of the images.

[0028] The feature extraction layer contains four independent AlexNet network structures. The AlexNet network structure is relatively simple, specifically consisting of 5 convolutional layers and 3 fully connected layers, for a total of 8 network layers.

[0029] The first convolutional layer contains a large-scale 11*11 convolutional kernel with a stride of 4, and does not expand the image edges. After processing the input image, an activation function is used for optimization. The optimized data is then fed into a 3*3 max pooling layer for further processing, with a stride of 2.

[0030] The second convolutional layer contains 5*5 convolutional kernels with a stride of 1, and expands the image edges by 2. After processing the input image, it is optimized using an activation function. The optimized data is then fed into a 3*3 max pooling layer for further processing, with a stride of 2.

[0031] The third convolutional layer contains a 3*3 convolutional kernel with a stride of 1, expanding the image edges by 1; after processing the input image, it is optimized using an activation function.

[0032] The fourth convolutional layer contains a 3*3 convolutional kernel with a stride of 1, expanding the image edges by 1; after processing the input image, it is optimized using an activation function.

[0033] The fifth convolutional layer contains 3x3 convolutional kernels with a stride of 1, expanding the image edges by 1. After processing the input image, an activation function is used for optimization. The optimized data is then fed into a 3x3 max-pooling layer for further processing, with a stride of 2.

[0034] The first fully connected layer consists of three steps: performing fully connected processing of the input data through convolution, optimizing it using an activation function, and removing some neural nodes in the fully connected layer through a dropout operation to prevent overfitting.

[0035] The second fully connected layer consists of three steps: performing fully connected processing of the input data through convolution, optimizing it using an activation function, and removing some neural nodes in the fully connected layer through a dropout operation to prevent overfitting.

[0036] The third fully connected layer consists of two steps: performing fully connected processing of the input data through convolution, and using the softmax function for classification.

[0037] The AlexNet network architecture uses the ReLU activation function. Compared to other activation functions, ReLU reduces training time and effectively prevents overfitting during training. These advantages make ReLU efficient and practical, helping to improve model training performance.

[0038] The formula for the ReLU activation function is:

[0039]

[0040] Where x is the value of the input activation function; f is the output value after processing by the activation function.

[0041] Pooling is similar in form to convolution, both involving computation between the original image matrix or feature map matrix and a fixed-shape window to output a feature map. However, convolution uses a kernel to convolve the original image, and this kernel has a data weighting property. Pooling, on the other hand, directly calculates the original data within the pooling window. This calculation can involve selecting the maximum, minimum, or average value, corresponding to max pooling, min pooling, and average pooling, respectively. The AlexNet network structure uses max pooling, which extracts the maximum data from a specified window, significantly reducing the number of parameters in the feature map—this is the primary function of the max pooling layer. Furthermore, because max pooling extracts the maximum data from a specific window regardless of its original position within the window, it also alleviates the sensitivity to the location of the features being identified.

[0042] The Dropout operation sets the output of each hidden layer neuron with a probability less than 0.5 to 0, effectively removing some neural nodes to prevent overfitting. The Dropout operation reduces the complex interactions between neurons, greatly improving the efficiency of the model.

[0043] Cross-entropy loss is a common loss function in machine learning. It measures the difference between predicted and true values. It utilizes the concept of entropy to first transform the model into an entropy value, and then uses this value to compare the differences between the models. The calculation process of cross-entropy loss is as follows: First, define a target distribution based on the distribution of the true values; then, calculate the cross-entropy between the distribution of predicted values ​​and the target distribution; finally, use the calculated cross-entropy as the output of the loss function.

[0044] The cross-entropy loss function focuses more on measuring the distributional difference between two probabilities, without addressing the imbalance of data or the difficulty of identification. In this invention, the amount of data on Yangcheng Lake hairy crabs and non-Yangcheng Lake hairy crabs differs, and the invention includes four independent training models trained on different features, each with varying degrees of difficulty in feature identification, thus placing different demands on the loss function. Based on these factors, this invention proposes an attention-based loss function:

[0045] L=-yln(a)+(1-y)ln(1-a)

[0046] Loss=βe (2-β) L

[0047] In the formula, y represents the actual label, a is the probability value predicted by the model, L represents the cross-entropy loss function, e is a mathematical constant, and β is the dynamic attention factor, which is a value greater than 0 and can be adjusted according to the difficulty of training features. Specifically, in this invention, the parameters can be adjusted according to the different training conditions of the features of the back, abdomen, crab legs, and crab claws.

[0048] The feature fusion layer in the Chenghu hairy crab identification model includes a color threshold parameter, which is derived based on the color of different parts of the hairy crab. The calculation formula for the color threshold parameter of a certain part of the hairy crab is as follows:

[0049]

[0050] Where w is the color threshold parameter; γ1 and γ2 are set parameters, γ1 is greater than 1, and γ2 is less than 1; x min x is the smallest color feature value among the images labeled "Yangcheng Lake hairy crab" in the image dataset; max x is the color feature value with the largest value in the images labeled "Yangcheng Lake hairy crab" in the image dataset; i The color feature value is the color characteristic value of the crab to be detected. The color feature value x... min x max and x i The calculation method involves converting the image to grayscale, identifying specific parts of the crab, and calculating the average grayscale value of those specific parts.

[0051] The classification layer makes a judgment based on the result of the feature combination.

[0052] Step four: Validate and optimize the Yangcheng Lake hairy crab identification model using the validation set.

[0053] Step 5: Use the trained Yangcheng Lake hairy crab recognition model to determine the type of hairy crab and output the judgment result.

[0054] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0055] 1. This invention proposes a Yangcheng Lake hairy crab recognition model based on the AlexNet network structure. Multiple AlexNet networks are run in parallel, and a color threshold parameter is derived based on the color contrast between the crab to be detected and the collected image dataset of Yangcheng Lake hairy crabs. Features of the crab's back, abdomen, claws, and legs are then fused and judged, and the judgment result is output. Compared with common hairy crab recognition technologies, this invention focuses on the recognition of Yangcheng Lake hairy crabs, starting from the characteristics of the crab itself. Image recognition is performed based on the features of the crab's back, abdomen, legs, and claws, eliminating the need for pre-set labels for comparison, making it more accurate and convenient.

[0056] 2. Considering the need to ensure the health and freshness of Yangcheng Lake hairy crabs when identifying them, which are typically found in suitable environments characterized by low light and abundant water, this invention proposes residual Gaussian filtering, introducing a residual structure based on Gaussian filtering. Compared to classic Gaussian filtering, residual Gaussian filtering offers advantages such as smoothness, unblurred edges, and greater clarity when processing Yangcheng Lake hairy crab images, helping the model to better identify them.

[0057] 3. This paper proposes an attention loss function based on the cross-entropy loss function. The proposed Yangcheng Lake hairy crab recognition model includes multiple independent AlexNet network structures to identify the back, abdomen, claws, and legs of the Yangcheng Lake hairy crab. Because different image features have different levels of difficulty in recognition, using a uniform cross-entropy loss function will inevitably encounter inaccurate recognition in some AlexNet network structures. Therefore, this invention introduces an attention function into the loss function, which can be adjusted according to the different image features being identified, making it more adaptable to multi-feature extraction situations, helping to improve the working effect of the loss function and improve the model's running efficiency. Attached Figure Description

[0058] Figure 1 This is a schematic diagram of the training process of the Yangcheng Lake hairy crab model of the present invention;

[0059] Figure 2 This is a schematic diagram of the logic judgment of the Yangcheng Lake hairy crab model of the present invention;

[0060] Figure 3 This is a schematic diagram of a comparative experiment between the residual Gaussian filter of this invention and a filter of the same type;

[0061] Figure 4This is a schematic diagram of the structure of the Yangcheng Lake hairy crab identification model of the present invention;

[0062] Figure 5 This is a schematic diagram of the AlexNet network structure in the Yangcheng Lake hairy crab identification model of the present invention;

[0063] Figure 6 This is a schematic diagram illustrating the comparison between the attention loss function of this invention and common loss functions. Detailed Implementation

[0064] The proposed method for identifying and authenticating Yangcheng Lake hairy crabs will be further explained below according to the accompanying drawings provided in this invention. The technical explanations and experimental data involved in the specific implementation section are merely a specific embodiment of this technical solution. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0065] Please see Figures 1 to 6 This invention discloses a method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure. The purpose of this invention is to determine whether a given hairy crab belongs to Yangcheng Lake.

[0066] The Chinese mitten crab (Eriocheir sinensis) is a type of river crab. It is highly prized for its delicious meat, excellent taste, and high nutritional value. Currently, the most common types of Chinese mitten crabs in China include those from Yangcheng Lake, Taihu Lake, Hongze Lake, Honghu Lake, and Gucheng Lake. Although these crabs are essentially the same species, differences in their habitat and farming methods lead to variations in appearance, size, and taste. Yangcheng Lake crabs are considered the highest quality and are the most renowned brand in China. Compared to other types, they are larger, more nutritious, and have a better taste. Yangcheng Lake crabs are significantly more expensive than those from other lakes, leading to the frequent sale of crabs from other lakes as Yangcheng Lake crabs. Because these crabs are generally similar with only minor differences, distinguishing them can be challenging, necessitating a scientific and effective method for identification.

[0067] Through long-term aquaculture development, Yangcheng Lake hairy crabs have developed four distinctive characteristics: First, their shells are bluish-gray, smooth, and glossy; second, their bellies are white with a slight yellowish tinge and a glossy sheen, unlike the gray of other crabs; third, their legs are covered in yellow, upright hairs; and fourth, their claws are golden and powerful, with tips that are a shredded golden yellow.

[0068] This invention utilizes the aforementioned characteristics of Yangcheng Lake hairy crabs to establish a Yangcheng Lake hairy crab identification model for judgment. The logical approach to the judgment is as follows: Figure 2 As shown. The technical solution is as follows:

[0069] Step 1: Collect images of mitten crabs, construct an image dataset, and divide it into a training set and a validation set.

[0070] The hairy crabs mentioned include two types of labels: Yangcheng Lake hairy crabs and non-Yangcheng Lake hairy crabs.

[0071] The image set of hairy crabs contains several data subsets, each containing four photos: a photo of the back, abdomen, legs, and claws of the same hairy crab.

[0072] Step two: Perform image preprocessing on the image dataset.

[0073] The image preprocessing process includes sharpening the image using residual Gaussian filtering.

[0074] During image preprocessing, many factors can affect the quality of photos taken of crabs. For example, firstly, the special requirements of crabs as a high-end food mean they are usually alive and vigorous, which means their movement can affect the photo quality; secondly, crabs need to be kept in water to maintain their vitality, and water interference is unavoidable when photographing and identifying them; and thirdly, crabs are usually sold in dimly lit and shady environments, which also affects the lighting conditions.

[0075] Based on the above factors, when acquiring images of hairy crabs, it is necessary to optimize the images to remove noise and increase contrast.

[0076] This invention selects residual Gaussian filtering for image optimization.

[0077] Classic Gaussian filtering is a commonly used image processing technique. Its working principle involves weighting the pixel to be calculated against its neighboring pixels and then using the weighted pixel value for optimization. The weights are closely related to the distance between the neighboring pixels and the pixel to be calculated. When the distance between the neighboring pixels and the pixel to be calculated increases, the weight of the neighboring pixel decreases; conversely, when the distance decreases, the weight of the neighboring pixel increases. However, Gaussian filtering only considers spatial distribution and does not pay much attention to the magnitude of pixel values, often resulting in poor edge optimization.

[0078] This invention proposes a residual Gaussian filter based on the classical Gaussian filter and by referencing the residual structure of residual networks. The formula is as follows:

[0079]

[0080] Gau(m,n)=∑ (x,y)∈U G(x,y)T(x,y)

[0081] F(m,n,α)=p θ T(m,n)+(1-p) θ Gau(T(m,n))

[0082] In this invention, a 3x3 sliding window Gaussian template is used, where (m,n) is the center point of the sliding window, (x,y) are the coordinates of other points in the neighborhood with (m,n) as the origin, σ is the standard deviation of the Gaussian function, and U represents the range of the 3x3 sliding window. G(x,y) is the point weight calculated by Gaussian filtering, T(m,n) is the pixel input value, and Gau(m,n) is the Gaussian filtered transformation value of the pixel input value. F(m,n,α) is the final image output, and p and θ are dynamic factors that can be dynamically adjusted according to the learning results.

[0083] By adding the original features of the image to the features transformed by Gaussian filtering, and introducing a dynamic factor to adjust the original features and the Gaussian filtering transformation, we can enhance the representation of the size of the original image features while emphasizing spatial distribution in Gaussian filtering, and alleviate its insufficient optimization of image edge regions.

[0084] To verify the actual effect of residual Gaussian filtering, this invention conducts a comparative study on different image sharpening methods.

[0085] This invention uses the controlled variable method, and the models used are all Yangcheng Lake hairy crab recognition models, with the only difference being the image sharpening method in the models.

[0086] The experimental group consisted of the first model using residual Gaussian filtering, while the control group consisted of three groups: the second model using Gaussian filtering; the third model using mean filtering; and the fourth model using median filtering.

[0087] The data used was the collected image dataset. After image preprocessing, 80% of the image dataset was selected for each experiment using random sampling.

[0088] The training set was used to train the corresponding first, second, third, and fourth models, and the parameters of each model were obtained. The test set was used to test the corresponding models, and the accuracy rate of the Yangcheng Lake hairy crab identification model was obtained. The accuracy rate is the ratio of the number of times the Yangcheng Lake hairy crab identification model correctly identified the crab in the test set data to the total number of identifications. The above experimental process was repeated 10 times, and the accuracy rate of each model was recorded.

[0089] The final experimental results are as follows Figure 3 As shown in the figure, the horizontal axis represents the number of experiments, the vertical axis represents the recognition accuracy of the model, and different curves represent experimental models using different image sharpening processing methods.

[0090] Overall, the experimental results show that the first model using residual Gaussian filtering has the highest average accuracy of 91.65%, followed by the third model using mean filtering with an accuracy of 88.01%, then the second model using Gaussian filtering with an accuracy of 87.17%, and finally the fourth model using median filtering with an accuracy of 86.77%.

[0091] Step 3: Train the Yangcheng Lake hairy crab recognition model using the training set.

[0092] After the training set is input into the Yangcheng Lake hairy crab recognition model, it passes through the data input layer, feature extraction layer, feature fusion layer, and classification layer in sequence, and then outputs the judgment result of the image; the image judgment result is used to distinguish whether the hairy crab in the image is a Yangcheng Lake hairy crab.

[0093] The structure of the Yangcheng Lake hairy crab identification model is as follows: Figure 4 As shown.

[0094] The data input layer inputs multiple photos from each data subset into the corresponding input channels.

[0095] The feature extraction layer contains four independent AlexNet network models, each capable of recognizing multiple images in each dataset; the model includes an attention loss function that is adjusted according to the different features of the image.

[0096] The AlexNet network model structure is as follows: Figure 5 As shown.

[0097] The feature extraction layer contains four independent AlexNet network structures. The AlexNet network structure is relatively simple, specifically consisting of 5 convolutional layers and 3 fully connected layers, for a total of 8 network layers.

[0098] The first convolutional layer contains a large-scale 11*11 convolutional kernel with a stride of 4, and does not expand the image edges. After processing the input image, an activation function is used for optimization. The optimized data is then fed into a 3*3 max pooling layer for further processing, with a stride of 2.

[0099] The second convolutional layer contains 5*5 convolutional kernels with a stride of 1, and expands the image edges by 2. After processing the input image, it is optimized using an activation function. The optimized data is then fed into a 3*3 max pooling layer for further processing, with a stride of 2.

[0100] The third convolutional layer contains a 3*3 convolutional kernel with a stride of 1, expanding the image edges by 1; after processing the input image, it is optimized using an activation function.

[0101] The fourth convolutional layer contains a 3*3 convolutional kernel with a stride of 1, expanding the image edges by 1; after processing the input image, it is optimized using an activation function.

[0102] The fifth convolutional layer contains 3x3 convolutional kernels with a stride of 1, expanding the image edges by 1. After processing the input image, an activation function is used for optimization. The optimized data is then fed into a 3x3 max-pooling layer for further processing, with a stride of 2.

[0103] The first fully connected layer consists of three steps: performing fully connected processing of the input data through convolution, optimizing it using an activation function, and removing some neural nodes in the fully connected layer through a dropout operation to prevent overfitting.

[0104] The second fully connected layer consists of three steps: performing fully connected processing of the input data through convolution, optimizing it using an activation function, and removing some neural nodes in the fully connected layer through a dropout operation to prevent overfitting.

[0105] The third fully connected layer consists of two steps: performing fully connected processing of the input data through convolution, and using the softmax function for classification.

[0106] The AlexNet network architecture uses the ReLU activation function. Compared to other activation functions, ReLU reduces training time and effectively prevents overfitting during training. These advantages make ReLU efficient and practical, helping to improve model training performance.

[0107] The formula is:

[0108]

[0109] Where x is the value of the input activation function; f is the output value after processing by the activation function.

[0110] Pooling is similar in form to convolution, both involving computation between the original image matrix or feature map matrix and a fixed-shape window to output a feature map. However, convolution uses a kernel to convolve the original image, and the kernel has a data weighting property. Pooling, on the other hand, directly calculates the original data within the pooling window. This calculation can involve selecting the maximum, minimum, or average value, corresponding to max pooling, min pooling, and average pooling, respectively. The AlexNet network structure uses max pooling, which extracts the maximum data from a specified window, significantly reducing the number of parameters in the feature map. This is the main function of the max pooling layer. Furthermore, because max pooling extracts the maximum data from a specific window regardless of its original position within the window, it also alleviates the sensitivity to the location of the features being identified.

[0111] The Dropout operation sets the output of each hidden layer neuron with a probability less than 0.5 to 0, effectively removing some neural nodes to prevent overfitting. The Dropout operation reduces the complex interactions between neurons, greatly improving the efficiency of the model.

[0112] Cross-entropy loss is a common loss function in machine learning. It measures the difference between predicted and true values. It utilizes the concept of entropy to first transform the model into an entropy value, and then uses this value to compare the differences between the models. The calculation process of cross-entropy loss is as follows: First, define a target distribution based on the distribution of the true values; then, calculate the cross-entropy between the distribution of predicted values ​​and the target distribution; finally, use the calculated cross-entropy as the output of the loss function.

[0113] The cross-entropy loss function focuses more on measuring the distributional difference between two probabilities, without addressing the imbalance of data or the difficulty of identification. In this invention, the amount of data on Yangcheng Lake hairy crabs and non-Yangcheng Lake hairy crabs differs, and the invention includes four independent training models trained on different features, each with varying degrees of difficulty in feature identification, thus placing different demands on the loss function. Based on these factors, this invention proposes an attention-based loss function:

[0114] L=-yln(a)+(1-y)ln(1-a)

[0115] Loss=βe (2-β) L

[0116] In the formula, y represents the actual label, a is the probability value predicted by the model, L represents the cross-entropy loss function, e is a mathematical constant, and β is the dynamic attention factor, which is a value greater than 0 and can be adjusted according to the difficulty of training features. Specifically, in this invention, the parameters can be adjusted according to the different training conditions of the features of the back, abdomen, crab legs, and crab claws.

[0117] To verify the actual effect of the attention loss function, this invention conducts a comparative study on different loss functions.

[0118] This invention uses the controlled variable method, and the models used are all Yangcheng Lake hairy crab identification models, with the only difference being the loss function in the model.

[0119] The experimental group consisted of the first model using the attention loss function, while the control group consisted of the second model using the cross-entropy loss function and the third model using the mean squared error loss function.

[0120] The data used was the collected image dataset. After image preprocessing, 80% of the image dataset was selected for each experiment using random sampling.

[0121] The first, second, and third models were trained using the training set to obtain the parameters for each model. The corresponding models were then tested using the test set to obtain the accuracy rate of the Yangcheng Lake hairy crab identification model. The accuracy rate is the ratio of the number of times the Yangcheng Lake hairy crab identification model correctly identified the crab in the test set data to the total number of identifications. This experimental process was repeated 10 times, and the accuracy rate of each model was recorded.

[0122] The final experimental results are as follows Figure 6 As shown in the figure, the horizontal axis represents the number of experiments, the vertical axis represents the recognition accuracy of the model, and different curves represent experimental models using different loss functions.

[0123] Overall, the experimental results show that the first model using the attention loss function has the highest average accuracy of 91.60%, followed by the second model using the cross-entropy loss function with an average accuracy of 96.44%, and finally the third model using the mean squared error with an average accuracy of 84.43%.

[0124] The feature fusion layer in the Chenghu hairy crab identification model includes a color threshold parameter, which is derived based on the color of different parts of the corresponding hairy crab.

[0125] The formula for calculating the color threshold parameter of a certain part of a hairy crab is as follows:

[0126]

[0127] Where w is the color threshold parameter; γ1 and γ2 are set parameters, γ1 is greater than 1, and γ2 is less than 1; x min x is the smallest color feature value among the images labeled "Yangcheng Lake hairy crab" in the image dataset; max x is the color feature value with the largest value in the images labeled "Yangcheng Lake hairy crab" in the image dataset; i The color feature value is the color characteristic value of the crab to be detected. The color feature value x... min x max and x i The calculation method involves converting the image to grayscale, identifying specific parts of the crab, and calculating the average grayscale value of those specific parts.

[0128] After adjusting and learning the model parameters, it was found that the model performed best when γ1 was 1.2 and γ2 was 0.9.

[0129] The classification layer makes a judgment based on the result of the feature combination.

[0130] Step four: Validate and optimize the Yangcheng Lake hairy crab identification model using the validation set.

[0131] Step 5: Use the trained Yangcheng Lake hairy crab recognition model to determine the type of hairy crab and output the judgment result.

[0132] The above is a specific embodiment based on the technical solution of the present invention. Various changes made to the embodiment without departing from the basic principles and ideas of the present invention are within the protection scope of the present invention.

Claims

1. A method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure, characterized in that, This includes a Yangcheng Lake hairy crab identification model used to determine the authenticity of Yangcheng Lake hairy crabs. The identification process is as follows: After photographing the hairy crabs to be detected, a set of images to be detected is obtained. The set of images to be detected is preprocessed and then input into the Yangcheng Lake hairy crab recognition model. The set of images to be detected passes through the data input layer, feature extraction layer, feature fusion layer and classification layer of the Yangcheng Lake hairy crab recognition model in sequence, and then outputs the judgment result of the image. The image judgment result is used to distinguish whether the hairy crab in the image is a Yangcheng Lake hairy crab. The data input layer is used to input the captured set of images to be detected into the model. The set of images to be detected includes four types of images: the back, abdomen, legs, and claws of the hairy crab. The feature extraction layer contains four independent AlexNet network structures, which are trained on the four types of images of different parts respectively. The AlexNet network structure contains an attention loss function that can be adjusted according to the identification part. The identification parts include four types of features of Yangcheng Lake hairy crab: back features, abdominal features, leg features, and claw features. The feature fusion layer includes color threshold parameters that correspond one-to-one with the four AlexNet network structures. The color threshold parameters weight the feature data output by the AlexNet network structures respectively, combine them to form a feature vector and output it. The classification layer performs classification judgment based on the combined feature vectors and outputs the judgment result.

2. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The training process of the Yangcheng Lake hairy crab recognition model is as follows: Collect images of Chinese mitten crabs and construct an image dataset; The image dataset is preprocessed. The image dataset is divided into a training set and a validation set; The Yangcheng Lake hairy crab recognition model was trained using the training set. The Yangcheng Lake hairy crab identification model was validated and optimized using the validation set.

3. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 2, characterized in that: The image dataset contains two types of labels; They are Yangcheng Lake hairy crabs and non-Yangcheng Lake hairy crabs, respectively.

4. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 2, characterized in that: The image dataset contains a subset of data, which contains four images. These are photos of the back, abdomen, legs, and claws of the same crab.

5. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The image preprocessing process uses residual Gaussian filtering, which is derived from classical Gaussian filtering. The formula for residual Gaussian filtering is: F(m, n, a) = p θ T(m, n) + (1 - p) θ Gau(T(m, n)) The Gaussian template used is a 3*3 sliding window, where (m,n) is the center point of the sliding window, (x,y) are the coordinates of a point in the neighborhood with (m,n) as the origin, σ is the standard deviation of the Gaussian function, and U represents the range of the 3*3 sliding window. G is the point weight calculated by Gaussian filtering, T is the pixel input value, and Gau is the Gaussian filter transformation value. F is the final image output, and p and θ are dynamic factors that can be dynamically adjusted according to the learning results.

6. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The AlexNet network structure consists of 5 convolutional layers and 3 fully connected layers, for a total of 8 layers. The convolutional layer includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a fourth convolutional layer, and a fifth convolutional layer; The fully connected layer includes a first fully connected layer, a second fully connected layer, and a third fully connected layer.

7. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The color threshold parameters are derived based on the color characteristics of the four types of parts of the mitten crab, specifically the color threshold parameters for the back, abdomen, legs, and claws. The calculation formulas for the color threshold parameters corresponding to the four types of parts of the mitten crab are as follows: Wherein, w is a color threshold parameter; γ1 and γ2 are set parameters, γ1 is greater than 1, and γ2 is less than 1; x min The minimum color feature value in the image data set tagged as the image of the Yangcheng Lake hairy crab; max The maximum color feature value in the image data set tagged as the image of the Yangcheng Lake hairy crab; i The color feature value of the to-be-detected hairy crab; the color feature value x min , x max , and x i The measurement method is to identify the specific part of the hairy crab after the image is grayed, and measure the average value of the gray value of the specific part.

8. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The attention loss function is based on the cross-entropy loss function, with an added attention function. The cross-entropy loss function is adjusted according to the difficulty of identifying sample features. The formula for the attention loss function is as follows: L=-yln(a)+(1-y)ln(1-a) Loss=βe (2-β) L In the formula, y represents the actual label, a is the probability value predicted by the model, L represents the cross-entropy loss function, β is the dynamic attention factor, which is a value greater than 0, and e is a mathematical constant.

9. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The activation function used in the model is the ReLU activation function. Where x is the value of the input activation function; f is the output value after processing by the activation function.

10. The method for identifying Yangcheng Lake hairy crabs using a multi-channel AlexNet network structure according to claim 1, characterized in that: The data flow of the Yangcheng Lake hairy crab identification model is as follows: The image dataset is preprocessed to obtain image set U1; Image set U1 is input into the first convolutional layer, processed by a large-scale 11*11 convolutional kernel, and optimized by the activation function; then it is input into a 3*3 max pooling layer for operation, and the output image set U2 is output. Image set U2 is input into the second convolutional layer, processed by a 5*5 convolutional kernel, and optimized by the activation function; then it is input into a 3*3 max pooling layer for operation, and the output image set U3 is produced. Image set U3 is input into the third convolutional layer, processed by a 3*3 convolutional kernel, and after optimization by the activation function, image set U4 is output. Image set U4 is input into the fourth convolutional layer, processed by a 3*3 convolutional kernel, and after optimization of the activation function, image set U5 is output. Image set U5 is input into the fifth convolutional layer, processed by a 3*3 convolutional kernel, and optimized by the activation function; then it is input into a 3*3 max pooling layer for operation, and output image set U6. Image set U6 is input into the first fully connected layer. After processing by the fully connected layer and optimization of the activation function, the Dropout operation is performed to output image set U7. Image set U7 is input into the second fully connected layer. After processing by the fully connected layer and optimization of the activation function, the Dropout operation is performed to output image set U8. The image set U8 is input into the third fully connected layer. After processing by the fully connected layer, the softmax function is used for classification and the classification result is output.

Citation Information

Patent Citations

  • Image identification method used for judging river crabs

    CN106305567A