Intelligent fish identification system for fishway based on underwater binocular vision and deep learning
By integrating underwater binocular vision and deep learning into a fishway intelligent fish recognition system, the error problem of fish body recognition and measurement in existing technologies has been solved. This system achieves accurate acquisition of three-dimensional information of fish bodies and stability of fish passing count, thereby improving the automation level and real-time operation effect of fishway monitoring.
Patent Information
- Application Number
- CN202611421588.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-11-27
AI Technical Summary
In existing fish passage monitoring technologies, underwater monocular images lack depth information, making it difficult to accurately obtain the true length of the fish. Underwater binocular vision suffers from parallax matching errors and measurement biases. Furthermore, fish identification, binocular measurement, and trajectory counting are not effectively combined, leading to information loss and misjudgment.
The intelligent fish passage recognition system, which integrates underwater binocular vision and deep learning, uses binocular image acquisition, image correction, fish body recognition, 3D measurement and behavior analysis modules. It utilizes a multi-task deep learning network and attitude sensor to achieve fish body segmentation mask constraint stereo matching, obtain the fish body's 3D coordinates and behavior analysis, and output structured fish passage recognition results.
It improves the accuracy and stability of fish identification, reduces underwater weak texture and background interference, and enables the simultaneous acquisition of fish species, fish length, swimming direction and number of fish passing through, thereby reducing the monitoring burden and mismatch rate and improving the efficiency of long-term automatic monitoring of fish passages.
Smart Images

Figure CN123182003A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fishway ecological monitoring technology, and in particular to an intelligent fish passage recognition system that integrates underwater binocular vision and deep learning. Background Technology
[0002] Fish passage monitoring is an important means of evaluating the effectiveness of fish passage operations, analyzing fish migration patterns, and carrying out aquatic ecological protection. Existing monitoring methods mainly include manual observation, underwater video playback, infrared gratings, and acoustic detection. Among these, manual observation and video playback are relatively inefficient and easily affected by personnel experience, water turbidity, and fish density. While infrared gratings and acoustic detection can determine the passage of fish, they are difficult to obtain information such as fish species, fish size, and direction of movement simultaneously.
[0003] With the development of computer vision technology, underwater cameras and deep learning algorithms are increasingly being applied to fish recognition and fish counting. However, monocular images lack depth information, making it difficult to accurately obtain the true length of the fish. Although underwater binocular vision can recover the three-dimensional information of the fish, the surface texture of the fish is weak, and there is light refraction between the water, the imaging window, and the internal medium of the waterproof shell, which can easily cause parallax matching errors and measurement deviations.
[0004] Furthermore, existing fish body recognition, binocular measurement, and trajectory counting are usually processed separately. The fish body segmentation, fish species, and key point information obtained by deep learning cannot be effectively used to constrain binocular stereo matching. The same fish body in the left and right views, as well as the same fish body in consecutive image frames, are also prone to incorrect association. Summary of the Invention
[0005] The purpose of this invention is to provide an intelligent fish passage recognition system that integrates underwater binocular vision and deep learning, thereby solving the aforementioned problems existing in the prior art.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] The fish passage intelligent recognition system, which integrates underwater binocular vision and deep learning, includes a binocular image acquisition module, an image correction module, a fish body recognition module, a 3D measurement module, and a behavior analysis module.
[0008] The binocular image acquisition module is used to simultaneously acquire left and right view images of the fish passage monitoring area; the image correction module is used to perform underwater imaging correction and epipolar correction on the left and right view images according to underwater binocular calibration parameters to obtain corrected left and right view images; the fish body recognition module is used to process the corrected left and right view images using a multi-task deep learning network to obtain the target detection area, fish body segmentation mask, fish species identification result, fish head key points, and fish tail key points corresponding to each fish body instance; the three-dimensional measurement module is used to determine the epipolar position relationship of each fish body instance in the left and right view images and the fish species... Based on the recognition results and the geometric relationship of the target detection area, a correspondence is established between left-view and right-view fish instances belonging to the same fish body. Using the fish body segmentation mask constrained by the corresponding fish instances, the disparity data of the fish instances is obtained. Based on the disparity data and underwater dual-target positioning parameters, the three-dimensional coordinates of the key points at the head and tail of the fish body are determined, and the length of the fish body is calculated based on the three-dimensional coordinates. The behavior analysis module is used to track fish instances in continuous image frames, determine the direction of fish passage based on the movement trajectory of the fish instances, count the number of fish passages, and generate fish passage recognition results including fish species, fish length, direction of fish passage, and passage time.
[0009] Furthermore, the binocular image acquisition module includes two underwater cameras with fixed relative positions and an attitude sensor; the attitude sensor is used to detect the attitude change of the binocular image acquisition module relative to the fishway coordinate system, and the image correction module is used to correct the underwater binocular positioning parameters according to the attitude change.
[0010] Furthermore, the underwater dual-target calibration parameters include the internal parameters of each of the two underwater cameras, lens distortion parameters, and relative pose parameters between the two underwater cameras; the underwater imaging correction is based on the light refraction relationship between the internal medium of the waterproof shell, the imaging window, and the water body, and corrects the pixel positions in the left and right view images.
[0011] Furthermore, the multi-task deep learning network includes a feature extraction module and multiple functional output modules connected to the feature extraction module; the multiple functional output modules are used to output the target detection region, the fish body segmentation mask, the fish species identification result, the key points at the head end of the fish body and the key points at the tail end of the fish body, and associate each output result with the corresponding fish body instance.
[0012] Furthermore, the three-dimensional measurement module is used to determine the corresponding epipolar range based on the target detection area of the fish instance in the left view image, filter candidate fish instances that intersect with the epipolar range from the right view image, and determine the left view fish instance and the right view fish instance that belong to the same fish based on the consistency of fish species, the geometric relationship of the target detection area and the motion continuity between the candidate fish instance and the fish instance in the left view image.
[0013] Furthermore, the three-dimensional measurement module is used to take one of the corrected left and right view images as the first corrected image and the other as the second corrected image; determine the pixels in the first corrected image that are located within the corresponding fish body segmentation mask as the pixels to be matched, and mask the pixels outside the fish body segmentation mask; determine the candidate matching pixels of the pixels to be matched in the second corrected image according to the epipolar constraint, and use the fish body segmentation mask of the corresponding fish body instance in the second corrected image to remove the candidate matching pixels that do not belong to the corresponding fish body instance; determine the matching pixels according to the retained candidate matching pixels to obtain disparity data.
[0014] Furthermore, the three-dimensional measurement module is used to obtain the fish length measurement values of the same fish instance in multiple image frames, filter the fish length measurement values according to the stereo matching quality of each image frame, and fuse the filtered fish length measurement values to obtain the fish length.
[0015] Furthermore, the three-dimensional measurement module is also used to select the corresponding body length-weight relationship model based on the fish species identification result, determine the estimated fish weight based on the fish body length, and add the estimated fish weight to the fish identification result.
[0016] Furthermore, the behavior analysis module is used to assign individual identifiers to fish instances in consecutive image frames, and determine whether a fish instance is swimming upstream or downstream based on the movement direction of fish instances with the same individual identifier crossing a preset virtual counting line; when a fish instance completes a movement across the virtual counting line, the behavior analysis module increases the number of fish swimming in the corresponding direction by one.
[0017] Furthermore, it also includes an edge computing module; the edge computing module is connected to the binocular image acquisition module and is used to process the left and right view images in real time at the fishway site and output structured fish passage recognition results.
[0018] The beneficial effects of this invention are:
[0019] 1. By co-designing the multi-task deep learning recognition results with underwater binocular stereo matching, the fish body segmentation mask directly participates in the range constraint of the pixels to be matched and the candidate matching pixels, realizing the active elimination of interference from background pixels, floating debris, fish passage walls and adjacent fish bodies. It has the effect of improving the stability of disparity calculation for weak textured fish bodies, reducing mismatches and improving the reliability of three-dimensional measurement.
[0020] 2. By establishing cross-view correspondence between fish instances in the left and right views, and by integrating the epipolar position, fish species identification results, geometric relationship of target detection area and motion continuity, accurate pairing of the same fish under conditions of dense fish passage, fish body intersection and partial occlusion is achieved. This has the effect of avoiding incorrect association between different fish and ensuring the consistency of subsequent stereo matching and length measurement objects.
[0021] 3. Through the design of underwater imaging correction, three-dimensional calculation of key points of the fish head and tail, and screening and fusion of multi-frame length measurement values, continuous suppression of medium refraction, image distortion, changes in fish posture and fluctuations in single-frame measurement is achieved. This improves the accuracy and stability of fish length measurement and can be combined with the body length-weight relationship model corresponding to the fish species to obtain weight estimation values.
[0022] 4. By integrating continuous frame fish tracking, virtual counting line judgment and real-time edge processing, the system achieves synchronous acquisition and structured output of information such as fish swimming direction, number of fish passing, passing time, fish species and individual size. This reduces manual playback and repeated counting, lowers the burden of original video transmission and storage, and improves the efficiency of long-term automatic monitoring of fish passages.
[0023] In summary, this invention achieves effective constraints on the binocular matching process by using a collaborative design of stereo matching, three-dimensional measurement, and continuous trajectory analysis. This reduces interference from weak underwater textures, background clutter, fish occlusion, and adjacent targets on disparity calculation, improving the accuracy and stability of fish species identification, fish length measurement, swimming direction judgment, and fish counting. It also features complete monitoring information, a high degree of automation, and suitability for long-term real-time operation of fish passages. Attached Figure Description
[0024] Figure 1 This is a block diagram of the overall structure of the intelligent fish passage recognition system that integrates underwater binocular vision and deep learning according to the present invention.
[0025] Figure 2 This is a data processing flowchart of the intelligent fish passage recognition process of the present invention;
[0026] Figure 3 This is a schematic diagram illustrating the underwater binocular imaging and refraction correction principle of the present invention;
[0027] Figure 4 This is a schematic diagram of the association and segmentation mask constraint stereo matching of fish body instances in the left and right views of the present invention;
[0028] Figure 5 This is a schematic diagram of the multi-frame length measurement fusion, swimming direction determination, and fish passing count of the present invention.
[0029] The markings in the diagram are as follows: 1. Binocular image acquisition module; 11. Left underwater camera; 12. Right underwater camera; 13. Attitude sensor; 2. Image correction module; 3. Fish body recognition module; 31. Multi-task deep learning network; 4. 3D measurement module; 5. Behavior analysis module; 6. Edge computing module. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0031] The parameters listed below are illustrative examples for ease of implementation and do not constitute a limitation on the scope of protection of this invention. Those skilled in the art can make adjustments to the camera parameters, network structure, matching algorithm, threshold settings, and data output format, all without departing from the core concept of this invention.
[0032] This embodiment provides an intelligent fish passage recognition system that integrates underwater binocular vision and deep learning.
[0033] like Figure 1 As shown, the system includes a binocular image acquisition module 1, an image correction module 2, a fish recognition module 3, a 3D measurement module 4, a behavior analysis module 5, and an edge computing module 6. The binocular image acquisition module 1 is used to simultaneously acquire left and right view images of the fish passage monitoring area; the image correction module 2 is used to perform underwater imaging correction, lens distortion correction, and epipolar correction; the fish recognition module 3 is used to output the target detection area, fish segmentation mask, fish species identification result, and key points at the head and tail of each fish instance; the 3D measurement module 4 is used to perform left and right view fish instance association, segmentation mask constrained stereo matching, 3D coordinate calculation, multi-frame length measurement fusion, and fish weight estimation; the behavior analysis module 5 is used to perform multi-target tracking, fish swimming direction judgment, and fish counting; the edge computing module 6 is used to run the above image processing programs on-site in the fish passage and output structured fish recognition results.
[0034] The binocular image acquisition module 1 includes a left underwater camera 11, a right underwater camera 12, and an attitude sensor 13. The left underwater camera 11 and the right underwater camera 12 are fixed on the same mounting base and acquire images synchronously via a hardware trigger signal or a unified timestamp. The imaging areas of the two underwater cameras overlap within the fish passage monitoring area, ensuring that fish passing through the monitoring area appear simultaneously in both the left and right view images. In this embodiment, the two underwater cameras can use a resolution of 1920×1080 pixels and a frame rate of 25 frames per second. The binocular baseline B is set to 0.20–0.40 m, preferably 0.30 m; the working distance between the camera and the main activity area of the fish is set to 0.80–3.00 m. To reduce the difference between the left and right frames caused by motion, the difference in the acquisition time of the left and right images is preferably no more than 2 ms.
[0035] Attitude sensor 13 is used to detect changes in roll, pitch, and yaw angles of the binocular image acquisition module 1 relative to the fishway coordinate system. Since the left underwater camera 11 and the right underwater camera 12 are rigidly connected, the attitude changes detected by attitude sensor 13 are mainly used to correct the external transformation parameters between the binocular camera coordinate system and the fishway coordinate system. When the attitude change exceeds a preset threshold, the image correction module 2 calls the pre-calibrated parameter group corresponding to the current attitude or outputs a recalibration prompt, thereby avoiding misinterpreting the overall tilt of the binocular module as a change in the fish's swimming direction.
[0036] Before the system is put into operation, underwater dual-target calibration is performed on the left underwater camera 11 and the right underwater camera 12. The underwater dual-target calibration parameters include the internal parameters of each of the two underwater cameras, lens distortion parameters, and the relative rotation matrix between the two underwater cameras. Translation vector The intrinsic parameter matrices of the left and right cameras are represented as follows:
[0037] (1)
[0038] In equation (1), , These are the internal parameter matrices of the left and right underwater cameras, respectively. , , , These represent the equivalent focal lengths of the left and right underwater cameras in the horizontal and vertical directions of the image, respectively. , , , These represent the principal point coordinates of the corresponding images. During calibration, underwater calibration plates of known dimensions are sequentially placed at multiple distances and attitude positions within the monitoring area. Calibration images are simultaneously acquired under the same water body, imaging window, and installation conditions as during normal operation to solve for the aforementioned parameters, as well as lens distortion parameters and the relative rotation matrix. Translation vector .
[0039] like Figure 3 As shown, when the underwater camera is installed inside a waterproof housing, the imaging light rays pass sequentially through the internal medium of the waterproof housing, the imaging window, and the water. Let the refractive indices of the internal medium of the waterproof housing, the imaging window, and the water be respectively... , , Then, at the interface between adjacent media, the light rays satisfy Snell's law:
[0040] (2)
[0041] In equation (2), The refractive index of the medium inside the waterproof casing. The refractive index of the imaging window, The refractive index of the water body; The angle of incidence of light in the medium inside the waterproof casing. , These are the angles of refraction and re-incidence of the light within the imaging window, respectively. This represents the angle of refraction of light after it enters the water. Image correction module 2 traces the propagating light rays corresponding to the original pixels based on camera intrinsic parameters, imaging window thickness, interface normal vector, and the refractive index of each medium, establishing a non-linear mapping relationship between the original image pixels and the virtual camera image pixels. During actual operation, a pixel mapping table can be pre-generated, and real-time underwater imaging correction can be achieved through table lookup and interpolation.
[0042] After completing refraction correction and lens distortion correction, image correction module 2 adjusts the image according to the relative rotation matrix. Translation vector Epipolar correction is applied to the left and right images. After correction, the absolute difference in the longitudinal coordinates of the same spatial point in the left and right images satisfies:
[0043] (3)
[0044] In equation (3), , These represent the vertical pixel coordinates of the same spatial point in the left and right corrected images, respectively. This represents the allowable epipolar error. In this embodiment, Set to 1-3 pixels, preferably 2 pixels. If the longitudinal reprojection error in the calibration verification image continuously exceeds... If the error occurs, the 3D measurement will be paused and a recalibration prompt will be displayed.
[0045] To avoid misjudgment caused by sign direction, the polar error in equation (3) is defined using absolute value, i.e., according to... Make a judgment.
[0046] like Figure 2 As shown, the corrected left and right view images are input into the fish recognition module 3. The fish recognition module 3 includes a multi-task deep learning network 31, which comprises a feature extraction part and multiple parallel or cascaded functional output parts connected to the feature extraction part. These outputs are used to output the fish target detection region, fish segmentation mask, fish species identification result, fish head key points, and fish tail key points. All outputs carry fish instance identifiers to ensure that the target box, mask, fish species, and key points in the same image can correspond to the same fish instance.
[0047] In this embodiment, the first The target detection region for each fish instance is represented as follows: ,in The coordinates of the center of the target detection area are: , These represent the width and height of the target detection region, respectively; the fish body segmentation mask is represented as... When pixel Belongs to the The value is 1 for each fish body instance, otherwise 0; the key point at the head of the fish body is represented as... The key point at the tail end of the fish is represented as The key point at the head of the fish is preferably set at the snout; the key point at the tail is set at the bifurcation point of the caudal fin or at the base of the caudal fin according to the fish species measurement specifications, and a uniform definition is used for the same fish species.
[0048] The multi-task deep learning network 31 can process left and right images separately using the same set of network parameters. Training samples consist of fish images with different illumination levels, turbidity levels, fish poses, occlusion degrees, and shooting distances, labeled with target detection regions, instance contours, fish species, and key points at the head and tail. The training, validation, and test sets can be divided in an 8:1:1 ratio. During training, data augmentation can be performed using brightness variations, contrast variations, scattering simulation, color cast, motion blur, and random occlusion. The total network loss is expressed as:
[0049] (4)
[0050] In equation (4), For the total network loss, For target detection loss, For instance segmentation loss, Losses due to fish species classification Locate the loss at the key points; , , , This corresponds to the loss weight. This embodiment can be set... , , , The system is adjusted based on the validation set results. During system operation, the target detection confidence threshold can be set to 0.50, and the fish species identification confidence threshold can be set to 0.60. Instances with fish species identification confidence below the threshold can still be measured and counted, but the fish species will be marked as pending confirmation.
[0051] The 3D measurement module 4 first performs the association of fish body instances in the left and right views. For example... Figure 4 As shown, for a fish instance in the left view image, based on the vertical coverage of its target detection region and epipolar error, candidate fish instances in the right view image whose target detection region or fish segmentation mask intersects with the epipolar range are selected. Then, a correlation score is calculated by combining the epipolar positional relationship, fish species consistency, target region geometric relationship, and motion continuity.
[0052] (5)
[0053] In equation (5), For the first The left view fish instance and the first The association score between the fish body instances in the right view; For polar line position similarity, Similarity of fish species probability distributions For the similarity of the target region size and shape, To ensure motion continuity with the predicted position of the trajectory in the previous frame; , , , These are the corresponding weights, and their sum is 1. In this embodiment, they can be set to... , , , For the same fish instance in the left view, the candidate instance in the right view with the highest association score (greater than 0.65) is identified as the corresponding instance. When multiple fish exist simultaneously, a global one-to-one matching method is used to avoid a right view instance being associated repeatedly.
[0054] To make association scores comparable, , , and All are normalized to [0,1]; , , , Non-negative weights and + + + =1.
[0055] After completing instance association, the 3D measurement module 4 uses the fish body segmentation mask to constrain stereo matching. First, pixels within the corresponding fish body segmentation mask in the first calibration image are identified as the pixels to be matched, and the water background, fishway walls, floating objects, and other fish body pixels outside the mask are masked. The parallax search range is determined based on the nearest and farthest allowed distances in the monitoring area.
[0056] (6)
[0057] In equation (6), , These are the minimum and maximum parallax, respectively. To correct the lateral focal length of the virtual camera, For binocular baseline, , These are the closest and furthest distances allowed within the monitoring area, respectively. , , , For example, the parallax search range is approximately 145–544 pixels. By limiting the parallax according to the actual fishway space, invalid searches along the entire polar line can be avoided.
[0058] For the pixels to be matched in the first corrected image The set of candidate matching pixels in the second corrected image is defined as:
[0059] (7)
[0060] In equation (7), The pixels to be matched in the first corrected image; Candidate matching pixels in the second corrected image; For parallax; Allowable longitudinal deviation; Allowable polar error; For the second corrected image, the first A segmentation mask for each fish body instance is generated. The fish body segmentation mask of the first image is used to determine the pixels that need to be matched, while epipolar constraints and disparity ranges are used to limit candidate positions. The fish body segmentation mask of the second image is used to eliminate candidate pixels corresponding to the background and other fish bodies. To accommodate segmentation edge errors, the segmentation mask of the second image can be dilated by 2–5 pixels before candidate filtering.
[0061] Among them, candidate matching pixels should simultaneously satisfy the requirement that the vertical error of the epipolar line does not exceed The parallax d satisfies And satisfy the condition that the pixel value of the corresponding instance mask in the second corrected image is 1; and These are the minimum and maximum parallax, determined by the monitoring distance range, respectively.
[0062] The matching cost is calculated within the candidate set. The matching cost can be composed of gray-level differences, local structure descriptions, and differences in deep features.
[0063] (8)
[0064] In equation (8), For matching cost, For the cost of grayscale or color matching, For local structure matching cost, The cost of deep feature matching for the output of the feature extraction network; , , As a weight. For the less textured belly and translucent fins, the weight can be increased. For areas with distinct scale textures, the size can be increased. and When the candidate set is not empty, the candidate pixel with the lowest matching cost is selected as the initial corresponding pixel, and abnormal disparities are eliminated through tests of left-right consistency, matching uniqueness, neighborhood continuity, and disparity range. When the candidate set is empty or fails the tests, the pixel is marked as an invalid disparity. Pixels that fail the tests are marked as invalid disparities and are not included in the subsequent calculation of the 3D coordinates of key points.
[0065] For the disparity data that passes the validity test, the 3D measurement module 4 recovers the 3D coordinates based on the binocular triangulation relationship. Let the corrected pixel coordinates be... The corresponding parallax is The virtual camera focal length is , The main point is ,but:
[0066] (9)
[0067] In equation (9), , , These represent the horizontal, vertical, and depth coordinates in the camera coordinate system. For the head and tail keypoints located at the edge of the fish body, a neighborhood is established within the fish body segmentation mask centered on the keypoint, and the median of the effective disparity within the neighborhood is used as the keypoint disparity to reduce the impact of fish body boundary segmentation errors on the 3D coordinates.
[0068] The length of the fish in a single frame is calculated based on the 3D coordinates of the head and tail. Let the coordinates of the key points at the head of the fish be... Tail end key point coordinates ,but:
[0069] (10)
[0070] In equation (10), The length of the fish in a single frame. , These are the three-dimensional coordinates of key points at the head and tail ends of the fish body, respectively. When the key point at the tail end of the fish body is set at the bifurcation point of the caudal fin, the length obtained by equation (10) is the bifurcation length; when the key point at the tail end of the fish body is set at the base of the caudal fin, the length obtained is the standard body length. To avoid underestimating the actual length by bending the straight-line distance between the head and tail of the fish body, the three-dimensional measurement module 4 prioritizes selecting image frames where the fish body contour unfolding meets the preset conditions. The fish body unfolding can be determined based on the curvature of the segmentation mask skeleton, the aspect ratio of the target area, and the angle between the line connecting the head and tail and the main axis of the fish body.
[0071] For example, the three-dimensional coordinates of the fish's head in a certain frame are: The three-dimensional coordinates of the tail end are Therefore, according to equation (10), the length of the fish in this frame is approximately... This value is only used to illustrate the calculation process from three-dimensional coordinates to the length of the fish.
[0072] Because fish may change direction, swing their tail fins, experience partial occlusion, and reflect light during swimming, the measurement quality of the same fish instance varies across different image frames. Therefore, the 3D measurement module 4 obtains the fish length measurement values from multiple image frames based on the same trajectory identifier and calculates the measurement quality for each frame. The measurement quality of frame t can be expressed as , where each mass component has been normalized to [0,1]:
[0073] (11)
[0074] In equation (11), For the first Frame measurement quality, This is the ratio of the number of effective parallax pixels within the fish body segmentation mask to the total number of mask pixels. For stereo matching confidence, Confidence levels for the head and tail key points. The fish's body spread; , , , For the corresponding weights. In this embodiment, the weights can be set. , , , .when If the value is below 0.60, the frame length measurement is deleted; for the remaining measurements, outliers are first removed using the median absolute deviation, and then quality-weighted fusion is performed.
[0075] (12)
[0076] In equation (12), This is a set of image frames that have passed quality screening and outlier screening. This represents the final fish length. Using multi-frame fusion can reduce the impact of single-frame keypoint offset, tail fin sway, and local parallax errors on the final measurement results.
[0077] In equation (12), This is the measured length of the fish in frame t. The quality of the t-th frame is measured, Ω is the set of image frames that have passed the quality filter and outlier filter, and L is the final fish length; when Ω is an empty set, the valid fish length is not output.
[0078] The three-dimensional measurement module 4 is also used for fish weight estimation. For fish species 's', a corresponding length-weight relationship model is pre-established, which is expressed as:
[0079] (13)
[0080] In equation (13), This is an estimate of the fish's body weight. This is the final length of the fish. , Fish species The corresponding model parameters. The model parameters were calibrated through regression analysis using measured body length and weight data for the corresponding fish species, where L uses the same unit of length as the model calibration data. Use the same weight units as the model calibration data. and These are the fish species-related parameters obtained from regression calibration. To ensure model applicability, the calibration samples should cover the main body length range of the target fish species, and juvenile and adult fish should be evaluated separately. When the fish species identification confidence level is lower than the preset threshold or the fish body length exceeds the model calibration range, the system will not output a definite weight value, but will mark the weight estimation result as low confidence.
[0081] The behavior analysis module 5 performs multi-target tracking on fish instances in consecutive image frames. Each fish trajectory has a unique individual identifier, and the trajectory status includes at least the target center position, movement speed, target region size, and fish species probability. The behavior analysis module 5 predicts the fish's position in the next frame based on the motion model and completes trajectory association by combining the distance between the predicted and detected positions, the degree of overlap of target regions, fish species consistency, and appearance feature similarity. When a fish is briefly occluded, the trajectory is maintained for a preset number of lost frames; if the reappearing fish instance meets the association conditions with the predicted trajectory, the original individual identifier is used again. The preset number of lost frames can be set to 10–30 frames.
[0082] like Figure 5 As shown, a virtual counting line is set within the fishway monitoring area. The virtual counting line is represented in the image plane as follows:
[0083] (14)
[0084] In equation (14), The equation for the virtual counting line is... , , For linear parameters; , These are the values of the center of the same fish's trajectory at two adjacent moments after substituting them into the equation of the straight line; For sign functions. When and When the signs are opposite, it indicates that the center of the fish's trajectory has crossed the virtual counting line. To prevent the fish from swaying near the counting line and causing duplicate counting, counting buffers are set on both sides of the virtual counting line; the counting status of the individual is only updated to "completed" after the fish has completed crossing the line and left the buffer.
[0085] In the cross-line determination and The signed function values obtained by substituting the trajectory center coordinates of adjacent time points into g(x,y) are used respectively. When any function value is equal to zero, the continuity of the trajectory in adjacent frames and the state of the counting buffer are considered, and the counting is not directly based on a single zero value.
[0086] in, and The signed distances are obtained by substituting the coordinates of the trajectory centers at adjacent time points into the counting line equation; when either is zero, cross-line confirmation is performed based on trajectory continuity and buffer state.
[0087] Pre-determine the unit vector of the upward direction based on the spatial orientation of the fishway. Let the displacement vector of the fish's trajectory before and after crossing the line be... The direction the fish swims is determined by the following formula:
[0088] (15)
[0089] In equation (15), Let be the displacement vector of the fish's trajectory before and after crossing the line. Let be the unit vector for swimming direction determined based on the spatial orientation of the fishway. When At that time, it was determined that the fish had gone upstream; when When a fish crosses the line, it is determined to be a fish swimming downstream. After confirming that the fish has completed a valid crossing, the behavior analysis module 5 increments the fish count for the corresponding direction. If the fish turns back within the counting buffer after crossing the line, this behavior is marked as a turning back and the final fish count is not incremented again. For cases where multiple fish cross simultaneously, each trajectory has an independent individual identifier, allowing for separate direction determination and counting.
[0090] Furthermore, set The minimum displacement threshold is determined for the positive direction; when Determine to trace back, when Determine if the absolute value does not exceed [a certain threshold]. The status remains pending confirmation.
[0091] when The direction of the swim is not determined at the moment, and the trajectory is kept in a state of pending confirmation to avoid misjudgment of direction caused by slight jitter.
[0092] The edge computing module 6 is located at the fishway site and may include a central processing unit, a graphics processing unit or neural network processing unit, memory, and a communication interface. In this embodiment, an edge computing device with a neural network inference capability of no less than 8 TOPS, 16GB of RAM, and 512GB of local storage space can be used. The edge computing module 6 operates in a pipeline manner to perform tasks such as image acquisition, image correction, fish recognition, instance association, stereo matching, 3D measurement, trajectory analysis, and result output. To meet real-time requirements, the original 1920×1080 image can be cropped to the effective monitoring area of the fishway, or scaled to 1280×720 pixels for network inference, while mapping back to the corrected image coordinates during the key point and stereo matching stages.
[0093] Each structured fish passage identification result includes at least the individual fish identifier, fish species identification result and confidence level, fish length, estimated fish weight, swimming direction, passage time, and movement speed. It may further include a length measurement quality score, original image index, and abnormal status. When the association between left and right fish instances fails, the effective disparity ratio is below a threshold, or the keypoint confidence is insufficient, the system can still retain the tracking and counting results for the corresponding fish, but will mark the fish length and weight as having no valid measurement results to avoid using low-quality data.
[0094] The complete identification process in this embodiment is as follows: After the fish enters the fishway monitoring area, the left underwater camera 11 and the right underwater camera 12 simultaneously acquire images; the image correction module 2 completes underwater refraction correction, distortion correction, and epipolar correction; the fish identification module 3 outputs the target detection area, fish segmentation mask, fish species, and head and tail key points in the left and right views respectively; the three-dimensional measurement module 4 establishes the correspondence between the same fish instance in the left and right views, uses the first image mask to determine the pixels to be matched, uses epipolar constraints and disparity range to determine the candidate positions, and uses the second image mask to exclude background and other fish pixels. Then, it calculates the disparity data and the three-dimensional coordinates of the head and tail key points, obtains the fish length measurement values in multiple image frames, performs quality-weighted fusion, and estimates the fish weight according to the fish species corresponding model; the behavior analysis module 5 continuously maintains the trajectory of the fish, and when it crosses the virtual counting line, it determines the upward or downward direction and completes a count; the edge computing module 6 finally outputs the structured fish passage identification result corresponding to the individual identifier.
[0095] Through the above implementation methods, the fish segmentation mask output by the deep learning network is not only used for fish contour recognition, but also directly participates in the association of left and right fish instances and the limitation of the stereo matching search range, so that the stereo matching is concentrated in the effective pixel area of the same fish instance, reducing mismatches caused by water background, fishway structures, floating objects and adjacent fish; at the same time, combined with multi-frame quality evaluation, trajectory-level result fusion and cross-line state control, the integrated recognition of fish species, fish length, fish weight, swimming direction and number can be achieved.
[0096] Experimental verification
[0097] To verify the technical effectiveness of this embodiment, an experimental environment was constructed at a fish passage monitoring section of a vertical slotted fishway. Two underwater cameras with a resolution of 1920×1080 pixels, a frame rate of 25 frames per second, and a binocular baseline of 0.30m were used, with manual frame-by-frame interpretation as the control benchmark. The experimental samples covered various conditions, including different fish lengths, species, swimming directions, water turbidity, fish density, and local occlusion. The multi-task deep learning network was trained using a backbone network for instance segmentation and keypoint detection, which is common in this field. The test set was divided according to the principle of non-overlapping with the training dataset.
[0098] Experimental results show that on the test set, the average accuracy of fish species identification is approximately 96.5%; in image frames where the fish are fully extended, the average relative error of fish length measurement is approximately 2.1%, and the overall average relative error of all valid measurement frames is approximately 3.2%; the average accuracy of upstream and downstream fish counting is approximately 97.8%. Compared to the traditional binocular method that does not utilize the fish segmentation mask and only performs stereo matching across the entire image, the proportion of effective disparity pixels within the fish segmentation mask in this embodiment is increased by approximately 18%, and the proportion of invalid disparity caused by mismatches is reduced by approximately 22%. Under complex conditions including floating debris, dense passage of multiple fish, and partial occlusion, the fish length measurement results and fish counting results in this embodiment remain stable, indicating that constraining underwater binocular matching with fish identification results can effectively improve the reliability of 3D measurement of weakly textured fish and the accuracy of fish counting. It should be noted that the above values are the results of this embodiment under a set of exemplary test conditions, used to illustrate the technical effects of the present invention. Specific values may vary depending on the fish passage conditions, camera parameters, and sample composition, and do not constitute a limitation on the scope of protection of the present invention.
[0099] The above description is merely a preferred embodiment of the present invention and does not limit the scope of the patent. Any modifications, equivalent substitutions, and improvements made within the concept and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A fish passage intelligent recognition system integrating underwater binocular vision and deep learning, characterized in that, It includes a binocular image acquisition module, an image correction module, a fish body recognition module, a 3D measurement module, and a behavior analysis module; The binocular image acquisition module is used to simultaneously acquire left and right view images of the fish passage monitoring area; The image correction module is used to perform underwater imaging correction and epipolar correction on the left and right view images according to the underwater dual-target positioning parameters, so as to obtain the corrected left and right view images. The fish body recognition module is used to process the corrected left and right view images using a multi-task deep learning network to obtain the target detection area, fish body segmentation mask, fish species recognition result, key points at the head end of the fish body and key points at the tail end of the fish body corresponding to each fish body instance; The three-dimensional measurement module is used to establish a correspondence between left-view fish instances and right-view fish instances belonging to the same fish based on the epipolar position relationship of each fish instance in the left-view image and the right-view image, the fish species identification result, and the geometric relationship of the target detection area. The pixels within the fish body segmentation mask in the left view of the corresponding fish body instance are used as the pixels to be matched, and the fish body segmentation mask in the right view of the corresponding fish body instance is used as the range constraint for candidate matching pixels. Stereo matching is performed by combining epipolar constraints and a preset disparity range to obtain the disparity data of the fish body instance. The three-dimensional coordinates of the key points at the head end and the key points at the tail end of the fish body are determined according to the disparity data and the underwater dual-target positioning parameters. The fish body length measurement values of multiple image frames are calculated according to the three-dimensional coordinates. The fish body length measurement values that have passed the quality screening are fused to obtain the fish body length. The behavior analysis module is used to track fish instances in continuous image frames, determine the direction of fish swimming by the movement trajectory of the fish instances, count the number of fish that have passed by, and generate fish recognition results including fish species, fish length, direction of fish swimming by, and time of passing.
2. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The binocular image acquisition module includes two underwater cameras with fixed relative positions and an attitude sensor; the attitude sensor is used to detect the attitude change of the binocular image acquisition module relative to the fishway coordinate system, and the image correction module is used to correct the underwater binocular positioning parameters according to the attitude change.
3. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The underwater dual-camera positioning parameters include the internal parameters of each of the two underwater cameras, lens distortion parameters, and relative pose parameters between the two underwater cameras; the underwater imaging correction is based on the light refraction relationship between the internal medium of the waterproof shell, the imaging window, and the water body, and corrects the pixel positions in the left and right view images.
4. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The multi-task deep learning network includes a feature extraction module and multiple functional output modules connected to the feature extraction module; the multiple functional output modules are used to output the target detection region, the fish body segmentation mask, the fish species identification result, the key points at the head end of the fish body and the key points at the tail end of the fish body, and associate each output result with the corresponding fish body instance.
5. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The three-dimensional measurement module is used to determine the corresponding epipolar range based on the target detection area of the fish instance in the left view image, filter candidate fish instances that intersect with the epipolar range from the right view image, and determine the left view fish instance and the right view fish instance that belong to the same fish based on the fish species consistency, geometric relationship of the target detection area and motion continuity between the candidate fish instance and the fish instance in the left view image.
6. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The three-dimensional measurement module is used to take one of the corrected left and right view images as a first corrected image and the other as a second corrected image; determine the pixels in the first corrected image that are located within the corresponding fish body segmentation mask as the pixels to be matched, and mask the pixels outside the fish body segmentation mask; determine the candidate matching pixels of the pixels to be matched in the second corrected image according to the epipolar constraint, and use the fish body segmentation mask of the corresponding fish body instance in the second corrected image to remove the candidate matching pixels that do not belong to the corresponding fish body instance; determine the matching pixels according to the retained candidate matching pixels to obtain the disparity data.
7. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The three-dimensional measurement module is used to obtain the fish length measurement value of the same fish instance in multiple image frames, filter the fish length measurement value according to the stereo matching quality of each image frame, and fuse the filtered fish length measurement value to obtain the fish length.
8. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The three-dimensional measurement module is also used to select the corresponding body length-weight relationship model based on the fish species identification result, determine the estimated fish weight based on the fish body length, and add the estimated fish weight to the fish recognition result.
9. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, The behavior analysis module is used to assign individual identifiers to fish instances in consecutive image frames, and determine whether a fish instance is swimming upstream or downstream based on the movement direction of fish instances with the same individual identifier crossing a preset virtual counting line; when a fish instance completes a movement across the virtual counting line, the behavior analysis module increments the number of fish swimming in the corresponding direction by one.
10. The intelligent fish passage recognition system integrating underwater binocular vision and deep learning according to claim 1, characterized in that, It also includes an edge computing module; the edge computing module is connected to the binocular image acquisition module and is used to process the left and right view images in real time at the fish passage site and output structured fish passage recognition results.
