Fish body size measuring method and device and fish size nondestructive measuring equipment
By using the key point detection model of the double-layer routing attention structure and the fast convolution module in the circulating aquaculture system, the problem of low accuracy of fish body size measurement in complex environments is solved, and the stability and accuracy of fish body size are achieved. Measurement improves the efficiency of breeding management.
Patent Information
- Application Number
- CN202410682328.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-03
AI Technical Summary
In recirculating aquaculture systems, existing technology is difficult to accurately measure fish body dimensions in complex environments, resulting in low measurement accuracy and poor stability, which affects breeding management.
A key point detection model based on a double-layer routing attention structure and a fast convolution module is used to obtain fish video frames through a depth camera, perform key point detection and data fitting, and use the Focal EIoU function to train the model to achieve fish body size Stable and accurate measurements.
It improves the stability and accuracy of fish body size measurement, is suitable for complex underwater environments, and reduces stress on fish and measurement errors.
Smart Images

Figure CN118583053A
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a fish body size measurement method, a device and fish size non-destructive measurement equipment. Background Art
[0002] In recirculating aquaculture systems, real-time and accurate estimation of fish size is one of the key parameters for formulating scientific aquaculture strategies. It not only provides important input information for feeding, thereby reducing environmental pollution caused by excessive feeding, but also provides an important reference for determining the optimal fishing time and formulating aquaculture plans.
[0003] However, current production still relies mainly on manual estimation and measurement, which is inefficient and harmful to fish, leading to fish stress. Therefore, there is an urgent need for a real-time, efficient, and non-destructive fish size measurement method, which has become one of the key issues that need to be solved in current aquaculture management.
[0004] In the related art, a depth camera is used to capture depth images, which can obtain the depth information of the photographed object. However, in the complex environment of a recirculating aquaculture system, such as abnormal posture, lighting changes, feature blur, and background interference, the depth information extracted from the image is difficult to correctly fit the abnormal posture of the fish body size, resulting in low accuracy in fish body size measurement. In addition, the three-dimensional size measurement method using a binocular camera captures images through perspective projection, which makes it difficult to reversely restore the depth information of the object in the image, thereby affecting the stability of the measurement accuracy. Summary of the invention
[0005] The present invention provides a fish body size measurement method, device and fish size non-destructive measurement equipment, which are used to solve the defects that the depth information extracted from the image in the prior art is difficult to correctly fit the abnormal posture of the fish body size in a complex environment, resulting in low fish body size measurement accuracy, and the depth information of the object in the image is difficult to reversely restore, thereby affecting the stability of the measurement accuracy, so as to achieve the stability and accuracy of the fish body size measurement.
[0006] The present invention provides a method for measuring fish body size, comprising: Based on the key point detection model, the key point data set of the target fish is detected to obtain the key point detection result; The key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on the multiple key point features to obtain target features; the key point detection model is trained based on the target features as training features and the Focal EIoU function as the loss function; The fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result.
[0007] According to a fish body size measurement method provided by the present invention, the key point data set is obtained by the following steps: Using a depth camera to acquire a video frame of the target fish in an underwater environment; Performing image conversion on the video frame, and annotating the converted image with object information to obtain an annotated image, wherein the annotated image includes key point annotation information and key point label information of the target fish; Data enhancement and data division are performed on the annotated image to obtain the key point data set; the data enhancement includes at least one of random brightness, random noise, random filtering and horizontal flipping of the image; the key point data set includes a training set, a test set and a validation set allocated in proportion.
[0008] According to a fish body size measurement method provided by the present invention, the key point detection model further includes a small target detection layer, which is used to obtain small target fish features from the key point data set; The key point detection model uses the SGD optimizer to optimize network parameters.
[0009] According to a fish body size measurement method provided by the present invention, the key point detection result includes three-dimensional coordinate points of different parts of the fish; the fitting result includes the body length of the target fish; The step of fitting the fish posture according to the key point detection result and determining the fish body size data according to the fitting result comprises: projecting the three-dimensional coordinate points of different parts of the fish in a three-dimensional space plane to obtain the Euclidean distance between the different parts of the fish; Fitting the Euclidean distances between different parts of the fish according to a quadratic polynomial curve to obtain a posture curve of the target fish; The body length is calculated according to the posture curve.
[0010] According to a fish body size measurement method provided by the present invention, the key point detection result includes three-dimensional coordinate points of different parts of the fish; the fitting result includes the body width of the target fish; The step of fitting the fish posture according to the key point detection result and determining the fish body size data according to the fitting result also includes: The body width of the target fish is calculated according to the three-dimensional coordinate points and Euclidean distances of different parts of the fish.
[0011] The present invention also provides a fish body size measuring device, comprising: A key point detection module is used to detect the key point data set of the target fish based on the key point detection model to obtain the key point detection result; The key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on the multiple key point features to obtain target features; the key point detection model is trained based on the target features as training features and the Focal EIoU function as the loss function; The calculation module is used to fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result.
[0012] The present invention also provides a non-destructive fish size measurement device, comprising: The fish body size measuring device; A depth camera, wherein the depth camera is used to collect a key point data set of a target fish; A waterproof box, the waterproof box is used to contain the depth camera to ensure the normal operation of the depth camera in an underwater environment; a light source, the light source is used to provide supplementary light for the depth camera.
[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned methods for measuring fish body size is implemented.
[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for measuring the body size of fish as described above is implemented.
[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the fish body size measurement method as described above is implemented.
[0016] The fish body size measurement method, device and fish size non-destructive measurement equipment provided by the present invention detect the key point data set of the target fish through a double-layer routing attention structure and a fast convolution module key point detection model to obtain the key point detection result, then fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result, thereby improving the stability and accuracy of fish body size measurement in complex environments. . BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a schematic diagram of the flow of the method for measuring fish body size provided by the present invention; Figure 2 It is a structural schematic diagram of a double-layer routing attention structure provided by the present invention; Figure 3 It is a schematic diagram of the structure of the fast convolution module C2f-Faster provided by the present invention; Figure 4 It is a schematic diagram of the positions of key points of fish provided by the present invention; Figure 5 It is a structural schematic diagram of a fish body size measuring device provided by the present invention; Figure 6 It is a structural schematic diagram of the non-destructive measurement device for fish size provided by the present invention; Figure 7 It is a schematic diagram of a fish size non-destructive measurement scenario provided by the present invention; Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] Combine the following Figure 1-Figure 7 The invention describes a fish size measuring method, a device and a fish size non-destructive measuring device.
[0021] Figure 1 FIG. 1 is a flow chart of the method for measuring fish size provided by the present invention, such as Figure 1 As shown, the fish body size measurement method comprises the following steps: Step 110, based on the key point detection model, the key point data set of the target fish is detected to obtain the key point detection result; wherein the key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on multiple key point features to obtain target features; the key point detection model is trained based on the target features as training features and the Focal EIoU function as the loss function.
[0022] In this step, the target fish refers to real fish living in an underwater environment, and the target fish may include one or more fish of the same or different species, and may also include one or more fish of the same or different body shapes.
[0023] In this step, the key point data includes sampling data of different parts of the fish. For example, the key point data of the fish includes image data of the dorsal fin, pectoral fin, head and tail of the fish.
[0024] In this embodiment, the fast convolution module includes a C2f-Faster network.
[0025] In this embodiment, the backbone network of the key point detection model uses the key point data set as the input of the detection network, extracts the target feature information required for the fish key points through a double-layer routing attention (BRA), and outputs feature maps of multiple scales, i.e., multiple key point features; for example, BRA outputs feature maps of four different sizes, namely (W / 2×H / 2×2C), (W / 4×H / 4×4C), (W / 8×H / 8×8C), and (W / 16×H / 16×8C).
[0026] Figure 2 is a schematic diagram of the structure of the double-layer routing attention structure provided by the present invention. Figure 2 In the illustrated embodiment, the working mechanism of the dual-layer routing attention (BRA) module is as follows: first, BRA takes the feature map as input and obtains the query Q, key K and value V through linear mapping; then, in order to determine which regions each specified region should involve, a directed graph is constructed and the adjacency matrix of the correlation between the query and the corresponding key regions is calculated; then, the aggregation operation is used to aggregate the tensors of the key and value to obtain K g and V g , and perform attention processing operations; finally, add the local context enhancement term LCE(V) that can be parameterized by deep convolution to obtain the output tensor O; the BRA structure can be expressed by the following formula: Among them, K g is the tensor of K, V gis the tensor of V; C is a scalar factor that can solve the problems of weight concentration and gradient vanishing; through dynamic sparse two-layer routing optimization and flexible content perception, more attention can be paid to the key information of fish features in the image and less attention to the background.
[0027] In this embodiment, feature maps of multiple scales are input into the neck of the model, that is, target features are extracted from feature maps of multiple scales through the C2f-Faster network; the C2f-Faster network can enhance the model's fish feature learning capability in a complex environment while reducing the complexity of the model.
[0028] In this embodiment, the target feature information is input into the head of the model, and a multi-layer detection head and FocalEIoU loss function are used for learning regression to finally achieve key point detection of fish.
[0029] Figure 3 is a schematic diagram of the structure of the fast convolution module C2f-Faster provided by the present invention. Figure 3 In the illustrated embodiment, the C2f-Faster structure is composed of a C2f module and a FasterBlock; Faster Block is a convolutional neural network module capable of capturing complex spatial changes in images; Faster Block is composed of a partial convolution structure PConV, two ConV layers displayed as inverted residual blocks, and a shortcut; the shortcut is used to determine whether to reuse input features, and PConV can apply conventional ConV to some input channels for spatial feature extraction, while keeping the remaining channels unchanged, enabling the model to capture finer-grained spatial information but using smaller channels to improve its detection accuracy and calculation speed.
[0030] In this embodiment, the formula for the number of memory accesses and floating point operations per second of PConV can be defined as: Among them, h, w are the width and height of the feature map, k is the size of the convolution sum, and c p is the number of channels for conventional convolution; the number of memory accesses of PConV is only 1 / 4 of that of conventional convolution and the FLOPs is only 1 / 16 of that of conventional convolution; on the basis of better adapting to the complex spatial changes of fish images, latency and computing speed can also be optimized.
[0031] Step 120: Fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result.
[0032] In this step, the key point detection results are the position data of different parts of the target fish. For example, the key point detection results include the two-dimensional coordinates or three-dimensional coordinates of the fish head, the midpoint of the fish and the tail of the fish.
[0033] In this embodiment, when the key point detection results include two-dimensional coordinates of different parts of the fish, the two-dimensional coordinates need to be converted into three-dimensional coordinates for subsequent calculation of the fish posture fitting curve.
[0034] Specifically, in this embodiment, the key point detection result includes the three-dimensional coordinate points of different parts of the fish; the fitting result includes the body length of the target fish; fitting the fish posture according to the key point detection result, and determining the fish body size data according to the fitting result includes: projecting the three-dimensional coordinate points of different parts of the fish in a three-dimensional space plane to obtain the Euclidean distance between different parts of the fish; fitting the Euclidean distance between different parts of the fish according to a quadratic polynomial curve to obtain a posture curve of the target fish; and calculating the body length according to the posture curve.
[0035] Figure 4 is a schematic diagram of the position of key points of fish provided by the present invention, Figure 4 In the embodiment shown, the above key point detection result is a three-dimensional real-world coordinate point, and the fish head is denoted by A(x u1 ,y u1 , z u1 ), dorsal fin is B1(x1, y1, z1), pectoral fin is B2(x2, y2, z2), tail is C(x u3 ,y u3 , z u3 ), where the midpoint of the fish body between the dorsal fin and the pectoral fin is denoted as B(x u2 ,y u2 , z u2 ); and then obtain the corresponding fish body length value through the following steps: (1) Fix the three-dimensional real-world coordinate points in a certain three-dimensional space plane and establish a plane rectangular coordinate system on the plane. A falls at the origin and is recorded as A', and C falls on the x-axis and is recorded as C'; x length is the straight-line distance from point A' to C', and also the straight-line length of the fish; x length The Euclidean distance between the fish head, the fish midpoint and the fish tail is calculated by the following formula: (2) Substitute points A, B, and C into the quadratic polynomial curve fitting to obtain the fish posture curve S, and then calculate the predicted value of the fish body length using the following formula: Wherein, S′ is the derivative of the curve S; in this embodiment, the proposed three-dimensional key points are input into the curve fitting algorithm to obtain a size value that is closer to the natural fish body curve.
[0036] In this embodiment, the key point detection results include three-dimensional coordinate points of different parts of the fish; the fitting results include the body width of the target fish; fitting the fish posture according to the key point detection results, and determining the fish body size data according to the fitting results also includes: calculating the body width of the target fish according to the three-dimensional coordinate points of different parts of the fish and the Euclidean distance.
[0037] Specifically, since fishes hardly bend in the direction of their body width, the Euclidean distance between the two measurement points corresponding to the body width can be directly calculated as the body width value, and the body width of the fish can be calculated using the following formula: Among them, (x1, y1, z1) is the three-dimensional coordinate point of the dorsal fin of the fish, and (x2, y2, z2) is the three-dimensional coordinate point of the pectoral fin of the fish.
[0038] The fish body size measurement method provided by the embodiment of the present invention detects the key point data set of the target fish through a double-layer routing attention structure and a fast convolution module key point detection model to obtain a key point detection result, then fits the fish posture according to the key point detection result, and determines the fish body size data according to the fitting result, thereby improving the stability and accuracy of fish body size measurement in complex environments.
[0039] In some embodiments, according to a fish body size measurement method provided by the present invention, a key point data set is obtained by the following steps: using a depth camera to obtain a video frame of a target fish in an underwater environment; performing image conversion on the video frame, and annotating the converted image with object information to obtain an annotated image, wherein the annotated image includes key point annotation information and key point tag information of the target fish; performing data enhancement and data partitioning on the annotated image to obtain a key point data set; the data enhancement includes at least one of random brightness, random noise, random filtering and horizontal flipping of the image; the key point data set includes a training set, a test set and a validation set allocated in proportion.
[0040] In this embodiment, the depth camera includes a RealSense Depth Camera, the camera has an operating range of 6m, a field of view of 86×57, and the camera includes an RGB sensor and a tracking module. The depth camera uses RGB and depth modes to simultaneously capture RGB-D images.
[0041] In this embodiment, a depth camera is used to shoot original video in an actual breeding site, and a control processor receives the original video shot by the camera and constructs a key point data set. The specific operation steps are as follows: (1) The depth camera is placed in a transparent waterproof box and set at the edge of the fish pond, facing the main area of the breeding pond, so that the normal swimming of fish can be captured; (2) Perform simple image conversion on the m groups of underwater videos taken, and annotate the converted images with object information, including the annotation information of target key points. In addition, K fish key point labels are divided according to the characteristics of fish; the values of m and K can be set according to the actual needs of the user, for example, m = 15, K = 5; (3) The input image is subjected to data enhancement with random brightness, random noise, random filtering, and horizontal flipping. At the same time, the training set, test set, and validation set are redistributed in a certain ratio; the image resolution is adjusted to W×H, and finally the fish key point data set is obtained; the above ratio, W, and H values can be set according to the actual needs of the user, for example, the above ratio is 8:1:1; W×H is 640×640.
[0042] The fish body size measurement method provided by the embodiment of the present invention uses a depth camera to obtain a video frame of a target fish in an underwater environment; performs image conversion on the video frame, and annotates the converted image with object information to obtain an annotated image, wherein the annotated image includes key point annotation information and key point label information of the target fish; performs data enhancement and data division on the annotated image to obtain a key point data set, thereby realizing the conversion of annotated two-dimensional key points into three-dimensional real-world coordinates, and improving the size measurement accuracy of the method in a complex environment.
[0043] In some embodiments, the key point detection model also includes a small target detection layer for acquiring small target fish features from a key point data set; the key point detection model uses an SGD optimizer to optimize network parameters.
[0044] In this embodiment, the key point detection model includes multiple head detection modules, and different head detection modules are used to collect features of fish images of different sizes; wherein the multiple head detection modules include a small target detection layer to realize feature extraction of small-sized fish images.
[0045] In view of factors such as abnormal posture, lighting changes, feature blur and background interference in complex underwater environments, the above embodiment constructs a fish key point detection model (FPDYOLO), which is mainly for key point detection tasks. It improves the detection of small target fish features by setting a small target detection layer, sets the initial parameters of the network, and uses the SGD optimizer to train the recognition network to generate a trained algorithm model.
[0046] The fish body size measurement method provided by an embodiment of the present invention, by setting the key point detection model to also include a small target detection layer, is used to obtain small target fish characteristics from the key point data set, and the key point detection model is set to use an SGD optimizer to optimize network parameters, thereby improving the accuracy of the key point detection model prediction results.
[0047] The fish body size measuring device provided by the present invention is described below. The fish body size measuring device described below and the fish body size measuring method described above can be referenced to each other.
[0048] Figure 5 Schematic diagram of the structure of the fish body size measuring device provided by the present invention. Figure 5 As shown, the fish body size measuring device 500 includes: a key point detection module 510 and a calculation module 520.
[0049] A key point detection module 510 is used to detect the key point data set of the target fish based on the key point detection model to obtain the key point detection result; Among them, the key point detection model includes a two-layer routing attention structure and a fast convolution module; the two-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculations on multiple key point features to obtain target features; the key point detection model is based on the target features as training features and the Focal EIoU function as the loss function. The calculation module 520 is used to fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result.
[0050] The fish body size measurement device provided by the embodiment of the present invention detects the key point data set of the target fish through a double-layer routing attention structure and a fast convolution module key point detection model to obtain a key point detection result, then fits the fish posture according to the key point detection result, and determines the fish body size data according to the fitting result, thereby improving the stability and accuracy of fish body size measurement in complex environments.
[0051] The non-destructive fish size measurement device provided by the present invention is described below. The non-destructive fish size measurement device described below and the fish body size measurement device described above can be referenced to each other.
[0052] Figure 6 Schematic diagram of the structure of the fish size non-destructive measurement device provided by the present invention. Figure 6 As shown, the fish size non-destructive measurement equipment includes: a fish size measuring device 600, a depth camera 610, a waterproof box 620 and a light source 630.
[0053] The fish body size measurement device 500 includes: a key point detection module 510 and a calculation module 520 .
[0054] Specifically, the key point detection module 510 is used to detect the key point data set of the target fish based on the key point detection model to obtain the key point detection result; wherein the key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on multiple key point features to obtain the target feature; the key point detection model is based on the target feature as the training feature and the Focal EIoU function as the loss function for training; The calculation module 520 is used to fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result.
[0055] The depth camera 610 is used to collect a key point dataset of the target fish.
[0056] In this embodiment, the depth camera 610 includes a RealSense Depth Camera, which has an operating range of 6m and a field of view of 86×57. The camera includes an RGB sensor and a tracking module. The depth camera 610 uses RGB and depth modes to simultaneously capture RGB-D images. The waterproof box 620 is used to contain the depth camera 610 to ensure that the depth camera 610 operates normally in an underwater environment.
[0057] The light source 630 is used to provide supplementary light for the depth camera 610 .
[0058] In this embodiment, the light source 630 may be a spotlight or a common lighting device.
[0059] The fish size non-destructive measurement device provided by the embodiment of the present invention collects the key point data set of the target fish by setting a depth camera, and sets a waterproof box to contain the depth camera to ensure the normal operation of the depth camera in an underwater environment, and sets a light source to fill in the depth camera to improve the collection efficiency and quality of the key point data set; then, a key point detection model including a double-layer routing attention structure and a fast convolution module is set to detect the key point data set of the target fish to obtain the key point detection result, and then the fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result, thereby improving the stability and accuracy of the fish body size measurement in a complex environment.
[0060] Figure 7 is a schematic diagram of a fish size non-destructive measurement scenario provided by the present invention. Figure 7In the illustrated embodiment, the fish size non-destructive measurement device includes a waterproof box, a depth camera, a light source, and a control processor; wherein the fish farming scene includes a farming pond and a circulating water farming device; the control processor includes a program for executing the above-mentioned fish size measurement method, and the control processor is respectively connected to the depth camera and the light source; the depth camera can collect fish swimming videos in real time under the control of the control processor, the light source is used to fill in the light for the depth camera device, and the control processor can measure the fish size according to the trained model.
[0061] Figure 8 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the fish body size measurement method, which includes: detecting the key point data set of the target fish based on the key point detection model to obtain the key point detection result; wherein the key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on multiple key point features to obtain the target feature; the key point detection model is based on the target feature as the training feature and the Focal EIoU function as the loss function for training; the fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result.
[0062] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0063] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the fish body size measurement method provided by the above methods, and the method includes: detecting the key point data set of the target fish based on the key point detection model to obtain the key point detection result; wherein the key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on multiple key point features to obtain target features; the key point detection model is based on the target feature as the training feature and the Focal EIoU function as the loss function for training; the fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result.
[0064] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the fish body size measurement method provided by the above methods, the method comprising: detecting a key point data set of a target fish based on a key point detection model to obtain a key point detection result; wherein the key point detection model comprises a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on multiple key point features to obtain target features; the key point detection model is based on the target feature as the training feature and the Focal EIoU function as the loss function for training; the fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result.
[0065] The device embodiments described above are merely illustrative, wherein the units described as separate components 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 modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0067] 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 make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for measuring fish body size, characterized in that: include: Based on the key point detection model, the key point data set of the target fish is detected to obtain the key point detection result; The key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on the multiple key point features to obtain target features; the key point detection model is trained based on the target features as training features and the Focal EIoU function as the loss function; The fish posture is fitted according to the key point detection result, and the fish body size data is determined according to the fitting result.
2. The method for measuring fish size according to claim 1, characterized in that: The key point data set is obtained by the following steps: Using a depth camera to acquire a video frame of the target fish in an underwater environment; Performing image conversion on the video frame, and annotating the converted image with object information to obtain an annotated image, wherein the annotated image includes key point annotation information and key point label information of the target fish; Data enhancement and data division are performed on the annotated image to obtain the key point data set; the data enhancement includes at least one of random brightness, random noise, random filtering and horizontal flipping of the image; the key point data set includes a training set, a test set and a validation set allocated in proportion.
3. The method for measuring fish size according to claim 1, characterized in that: The key point detection model also includes a small target detection layer, which is used to obtain small target fish features from the key point data set; The key point detection model uses the SGD optimizer to optimize network parameters.
4. The method for measuring fish size according to claim 1, characterized in that: The key point detection result includes the three-dimensional coordinate points of different parts of the fish; the fitting result includes the body length of the target fish; The step of fitting the fish posture according to the key point detection result and determining the fish body size data according to the fitting result comprises: projecting the three-dimensional coordinate points of different parts of the fish in a three-dimensional space plane to obtain the Euclidean distance between the different parts of the fish; Fitting the Euclidean distances between different parts of the fish according to a quadratic polynomial curve to obtain a posture curve of the target fish; The body length is calculated according to the posture curve.
5. The method for measuring fish size according to claim 1, characterized in that: The key point detection result includes the three-dimensional coordinate points of different parts of the fish; the fitting result includes the body width of the target fish; The step of fitting the fish posture according to the key point detection result and determining the fish body size data according to the fitting result also includes: The body width of the target fish is calculated according to the three-dimensional coordinate points and Euclidean distances of different parts of the fish.
6. A fish size measuring device, characterized in that: include: A key point detection module is used to detect the key point data set of the target fish based on the key point detection model to obtain the key point detection result; The key point detection model includes a double-layer routing attention structure and a fast convolution module; the double-layer routing attention structure is used to extract multiple key point features from the key point data set, and the fast convolution module is used to perform convolution calculation on the multiple key point features to obtain target features; the key point detection model is trained based on the target features as training features and the Focal EIoU function as the loss function; The calculation module is used to fit the fish posture according to the key point detection result, and determine the fish body size data according to the fitting result.
7. A non-destructive measurement device for fish size, characterized in that: include: The fish body size measuring device according to claim 6; A depth camera, wherein the depth camera is used to collect a key point data set of a target fish; A waterproof box, which is used to contain the depth camera to ensure that the depth camera operates normally in an underwater environment; A light source is used to provide fill light for the depth camera.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the fish body size measurement method according to any one of claims 1 to 5 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for measuring fish body size as claimed in any one of claims 1 to 5 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for measuring fish body size as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Cited By
Fish body mass non-contact estimation method based on binocular vision
CN121810695A
A non-contact fish body weight estimation method based on binocular vision
CN121810695B
