A method and system for estimating the weight of living fish based on instance segmentation

Through examples based on examples, the contours of live fish are obtained and predicted by the Cam-SOLO neural network, which solves the problem of insufficient accuracy of fish weight estimation in the existing technology, and realizes high-precision automatic fish weight estimation estimates Essence

CN114998375BActive Publication Date: 2025-01-28CHINA AGRI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210670751.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-15
Publication Date
2025-01-28
Estimated Expiration
2042-06-15

AI Technical Summary

Technical Problem

The prior art has problems with insufficient accuracy in automated live fish weight estimation, especially in the case of high fish density, severe occlusion and bending of fish body.

Method used

Using example-based dividing methods, the CAM-SOLO neural network is constructed through ResNet, PAN, SOLO neural network and attention mechanism to obtain the outline of live fish, and combined with the perimeter of the permeable fish for underwater bilateral visual fish, and then predict the fish. The weight.

Benefits of technology

It improves the accuracy of the weight estimation of living fish, solves the problem of greater circumstances caused by fish blocking and body bending, and realizes the automatic estimation of fish weights in a complex underwater environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114998375B_ABST
    Figure CN114998375B_ABST
Patent Text Reader

Abstract

The invention provides a method and system for estimating the weight of a live fish based on instance segmentation, which belongs to the technical field of image processing. The method for estimating the weight of a live fish comprises: acquiring a sample data set; constructing a CAM-SOLO neural network based on ResNet, PAN, SOLO neural networks and an attention mechanism; training the CAM-SOLO neural network according to the sample data set to obtain a segmentation network model; determining the contour of each live fish in the live fish image to be identified based on the segmentation network model; determining a target live fish and the circumference of the target live fish based on the contour of each live fish in the live fish image to be identified; determining the weight of the target live fish based on the circumference-weight prediction model according to the circumference of the target live fish, thereby improving the accuracy of estimating the weight of the live fish.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of image processing, and in particular to a method and system for estimating the weight of a living fish based on instance segmentation. Background Art

[0002] In aquaculture, regularly obtaining the weight of farmed fish is of great significance for aquaculture companies to formulate farming strategies and management plans such as fish grading management, farming density monitoring and feeding amount adjustment. Manual sampling is not only slow and costly, but also causes irreversible damage to fish. Therefore, the use of automated live fish weight estimation methods to replace manual sampling has received widespread attention.

[0003] The automated method for estimating the weight of live fish can greatly improve the efficiency of estimating the weight of fish, reduce the reliance on manual labor, reduce the risk of manual fishing, and reduce unnecessary losses. In the prior art, such as the solution of Chinese Patent Publication No. CN104931120A, an ultrasonic detector is used to detect the detection image of fish in the cage, and the detection image contains image blocks of multiple fish. The image blocks are compared with the standard image. If the length and width match, the weight of the fish in the standard image is used as the weight of the fish in the image block. Since there are a large number of fish in the cage, the occlusion is relatively serious, and the curvature of the fish body will also affect the size of the image block, the weight of the fish detected by the solution of CN104931120A is not accurate enough.

[0004] The weight of fish is closely related to its size parameters such as circumference and body length. Images often contain information about the size of fish. By segmenting the fish in the image and estimating the circumference of the fish using underwater binocular vision, the weight of the fish can be predicted. This can automatically estimate the weight of farmed fish and make up for the defects of manual sampling. However, the accuracy of estimating the circumference of fish using underwater binocular vision is limited by two factors. On the one hand, the density of farmed fish is high and occlusion is serious. On the other hand, the curvature of the fish body will also affect the accuracy of the circumference estimation. The greater the curvature of the fish body, the greater the error. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for estimating the weight of living fish based on instance segmentation, which can improve the accuracy of estimating the weight of living fish.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] A method for estimating the weight of a living fish based on instance segmentation, comprising:

[0008] Acquire a sample data set; the sample data set includes a plurality of live fish sample images and the real outline of the live fish in each live fish sample image;

[0009] Construct CAM-SOLO neural network based on ResNet, PAN, SOLO neural network and attention mechanism;

[0010] According to the sample data set, the CAM-SOLO neural network is trained to obtain a segmentation network model;

[0011] Based on the segmentation network model, according to the live fish image to be identified, determining the outline of each live fish in the live fish image to be identified;

[0012] Determining a target living fish and a circumference of the target living fish according to the outline of each living fish in the living fish image to be identified;

[0013] Based on the circumference-weight prediction model, the weight of the target living fish is determined according to the circumference of the target living fish; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of the living fish.

[0014] Optionally, the obtaining of the sample data set specifically includes:

[0015] The binocular camera is calibrated by using the Zhang Zhengyou calibration method to determine the intrinsic parameter matrix and distortion coefficient of the binocular camera;

[0016] Using the binocular camera to collect underwater binocular video of living fish;

[0017] Determining a plurality of initial sample images according to the underwater binocular video;

[0018] For each initial sample image, determining an estimated value of the body length of the sample living fish in the initial sample image according to the internal parameter matrix and the distortion coefficient of the binocular camera;

[0019] Determine the relative error of body length according to the estimated value of body length of the sample living fish and the measured value of body length of the living fish in the initial sample image; if the initial sample image contains one living fish, the measured value of body length is the real body length of the living fish; if the initial sample image contains multiple living fish, the measured value of body length is the maximum value of body lengths of multiple living fish;

[0020] According to the relative error of body length and a preset error threshold, positive samples and negative samples in a plurality of initial sample images are determined, and the outlines of living fish in the positive samples and negative samples are marked to obtain a sample data set.

[0021] Optionally, determining the estimated value of the body length of the sample living fish in the initial sample image according to the internal parameter matrix and the distortion coefficient of the binocular camera specifically includes:

[0022] According to the intrinsic parameter matrix, the initial sample image is converted into a camera coordinate system to obtain a camera coordinate system sample image;

[0023] According to the distortion coefficient, pixels in the camera coordinate system sample image are converted, and the camera coordinate system sample image is converted into a pixel coordinate system to obtain a pixel coordinate system sample image;

[0024] Calculate the distance from each pixel point in the sample image of the pixel coordinate system to the binocular camera plane;

[0025] According to the distance between each pixel point in the pixel coordinate system sample image and the binocular camera plane, the pixel coordinate system sample image is converted into the world coordinate system to obtain the world coordinate system sample image;

[0026] According to the three-dimensional coordinates of the sample living fish in the sample image of the world coordinate system, an estimated value of the body length of the sample living fish is determined.

[0027] Optionally, the following formula is used to determine the estimated value of the body length of the sample live fish:

[0028] ;

[0029] in, is the estimated value of the body length of the sampled live fish, is the three-dimensional coordinate of the mouth of the sample living fish, is the three-dimensional coordinate of the tail of the living fish sample.

[0030] Optionally, when the initial sample image includes a living fish, the following formula is used to determine the relative error of body length:

[0031] ;

[0032] When the initial sample image contains multiple live fish, the following formula is used to determine the relative error of body length:

[0033] ;

[0034] in, RL is the measured value of body length when the initial sample image contains a living fish, SL is the measured value of body length when the initial sample image contains multiple live fish, Error 1 is the relative error of body length when the initial sample image contains a live fish, Error 2 is the relative error of body length when the initial sample image contains multiple live fish, and || is the absolute value operation.

[0035] Optionally, the step of training a CAM-SOLO neural network according to the sample data set to obtain a segmentation network model specifically includes:

[0036] For any living fish sample image, extract features of the living fish sample image from bottom to top through ResNet to obtain a first feature map, a second feature map, a third feature map, and a fourth feature map;

[0037] Performing feature extraction on the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine a fifth feature map, a sixth feature map, a seventh feature map, an eighth feature map, and a ninth feature map;

[0038] For any feature map of the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, sampling the feature map to obtain a grid feature map; performing multiple convolution operations on the grid feature map to determine the category prediction results of each grid in the grid feature map;

[0039] Normalizing the coordinates of each pixel in the feature map to obtain a normalized horizontal coordinate and a normalized vertical coordinate of each pixel;

[0040] Determining a first mask prediction feature map according to the feature map and the normalized horizontal coordinates of each pixel in the feature map;

[0041] Determining a second mask prediction feature map according to the feature map and the normalized ordinate of each pixel in the feature map;

[0042] A channel attention mechanism is used to establish association relationships between pixels in the feature map to obtain an association feature map;

[0043] The first mask prediction feature map and the associated feature map are connected in series and convolved to obtain a first branch feature map;

[0044] The second mask prediction feature map is connected in series with the associated feature map, and convolved to obtain a second branch feature map;

[0045] Determine a predicted outline of a live fish in the feature map according to the first branch feature map, the second branch feature map, and the category prediction results of each grid in the grid feature map;

[0046] A loss function is determined based on the category prediction results of each grid in the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, the predicted outline of the living fish and the real outline of the living fish, and the CAM-SOLO neural network is iteratively trained according to the loss function until the loss function converges to obtain the optimal CAM-SOLO neural network, and the optimal CAM-SOLO neural network is a segmentation network model.

[0047] Optionally, the extracting features of the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map, and the ninth feature map specifically includes:

[0048] Performing a convolution operation on the first feature map to obtain a first intermediate feature map;

[0049] Performing a convolution operation on the second feature map to obtain a second intermediate feature map;

[0050] Performing a convolution operation on the third feature map to obtain a third intermediate feature map;

[0051] Performing a convolution operation on the fourth feature map to obtain a fourth intermediate feature map;

[0052] Upsampling the first intermediate feature map and concatenating the first intermediate feature map with the second intermediate feature map to obtain a first concatenated feature map;

[0053] Performing a convolution operation on the first concatenated feature map to obtain a fifth intermediate feature map;

[0054] Upsampling the first spliced ​​feature map, and splicing it with the third intermediate feature map to obtain a second spliced ​​feature map;

[0055] Performing a convolution operation on the second concatenated feature map to obtain a sixth intermediate feature map;

[0056] Upsampling the second concatenated feature map, concatenating the second concatenated feature map with the fourth intermediate feature map, and performing a convolution operation to obtain a fifth feature map;

[0057] Performing downsampling and convolution operations on the fifth feature map, and connecting it with the sixth intermediate feature map to obtain a first connected feature map;

[0058] Performing a convolution operation on the first connection feature map to obtain a sixth feature map;

[0059] Performing downsampling and convolution operations on the first connection feature map, and connecting it with the fifth intermediate feature map to obtain a second connection feature map;

[0060] Performing a convolution operation on the second connected feature map to obtain a seventh feature map;

[0061] Downsampling and convolution operations are performed on the second connected feature map, and the second connected feature map is connected with the first intermediate feature map to obtain a fifth concatenated feature map;

[0062] Performing a convolution operation on the fifth concatenated feature map to obtain an eighth feature map;

[0063] Perform a maximum pooling operation on the eighth feature map to obtain a ninth feature map.

[0064] Optionally, the outline of the living fish includes a plurality of outline points;

[0065] The step of determining the target live fish and the circumference of the target live fish according to the contours of each live fish in the live fish image to be identified specifically includes:

[0066] Determine a target live fish according to the outline of each live fish in the live fish image to be identified; the target live fish is a live fish that is not blocked and has the longest body length;

[0067] The live fish image to be identified is converted into a world coordinate system, and the three-dimensional coordinates of each contour point of the target live fish are determined;

[0068] The circumference of the target living fish is determined according to the three-dimensional coordinates of each contour point of the target living fish.

[0069] Optionally, the circumference of the target live fish is determined using the following formula:

[0070] ;

[0071] in, C f is the circumference of the target live fish, n is the total number of contour points of the target living fish, For contour points i The three-dimensional coordinates of .

[0072] To achieve the above object, the present invention also provides the following solution:

[0073] A live fish weight estimation system based on instance segmentation, comprising:

[0074] A sample data acquisition unit is used to acquire a sample data set; the sample data set includes a plurality of live fish sample images and the real outline of the live fish in each live fish sample image;

[0075] The network construction unit is used to build the CAM-SOLO neural network based on ResNet, PAN, SOLO neural networks and attention mechanisms;

[0076] A training unit, connected to the sample data acquisition unit and the network construction unit, respectively, for training the CAM-SOLO neural network according to the sample data set to obtain a segmentation network model;

[0077] A contour recognition unit connected to the training unit, and configured to determine the contour of each living fish in the living fish image to be identified based on the segmentation network model and the living fish image to be identified;

[0078] A perimeter determination unit, connected to the contour recognition unit, for determining a target living fish and the perimeter of the target living fish according to the contour of each living fish in the living fish image to be recognized;

[0079] A weight determination unit is connected to the circumference determination unit and is used to determine the weight of the target living fish according to the circumference of the target living fish based on a circumference-weight prediction model; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of a living fish.

[0080] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects: a CAM-SOLO neural network is constructed based on ResNet, PAN, SOLO neural networks and attention mechanism, the outline of the living fish is obtained through CAM-SOLO, and then the target living fish and the corresponding circumference are determined according to the outline of the living fish, and finally the corresponding weight is determined according to the circumference of the target living fish. The method of segmenting the outline and determining the target living fish solves the problem of large circumference error caused by fish occlusion and body bending, improves the accuracy of weight estimation, and makes up for the defects of manual sampling and weighing, thereby realizing automatic estimation of the weight of live fish in complex underwater environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0082] Figure 1 It is a flow chart of a method for estimating the weight of a living fish based on instance segmentation of the present invention;

[0083] Figure 2 Create a basic flow chart of the process for a sample data set;

[0084] Figure 3 It is a schematic diagram of the CAM-SOLO neural network backbone network;

[0085] Figure 4 Schematic diagram of the CAM-SOLO neural network head structure;

[0086] Figure 5 It is a schematic diagram of the module structure of the live fish weight estimation system based on instance segmentation of the present invention;

[0087] Explanation of symbols:

[0088] Sample data acquisition unit-1, network construction unit-2, training unit-3, contour recognition unit-4, perimeter determination unit-5, weight determination unit-6. DETAILED DESCRIPTION

[0089] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0090] The purpose of the present invention is to provide a method and system for estimating the weight of live fish based on instance segmentation. By adopting the method of segmenting contours and determining target live fish, the problem of large circumference error caused by fish occlusion and body bending is solved, the accuracy of weight estimation is improved, and automatic estimation of the weight of live fish in complex underwater environments is realized.

[0091] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0092] like Figure 1 As shown, the method for estimating the weight of a live fish based on instance segmentation of the present invention comprises:

[0093] S1: Obtain a sample data set; the sample data set includes a plurality of live fish sample images and the true outline of the live fish in each live fish sample image.

[0094] S2: Based on ResNet (Residual Network), improved PAN (Path Aggregation Network), SOLO (Segmenting Objects by Locations) neural network and attention mechanism, a CAM-SOLO neural network is constructed. In this embodiment, the channel attention part of DANet (Dual Attention Network) is used to construct the CAM-SOLO neural network.

[0095] S3: According to the sample data set, the CAM-SOLO neural network is trained to obtain a segmentation network model. Specifically, the CAM-SOLO neural network is trained end-to-end using the labeled sample data set to obtain a segmentation network model.

[0096] S4: Based on the segmentation network model, according to the live fish image to be identified, determine the outline of each live fish in the live fish image to be identified.

[0097] S5: Determine the target live fish and the perimeter of the target live fish according to the contours of each live fish in the live fish image to be identified. Specifically, the contour of the live fish includes a plurality of contour points.

[0098] S6: Determine the weight of the target living fish according to the circumference of the target living fish based on a circumference-weight prediction model; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of a living fish.

[0099] Furthermore, if Figure 2 As shown, step S1 specifically includes:

[0100] S101: calibrate the binocular camera using the Zhang Zhengyou calibration method to determine the internal parameter matrix and distortion coefficient of the binocular camera.

[0101] S102: Using the binocular camera to collect underwater binocular video of the living fish.

[0102] S103: Determine a plurality of initial sample images according to the underwater binocular video.

[0103] S104: For each initial sample image, determine an estimated value of the body length of the sample living fish in the initial sample image according to the internal parameter matrix and the distortion coefficient of the binocular camera.

[0104] Specifically, step S104 includes:

[0105] S1041: According to the intrinsic parameter matrix, convert the initial sample image into a camera coordinate system to obtain a camera coordinate system sample image.

[0106] S1042: Calculate pixels in the camera coordinate system sample image according to the distortion coefficient, and transform the camera coordinate system sample image into a pixel coordinate system to obtain a pixel coordinate system sample image.

[0107] S1043: Calculate the distance from each pixel point in the sample image of the pixel coordinate system to the binocular camera plane. Specifically, the formula is used: Calculate the distance from a pixel point in space to the binocular camera plane D .in, f To calibrate the focal length, T is the distance between the two cameras in the binocular camera, d is the difference.

[0108] S1044: According to the distance between each pixel point in the pixel coordinate system sample image and the binocular camera plane, the pixel coordinate system sample image is converted to the world coordinate system to obtain the world coordinate system sample image. Specifically, the following formula is used to convert the pixel coordinate system sample image to the world coordinate system:

[0109] ;

[0110] Among them, (X, Y, Z) is the three-dimensional coordinate of the sample living fish in the sample image of the world coordinate system, )and They are the pixel coordinates of the sample living fish in the images taken by the two cameras in binocular vision.

[0111] S1045: Determine the estimated value of the body length of the sample living fish according to the three-dimensional coordinates of the sample living fish in the sample image of the world coordinate system. In this embodiment, the estimated value of the body length of the sample living fish is determined by the following formula:

[0112] ;

[0113] in, is the estimated value of the body length of the sampled live fish, is the three-dimensional coordinate of the mouth of the sample living fish, is the three-dimensional coordinate of the tail of the living fish sample.

[0114] S105: Determine the relative error of body length according to the estimated value of body length of the sample live fish and the measured value of body length of the live fish in the initial sample image. If the initial sample image contains a live fish, the measured value of body length is the real body length of the live fish. If the initial sample image contains multiple live fish, the measured value of body length is the maximum value of body length of multiple live fish. Binocular vision three-dimensional measurement can obtain the three-dimensional coordinates of the target in the real world, and obtain the size parameters of the target based on the three-dimensional coordinates. When the fish body is not bent and faces the camera, its body length should reach the maximum. Therefore, the maximum value of body length is used as the pre-set standard fish body length when multiple fish are contained in the image.

[0115] Specifically, when the initial sample image contains a living fish, the following formula is used to determine the relative error of the body length:

[0116] ;

[0117] When the initial sample image contains multiple live fish, the following formula is used to determine the relative error of body length:

[0118] ;

[0119] in, RLis the measured value of body length when the initial sample image contains a living fish, SL is the measured value of body length when the initial sample image contains multiple live fish, Error 1 is the relative error of body length when the initial sample image contains a live fish, Error 2 is the relative error of body length when the initial sample image contains multiple live fish, and || is the absolute value operation.

[0120] S106: According to the relative error of body length and the preset error threshold, positive samples and negative samples in the multiple initial sample images are determined, and the contours of the living fish in the positive samples and the negative samples are labeled to obtain a sample data set. Specifically, the contours of the living fish in the positive samples and the negative samples are labeled using the Labelme toolbox.

[0121] Furthermore, the error threshold is set to t , for an image containing only one fish, if Error 1≥ t , then the live fish in the initial sample image is classified as a negative sample. Error 1< t , then the live fish in the initial sample image is classified as a positive sample. For images containing multiple fish, if the fish target is occluded, it is directly classified as a negative sample; if it is not occluded, but Error 2≥ t , then the fish target is classified as a negative sample; if it is not blocked, and Error 2< t , then the fish target is classified as a positive sample. After the initial sample image is annotated, the contour points connected in sequence are used to annotate the contours of each living fish in the image, and whether each living fish is blocked and the living fish whose relative error of body length is less than the error threshold are marked.

[0122] Furthermore, step S3 specifically includes:

[0123] S301: For any living fish sample image, extract features of the living fish sample image from bottom to top through ResNet to obtain a first feature map, a second feature map, a third feature map and a fourth feature map.

[0124] S302: Extract features from the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine a fifth feature map, a sixth feature map, a seventh feature map, an eighth feature map, and a ninth feature map.

[0125] Specifically, step S302 includes:

[0126] A convolution operation is performed on the first feature map to obtain a first intermediate feature map.

[0127] A convolution operation is performed on the second feature map to obtain a second intermediate feature map.

[0128] A convolution operation is performed on the third feature map to obtain a third intermediate feature map.

[0129] A convolution operation is performed on the fourth feature map to obtain a fourth intermediate feature map.

[0130] The first intermediate feature map is upsampled and concatenated with the second intermediate feature map to obtain a first concatenated feature map.

[0131] A convolution operation is performed on the first concatenated feature map to obtain a fifth intermediate feature map.

[0132] The first spliced ​​feature map is upsampled and spliced ​​with the third intermediate feature map to obtain a second spliced ​​feature map.

[0133] A convolution operation is performed on the second concatenated feature map to obtain a sixth intermediate feature map.

[0134] The second concatenated feature map is upsampled, concatenated with the fourth intermediate feature map, and then a convolution operation is performed to obtain a fifth feature map.

[0135] Downsampling and convolution operations are performed on the fifth feature map, and the fifth feature map is connected with the sixth intermediate feature map to obtain a first connected feature map.

[0136] A convolution operation is performed on the first connected feature map to obtain a sixth feature map.

[0137] Downsampling and convolution operations are performed on the first connection feature map, and the map is connected with the fifth intermediate feature map to obtain a second connection feature map.

[0138] A convolution operation is performed on the second connected feature map to obtain a seventh feature map.

[0139] Downsampling and convolution operations are performed on the second connected feature map, and the second connected feature map is connected with the first intermediate feature map to obtain a fifth concatenated feature map.

[0140] A convolution operation is performed on the fifth concatenated feature map to obtain an eighth feature map.

[0141] Perform a maximum pooling operation on the eighth feature map to obtain a ninth feature map.

[0142] In this embodiment, the CAM-SOLO network includes a backbone network and a header structure. Figure 3As shown, the backbone network includes ResNet and an improved PAN network. Specifically, the present invention performs downsampling and convolution operations on the fifth feature map P2 in the PAN network, connects it with the sixth intermediate feature map, and convolves it to obtain the sixth feature map N3; performs downsampling and convolution operations on the first connected feature map, connects it with the fifth intermediate feature map, and convolves it to obtain the seventh feature map N4; performs downsampling and convolution operations on the second connected feature map, connects it with the first intermediate feature map P5, and convolves it to obtain the eighth feature map N5. The head structure is used to output the category and segmentation result of the target living fish in the image. As shown Figure 4 As shown in Figure 1, the head structure includes an instance recognition module and a mask segmentation module. The head structure divides the input feature map into If the center of an object falls in a grid cell, the grid cell is responsible for predicting the category of the target and guiding the mask segmentation module to segment the target. The mask segmentation module contains two mask prediction branches and one attention branch.

[0143] The backbone network first uses ResNet to extract features from the image. This process is a bottom-up feature propagation process, and the output feature map [C2, C3, C4, C5] is obtained. The corresponding feature map size is . Among them, H is the height of the live fish sample image, W is the width of the live fish sample image, C2 is the fourth feature map, C3 is the third feature map, C4 is the second feature map, and C5 is the first feature map.

[0144] The improved PAN network includes a side fusion channel, a top-down feature propagation channel, and a bottom-up feature propagation channel. The lateral connection reduces the dimension of the image, and the top-down feature propagation channel improves the information richness of each layer's output feature map by upsampling the feature map and fusing the information with the underlying features. The output feature map corresponding to this process is [P2, P3, P4, P5], and the corresponding size is In the bottom-up propagation process of ResNet, there are dozens or hundreds of convolutional layers. After the features are transmitted through multiple layers, the shallow feature information will be lost seriously. The structure of the bottom-up feature propagation channel in the improved PAN network itself has less than 10 layers. In this way, the shallow features are horizontally connected to P2 in the original FPN and then transmitted from P2 to the top layer along the bottom-up path, which can better preserve the shallow feature information. The feature map output by this process is [P2, N3, N4, N5, N6], and the corresponding size is Among them, P2 is the fifth feature map, N3 is the sixth feature map, N4 is the seventh feature map, N5 is the eighth feature map, and N6 is the ninth feature map.

[0145] S303: For any feature map among the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, sample the feature map to obtain a grid feature map; perform multiple convolution operations on the grid feature map to determine the category prediction results of each grid in the grid feature map.

[0146] Specifically, the category recognition module first uses bilinear interpolation to sample any feature map of the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map, and the ninth feature map to The size of the convolution kernel is then 7 times convolutional. , predict the category of the grid. If the input feature map is divided into grids, the output space is ,For each grid, the category branch predicts a C-dimensional output representing the probability of the semantic category, where C represents the number of categories.

[0147] S corresponds to the mask prediction branch. The first mask prediction branch and the second mask prediction branch of the instance mask finally output the feature map of 2H*2W*S. If the instance recognition module selects the (2nd, 3rd)th grid, the first mask prediction branch selects the second feature map in 2H*2W*S, and the second mask prediction branch selects the third one. Then these two feature maps are multiplied pixel by pixel, so that the category prediction result and the corresponding mask of the (2nd, 3rd)th grid can be obtained.

[0148] S304: Normalizing the coordinates of each pixel in the feature map to obtain a normalized horizontal coordinate and a normalized vertical coordinate of each pixel.

[0149] S305: Determine a first mask prediction feature map according to the feature map and the normalized horizontal coordinates of each pixel in the feature map. Specifically, normalize the horizontal coordinates and vertical coordinates of the pixels in the feature map to the interval of [-1, 1], and divide the interval of [-1, 1] equally according to the number of horizontal coordinates and vertical coordinates.

[0150] S306: Determine a second mask prediction feature map according to the feature map and the normalized ordinate of each pixel in the feature map.

[0151] S307: Use a channel attention mechanism to establish an association relationship between pixels in the feature map to obtain an associated feature map.

[0152] S308: Connect the first mask prediction feature map and the associated feature map in series, and perform convolution to obtain a first branch feature map.

[0153] S309: Connect the second mask prediction feature map and the associated feature map in series and perform convolution to obtain a second branch feature map.

[0154] The addition of coordinate information increases the sensitivity of the network to position information. In order to better improve the network's attention to the channel, the present invention adds a channel attention branch to the head structure. Specifically, the features output by the backbone network are input into the channel attention branch, and then the results (associated feature maps) output by the channel attention branch are connected in series with the first mask prediction feature map and the second mask prediction feature map, respectively, to obtain the first branch feature map and the second branch feature map.

[0155] The mask segmentation module is divided into three branches, namely two mask prediction branches and one attention branch. Among them, the mask prediction branch contains two parts of information, one part is the feature map output by the backbone network; the other part is to achieve the purpose of spatial variability, and the normalized pixel position coordinates are added to the two mask prediction branches respectively. The first mask prediction branch adds the normalized result of the horizontal coordinate of the pixel. The second mask prediction branch adds the normalized result of the vertical coordinate of the pixel. The horizontal coordinate and the vertical coordinate of the pixel are respectively connected in series with the feature map output by the backbone network to form the mask prediction feature map of the first mask prediction branch and the second mask prediction branch, and then 7 convolution kernels are used to respectively. The convolution layer processes the feature map that incorporates the coordinate information and upsamples the output result to 2 times the size. Taking the fifth feature map P2 as an example, after the above processing, the final output feature map size is , used to concatenate with the feature map output by the channel attention branch.

[0156] S310: Determine a predicted outline of a living fish in the feature map according to the first branch feature map, the second branch feature map, and the category prediction results of each grid in the grid feature map.

[0157] Specifically, one convolution kernel is used on the first branch feature map and the second branch feature map respectively. The convolution layer fuses the features to obtain the first fused feature map and the second fused feature map, and performs The convolutional layer outputs feature maps with the same number of grids C as in the category recognition branch to predict instance masks. Among them, the feature map output by the first mask prediction branch is , the feature map output by the second mask prediction branch is ,in, is the set of real numbers.

[0158] For an instance at grid position (i, j), the mask prediction result of the instance is defined as the multiplication of the feature values ​​of the channel feature maps of the first mask prediction branch and the second mask prediction branch:

[0159] ;

[0160] ;

[0161] in, and Represents the feature map X and feature map Y corresponding to the j-th channel and the i-th channel, Indicates the multiplication of the feature points corresponding to the feature map, m k is the mask prediction result.

[0162] S311: Determine a loss function based on the category prediction results of each grid in the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, the predicted outline of the living fish and the real outline of the living fish, and iteratively train the CAM-SOLO neural network according to the loss function until the loss function converges to obtain the optimal CAM-SOLO neural network, and the optimal CAM-SOLO neural network is a segmentation network model.

[0163] In this embodiment, the feature maps output by the backbone network correspond to different head networks, that is, the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map correspond to a head network respectively, and the parameters between the head networks are shared, but the number of grids corresponding to different layers is different. Specifically, the number of grids corresponding to each layer in the present invention is [40, 36, 24, 16, 12].

[0164] Specifically, step S3 also includes: presetting the maximum number of iterations, learning rate, batch size and minimum loss threshold of training. When the number of iterations of training reaches the maximum number of iterations or the difference between the loss functions obtained from the previous and next training is less than the minimum loss threshold, stop training and determine the final segmentation network model.

[0165] In this embodiment, the loss function is:

[0166] ;

[0167] in, L cate is the Focal loss used to identify the target category. L mask is the Dice loss for mask prediction, p t is the category prediction value, is the balancing variable, is an adjustable aggregation parameter, p x,y is the predicted mask value corresponding to the pixel at coordinate (x, y), q x,yis the true mask value corresponding to the pixel at coordinate (x, y).

[0168] In step S4, the live fish image to be identified is input into the segmentation network model to obtain the category score at the grid (i, j) p i,j and the corresponding mask m k . First, set the confidence threshold to 0.1 to filter out low-confidence predictions. Then select the top 500 masks and process them using non-maximum suppression. Finally, set the threshold to 0.5 to convert the predicted soft masks to binary masks. Based on the class scores and masks of the grid, determine the outline of the live fish.

[0169] Furthermore, step S5 specifically includes:

[0170] S501: Determine a target live fish according to the outline of each live fish in the live fish image to be identified; the target live fish is a live fish that is not blocked and has the longest body length.

[0171] S502: Convert the live fish image to be identified into a world coordinate system, and determine the three-dimensional coordinates of each contour point of the target live fish. Specifically, convert the pixel coordinates corresponding to the contour into a world coordinate system, and then obtain the three-dimensional position of the contour of the target live fish.

[0172] S503: Determine the perimeter of the target living fish according to the three-dimensional coordinates of each contour point of the target living fish. In this embodiment, the perimeter of the target living fish is determined using the following formula:

[0173] ;

[0174] in, C f is the circumference of the target live fish, n is the total number of contour points of the target living fish, For contour points i The three-dimensional coordinates of .

[0175] In the process of constructing a sample data set, the present invention uses the relative error of the unobstructed body length of the living fish to determine the positive and negative samples in the image. In the process of acquiring the individual contour of the living fish, the fish instance segmentation algorithm based on CAM-SOLO is used to segment the living fish and output the contour features of the positive samples. At the same time, the contour features are combined with the underwater binocular vision to calculate the circumference of the living fish and predict its corresponding weight, which effectively solves the problem of large circumference estimation errors caused by the occlusion and body bending of the living fish, makes up for the defects of manual sampling and weighing, and realizes the automatic estimation of the weight of fish in complex underwater environments.

[0176] Table 1 shows the weight prediction results of the live fish weight estimation method based on instance segmentation combined with underwater binocular vision and fish circumference-weight prediction model on the spotted sea bream. The evaluation indicators include: R is the correlation coefficient between the predicted weight and the true weight, RMSE is the root mean square error, MAE is the mean absolute error, and MAPE is the mean absolute percentage error.

[0177] Table 1 Weight prediction results of different circumference-weight prediction models

[0178] Model R RMSE MAE MAPE (%) Linear 0.978 22.94 16.74 6.77 Power Index 0.971 27.46 18.08 6.12 Square root 0.975 24.38 16.54 5.76

[0179] like Figure 5 As shown, the live fish weight estimation system based on instance segmentation of the present invention includes: a sample data acquisition unit 1, a network construction unit 2, a training unit 3, a contour recognition unit 4, a circumference determination unit 5 and a weight determination unit 6.

[0180] The sample data acquisition unit 1 is used to acquire a sample data set; the sample data set includes a plurality of live fish sample images and the real contours of the live fish in each live fish sample image.

[0181] The network construction unit 2 is used to construct a CAM-SOLO neural network based on ResNet, PAN, SOLO neural networks and attention mechanism.

[0182] The training unit 3 is connected to the sample data acquisition unit 1 and the network construction unit 2 respectively. The training unit 3 is used to train the CAM-SOLO neural network according to the sample data set to obtain a segmentation network model.

[0183] The contour recognition unit 4 is connected to the training unit 3, and is used to determine the contour of each living fish in the living fish image to be identified based on the segmentation network model and the living fish image to be identified.

[0184] The perimeter determination unit 5 is connected to the contour recognition unit 4, and is used to determine the target living fish and the perimeter of the target living fish according to the contour of each living fish in the image of the living fish to be recognized.

[0185] The weight determination unit 6 is connected to the circumference determination unit 5, and the weight determination unit 6 is used to determine the weight of the target living fish according to the circumference of the target living fish based on a circumference-weight prediction model; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of a living fish.

[0186] Furthermore, the sample data acquisition unit 1 includes: a binocular camera, a calibration module, an initial sample image determination module, a body length estimation module, an error determination module and a labeling module.

[0187] Among them, the calibration module is connected to the binocular camera, and the calibration module is used to calibrate the binocular camera using Zhang Zhengyou calibration method to determine the internal parameter matrix and distortion coefficient of the binocular camera.

[0188] The binocular camera is used to collect underwater binocular videos of living fish.

[0189] The initial sample image determination module is connected to the binocular camera, and the initial sample image determination module is used to determine a plurality of initial sample images according to the underwater binocular video.

[0190] The body length estimation module is connected to the initial sample image determination module and the calibration module. The body length estimation module is used to determine the body length estimation value of the sample living fish in the initial sample image according to the internal parameter matrix and distortion coefficient of the binocular camera for each initial sample image.

[0191] Specifically, the body length estimation module includes: a camera coordinate conversion submodule, a pixel coordinate conversion submodule, a distance calculation submodule, a world coordinate conversion submodule, an estimation submodule,

[0192] The camera coordinate conversion submodule is connected to the initial sample image determination module, and is used to convert the initial sample image into a camera coordinate system according to the intrinsic parameter matrix to obtain a camera coordinate system sample image.

[0193] The pixel coordinate conversion submodule is connected to the camera coordinate conversion submodule, and is used to convert the pixels in the camera coordinate system sample image according to the distortion coefficient, and convert the camera coordinate system sample image to the pixel coordinate system to obtain the pixel coordinate system sample image.

[0194] The distance calculation submodule is connected to the pixel coordinate conversion submodule, and the distance calculation submodule is used to calculate the distance from each pixel point in the sample image of the pixel coordinate system to the binocular camera plane.

[0195] The world coordinate conversion submodule is connected to the distance calculation submodule, and the world coordinate conversion submodule is used to convert the pixel coordinate system sample image to the world coordinate system according to the distance from each pixel point in the pixel coordinate system sample image to the binocular camera plane to obtain the world coordinate system sample image.

[0196] The estimation submodule is connected to the world coordinate conversion submodule, and the estimation submodule is used to determine the estimated value of the body length of the sample living fish according to the three-dimensional coordinates of the sample living fish in the sample image of the world coordinate system.

[0197] The error determination module is connected to the body length estimation module, and the error determination module is used to determine the relative error of body length according to the estimated value of body length of the sample living fish and the actual measured value of body length of the living fish in the initial sample image. If the initial sample image contains one living fish, the actual measured value of body length is the real body length of the living fish. If the initial sample image contains multiple living fish, the actual measured value of body length is the maximum value of body length of multiple living fish.

[0198] The labeling module is connected to the error determination module. The labeling module is used to determine the positive samples and negative samples in multiple initial sample images according to the relative error of the body length and a preset error threshold, and to label the contours of the living fish in the positive samples and the negative samples to obtain a sample data set.

[0199] Furthermore, the training unit 3 includes: a first feature extraction module, a second feature extraction module, a category determination module, a normalization module, a first mask module, a second mask module, an attention module, a first branch module, a second branch module, a contour determination module and an iteration module.

[0200] Among them, the first feature extraction module is connected to the sample data acquisition unit 1, and the first feature extraction module is used to extract features of any living fish sample image from the bottom up through ResNet to obtain a first feature map, a second feature map, a third feature map and a fourth feature map.

[0201] The second feature extraction module is connected to the first feature extraction module, and the second feature extraction module is used to perform feature extraction on the first feature map, the second feature map, the third feature map and the fourth feature map through PAN to determine the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map.

[0202] The category determination module is connected to the second feature extraction module, and the category determination module is used to sample any feature map among the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map to obtain a grid feature map; perform multiple convolution operations on the grid feature map to determine the category prediction results of each grid in the grid feature map.

[0203] The normalization module is connected to the second feature extraction module, and is used to normalize the coordinates of each pixel in the feature map to obtain a normalized horizontal coordinate and a normalized vertical coordinate of each pixel.

[0204] The first mask module is connected to the normalization module and the second feature extraction module, and the first mask module is used to determine a first mask prediction feature map according to the feature map and the normalized horizontal coordinates of each pixel in the feature map.

[0205] The second mask module is connected to the normalization module and the second feature extraction module, and the second mask module is used to determine a second mask prediction feature map according to the feature map and the normalized ordinate of each pixel in the feature map.

[0206] The attention module is connected to the second feature extraction module, and the attention module is used to establish an association relationship between pixels in the feature map by using a channel attention mechanism to obtain an associated feature map.

[0207] The first branch module is connected to the first mask module and the attention module. The first branch module is used to connect the first mask prediction feature map and the associated feature map in series and convolve to obtain a first branch feature map.

[0208] The second branch module is connected to the second mask module and the attention module. The second branch module is used to connect the second mask prediction feature map and the associated feature map in series and convolve to obtain a second branch feature map.

[0209] The contour determination module is connected to the first branch module, the second branch module and the category determination module respectively. The contour determination module is used to determine the predicted contour of the living fish in the feature map according to the category prediction results of each grid in the first branch feature map, the second branch feature map and the grid feature map.

[0210] The iteration module is connected to the category determination module and the contour determination module. The iteration module is used to determine the loss function according to the category prediction results of each grid in the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, the predicted contour of the living fish and the real contour of the living fish, and iteratively train the CAM-SOLO neural network according to the loss function until the loss function converges to obtain the optimal CAM-SOLO neural network. The optimal CAM-SOLO neural network is the segmentation network model.

[0211] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0212] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for estimating the weight of living fish based on instance segmentation, characterized in that: The method for estimating the weight of a living fish based on instance segmentation comprises: Acquire a sample data set; the sample data set includes a plurality of live fish sample images and the real outline of the live fish in each live fish sample image; Based on the residual network ResNet, PAN, SOLO neural network and attention mechanism, the CAM-SOLO neural network is constructed; According to the sample data set, the CAM-SOLO neural network is trained to obtain a segmentation network model, which specifically includes: For any living fish sample image, extract features of the living fish sample image from bottom to top through ResNet to obtain a first feature map, a second feature map, a third feature map, and a fourth feature map; Performing feature extraction on the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine a fifth feature map, a sixth feature map, a seventh feature map, an eighth feature map, and a ninth feature map; For any feature map of the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, sampling the feature map to obtain a grid feature map; performing multiple convolution operations on the grid feature map to determine the category prediction results of each grid in the grid feature map; Normalizing the coordinates of each pixel in the feature map to obtain a normalized horizontal coordinate and a normalized vertical coordinate of each pixel; Determining a first mask prediction feature map according to the feature map and the normalized horizontal coordinates of each pixel in the feature map; Determining a second mask prediction feature map according to the feature map and the normalized ordinate of each pixel in the feature map; A channel attention mechanism is used to establish association relationships between pixels in the feature map to obtain an association feature map; The first mask prediction feature map and the associated feature map are connected in series and convolved to obtain a first branch feature map; The second mask prediction feature map is connected in series with the associated feature map, and convolved to obtain a second branch feature map; Determine a predicted outline of a live fish in the feature map according to the first branch feature map, the second branch feature map, and the category prediction results of each grid in the grid feature map; Determine a loss function according to the category prediction results of each grid in the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map, and the ninth feature map, the predicted outline of the living fish, and the real outline of the living fish, and iteratively train the CAM-SOLO neural network according to the loss function until the loss function converges to obtain an optimal CAM-SOLO neural network, and the optimal CAM-SOLO neural network is a segmentation network model; Based on the segmentation network model, according to the live fish image to be identified, determining the outline of each live fish in the live fish image to be identified; Determining a target living fish and a circumference of the target living fish according to the outline of each living fish in the living fish image to be identified; Based on the circumference-weight prediction model, the weight of the target living fish is determined according to the circumference of the target living fish; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of the living fish.

2. The method for estimating the weight of living fish based on instance segmentation according to claim 1, characterized in that: The obtaining of the sample data set specifically includes: The binocular camera is calibrated by using the Zhang Zhengyou calibration method to determine the intrinsic parameter matrix and distortion coefficient of the binocular camera; Using the binocular camera to collect underwater binocular video of living fish; Determining a plurality of initial sample images according to the underwater binocular video; For each initial sample image, determining an estimated value of the body length of the sample living fish in the initial sample image according to the internal parameter matrix and the distortion coefficient of the binocular camera; Determine the relative error of body length according to the estimated value of body length of the sample living fish and the measured value of body length of the living fish in the initial sample image; if the initial sample image contains one living fish, the measured value of body length is the real body length of the living fish; if the initial sample image contains multiple living fish, the measured value of body length is the maximum value of body lengths of multiple living fish; According to the relative error of body length and a preset error threshold, positive samples and negative samples in a plurality of initial sample images are determined, and the outlines of living fish in the positive samples and negative samples are marked to obtain a sample data set.

3. The method for estimating the weight of living fish based on instance segmentation according to claim 2, characterized in that: Determining the estimated value of the body length of the sample living fish in the initial sample image according to the internal parameter matrix and the distortion coefficient of the binocular camera specifically includes: According to the intrinsic parameter matrix, the initial sample image is converted into a camera coordinate system to obtain a camera coordinate system sample image; According to the distortion coefficient, pixels in the camera coordinate system sample image are converted, and the camera coordinate system sample image is converted into a pixel coordinate system to obtain a pixel coordinate system sample image; Calculate the distance from each pixel point in the sample image of the pixel coordinate system to the binocular camera plane; According to the distance between each pixel point in the pixel coordinate system sample image and the binocular camera plane, the pixel coordinate system sample image is converted into the world coordinate system to obtain the world coordinate system sample image; According to the three-dimensional coordinates of the sample living fish in the sample image of the world coordinate system, an estimated value of the body length of the sample living fish is determined.

4. The method for estimating the weight of living fish based on instance segmentation according to claim 3, characterized in that: Use the following formula to determine the estimated length of the live fish in the sample: Among them, ML is the estimated value of the body length of the living fish sample, (X mouth , Y mouth , Z mouth ) is the three-dimensional coordinate of the mouth of the sample living fish, (X tail , Y tail , Z tail ) is the three-dimensional coordinate of the tail of the living fish sample.

5. The method for estimating the weight of living fish based on instance segmentation according to claim 2, characterized in that: When the initial sample image contains a live fish, the following formula is used to determine the relative error of body length: When the initial sample image contains multiple live fish, the following formula is used to determine the relative error of body length: Wherein, RL is the actual measured value of the body length when the initial sample image contains one live fish, SL is the actual measured value of the body length when the initial sample image contains multiple live fish, Error1 is the relative error of the body length when the initial sample image contains one live fish, Error2 is the relative error of the body length when the initial sample image contains multiple live fish, and || is the absolute value operation.

6. The method for estimating the weight of living fish based on instance segmentation according to claim 1, characterized in that: The extracting features of the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map, and the ninth feature map specifically includes: Performing a convolution operation on the first feature map to obtain a first intermediate feature map; Performing a convolution operation on the second feature map to obtain a second intermediate feature map; Performing a convolution operation on the third feature map to obtain a third intermediate feature map; Performing a convolution operation on the fourth feature map to obtain a fourth intermediate feature map; Upsampling the first intermediate feature map and concatenating the first intermediate feature map with the second intermediate feature map to obtain a first concatenated feature map; Performing a convolution operation on the first concatenated feature map to obtain a fifth intermediate feature map; Upsampling the first spliced ​​feature map, and splicing it with the third intermediate feature map to obtain a second spliced ​​feature map; Performing a convolution operation on the second concatenated feature map to obtain a sixth intermediate feature map; Upsampling the second concatenated feature map, concatenating the second concatenated feature map with the fourth intermediate feature map, and performing a convolution operation to obtain a fifth feature map; Performing downsampling and convolution operations on the fifth feature map, and connecting it with the sixth intermediate feature map to obtain a first connected feature map; Performing a convolution operation on the first connected feature map to obtain a sixth feature map; Performing downsampling and convolution operations on the first connection feature map, and connecting it with the fifth intermediate feature map to obtain a second connection feature map; Performing a convolution operation on the second connected feature map to obtain a seventh feature map; Performing downsampling and convolution operations on the second connected feature map, and connecting it with the first intermediate feature map to obtain a fifth spliced ​​feature map; Performing a convolution operation on the fifth concatenated feature map to obtain an eighth feature map; Perform a maximum pooling operation on the eighth feature map to obtain a ninth feature map.

7. The method for estimating the weight of living fish based on instance segmentation according to claim 1, characterized in that: The outline of the living fish includes a plurality of outline points; The step of determining the target live fish and the circumference of the target live fish according to the contours of each live fish in the live fish image to be identified specifically includes: Determine a target live fish according to the outline of each live fish in the live fish image to be identified; the target live fish is a live fish that is not blocked and has the longest body length; The live fish image to be identified is converted into a world coordinate system, and the three-dimensional coordinates of each contour point of the target live fish are determined; The circumference of the target living fish is determined according to the three-dimensional coordinates of each contour point of the target living fish.

8. The method for estimating the weight of living fish based on instance segmentation according to claim 7, characterized in that: Use the following formula to determine the circumference of the target live fish: Among them, C f is the circumference of the target live fish, n is the total number of contour points of the target live fish, (X i , Y i , Z i ) is the three-dimensional coordinate of contour point i.

9. A live fish weight estimation system based on instance segmentation, characterized in that: The live fish weight estimation system based on instance segmentation includes: A sample data acquisition unit is used to acquire a sample data set; the sample data set includes a plurality of live fish sample images and the real outline of the live fish in each live fish sample image; The network construction unit is used to build the CAM-SOLO neural network based on ResNet, PAN, SOLO neural networks and attention mechanisms; A training unit, connected to the sample data acquisition unit and the network construction unit, respectively, for training the CAM-SOLO neural network according to the sample data set to obtain a segmentation network model; The training unit includes: a first feature extraction module, a second feature extraction module, a category determination module, a normalization module, a first mask module, a second mask module, an attention module, a first branch module, a second branch module, a contour determination module and an iteration module; The first feature extraction module is connected to the sample data acquisition unit, and the first feature extraction module is used to extract features of any living fish sample image from the bottom up through ResNet to obtain a first feature map, a second feature map, a third feature map, and a fourth feature map; The second feature extraction module is connected to the first feature extraction module, and the second feature extraction module is used to extract features from the first feature map, the second feature map, the third feature map, and the fourth feature map through PAN to determine a fifth feature map, a sixth feature map, a seventh feature map, an eighth feature map, and a ninth feature map; The category determination module is connected to the second feature extraction module, and the category determination module is used to sample any feature map of the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map, and the ninth feature map to obtain a grid feature map; perform multiple convolution operations on the grid feature map to determine the category prediction results of each grid in the grid feature map; The normalization module is connected to the second feature extraction module, and the normalization module is used to normalize the coordinates of each pixel in the feature map to obtain a normalized horizontal coordinate and a normalized vertical coordinate of each pixel; The first mask module is connected to the normalization module and the second feature extraction module, and the first mask module is used to determine a first mask prediction feature map according to the feature map and the normalized horizontal coordinates of each pixel in the feature map; The second mask module is connected to the normalization module and the second feature extraction module, and the second mask module is used to determine a second mask prediction feature map according to the feature map and the normalized ordinate of each pixel in the feature map; The attention module is connected to the second feature extraction module, and the attention module is used to establish an association relationship between pixels in the feature map by using a channel attention mechanism to obtain an associated feature map; The first branch module is connected to the first mask module and the attention module, and the first branch module is used to connect the first mask prediction feature map and the associated feature map in series and perform convolution to obtain a first branch feature map; The second branch module is connected to the second mask module and the attention module, and the second branch module is used to connect the second mask prediction feature map and the associated feature map in series and perform convolution to obtain a second branch feature map; The contour determination module is connected to the first branch module, the second branch module and the category determination module respectively, and the contour determination module is used to determine the predicted contour of the living fish in the feature map according to the first branch feature map, the second branch feature map and the category prediction results of each grid in the grid feature map; The iteration module is connected with the category determination module and the outline determination module, and the iteration module is used to determine the loss function according to the category prediction results of each grid in the fifth feature map, the sixth feature map, the seventh feature map, the eighth feature map and the ninth feature map, the predicted outline of the living fish and the real outline of the living fish, and iteratively train the CAM-SOLO neural network according to the loss function until the loss function converges to obtain the optimal CAM-SOLO neural network, and the optimal CAM-SOLO neural network is the segmentation network model; A contour recognition unit connected to the training unit, and configured to determine the contour of each living fish in the living fish image to be identified based on the segmentation network model and the living fish image to be identified; A perimeter determination unit, connected to the contour recognition unit, for determining a target living fish and the perimeter of the target living fish according to the contour of each living fish in the living fish image to be recognized; A weight determination unit is connected to the circumference determination unit and is used to determine the weight of the target living fish according to the circumference of the target living fish based on a circumference-weight prediction model; the circumference-weight prediction model is a pre-established relationship model between the circumference and weight of a living fish.

Citation Information

Patent Citations

  • Cage fish-farming weight detection method

    CN104931120A

  • Fish weight automatic estimation method and device, electronic equipment and storage medium

    CN113628182A