A Phenotypic Measurement System for Aquaculture Objects Based on Visual Algorithms
The vision-based aquaculture object phenotyping system, which combines clamp components and camera photography with key point detection algorithms, solves the problem of inaccurate measurement of irregular aquaculture objects and achieves efficient and accurate size measurement.
Patent Information
- Application Number
- CN202411052216.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-08-01
AI Technical Summary
Existing technologies are inaccurate in measuring irregularly shaped aquatic products such as crabs, snails, and lobsters, resulting in low work efficiency, high labor costs, and a high risk of errors, and failing to accurately reflect their quality.
A visual algorithm-based phenotyping system for aquaculture objects is used, including a clamping assembly and a photographic device. The clamping assembly fixes the aquaculture objects, and the camera takes pictures to acquire images. The system combines top-down and bottom-up keypoint detection algorithms to measure the actual size of the aquaculture objects.
It enables accurate size measurement of irregular aquatic aquaculture objects, reduces the difficulty of manual inspection, improves measurement efficiency and accuracy, and reduces labor costs.
Smart Images

Figure CN118758182B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of phenotypic measurement technology for aquaculture objects, specifically relating to a phenotypic measurement system for aquaculture objects based on visual algorithms, including a measurement device and a measurement method. Background Technology
[0002] In the processing of aquaculture products, it is necessary to sort them into different grades. Currently, the grading is mainly based on the weight of the aquaculture products, which does not accurately reflect their quality. Therefore, a method of measuring the size of aquaculture products has been added to assess their grade.
[0003] Currently, most measurements are taken manually using tools such as calipers. However, for aquatic organisms with irregular shapes, such as river crabs, snails, and lobsters, manual measurement is very inaccurate. Figure 12 The measurement points on the back of the crab shown are numerous and complex (as indicated by the numbers in the figure), which not only results in low work efficiency and high labor costs, but also makes it prone to errors and causes unnecessary losses. Summary of the Invention
[0004] Therefore, this application provides a visual algorithm-based phenotypic measurement system for aquaculture objects, including a measurement device and a measurement method, which can solve the problem of inaccurate measurement of irregular aquaculture objects in the prior art.
[0005] To address the aforementioned problems, this application provides a visual algorithm-based device for measuring the phenotypic characteristics of aquaculture objects, comprising:
[0006] The clamping assembly includes a support plate for securing the aquaculture object on the support plate;
[0007] A photographic device, including a camera, takes a picture of the aquaculture object at a preset distance from the support plate, obtains a picture of the aquaculture object, and obtains the size of the aquaculture object from the size in the picture.
[0008] In some implementations...
[0009] The aquaculture species includes river crabs, and the clamping assembly also includes a clamping rod, one end of which is movably connected to the support plate, and the other end is a free end; the clamping rod and the support plate work together to clamp the small legs and claws of the river crab.
[0010] In some implementations...
[0011] The clamping rod is connected to the bearing plate by a pin, and a compression spring is sleeved on the pin. One end of the compression spring abuts against the clamping rod so that the clamping rod and the bearing plate clamp the crab.
[0012] In some implementations...
[0013] The aquaculture object includes snails. The clamp assembly also includes a base, a slide rail, a lifting frame, and a fixing line. The support plate is disposed on the base, the slide rail is vertically disposed on the base, and the lifting frame is U-shaped and slides in conjunction with the slide rail. On the vertical projection plane, the support plate is located in the U-shaped groove of the lifting frame. The two ends of the fixing line are connected to the two side walls of the U-shaped groove. When the lifting frame moves down, the fixing line presses down on the snails located on the support plate.
[0014] In some implementations...
[0015] The aquaculture object includes lobster, and the clamp assembly also includes two partitions, which are alternately arranged on the support plate, with the lobster located between the two partitions.
[0016] In some implementations...
[0017] The support plate is stepped. When the support plate is placed horizontally, the partition is placed on the adjacent lower plate surface, and the higher plate surface is provided with a groove. The extension direction of the groove passes through the gap between the two partitions.
[0018] According to another aspect of this application, a method for measuring the phenotypic characteristics of aquaculture objects based on a visual algorithm is provided, including an aquaculture object phenotypic measurement device employing the visual algorithm as described above.
[0019] In some implementations...
[0020] The aquaculture object is fixed on the support plate;
[0021] The camera is aimed at the aquaculture object to take a picture, thereby obtaining a photo of the aquaculture object;
[0022] Mark multiple key points that need to be measured on the photograph of the aquaculture object, measure the distance between the multiple key points according to the preset distance requirements, and obtain the actual size of the aquaculture object according to the preset algorithm based on the distance.
[0023] In some implementations...
[0024] The preset algorithm includes a top-down keypoint detection algorithm, which comprises two calculation processes:
[0025] A target object location detection algorithm is used to detect the overall size of the aquaculture object;
[0026] The main key point detection algorithm is used to detect the key point locations of the aquaculture object.
[0027] In some implementations...
[0028] The target subject location detection algorithm includes at least one of SSD, YOLO, MobileNet, and Faster R-CNN; the subject key point detection algorithm includes at least one of Proposals and ShuffleNet.
[0029] In some implementations...
[0030] Before marking key points, the obtained photos of aquaculture objects are preprocessed to ensure that the key points on the images are distributed in the same way.
[0031] This application provides a visual algorithm-based phenotypic measurement device for aquaculture objects, comprising: a clamp assembly including a support plate for fixing the aquaculture object on the support plate; and a photographic device including a camera, wherein the camera takes a picture of the aquaculture object at a preset distance from the support plate to obtain a photograph of the aquaculture object, and the size of the aquaculture object is obtained from the size in the photograph.
[0032] This application has the following beneficial effects:
[0033] The aquaculture object is fixed by a clamp assembly, which facilitates the taking of photos. The size of the aquaculture object in the photos is then measured to calculate its actual size. This method can measure the corresponding size of irregularly shaped aquaculture objects, reduce the difficulty of manual inspection, and achieve the goal of accurately obtaining the size of aquaculture objects. Attached Figure Description
[0034] To more clearly illustrate the embodiments of this application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. The drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0035] Figure 1 This is a schematic diagram of the size measuring device for aquaculture objects, specifically river crabs, according to an embodiment of this application.
[0036] Figure 2 Examples of this application Figure 1 The left view;
[0037] Figure 3 Examples of this application Figure 1 Top view;
[0038] Figure 4 Examples of this application Figure 1 A three-dimensional view;
[0039] Figure 5 This is a schematic diagram of the size measuring device for aquaculture snails, as described in this embodiment of the application.
[0040] Figure 6 Examples of this application Figure 5 The left view;
[0041] Figure 7 Examples of this application Figure 5 Top view;
[0042] Figure 8 Examples of this application Figure 5 A three-dimensional view;
[0043] Figure 9 This is a schematic diagram of the size measuring device for aquaculture, specifically for lobsters, according to an embodiment of this application.
[0044] Figure 10 Examples of this application Figure 9 Top view;
[0045] Figure 11 Examples of this application Figure 9 A three-dimensional view;
[0046] Figure 12 This is a schematic diagram of the measurement points on the back of the crab.
[0047] The reference numerals in the attached figures are as follows:
[0048] 11. First bearing plate; 12. Clamping rod; 13. Limiting component; 14. Base plate; 15. Pad block; 16. Fixing seat; 17. Compression spring; 18. Pin shaft;
[0049] 21. Second bearing plate; 22. Slide rail; 23. Base; 24. Platform; 25. Lifting frame; 26. Fixing line;
[0050] 31. Third bearing plate; 32. Partition plate; 33. Groove; 34. Limiting component; 35. Step. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit this application or its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0052] In the description of this application, it should be understood that the orientation or positional relationship indicated by directional terms such as "front, back, up, down, left, right", "horizontal, vertical, horizontal" and "top, bottom" is usually based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing this application and simplifying the description. Unless otherwise stated, these directional terms do not indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the scope of protection of this application; the directional terms "inner" and "outer" refer to the inner and outer contours relative to the outline of each component itself.
[0053] For ease of description, spatial relative terms such as "above," "on top of," "on the upper surface of," "above," etc., are used herein to describe the spatial positional relationship of a device or feature as shown in the figures to other devices or features. It should be understood that spatial relative terms are intended to encompass different orientations in use or operation beyond the orientation of the device as described in the figures. For example, if the device in the figures were inverted, a device described as "above" or "on top of" other devices or structures would subsequently be positioned as "below" or "under" other devices or structures. Thus, the exemplary term "above" can include both "above" and "below." The device may also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatial relative descriptions used herein will be interpreted accordingly.
[0054] Furthermore, it should be noted that the use of terms such as "first" and "second" to define components is merely for the purpose of distinguishing the corresponding components. Unless otherwise stated, the above terms have no special meaning and therefore cannot be construed as limiting the scope of protection of this application.
[0055] See Example 1 in conjunction with the above. Figures 1 to 11 As shown in the embodiment of this application, a device for measuring the phenotypic characteristics of aquaculture objects based on a visual algorithm includes:
[0056] The clamping assembly includes a support plate for securing the aquaculture object on the support plate;
[0057] A photographic device, including a camera, takes a picture of the aquaculture object at a preset distance from the support plate, obtains a picture of the aquaculture object, and obtains the size of the aquaculture object from the size in the picture.
[0058] This application uses a clamping assembly to fix the aquaculture object, making it easy to take photos and measure the size of the aquaculture object in the photos to calculate the actual size of the aquaculture object. This can measure the corresponding size of irregularly shaped aquaculture objects, reduce the difficulty of manual inspection, and achieve the goal of accurately obtaining the size of aquaculture objects.
[0059] In some implementations...
[0060] The aquaculture species includes river crabs, and the clamping assembly also includes a clamping rod 12, one end of which is movably connected to the support plate, and the other end is a free end; the clamping rod 12 and the support plate work together to clamp the small legs and claws of the river crab.
[0061] For aquaculture species such as river crabs, Figure 1-4 As shown, a clamping rod 12 is installed on the first support plate 11 to fix the crab's small legs and claws, ensuring the crab is in a stable position when taking photos. For easier framing of the photo, a limiting member 13 is also provided on the first support plate 11, which can serve as a reference mark.
[0062] In some implementations...
[0063] The clamping rod 12 is connected to the bearing plate by a pin 18. A compression spring 17 is sleeved on the pin 18. One end of the compression spring 17 abuts against the clamping rod 12 so that the clamping rod 12 and the bearing plate clamp the crab.
[0064] The clamping rod 12 is connected to the first support plate 11 via a pin 18 and can rotate around the pin 18. This makes it convenient to place the crab on the first support plate 11 and provides a large operating space. Then, the clamping rod 12 is rotated above the crab and pressed by the compression spring 17, so that the small legs and claws of the crab between the clamping rod 12 and the first support plate 11 are fixed, thus keeping the entire crab in a stationary state, which is convenient for taking pictures.
[0065] In some implementations...
[0066] The aquaculture object includes snails. The clamp assembly also includes a base 23, a slide rail 22, a lifting frame 25, and a fixing line 26. The support plate is disposed on the base 23, the slide rail 22 is vertically disposed on the base 23, and the lifting frame 25 is U-shaped and slides in cooperation with the slide rail 22. On the vertical projection plane, the support plate is located in the U-shaped groove of the lifting frame 25. The two ends of the fixing line 26 are connected to the two side walls of the U-shaped groove. When the lifting frame 25 moves down, the fixing line 26 presses down on the snails located on the support plate.
[0067] For snails and similar aquaculture species, such as Figure 5-8 As shown, the structure also includes a base 23, a slide rail 22, a lifting frame 25, and a fixing line 26. The second bearing plate 21 is set on the base 23. If necessary, a base platform 24 can be used to raise the second bearing plate 21. The slide rail 22 is set on the base 23. The lifting frame 25 slides up and down along the slide rail 22. The lifting frame 25 has a U-shaped structure. The two sides of the U-shape are connected to the fixing line 26. During the downward movement, the fixing line 26 can hold the screw on the second bearing plate 21 to prevent it from moving around and facilitates taking pictures.
[0068] In some implementations...
[0069] The aquaculture object includes lobster, and the clamp assembly also includes two partitions 32, which are arranged alternately on the support plate, with the lobster located between the two partitions 32.
[0070] For aquaculture species such as lobsters, Figure 9-11 As shown, a partition 32 is set on the third support plate 31. The small legs, claws, antennae and tail of the lobster are separated by two partitions 32 arranged alternately, which makes it convenient to take pictures. A limiting member 34 can also be set on the third support plate 31 as a reference mark for taking pictures.
[0071] In some implementations...
[0072] The support plate is stepped. When the support plate is placed horizontally, the partition 32 is provided on the adjacent lower plate surface, and the higher plate surface is provided with a groove 33. The extension direction of the groove 33 passes through the gap between the two partitions 32.
[0073] The third support plate 31 is set in a stepped shape, and the partition plate 32 is located on the lower plate surface. This allows the lobster to be placed in the groove 33 on the step 35, making it easier for the lobster to be fixed on the third support plate 31.
[0074] According to another aspect of this application, a method for measuring the phenotypic characteristics of aquaculture objects based on a visual algorithm is provided, including an aquaculture object phenotypic measurement device employing the visual algorithm as described above.
[0075] Based on the aforementioned visual algorithm-based aquaculture object phenotyping device, different types of aquaculture objects can be fixed, enabling accurate photography and obtaining better positional photos of the aquaculture objects.
[0076] In some implementations...
[0077] The aquaculture object is fixed on the support plate;
[0078] The camera is aimed at the aquaculture object to take a picture, thereby obtaining a photo of the aquaculture object;
[0079] Mark multiple key points that need to be measured on the photograph of the aquaculture object, measure the distance between the multiple key points according to the preset distance requirements, and obtain the actual size of the aquaculture object according to the preset algorithm based on the distance.
[0080] The aquaculture object is placed into the fixture assembly, and then photographed to obtain different key points in the photo. These key points can reflect the main dimensions of the aquaculture object. The distance between the relevant key points is measured, and the actual size of the aquaculture object is calculated based on this distance.
[0081] Traditional manual phenotyping methods are inefficient, prone to human error, and require a large amount of work for statistical analysis. Furthermore, traditional manual measurements cannot only record the measured data but also visualize it. This application presents a vision-based measurement method: it is simple to measure, has low human error, and is easy to statistically analyze. While outputting the data to be collected, it also saves the original data sampling images, enabling it to output not only the data to be detected but also the coordinate point data.
[0082] In some implementations...
[0083] The preset algorithm includes a top-down keypoint detection algorithm, which comprises two calculation processes:
[0084] A target object location detection algorithm is used to detect the overall size of the aquaculture object;
[0085] The main key point detection algorithm is used to detect the key point locations of the aquaculture object.
[0086] Top-down keypoint detection algorithms mainly consist of two parts: object detection and subject keypoint detection. Commonly used object detection algorithms include SSD, YOLO, MobileNet, and Faster R-CNN. For keypoint detection algorithms, firstly, it's important to note that the local information of keypoints has weak discriminative power; similar local regions can easily appear in the background, causing confusion. Therefore, a larger receptive field is necessary. Secondly, the difficulty of detecting keypoints varies depending on their location. Detecting keypoints at edges is significantly more difficult than detecting keypoints near the center of the subject, so different keypoints may require different treatment. Finally, top-down keypoint localization relies on the proposed suggestions of the detection algorithm, which can lead to inaccurate detection and duplicate detections.
[0087] The bottom-up keypoint detection algorithm mainly consists of two parts: keypoint detection and keypoint clustering. Keypoint detection requires detecting all keypoints of all categories in the image, and then clustering these keypoints to connect different keypoints together, thereby generating different individuals.
[0088] In some implementations...
[0089] Before marking key points, the obtained photos of aquaculture objects are preprocessed to ensure that the key points on the images are distributed in the same way.
[0090] The images to be detected are processed to the image conditions used during model training to maintain a consistent distribution of image features. The main image geometric transformation is used to correct systematic errors during image acquisition and random errors in instrument position (mainly including imaging angle, lighting changes, and camera accuracy).
[0091] Image processing also requires grayscale interpolation algorithms because, according to this transformation relationship, the pixels of the output image may be mapped to non-integer coordinates of the input image. Commonly used methods include nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation. We primarily use bicubic interpolation here. Its basic principle is to approximate the value of missing pixels based on existing pixels using a cubic function determined by 16 coefficients. The coefficients are calculated based on known pixels. The advantage of bicubic interpolation is that the calculation function has the property of convergence of its first and second derivatives, resulting in a smoother interpolation effect while preserving the details and sharpness of the original image. The disadvantage is its slower processing speed and high computational resource consumption. The current project requires single-frame image processing, which our computing power can handle.
[0092] Example 2 uses the apparatus from Example 1 to measure the size of aquaculture organisms. The method steps are as follows:
[0093] Turn on the camera equipment. According to the operating instructions for measuring aquaculture objects, install the camera components and adjust the height. Prepare a computer with the phenotyping software pre-installed. Insert the camera equipment's USB cable into the computer's USB port. Power on the equipment and the computer. Open and run the phenotyping software on the computer. Enter the corresponding aquaculture object sub-item that needs to be measured. At this time, the software will display the camera's field of view.
[0094] After completing the preparation work and debugging the equipment, clamp the aquatic organisms to be detected, place the clamp in the detection position, and check the camera image on the computer interface. Adjust the camera lens focus until the image is clear, and adjust the clamp position to ensure that the clamp is completely within the visual detection area. Click the capture button on the software interface, check whether the marked points in the captured image are correct and accurate, and save the detection image. Repeat this process three times to check the captured image and confirm that the data is consistent. This completes the equipment debugging and startup process. After confirming that the recognition is running normally, clamp the aquatic organisms to be detected (in the conventional process, only one image is needed per clamp). Clamp the aquatic organisms to be detected, place the clamp in the shooting area, click the capture button on the software, check the image markings, click to confirm the image markings, and click to save the data.
[0095] I. Target Position Detection Algorithm Deep Learning Framework: TensorFlow
[0096] Algorithm: MobileNet-SSD
[0097] Language: Python
[0098] Algorithm introduction:
[0099] The MobileNet-SSD algorithm's network structure mainly consists of two parts: MobileNet and SSD (SingleShot Multibox Detector). Specifically, the configuration of the basic network part of MobileNet-SSD from Conv0 to Conv13 is completely consistent with the MobileNet v1 model, essentially removing the final global average pooling, fully connected layers, and softmax layers of MobileNet v1. The SSD part adds additional convolutional layers on top of MobileNet to perform object detection on feature maps of different scales. In the VGG16-SSD scheme, Conv6 and Conv7 replace the original VGG16's FC6 and FC7, respectively. Both MobileNet-SSD and VGG16-SSD extract features from six different scale feature maps for detection. MobileNet-SSD combines the advantages of MobileNet and SSD, using a pre-trained MobileNet as the feature extractor: it uses depthwise separable convolution to reduce the model's parameters and computational cost. Depthwise separable convolution decomposes the standard convolution operation into two steps: depthwise convolution and pointwise convolution, used to extract spatial and channel features, respectively. A series of convolutional layers then predict the object's class and location. This structure allows MobileNet-SSD to maintain high accuracy while having low computational and storage costs, making it suitable for real-time object detection tasks.
[0100] 1. Depthwise Separable Convolution
[0101] Depthwise convolution formula:
[0102] Pointwise convolution formula: Where D is the depthwise convolution kernel, P is the pointwise convolution kernel, x is the input feature map, and M and N are the number of filters in the depthwise convolution and pointwise convolution, respectively.
[0103] 2. Feature Pyramid Network (FPN): This network generates a series of multi-scale feature maps by recursively applying upsampling and fusion steps. Each feature map can be used to detect targets at its corresponding scale. It is a key component of the SSD network, allowing the model to detect targets at multiple scales. By extracting multi-scale feature maps from the basic MobileNet feature extractor, SSD can apply convolutional kernels of different sizes to feature maps at different resolutions, thereby detecting targets of different sizes.
[0104] Feature upsampling:
[0105] Feature map upsampling typically uses methods such as nearest neighbor, bilinear interpolation, or transposed convolution to increase the resolution of the feature map;
[0106] The formula for transpose convolution is: Where T is the transposed convolution kernel, F is the input feature map, and k is half the size of the convolution kernel.
[0107] Feature fusion:
[0108] Feature fusion can be a simple addition or multiplication of elements, or a more complex fusion strategy, such as using convolutional layers to reweight features.
[0109] Formula for adding elements: F conbined =F low-leve +UF high-leve F low-leve It is a low-level feature map, F high-leve It is a high-level feature map, and U is the upsampling operation.
[0110] 3. Detection Head: The SSD network uses specific convolutional layers to predict bounding boxes and class probabilities. In MobileNet-SSD, these convolutional layers output the class score and bounding box coordinates for each location on each feature map.
[0111] ① A bounding box is usually represented by four values: (x, y, w, h), which represent the coordinates of the center point and the width and height of the box, respectively.
[0112] ② In SSD, bounding box prediction may use convolutional layers to output C anchor boxes of different scales and sizes.
[0113] ③ Category prediction typically uses the softmax function: Where s i is the unnormalized prediction score for category i, and C is the total number of categories.
[0114] 4. Loss Function: MobileNet-SSD uses a specific loss function to train the network, which typically includes classification loss and bounding box regression loss.
[0115] SSD networks typically use a multi-task loss function, combining bounding box regression loss and classification loss, for example: L = L conf +λL loc +L cls L conf It is the confidence loss, L loc It is the bounding box position loss, L cls λ is the classification loss, and λ is the weight used to balance the bounding box loss.
[0116] Based on this, optimize as follows:
[0117] 1. To further reduce the number of parameters, the Inception-v4 module, employing parallel convolution, is used. Inception-v4 is a deep convolutional neural network that inherits and develops the characteristics of the Inception series of networks, particularly in improving computational and parameter efficiency. The following are the key features of the Inception-v4 network structure:
[0118] ①Inception Module: Inception-v4 continues to use the Inception module, which captures different scale features of an image by performing convolutions (e.g., 1x1, 3x3, 5x5) and pooling operations of different sizes in parallel.
[0119] ② Stem branch: Inception-v4 introduces a new stem branch, which is the initial part of the network used to reduce the input image size from its original size to a smaller size for processing by subsequent layers.
[0120] ③Reduction Module: Inception-v4 introduces a dedicated reduction block to change the width and height of the feature map, similar to the downsampling layer in a convolutional network.
[0121] ④ Inception A, B, and C Modules: The Inception-v4 network structure contains three main Inception modules, named A, B, and C. These modules are reused throughout the network to progressively extract and combine features.
[0122] ⑤ Residual Connections: Although the initial Inception-v4 design did not use residual connections, subsequent versions of Inception-ResNet combined the Inception architecture with residual connections to accelerate training and improve performance.
[0123] ⑥ Activation value scaling: To prevent the network from crashing during training, especially when there are many convolutional kernels, Inception-v4 introduces a scaling factor for activation values, which is usually between 0.1 and 0.3.
[0124] ⑦ Performance and efficiency: Inception-v4 delivers excellent performance while maintaining high computational efficiency, thanks to its carefully designed network structure and modules.
[0125] ⑧ Experimental results: Inception-v4 and its variants have achieved excellent results on tasks such as the ImageNet classification challenge, demonstrating their powerful image recognition capabilities.
[0126] 2. Due to the cumbersome and costly process of collecting and labeling basic data, a series of data augmentation methods were adopted to enrich the data, enabling the model to be trained with strong generalization ability on a small and relatively repetitive dataset. We mainly used methods such as increasing contrast, decreasing contrast, increasing brightness, decreasing brightness, increasing saturation, decreasing saturation, random cropping, and random rotation.
[0127] 3. During model training, the convergence speed was improved by reducing the network depth (depth_multiplier: 0.75) and replacing the original hard example / negative mining with focal loss. Focal loss adjusts sample weights based on prediction accuracy, making the model pay more attention to misclassified and hard-to-classify samples. The model already has good classification ability for samples that can be predicted accurately; reducing attention to these samples will not affect the model's classification ability for them. For samples that are predicted less accurately or even incorrectly, the model pays more attention, which can improve the prediction ability for these samples, thereby improving the overall performance.
[0128] The Hard Example Minin loss can be described using the following pseudocode:
[0129] For each training epoch:
[0130] for each batch in training data:
[0131] predict scores for all examples in the batch
[0132] calculate loss for all examples
[0133] identify hard negative examples based on the loss or confidence score
[0134] create a new batch with a balanced number of hard negative examples and positive
[0135] examples
[0136] update model weights using the new batch
[0137] The formula for the Focal loss function is as follows:
[0138] FL=-∝ t (1-p t ) γ log(p t )
[0139] in:
[0140] ∝ t It is a weighting factor that balances positive and negative samples. For samples of class t, ∝ t It is usually set to ∝ or ∝×(1-balanced_weight), where balanced_weight is the ratio of the number of samples in class t to the total number of samples.
[0141] p t It is the model predicting the probability of the current class. For a binary classification problem, if y t =1 (i.e., the sample belongs to category t), then p t = p(confidence score of model prediction as positive); if y t =0, then p t = 1 - p (confidence that the model predicts the class to be negative).
[0142] γ is an index that adjusts the model's focus on difficult samples, used to reduce attention to easily classified samples, and is usually set to 2 or 5.
[0143] log(p t ) is the probability p t The natural logarithm of .
[0144] Model inference performance:
[0145] Based on the SSD-Mobilnet network and optimized, the test model achieved an accuracy of over 99.5%, a recall of over 99.9%, and an inference speed of 60fps in the current environment.
[0146] II. Key Point Detection Algorithm
[0147] Deep learning framework: PyTorch
[0148] Algorithm: ShuffleNet V2
[0149] Language: Python
[0150] Algorithm introduction:
[0151] Keypoint detection is essentially a regression analysis of N keypoints. Commonly used algorithms include ResNet, MobileNet, SequenceNet, ShuffleNet, and Kaopo. Before designing the algorithm, we first performed a simple verification of the aforementioned algorithms and found that the ShuffleNet mesh structure performs best for regression detection of multiple keypoints. Therefore, we chose to use the ShuffleNet network as the basic framework for optimization to achieve good results in the current scenario.
[0152] Key features:
[0153] 1. Pointwise Group Convolution: ShuffleNet v1 uses pointwise group convolution to reduce computation. In pointwise group convolution, the input channels are divided into multiple groups, and each group undergoes convolution operation independently. If the number of input channels is C... in The number of output channels is C out Then grouped convolution can be expressed as: Conv group (C in C out ,G)
[0154] 2. Channel Shuffle: To address the information isolation problem between channels caused by grouped convolutions, ShuffleNet v1 introduced a channel shuffle operation. By rearranging the channels, it ensures that the convolutional outputs of different groups can be effectively fused in subsequent layers. For an input feature x, channel shuffle can be represented as: ChannelShuffle(x) where x has a shape of [N,C,H,W], where N is the batch size, C is the number of channels, and H and W are the height and width of the feature map, respectively. The shuffle operation reorganizes the channel dimensions of the feature map to ensure that the convolutional outputs of different groups can be effectively fused in subsequent layers.
[0155] 3. Bottleneck Structure: ShuffleNet v1 employs a bottleneck structure, where the number of input and output channels differs, which helps reduce the number of model parameters and computational cost.
[0156] 4. Depthwise Separable Convolution: In 3x3 convolutions, ShuffleNet v1 uses depthwise separable convolution. First, a spatial convolution is applied independently to each input channel, then a 1x1 convolution is used to merge the results, significantly reducing computational cost compared to standard convolutions. For input x and depthwise convolution kernel d, depthwise separable convolution can be represented as: DWConv(x,d), where d is applied to each channel of x, and then a 1x1 convolution is used to merge the results, further reducing computational cost.
[0157] 5. Residual Connections: ShuffleNet v1 uses residual connections in its residual modules to aid gradient flow and improve the ability to train deep networks, thereby enhancing the stability of network training. The formula for a residual connection can be expressed as: Residual(x,f(x))=f(x)+x, where x is the input, and f(x) is the result of a certain part of the network processing the input x.
[0158] 6. Average Pooling and Concatenation: When processing feature maps of different sizes, ShuffleNet v1 uses average pooling to reduce the spatial size of the feature maps and concatenates them with the output instead of adding them, to maintain the consistency of feature map sizes. This can be represented as: AvgPool(x,k,s), where x is the input feature map, k is the size of the pooling kernel, and s is the stride.
[0159] ShuffleNet v1 was designed to minimize model size and computational cost while maintaining performance, making it suitable for running on resource-constrained devices.
[0160] Based on this, optimize as follows:
[0161] 1. Similar to the approach used in object detection, data augmentation is still necessary to enrich the data and enable the model to be trained with strong generalization ability on a small and relatively repetitive dataset. The difference is that we only adopted methods such as reducing contrast, brightness, and saturation.
[0162] 2. The optimization of the network structure involves adding a left-right mirroring strategy when processing data, making the random key points symmetrical during model training.
[0163] 3. Further optimize the components in the network, such as using smaller convolutional kernels or fewer layers, to reduce computational cost.
[0164] Model inference performance:
[0165] Based on the ShuffleNet v1 network and optimized, the test model achieved an accuracy of over 99.5%, a recall of over 99.9%, and an inference speed of 50fps in the current environment.
[0166] It will be readily understood by those skilled in the art that the above embodiments can be freely combined and superimposed without conflict.
[0167] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application. The above description is merely a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of this application, and these improvements and modifications should also be considered within the protection scope of this application.
Claims
1. A device for measuring the phenotypic characteristics of aquaculture objects based on visual algorithms, characterized in that, include: The clamping assembly includes a first support plate, a second support plate, and a third support plate, for fixing the aquaculture object on the first support plate, the second support plate, and the third support plate; A photographic device, including a camera, takes pictures of the aquaculture object at preset distances from the first support plate, the second support plate, and the third support plate, and obtains a photograph of the aquaculture object, and obtains the size of the aquaculture object from the size of the photograph; When the aquaculture object is a river crab, the clamp assembly also includes a clamping rod (12), one end of which is movably connected to the first support plate, and the other end is a free end; the clamping rod (12) and the first support plate work together to clamp the small legs and claws of the river crab; When the aquaculture object is a snail, the clamp assembly also includes a base (23), a slide rail (22), a lifting frame (25), and a fixing line (26). The second support plate is disposed on the base (23), the slide rail (22) is vertically disposed on the base (23), and the lifting frame (25) is U-shaped and is slidably disposed in cooperation with the slide rail (22). On the vertical projection plane, the second support plate is located in the U-shaped groove of the lifting frame (25). The two ends of the fixing line (26) are connected to the two side walls of the U-shaped groove. When the lifting frame (25) moves down, the fixing line (26) presses down on the snail located on the second support plate. When the aquaculture object is a crayfish, the clamp assembly also includes two partitions (32), the two partitions (32) are alternately arranged on the third support plate, the crayfish is located between the two partitions (32), the third support plate is stepped, when the third support plate is placed horizontally, the partitions (32) are arranged on the adjacent lower plate surface, and the higher plate surface is provided with a groove (33), the extension direction of the groove (33) passes through the gap between the two partitions (32).
2. The aquaculture object phenotyping device based on visual algorithms according to claim 1, characterized in that: The clamping rod (12) is connected to the first bearing plate by a pin (18). A compression spring (17) is sleeved on the pin (18). One end of the compression spring (17) abuts against the clamping rod (12) so that the clamping rod (12) and the first bearing plate clamp the crab.
3. A method for phenotypic measurement of aquaculture objects based on visual algorithms, characterized in that, Includes a visual algorithm-based aquaculture object phenotyping device as described in any one of claims 1-2.
4. The measurement method according to claim 3, characterized in that, Includes the following steps: The aquaculture object is fixed on the first support plate, the second support plate, and the third support plate; The camera is aimed at the aquaculture object to take a picture, thereby obtaining a photo of the aquaculture object; Mark multiple key points that need to be measured on the photograph of the aquaculture object, measure the distance between the multiple key points according to the preset distance requirements, and obtain the actual size of the aquaculture object according to the preset distance and the preset algorithm.
5. The measurement method according to claim 4, characterized in that: The preset algorithm includes a top-down keypoint detection algorithm, which comprises two calculation processes: A target location detection algorithm is used to detect the overall location of the aquaculture object; The main key point detection algorithm is used to detect the key point locations of the aquaculture object.
6. The measurement method according to claim 5, characterized in that: The target subject location detection algorithm includes at least one of SSD, YOLO, MobileNet, and Faster R-CNN; the subject key point detection algorithm includes at least one of Proposals and ShuffleNet.
7. The measurement method according to claim 6, characterized in that: Before marking key points, the obtained photos of aquaculture objects are preprocessed to ensure that the key points are distributed uniformly in the photos.
Citation Information
Patent Citations
Clamp for fixing crab
CN108792317A
Fish body posture estimation and fish body surface shape data measurement method and device
CN112669348A
Crayfish size measuring device
CN219301464U