Channel congestion prediction method, model training method, device, equipment and medium

By combining linear and nonlinear prediction models and using multiple testing methods to determine initial parameters and loss functions for model training, the accuracy and stability issues of waterway congestion prediction have been resolved, achieving efficient prediction under different scenarios.

CN120875100APending Publication Date: 2025-10-31CHINA MOBILE SHANGHAI ICT CO LTD +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410536046.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing methods for predicting waterway congestion lack accuracy and stability in different scenarios and are greatly affected by factors such as season, weather, tides, and port cargo throughput, resulting in unstable prediction results.

Method used

A combined linear and nonlinear prediction model is adopted. The first model is used to explore the linear patterns of ship data, and the second model is used to explore the nonlinear patterns. Initial parameters are determined by using stationarity test, white noise test, autocorrelation test and partial autocorrelation test. The first loss function and the second loss function are constructed, and a convergent model is trained to predict the degree of ship congestion.

Benefits of technology

It improves the accuracy and stability of waterway congestion prediction, is applicable to waterway congestion prediction in different scenarios, and reduces computational costs and training cycles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120875100A_ABST
    Figure CN120875100A_ABST
Patent Text Reader

Abstract

The invention discloses a channel congestion prediction method and device, a model training method and device, equipment and a medium. The model training method comprises the following steps: constructing a first model and a second model; taking the training set as input to respectively obtain a first prediction set output by the first model and a second prediction set output by the second model; respectively constructing a first loss function and a second loss function based on the first prediction set, the second prediction set and the channel parameters of the to-be-predicted channel; and respectively training the first model and the second model by adopting the first loss function and the second loss function to obtain a convergent first model and a convergent second model. According to the method, the ship congestion degree is determined based on the prediction result of the first model and the prediction result of the second model, the prediction accuracy and stability can be effectively improved, and the method is fully suitable for channel congestion prediction in different scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of deep learning, and in particular to a method for predicting waterway congestion, a model training method, a device, equipment, and a medium. Background Technology

[0002] Predicting vessel traffic flow in waterways to assess congestion is crucial for ensuring efficient and safe vessel passage. However, the process of vessel traffic flow prediction is complex and influenced by various factors, such as season, weather, tides, and port cargo throughput. Consequently, current prediction methods produce results with fluctuating accuracy and instability, making them unsuitable for widespread application in predicting waterway congestion under various scenarios and conditions. Summary of the Invention

[0003] In view of this, this application provides a method, model training method, device, equipment and medium for predicting waterway congestion. The method uses a first model to mine the linear patterns of ship data and a second model to mine the nonlinear patterns of ship data. By determining the degree of ship congestion based on the prediction results of the first model and the prediction results of the second model, the accuracy and stability of the prediction can be effectively improved, so as to be fully applicable to waterway congestion prediction in different scenarios.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] In a first aspect, a method for predicting waterway congestion includes: obtaining first data, which includes historical data of ships at nodes to be predicted in the waterway to be predicted; performing linear prediction based on the first data using a first model to obtain first ship data; and performing nonlinear prediction based on the first data using a second model to obtain second ship data; wherein the first ship data and the second ship data represent predicted data of ships at the nodes to be predicted; the first model is obtained by training a linear prediction model based on historical data of ships at multiple nodes in the waterway to be predicted and the waterway parameters of the waterway to be predicted, and the second model is obtained by training a nonlinear prediction model based on historical data of ships at multiple nodes in the waterway to be predicted and the waterway parameters of the waterway to be predicted; determining a congestion index at the nodes to be predicted based on the first ship data and the second ship data; wherein the historical ship data includes the historical number of ships and the historical ship speed; and the predicted ship data includes the predicted number of ships and the predicted ship speed.

[0006] Secondly, this application provides a model training method, comprising: constructing a first model and a second model; the first model is a linear prediction model, and the second model is a nonlinear prediction model; the initial parameters of the first model are determined based on stationarity tests, white noise tests, autocorrelation tests, and partial autocorrelation tests on the training set, and the training set contains historical data of ships at multiple nodes in the channel to be predicted; using the training set as input, obtaining a first prediction set output by the first model and a second prediction set output by the second model; the first prediction set and the second prediction set are used to represent the predicted data of ships at multiple nodes; based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted, constructing a first loss function and a second loss function respectively; using the first loss function and the second loss function, training the first model and the second model respectively to obtain a converged first model and a converged second model; the ship data of the nodes output by the converged first model and the second model are used to predict the ship congestion level of the nodes; the historical ship data includes the historical number of ships and the historical ship speed; the predicted ship data includes the predicted number of ships and the predicted ship speed.

[0007] Thirdly, this application provides a waterway congestion prediction device, comprising: an acquisition module configured to acquire first data, the first data including historical data of ships at a node to be predicted in the waterway to be predicted; the historical data of ships including the historical number of ships and the historical speed of ships; a first prediction module configured to perform linear prediction based on the first data using a first model to obtain first ship data; a second prediction module configured to perform nonlinear prediction based on the first data using a second model to obtain second ship data; wherein the first ship data and the second ship data are used to represent predicted data of ships at the node to be predicted; the first model is obtained by training a linear prediction model based on historical data of ships at multiple nodes in the waterway to be predicted and the waterway parameters of the waterway to be predicted, and the second model is obtained by training a nonlinear prediction model based on historical data of ships at multiple nodes in the waterway to be predicted and the waterway parameters of the waterway to be predicted; and an output module configured to determine a congestion index at the node to be predicted based on the first ship data and the second ship data.

[0008] Fourthly, this application provides a model training apparatus, comprising: a first construction module configured to construct a first model and a second model; the first model is a linear prediction model, the second model is a nonlinear prediction model, and the initial parameters of the first model are determined based on stationarity tests, white noise tests, autocorrelation tests, and partial autocorrelation tests on a training set; the training set contains historical data of ships at multiple nodes in the channel to be predicted; the historical data of ships includes the historical number of ships and the historical ship speed; and an input module configured to use the training set as input to obtain a first prediction set output by the first model and a second prediction set output by the second model. Two prediction sets; the first prediction set and the second prediction set are used to represent the predicted data of ships at the plurality of nodes; the predicted data of ships includes the predicted number of ships and the predicted ship speed; a second construction module is configured to construct a first loss function and a second loss function based on the first prediction set, the second prediction set and the channel parameters of the channel to be predicted, respectively; a training module is configured to train the first model and the second model using the first loss function and the second loss function, respectively, to obtain a converged first model and a converged second model; the ship data of the nodes output by the converged first model and the second model are used to predict the ship congestion level of the nodes.

[0009] Fifthly, this application provides an electronic device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements some or all of the steps in the above-described model training method, or when it executes the computer program, it implements some or all of the steps in the above-described waterway congestion prediction method.

[0010] Sixthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above-described model training method, or implements some or all of the steps in the above-described waterway congestion prediction method.

[0011] Seventhly, this application provides a computer program including computer-readable code, which, when executed in an electronic device, allows a processor in the electronic device to perform some or all of the steps in the above-described model training method, or to perform some or all of the steps in the above-described waterway congestion prediction method.

[0012] Eighthly, this application provides a computer program product, which includes a computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described model training method, or implements some or all of the steps in the above-described waterway congestion prediction method.

[0013] In this application, a first model belonging to a linear prediction model and a second model belonging to a nonlinear prediction model are constructed. The initial parameters of the first model are determined based on ship data from multiple nodes in the channel to be predicted at historical times. Then, using the ship data from multiple nodes at historical times as input, a first prediction set output by the first model and a second prediction set output by the second model are obtained. A first loss function and a second loss function are constructed based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted, respectively. The first model is trained using the first loss function, and the second model is trained using the second loss function. In other words, both the model construction process and the model training process fully consider ship data and channel parameters. Thus, combining the prediction results of two different types of prediction models to determine the degree of ship congestion can effectively improve the accuracy and stability of the prediction, making it fully applicable to channel congestion prediction in different scenarios.

[0014] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure. Attached Figure Description

[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.

[0016] Figure 1A This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0017] Figure 1B This is a schematic diagram of a channel congestion prediction device provided in an embodiment of this application;

[0018] Figure 1C This is a schematic diagram of a model training device provided in an embodiment of this application;

[0019] Figure 2 This is a schematic diagram of the first implementation process of the model training method provided in this application embodiment;

[0020] Figure 3 This is a schematic diagram of the second implementation process of the model training method provided in this application embodiment;

[0021] Figure 4 This is a schematic diagram illustrating the parameter search process during the training of the second model provided in this application embodiment;

[0022] Figure 5 This is a schematic diagram of the third implementation process of the model training method provided in the embodiments of this application;

[0023] Figure 6This is a schematic diagram of the architecture of the third model provided in the embodiments of this application;

[0024] Figure 7 This is a schematic flowchart of the stationarity test and white noise test provided in the embodiments of this application;

[0025] Figure 8 This is a schematic diagram of the architecture of the LSTM model provided in the embodiments of this application.

[0026] Figure 9 This is a flowchart illustrating the waterway congestion prediction method provided in the embodiments of this application. Detailed Implementation

[0027] The embodiments of this application are described below with reference to the accompanying drawings. In the following description, reference is made to the accompanying drawings, which form part of this application and illustrate specific aspects of the embodiments of this application or to which specific aspects of the embodiments of this application may be used. It should be understood that the embodiments of this application may be used in other aspects and may include structural or logical variations not depicted in the drawings. Therefore, the following detailed description should not be construed in a limiting sense, and the scope of this application is defined by the appended claims. For example, it should be understood that the disclosure of the described methods is equally applicable to corresponding devices or systems for performing the methods, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units, such as functional units, to perform the described one or more method steps (e.g., one unit performs one or more steps, or multiple units, each performing one or more of multiple steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific apparatus is described based on one or more units such as functional units, the corresponding method may include a step to perform the functionality of one or more units (e.g., a step to perform the functionality of one or more units, or multiple steps, each of which performs the functionality of one or more units among a plurality of units), even if such one or more steps are not explicitly described or illustrated in the accompanying drawings. Furthermore, it should be understood that, unless otherwise expressly stated, features of the various exemplary embodiments and / or aspects described herein can be combined with each other.

[0028] In the field of traffic flow prediction, there are numerous prediction models. Linear system models, such as the Kalman filter method and historical average models, have the advantages of intuitive trend analysis and strong interpretability, but their disadvantages include simple structure, relatively large errors, and certain limitations. Neural network models, on the other hand, possess strong nonlinear mapping and adaptive learning capabilities. The nonlinearity, periodicity, and randomness of traffic data determine the advantages of deep learning in traffic flow prediction. In the context of waterways, ship traffic flow is based on time-series data and is easily affected by factors such as weather, tides, seasons, and port cargo throughput. Individual linear or nonlinear prediction models are insufficient to accurately represent the spatial characteristics of the data. Furthermore, combining multiple types of models to predict ship traffic flow presents challenges. How to select appropriate models to ensure accurate and stable prediction results while maintaining a simple network structure, and how to train multiple types of models to save computational costs, are all problems that urgently need to be solved.

[0029] In view of this, embodiments of this application provide a model training method, a waterway congestion prediction method, a device, a storage medium, and a computer program product, which can effectively improve the accuracy and stability of prediction, so as to be fully applicable to waterway congestion prediction in different scenarios.

[0030] In some embodiments, the methods of this application can be applied to multiple scenarios in the port and shipping industry, such as designing smart maritime affairs, intelligent ships, and shipping logistics, to ensure the safety of ship navigation, avoid water traffic accidents, and have many applicable scenarios and strong replicability.

[0031] The following describes exemplary applications of the electronic devices provided in the embodiments of this application. The electronic devices provided in the embodiments of this application can be rechargeable devices such as laptops, tablets, desktop computers, mobile devices (e.g., mobile phones, wearable smartwatches, dedicated messaging devices), electric vehicles, and electric bicycles, but are not limited to these. Alternatively, the electronic device can also be implemented as a server.

[0032] In some embodiments, the server may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms, but is not limited thereto. In some embodiments, the server and electronic devices may be directly or indirectly connected through wired or wireless communication methods, and this application embodiment does not impose specific limitations on this.

[0033] See Figure 1A , Figure 1A This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 1AThe illustrated electronic device 100 includes at least one processor 110, a memory 150, at least one network interface 120, and a user interface 130. The various components of the electronic device 100 are coupled together via a bus system 140. It is understood that the bus system 140 is used to implement communication between these components. In addition to a data bus, the bus system 140 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 1A All buses are labeled as Bus System 140.

[0034] The processor 110 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0035] User interface 130 includes one or more output devices 131 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 130 also includes one or more input devices 132, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0036] The memory 150 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 150 may optionally include one or more storage devices physically located away from the processor 110.

[0037] The memory 150 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 150 described in this application embodiment is intended to include any suitable type of memory.

[0038] In some embodiments, memory 150 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0039] Operating system 151 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, for implementing various basic business functions and handling hardware-based tasks.

[0040] The network communication module 152 is used to reach other computing devices via one or more (wired or wireless) network interfaces 120, exemplary network interfaces 120 including Bluetooth, WiFi, and Universal Serial Bus (USB).

[0041] Presentation module 153 enables the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 131 associated with user interface 130 (e.g., a display screen, a speaker, etc.).

[0042] The input processing module 154 is used to detect and translate one or more user inputs or interactions from one or more input devices 132.

[0043] In some embodiments, the model training method and waterway congestion prediction method provided in this application can be implemented in software and stored in memory 150. See also Figure 1B and Figure 1C , Figure 1B This is a schematic diagram of a channel congestion prediction device provided in an embodiment of this application. Figure 1C This is a schematic diagram of a model training device provided in an embodiment of this application, which can be software in the form of programs and plug-ins.

[0044] The waterway congestion prediction device 155 includes the following software modules: an acquisition module 1551, a first prediction module 1552, a second prediction module 1553, and an output module 1554. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their functions. The functions of each module will be described below.

[0045] The model training device 156 includes the following software modules: a first construction module 1561, an input module 1562, a second construction module 1563, and a training module 1564. These modules are logically connected and can therefore be arbitrarily combined or further divided according to their functions. The functions of each module will be described below.

[0046] In other embodiments, the channel congestion prediction device 155 and model training device 156 provided in this application can be implemented in hardware. For example, the channel congestion prediction device 155 and model training device 156 provided in this application can be processors in the form of hardware decoding processors, which are programmed to execute the model training method or channel congestion prediction method provided in this application. For instance, the processor in the form of a hardware decoding processor can employ one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0047] In some embodiments, the waterway congestion prediction device 155 and the model training device 156 can be combined into a single processing device. In this case, the processing device may also include at least one of the following interfaces: a data acquisition interface, a model building interface, a prediction display interface, and an alarm interface. In this way, a complete embedded processing module can be provided, which has high portability.

[0048] The model training method and waterway congestion prediction method provided in this application will be described below with reference to exemplary applications and implementations of the electronic devices provided in the embodiments of this application.

[0049] Figure 2 This is a schematic diagram illustrating an implementation flow of the model training method provided in this application. For example... Figure 2 As shown, the model training method in this application embodiment may include steps S210 to S240.

[0050] In step S210, the first model and the second model are constructed.

[0051] In some embodiments, the first model is a linear prediction model, and the second model is a nonlinear prediction model. Linear prediction models include: autoregressive models (AR models), moving average models (MA models), autoregressive moving average models (ARMA models), auto-regressive with extra inputs (ARX) models, autoregressive integrated moving average models (ARIMA models), output error models, Box-Jenkins (BJ) models, etc. Nonlinear prediction models include: long short-term memory (LSTM) models, recurrent neural network (RNN) models, back propagation (BP) neural network models, etc.

[0052] Understandably, linear forecasting models perform well in short-term forecasting because they can leverage historical data over a short period to fully exploit its abrupt changes, thus achieving good predictive results for future short-term data. Nonlinear forecasting models, on the other hand, have a significant advantage in long-term forecasting because they can leverage historical data over a long period to fully explore its changing trends, thus achieving good predictive results for future long-term data.

[0053] In some embodiments, the initial parameters of the first model are determined based on a training set, which contains ship data at historical times for multiple nodes in the channel to be predicted, i.e., historical ship data. The historical ship data includes the historical number of ships and their historical speeds. Multiple nodes in the channel to be predicted can be understood as multiple areas to be predicted within the channel, or multiple locations within the channel to be predicted. In other words, this application can obtain the number of ships and their speeds at historical times for multiple areas or locations within the channel to be predicted, thereby establishing a training set and achieving refined predictions for different locations or areas within the channel to be predicted.

[0054] In some embodiments, the initial parameters of the first model are determined based on stationarity tests, white noise tests, autocorrelation tests, and partial autocorrelation tests performed on the training set.

[0055] The stationarity test determines whether time series data possesses statistically stationary properties. A stationary series is one whose mean, variance, and autocovariance do not change over time. It is understood that stationary series typically exhibit stable statistical properties; therefore, changes in stationary series data are predictable, and models can be built based on stationary series to predict future data.

[0056] The white noise test can determine whether time series data is a purely random sequence. A purely random sequence is one in which there is no correlation between any two distinct data points. In other words, if time series data is purely random, it means that historical data in the sequence has no impact on the development of future data, and no valuable patterns can be extracted from the sequence; that is, it is impossible to build a model based on a purely random sequence.

[0057] Autocorrelation testing typically involves plotting the autocorrelation function on time series data. The autocorrelation function graph can demonstrate the correlation between data at any given time point in the time series and data at historical times corresponding to different lag orders.

[0058] Partial autocorrelation tests typically involve plotting a partial autocorrelation function (PIF) on time series data. This PIF plot demonstrates the correlation between data at any given time point and historical data at a specific lag order.

[0059] Understandably, the number of ships and their speeds at historical moments in the training set are based on time-series data, or i.e., time series data. Performing stationarity and white noise tests on the time-series data of ship numbers and speeds can determine whether these data are predictable. Performing autocorrelation and partial autocorrelation tests on the time-series data of ship numbers and speeds can determine the correlation between data points at different times. Both predictability and the correlation between data points at different times can be reflected by multiple parameters, which constitute the initial parameters of the first model. Therefore, the initial parameters of the first model can be determined based on the results of the stationarity test, white noise test, autocorrelation test, and partial autocorrelation test.

[0060] In some embodiments, the number of ships and their speeds can be obtained by statistically analyzing and calculating GPS ship positioning data to determine the number of ships and their speeds at different historical moments for each node, thereby obtaining a training set. For example, the training set might be {S}. i,1 S i,2 , ...,S i,j}, where S i,jThis represents the ship data of node i at time j. In some embodiments, the number of ship data in the training set can be determined based on the ship data of M nodes at k historical times before the current time t, i.e., i = 1, 2, ..., M, j = tk, ..., t-2, t-1.

[0061] In some embodiments, the value of parameter k can be determined based on the model training process, thereby enabling the first and second models to be trained based on a small amount of historical ship data, resulting in accurate and stable prediction results from the trained first and second models.

[0062] In some embodiments, this application can also construct a validation set, which includes ship data from multiple nodes in the channel to be predicted at different historical times. The training set is used to train the model, and the validation set is used to validate the trained model. Therefore, the ship data in the validation set differs from the ship data in the training set. For example, ship data from five nodes in the channel to be predicted over the past five days can be obtained; the ship data from the first three days of these five nodes can be used as the training set, and the ship data from the last two days of these five nodes can be used as the validation set. The methods for obtaining the training and validation sets are the same and will not be elaborated upon here.

[0063] In step S220, the training set is used as input to obtain the first prediction set output by the first model and the second prediction set output by the second model.

[0064] In some embodiments, a training set is input into a first model to obtain a first prediction set. The training set is then input into a second model to obtain a second prediction set. The first and second prediction sets are used to represent the predicted number of ships and the predicted ship speeds at multiple nodes to be predicted.

[0065] For example, the ship data of the first node in the training set at time t-5 can be input into the first model to obtain the ship data of the first node at time t-4 predicted by the first model. Then, the ship data of the first node in the training set at time t-4 can be input into the first model to obtain the ship data of the first node at time t-3 predicted by the first model, and so on. Ship data of other nodes in the training set at other times can be input into the first model to finally obtain the first prediction set. The method for obtaining the second prediction set is similar and will not be elaborated here.

[0066] For example, the ship data of the first node in the training set from time t-7 to t-5 can be input into the first model to obtain the ship data of the first node at time t-4 predicted by the first model. Then, the ship data of the first node in the training set from time t-6 to t-4 can be input into the first model to obtain the ship data of the first node at time t-3 predicted by the first model. And so on, the ship data of other nodes in the training set at other times can be input into the first model to finally obtain the first prediction set.

[0067] In step S230, a first loss function and a second loss function are constructed based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted.

[0068] In some embodiments, the first prediction set is the ship prediction data output by the first model. Based on the prediction data of the first model and the channel parameters of the channel to be predicted, a first loss function of the first model can be established. Similarly, the second prediction set is the ship prediction data output by the second model. Based on the prediction data output by the second model and the channel parameters of the channel to be predicted, a second loss function of the second model can be established.

[0069] In some embodiments, a real dataset can be determined from the training set. This real dataset corresponds to a first prediction set and a second prediction set. The ship data in the real dataset is the actual ship data at a certain time, while the ship data in the first and second prediction sets are the predicted ship data at a certain time. Then, a first loss function is constructed based on the error between the real dataset and the first prediction set, as well as the channel parameters. A second loss function is constructed based on the error between the real dataset and the second prediction set, as well as the channel parameters.

[0070] For example, ship data from time t-6 to t-2 in the training set are input into the first and second models for prediction, resulting in a first prediction set and a second prediction set. These two sets include the predicted ship data from time t-5 to t-1. The real dataset is then determined from the training set, containing the actual ship data from time t-5 to t-1. Based on the error between the real and predicted ship data, and the channel parameters, a first loss function and a second loss function can be constructed.

[0071] In some embodiments, the first loss function and the second loss function may be constructed based on at least one of the following: mean-square error (MSE), mean absolute error (MAE), mean absolute percentage error (MAPE), mean deviation error (MDE), and updated mean absolute percentage error (UMAPE).

[0072] In step S240, the first loss function and the second loss function are used to train the first model and the second model respectively, so as to obtain the converged first model and the second model.

[0073] In some embodiments, a first model is trained using a first loss function, and a second model is trained using a second loss function, until both the first and second models converge, thus meeting the convergence condition. The smaller the loss values ​​of the first and second loss functions, the higher the prediction accuracy of the first and second models.

[0074] In some embodiments, the convergence conditions of the first model and the second model may be the same or different. In some embodiments, the convergence condition may be that the number of training iterations of the model reaches a preset threshold, the convergence condition may also be that the loss value of the loss function is less than a preset loss threshold, or the convergence condition may also be that the loss value of the loss function remains less than the preset loss threshold for a preset time period.

[0075] In some embodiments, the ship data from multiple nodes output by the converged first model and the converged second model are used to predict ship congestion at multiple nodes. This can be understood as the ship congestion level at multiple nodes being predicted based on the first ship data output by the converged first model and the second ship data output by the converged second model.

[0076] In other words, the first model, from construction to training, is based on ship data and waterway parameters at every stage. It considers different application scenarios and waterway conditions, fully exploring the linear patterns and short-term abrupt changes in ship data, effectively improving the model's prediction accuracy. Furthermore, since the initial parameters of the first model are determined based on stationarity tests, white noise tests, autocorrelation tests, and partial autocorrelation tests on the training set, only a small amount of training with the training set and the first loss function is needed to make the first model meet the requirements for waterway congestion prediction, effectively shortening the training cycle and reducing parameter tuning costs. The training of the second model is based on the training set and the second loss function. Both the first and second loss functions include waterway parameters (such as waterway depth, waterway grade, and waterway width), which can reflect different waterway conditions. Therefore, the first and second models trained in this application can adapt to different waterways in different application scenarios and explore the nonlinear patterns and long-term trends of ship data, effectively improving the stability of model predictions.

[0077] Based on this, combining the ship data predicted by the first and second models to predict the degree of ship congestion can make the prediction results both highly accurate and stable, and can also be fully applied to different scenarios and different waterway conditions.

[0078] In some embodiments, the ship data includes the number of ships and the ship speed. Both the first loss function and the second loss function include a first loss term associated with the number of ships and a second loss term associated with the ship speed.

[0079] In this embodiment of the disclosure, the training set includes the ship speeds and number of ships at multiple nodes in the channel to be predicted at historical times, i.e., the training set S. i,j =[N i,j V i,j ], N i,j V represents the number of ships. i,j This represents ship speed. The first prediction set includes the ship speeds and numbers at multiple nodes after historical time points, as predicted by the first model; that is, the first prediction set. This represents the number of ships predicted by the first model. This represents the ship speed predicted by the first model. The second prediction set includes the ship speeds and numbers of ships at multiple nodes after historical time points, as predicted by the second model. This represents the number of ships predicted by the second model. This represents the ship speed predicted by the second model.

[0080] In some embodiments, both the first and second loss functions include a first loss term associated with the number of ships and a second loss term associated with ship speed. That is, the first loss function calculates the error between the actual number of ships and the number predicted by the first model, as well as the error between the actual ship speed and the ship speed predicted by the first model. The second loss function calculates the error between the actual number of ships and the number predicted by the second model, as well as the error between the actual ship speed and the ship speed predicted by the second model. In this way, the two models can make accurate and stable predictions of ship speed and number of ships, taking into account various factors of channel congestion, making channel congestion predictions more consistent with reality.

[0081] In some embodiments, the first loss function and the second loss function further include: a fourth parameter associated with the number of ships and a fifth parameter associated with the ship speed; the fourth parameter is used to adjust the weight of the first loss term in the first loss function or the second loss function; the fifth parameter is used to adjust the weight of the second loss term in the first loss function or the second loss function; the fourth parameter and the fifth parameter are determined based on the waterway parameters.

[0082] In some embodiments, such as Figure 3 As shown, step S230 includes steps S231 to S233.

[0083] In step S210, the first model and the second model are constructed.

[0084] For optional implementations of step S210, please refer to [link / reference]. Figure 2 The related parts in the embodiments involved will not be described again here.

[0085] In step S220, the training set is used as input to obtain the first prediction set output by the first model and the second prediction set output by the second model.

[0086] Optional implementations of step S220 can be found in [reference]. Figure 2 The related parts in the embodiments involved will not be described again here.

[0087] In step S231, the fourth parameter and the fifth parameter are determined based on the mapping relationship between the channel parameters, the fourth parameter, and the fifth parameter.

[0088] In some embodiments, the mapping relationship between the channel parameter, the fourth parameter, and the fifth parameter can be determined based on historical experience to identify different channel parameters and the corresponding values ​​of the fourth and fifth parameters for different channel parameter values. Channel parameters may include at least one of the following: channel width, channel depth, and channel grade. Taking channel width as an example, the values ​​of the fourth and fifth parameters are determined based on the mapping relationship between channel width and the fourth and fifth parameters. For example, the mapping relationship between channel width and the fourth and fifth parameters can be seen in Table 1 below, where α represents the fourth parameter and β represents the fifth parameter.

[0089] Table 1

[0090]

[0091] In some embodiments, the mapping relationship between the channel width and the fourth and fifth parameters can also be represented by a mapping function, a mapping image, or the like.

[0092] In step S232, a first loss term in the first loss function is constructed based on the number of ships in the first prediction set and the fourth parameter; a second loss term in the first loss function is constructed based on the ship speed in the first prediction set and the fifth parameter.

[0093] In some embodiments, the first loss function, taking UMAPE as an example, is calculated as follows:

[0094]

[0095] Where M is the number of nodes, N i,j and V i,j Let be the number of ships (i.e., the actual number of ships) and the ship speed (i.e., the actual ship speed) at time j for each node i, respectively. and Let represent the number of ships at time j predicted by the first model (i.e., the predicted number of ships) and the ship speed (i.e., the predicted number of ships). In the above formula, the term before the plus sign is the first loss term, and the term after the plus sign is the second loss term.

[0096] In some embodiments, the first loss function is taken as MAE, and its calculation formula is as follows:

[0097]

[0098] In step S233, based on the number of ships in the second prediction set and the fourth parameter, a first loss term in the second loss function is constructed; based on the ship speed in the second prediction set and the fifth parameter, a second loss term in the second loss function is constructed.

[0099] In some embodiments, the second loss function, taking UMAPE as an example, is calculated as follows:

[0100]

[0101] in, and Let be the number of ships at node i at time j predicted by the second model. In the above formula, the term before the plus sign is the first loss term, and the term after the plus sign is the second loss term.

[0102] In some embodiments, the first loss function is taken as MAE, and its calculation formula is as follows:

[0103]

[0104] In step S240, the first loss function and the second loss function are used to train the first model and the second model respectively, so as to obtain the converged first model and the second model.

[0105] In some embodiments, the training of the first and second models can employ batch gradient descent or stochastic gradient descent. During the training of the second model, the number of network layers (e.g., the number of memory modules contained in the hidden layers of an LSTM model), the gradient descent rate, and the Dropout rate can be determined using methods such as... Figure 4 The search method shown is used for search training. Figure 4 The largest cube represents the predefined search space, and the side lengths of the smaller cubes in each direction of the largest cube represent the search step size in that direction. For example, the number of hidden layers in an LSTM model is searched along the direction corresponding to the length of the cube, with a search step size of {2,3,4,5,6}. The gradient descent rate can be searched along the direction corresponding to the width of the cube, with a search step size of {0.001,0.005,0.01,0.05,0.1}. The Dropout ratio can be searched along the direction corresponding to the height of the cube, with a search step size of {0.3,0.4,0.5,0.6}.

[0106] In some embodiments, such as Figure 5 As shown, the model training method also includes steps S250 to S270.

[0107] In step S250, a third model is constructed that includes the first model and the second model.

[0108] In step S260, the first weight and the second weight are determined based on the first loss function and the second loss function.

[0109] In step S270, the output of the third model is determined based on the output of the first model, the output of the second model, the first weight, and the second weight.

[0110] In some embodiments, the first loss function represents the average prediction error of the first model with respect to multiple nodes at any historical time; the second loss function represents the average prediction error of the second model with respect to multiple nodes at any historical time. Step S260 includes: obtaining multiple first loss values ​​and multiple second loss values ​​based on multiple first loss functions and multiple second loss functions; calculating the average of the multiple first loss values ​​to obtain a first average loss value; calculating the average of the multiple second loss values ​​to obtain a second average loss value; and determining a first weight and a second weight based on the first average loss value and the second average loss value.

[0111] In this embodiment of the disclosure, the architecture diagram of the third model is as follows: Figure 6 As shown, the output of the third model 330 Based on the output of the first model 310 The output of the second model 320 Yes, that's correct. Specifically, the output calculation method for the third model is as follows:

[0112]

[0113] Where ω1 represents the first weight and ω2 represents the second weight.

[0114] The first and second weights are determined based on the first and second loss functions. Specifically, the first loss function represents the average prediction error of the first model for multiple nodes at any historical time; the second loss function represents the average prediction error of the second model for multiple nodes at any historical time. Then, we can obtain k loss functions corresponding to M nodes from time tk to t, determine the first loss value of the k first loss functions and the second loss value of the k second loss functions, calculate the first average loss value of the k first loss values, calculate the second average loss value of the k second loss values, and determine the first and second weights based on the first and second average loss values. The specific calculation formula is as follows:

[0115]

[0116] Lm1 and Lm2 are the average values ​​of all loss values ​​from time tk to t for the first and second models, respectively, for the M nodes. The formulas for calculating Lm1 and Lm2 are as follows:

[0117]

[0118] Based on formulas (6) and (7) above, it can be seen that the optimization process of ω1 and ω2 is dynamically calculated and adjusted according to the values ​​of Lm1 and Lm2. The variable involved in Lm1 and Lm2 is k. Therefore, the optimization process of ω1 and ω2 is the process of determining k. k represents the number of historical moments, that is, the number of ship data. It can be understood that the output of the third model is based on the ship data of k historical moments. The smaller k is, the less input data the third model needs to predict; the larger k is, the more input data the third model needs to predict.

[0119] In some embodiments, the ship data in the training set is time-series data ordered by time; the initial parameters of the first model include: a first parameter, which is the difference order of the time-series data; a second parameter, which is the number of autoregressive terms; and a third parameter, which is the number of moving average terms.

[0120] In some embodiments, the ship data in the training set is time-series data ordered by time. The current value of the ship's time series is determined by the historical time series value and the amount of external disturbance. Based on this, a first model can be established, including the difference order, the number of autoregressive terms and the number of moving average terms, such as the ARIMA model. The first parameter of the ARIMA model is d, the second parameter is p and the third parameter is q, i.e., ARIMA(p,d,q).

[0121] In some embodiments, constructing a first model includes: performing a stationarity test and a white noise test on the training set to obtain test results; determining the first parameters of the first model based on the test results; plotting the autocorrelation function image and the partial autocorrelation function image of the training set; and determining the second and third parameters of the first model based on the autocorrelation function image and the partial autocorrelation function image.

[0122] For example, such as Figure 7 As shown, the process of performing stationarity and white noise tests on the time series data in the training set includes:

[0123] In step S410, the time series data is subjected to a stationarity test;

[0124] If the time series data is a stationary sequence, a white noise test is performed, i.e., step S420 is executed. If the time series data is not a stationary sequence, a difference processing is performed, i.e., step S430 is executed, and the value of the first parameter is determined based on the result of the difference processing.

[0125] In step S4250, white noise testing is performed on the time series data;

[0126] If the time series data is a white noise sequence, then the first model cannot be established; if the time series data is not a white noise sequence, then the first model can be established, i.e., step S440 should be executed. It should be noted that the characteristics of a white noise sequence are that the random variables at any two points in time are uncorrelated, and there are no usable dynamic patterns in the sequence; therefore, historical data cannot be used to predict or infer the future. Therefore, the first parameters of the first model can be determined through the results of the stationarity test and the white noise test.

[0127] In step S440, the ARIMA model is fitted.

[0128] In some embodiments, the first model is an ARIMA model.

[0129] In some embodiments, when the test result indicates that the training set is a non-stationary sequence and a non-white noise sequence, the training set is differentially processed at least once until the processed training set is a stationary sequence, and the number of differential processing is determined as a first parameter; when the test result indicates that the training set is a stationary sequence and a non-white noise sequence, the value of the first parameter is determined to be 0.

[0130] The specific methods for stationarity testing and white noise testing are explained below.

[0131] In some embodiments, there are many methods to test the stationarity of a time series, such as graphical observation, which reveals that the series is non-stationary. To ensure the accuracy of the judgment, this application adopts the runs test. The principle is that if the mean of the time series X is x, then values ​​in the series smaller than x are marked with a "-" sign and values ​​larger than x are marked with a "+" sign. This yields a sequence of signs corresponding to the original series. Each consecutive segment of identical signs is called a run.

[0132] For example, given the sequence 5679564838 with a mean of 6.1, the sign sequence would be "--++---+-+", meaning there are 6 runs. If a sequence is a stationary random sequence, its observations should fluctuate around its mean. Therefore, observations above or below its mean are appropriate. If the number of runs is too small, the observations will be consistently above or below the mean, indicating a clear trend or periodicity in the sequence.

[0133] Therefore, it is necessary to determine the appropriate number of runs. Using statistical tests, we assume the length of the time series is L, where L = L1 + L2. L1 is the number of occurrences of "+" in the sequence, L2 is the number of occurrences of "-", and the total number of runs in the sequence is r. For a random sequence, we know that when both L1 and L2 do not exceed 15, the total number of runs r follows a normal distribution.

[0134]

[0135]

[0136] When L1 and L2 are greater than 15, then:

[0137]

[0138] Where E(r) is the expected value of r, D(r) is the variance of r, and Z is the statistical test result of r.

[0139] Therefore, when using the runs test to test the stationarity of a series, we need to calculate the statistics r and Z. If r L <r<r U (r L Let r be the lower bound of r. U If |Z| < 1.96 at a given significance level α (where α is the upper limit of r), then the sequence is stationary; otherwise, it is non-stationary. Therefore, by the above method, we can conclude that this sequence is non-stationary.

[0140] For the ship flow sequence of node i in this application, it is {S} i,1 S i,2 , ...,S i,j}, each ship's data S i,j N includes the number of ships at node i at time j. i,j And ship speed V i,j S i,j =[N i,j V i,j Therefore, for each node i, the following time series pairs are formed:

[0141] {N i,j |j=tk,t-k+1,...,t-1},i=1,2,...,M;

[0142] {V i,j |j=tk,t-k+1,...,t-1},i=1,2,...,M;

[0143] Therefore, after calculating the sequence pairs for each node, we find that |Z| < 1.96, indicating that the sequence is not stationary and will be processed by difference.

[0144] In some embodiments, when the ship data in the training set is a non-stationary sequence, it is differencing to make it stationary. The degree of differencing is the value of the first parameter in the first model. In some embodiments, the first model is taken as an example of the ARIMA(p,d,q) model, where the first parameter is the order d. The formula for differencing is as follows:

[0145] W t =△ d N t =(1-L) d N t (11)

[0146] Z t =△ d V t =(1-L) d V t (12)

[0147] Among them, W t For the time series N of the number of ships t The time series obtained after differencing, Z t For the time series Z of ship speed t The time series obtained after difference analysis.

[0148] First, perform first-order differencing, then check the stationarity of the differencing sequence. If it is a non-stationary sequence, continue with second-order differencing, and so on, until a stationary sequence is obtained. Then, perform a white noise test on the obtained stationary sequence. If the sequence is determined to be a white noise sequence, an ARIMA model cannot be built, and the modeling process ends. If the sequence is determined to be a non-white noise sequence, an ARIMA model can be built.

[0149] The following method is given for verifying whether time-series data is a white noise sequence. The definition is as follows: For the time series of the number of ships at each node in this application, the definition is as follows:

[0150] {N i,j |j=tk,t-k+1,...,t-1},i=1,2,...,M (13)

[0151] If the following properties are satisfied, then the time series of ship numbers is a white noise series:

[0152] (1) Take t∈T, E(N) t )=μ1.

[0153] (2) Take t, s∈T,

[0154] Among them, E(N) t ) represents the number of ships N t Expectation, γ s,t Here, μ1 is the mean number of ships, and s1 is the statistic for the white noise test. 2 Let N be the variance of the number of ships. t and N s This represents the number of ships at different times.

[0155] Similarly, for the time series of ship speeds:

[0156] {V i,j |j=tk,t-k+1,...,t-1},i=1,2,...,M (14)

[0157] If the following property is satisfied, then the time series of ship speeds is a white noise series:

[0158] (1) Take t∈T, E(V) t )=μ2.

[0159] (2) Take t, s∈T,

[0160] Among them, E(V) t (V) represents the ship's speed. t Expectation, γ s,t Here, μ is the statistic for the white noise test, μ2 is the mean ship speed, and s2 is the statistic. 2 V represents the variance of the ship's speed. t and V s The speed of the ship at different times.

[0161] In some embodiments, the autocorrelation function (ACF) and partial autocorrelation function (PACF) graphs of the time series data are plotted respectively. Based on the characteristics of the two graphs, the second and third parameters of the first model are determined. The autocorrelation function (ACF) reflects the correlation between the values ​​of the same sequence at different time points. The partial autocorrelation function (PACF) strictly reflects the correlation between the current value and the lag value, eliminating the interference of intermediate random variables. Therefore, if the first model is an ARIMA model, the number of lags in the time series data itself, i.e., the second parameter, can be determined based on the PACF, and can be represented as p. Similarly, the number of lags in the prediction error, i.e., the third parameter, can be determined based on the ACF, and can be represented as q.

[0162] In some embodiments, candidate models, as well as second and third parameters corresponding to the candidate models, are obtained based on the image features displayed by the ACF and PACF images. The image features include: trailing and truncation. When there is only one candidate model, the candidate model is used as the first model. When there are multiple candidate models, the first model is determined from the multiple candidate models based on the Bayesian information criterion.

[0163] The process of determining the second and third parameters is explained below.

[0164] The model is determined by initially judging the suitable model type based on the truncation and trailing properties of the ship's time series ACF and PACF. For example, it can be determined based on the mapping relationship between ACF and PACF and model type shown in Table 2.

[0165] Table 2

[0166] Model ACF PACF AR(p) trailing truncation MA(q) truncation trailing ARMA(p,q) trailing trailing

[0167] By plotting the ACF and PACF images of the differencing time series, the tailing and truncation properties of the ACF and PACF images are observed. After determining the form of the ARIMA(p,d,q) model based on the ACF and PACF, the AR(p), MA(q), and ARMA(p,q) modes are determined.

[0168] To select the optimal model, this application uses the Bayesian Information Criterion (BIC). The BIC criterion is suitable for sequences with relatively large sample sizes. The formula for calculating BIC is as follows:

[0169] BIC=ln(λ)θ-2ln(Lf) (15)

[0170] θ is the number of model parameters, λ is the number of samples, Lf is the likelihood function, and ln(λ)θ penalty can avoid the curse of dimensionality when the dimensionality is too large and the training sample data is relatively small. The minimum BIC value corresponds to (p,q) which are the values ​​of p and q determined in the ARIMA model.

[0171] For example: the autocorrelation function graph shows that the lag exceeds the confidence boundary for three orders (tailing), and the partial autocorrelation function graph shows that the partial autocorrelation coefficient exceeds the confidence boundary for lags 1 to 7 (lags 1, 2, ..., 7), and the partial autocorrelation coefficient shrinks to 0 after lag 7 (truncation). Then the following models can be selected: (1) ARMA(0,1) model: that is, the autocorrelation graph shrinks to 0 after lag 1, and the partial autocorrelation shrinks to 0, which is a moving average model MA(1) with order q=1. (2) ARMA(7,0) model: that is, the partial autocorrelation graph shrinks to 0 after lag 7, and the autocorrelation shrinks to 0, which is an autoregressive model AR(7) with order p=7. (3) ARMA(7,1) model: that is, both the autocorrelation and the partial autocorrelation shrink to zero. It is a mixed model.

[0172] In some embodiments, the second model is an LSTM model, and the method for constructing the second model applied to waterway congestion prediction includes: constructing an LSTM model under the Keras high-level API, which includes an input layer 510 (e.g., Figure 8 x in t x t+1 ... xt+n ), hidden layer 520 and output layer 530 (e.g. Figure 8 Y in t Y t+1 ..., Y t+n And O1, O2, ..., O m Hidden layer 520 includes hidden layer one (such as...). Figure 8 A in 1 ) and hidden layer two (such as Figure 8 A in 2 The hidden state of hidden layer one is as follows: Figure 8 h t h t+1 ... h t+n As shown, the hidden state of the second hidden layer is as follows: Figure 8 H in t H t+1 H t+n As shown. The number of neurons in the input layer depends on the sensor monitoring items. The number of memory modules in the first hidden layer is obtained from {32, 64, 128, 256, 512}, and the number of memory modules in the second hidden layer is also obtained from {32, 64, 128, 256, 512}. The output layer is a single unit. Except for the memory modules in the first and second hidden layers which use Dropout, all others use fully connected connections. A schematic diagram of the LSTM model structure is shown below. Figure 8 As shown.

[0173] In some embodiments, before constructing the first model, the method further includes: preprocessing the ship data in the training set. The preprocessing includes: (1) discarding outliers in the ship data, such as discarding data whose ship latitude and longitude are outside the scope of the study. For example, discarding data whose ship speed is less than 0. (2) imputing missing and invalid data in the training set.

[0174] The interpolation process is based on quadratic interpolation, which interpolates every three adjacent data points to impute missing and invalid data in the training set. The formula for quadratic interpolation is as follows:

[0175]

[0176] Where (x, y) are the x and y coordinates obtained after quadratic interpolation, (x... u ,y u ), (x u+1 ,y u+1 ) and (x u+2 ,y u+2 () represents the x-axis and y-axis values ​​corresponding to three adjacent data points.

[0177] Figure 9This is a schematic diagram illustrating an implementation process of the waterway congestion prediction method provided in this application. For example... Figure 9 As shown, the waterway congestion prediction method of this application embodiment may include steps 610 to 640.

[0178] In step S610, the first data is obtained.

[0179] In this embodiment of the disclosure, the first data includes historical data of ships at the nodes to be predicted in the channel to be predicted. The first data includes the historical number of ships and the historical ship speed.

[0180] In step S620, the first ship data is obtained by performing linear prediction based on the first data using the first model.

[0181] In step 630, a second ship data is obtained by performing nonlinear prediction based on the first data using a second model.

[0182] In this embodiment of the disclosure, the first model and the second model are obtained by the model training method described in the foregoing embodiments.

[0183] In step S640, the congestion index at the node to be predicted is determined based on the first ship data and the second ship data.

[0184] In this embodiment of the disclosure, the first ship data includes the number of ships and ship speeds predicted by the first model; the second ship data includes the number of ships and ship speeds predicted by the second model.

[0185] In some embodiments, step S630 includes: obtaining a first weight and a second weight; wherein the first weight is determined based on a first loss function of a first model, and the second weight is determined based on a second loss function of a second model; and determining a congestion index based on the first weight and first ship data, and the second weight and second ship data.

[0186] In some embodiments, the first vessel data is weighted based on a first weight; the second vessel data is weighted based on a second weight; the sum of the weighted first vessel data and the weighted second vessel data is determined as the third vessel data; the third vessel data is calculated according to a preset channel congestion calculation function to obtain the congestion index. The calculation formula for the third vessel data can be found in formula (5) in the model training method embodiment.

[0187] In some embodiments, either the first ship data or the second ship data can be selected as the third ship data. In some embodiments, the average of the first ship data and the second ship data can also be calculated to obtain the third ship data.

[0188] In this embodiment, the first weight and the second weight can be obtained by the model training method described in the foregoing embodiments. The calculation formula for the third ship data can be found in formula (5). In some embodiments, the third ship data... To determine the final predicted number of ships, The final predicted ship speed is given. The formula for calculating the congestion index is as follows:

[0189]

[0190] Where C is the velocity threshold, N prob This represents the number of vessels navigable in the waterway. Congestion Index The larger the value, the more congested the nodes in the predicted channel are.

[0191] In this embodiment of the disclosure, based on the channel width regulations, the navigable flow rate values ​​differ for different channels. By predicting the number of vessels and their speed at each node at time t, the congestion index at each node at time t can be calculated using the above formula. This congestion index can be used to determine the future flow conditions of a certain channel segment. This avoids the problem of bias in evaluating channel congestion index solely based on speed or flow rate under different channel conditions.

[0192] Based on the same inventive concept, embodiments of this application also provide a waterway congestion prediction device. Still as Figure 1B As shown, the waterway congestion prediction device 155 includes: an acquisition module 1551, a first prediction module 1552, a second prediction module 1553, and an output module 1554.

[0193] In some embodiments, the acquisition module 1551 is configured to acquire first data, the first data including historical data of ships at the nodes to be predicted in the channel to be predicted; the first prediction module 1552 is configured to perform linear prediction based on the first data using a first model to obtain first ship data; the second prediction module 1553 is configured to perform nonlinear prediction based on the first data using a second model to obtain second ship data; wherein the first ship data and the second ship data are used to represent the predicted data of ships at the nodes to be predicted; the first model is obtained by training a linear prediction model based on historical data of ships at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted, and the first model is obtained by training a nonlinear prediction model based on historical data of ships at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted; the output module 1554 is configured to determine a congestion index at the node to be predicted based on the first ship data and the second ship data, the congestion index being used to represent the degree of congestion of ships at the node to be predicted.

[0194] Based on the same inventive concept, embodiments of this application also provide a model training device. Still as Figure 1C As shown, the model training device 156 includes: a first building module 1561, an input module 1562, a second building module 1563, and a training module 1564.

[0195] In some embodiments, the first construction module 1561 is configured to construct a first model and a second model; the first model is a linear prediction model, and the second model is a nonlinear prediction model. The initial parameters of the first model are determined based on a training set, which contains historical data of ships at multiple nodes in the channel to be predicted. The input module 1562 is configured to use the training set as input to obtain a first prediction set output by the first model and a second prediction set output by the second model. The first prediction set and the second prediction set are used to represent the predicted data of ships at the multiple nodes. The second construction module 1563 is configured to construct a first loss function and a second loss function based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted. The training module 1564 is configured to train the first model and the second model using the first loss function and the second loss function to obtain a converged first model and a converged second model. The ship data of the nodes output by the converged first model and the second model are used to predict the ship congestion level of the nodes.

[0196] In some embodiments, the second construction module 1563 is further configured to: determine the fourth parameter and the fifth parameter based on the mapping relationship between the channel parameter, the fourth parameter, and the fifth parameter; construct a first loss term in the first loss function based on the number of ships in the first prediction set and the fourth parameter; construct a second loss term in the first loss function based on the ship speed in the first prediction set and the fifth parameter; construct a first loss term in the second loss function based on the number of ships in the second prediction set and the fourth parameter; and construct a second loss term in the second loss function based on the ship speed in the second prediction set and the fifth parameter.

[0197] In some embodiments, the first construction module 1561 is further configured to construct a third model including a first model and a second model; determine a first weight and a second weight based on a first loss function and a second loss function; associate the first weight with the output of the first model and the second weight with the output of the second model; determine the output of the third model based on the output of the first model, the output of the second model, the first weight and the second weight; and use the ship data of the nodes output by the third model to predict the ship congestion level of the nodes.

[0198] In some embodiments, the first construction module 1561 is further configured to obtain a plurality of first loss values ​​and a plurality of second loss values ​​based on a plurality of first loss functions and a plurality of second loss functions; calculate the average of the plurality of first loss values ​​to obtain a first average loss value; calculate the average of the plurality of second loss values ​​to obtain a second average loss value; and determine a first weight and a second weight based on the first average loss value and the second average loss value.

[0199] In some embodiments, the first construction module 1561 is further configured to perform stationarity and white noise tests on the training set to obtain test results; determine the first parameters of the first model based on the test results; plot the autocorrelation function image and the partial autocorrelation function image of the training set; and determine the second and third parameters of the first model based on the autocorrelation function image and the partial autocorrelation function image.

[0200] In some embodiments, the first construction module 1561 is further configured to perform at least one difference processing on the training set until the processed training set is a stationary sequence when the test result indicates that the training set is a non-stationary sequence and a non-white noise sequence, and to determine the number of difference processing as a first parameter; and to determine the value of the first parameter to be 0 when the test result indicates that the training set is a stationary sequence and a non-white noise sequence.

[0201] In some embodiments, the first construction module 1561 is further configured to obtain a candidate model, and a second parameter and a third parameter corresponding to the candidate model, based on the image features displayed by the autocorrelation function image and the partial autocorrelation function image; the image features include: trailing and truncation; when there is only one candidate model, the candidate model is used as the first model; when there are multiple candidate models, the first model is determined from multiple candidate models based on the Bayesian information criterion.

[0202] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this application can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0203] It should be noted that, in the embodiments of this application, if the above-mentioned waterway congestion prediction method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0204] This application provides an electronic device, including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0205] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium can be transient or non-transient.

[0206] This application provides a computer program including computer-readable code. When the computer-readable code runs in an electronic device, the processor in the electronic device executes some or all of the steps in the above-described method.

[0207] This application provides a computer program product, which includes a computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.

[0208] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referred to interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0209] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above embodiments of this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0210] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0211] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0212] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0213] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0214] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0215] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0216] The above are merely embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for predicting waterway congestion, characterized in that, include: Obtain first data, which includes historical data of ships at the nodes to be predicted in the channel to be predicted; The first ship data is obtained by performing linear prediction based on the first data using the first model. The second model is used to perform nonlinear prediction based on the first data to obtain second ship data; wherein, the first ship data and the second ship data are used to represent the predicted data of ships at the nodes to be predicted; the first model is obtained by training a linear prediction model based on historical data of ships at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted; the second model is obtained by training a nonlinear prediction model based on historical data of ships at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted. Based on the first ship data and the second ship data, the congestion index at the node to be predicted is determined; The historical data of the ships includes the historical number of ships and the historical ship speed; the predicted data of the ships includes the predicted number of ships and the predicted ship speed.

2. The method according to claim 1, characterized in that, The step of determining the congestion index at the node to be predicted based on the first ship data and the second ship data includes: Obtain a first weight and a second weight; wherein the first weight is determined based on a first loss function of the first model, and the second weight is determined based on a second loss function of the second model; The congestion index is determined based on the first weight and the first ship data, and the second weight and the second ship data.

3. The method according to claim 2, characterized in that, The step of determining the congestion index based on the first weight and the first ship data, and the second weight and the second ship data, includes: Based on the first weight, the first ship data is weighted and calculated. The second ship data is weighted and calculated based on the second weight. The sum of the weighted first ship data and the weighted second ship data is determined as the third ship data; The third vessel data is calculated according to a preset waterway congestion calculation function to obtain a congestion index.

4. The method according to any one of claims 1 to 3, characterized in that, The node to be predicted is a preset position or preset area in the channel to be predicted.

5. The method according to any one of claims 1 to 3, characterized in that, The waterway parameters include at least one of the following: waterway width, waterway depth, and waterway grade.

6. A model training method, characterized in that, include: Construct the first model and the second model; The first model is a linear prediction model, and the second model is a nonlinear prediction model. The initial parameters of the first model are determined based on stationarity test, white noise test, autocorrelation test and partial autocorrelation test on the training set. The training set contains historical data of ships at multiple nodes in the channel to be predicted. Using the training set as input, a first prediction set output by the first model and a second prediction set output by the second model are obtained respectively; the first prediction set and the second prediction set are used to represent the prediction data of ships at the plurality of nodes; Based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted, a first loss function and a second loss function are constructed respectively. The first model and the second model are trained using the first loss function and the second loss function, respectively, to obtain a converged first model and a converged second model; the ship data of the nodes output by the converged first model and the second model are used to predict the ship congestion level of the nodes; The historical data of the ships includes the historical number of ships and the historical ship speed; the predicted data of the ships includes the predicted number of ships and the predicted ship speed.

7. The method according to claim 6, characterized in that, The first prediction set includes the number of ships and ship speeds predicted by the first model; the second prediction set includes the number of ships and ship speeds predicted by the second model; both the first loss function and the second loss function include: a first loss term associated with the number of ships and a second loss term associated with the ship speed.

8. The method according to claim 7, characterized in that, The first loss function and the second loss function further include: a fourth parameter associated with the number of ships and a fifth parameter associated with the ship speed; the fourth parameter is used to adjust the weight of the first loss term in the first loss function or the second loss function; the fifth parameter is used to adjust the weight of the second loss term in the first loss function or the second loss function. The fourth and fifth parameters are determined based on the waterway parameters.

9. The method according to claim 7, characterized in that, The construction of a first loss function and a second loss function based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted includes: Based on the mapping relationship between the channel parameters, the fourth parameter, and the fifth parameter, the fourth parameter and the fifth parameter are determined; Based on the number of ships in the first prediction set and the fourth parameter, a first loss term is constructed in the first loss function; based on the ship speed in the first prediction set and the fifth parameter, a second loss term is constructed in the first loss function. Based on the number of ships in the second prediction set and the fourth parameter, a first loss term in the second loss function is constructed; based on the ship speed in the second prediction set and the fifth parameter, a second loss term in the second loss function is constructed.

10. The method according to any one of claims 6 to 8, characterized in that, The method further includes: Construct a third model that includes the first model and the second model; Based on the first loss function and the second loss function, a first weight and a second weight are determined; the first weight is associated with the output of the first model, and the second weight is associated with the output of the second model. Based on the output of the first model, the output of the second model, the first weight, and the second weight, the output of the third model is determined; the ship data of the node output by the third model is used to predict the ship congestion level of the node.

11. The method according to claim 10, characterized in that, The first loss function represents the average prediction error of the first model for multiple nodes at any historical time; the second loss function represents the average prediction error of the second model for multiple nodes at any historical time. The step of determining the first weight and the second weight based on the first loss function and the second loss function includes: Based on multiple first loss functions and multiple second loss functions, multiple first loss values ​​and multiple second loss values ​​are obtained; Calculate the average of multiple first loss values ​​to obtain the first average loss value; calculate the average of multiple second loss values ​​to obtain the second average loss value; The first weight and the second weight are determined based on the first average loss value and the second average loss value.

12. The method according to claim 6, characterized in that, The historical ship data in the training set is time-series data sorted by time; the initial parameters of the first model include: a first parameter, which is the difference order of the time-series data; a second parameter, which is the number of autoregressive terms; and a third parameter, which is the number of moving average terms.

13. The method according to claim 6 or 12, characterized in that, The construction of the first model includes: The training set was subjected to stationarity and white noise tests to obtain the test results. Based on the test results, the first parameter of the first model is determined; Plot the autocorrelation function image and the partial autocorrelation function image of the training set; Based on the autocorrelation function image and the partial autocorrelation function image, the second parameter and the third parameter of the first model are determined.

14. The method according to claim 13, characterized in that, The determination of the first parameter of the first model based on the test results includes: If the test result indicates that the training set is a non-stationary sequence and a non-white noise sequence, the training set is subjected to at least one difference processing until the processed training set is a stationary sequence, and the number of difference processing is determined as the first parameter. If the test results indicate that the training set is a stationary sequence and a non-white noise sequence, the value of the first parameter is determined to be 0.

15. The method according to claim 13, characterized in that, The step of determining the second and third parameters of the first model based on the autocorrelation function image and the partial autocorrelation function image includes: Based on the image characteristics displayed by the autocorrelation function image and the partial autocorrelation function image, a candidate model is obtained, along with the second and third parameters corresponding to the candidate model; the image characteristics include: trailing and truncation. If there is only one candidate model, then the candidate model is taken as the first model. When there are multiple candidate models, the first model is determined from the multiple candidate models based on the Bayesian information criterion.

16. A waterway congestion prediction device, characterized in that, include: The acquisition module is configured to acquire first data, which includes historical data of ships at the nodes to be predicted in the channel to be predicted; the historical data of ships includes the historical number of ships and the historical speed of ships. The first prediction module is configured to perform linear prediction based on the first data using a first model to obtain the first ship data; The second prediction module is configured to perform nonlinear prediction based on the first data using a second model to obtain second ship data; wherein the first ship data and the second ship data are used to represent the predicted ship data at the node to be predicted; the first model is obtained by training a linear prediction model based on historical ship data at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted, and the second model is obtained by training a nonlinear prediction model based on historical ship data at multiple nodes in the channel to be predicted and the channel parameters of the channel to be predicted; the predicted ship data includes the predicted number of ships and the predicted ship speed; The output module is configured to determine the congestion index at the node to be predicted based on the first ship data and the second ship data.

17. A model training device, characterized in that, include: The first building module is configured to build the first model and the second model; The first model is a linear prediction model, and the second model is a nonlinear prediction model. The initial parameters of the first model are determined based on stationarity tests, white noise tests, autocorrelation tests, and partial autocorrelation tests on the training set. The training set contains historical data of ships at multiple nodes in the channel to be predicted. The historical data of ships includes the historical number of ships and the historical ship speed. The input module is configured to take the training set as input and obtain a first prediction set output by the first model and a second prediction set output by the second model, respectively; the first prediction set and the second prediction set are used to represent the prediction data of ships at the plurality of nodes; the prediction data of ships includes the predicted number of ships and the predicted ship speed. The second construction module is configured to construct a first loss function and a second loss function based on the first prediction set, the second prediction set, and the channel parameters of the channel to be predicted, respectively. The training module is configured to train the first model and the second model respectively using the first loss function and the second loss function to obtain a converged first model and a converged second model; the ship data of the node output by the converged first model and the second model is used to predict the ship congestion level of the node.

18. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 5, or when it executes the program, it implements the steps of the method according to any one of claims 6 to 15.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 15.

20. A computer program product comprising a computer-readable storage medium storing a computer program that, when read and executed by a computer, implements the steps of the method according to any one of claims 1 to 5, or implements the steps of the method according to any one of claims 6 to 15.

Citation Information

Cited By

  • Trajectory prediction model training method, system and device and storage medium

    CN121564467A