Abstract:In aquaculture, there is an inseparable mutual mapping relationship between water quality and fish behaviors. In the past, monitoring was more biased towards one-way mapping, which generally indicated the water quality through fish behaviors. In order to solve the problem of misjudgment and lag only by fish behaviors, a bidirectional mapping model between fish behaviors and water quality was constructed based on random forest. The bidirectional mapping model can not only provide more information to improve the accuracy of prediction, but also improve the reliability of the model through mutual verification. Firstly, YOLO v7 was improved by introducing a deformable convolution module, and the position of fish in the video was detected by using the improved model, and then the swimming parameters of fish were quantified by the coordinates of the front and back frames. Then, the collected fish swimming parameters and the corresponding water quality parameters were taken as inputs, the random forest model was used for classification and regression, and the specific numerical values of fish swimming parameters and water quality parameters and the abnormal level of indicators were predicted respectively, so as to obtain a bidirectional mapping relationship. In order to show the generalization ability of the model, experiments were carried out under two data sets: Li'an Port and Xincun Port Fishing Ground. The experimental results showed that the proposed method can realize the bidirectional mapping between fish behaviors and water quality. Among them, the average accuracy of classification experiment can reach 90.947%, and the average value of regression experiment determination coefficient R2 can reach 0.801.