To detect the abnormal behaviour of ships in the waters of any jurisdiction and to improve the safety of maritime navigation, the meshing-based method is adopted to obtain discrete trajectory data and a probabilistic directed graph model is established to obtain historical data from ships' AIS (automatic identification systems). The state statistical characteristics of each node in the ship probability map are obtained to detect the navigation state of the ship in real time. By predicting the normal navigation trajectory of the ship, it can be judged whether the ship has the potential to behave abnormally at some moment in the future. Simulation experiments were designed based on a maritime simulator platform. The experimental results indicate that the model can correctly predict abnormal behaviour by ships, including excessive speed and deviation from the channel or normal sailing mode.