River crab sex rapid judgment method based on key point detection

Through the method based on key point detection, the YOLO model is used to identify the key points of the cephala and cephala of the cephala and the wrist joints of the cephala, and the area ratio K is calculated, which solves the interference, accuracy and equipment dependence problems of the gender judgment of the cephala in the prior art, and achieves fast and accurate gender judgment.

CN120126183APending Publication Date: 2025-06-10JINLING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510312026.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The prior art has problems in the judgment of river crabs' gender, limited image accuracy, and high equipment dependence, making it difficult to achieve fast, accurate and efficient gender judgment.

Method used

Using a method based on key point detection, the key points of the cephala of the river crab and the wrist joints of the cephala of the river crab were identified through the YOLO model, and the area ratio K was calculated to achieve a rapid judgment of the gender of the river crab.

Benefits of technology

This method can quickly and accurately judge the gender of the river crab without interfering with the growth of river crabs, reduce dependence on image quality, reduce equipment dependence, and improve the accuracy of farmers' market forecasts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120126183A_ABST
    Figure CN120126183A_ABST
Patent Text Reader

Abstract

The invention provides a quick river crab sex judgment method based on key point detection, and belongs to the field of aquaculture combined with computer vision. A SimAM attention module is introduced on the basis of a YOLO model, the actual sizes of the two parts of the river crab are obtained through key point information of the head, chest and wrist joints of the river crab in an image, and the sex of the river crab is judged through area comparison of the two parts. According to the method, gender determination can be completed only by analyzing the complete front images of the river crabs collected by the monocular camera, the influence of image quality is small, the algorithm is small in volume, hardware can be embedded to realize online processing, efficient and accurate determination of the gender of the river crabs is realized, and the method is suitable for popularization and application. The equipment dependence can be greatly reduced, and the detection burden of aquaculture personnel is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of aquaculture combined with computer vision, and particularly relates to a method for quickly judging the gender of Chinese mitten crabs based on key point detection. Background Art

[0002] The gender judgment of Chinese mitten crabs is very important in aquaculture, market prediction, quality control and ecological research. Currently, the common methods for judging the gender of Chinese mitten crabs include traditional manual visual inspection methods and machine vision-based methods. The primary judgment method is to discriminate the shape of the navel of the Chinese mitten crab, and the main source of the image is to photograph the abdomen of the Chinese mitten crab after turning it over during fishing. Due to the nocturnal habit of Chinese mitten crabs and their susceptibility to stress, if the above detection methods are applied in the breeding process, there will be a relatively significant interference to the Chinese mitten crabs, and it is not suitable to carry out frequently and in large quantities. If the monitoring is not carried out regularly, it is difficult for farmers to accurately grasp the situation of Chinese mitten crabs in the pond, which further affects the farmers' judgment of the market. Other methods for discriminating the gender of Chinese mitten crabs that can be achieved without fishing include judging the density of the bristles on the legs of Chinese mitten crabs, and the judgment methods still include visual inspection and machine vision recognition. Due to the complex breeding environment of Chinese mitten crabs, turbid water, and the obstruction of aquatic plants, the accuracy of the collected images is limited, making it difficult to achieve the discrimination of the density of bristles. In addition, if the Chinese mitten crabs have limb fractures, abrasions, etc. due to fighting, it further poses a challenge to the application of this method.

[0003] Therefore, there is an urgent need for an accurate and efficient method for discriminating the gender of Chinese mitten crabs, which can quickly judge the gender of Chinese mitten crabs without interfering with their growth, and reduce the dependence of the judgment result on the accuracy of the image, so as to help farmers initially master the number of male and female Chinese mitten crabs in the entire breeding pond and improve the accuracy of farmers' market prediction. Summary of the Invention

[0004] Object of the Invention: To propose a method for quickly judging the gender of Chinese mitten crabs based on key point detection to solve the above problems existing in the prior art.

[0005] A method for quickly judging the gender of Chinese mitten crabs based on key point detection proposed by the present invention includes the following steps:

[0006] Obtain a predetermined number of Chinese mitten crab images, label the gender to which each Chinese mitten crab image belongs, and mark the cephalothorax region and the merus region of the cheliped from them;

[0007] Send the marking results of the cephalothorax region and the merus region of the cheliped into the YOLO model for training;

[0008] Use the trained YOLO model to identify several key points of the cephalothorax and the merus of the cheliped in the cephalothorax region and the merus region of the cheliped;

[0009] Based on the key points, measure the cephalothorax body length, cephalothorax body width, merus length of the cheliped, and merus width of the cheliped respectively;

[0010] Calculate the carapace area based on the carapace body length and carapace body width, calculate the carpus area based on the carpus length and carpus width of the cheliped, and calculate the ratio K of the carpus area to the carapace area;

[0011] Use the ratio K and the gender of the river crab image to train the YOLO model and verify the accuracy rate to obtain a rapid river crab gender judgment model;

[0012] Use the rapid river crab gender judgment model to complete the gender recognition of subsequent actual photographed river crab images.

[0013] In a further embodiment, the marking results of the carapace area and the carpus area of the cheliped are sent into the YOLO model for training, specifically including:

[0014] The YOLO model recognizes the carapace area and the carpus area of the cheliped and generates corresponding masks. The size of the masks is automatically generated by threshold segmentation of the river crab image input into the YOLO model. The river crab image is divided into a target area and a background area according to the gray value of the pixels, forming a two-dimensional matrix composed of the intensity values of each pixel;

[0015] The pixel values of the carapace area and the carpus area of the cheliped are 1, and the pixel value of the background area is 0. The calculation formula is as follows:

[0016]

[0017] In the formula, is to supplement the area to be judged; X is the convolved area after expansion; M is the corresponding area after the mask is expanded; W T is the convolution kernel after expansion and transposition; b is the bias, and the initial value is 0; is the element-wise multiplication of two matrices.

[0018] In a further embodiment, the YOLO model selects YOLOv11, and adds a SimAM attention module on the basis of YOLOv11 to calibrate the key points to be measured;

[0019] The energy function of the SimAM attention module is as follows:

[0020]

[0021] In the formula, is the energy function; is the bias matrix of the energy function; is the weight matrix of the energy function, y represents the true label, represents the i-th sample feature, and M is the total number of samples.

[0022] In a further embodiment, when the C3k2 module of the YOLOv11 bottleneck layer completes the feature maps of the crab carapace and the carpus, a SimAM attention module is connected to generate a weighted feature map. :

[0023]

[0024] Wherein, is the attention weight of each pixel point ; is the element-wise multiplication of two matrices;

[0025] Among them, the attention weight of each pixel point is calculated as follows:

[0026]

[0027] Wherein, is the similarity between the pixel point and its neighboring pixels; is the normalization of , is a positive constant;

[0028]

[0029] is other pixels within the neighborhood of the pixel , k = [0, 1, 2...]; N is the number of pixels in the neighborhood; is the neighborhood of the pixel point .

[0030] In a further embodiment, the key points of the carapace include:

[0031] Point 1: Specifically, it is the deepest depression between the two otter teeth in the center of the carapace;

[0032] Point 2: The midpoint of the posterior edge of the carapace;

[0033] Point 3: The tip of the 4th lateral tooth on the left anterior edge of the carapace;

[0034] Point 4: The tip of the 4th lateral tooth on the right anterior edge of the carapace.

[0035] The carpus of the cheliped is divided into two groups, and the key points of each group are the same, including:

[0036] Point 1: The deepest concave point of the angle between the thorn born at the outer end corner of the carpus of the cheliped and the carpus;

[0037] Point 2: The vertex on the opposite side of the thorn-bearing end on the outside of the carpus of the cheliped;

[0038] Point 3: The intersection point of the carpus of the cheliped and the hairy palm.

[0039] Point 4: The midpoint of the lower edge of the carpus.

[0040] In a further embodiment, the loss function for identifying key points is determined as follows:

[0041] Select the target position regression loss function CIoU to detect the distance between the predicted box and the ground truth box:

[0042]

[0043] In the formula, d represents the length between the centers of the predicted box and the ground truth box; c represents the diagonal length of the smallest circumscribed rectangle formed by the predicted box and the ground truth box; where IoU represents the overlap ratio between the predicted box and the ground truth box; v represents the penalty factor; is the weight value of v.

[0044] Select the VFL loss function and the DFL loss function to complete the positive and negative sample correction and accelerate the model convergence speed; where the VFL loss function is as follows:

[0045]

[0046] In the formula, is the model prediction sample of the i-th label; is the IoU of the i-th image. When it means that the predicted box and the ground truth box intersect, and it is a positive sample. it means that the predicted box and the ground truth box do not intersect, and it is a negative sample; is the hyperparameter of the i-th key point, with an initial value of 1 and a final value obtained through learning.

[0047] Select the target key point regression loss function PCK to evaluate the accuracy of key points:

[0048]

[0049] In the formula, is the indicator function; i represents the label number of the key point; is the given threshold, then ; p represents the serial number of the crab image, represents the distance between the predicted key point i and the actual key point in the p-th image, represents the normalization factor in the p-th image.

[0050] In a further embodiment, the distance from carapace key point 1 to carapace key point 2 is denoted as the carapace body length and the distance from carapace key point 3 to carapace key point 4 is denoted as the carapace body width ;

[0051] The width of the carpus of the cheliped is from key point 1 to key point 2 of the carpus of the cheliped ; The length of the carpus of the cheliped is from key point 3 to key point 4 of the carpus of the cheliped ;

[0052] Calculate the ratio K of the area of the carpus to the area of the carapace:

[0053]

[0054] Set a threshold interval , when , it is determined as a female crab; when , it is determined as a male crab; when , re-identify the key points and recalculate the K value and then determine again, or transfer to manual determination.

[0055] Beneficial effects: Compared with the traditional technology, the method proposed by the present invention only needs to analyze the complete front image of the river crab collected by a monocular camera to complete gender determination, is less affected by the image quality, and the algorithm has a small volume and can be embedded in hardware for online processing, realizing efficient and accurate judgment of the gender of the river crab, and can greatly reduce equipment dependence and reduce the detection burden of aquaculture personnel. Description of the drawings

[0056] Figure 1 It is the overall flowchart of the method for rapid determination of the gender of river crabs based on key point detection in the embodiment.

[0057] Figure 2 It is the schematic diagram of the relevant network for river crab image processing and key point detection in the embodiment.

[0058] Figure 3 It is the schematic diagram of the size marking of the river crab in the embodiment.

[0059] Figure 4 It is the schematic diagram of the size marking of the carpus of the cheliped of the river crab in the embodiment.

[0060] Figure 5 It is the example diagram of the determined female crab.

[0061] Figure 6 It is the example diagram of the determined male crab. Detailed implementation manners

[0062] In the following description, a large number of specific details are given to provide a more thorough understanding of the present invention. However, it is obvious to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features well known to the art are not described.

[0063] In view of the objective problems existing in the background technology, the present invention introduces the SimAM attention module on the basis of the original YOLOv11 model, obtains the actual size of the two parts of the hairy crab through the key point information of the carapace and the carpus of the hairy crab in the image, and judges the gender of the hairy crab by comparing the areas of the two parts. Figure 1 The overall technical solution of the embodiment of the present invention is shown as follows:

[0064] I. Convolution processing of the hairy crab image part

[0065] First, the image to be calibrated is processed, as shown in Figure 2 Module 1.

[0066] Specifically, on the basis of completing the object detection of the carapace and the carpus of the hairy crab, the carapace and the carpus regions are identified and corresponding masks are generated. The size of the mask mask is automatically generated by threshold segmentation of the input image. The image is divided into the target region and the background region according to the gray value of the pixel, forming a two-dimensional matrix composed of the intensity values of each pixel. The pixel values of the carapace and the carpus regions are 1, and the pixel values of the background region are 0.

[0067] The calculation formula is shown in Equation (1):

[0068]

[0069] Where is the area to be supplemented, X is the convolved area after expansion, M is the corresponding area after the mask is expanded, and W T is the convolution kernel after expansion and transposition, and b is the bias, with an initial value of 0 and a final value obtained by model training.

[0070] A k×k convolution kernel K is established, and each element in the convolution kernel represents the corresponding weight.

[0071] An automatic update mask rule is established:

[0072] Discrimination: If the convolution can calculate the output according to at least one valid input value, the mask of this pixel point is marked as 1, as shown in the following formula.

[0073]

[0074] The partial convolution layer is stacked 5 times to complete the image enhancement and filling of the carapace and the carpus.

[0075] II. Key point marking

[0076] The YOLOv11 model is adopted, and the SimAM attention module is added after the c3k2 module to calibrate the key points to be measured, as shown in Figure 2As shown in Module 2. The key points to be marked are as follows:

[0077] Carapace:

[0078] Point 1: Specifically, it is the deepest depression between the two tubercles in the center of the carapace;

[0079] Point 2: The midpoint of the posterior margin of the carapace;

[0080] Point 3: The tip of the 4th lateral tooth on the anterior margin of the left side of the carapace;

[0081] Point 4: The tip of the 4th lateral tooth on the anterior margin of the right side of the carapace.

[0082] Carpus 1 of the cheliped:

[0083] Point 1: The deepest concave point of the angle between the spine born at the outer end corner of the carpus of the cheliped and the carpus;

[0084] Point 2: The vertex on the opposite side of the end of the spine on the outer side of the carpus of the cheliped;

[0085] Point 3: The intersection point of the carpus of the cheliped and the hairy palm;

[0086] Point 4: The midpoint of the lower edge of the carpus.

[0087] Since under normal circumstances, the carpus of the cheliped is symmetric left and right, the marking method for the other carpus will not be described again, but the sequential marking is as follows:

[0088] Carpus 2 of the cheliped:

[0089] Point 5: The deepest concave point of the angle between the spine born at the outer end corner of the carpus of the cheliped and the carpus;

[0090] Point 6: The vertex on the opposite side of the end of the spine on the outer side of the carpus of the cheliped;

[0091] Point 7: The intersection point of the carpus of the cheliped and the hairy palm;

[0092] Point 8: The midpoint of the lower edge of the carpus.

[0093] Define the energy function of the SimAM parameter-free attention module as shown in Equation (3):

[0094]

[0095] Among them, is the energy function, is the bias matrix of the energy function, is the weight matrix of the energy function, y represents the true label, represents the feature of the i-th sample, and M is the total number of samples.

[0096] The initial values of the bias matrix and the weight matrix are all 0, and the specific values are obtained from subsequent training. It represents the regularization parameter, which is used to control the complexity of the model and is obtained through training.

[0097] When the YOLOV11 bottleneck layer C3k2 module finishes generating the feature maps of the crab's carapace and carpus, the SimAM module is connected, and the weighted feature map is generated through the following three steps :

[0098] ① Neighborhood pixel similarity It is calculated as shown in Equation (4):

[0099]

[0100] N is the number of pixels in the neighborhood;

[0101] is the pixel point 's neighborhood;

[0102] is the other pixel in the neighborhood of pixel , k = [0, 1, 2...].

[0103] ② Based on the neighborhood similarity The attention weight calculation is further completed as shown in Equation (5):

[0104]

[0105] Among them, is the attention weight of each pixel, is the normalization, is a very small positive number used to prevent division by zero errors.

[0106] ③ The feature and the attention weight are weighted and fused as shown in Equation (6) to obtain the weighted feature map:

[0107]

[0108] Among them is the weighted feature map, is defined as the element-wise multiplication of two matrices, and thus the enhanced feature map is obtained.

[0109] III. Determination of the key point marking loss function

[0110] The target position regression loss function CIoU Loss is selected to detect the distance between the predicted box and the ground truth box;

[0111] VFL and DFL are selected to complete the positive and negative sample correction and accelerate the model convergence speed;

[0112] The target key point regression loss function PCK is selected to evaluate the accuracy of key points.

[0113] 1) Marking of key points on the carapace

[0114] ① IoU (Intersection over Union) prediction:

[0115]

[0116] Where Areal and Area2 represent the area of the predicted box and the ground truth box of the carapace respectively. The value range of IoU 1 is [0, 1]. The larger the value of IoU 1 , the more accurate the prediction; on the contrary, the more incorrect the prediction result.

[0117] ② CIoU calculation:

[0118]

[0119] Where d 1 represents the length between the center points of the predicted box and the ground truth box of the crab carapace, c 1 represents the diagonal length of the minimum circumscribed rectangle of the combination of the predicted box and the ground truth box of the carapace, where IoU 1 represents the overlapping ratio of the predicted box and the ground truth box of the carapace.

[0120] represents the penalty factor, is the weight value of. It is obtained from Equation (9):

[0121]

[0122] Where and represent the width and height of the ground truth box and the predicted box of the carapace respectively. It is obtained from Equation (10).

[0123]

[0124] ③ The VFL (Varifocal Loss) loss function uses an asymmetric weighting operation to solve the problem of uneven positive and negative samples in the algorithm. The calculation formula is shown in Equation (11):

[0125]

[0126] Where is the model prediction sample of the i-th mark on the carapace, represents the IoU of the i-th image1 When , it means that the predicted box and the ground truth box of the carapace intersect, and it is a positive sample; When , it means that the predicted box and the ground truth box of the carapace do not intersect at all, and it is a negative sample.

[0127] ④ DFL (Distribution Focal Loss) loss function. Its main purpose is to use the probability output value P to make the network focus faster on the vicinity of the true key points of the Eriocheir sinensis carapace, increase the probability of these positions, and thus accelerate the convergence speed of the model. The DFL calculation formula is shown in (12):

[0128]

[0129] P i and P i+1 represent the predicted probability distribution values, where P i is the predicted probability of the model at a certain key point position, and P i+1 is the next probability distribution value;

[0130] Y is the label of each true key point position of the carapace;

[0131] Y i and Y i+1 are the boundaries of the predicted probability distribution.

[0132] ⑤ PCK (Percentage of Correct Keypoints) is an algorithm performance index used to evaluate the accuracy of key points. It calculates the percentage of correctly estimated key points within a given threshold distance and is calculated by Equation (13).

[0133]

[0134] Among them, represents the accuracy of the key points on the carapace, is the indicator function, i represents the label number of the key points of the Eriocheir sinensis carapace, is the given threshold, then . p represents the serial number of the Eriocheir sinensis image, represents the distance between the predicted key point and the actual key point of the carapace in the p-th image, represents the normalization factor of the carapace in the p-th image.

[0135] Thus, the marking of the key points of the Eriocheir sinensis carapace is completed.

[0136] 2) Marking of the key points of the merus of the cheliped

[0137] Since the carpus is symmetric under normal circumstances, only the key point marking method for one carpus is shown here.

[0138] ① IoU 2 Prediction:

[0139] IoU 2 represents the overlapping ratio of the predicted box and the ground truth box of the carpus.

[0140]

[0141] ② CIoU 2 The formula is as follows:

[0142]

[0143] where d 2 represents the length between the center points of the predicted box and the ground truth box of the marked carpus of the Chinese mitten crab's chela, and c 2 represents the diagonal length of the minimum circumscribed rectangle of the combination of the predicted box and the ground truth box of the chela carpus, where Area3 and Area4 represent the areas of the predicted box and the ground truth box of the chela carpus respectively. The value range of IoU 2 is [0, 1]. The larger the value of IoU 2 , the more accurate the prediction; conversely, the more incorrect the prediction result.

[0144] In the calculation formula of (15), represents the marking penalty factor of the chela carpus, is 's weight value. The calculation formula of

[0145]

[0146] where (w g , h g ) and (w p , h p represent the width and height of the ground truth box and the predicted box of the chela carpus respectively.

[0147] The calculation formula of

[0148]

[0149] ③ The calculation of the VFL loss function is completed as shown in formula (18):

[0150]

[0151] where The model prediction sample for the $i$-th mark of the carpus Represents the IoU of the carpus for the $i$-th image 1 , when It means that the predicted box and the ground truth box of the carpus intersect, and it is a positive sample; It means that the predicted box and the ground truth box of the carpus do not intersect at all, and it is a negative sample. Is the hyperparameter for the $i$-th key point of the carpus, used to control the loss weight of positive and negative samples, with an initial value of 1 and the final value obtained through learning.

[0152] ④ Complete the calculation of the DFL loss function as shown in Equation (19):

[0153]

[0154] and Are the predicted probability values of the model for the position of the key points of the chela carpus, $i = [1, 2, 3, 4, 5, 6, 7, 8]$; $t$ is the ground truth position label of the key point of the carpus; and Are the boundaries of the predicted probability distribution.

[0155] ⑤ Complete the calculation of the PCK accuracy as shown in Equation (20):

[0156]

[0157] Among them, Represents the label serial number of the key point of the Eriocheir sinensis chela, Is a given threshold, Is the serial number of the Eriocheir sinensis image, Represents the distance between the predicted key point and the actual key point of the carpus in the $p$-th image, Represents the normalization factor of the chela carpus in the $p$-th image.

[0158] So far, the marking of the key points of the Eriocheir sinensis chela carpus is completed.

[0159] IV. Train the model

[0160] Use the training set to train the above key point marking model until the values of the 4 loss functions of each key point of the evaluation model drop to 0.05.

[0161] V. Size measurement

[0162] 1) Complete the measurement of the carapace body length and body width. Specifically, the distance from carapace key point 1 to carapace key point 2 is recorded as the body length; the distance from carapace key point 3 to carapace key point 4 is recorded as the body width as Figure 3 shown ( Figure 3 The red arrow in (a) indicates the body length; the red arrow in (b) indicates the body width).

[0163] 2) Measure the length and width of all chela carpus in the image respectively. Specifically, the width of the first chela carpus is from key point 1 to key point 2 of the chela (see Figure 4 (a)); the length of the first chela carpus is from key point 3 to key point 4 (see Figure 4 (b)). The width of the second chela carpus is from key point 5 to key point 6, and the length of the second chela carpus is from key point 7 to key point 8 (Note: Since the two chelae are symmetrical, key points 5, 6, 7, and 8 are not shown in Figure 4 ).

[0164] VI. Gender Judgment

[0165] 1) Select the one with a larger product of the length and width of the carpus as the final result and further calculate;

[0166] 2) Mark as the body width, as the body length, as the width of the chela carpus, as the length of the chela carpus. Then the following formula for judging male and female can be obtained:

[0167]

[0168] Finally, use the existing marked image set to perform offline training on the model to obtain the actual K value. Select the test set, as shown in Table 1, to test the model results.

[0169] Table 1

[0170]

[0171] According to the results obtained from Table 1, set a threshold range (6 - 6.5%). When the actual K value is less than 6%, it is determined as a female crab (see Figure 5 , female crab, chela complete); when the actual K value is greater than 6.5%, it is determined as a male crab (see Figure 6 , male crab, one chela missing). When the actual K value is between 6 - 6.5%, it is recommended to re-identify and determine or make a manual determination.

[0172] The technical process of the above-mentioned method for quickly judging the gender of Chinese mitten crabs based on key point detection disclosed in the above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination.

[0173] When implemented using hardware, all or part of the above embodiments can run the working logic and calculation process on an electronic device after being compiled by software.

[0174] When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. If the above method is implemented in the form of software function modules and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the related technology, may be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing an electronic device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), magnetic disks, or optical discs. Thus, the embodiments of the present application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications or equivalent replacements can still be made to the specific implementation manners of the present invention, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.

Claims

1. A method for quickly determining the sex of river crabs based on key point detection, characterized in that: The steps include: Obtain a predetermined number of river crab images, mark the gender of each river crab image, and mark the cephalothorax region and chelicerae carpal region; The marking results of the cephalothorax and chelicerae carpal regions are sent to the YOLO model training; Use the trained YOLO model to identify several key points of the cephalothorax and chelicerae in the cephalothorax and chelicerae regions; Based on the key points, the length of the cephalothorax, the width of the cephalothorax, the length of the chelipeds wrist segment, and the width of the chelipeds wrist segment are calculated respectively; The cephalothorax area is calculated based on the cephalothorax length and width, the wrist area is calculated based on the chelicerae wrist length and width, and the ratio of the wrist area to the cephalothorax area is calculated. The ratio K and the gender of the crab image are used to train the YOLO model and verify the accuracy, thus obtaining a model for quickly determining the gender of the crab. The model for rapid gender determination of river crabs is used to complete gender recognition of subsequent real-shot river crab images.

2. The method for quickly determining the sex of river crabs based on key point detection according to claim 1 is characterized in that: The labeling results of the cephalothorax and chelicerae regions are sent to the YOLO model training, including: The YOLO model identifies the cephalothorax and chelicerae regions and generates corresponding masks. The mask size is automatically generated by the input YOLO model’s crab image through threshold segmentation. The crab image is divided into the target region and the background region according to the grayscale value of the pixel, forming a two-dimensional matrix composed of the intensity value of each pixel. The pixel value of the cephalothorax area and the chelicerae carpal area is 1, and the pixel value of the background area is 0. The calculation formula is as follows: ; In the formula, is to fill the area to be judged; X is the convolved area after expansion; M is the corresponding area after the mask is expanded; W T is the expanded and transposed convolution kernel; b is the bias, and its initial value is 0; Multiply two matrices element-wise.

3. The method for quickly determining the sex of river crabs based on key point detection according to claim 1 is characterized in that: The YOLO model uses YOLOv11, and adds the SimAM attention module on the basis of YOLOv11 to calibrate the key points to be measured; The energy function of the SimAM attention module is as follows: ; In the formula, is the energy function; is the bias matrix of the energy function; is the weight matrix of the energy function, y represents the true label, represents the i-th sample feature, and M is the total number of samples.

4. The method for quickly determining the sex of river crabs based on key point detection according to claim 3 is characterized in that: After the C3k2 module of the bottleneck layer of YOLOv11 completes the feature map of the crab's head and chest armor and wrist, it is connected to the SimAM attention module to generate a weighted feature map : ; In the formula, For each pixel The attention weight of Multiply two matrices element-wise; Among them, each pixel The attention weight The calculation formula is as follows: ; In the formula, Pixel Similarity with its neighboring pixels; for Normalization of is a positive constant; ; Pixel Other pixels in the neighborhood, k=[0,1,2...]; N is the number of pixels in the neighborhood; Pixel 's neighborhood.

5. The method for quickly determining the sex of river crabs based on key point detection according to claim 1 is characterized in that: Key points of the cephalothorax include: Point 1: The deepest depression between the two otter teeth in the center of the cephalothorax; Point 2: midpoint of the posterior edge of the cephalothorax; Point 3: tip of the fourth lateral tooth on the left front edge of the cephalothorax; Point 4: tip of the 4th lateral tooth on the right anterior edge of the cephalothorax.

6. The method for quickly determining the sex of river crabs based on key point detection according to claim 1 is characterized in that: The chelicerae are divided into two groups, each with the same key points, including: Point 1: The most concave point of the angle between the spine on the outer end of the chelicerae carpal segment and the carpal segment; Point 2: the apex opposite to the lateral spine of the chelicerae carp; Point 3: The intersection of the chelicerae wrist and the hairy palm; Point 4: midpoint of the lower edge of the wrist joint.

7. The method for quickly determining the sex of river crabs based on key point detection according to claim 1, 5 or 6, characterized in that: The loss function for identifying key points is determined as follows: The target position regression loss function CIoU is used to detect the distance between the predicted box and the real box; The VFL loss function and DFL loss function are used to complete the positive and negative sample correction and accelerate the model convergence speed; The target key point regression loss function PCK is used to evaluate the key point accuracy.

8. The method for quickly determining the sex of river crabs based on key point detection according to claim 7 is characterized in that: The target position regression loss function CIoU is used to detect the distance between the predicted box and the real box: ; Where d represents the length of the center point of the predicted box and the real box; c represents the diagonal length of the minimum bounding rectangle of the predicted box and the real box; IoU represents the overlap ratio of the predicted box and the real box; v represents the penalty factor; is the weight value of v.

9. The method for quickly determining the sex of river crabs based on key point detection according to claim 7 is characterized in that: The VFL loss function is used to complete the positive and negative sample correction, where the VFL loss function is as follows: ; In the formula, Predict samples for the i-th labeled model; is the IoU of the i-th image, when When represents the intersection of the predicted box and the true box, it is a positive sample. When represents that the predicted box and the true box do not intersect, it is a negative sample; is the hyperparameter of the i-th key point, with an initial value of 1 and a final value obtained through learning; The target key point regression loss function PCK is used to evaluate the key point accuracy, and the expression is as follows: ; In the formula, is the indicator function; i represents the label number of the key point; For a given threshold, ; p represents the serial number of the crab image, Represents the distance between the predicted key point i and the actual key point in the pth image, Represents the normalization factor in the p-th image.

10. The method for quickly determining the sex of river crabs based on key point detection according to claim 5 or 6, characterized in that: The distance from the key point 1 of the cephalothorax to the key point 2 of the cephalothorax is recorded as the length of the cephalothorax , the distance from the key point 3 of the cephalothorax to the key point 4 of the cephalothorax is recorded as the width of the cephalothorax ; The width of the chelicerae wrist segment is from key point 1 to key point 2. ; Key point 3 to key point 4 is the length of the chelicerae wrist segment ; Calculate the ratio of the wrist area to the cephalothorax area K: ; Set a threshold range ,when When When When the key points are re-identified and the K value is recalculated, the judgment is made again, or it is transferred to manual judgment.