A method for identifying biological signs of hard-shell clams based on YOLOX-S

By improving the YOLOX-S model and adding the CBAM attention mechanism, the problem of counting error of hard-shell clam seedlings is solved, and the survival rate, quantity, length and width of hard-shell clams is achieved is achieved, and the intelligence of aquaculture is improved. level of transformation.

CN114937266BActive Publication Date: 2024-11-26INST OF OCEANOLOGY - CHINESE ACAD OF SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210451007.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2024-11-26
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

In the breeding process of hard-shelled clam seedlings, the traditional clam seedling counting method relies on manual weighing and empirical naked-eye evaluation, which can easily cause errors, affect quality judgment, and lack efficient biological feature recognition methods.

Method used

The biological sign recognition method of hard shell clams based on YOLOX-S was adopted. By collecting image data sets, the YOLOX-S model was improved and the CBAM attention mechanism was added to train to identify the survival rate, number, and length and width of hard shell clams.

Benefits of technology

It realizes rapid and accurate identification of hard-shell clam biological signs, reduces artificial errors, and improves the intelligence level of aquaculture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114937266B_ABST
    Figure CN114937266B_ABST
Patent Text Reader

Abstract

The present invention provides a method for identifying biological signs of hard shell clams based on YOLOX‑S, comprising the following steps: S1, collecting hard shell clam images to construct a data set; S2, improving the YOLOX‑S model and adding a CBAM attention mechanism; S3, inputting the hard shell clam image to be detected, and training it using the improved YOLOX‑S model; S4, outputting a predicted image according to the training model, and completing the detection. The present invention has the beneficial effects of: using a machine vision method to realize rapid identification of biological signs of hard shell clams, which can effectively improve detection efficiency and reduce manual errors compared to traditional manual methods; by improving the traditional YOLOX‑S algorithm and adding a CBAM attention mechanism, a better detection effect is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of image recognition, and in particular relates to a hard-shell clam biological sign recognition method based on YOLOX-S. Background Art

[0002] Hard-shell clams, originally distributed on the east coast of the United States, are a type of buried shellfish. Due to their strong adaptability, delicious taste, high nutritional value and fast growth rate, they have become one of the main species for aquaculture in shallow sea mudflats and ponds in my country. In recent years, with the continuous improvement of people's living standards, the demand for hard-shell clams has continued to increase, and the supply of hard-shell clam seedlings has been in short supply. Therefore, factory-based artificial seedling cultivation has been carried out in China on a large scale. In the process of hard-shell clam seedling cultivation, the biological characteristics of hard-shell clam seedlings, such as survival rate, quantity, length and width, are important quality indicators of clam seedlings. However, in the current aquaculture industry, the cultivation of hard-shell clams is extensive, and the requirements for technology and management are not high. The data of hard-shell clam seedlings traded in each market is huge. The traditional method of counting clam seedlings is only through manual weighing, rough counting, and the survival status of clam seedlings often relies on experience and naked eye evaluation. The manual evaluation method is very easy to cause errors, which affects the judgment of the quality of clam seedlings. Summary of the invention

[0003] In view of this, the present invention aims to propose a hard clam biological sign recognition method based on YOLOX-S to at least solve at least one problem in the background technology.

[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0005] A method for identifying biological signs of hard-shell clams based on YOLOX-S, comprising the following steps:

[0006] S1, collect hard-shell clam images to build a dataset;

[0007] S2. Improve the YOLOX-S model and add the CBAM attention mechanism;

[0008] S3, input the hard-shell clam image to be detected and train it using the improved YOLOX-S model;

[0009] S4. According to the training model, the predicted image is output and the detection is completed.

[0010] Furthermore, in step S1, the collection method is: putting the hard-shell clam seedlings onto a glass slide, photographing the collected images under a microscope to construct a data set, and dividing the data set into a training set, a test set, and a validation set.

[0011] Furthermore, in step S2, four attention mechanism modules are added, and the attention mechanism is added to the three effective feature layers extracted from the backbone network, and the attention mechanism is also added to the sampled results.

[0012] Furthermore, in step S3, the hard-shell clam image to be detected is input, and the VOC format is selected to train the improved YOLOX-S model. The processed images mainly contain three folders, among which Annotations stores xml tag data, JPEGImages stores image data, and ImageSets stores txt files for training, verification, and testing.

[0013] Further, in step S1, the specific steps are as follows: according to the hard-shell clams in the original data set, the initial data set data is analyzed and expanded using data enhancement methods such as Mosaic, MixUp, and CutOut for rotation, translation, and contrast enhancement, and then labeled, and the labeled categories are divided into health and death; then the resolution size of the original data set image is set to be consistent, and then matched with the label of the original image data to obtain the labeled hard-shell clam recognition image and survival status label as the data set.

[0014] Furthermore, in step S2, the specific steps are as follows: the convolutional neural network of the improved YOLOX-S model is used to perform convolution operations of different sizes on the hard-shell clam images of the input training set, and three effective feature layers are generated after the backbone network CSPDarknet, and then attention mechanism modules are added respectively, and at the same time, the attention mechanism is added to the sampled results, and the added attention mechanisms are all CBAM modules.

[0015] Furthermore, the number of hard-shell clams is calculated by predicting the number of anchor frames, and the length and width of hard-shell clams are calculated by subtracting the absolute value of the distance between the pixel values ​​of healthy clams.

[0016] The convolutional neural network structure includes:

[0017] The local convolution stage includes one-dimensional convolution and pooling operations. It uses the fast speed of the YOLO convolutional neural network to enhance the contrast of the dataset images and mark the dead or alive features of the hard-shell clams.

[0018] The global convolution stage, including the convolution and pooling operations of the YOLOX-S convolutional neural network, extracts features from the hard-shell clam images containing the marked areas, and then performs the final recognition processing in the fully connected layer at the end of the network.

[0019] In a second aspect, the present solution discloses an electronic device, comprising a processor and a memory that is communicatively connected to the processor and is used to store executable instructions of the processor, wherein the processor is used to execute the hard-shell clam biological sign recognition method based on YOLOX-S described in the first aspect.

[0020] In the third aspect, the present solution discloses a server, comprising at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes the hard-shell clam biological sign recognition method based on YOLOX-S described in the first aspect.

[0021] In a fourth aspect, the present solution discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the hard-shell clam biological sign recognition method based on YOLOX-S as described in the first aspect.

[0022] Compared with the prior art, the hard-shell clam biological sign recognition method based on YOLOX-S described in the present invention has the following beneficial effects:

[0023] 1. Using machine vision methods to quickly identify the biological signs of hard-shell clams (survival rate, quantity, length and width) can effectively improve detection efficiency and reduce manual errors compared to traditional manual methods.

[0024] 2. By improving the traditional YOLOX-S algorithm and adding the CBAM attention mechanism, better detection effect is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0026] Figure 1 It is a flow chart of the biological sign recognition method of hard-shell clams based on the YOLOX-S model in the present invention;

[0027] Figure 2 It is a schematic diagram of the structure of the improved YOLOX-S network structure in the present invention;

[0028] Figure 3 This is a network training loss curve diagram of the hard-shell clam biological sign recognition method based on the YOLOX-S model in the present invention.

[0029] Figure 4 This is a P and R curve diagram of healthy hard-shell clams in the YOLOX-S algorithm in the experiment of the present invention.

[0030] Figure 5 This is a P and R curve diagram of dead hard-shell clams in the YOLOX-S algorithm in the experiment of the present invention.

[0031] Figure 6 This is the mAP curve of the hard-shell clam in the YOLOX-S algorithm in the experiment of the present invention.

[0032] Figure 7 This is a diagram of the test results of an example in the present invention. DETAILED DESCRIPTION

[0033] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0034] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0035] The present invention provides a method for identifying biological signs of hard shell clams based on YOLOX-S, including survival rate, quantity, length and width. The method realizes rapid detection of the survival rate, quantity, length and width of hard shell clams, avoids errors in manual detection, and improves the intelligent level of aquaculture.

[0036] In order to achieve the above purpose, the technical solution adopted is: a method for identifying the survival rate, quantity and length and width of hard shell clams based on the YOLOX-S model, the specific steps are as follows:

[0037] S1. Collect hard-shell clam images to construct a data set. Specifically, take an appropriate amount of hard-shell clam seedlings onto a glass slide, take images under a microscope, and construct a data set. The image size is 1280 × 720. The data set is divided into a training set, a test set, and a validation set.

[0038] S2. Improve the YOLOX-S model and add the CBAM attention mechanism. This model improvement adds a total of 4 attention mechanism modules, adding attention mechanisms to the three effective feature layers extracted from the backbone network, and adding attention mechanisms to the up-sampled results.

[0039] S3. Input the hard-shell clam image to be detected, and choose to use the VOC format to train the improved YOLOX-S. The processed images mainly contain three folders, among which Annotations stores xml label data, JPEGImages stores image data, and ImageSets stores txt files for training, verification, and testing.

[0040] S4. According to the training model, the predicted image is output and the detection is completed.

[0041] The above step S1 includes the following steps:

[0042] According to the hard-shell clams in the original data set, the initial data set data is analyzed and expanded using data enhancement methods such as Mosaic, MixUp, and CutOut for rotation, translation, and contrast enhancement, and then annotated, with the annotated categories divided into health and death; then the resolution size of the original data set image is set to be consistent, and similarly, the label of the original image data is matched to obtain the annotated hard-shell clam recognition image and the survival status label as the data set. On the other hand, the mentioned data set is divided into a training set and a test set, and the test set is used to test the accuracy and robustness of the hard-shell clam recognition model.

[0043] The step S2 comprises the following steps:

[0044] The convolutional neural network of the improved YOLOX-S model performs convolution operations of different sizes on the input training set hard-shell clam images, generates three effective feature layers after the backbone network CSPDarknet, and then adds attention mechanism modules respectively. At the same time, the attention mechanism is added to the upsampling result. The added attention mechanism is the CBAM module.

[0045] CBAM is an effective combination of channel attention and spatial attention mechanisms. The implementation of the channel attention mechanism can be divided into two parts. For the single feature layer input, global average pooling and global maximum pooling are performed respectively. After that, the results of average pooling and maximum pooling are processed using a shared fully connected layer. The two processed results are added, and then a sigmoid is taken to obtain the weight (between 0 and 1) of each channel of the input feature layer. After obtaining this weight, this weight is multiplied by the original input feature layer. This is the process of moving away from the upper half of the channel attention mechanism.

[0046] The lower part of CBAM is the spatial attention mechanism. For the input feature layer, the maximum value and average value are taken on the channel of each feature point. The two results are then stacked, and the number of channels is adjusted using a convolution with a channel number of 1. Then a sigmoid is taken to obtain the weight (between 0 and 1) of each feature point in the input feature layer. After obtaining this weight, it is multiplied by the original input feature layer.

[0047] The step S3 comprises the following steps:

[0048] Among them, the YOLOX network structure is divided into three parts, namely the main feature extraction network CSPDarknet, the enhanced feature extraction network FPN, and the classifier and regressor YOLO head. First, the input image will be feature extracted in CSPDarknet, and the extracted features can be called feature layers, which are the feature sets of the input image. In the main part, three feature layers are obtained for the next network construction, and these three feature layers are called effective feature layers; the Focus network structure is also used. The specific operation is to get a value for every other pixel in an image. At this time, four independent feature layers are obtained, and then the four independent feature layers are stacked. At this time, the width and height information is concentrated on the channel information, and the input channel is expanded four times; then it goes through convolution and a series of residual structures. The residual is divided into the main branch and the side branch. The main branch is a 1*1 convolution, and then a 3*3 convolution operation is performed. The residual is not processed and is directly added. The BN layer is equivalent to the residual in Resnet, which well alleviates the degradation problem, as well as the gradient disappearance and gradient explosion problems caused by the deepening of depth. FPN is the enhanced feature extraction network of YOLOX-S. The three effective feature layers obtained in the main part will be fused in this part, with the purpose of combining feature information of different scales. In the FPN part, the effective feature layers that have been obtained are used to continue to extract features. The YOLO Head is the classifier and regressor of YOLOX-S. Through CSPDarknet and FPN, three enhanced effective feature layers are obtained. Each feature layer has width, height and number of channels. The feature map is regarded as a collection of feature points one by one, and each feature point has channel number features. YOLO head judges the feature points to determine whether there is an object corresponding to the feature points. Therefore, the work done by the entire YOLOX-S network is feature extraction-feature enhancement-prediction of the object corresponding to the feature point.

[0049] A further method for identifying the number, length, width and survival rate of hard-shell clams based on YOLOX-S first calculates the number of hard-shell clams by predicting the number of anchor frames. Hard-shell clam identification is a binary classification problem, so 0 is set for healthy clams and 1 is set for dead clams, thereby determining their survival rate. The length and width calculation is achieved by subtracting the absolute value of the distance between the pixel values ​​of healthy clams. Its convolutional neural network structure includes:

[0050] (1) The local convolution stage includes one-dimensional convolution and pooling operations. The fast speed of the YOLO convolutional neural network is used to enhance the contrast of the dataset images and mark the life and death features of the hard-shell clams.

[0051] (2) The global convolution stage, including the convolution and pooling operations of the YOLOX-S convolutional neural network, extracts features from the hard-shell clam image containing the marked area, and then performs the final recognition processing in the fully connected layer at the end of the network.

[0052] The invention provides a method for identifying biological signs of hard-shell clams such as survival rate, quantity and length and width based on a YOLOX-S algorithm. Figure 1 The figure is a schematic diagram of the overall process of the present invention, and the present application includes the following steps:

[0053] The problem of biological sign recognition of hard-shell clams mainly faces the following two challenges: first, the image under the microscope will have uneven lighting due to its own light source and the light problems of the environment, which increases the difficulty of executing the target detection task; second, the image is collected when the hard-shell clams are in most active states and have strong fluidity in the water, so the collected images will be marginalized and overlapped, which may cause candidate frame overlap problems during target detection.

[0054] S1. Read the image in the data set and divide the image into blocks and thresholds to solve the problem of uneven illumination and insufficient segmentation. The interference of pure background or pure object can be eliminated by judging the grayscale difference between classes.

[0055] This step is mainly aimed at the first challenge mentioned above, solving the problem of uneven illumination of images under a microscope. The present invention adopts a block threshold segmentation method to pre-process the image. By dividing the image into several blocks and performing threshold segmentation separately, the uneven effects caused by illumination or reflection can be solved to a certain extent. The selected block should be small enough so that the illumination of each block is approximately uniform, so that when the automatic threshold is used, a high threshold will be used for segmentation in high grayscale areas, and a low threshold will be used for segmentation in low grayscale areas. In this embodiment, the blocks are comparable in size to the hard-shell clams. After the blocks are divided, the global threshold method is used for processing by block. However, it should be noted that some blocks only contain background. At this time, a judgment needs to be made to exclude the processing of such blocks. Use the separability metric mentioned in the Otsu method:

[0056]

[0057] After calculating the separability measure of each block, it was found that the distinction effect was not very good. By analyzing the maximum inter-class variance method, the average grayscale difference between classes at the segmentation threshold was used to judge the separability of the image block. When there is only background or only object in the image, the grayscale value is close, so the average grayscale difference (inter-class grayscale difference) of "background" and "foreground" calculated by the Otsu method will be very small. When there is only background in the block, the average grayscale difference is very different from that when there is an object, and the selected feature distinction effect is very good. After that, only the blocks with both objects and background are automatically thresholded, binarized, and filled with holes, so that each hard-shell clam can be well segmented, effectively solving the problem of uneven light.

[0058] S2. This step is mainly aimed at the second challenge mentioned above. The collected images are marginalized and overlapped, which may cause overlapping candidate boxes during target detection.

[0059] Specifically, during the object detection process, a large number of candidate boxes will be generated at the same object position, and these candidate boxes may overlap with each other. At this time, non-maximum suppression is needed to find the best object bounding box and eliminate redundant bounding boxes. The process of non-maximum suppression is as follows: sort according to confidence score, select the bounding box with the highest confidence and add it to the final output list, delete it from the bounding box list, calculate the area of ​​all bounding boxes, calculate the IoU of the bounding box with the highest confidence and other candidate boxes, delete the bounding boxes with IoU greater than the threshold, and repeat the above process until the bounding box list is empty.

[0060] The specific solution is to reduce the IoU threshold.

[0061] S3, create a dataset of annotated hard-shell clam images;

[0062] The step S3 comprises the following steps:

[0063] Take an appropriate amount of hard-shell clam seedlings onto a glass slide, and take 1200 images under a microscope to construct a dataset with an image size of 1280×720. The dataset is divided into three parts: training set, test set, and validation set in a ratio of 8:1:1. According to the hard-shell clams in the original dataset, the initial dataset data is analyzed and expanded using data enhancement methods such as Mosaic, MixUp, and CutOut for rotation, translation, and contrast enhancement, and then annotated. The dataset image is annotated with LabelImg to mark the target area and category. The sample label category is divided into two categories: health, indicating that the target area is a live clam seedling; death, indicating that the target area is a dead clam seedling. Then set the resolution size of the original dataset image to be consistent, and similarly match it with the label of the original image data to obtain the annotated hard-shell clam recognition image and survival status label as the dataset.

[0064] S4. Use the convolutional neural network of the improved YOLOX-S model to extract the multi-scale features of the hard-shell clams in the dataset and train the hard-shell clam recognition model. The improved YOLOX-S network structure is as follows: Figure 2 shown.

[0065] The step S4 comprises the following steps:

[0066] The convolutional neural network of the improved YOLOX-S model performs convolution operations of different sizes on the hard-shell clam images of the input training set to form feature maps of hard-shell clam images at different scales. The convolutional neural network is used to learn the features of hard-shell clam images at different scales to realize the detection of hard-shell clams at multiple scales.

[0067] S5. Input the hard-shell clam image to be detected and choose to use the VOC format to train YOLOX-S. The processed images mainly contain three folders, among which Annotations stores xml label data, JPEGImages stores image data, and ImageSets stores txt files for training, verification, and testing.

[0068] The step S5 comprises the following steps:

[0069] Among them, the YOLOX network structure is divided into three parts, namely the main feature extraction network CSPDarknet, the enhanced feature extraction network FPN, and the classifier and regressor YOLO head. First, the input image will be feature extracted in CSPDarknet, and the extracted features can be called feature layers, which are the feature sets of the input image. In the main part, three feature layers are obtained for the next step of network construction. These three feature layers are called effective feature layers; the Focus network structure is also used. The specific operation is to get a value for every other pixel in an image, and obtain four independent feature layers, and then stack the four independent feature layers. At this time, the width and height information is concentrated on the channel information, and the input channel is expanded four times; then it goes through convolution and a series of residual structures. The residual is divided into the main branch and the side branch. The main branch is a 1*1 convolution, and then a 3*3 convolution operation is performed. The residual is not processed and is directly added. The BN layer is equivalent to the residual in Resnet, which well alleviates the degradation problem, as well as the gradient disappearance and gradient explosion problems caused by the deepening of depth. FPN is the enhanced feature extraction network of YOLOX-S. The three effective feature layers obtained in the main part will be fused in this part to combine feature information of different scales. In the FPN part, the effective feature layers that have been obtained are used to continue to extract features. Feature fusion can be performed on feature layers of different shapes from bottom to top, and then downsampled to output three YOLO Heads respectively. The feature extraction part extracts the middle layer (80, 80, 256), the lower middle layer (40, 40, 512), and the bottom layer (20, 20, 1024). YOLO Head is the classifier and regressor of YOLOX-S. Through CSPDarknet and FPN, three enhanced effective feature layers are obtained. Each feature layer has width, height and number of channels. At this time, the feature map is regarded as a collection of feature points one by one, and each feature point has channel number features. The classifier and regressor YOLO head obtains three enhanced features, the shapes of which are (20, 20, 1024), (40, 40, 512), and (80, 80, 256), respectively. The feature layers of these three shapes are then passed into the YOLO Head to obtain the prediction results.

[0070] A further method for identifying the survival rate, quantity, length and width of hard shell clams based on YOLOX-S, whose convolutional neural network structure includes:

[0071] The local convolution stage includes one-dimensional convolution and pooling operations. It uses the fast speed of the YOLO convolutional neural network to enhance the contrast of the dataset images and mark the life and death features of the hard-shell clams.

[0072] The global convolution stage, including the convolution and pooling operations of the YOLOX-S convolutional neural network, extracts features from the hard-shell clam images containing the marked areas, and then performs the final recognition processing in the fully connected layer at the end of the network.

[0073] S6. According to the training model, the predicted image is output and the detection is completed.

[0074] Experimental example:

[0075] In this example, we collected images of hard-shelled clam seedlings, and performed flipping, image enhancement, and other processing on the acquired dataset images. The dataset images were annotated with LabelImg to mark the target area and category, and the annotated hard-shelled clam recognition images and survival status labels were obtained to form a standard VOC dataset format. The constructed dataset was randomly divided into training set, test set, and validation set in a ratio of 8:1:1.

[0076] The YOLOX-S model was improved by adding four CBAM attention mechanisms. The improved YOLOX-S algorithm was trained under the pytorch framework. The input image format was unified to 1280×720 and enhanced with Mosaic data. After 150 cycles, please refer to the attached Figure 3 As shown in the figure, the training set loss finally converges to around 1.42, indicating that the results of this algorithm are credible.

[0077] Use precision (P), recall (R) and F1 to evaluate the YOLOX-S algorithm. Figure 4 , attached Figure 5 , attached Figure 4 The P and R curves of healthy hard-shell clams in the YOLOX-S algorithm are shown in the figure below. Figure 5 The P and R curves of dead hard-shell clams in the YOLOX-S algorithm. The higher the values ​​of precision, recall, and F1, the better the performance of the model. The calculation formula is as follows:

[0078]

[0079]

[0080]

[0081] Where: TP is the correct recognition, FP is the wrong recognition, FN is the number of test sample images that were missed, unit: sheet.

[0082] The average precision AP (average precision) measures how well the model is trained on each category, and the class average precision mAP (Mean Average Precision) measures how well the trained model is trained on all categories. The calculation formulas for AP and mAP are as follows:

[0083]

[0084]

[0085] Use the AP formula to calculate mAP, where r1, r2...r n It is the Recall value corresponding to the Precision interpolation point arranged in ascending order, and the AP of all categories is mAP.

[0086] In this embodiment, Figure 6 This is a graph of the mAP of the hard-shell clam in the YOLOX-S algorithm. Figure 7 This is a diagram of the example detection results in the present invention. The average accuracy of the model in identifying the survival status of hard-shell clams can reach 95.86%.

[0087] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0088] In the several embodiments provided in the present application, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the division of the units described above is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The above-mentioned units may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

[0090] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for identifying biological signs of hard clams based on YOLOX-S, characterized in that: The following steps are involved: S1, collect hard-shell clam images to build a dataset; S2. Improve the YOLOX-S model and add the CBAM attention mechanism; S3, input the hard-shell clam image to be detected and use the improved YOLOX-S model for training; S4. According to the training model, the predicted image is output and the detection is completed; Read the image in the dataset and preprocess the image using the block threshold segmentation method. The image is divided into several blocks and threshold segmented separately. The blocks are about the same size as the hard shell clams. The global threshold method is used for each block, and the separability metric mentioned in the Otsu method is used: After calculating the separability metric of each block, the maximum inter-class variance method is used to analyze the inter-class average grayscale difference at the segmentation threshold to determine the separability of the image block. Then, only the blocks that have both objects and backgrounds are automatically thresholded, binarized, and holes are filled to segment each hard-shell clam. Use non-maximum suppression to find the best target bounding box and eliminate redundant bounding boxes. The process of non-maximum suppression is as follows: Sort by confidence score, select the bounding box with the highest confidence and add it to the final output list, delete it from the bounding box list, calculate the area of ​​all bounding boxes, calculate the IoU between the bounding box with the highest confidence and other candidate boxes, delete the bounding boxes with IoU greater than the threshold, and repeat the above process until the bounding box list is empty; The process of creating a dataset of annotated hard-shelled clam images includes: Take the hard-shell clam seedlings onto the slide and use Mosaic, MixUp, CutOut uses the data enhancement method to rotate, translate, and enhance contrast. The initial data set is analyzed and expanded, and then labeled. The data set image is labeled with the target area and category using LabelImg. The sample label category is divided into two categories: health, indicating that the target area is a live clam seedling; death, indicating that the target area is dead clam seedlings, and then set the resolution size of the original dataset image to be consistent. Similarly, match it with the label of the original image data to obtain the annotated hard-shell clam recognition image and survival status label as the dataset.

2. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: In step S1, the collection method is: putting the hard-shell clam seedlings on a glass slide, taking the collected images under a microscope to construct a data set, and dividing the data set into a training set, a test set and a validation set.

3. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: In step S2, four attention mechanism modules are added, and the attention mechanism is added to the three effective feature layers extracted from the backbone network, and the attention mechanism is also added to the sampled results.

4. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: In step S3, the hard-shell clam image to be detected is input, and the VOC format is selected to train the improved YOLOX-S model. The processed images mainly contain three folders, among which Annotations stores xml tag data, JPEGImages stores image data, and ImageSets stores txt files for training, verification, and testing.

5. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: In step S1, the specific steps are as follows: according to the hard-shell clams in the original data set, use Mosaic, The initial data set is analyzed and expanded by using data enhancement methods such as MixUp and CutOut for rotation, translation, and contrast enhancement, and then labeled. The labeled categories are divided into health and death. The resolution size of the original data set image is then set to be consistent and matched with the label of the original image data to obtain the labeled hard clam recognition image and survival status label as the data set.

6. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: In step S2, the specific steps are as follows: use the convolutional neural network of the improved YOLOX-S model to perform convolution operations of different sizes on the hard-shell clam images of the input training set, generate three effective feature layers after the backbone network CSPDarknet, and then add attention mechanism modules respectively, and at the same time add attention mechanisms to the sampled results. The added attention mechanisms are all CBAM modules.

7. The method for identifying biological signs of hard clams based on YOLOX-S according to claim 1, characterized in that: The number of hard-shell clams is calculated by predicting the number of anchor frames, and the length and width of hard-shell clams are calculated by subtracting the absolute value of the distance between the pixel values ​​of healthy clams. The convolutional neural network structure includes: The local convolution stage includes one-dimensional convolution and pooling operations. It uses the fast speed of the YOLO convolutional neural network to enhance the contrast of the dataset images and mark the dead or alive features of the hard-shell clams. The global convolution stage, including the convolution and pooling operations of the YOLOX-S convolutional neural network, extracts features from the hard-shell clam images containing the marked areas, and then performs the final recognition processing in the fully connected layer at the end of the network.

8. An electronic device, comprising a processor and a memory connected to the processor for storing instructions executable by the processor, characterized in that: The processor is used to execute the hard-shell clam biological sign recognition method based on YOLOX-S as described in any one of claims 1 to 7.

9. A server, characterized in that: The invention comprises at least one processor and a memory in communication with the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes a hard-shell clam biological sign recognition method based on YOLOX-S as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for identifying biological signs of hard-shell clams based on YOLOX-S according to any one of claims 1 to 7 is implemented.