Petrochemical wastewater contains heavy metals and petroleum-based pollutants and is a major environmental and biological health hazard. Zebrafish are sensitive to water quality changes and can be used as biological indicators for water quality monitoring. The type, concentration, and toxicity of pollutants in the water can be inferred by observing zebrafish survival, behavior, activity, and other parameters. However, the traditional method of monitoring zebrafish toxicity-response behavior by manual observation and analysis is subjective, labor-intensive, and inefficient. Therefore, automating the monitoring and identification of zebrafish toxicity-response behavior using computer vision technology is an important and challenging research goal. The common methods of computer vision technology in zebrafish toxicity-response behavior monitoring and recognition can be divided into three steps: Foreground extraction, target tracking, and behavior analysis. However, there are problems such as sensitivity to light changes, inability to deal with occlusion and overlapping phenomena, and low efficiency. Therefore, the aim of this study was to improve efficiency and detection accuracy in complex situations such as fish shading for the automated and real-time identification of zebrafish toxicity-response behavior. In this study, four typical pollutants (zinc, chromium, lead, and phenol) in petrochemical tail water were selected to experimentally observe the swimming behavior of zebrafish at different concentrations and exposure times. A multi-target tracking technique based on YOLOv8+ Bytetrack was used to extract the characteristic values of zebrafish movements (average velocity, maximum velocity, minimum velocity, and average number of collisions). YOLOv8 is a deep learning-based end-to-end target detection algorithm that enables efficient and accurate target detection. Bytetrack is a multi-target tracking algorithm based on target detection that can achieve real-time target tracking coupled with the use of low-scoring frames in the tracking algorithm for secondary matching, which can effectively optimize the problem of switching IDs due to occlusion in the tracking process. The convolutional neural network Resnet was used to analyze the motion trajectory maps of zebrafish. The bounding box and confidence level output from the YOLOv8 model were inputted into the algorithm to obtain a unique ID and trajectory for each zebrafish. Finally, zebrafish features such as position, speed, number of wall touches, and trajectory were extracted based on the tracking results. The experimental results showed that the algorithm's tracking accuracy, missing rate, and detection time (per 300 frames) reached 90.26%, 16.33%, and 0.19 min, respectively, which represented a considerable improvement in detection time and accuracy over those of traditional target-detection methods. The tracking accuracy of manual labeling was up to 100%, and the monitoring time was 125.62 min, which was 661.16 times greater than that of the multi-target tracking method in this study. Moreover, the detection times of the threshold segmentation-based Kalman filter, SOTMOT-based multi-target tracking, and FairMOT-based multi-target tracking were 3.59, 0.41, and 0.37 min, respectively, representing 18.89-, 2.16-, and 1.95-fold increases over that of the proposed method, and the tracking accuracies were 67.09%, 88.52%, and 90.10%, which represented only 74.32%, 98.07%, and 99.82%, respectively, of the accuracy of this method. Moreover, the missing detection rates were 72.80%, 20.69%, and 26.45%, which were 4.46, 1.27, and 1.62 times greater than the missing detection rate of this method. This method outperforms other multi-target tracking methods (SOTMOT and Deepsort) regarding target-tracking accuracy and precision. Meanwhile, the proposed method can accurately identify the corresponding movement status and trajectory changes in zebrafish based on specific pollutants. An increase and then a decrease in velocity were observed in zebrafish exposed to zinc sulfate and lead acetate as compared to that of the control group. A significant difference (P < 0.05) exists between the effects of zinc sulfate and lead acetate on the increase in velocity of zebrafish at the beginning of the exposure. The velocity of zebrafish in the potassium dichromate-exposed group showed a fluctuating trend, with values slightly lower than those of the control group. In contrast, the proportion of abnormal trajectories was significantly higher (P < 0.05) than that in the other experimental groups. Under phenol exposure conditions, the velocity of zebrafish tended to fluctuate over a wide range, while the number of wall touches was significantly higher than that in the other experimental groups (P < 0.05). At the late stage of exposure, the velocity of zebrafish in zinc sulfate, lead acetate, and potassium dichromate exposure groups gradually stabilized. The velocity of zebrafish under zinc sulfate and lead acetate exposure conditions tended to decrease significantly. In the potassium dichromate group, the velocity of zebrafish under 1 and 2 TU phenol exposure increased sharply and then fluctuated within a certain range, and 4 TU phenol exposure resulted in partial mortality of zebrafish. In summary, the multi-target tracking method can quickly identify the type of pollutant to which zebrafish are exposed by setting thresholds for the speed, number of wall touches, and percentage of abnormal trajectories in zebrafish behavior. This method is simple, effective, performs accurate identification, and determines real-time responses, making it highly valuable for reference in fish toxicity-response behavior identification.