The species and population size of marine fish are important for maintaining the ecological environment and reflecting climate change. Traditional fish detection methods mainly rely on manual or traditional computer vision, which has disadvantages such as complex design, low detection accuracy, and poor generalization. The widespread use of ocean observation systems has accumulated a large number of images and videos, which makes the application of deep learning on marine fish detection possible. In this paper, a real-time high-precision fish detection algorithm based on YOLOv5s is constructed. Considering the enhancement of the channel representation and spatial interaction ability of the model, the attention mechanism and gated convolution are introduced, respectively, and GhostNet is introduced to lighten the model. Through a series of model comparisons, two improved models, S-Head-Ghost-Fish9 and S-SE-HorBlock-Head-Ghost-Fish9, are finally obtained. Compared with the original model, in terms of model size, the former reduces by 19% and the latter increases by 9.5%; in terms of computation, the former reduces by 15.7% and the latter reduces by 3.1%; in terms of detection speed, both take about 17 ms to detect a single image, and both can meet the real-time detection requirements; in terms of detection accuracy, the former improves by 3% and the latter by 3.6%. Compared with the latest detection algorithms of YOLOv6 and YOLOv8, the detection accuracy is slightly lower than 1%, but the model size and computation amount are only 1/3 to 1/2 of them. The improved models can help assess the population size and growth of the fish, which is of great significance in maintaining the stability of the fish population.
To address the issues of high hardware requirements and low measurement efficiency in the process of measuring fish movement parameters, a method based on binocular vision for measuring fish movement parameters is proposed in this study. First, fish keypoints data in videos are identified and tracked based on the open-source machine learning tool DeepLabCut by collecting, annotating, training images and video data. Linear interpolation and feedforward neural networks are introduced to the keypoints data processing to fill the missing keypoints from the video. The three-dimensional coordinates of the fish keypoints were obtained via keypoints of left and right images based on binocular stereo vision principle. Finally, movement parameters, such as the speed, acceleration, and rotational speed of the fish, were calculated using the three-dimensional coordinates of each frame. The effectiveness of this method has been verified through fish data in a laboratory environment, and the results show that it is more accurate than traditional manual measurements. This method provides a new technique for research in the fields of fish behavioral ecology ,aquaculture science and technology. It is also helpful for real-time monitoring and assessment of the health status of aquatic ecosystems.