Ship flow prediction method and computer system based on computer vision
Through the ship flow prediction method based on computer vision, the ship flow prediction network is used to extract representation information from video and AIS data, which solves the problem of low ship flow prediction accuracy and efficiency in the existing technology and achieves efficient and accurate ship flow. predict.
Patent Information
- Application Number
- CN202410948904.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing ship flow prediction methods rely on statistical models or empirical formulas, which are difficult to handle large-scale, complex and changeable ship flow data. The prediction accuracy and real-time performance are insufficient, and the model debugging is complex, requiring a large number of labeled samples, and the debugging efficiency is low.
Using methods based on computer vision, target detection and tracking are performed by obtaining remote sensing images, and predictions are made using a ship flow estimation network. The network includes a representation information extraction component and a flow estimation component. Pre-debugging and detailed optimization debugging are used to improve prediction accuracy. and efficiency.
It achieves the performance of extracting characterization information from video and AIS data, reduces the need for large-scale ship flow data, improves prediction accuracy and efficiency, and saves sample collection and labeling costs.
Smart Images

Figure CN118485907B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to a ship traffic prediction method and computer system based on computer vision. Background Art
[0002] In the field of ship traffic management, accurate prediction of ship flow is of great significance for port planning, shipping scheduling and the healthy development of water transport economy. However, the prediction of ship flow faces many challenges, such as diverse data sources, high data dimensions, and strong dynamic changes. Traditional ship flow prediction methods mostly rely on statistical models or empirical formulas. These methods often seem to be unable to cope with large-scale, complex and changeable ship flow data, and the prediction accuracy and real-time performance are difficult to meet actual needs. With the rapid development of computer vision technology and artificial intelligence, ship flow prediction methods based on computer vision and machine learning have gradually attracted attention. This type of method uses multiple information sources such as port monitoring videos and ship automatic identification system (AIS) data, combined with advanced algorithms such as deep learning, to make real-time and accurate predictions of ship flow. However, in practical applications, the debugging and optimization process of the model is complicated, requires a large number of labeled samples, and the debugging efficiency is low. These problems limit the practical application effect of existing methods in ship flow prediction. Summary of the invention
[0003] The object of the present invention is to provide a ship flow prediction method and computer system based on computer vision. The embodiment of the present application is implemented as follows:
[0004] In a first aspect, the present application provides a ship flow prediction method based on computer vision, the method comprising: acquiring multiple remote sensing images of a target monitoring area in a target monitoring period; performing target detection on the multiple remote sensing images to obtain ship detection results, the ship detection results including ship positions and ship categories; performing target tracking on the detected ships based on a target tracking algorithm to obtain ship driving parameters; obtaining ship flow data for a target monitoring period based on statistics of the ship driving parameters; loading the ship flow data for the target monitoring period into a ship flow estimation network, and outputting estimated ship flow data for the next monitoring period based on the ship flow estimation network; wherein the ship flow estimation network comprises a characterization information extraction component and a flow estimation component, and the ship flow estimation network is debugged by the following steps: obtaining a first learning sample library, the first learning sample library comprising multiple first learning samples and a priori tags of each first learning sample, the first learning sample comprising a port monitoring video learning sample and a ship AIS data learning sample, the priori tags are used to indicate the ship The invention relates to an association relationship between an AIS data learning sample and a port surveillance video learning sample; splitting the port surveillance video learning sample in the first learning sample to obtain a video frame image stream, and splitting the ship AIS data learning sample in the first learning sample to obtain a ship AIS data stream; based on the video frame image stream corresponding to the port surveillance video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample, and the prior label of the first learning sample, pre-debugging the representation information extraction component; obtaining a ship flow data learning sample library, the ship flow data learning sample library including multiple second learning samples, the second learning sample including past ship flow data in the ship flow data and the actual ship flow in the next monitoring period corresponding to the past ship flow data; according to the past ship flow data in the second learning sample and the actual ship flow in the next monitoring period corresponding to the past ship flow data, performing detailed optimization and debugging on the flow estimation component and the pre-debugging representation information extraction component.
[0005] Optionally, according to the past ship traffic data in the second learning example and the actual ship traffic in a subsequent monitoring period corresponding to the past ship traffic data, the traffic estimation component and the pre-debugging characterization information extraction component are optimized and debugged in detail, including: performing feature embedding mapping on the past ship traffic data to obtain the embedding mapping characterization vector of the past ship traffic data; performing distribution feature embedding mapping on the past ship traffic data to obtain the distribution embedding mapping characterization vector of the past ship traffic data; integrating the embedding mapping characterization vector of the past ship traffic data and the distribution embedding mapping characterization vector to obtain the past embedding characterization vector; extracting characterization information based on the past embedded characterization vector by the pre-debugging characterization information extraction component to obtain a characterization vector of past ship flow data; estimating based on the characterization vector of past ship flow data by the flow estimation component to obtain estimated ship flow data of a subsequent monitoring period corresponding to the past ship flow data; obtaining a first network debugging error based on the actual ship flow and the estimated ship flow data of the subsequent monitoring period; optimizing component parameters of the pre-debugging characterization information extraction component and the flow estimation component according to the first network debugging error until the detailed optimization and debugging cutoff requirements are met.
[0006] Optionally, the characterization information extraction component includes a joint focus projection module, a cross-layer identity connection and standardization module, and a multi-layer perceptron module; the optimization of the component parameters of the pre-debugged characterization information extraction component and the traffic estimation component according to the first network debugging error includes: fixing the component parameters of the joint focus projection module and the multi-layer perceptron module; optimizing the component parameters of the traffic estimation component and the cross-layer identity connection and standardization module according to the first network debugging error.
[0007] Optionally, based on the video frame image stream corresponding to the port surveillance video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample and the prior label of the first learning sample, the representation information extraction component is pre-debugging, including: embedding and mapping the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, wherein the representation vector of each video frame in the video frame embedding representation vector set is obtained by integrating the embedding mapping representation vector and the distribution embedding mapping representation vector of the video frame; embedding and mapping the ship AIS data stream to obtain a set of ship AIS data representation vectors of the ship AIS data stream, wherein the ship AIS data representation vector set The representation vector of each ship AIS data subset is obtained by integrating the embedding mapping representation vector and the distribution embedding mapping representation vector of the ship AIS data subset; the representation information extraction component is used to extract the representation information of the video frame embedding representation vector set to obtain the video frame representation vector; the representation information extraction component is used to extract the representation information of the ship AIS data representation vector set to obtain the ship AIS data representation vector; based on the video frame representation vector, the ship AIS data representation vector and the prior label of the first learning sample, a second network debugging error is obtained; based on the second network debugging error, the component parameters of the representation information extraction component are optimized until the pre-debugging cutoff requirement is met.
[0008] Optionally, the embedding mapping of the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream includes: performing distribution feature embedding mapping on each video frame in the video frame image stream to obtain a distribution embedding mapping representation vector of each video frame; performing feature embedding mapping on each video frame in the video frame image stream to obtain an embedding mapping representation vector of each video frame; for each video frame in the video frame image stream, integrating the distribution embedding mapping representation vector and the embedding mapping representation vector of the video frame to obtain a representation vector of the video frame; merging the representation vectors of multiple video frames according to the distribution information of the video frames in the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream; the embedding mapping of the ship AIS data stream to obtain a ship AIS data stream of the ship The invention discloses a set of ship AIS data characterization vectors, comprising: respectively performing distribution feature embedding mapping on each ship AIS data subset in the ship AIS data stream to obtain a distribution embedding mapping characterization vector of each ship AIS data subset; respectively performing feature embedding mapping on each ship AIS data subset in the ship AIS data stream to obtain an embedding mapping characterization vector of each ship AIS data subset; for each ship AIS data subset in the ship AIS data stream, integrating the distribution embedding mapping characterization vector and the embedding mapping characterization vector of the ship AIS data subset to obtain a characterization vector of the ship AIS data subset; and merging the characterization vectors of multiple ship AIS data subsets according to distribution information of the ship AIS data subset in the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream.
[0009] Optionally, before embedding and mapping the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, the method further includes: performing a standardization operation on the pixel value of each pixel in each of the video frames to obtain a video frame image stream after the standardization operation, so as to embed and map the video frame image stream after the standardization operation; before embedding and mapping the ship AIS data stream to obtain a set of ship AIS data representation vectors of the ship AIS data stream, the method further includes: performing a quantization mapping operation on the data items in each of the ship AIS data subsets to obtain a data item vector; performing a standardization operation on the data item vectors of the data items in each of the ship AIS data subsets to obtain a ship AIS data stream after the standardization operation, so as to embed and map the ship AIS data stream after the standardization operation.
[0010] Optionally, obtaining a second network debugging error based on the video frame representation vector, the ship AIS data representation vector and the prior label of the first learning sample includes: performing a representation vector dimension unification operation on the video frame representation vector and the ship AIS data representation vector to obtain a target ship AIS data representation vector and a target video frame representation vector having consistent dimensions; obtaining a representation vector commonality measurement result between the target ship AIS data representation vector and the target video frame representation vector corresponding to the same first learning sample; and obtaining a second network debugging error based on the representation vector commonality measurement result and the prior label of the first learning sample.
[0011] Optionally, obtaining the second network debugging error based on the representation vector commonality measurement result and the prior label of the first learning sample includes: determining the positive learning samples and the negative learning samples in the first learning samples of the same training group through the prior labels of each of the first learning samples, the positive learning sample represents the first learning sample whose prior label indicates that the information of the ship AIS data learning sample is associated with the port surveillance video learning sample; the negative learning sample represents the first learning sample whose prior label indicates that the information of the ship AIS data learning sample is not associated with the port surveillance video learning sample; determining the second network debugging error through the representation vector commonality measurement result corresponding to the positive learning sample and the representation vector commonality measurement result corresponding to the negative learning sample in the first learning samples of the same training group; wherein the second network debugging error is positively correlated with the representation vector commonality measurement result corresponding to the positive learning sample; and the second network debugging error is negatively correlated with the representation vector commonality measurement result corresponding to the negative learning sample.
[0012] Optionally, after the estimated ship flow data of the next monitoring period is output based on the ship flow estimation network, the method further includes: obtaining the actual ship flow corresponding to the next monitoring period; and verifying the actual ship flow corresponding to the next monitoring period based on the estimated ship flow data of the next monitoring period to obtain a verification result.
[0013] In a second aspect, the present application provides a computer system comprising: one or more processors; a memory; one or more computer programs; wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and when the one or more computer programs are executed by the processors, the method as described above is implemented.
[0014] The beneficial effects of the present application include at least: the ship flow prediction method and computer system based on computer vision provided by the present application, ship flow estimation is performed through a pre-trained ship flow estimation network, and in the network debugging stage, a first learning sample library is obtained, the first learning sample library includes multiple first learning samples and a priori marks of each first learning sample, the first learning sample includes a port surveillance video learning sample and a ship AIS data learning sample, and the priori mark is used to indicate the association between the ship AIS data learning sample and the port surveillance video learning sample. The port surveillance video learning sample in the first learning sample is split to obtain a video frame image stream, and the ship AIS data learning sample in the first learning sample is split to obtain a ship AIS data stream. Based on the video frame image stream corresponding to the port surveillance video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample, and the priori mark of the first learning sample, the representation information extraction component is pre-debugged. A vessel flow data learning sample library is obtained, the vessel flow data learning sample library includes a plurality of second learning samples, the second learning samples include past vessel flow data in the vessel flow data and the actual vessel flow in a subsequent monitoring period corresponding to the past vessel flow data. According to the past vessel flow data in the second learning sample and the actual vessel flow in a subsequent monitoring period corresponding to the past vessel flow data, detailed optimization and debugging are performed on the flow estimation component and the representation information extraction component after pre-debugging. Based on this, the representation information extraction component after pre-debugging has been pre-debugging on learning samples with a larger sample base, and has the performance of extracting representation information in video and AIS data. Later, when the traffic estimation component and the representation information extraction component after pre-debugging are optimized and debugged in detail, the knowledge learned in the pre-debugging can be transferred to the ship traffic estimation. At the same time, the past ship traffic data also has valuable ship traffic patterns. Knowledge transfer and detail optimization are adopted to make the network quickly transition to the branch of ship traffic estimation. In addition, because the debugged representation information extraction component can adapt to the ship traffic data through the knowledge learned in the video and AIS data, then when optimizing the details, only a small number of ship traffic data learning samples are needed to produce a higher network debugging effect, without the need for large-scale ship traffic data learning samples, saving the cost of manual sample collection and labeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a flowchart of a ship traffic prediction method based on computer vision provided in an embodiment of the present application.
[0016] Figure 2 It is a schematic diagram of the composition of a computer system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] The execution subject of the ship flow prediction method based on computer vision in the embodiment of the present application is a computer device, including but not limited to a server, a personal computer, a laptop, a tablet computer, a smart phone, etc. Figure 1 As shown, the method includes:
[0018] Step S100: Acquire multiple remote sensing images of the target monitoring area in the target monitoring cycle.
[0019] In step S100, the computer system is responsible for obtaining multiple remote sensing images of a specific monitoring area (such as a busy port, a waterway intersection, etc.) from a specified data source within a target monitoring period (such as a day, a week, or a specific time period). Specifically, the computer system first determines the location and scope of the monitoring area, which is usually based on geographic information system (GIS) data or a pre-set monitoring plan. Then, the computer system sets a time window according to the target monitoring period to ensure that sufficient ship activity information can be captured within this time period. In order to obtain remote sensing images, the computer system can be connected to multiple remote sensing data sources, including but not limited to satellite remote sensing, drone photography, or ground fixed cameras. Each data source has its own unique advantages and limitations: satellite remote sensing images have a wide coverage, but the update frequency may be low; drone photography is highly flexible and can be used for high-resolution photography of specific areas; ground fixed cameras can provide continuous and stable monitoring images. In practical applications, the computer system can be configured with an automated data capture script or program that automatically downloads the latest remote sensing images from the selected data source according to a preset time interval (such as every hour, every half hour). These images are usually stored in digital formats, such as JPEG, PNG or TIFF, and contain visual information of ships, coastlines, buildings and other natural and man-made objects in the monitoring area. Taking port monitoring as an example, assuming that the target monitoring period is one day, the computer system can obtain remote sensing images of the port from satellites or drone platforms at different time points every day (such as every two hours). These images will show the dynamic changes of ships in the port, including the entry and exit of ships, berthing positions, operating status, etc. Each image is a two-dimensional array containing rich information, in which the value of each pixel represents a specific color or brightness, which together constitute a visual snapshot of the port area.
[0020] Step S200: performing target detection on a plurality of remote sensing images to obtain ship detection results, which include ship positions and ship categories.
[0021] In step S200, the computer system performs in-depth target detection processing on multiple remote sensing images collected from the target monitoring cycle, aiming to identify the ship target from the complex image background and determine its accurate location and category information. First, the computer system scans each remote sensing image using a pre-trained target detection model. This model may be based on a deep learning architecture, such as Faster R-CNN, YOLO (You Only Look Once) or SSD (SingleShot MultiBox Detector), which have shown excellent performance in the field of target detection. These models are trained with a large amount of labeled data (i.e., images containing ship location and category information), learn the feature representation of ship targets, and can automatically identify and locate ships in new images. During the target detection process, feature extraction is performed on the input remote sensing image to generate a series of feature maps. These feature maps contain abstract representations of different regions in the image, allowing the model to distinguish between background and foreground objects. Next, the model applies a series of sliding windows or anchors on the feature map to predict potential target areas (i.e., candidate boxes), and classifies and adjusts the position of each candidate box. Taking Faster R-CNN as an example, the model first generates a series of candidate regions that may contain targets through the region proposal network (RPN), and then crops, scales and sends each candidate region to the classification and regression subnetwork for further classification and position refinement. Finally, the model outputs the bounding box of each detected ship target, which accurately marks the location of the ship in the image and comes with a category label (such as cargo ship, passenger ship, tanker, etc.), thus forming the ship detection result. The computer system uses these ship detection results as the basis for subsequent analysis. For example, the computer system can calculate the number, density and distribution of ships based on the location information of the ships, which is crucial for assessing the busyness of the port, planning the routes of ships entering and leaving the port, and predicting future ship traffic. At the same time, the category information of the ship can also provide additional context for the prediction model to help better understand the behavior patterns and traffic patterns of ships.
[0022] Step S300: Track the detected ship based on the target tracking algorithm to obtain the ship's driving parameters.
[0023] Step S300 is intended to further analyze and understand the dynamic behavior of the ship in the monitoring area. In this step, the computer system uses advanced target tracking algorithms to continuously track the ship detected in step S200 to obtain key ship driving parameters such as heading and speed.
[0024] Specifically, the computer system first receives the ship detection results output in step S200, which contain the precise position and category information of each detected ship in the remote sensing image. Subsequently, the computer system starts the target tracking algorithm, which may be implemented based on technologies such as deep learning, Kalman filtering, particle filtering or optical flow method. Taking the SORT (Simple Online and Realtime Tracking) or DeepSORT algorithm in deep learning as an example, these algorithms can not only associate the same ship target between consecutive frames, but also retrieve and continue to track the target after it is partially blocked or disappears temporarily. During the tracking process, the algorithm analyzes the movement trajectory of the ship in the image and calculates the ship's driving parameters accordingly. For the calculation of the heading, the computer system can determine it by comparing the direction of change of the ship's position in consecutive frames. For example, if the ship moves from left to right in the image, the heading can be judged as east or west (depending on the setting of the image coordinate system). The calculation of speed is more complicated, and it usually involves the precise measurement of the ship's moving distance and time interval. The system can track the position of the ship in multiple consecutive frames of images, calculate the pixel distance of its movement, and convert the pixel distance into the actual sailing speed by combining the resolution, shooting angle and known geographic coordinate information of the remote sensing image. In addition, in order to track the ship more accurately and calculate the driving parameters, the computer system may also use the category information of the ship as an aid. Different categories of ships may have different sizes, shapes and motion characteristics, and this information can be used by the target tracking algorithm to optimize the tracking effect and the accuracy of parameter calculation.
[0025] In the application scenario of ship traffic prediction, the ship driving parameters obtained in step S300 are crucial for understanding the ship traffic pattern, predicting future ship traffic, and optimizing the operation and management of ports and waterways. For example, the computer system can predict the future driving trajectory of the ship based on its speed and heading, so as to plan the use of waterway resources in advance and avoid collisions and congestion between ships. At the same time, the ship's driving parameters can also be used as input features to train machine learning models to predict the distribution of ship traffic in a certain period of time in the future, providing a scientific basis for decision-making in ports and shipping industries.
[0026] Step S400: Obtaining ship flow data of a target monitoring period based on ship driving parameter statistics.
[0027] In step S400, the computer system conducts an in-depth analysis of the ship driving parameters obtained in step S300, and obtains the ship flow data within the target monitoring period through statistics and calculations. These data not only reflect the changes in the number of ships in the monitoring area, but also imply key information such as the movement mode and speed distribution of the ships, which provides an important basis for subsequent flow prediction. Specifically, the computer system first collects and organizes the driving parameters of all tracked ships within the target monitoring period, including heading, speed, and the time of their appearance and disappearance in the monitoring area. Subsequently, the computer system uses a series of statistical methods to process these parameters to extract key indicators of ship flow. For example, these key indicators can be the number of ships, speed, etc. A specific example is as follows: The computer system can calculate the number of ships in the monitoring area within each time unit (such as hour, half an hour), thereby obtaining the time series data of ship flow. These data directly reflect the dynamic changes in ship flow and are an important basis for evaluating the busyness of ports and planning waterway resources. In addition, the computer system can further analyze the speed distribution of ships and identify the proportion of ships in different speed ranges, which is also of great significance for understanding the traffic mode of ships and predicting future flow distribution. In order to more comprehensively describe the ship traffic conditions, the computer system can also count other relevant indicators, such as the average speed, maximum speed, minimum speed, etc. of the ship. These indicators not only provide a quantitative description of the ship's driving status, but can also be used as input features to train machine learning models to predict future ship traffic. The ship traffic data generated in step S400 has a wide range of application value. Port managers can use this data to evaluate the port's operating efficiency, optimize ship scheduling plans, and improve port throughput capacity. Shipping companies can use this data to plan routes, arrange ship schedules, and reduce operating costs. In addition, this data can also be used to support work in many fields such as policy formulation, environmental protection, and safety supervision.
[0028] Step S500: Load the ship flow data of the target monitoring period into the ship flow estimation network, and output the estimated ship flow data of the next monitoring period based on the ship flow estimation network.
[0029] Step S500 uses the data collected and processed in the early stage to predict the changing trend of future ship traffic through a complex machine learning model (especially the ship traffic prediction network). In this step, the computer system plays a vital role. It is responsible for taking the ship traffic data of the target monitoring period obtained in step S400 as input, loading it into the pre-trained ship traffic prediction network, and then outputting the estimated ship traffic data for the next monitoring period.
[0030] Specifically, the computer system first ensures that the ship flow data for the target monitoring period has been preprocessed in the format required by the network, including data standardization, normalization, and possible feature engineering steps. These preprocessing steps are critical to ensuring data consistency and the effectiveness of the network model. Subsequently, the computer system passes these processed data as input features to the ship flow estimation network. This network may be a complex deep learning model, such as a recurrent neural network (RNN), a long short-term memory network (LSTM), or a Transformer, which performs well in processing time series data and can capture the time dependency and periodicity in ship flow data. Inside the model, the input features are first nonlinearly transformed and feature extracted through a series of hidden layers, which may contain multiple structures such as convolutional layers, pooling layers, and fully connected layers to capture high-level abstract features in the data. As the data is passed through the network, these features are gradually transformed into predictions of ship flow for the next monitoring period.
[0031] Finally, the ship flow estimation network outputs the estimated ship flow data for the next monitoring cycle. These data may include information such as the estimated number of ships in each time unit (such as hour, half hour), the estimated distribution of ship types, and possible flow peak and trough times. This information is of great practical value to port managers, shipping companies and relevant regulatory agencies, and can help them make more scientific and reasonable decisions. In practical applications, the computer system can compare and verify the estimated ship flow data with historical real data to evaluate the prediction performance of the model. If there is a large deviation between the prediction result and the actual data, the computer system can also automatically adjust the model parameters or retrain the model to improve the accuracy of the prediction.
[0032] In the embodiment of the present application, the ship flow estimation network includes a characterization information extraction component and a flow estimation component. The ship flow estimation network is debugged by the following steps:
[0033] Step S10: Obtain a first learning sample library, the first learning sample library includes multiple first learning samples and prior labels of each first learning sample, the first learning samples include port surveillance video learning samples and ship AIS data learning samples, and the prior labels are used to indicate the association relationship between the ship AIS data learning samples and the port surveillance video learning samples.
[0034] In step S10, the computer system is responsible for acquiring a comprehensive and diverse first learning sample library, which not only contains abundant port surveillance video learning samples and ship AIS (Automatic Identification System) data learning samples, but also comes with a priori labels for each learning sample.
[0035] First, the computer system collects port surveillance video learning samples through various channels. These videos are usually taken by cameras installed in key areas of the port, recording the entire process of ships entering and leaving the port, berthing, and operating. The video content covers ship activities under different time, weather, and lighting conditions, providing rich visual information for the model. At the same time, in order to ensure the diversity and representativeness of the data, the computer system will pay special attention to selecting videos of different ports and different types of ships to cover a wider range of application scenarios. In addition to port surveillance videos, the computer system also collects a large number of ship AIS data learning samples. The AIS system is one of the essential navigation devices for modern ships, which can send key information such as the ship's position, speed, heading, and ship type in real time. These data are usually stored in text or binary format and contain rich ship dynamic information, which is crucial for understanding and predicting ship traffic. The system has obtained a large number of real AIS data samples by cooperating with maritime departments, shipping companies, etc., ensuring the accuracy and reliability of the data.
[0036] After collecting the port surveillance video learning samples and the ship AIS data learning samples, the computer system also needs to assign a priori tags to each learning sample. These tags are used to indicate the association between the port surveillance video and the ship AIS data in the same time period, that is, which video clips correspond to which AIS data. This correspondence is crucial for the model to learn how to extract ship information consistent with the AIS data from the video. Priori tags are usually completed by manual annotation, and the annotator will make matching judgments based on the video content and the timestamp, location information and other features of the AIS data. Finally, the computer system organizes these learning samples with priori tags into the first learning sample library. This library not only contains a variety of port surveillance video and AIS data samples, but also establishes a close connection between the video and the data through priori tags. This provides a valuable data basis for the pre-debugging of the characterization information extraction component in the subsequent steps, which helps the model better understand and predict ship traffic.
[0037] Step S20: performing a splitting operation on the port monitoring video learning sample in the first learning sample to obtain a video frame image stream, and performing a splitting operation on the ship AIS data learning sample in the first learning sample to obtain a ship AIS data stream.
[0038] In step S20, the computer system performs a fine splitting operation on the port monitoring video learning samples and the ship AIS data learning samples in the first learning sample library to provide structured data input for subsequent feature extraction and model training. For the port monitoring video learning samples, the computer system first reads each video file and decodes it to split the continuous image sequence into independent video frames. These video frames are arranged in chronological order to form a video frame image stream. Each video frame is a two-dimensional array (or matrix), in which the elements represent the color or brightness value of each pixel in the image. For example, for a video frame with a resolution of 1920×1080, the corresponding two-dimensional array will have 1920 rows and 1080 columns, and each element in the array is a color value (such as RGB format). Each frame in the video frame image stream contains information such as the position, shape and motion state of the ship at a specific moment, which is the basis for subsequent target detection and tracking. At the same time, the computer system also performs a splitting operation on the ship AIS data learning samples. AIS data usually exists in the form of a time series, recording the status information of the ship at different time points. In this step, the computer system reads the AIS data file in chronological order and splits it into multiple ship AIS data subsets. Each subset corresponds to a specific time node and contains multi-dimensional AIS data of all ships under that node. These dimensions may include the ship's MMSI code (unique identification code), location (latitude and longitude), speed, heading, ship type, etc. For example, at a certain time node, there may be 10 ships active in the monitoring area, then the corresponding AIS data subset will contain all the above status information of these 10 ships. Each subset in the ship AIS data stream is a snapshot of the dynamic behavior of the ship, providing key time series data for subsequent traffic estimates.
[0039] Through the splitting operation in step S20, the computer system converts the original port monitoring video learning samples and the ship AIS data learning samples into structured video frame image streams and ship AIS data streams. These two data streams will be used in the pre-debugging of the characterization information extraction component in the subsequent steps. The visual information in the video frame and the dynamic information in the AIS data can be verified and supplemented with each other to improve the accuracy and robustness of the model for ship flow estimation. At the same time, this splitting operation also makes it possible for parallel processing and accelerated calculation of the model, further improving the efficiency and performance of the entire prediction process.
[0040] Step S30: pre-debugging the representation information extraction component based on the video frame image stream corresponding to the port monitoring video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample and the priori label of the first learning sample.
[0041] Step S30 pre-debugging (i.e., pre-training) the characterization information extraction component to ensure that the component can effectively extract feature information useful for ship flow estimation from port monitoring videos and ship AIS data. In this step, the computer system makes full use of the rich data resources in the first learning sample library and optimizes and adjusts the characterization information extraction component through a series of complex machine learning techniques and algorithms.
[0042] First, the computer system extracts the video frame image stream corresponding to the port surveillance video learning sample and the ship AIS data stream corresponding to the ship AIS data learning sample from the first learning sample library. The video frame image stream contains multiple continuous video frames, each of which is a visual snapshot of the ship at a specific moment, while the ship AIS data stream records the dynamic state information of the ship at different time points, such as position, speed, heading, etc. These data streams are closely related to the prior labeling of the first learning sample. The prior labeling clearly indicates which video frames correspond to which AIS data, providing important supervision information for the learning of the model. Then, the computer system inputs these data streams into the representation information extraction component to start the pre-debugging process. The representation information extraction component may be a complex deep learning model, such as a convolutional neural network (CNN) combined with a recurrent neural network (RNN) or a Transformer structure. This component is designed to extract the visual features of the ship (such as shape, size, color, etc.) from the video frame image and extract dynamic features (such as speed change, heading change, etc.) from the ship AIS data. These features are then integrated together to form a comprehensive description of the ship's behavior. During the pre-debugging process, the computer system first uses a priori labels to guide the learning of the model. Specifically, it uses corresponding video frames and AIS data as positive sample pairs, and non-corresponding video frames and AIS data as negative sample pairs. Through comparative learning, the model can gradually learn which feature combinations are effective and which are insignificant. At the same time, the computer system will also use a series of optimization algorithms (such as gradient descent, Adam optimizer, etc.) to continuously adjust the parameters of the model to minimize the loss function (such as cross entropy loss, mean square error loss, etc.), thereby improving the model's ability to extract relevant features for ship flow estimation.
[0043] As the pre-debugging progresses, the performance of the characterization information extraction component will gradually improve. It can more accurately extract feature information useful for ship flow estimation from video frames and AIS data, providing strong support for the flow estimation component in the subsequent steps. In addition, since the pre-debugging process fully utilizes the prior labeled supervision information, this component can also overcome the impact of data noise and uncertainty on model performance to a certain extent, and improve the robustness and generalization ability of the entire ship flow estimation network.
[0044] Step S30 lays a solid foundation for the construction of the ship flow estimation network by pre-debugging the characterization information extraction component. This process not only improves the model's ability to extract features related to ship flow estimation, but also enhances the robustness and generalization ability of the entire network, providing a strong guarantee for flow estimation in subsequent steps.
[0045] Step S40: Obtain a ship flow data learning sample library, the ship flow data learning sample library includes multiple second learning samples, the second learning samples include past ship flow data in the ship flow data and the actual ship flow in the next monitoring period corresponding to the past ship flow data.
[0046] In step S40, the computer system is responsible for collecting and collating a series of second learning samples containing past ship flow data and the corresponding actual ship flow in the next monitoring period to form a ship flow data learning sample library. Specifically, the computer system first clarifies the needs and goals of the ship flow prediction task, that is, to estimate the ship flow in a future monitoring period based on past ship flow data. In order to achieve this goal, the computer system needs to collect a large amount of historical ship flow data as learning samples. These data may come from multiple channels such as port monitoring systems, ship AIS systems, maritime administration departments, etc., covering ship flow conditions at different times, different ports, and different weather conditions. Next, the computer system cleans and preprocesses these raw data to remove noise, fill missing values, unify data formats, etc., to ensure the accuracy and consistency of the data. During the preprocessing process, the computer system will also divide the data according to task requirements to form multiple second learning samples. Each learning example contains two parts of information: one is the past ship flow data, which records the key information such as the number, type, and navigation trajectory of ships in a certain monitoring period; the other is the actual ship flow in the next monitoring period corresponding to the past ship flow data, which is used as a supervisory signal to evaluate the accuracy of model prediction. After building the ship flow data learning sample library, the computer system can use these learning examples to optimize and debug the flow estimation component and the representation information extraction component after pre-debugging. By continuously adjusting model parameters and optimizing model structure, the computer system aims to improve the model's ability to predict future ship flow, so that it can more accurately reflect the changing trends and laws of actual ship flow. This process not only helps to improve the accuracy of ship flow prediction, but also provides strong data support for port management, shipping planning and other fields.
[0047] Step S50: According to the past ship flow data in the second learning example and the actual ship flow in the next monitoring period corresponding to the past ship flow data, the flow estimation component and the pre-debugging characterization information extraction component are optimized and debugged in detail.
[0048] Step S50 performs detailed optimization and debugging on the flow estimation component and the pre-debugging characterization information extraction component to further enhance the model's ability to predict future ship flow. In this step, the computer system makes full use of the data resources in the second learning sample library and fine-tunes the model through detailed optimization (fine-tuning) to meet the needs of specific application scenarios.
[0049] Specifically, the computer system first extracts the past ship flow data and the corresponding real ship flow in the next monitoring period from the second learning sample library. These data samples contain rich ship flow information, such as the number, type, navigation trajectory and timestamp of ships, which provide a solid foundation for the detailed optimization of the model. Next, the computer system inputs these data samples into the flow estimation component and the representation information extraction component after pre-debugging. During the input process, the computer system performs appropriate preprocessing on the data, such as data standardization, feature encoding, etc., to ensure that the model can process these data efficiently and accurately.
[0050] During the model training process, the computer system uses fine-tuning technology to fine-tune the parameters of the traffic estimation component and the representation information extraction component. Detail optimization is a method of transfer learning that uses the common features learned by the pre-debugged model on a large-scale data set to make small-scale parameter adjustments for specific tasks. In this case, since the representation information extraction component has been pre-debugged and has a certain feature extraction capability, the system mainly focuses on fine-tuning the traffic estimation component, and also makes necessary parameter adjustments to the representation information extraction component to ensure that the two work together.
[0051] During the detailed optimization process, the computer system uses the back-propagation algorithm to calculate the error between the model prediction results and the actual ship traffic, and updates the model parameters based on the error signal. This process is repeated many times until the model's performance on the validation set reaches a stable or optimal state.
[0052] Through the detailed optimization and debugging of step S50, the computer system can significantly improve the prediction ability of the flow estimation component for future ship flow. The model can not only capture the changing trend of ship flow more accurately, but also comprehensively consider complex factors such as ship type and navigation trajectory, thereby providing more comprehensive and accurate prediction results. These prediction results have important application value in the fields of port management, shipping planning, etc., and can help relevant decision makers better cope with the challenges brought about by changes in ship flow.
[0053] As an implementation mode, step S50, according to the past ship flow data in the second learning example and the actual ship flow in the next monitoring period corresponding to the past ship flow data, performs detailed optimization and debugging on the flow estimation component and the pre-debugging characterization information extraction component, which may specifically include:
[0054] Step S51: Perform feature embedding mapping on the past ship traffic data to obtain an embedding mapping representation vector of the past ship traffic data.
[0055] The purpose of step S51 is to convert the original ship flow data into a form that is more suitable for processing by the machine learning model - an embedded mapping representation vector. In this way, the computer system can more effectively capture the potential information and patterns in the data, thereby improving the accuracy of flow estimation.
[0056] Specifically, in step S51, the computer system analyzes the characteristics of past ship traffic data and identifies the features that have a significant impact on traffic estimation. These features may include the number, type, size, sailing speed, direction, timestamp (such as date, hour) and geographical location (such as channel, berth), etc. Each feature represents a dimension of the ship traffic data and together constitutes a complete view of the data.
[0057] Next, the computer system performs an embedding mapping operation on these features. Embedding mapping is a technique that converts discrete or low-dimensional data into a high-dimensional continuous vector space, which helps capture complex relationships and similarities between data. In the scenario of ship traffic prediction, embedding mapping can convert each feature into a vector of fixed length, which is the embedding mapping representation vector of the feature. Taking ship type as an example, assume that the data set contains multiple types of ships such as cargo ships, passenger ships, and tankers. Before embedding mapping, these types may be simple text labels or digital codes. However, through the embedding mapping operation, the computer system can convert each ship type into a multidimensional vector. In this vector space, similar ship types (such as different types of cargo ships) can have similar vector representations, while dissimilar types (such as cargo ships and passenger ships) will have a larger vector distance. Another example is the timestamp feature, which can also be converted into an embedding vector by the computer system. Different dates, hours, and even seasons may correspond to different ship traffic patterns. Through embedding mapping, these time information can be converted into vector representations that reflect their inherent associations and periodicity. The specific implementation of embedding mapping may rely on a variety of machine learning algorithms or models, such as the application of word embedding technologies such as Word2Vec and GloVe on text data, or the application of more complex neural network models (such as autoencoders, Transformers, etc.) on more complex data. However, in the scenario of ship traffic prediction, the specific embedding mapping algorithm or model can be customized and optimized according to the characteristics of the data and the requirements of the task. Finally, after the feature embedding mapping operation of step S51, the computer system obtains the embedding mapping representation vector of the past ship traffic data. These vectors not only retain the key information in the original data, but also exist in a form that is more suitable for machine learning model processing, providing strong support for subsequent representation information extraction and traffic estimation.
[0058] Step S52: Perform distribution feature embedding mapping on the past ship flow data to obtain a distribution embedding mapping representation vector of the past ship flow data.
[0059] Step S52 aims to capture the temporal and spatial distribution information in the data by embedding the distribution features, that is, embedding the position information. Specifically, the computer system identifies the features related to the temporal and spatial distribution in the past ship traffic data. The temporal distribution features may include date, time (such as hours, minutes), season, etc., which reflect the periodic law of the change of ship traffic over time. The spatial distribution features may involve the geographical location of the ship (such as longitude and latitude), channel number, berth location, etc., which reveal the spatial distribution pattern of ship traffic. In order to effectively encode these distribution features, the computer system adopts the distribution feature embedding mapping technology. This technology is similar to the position encoding method in natural language processing, such as the sinusoidal position encoding in the Transformer model, but here it is customized to adapt to the characteristics of ship traffic data. In the process of position embedding, for the temporal distribution features, the computer system can assign a unique encoding vector to each timestamp. These vectors have a certain geometric structure in the embedding space, so that the encoding vectors of similar time points are also close in distance, thereby reflecting the continuity and periodicity of time. For example, the encoding vectors of adjacent hours may have a small Euclidean distance in the embedding space, while the encoding vectors of different seasons may be distributed in different areas of the embedding space. Position encoding can also play a role in spatial distribution features. The computer system can assign a unique encoding vector to each geographic location or waterway number. These vectors not only represent the absolute information of the spatial location, but also reflect the spatial distribution pattern of ship traffic through their relative position relationship. For example, at the intersection of busy waterways, the encoding vectors of related geographic locations may form a tight cluster in the embedding space, while in more remote areas, the encoding vectors may be more sparsely distributed. The specific implementation of position embedding may involve a variety of algorithms and models. In practical applications, computer systems can use predefined functions (such as a combination of sine and cosine functions) to generate position encoding vectors, or use neural network models (such as autoencoders) to learn more complex encoding representations. Regardless of the method used, the core goal of position encoding is to convert the temporal and spatial distribution information in the original data into a structured, model-friendly embedding vector form.
[0060] Through the distribution feature embedding mapping in step S52, the computer system obtains the distribution embedding mapping representation vectors of the past ship flow data. These vectors not only contain the basic feature information of the ship flow, but also incorporate the key elements of time and space distribution, providing richer and more comprehensive data support for subsequent characterization information extraction and flow estimation.
[0061] Step S53: Integrate the embedding mapping representation vector of past ship flow data and the distribution embedding mapping representation vector to obtain a past embedding representation vector.
[0062] The purpose of step S53 is to integrate the basic characteristic information of ship traffic with the time and space distribution information, so as to provide richer and more effective data representation for subsequent characterization information extraction and traffic estimation.
[0063] In the embodiment of the present application, the computer system obtains the embedding mapping representation vector and the distribution embedding mapping representation vector of the past ship traffic data through steps S51 and S52. These vectors capture different aspects of ship traffic: the embedding mapping representation vector focuses on basic features such as the number, type, and size of ships, while the distribution embedding mapping representation vector focuses on the distribution pattern of these features in time and space. In order to effectively integrate these two representation vectors, the computer system adopts an integration strategy. This strategy may involve simple vector concatenation, weighted summation, attention mechanism and other methods, and the specific choice depends on the characteristics of the data and the requirements of the task. For example, if the basic features and distribution features are equally important in traffic prediction, then simple vector concatenation may be an intuitive and effective choice. In this case, the computer system connects the embedding mapping representation vector and the distribution embedding mapping representation vector of each sample end to end to form a longer vector as the past embedding representation vector of the sample. If certain features or distribution information are more important in a specific case, the computer system can use a weighted summation method to assign different weights to different vector dimensions or components. These weights can be set by prior knowledge or automatically learned during model training. In addition, the attention mechanism allows the system to dynamically adjust the importance of different features or distribution information in the integration process. Through the attention mechanism, the computer system can learn which features or distribution information are more important for the current flow estimation task and pay more attention to them accordingly. Regardless of the integration strategy adopted, the ultimate goal of step S53 is to generate a past embedding representation vector that can fully reflect the characteristics of past ship flow data. This vector not only contains the basic feature information of the ship, but also incorporates the distribution information of time and space, providing rich input data for the subsequent representation information extraction component.
[0064] Step S54: extracting the representation information based on the past embedded representation vector through the pre-debugging representation information extraction component to obtain the representation vector of the past ship traffic data.
[0065] Step S54 involves using the pre-debugging representation information extraction component to deeply process the past embedded representation vectors to extract more critical and effective representation information for flow estimation. Specifically, the computer system first obtains the past embedded representation vectors obtained by integration in step S53. This vector not only contains the basic feature information of the ship (such as quantity, type, size, etc.), but also incorporates time and space distribution information, providing rich materials for representation information extraction. Subsequently, the computer system inputs these past embedded representation vectors into the pre-debugging representation information extraction component. This component may be a complex deep learning model, such as a combination of a convolutional neural network (CNN), a recurrent neural network (RNN) or its variants (such as LSTM, GRU) and an attention mechanism. These models have been debugged and optimized in the early stage and have the ability to extract useful features from the original data. In the process of representation information extraction, the input past embedded representation vectors are processed in multiple layers. Each layer of processing can introduce operations such as nonlinear transformation, feature dimensionality reduction, feature selection or feature fusion, aiming to gradually reveal the potential patterns and laws in the data. For example, the convolution layer can capture local features through sliding windows and convolution kernels, and the pooling layer will downsample these features to reduce the amount of calculation and increase the robustness of the features. Recurrent neural networks can process sequence data and capture the time dependency in the data. The attention mechanism allows the model to dynamically adjust the importance of different features during the processing. After multiple layers of processing, the representation information extraction component will output a series of representation vectors of past ship traffic data. These vectors are abstractions and generalizations of the original data. They remove redundant information, retain key features, and provide more refined and effective inputs for subsequent traffic estimation. Taking the historical ship traffic data of a port as an example, after the representation information extraction in step S54, the computer system may obtain a series of representation vectors, each of which corresponds to the key features of the port ship traffic in a certain period of time. These features may include the changing trend of the number of ships, the proportional distribution of different types of ships, the average value of the ship's sailing speed and its distribution range, etc. These representation vectors will be used as inputs to the traffic estimation component to further estimate future ship traffic.
[0066] Step S55: The flow estimation component estimates the characterization vector of the past ship flow data to obtain the estimated ship flow data of the next monitoring period corresponding to the past ship flow data.
[0067] Step S55 involves processing the representation vectors of past ship flow data using the flow estimation component to estimate the ship flow in a future monitoring period. In this step, the computer system receives the representation vectors of past ship flow data from step S54. These representation vectors are obtained after deep processing by the representation information extraction component. They contain key feature information of ship flow and are an important basis for estimating future flow. Next, the computer system inputs these representation vectors into the flow estimation component. The flow estimation component may be a carefully designed regression model, such as support vector regression (SVR) or a fully connected layer in a deep neural network. These models have been trained and optimized to have the ability to predict the target variable from the input features. During the flow estimation process, the model performs a series of complex calculations on the input representation vectors. These calculations may include linear transformations, nonlinear activations, feature interactions, etc., aiming to capture the potential relationship between the representation vector and the target variable (i.e., future ship flow). For example, in a deep neural network, a fully connected layer can gradually abstract low-level features into high-level prediction results through weighted summation and activation function operations between multiple neurons. After a series of calculations, the flow estimation component will output the estimated ship flow data. These data correspond to the ship flow situation of one or more monitoring periods after the monitoring period in which the past ship flow data is located. The estimated results may include information such as the specific value of the number of ships, the distribution ratio of ship types, the time point when the flow peak occurs, etc., depending on the design and training objectives of the model. For example, assume that the computer system has obtained the daily ship entry and exit records of the port in the past year, and obtained the characterization vector of the daily ship flow after a series of processing. In step S55, the computer system uses the flow estimation component to process these characterization vectors and estimates the number of ships entering and leaving the port every day in the next week. These estimated results will serve as an important basis for the decision-making of port management departments, helping them to better plan berth resources, optimize ship scheduling plans, etc.
[0068] Step S56: Based on the actual ship flow and the estimated ship flow data of the next monitoring period, a first network debugging error is obtained.
[0069] In step S56, the computer system compares the actual ship flow data of the next monitoring period with the ship flow data estimated by the flow estimation component to calculate the first network debugging error. This error value is an important indicator for measuring the accuracy of model prediction, and has guiding significance for subsequent optimization of model parameters and improvement of prediction performance. The computer system uses one or more error calculation methods to compare the actual ship flow data with the estimated ship flow data. Common error calculation methods include mean square error (MSE), mean absolute error (MAE), root mean square error (RMSE), etc. These methods can quantify the difference between the true value and the predicted value, and provide an objective basis for evaluating model performance. Taking the mean square error as an example, the computer system calculates the square of the difference between the actual ship flow and the estimated ship flow, and then averages the square of the difference of all monitoring points. This average value is the first network debugging error, which reflects the average deviation of the model in predicting the ship flow during the entire monitoring period. The smaller the error value, the better the prediction performance of the model, and vice versa, it means that the model still has a lot of room for improvement.
[0070] For example, suppose the actual ship flow of a port in a certain monitoring period is [100, 120, 110, 90] ships, while the ship flow estimated by the flow estimation component is [95, 125, 105, 95] ships. Using the mean square error calculation method, the computer system first calculates the square of the error of each monitoring point: [(100-95) 2 , (120-125) 2 , (110-105) 2 ,(90-95) 2 ] = [25, 25, 25, 25], and then average these squared errors to get the first network debugging error: (25+25+25+25) / 4 = 25. This error value reflects the prediction accuracy of the model during the monitoring period.
[0071] Through the calculation of step S56, the computer system obtains the first network debugging error, which provides an important reference for subsequent optimization of model parameters and improvement of prediction performance. Based on this error value, the computer system can further adjust the parameter settings of the traffic estimation component and the characterization information extraction component, such as the learning rate, the number of network layers, the activation function, etc., in order to obtain a smaller debugging error and higher prediction accuracy in the next round of training.
[0072] Step S57: Optimize the component parameters of the pre-debugging characterization information extraction component and the traffic estimation component according to the first network debugging error until the detailed optimization debugging cutoff requirement is met.
[0073] By continuously iterating and adjusting the model parameters to minimize the debugging error, the prediction performance of the model is improved. Specifically, the computer system first obtains the first network debugging error calculated in step S56. This error value reflects the accuracy of the model's prediction of ship flow under the current parameter settings, and is an important basis for optimizing the model parameters. Next, the computer system uses one or more optimization algorithms to adjust the component parameters of the characterization information extraction component and the flow estimation component. These parameters include but are not limited to weights, biases, learning rates, network layers, etc., which together determine the complexity and learning ability of the model. Commonly used optimization algorithms include gradient descent methods (such as SGD, Adam, etc.), Newton methods, quasi-Newton methods, etc. These algorithms calculate the gradient (or approximate gradient) of the error function with respect to the model parameters, and update the parameter values according to certain rules to gradually reduce the error function. Taking the Adam optimization algorithm as an example, it combines the advantages of the momentum method and the RMSprop algorithm, updates the parameters by calculating the first-order moment estimation and second-order moment estimation of the gradient, and has the advantages of fast convergence speed and adaptive adjustment of the learning rate. During the optimization process, the computer system calculates the gradient information based on the first network debugging error, and applies the optimization algorithm to update the parameters of the characterization information extraction component and the traffic estimation component. This process is repeated for multiple iterations, and each iteration uses the new parameter values to recalculate the debugging error and continue to optimize the parameters based on the new error values. As the iterations proceed, the debugging error usually decreases gradually, and the prediction performance of the model gradually improves. In order to control the convergence and computing resource consumption of the optimization process, the computer system usually sets some cutoff conditions to determine when to stop the iteration. These cutoff conditions may include the debugging error falling below a certain threshold, the number of iterations reaching a preset upper limit, the verification set error starting to rise (indicating overfitting), etc. When any of these cutoff conditions is met, the optimization process stops, and the model parameters obtained at this time are the optimal or near-optimal parameter settings.
[0074] As an implementation mode, the characterization information extraction component includes a joint focus projection module, a cross-layer identity connection and standardization module, and a multi-layer perceptron module; based on this, step S57, according to the first network debugging error, optimizes the component parameters of the pre-debugging characterization information extraction component and the traffic estimation component, including:
[0075] Step S571: Fixing the component parameters of the joint focus projection module and the multi-layer perceptron module.
[0076] Step S571 involves fixing the component parameters of the joint focus projection module and the multi-layer perceptron module during the model training process. The execution of this step is intended to maintain the good performance of these modules that have been obtained in the early debugging stage, while concentrating resources to optimize other modules that may need more adjustment to achieve the best overall model performance. Specifically, the computer system identifies the joint focus projection module and the multi-layer perceptron module in the representation information extraction component. The joint focus projection module is a parallel attention mechanism layer. As an implementation of the attention mechanism, it can process different position information in the input vector in parallel, capture the dependencies between them, and generate weighted feature representations. The multi-layer perceptron module is a neural network structure composed of multiple fully connected layers. It abstracts and integrates the input features through multiple layers of nonlinear transformations to extract higher-level feature representations. In ship flow prediction, the multi-layer perceptron module can further process the feature vector output by the joint focus projection module to provide richer and more effective information for subsequent flow estimation.
[0077] In step S571, the computer system chooses to fix the component parameters of these two modules, which means that in the subsequent model optimization process, the parameters of these two modules will no longer be updated. This decision is based on multiple considerations: first, these two modules may have obtained relatively stable parameter settings through a large amount of data training in the early pre-debugging stage, and these parameters can guarantee the performance of the modules to a certain extent; second, fixing these parameters can reduce the number of variables in the model optimization process, reduce computational complexity, and improve optimization efficiency; finally, fixing these modules can also avoid unstable factors that may be introduced due to large changes in parameters during the optimization process, which helps to maintain the stability of the model.
[0078] When the computer system executes step S571, it first checks and confirms the current parameter status of the joint focus projection module and the multi-layer perceptron module, and then fixes these parameters. In the subsequent model optimization process, the computer system will focus on the parameter adjustment of other modules (such as flow estimation components, cross-layer constant connections and standardization modules, etc.), in order to further improve the prediction accuracy of the overall model while maintaining the stability of the performance of these two modules. Through this strategy, the computer system can use computing resources more efficiently, accelerate the model optimization process, and provide more accurate and reliable ship flow prediction results for port management departments.
[0079] Step S572: Optimize component parameters of the traffic estimation component and the cross-layer constant connection and standardization module according to the first network debugging error.
[0080] Step S572 optimizes and adjusts the component parameters of the flow estimation component and the cross-layer identical connection and standardization module according to the first network debugging error. The execution of this step is intended to improve the prediction performance of the model by reducing the error between the prediction result and the actual observation, so that it can more accurately estimate the future ship flow. Specifically, the computer system obtains the first network debugging error, which is calculated by comparing the estimated ship flow data output by the flow estimation component with the actual ship flow data of the next monitoring period. The size of the error value directly reflects the prediction accuracy of the model under the current parameter setting, and is an important basis for subsequent optimization and adjustment. Next, the computer system will focus on the flow estimation component and the cross-layer identical connection and standardization module. The flow estimation component is one of the core parts of the model. It is responsible for estimating the future ship flow based on the representation vector output by the representation information extraction component. In this step, the computer system uses an appropriate optimization algorithm (such as gradient descent method, Adam optimizer, etc.) to adjust the parameters of the flow estimation component according to the first network debugging error, in order to reduce the error and improve the prediction accuracy.
[0081] At the same time, cross-layer identity connections and standardization modules are also important objects in the optimization process. Cross-layer identity connections help alleviate the gradient vanishing problem in deep networks by directly skipping certain layers to transmit information, allowing the network to learn features more deeply and more effectively. The standardization operation accelerates the training process and improves model stability by normalizing the feature vectors. In this step, the computer system also adjusts the parameters of these modules based on the first network debugging error to ensure that they can effectively support the optimization of the traffic valuation component.
[0082] When the computer system executes step S572, it first calculates the first network debugging error, and then uses an optimization algorithm such as a gradient descent method to adjust the parameters of the traffic estimation component and the cross-layer constant connection and normalization module according to the size and direction of the error value. During the adjustment process, the computer system can iteratively calculate the error and update the parameters multiple times until the error value drops below a certain threshold or meets other preset stop conditions.
[0083] Through the optimization and adjustment of this step, the computer system can gradually reduce the error between the prediction results and the actual observations, and improve the prediction performance of the model. The optimized model will be able to more accurately estimate future ship traffic, provide more reliable data support for port management departments, and help them better plan berth resources and optimize ship scheduling plans. At the same time, this optimization process also helps to improve the generalization ability of the model, so that it can adapt to ship traffic prediction tasks in different ports and different time periods.
[0084] As an implementation mode, step S30, based on the video frame image stream corresponding to the port monitoring video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample, and the prior label of the first learning sample, pre-debugging the representation information extraction component may specifically include:
[0085] Step S31: embedding and mapping the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, wherein the representation vector of each video frame in the set of video frame embedding representation vectors is obtained by integrating the embedding mapping representation vector and the distribution embedding mapping representation vector of the video frame.
[0086] Step S31 involves performing in-depth embedding mapping processing on the video frame image stream in the port surveillance video learning sample to extract key feature information in the video frame and convert it into a representation vector form that can be understood and processed by the machine learning model.
[0087] Specifically, the computer system reads each frame of the video frame image stream. These images exist in the form of a two-dimensional array (or matrix), and each element in the array represents the color or brightness value of the corresponding pixel in the image. In order to convert these original pixel values into representation vectors, the computer system needs to adopt an effective embedding mapping method. In the field of machine learning, convolutional neural network (CNN) is one of the commonly used models for processing image data. CNN can automatically extract hierarchical feature representations from images through structures such as convolutional layers and pooling layers. Therefore, in step S31, the computer system can use a pre-trained CNN model (such as VGG, ResNet, etc.) to embed and map the video frame images.
[0088] The CNN model performs multiple layers of convolution and pooling operations on each frame of the image, gradually extracting low-level features (such as edges and textures) and high-level features (such as shapes and objects) in the image. After each layer of processing, the image is converted into a feature map, which contains the representation of the image in the feature space of that layer. Finally, the feature map after multiple layers of processing will be flattened or pooled into a vector of a fixed length, which is the embedding mapping representation vector of the video frame.
[0089] In addition to the embedding mapping representation vector, in order to introduce time or spatial position information, the computer system will also perform distributed embedding mapping (such as position encoding) on the video frame. Position encoding is a technology that encodes position information into a feature vector, which can help the model understand the relative relationship between different positions. In the scene of video frames, position encoding may include timestamp encoding (used to indicate the position of the video frame in the time series) and spatial position encoding (used to indicate the position of different areas in the image). These encoding vectors are integrated with the embedding mapping representation vector to form a complete representation vector for each video frame. Finally, the computer system combines the representation vectors of all video frames into a set of video frame embedding representation vectors. This set is a feature sequence composed of features from multiple images. It retains the key information in the video frame image stream while removing redundancy and noise, providing strong data support for subsequent representation information extraction and traffic prediction.
[0090] Step S32: embedding and mapping the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream, wherein the characterization vector of each ship AIS data subset in the set of ship AIS data characterization vectors is obtained by integrating the embedding mapping characterization vector and the distribution embedding mapping characterization vector of the ship AIS data subset.
[0091] Step S32 focuses on embedding and mapping the ship AIS data stream so as to convert the original AIS data into a feature vector form that can be effectively used by the machine learning model. This process not only helps to extract key information about ship dynamics, but also provides basic data support for subsequent traffic prediction. In the field of ship traffic monitoring, the ship automatic identification system (AIS) is a widely used technology that can send key information such as the position, speed, heading, and ship type of the ship in real time. These AIS data usually exist in the form of time series, recording the state changes of the ship at different time points. However, the original AIS data contains a large amount of discrete numerical values and text information, and directly using it in the machine learning model may face problems such as high feature dimension and sparse data. Therefore, step S32 converts these raw data into a more compact and expressive representation vector by embedding mapping. Specifically, the computer system reads the ship AIS data stream, which contains multiple ship AIS data subsets, each of which corresponds to the ship status information at a time node. The data items in each subset may include the ship's unique identification code (such as MMSI code), latitude and longitude coordinates, speed, heading, ship type, etc. In order to embed and map these data, computer systems can use a variety of methods. A common method is to use word embedding technology. Although AIS data is not text data in the traditional sense, the idea of word embedding is also applicable to processing discrete numerical and categorical features. For example, the computer system can treat each data item (such as ship type) as a "word" and use an algorithm similar to Word2Vec or GloVe to train an embedding matrix that maps each "word" to a vector space of fixed length. However, in the scenario of ship traffic prediction, more complex embedding mapping methods may be more applicable. For example, the computer system can use recurrent neural networks (RNN) or their variants (such as LSTM, GRU) to process time series data in AIS data streams. These models can capture the temporal dependencies in the data and generate an embedding mapping representation vector for each time node. In this process, the computer system takes the AIS data subset at each time node as input, processes it through the hidden layer of the RNN model, and obtains the representation vector of the time node.
[0092] In addition to the embedding mapping representation vector, in order to introduce time position information, the computer system will also perform distributed embedding mapping (such as time position coding) on the ship AIS data stream. Time position coding is a technique that encodes time information into a feature vector, which helps the model understand the relative relationship between different time nodes. In the case of AIS data, time position coding may include timestamp coding (used to indicate the position of a data subset in a time series), etc. These encoding vectors are integrated with the embedding mapping representation vector to form a complete representation vector for each ship AIS data subset.
[0093] Finally, the computer system combines the representation vectors of all ship AIS data subsets into a set of ship AIS data representation vectors. This set is a feature sequence consisting of ship status features at multiple time nodes. It not only contains the ship's dynamic information (such as changes in position, speed, and heading), but also incorporates time and position information. Through this set of representation vectors, the computer system can more comprehensively understand the ship activities in the AIS data stream, providing strong data support for subsequent representation information extraction and traffic prediction.
[0094] Step S33: extracting representation information from the video frame embedded representation vector set through the representation information extraction component to obtain a video frame representation vector.
[0095] In step S33, the computer system uses a well-designed representation information extraction component to perform deep feature extraction and integration on the video frame embedded representation vector set to obtain a more representative video frame representation vector. This process not only helps to reduce redundant information, but also enhances the model's sensitivity to ship flow-related features, thereby improving the accuracy of prediction. Specifically, the video frame embedded representation vector set is obtained by embedding and mapping the video frame image stream in the port monitoring video learning sample in step S31, and it contains the key feature information of each frame in the video. However, these embedded representation vectors are still in a relatively primitive state. They may contain a large amount of information that is not directly related to ship flow prediction, or some key features are not represented significantly enough in the vector. Therefore, these vectors need to be further processed by the representation information extraction component. The representation information extraction component may be a complex deep learning model that combines multiple technologies such as convolutional neural network (CNN), recurrent neural network (RNN), and attention mechanism, aiming to extract high-level features useful for ship flow prediction from the input video frame embedded representation vector. These features may include the number, type, location distribution, movement trajectory, etc. of ships, which together constitute a comprehensive view of the port ship activities.
[0096] In practical applications, the computer system passes the video frame embedding representation vector set as input to the representation information extraction component. The multi-layer network structure inside the component processes these vectors layer by layer, and each layer extracts more abstract and advanced feature representations through operations such as convolution, pooling, and activation. As the processing deepens, the redundant information in the original embedding representation vector is gradually filtered out, while the key features are strengthened and integrated. In the process of representation information extraction, the attention mechanism plays an important role. It allows the model to dynamically adjust the degree of attention to different areas when processing video frames, so that the model can focus more on those areas that have an important impact on ship flow prediction (such as channel intersections, near berths, etc.). By allocating attention weights, the model can generate more accurate and meaningful video frame representation vectors.
[0097] Finally, after being processed by the representation information extraction component, the computer system obtains the video frame representation vector. This vector is a highly abstract and generalized representation vector embedded in the original video frame. It contains the key feature information required for ship flow prediction and removes a lot of redundancy and noise. This representation vector will be used as the input of the subsequent flow estimation component to further predict future ship flow.
[0098] Step S34: extracting the representation information of the ship AIS data representation vector set through the representation information extraction component to obtain the ship AIS data representation vector.
[0099] In step S34, the computer system uses the representation information extraction component to conduct an in-depth analysis of the ship AIS data representation vector set, aiming to extract high-level features that play a decisive role in ship traffic prediction from the complex AIS data stream, and finally form a more compact and information-rich ship AIS data representation vector.
[0100] The set of ship AIS data representation vectors is obtained by processing the original AIS data stream through the embedding mapping technology. This set contains the feature vectors of the ship AIS data subsets at multiple time nodes, and each feature vector captures the multi-dimensional information such as the position, speed, heading, type, etc. of the ship at a specific time point. However, although these feature vectors are detailed, they may still contain redundant information, and the contribution of different features to traffic prediction is not the same. In order to solve this problem, step S34 introduces a representation information extraction component. This component is a carefully designed machine learning model that may combine a variety of network architectures (such as RNN, LSTM, Transformer, etc.) and feature extraction techniques to achieve efficient processing of the AIS data representation vector set. Specifically, the component receives the ship AIS data representation vector set as input and performs feature transformation and abstraction operations on it layer by layer. During the feature transformation process, the component can use structures such as convolutional layers and pooling layers to capture local patterns and spatial relationships in the data. At the same time, since AIS data has obvious time series characteristics, the component also uses recurrent neural networks (such as LSTM) to model the time dependencies in the data to ensure that the model can capture the continuous changes in the ship's status over time.
[0101] In addition, the attention mechanism also plays an important role in this step. By introducing the attention mechanism, the component can dynamically adjust the importance weights of different features when processing AIS data, so that the model can focus more on those features that are most critical to ship flow prediction. This mechanism not only improves the interpretability of the model, but also helps to improve the accuracy of the prediction. After multi-layer network processing and feature extraction, the representation information extraction component will eventually output a ship AIS data representation vector. This vector is a highly generalized and abstract set of original AIS data representation vectors. It removes redundant information, retains key features, and exists in a more compact and easy-to-process form. This representation vector not only contains the status information of the ship at the current point in time, but also implies the potential change trends and laws of ship flow, providing strong data support for subsequent flow estimation.
[0102] Taking a section of AIS data stream of a port as an example, in step S34, the computer system conducts an in-depth analysis of the characterization vector set of the data stream through the characterization information extraction component. The component successfully extracts key features such as the number of ships, type distribution, and moving speed from complex data using technical means such as recurrent neural networks and attention mechanisms, and forms a corresponding ship AIS data characterization vector. This vector accurately reflects the activities of ships in the port and provides a reliable basis for subsequent traffic prediction.
[0103] Step S35: obtaining a second network debugging error based on the video frame representation vector, the ship AIS data representation vector and the priori label of the first learning example.
[0104] In step S35, the computer system uses the video frame representation vector, the ship AIS data representation vector and the prior label of the first learning sample to calculate the second network debugging error by comparing the difference between the model prediction result and the real label. This error value not only reflects the ability of the current model in feature extraction and association matching, but also provides an important basis for subsequent parameter adjustment and optimization.
[0105] Specifically, the video frame representation vector and the ship AIS data representation vector are extracted from the video frame image stream and the ship AIS data stream respectively through steps S33 and S34, and each of them contains rich information related to ship traffic. The prior label of the first learning example clearly indicates which video frames correspond to which AIS data subsets, that is, they describe the ship activities in the port in the same time period. These prior labels are supervisory signals in the model training process, which are used to guide the model to learn the correct feature association pattern.
[0106] To obtain the second network debugging error, the computer system first needs to match the video frame representation vector with the corresponding ship AIS data representation vector. This matching process may involve a variety of strategies, such as similarity calculation based on distance measurement, dynamic matching based on attention mechanism, etc. After the matching is completed, the computer system checks whether the matching results predicted by the model are correct based on the prior mark, that is, whether the model successfully associates the video frames describing the ship activities in the same time period with the AIS data subset. Next, the computer system calculates the number of errors or the size of the errors in all matching results to quantify the difference between the model prediction and the actual situation. This error calculation process may use a variety of indicators, such as accuracy, recall, F1 score, mean square error, etc., and the specific selection depends on the task requirements and model characteristics. Taking accuracy as an example, the computer system can calculate the proportion of the number of correctly matched samples to the total number of samples as one aspect of evaluating the performance of the model. In addition to directly calculating the matching error, the computer system can further analyze the source and distribution of the error. For example, the computer system can check which types of ships, which time periods, which port areas, etc., the model has poor prediction performance, so as to optimize the model in a targeted manner later. This error analysis helps to gain a deeper understanding of the model’s limitations and room for improvement, providing strong support for the model’s continuous improvement.
[0107] Step S36: Optimizing component parameters of the characterization information extraction component based on the second network debugging error until the pre-debugging cutoff requirement is met.
[0108] Step S36 involves optimizing and adjusting the component parameters of the characterization information extraction component according to the second network debugging error, in order to improve the performance of the model and meet the cut-off requirements of the pre-debugging. In this step, the computer system plays a core role, and it continuously adjusts the internal parameters of the model through iterative optimization strategies to minimize the debugging error and improve the accuracy and robustness of the model.
[0109] Specifically, the computer system receives the second network debugging error calculated in step S35 as the optimization target. This error value reflects the performance of the current characterization information extraction component in extracting video frames and ship AIS data features and performing correlation matching. If the error is large, it means that the model is insufficient in feature extraction or correlation matching and needs further adjustment. In order to optimize the component parameters of the characterization information extraction component, the computer system usually adopts one or more optimization algorithms. These algorithms may include gradient descent methods (such as SGD, Adam, etc.), Newton methods, quasi-Newton methods, etc., which guide the update direction of parameters by calculating the gradient or approximate gradient of the error function with respect to the model parameters. In practical applications, since the characterization information extraction component is often a complex deep learning model containing a large number of network layers and parameters, the optimization process can be very time-consuming and computationally intensive. During the optimization process, the computer system calculates the gradient value of each parameter based on the current network debugging error, and determines the update amount of the parameter based on the optimization algorithm. Then, the computer system applies the update amount to the parameter, generates a new parameter value, and retrains the model to evaluate the performance under the new parameter setting. This process will be repeated for multiple iterations, and each iteration will generate a new network debugging error value. If the error value is gradually decreasing, it means that the optimization direction is correct, and the computer system continues to optimize in this direction; if the error value begins to increase or fluctuate, it means that it may be trapped in a local optimal solution or the parameter update step size is too large. At this time, the system can adjust the hyperparameters of the optimization algorithm (such as learning rate, momentum, etc.), or adopt strategies such as early stopping to avoid overfitting.
[0110] The optimization process will continue until the cutoff requirements of the pre-debugging are met. These cutoff requirements may include the network debugging error falling below a certain threshold, the number of iterations reaching a preset upper limit, the validation set error starting to rise (indicating overfitting), etc. When one of these conditions is met, the optimization process will stop, and the parameter settings of the representation information extraction component obtained at this time are optimal or near-optimal, and can be used in subsequent model training and prediction tasks.
[0111] As an implementation manner, step S31, embedding mapping is performed on the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, which may specifically include:
[0112] Step S311: performing distribution feature embedding mapping on each video frame in the video frame image stream to obtain a distribution embedding mapping representation vector of each video frame.
[0113] Step S311 uses the distributed feature embedding mapping technology to encode the distribution features such as the position or timestamp of the video frame in the sequence into a vector form, so that the subsequent machine learning model can understand and use this information. In step S311, the computer system performs distributed feature embedding mapping on each frame in the video frame image stream. Specifically, the computer system generates a distribution embedding mapping representation vector based on the position of the video frame in the time sequence (such as frame index, timestamp, etc.) or spatial layout (such as the position of the frame in the video picture, although the time position is more critical in ship traffic prediction). In order to achieve this mapping process, the computer system can use a variety of encoding methods. A common method is positional encoding, which is achieved by encoding the position information into different dimensions in the vector. For example, the computer system can use a combination of sine and cosine functions to generate a unique encoding vector for each position, which has certain geometric properties in the vector space and can reflect the relative relationship between positions.
[0114] In the scenario of ship flow prediction, it is assumed that the video frame image stream records the ship activities in a port within one day, and there are 24 hours of video data, and one frame is extracted every hour as a representative. In step S311, the computer system will generate a distribution embedding mapping representation vector for each of the 24 frames of video. These vectors not only contain the index information of the video frame (such as the 1st frame, the 2nd frame... the 24th frame), but also may imply temporal continuity (such as the vectors of adjacent frames are close in the vector space).
[0115] Taking the first frame of video as an example, its distribution embedding mapping representation vector may be an array of length N (N is the vector dimension), and each element in the array is a sine or cosine value calculated based on the frame index and timestamp. This vector will serve as an additional feature of the video frame, together with the visual feature vector extracted in the subsequent steps, to describe the ship activity information contained in the frame.
[0116] Through the processing of step S311, the computer system successfully assigns distribution feature information to each frame in the video frame image stream and encodes this information into a vector form that is easy for the model to process. These distribution embedding mapping representation vectors will serve as the basis for feature extraction and association matching in subsequent steps, which will help improve the accuracy and robustness of ship flow prediction.
[0117] Step S312: Perform feature embedding mapping on each video frame in the video frame image stream to obtain an embedding mapping representation vector for each video frame.
[0118] Step S312 extracts the key features of each frame image from the video frame image stream and converts these features into embedded mapping representation vectors to facilitate further processing and analysis by subsequent machine learning models.
[0119] In order to achieve feature embedding mapping, the computer system uses deep learning models, especially convolutional neural networks (CNNs), to process video frame images. CNNs perform sliding convolution operations on images through multi-layer convolution kernels to automatically extract hierarchical features in images. These features are gradually abstracted from low-level edges and textures to high-level shapes and objects, providing a rich information basis for subsequent traffic prediction.
[0120] In step S312, the computer system inputs each frame of the video frame image stream into the pre-trained CNN model. The model performs multi-layer convolution, pooling, activation and other operations on the image to gradually extract the key features in the image. As the processing deepens, the image data is converted into a series of feature maps that capture different aspects of the image at different levels.
[0121] In order to obtain an embedded mapping representation vector of fixed length, computer systems usually add a global average pooling layer (GAP) or a fully connected layer (FC) to the last few layers of the CNN model. The global average pooling layer performs an average pooling operation on the feature map in the spatial dimension to obtain a vector with the same number of channels as the feature map; while the fully connected layer directly flattens the feature map and obtains a vector of fixed length through linear transformation. Regardless of which method is used, the final embedded mapping representation vector contains the key feature information in the image and has a low dimension, which is convenient for subsequent processing.
[0122] Taking a surveillance video of a port as an example, in step S312, the computer system uses the CNN model to perform feature embedding mapping on each frame of the video frame image stream. Assuming that the CNN model outputs multiple feature maps after multi-layer processing, the computer system then processes these feature maps using a global average pooling layer to obtain an embedding mapping representation vector with a length of 128. This vector not only contains visual feature information such as the shape, size, and color of the ship, but also captures the relative position relationship between the ships and their dynamic change patterns in the time series through the automatic learning mechanism of the CNN model. These feature information will provide strong data support for subsequent ship traffic prediction.
[0123] Step S313: For each video frame in the video frame image stream, the distribution embedding mapping representation vector of the video frame and the embedding mapping representation vector are integrated to obtain a representation vector of the video frame.
[0124] In step S313, the computer system integrates the distribution embedding map representation vector of the video frame (including the position information of the video frame in the time series or spatial layout) with the embedding map representation vector (including the visual feature information in the video frame), thereby obtaining a comprehensive representation vector that contains both position information and visual content. In step S313, the computer system performs an integration operation on each video frame in the video frame image stream. Specifically, it merges the distribution embedding map representation vector and the embedding map representation vector of each video frame. This merging can be achieved by simple concatenation, that is, connecting the two vectors end to end to form a longer vector. For example, if the length of the distribution embedding map representation vector is M and the length of the embedding map representation vector is N, then the length of the integrated video frame representation vector will be M+N. The integrated video frame representation vector not only contains the position information of the video frame in the time series (such as timestamp, frame index, etc.), but also contains rich visual feature information (such as the shape, size, color, etc. of the ship). This comprehensive representation vector enables subsequent machine learning models to take into account both the temporal and spatial positions of the video frames as well as their content characteristics, thereby more accurately understanding the dynamic changing patterns of the ship.
[0125] Taking a surveillance video of a port as an example, assuming that there are 100 frames in the video frame image stream, each frame is processed through steps S311 and S312 to obtain the corresponding distribution embedding mapping representation vector and embedding mapping representation vector. In step S313, the computer system performs an integration operation on each frame. Assuming that the length of the distribution embedding mapping representation vector is 16 (for example, obtained by encoding through sine and cosine functions), and the length of the embedding mapping representation vector is 256 (for example, obtained by extracting through a convolutional neural network), the length of the integrated video frame representation vector will be 16+256=272. In this way, each video frame is converted into a comprehensive representation vector with a length of 272. These vectors together constitute a feature sequence describing the activity of port ships, providing strong data support for subsequent ship flow predictions.
[0126] Step S314: merging the representation vectors of multiple video frames according to the distribution information of the video frames in the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream.
[0127] Step S314 is a key step to integrate the video frame representation vectors and form the overall representation of the video frame image stream. Through this step, the computer system merges multiple individual video frame representation vectors into an ordered set, namely, a video frame embedded representation vector set, according to the distribution information of the video frames in the video frame image stream (such as time sequence or frame index). This set not only retains the key feature information of each video frame, but also reflects the temporal or spatial relationship between video frames, providing comprehensive data support for subsequent feature extraction and traffic prediction. Specifically, it is assumed that the port monitoring video is divided into a series of video frames, and each frame is processed through the previous steps to obtain its own representation vector. These representation vectors contain visual features such as the shape, size, and color of the ship in the video frame, as well as the position information of the frame in the time series. The task of step S314 is to merge these individual representation vectors according to their original order in the video frame image stream. The merging process is relatively intuitive. The computer system traverses each frame in the video frame image stream and adds its corresponding representation vector to a new set in turn. Each element of this set is a representation vector of a video frame, and the set itself is arranged in the original order of the video frames, thereby preserving the temporal or spatial continuity between the video frames. Taking a surveillance video of a port as an example, assume that the video is divided into 100 frames, and each frame is processed by the previous steps to obtain a representation vector of length 256 (this is only an example, and the actual length may vary depending on the specific implementation). In step S314, the computer system merges these 100 representation vectors into a two-dimensional array of shape (100, 256) in the time sequence of the video frames, that is, the video frame embedded representation vector set. The first row of this set corresponds to the representation vector of the first frame of the video, the second row corresponds to the representation vector of the second frame, and so on, until the last row corresponds to the representation vector of the 100th frame of the video. Through the processing of step S314, the computer system successfully merges multiple video frame representation vectors in the video frame image stream into an ordered set. This collection not only facilitates batch processing and analysis by subsequent machine learning models, but also provides a more comprehensive and accurate data basis for ship traffic prediction by preserving the temporal or spatial relationship between video frames.
[0128] Step S32, embedding and mapping the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream, which may specifically include:
[0129] Step S321: performing distribution feature embedding mapping on each ship AIS data subset in the ship AIS data stream, and obtaining a distribution embedding mapping representation vector of each ship AIS data subset.
[0130] Step S321 performs distributed feature embedding mapping on each data subset in the ship AIS data stream to capture and encode the location information of these subsets in the time series or data series. In ship traffic monitoring, AIS (Automatic Identification System) data records key information such as the ship's position, speed, and heading in real time. These data usually exist in the form of a time series, and each time point corresponds to a data subset, which contains the status information of all visible ships at that moment. However, the original AIS data only contains discrete timestamps and status values, and lacks features that directly express the relative position or time interval between data subsets. Therefore, step S321 generates an embedded representation vector containing distribution feature information for each data subset through distributed feature embedding mapping technology.
[0131] In computer systems, this step is usually implemented through encoding algorithms. These algorithms can convert timestamps, intervals of data records, or other distribution characteristics into vector form, allowing the model to understand and use this information. A common practice is positional encoding, which uses a combination of sine and cosine functions to generate a unique encoding vector for each location. However, in the case of AIS data, due to the clear time series characteristics of the data, it is more likely to use a timestamp-based encoding method.
[0132] Specifically, the computer system processes each data subset in the ship's AIS data stream. For each subset, the computer system first extracts its timestamp information, and then calculates a distribution embedding mapping representation vector based on the timestamp. This vector may be an array of fixed length, each element of which is calculated by a certain function (such as a timestamp-based hash function, a timestamp-to-vector mapping function, etc.) to reflect the position of the data subset in the time series. Taking a section of AIS data stream of a port as an example, it is assumed that the data stream contains data subsets at multiple consecutive time points, and each subset records the position, speed and other information of multiple ships at that moment. In step S321, the computer system performs distribution feature embedding mapping on each data subset. Assuming that the timestamp encoding function converts each timestamp into a vector of length 32, then for the first data subset in the data stream, its timestamp will be encoded as a 32-dimensional array; for the second data subset, its timestamp will also be encoded as a different 32-dimensional array, and so on. These encoded vectors not only contain the time information of the data subsets, but also implicitly express the relative position relationship between the data subsets through the different values of the vectors.
[0133] Through the processing of step S321, the computer system successfully generates a distribution embedding mapping representation vector for each data subset in the ship AIS data stream. These vectors, as an important feature of the data subset, will be used in subsequent feature extraction and flow prediction tasks, helping the model to more accurately understand the dynamic change pattern of AIS data.
[0134] Step S322: performing feature embedding mapping on each ship AIS data subset in the ship AIS data stream, and obtaining an embedding mapping representation vector of each ship AIS data subset.
[0135] Step S322 aims to extract key information from the AIS data subset, such as the position, speed, and heading of the ship, and encode this information into a vector form that is convenient for the machine learning model to process. For example, in the ship automatic identification system (AIS), each data subset usually contains the status information of multiple ships at the same time point, such as MMSI code (ship unique identification code), longitude, latitude, speed, heading, etc. This information is crucial to understanding the dynamic behavior patterns of ships, but the original AIS data format is not directly applicable to most machine learning models. Therefore, step S322 converts the AIS data subset into an embedded mapping representation vector through feature embedding mapping technology for subsequent feature extraction and traffic prediction.
[0136] In computer systems, feature embedding mapping is usually implemented through machine learning models, especially those that can process structured data. For AIS data, since each data subset contains features of multiple dimensions, a fully connected layer (FC) or feature engineering combined with an embedding layer can be used to perform feature embedding mapping.
[0137] Specifically, the computer system traverses and processes each data subset in the ship AIS data stream. For each data subset, the computer system extracts feature information, such as the ship's MMSI code, location (latitude and longitude), speed, heading, etc. Then, according to the type and number of features, the corresponding feature embedding mapping scheme is designed. For continuous features (such as speed and heading), the computer system can directly normalize or standardize them as part of the embedding mapping. For discrete features (such as MMSI codes), the computer system can use an embedding layer to convert them into a fixed-length vector representation. The embedding layer generates a unique vector representation for each MMSI code by learning the similarity relationship between different MMSI codes, thereby capturing the potential association between ships. In the feature embedding mapping process, the computer system can also use some nonlinear transformations (such as activation functions) to increase the expressive power of the model. Finally, after the feature embedding mapping process, each AIS data subset is converted into a fixed-length embedding mapping representation vector.
[0138] In step S322, the computer system performs feature embedding mapping on these data subsets. For each ship's MMSI code, the computer system converts it into a vector representation of length 64 through the embedding layer; for continuous features such as the ship's position, speed, and heading, the computer system directly normalizes them as part of the vector. Finally, each data subset is converted into an embedding mapping representation vector with a length of hundreds (depending on the number of features and the length of the embedding vector), and these vectors together constitute a feature space describing the activities of port ships. Through the processing of step S322, the computer system successfully converts the original AIS data subset into an embedding mapping representation vector in a high-dimensional feature space. These vectors not only retain the key information in the original data, but also introduce additional semantic and structural information through the embedding mapping technology, providing strong data support for subsequent feature extraction and traffic prediction.
[0139] Step S323: For each ship AIS data subset in the ship AIS data stream, the distribution embedding mapping characterization vector of the ship AIS data subset and the embedding mapping characterization vector are integrated to obtain a characterization vector of the ship AIS data subset.
[0140] In step S323, the computer system integrates the distribution embedding mapping representation vector of each data subset (including the position information of the data subset in the time series) with the embedding mapping representation vector (including the specific status information of the ship in the data subset) to generate a representation vector that fully describes the data subset. The following is a detailed explanation of step S323, which is expanded in conjunction with a specific application scenario: In the data stream of the ship automatic identification system (AIS), each data subset not only records the status information (such as position, speed, heading, etc.) of multiple ships at the same time point, but also implies the relative position of these status information in the time series. Steps S321 and S322 extract and encode this information into vector form through distribution feature embedding mapping and feature embedding mapping technology respectively. However, in order for the subsequent machine learning model to fully understand the content of each data subset, these two vectors need to be integrated.
[0141] In step S323, the computer system performs an integration operation on each data subset in the ship AIS data stream. Specifically, it merges the distribution embedding mapping representation vector and the embedding mapping representation vector of each data subset. This merging is usually achieved by simple concatenation, that is, connecting the two vectors end to end to form a longer vector. This integration method not only retains the position information of the data subset in the time series, but also includes the specific status information of the ship in the data subset, so that the subsequent machine learning model can take into account the characteristics of both time and space dimensions.
[0142] Through the integration operation in step S323, the computer system successfully generates a comprehensive characterization vector for each ship AIS data subset. These characterization vectors not only facilitate batch processing and analysis by subsequent machine learning models, but also provide richer and more accurate data support for ship flow prediction by considering the characteristics in both time and space dimensions.
[0143] Step S324: according to the distribution information of the ship AIS data subsets in the ship AIS data stream, the characterization vectors of the multiple ship AIS data subsets are merged to obtain a set of ship AIS data characterization vectors of the ship AIS data stream.
[0144] Through step S324, the computer system orderly merges the characterization vectors of the data subsets into a set, i.e., the ship AIS data characterization vector set, according to the distribution information (mainly the time sequence) of the data subsets in the AIS data stream. This set not only retains the key feature information of each data subset, but also reflects the time continuity between the data subsets, providing comprehensive data support for subsequent feature extraction and flow prediction.
[0145] Specifically, the ship AIS data stream is composed of a series of data subsets arranged in chronological order, and each data subset records the status information of multiple ships at a certain moment. After processing from steps S321 to S323, each data subset is converted into a characterization vector containing distribution characteristics and specific status characteristics. The task of step S324 is to merge these individual characterization vectors according to their original order in the AIS data stream. The merging process is relatively intuitive. The computer system traverses each data subset in the AIS data stream and adds its corresponding characterization vector to a new set in turn. Each element of this set is a characterization vector of a data subset, and the set itself is arranged in the original time order of the data subset, thereby retaining the time continuity between the data subsets.
[0146] Take a section of AIS data stream of a port as an example. Assume that the data stream contains data subsets of 10 consecutive time points. Each subset is processed through the previous steps to obtain a characterization vector of length 672 (this is only an example, and the actual length may vary depending on the specific implementation). In step S324, the computer system merges these 10 characterization vectors into a two-dimensional array of shape (10, 672) in chronological order, that is, a set of ship AIS data characterization vectors. The first row of this set corresponds to the characterization vector of the data subset at the first time point, the second row corresponds to the characterization vector of the data subset at the second time point, and so on, until the last row corresponds to the characterization vector of the data subset at the tenth time point.
[0147] Through the processing of step S324, the computer system successfully merges the representation vectors of multiple ship AIS data subsets into an ordered set. This set not only facilitates the subsequent machine learning model to perform batch processing and analysis, but also provides a more comprehensive and accurate data basis for ship flow prediction by retaining the temporal continuity between data subsets. In the subsequent steps, this set will be used as input data, key features will be further extracted through the feature extraction component, and ship flow will be predicted through the flow estimation component.
[0148] As an implementation manner, in step S31, before embedding and mapping the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, the method further includes:
[0149] Step S31a: performing a standardization operation on the pixel value of each pixel in each video frame to obtain a video frame image stream after the standardization operation, and performing embedding mapping on the video frame image stream after the standardization operation.
[0150] Step S31a plays an important role in preprocessing the video frame image stream in the pre-debugging process of ship flow prediction. The purpose of this step is to eliminate the brightness and contrast differences in the video frame caused by factors such as lighting conditions and camera parameters through standardized operations, so that the subsequent feature extraction and embedding mapping process can be carried out on a more consistent and comparable data basis.
[0151] In the port surveillance video, each frame contains a large number of pictures (pixels), and each picture element has a corresponding picture element value, which usually represents the color or grayscale information of the image at that location. However, due to different factors such as shooting time, weather conditions, camera exposure settings, etc., there may be significant differences in visual characteristics such as brightness and contrast between different video frames. This difference will interfere with the subsequent feature extraction and embedding mapping process, affecting the accuracy and stability of the model. To solve this problem, step S31a introduces a standardization operation. In this step, the computer system traverses each frame of the video frame image stream and standardizes the pixel value of each picture element. The specific method of the standardization operation may vary depending on the application scenario, but generally includes the following steps:
[0152] Calculate global statistics: First, the computer system can calculate global statistics for the entire video frame image stream or a specific subset, such as mean, standard deviation, etc. These statistics are used for subsequent standardization calculations.
[0153] Pixel-by-pixel normalization: Next, the computer system normalizes each pixel in each frame of the image. This is usually done by subtracting the global mean from the pixel value and then dividing it by the global standard deviation (or a fixed scaling factor) to get a normalized pixel value. This value is usually distributed between -1 and 1 (depending on the specific normalization method), eliminating the scale differences between the original pixel values.
[0154] For example, suppose the original value of a pixel is 200 (within the grayscale range of 0-255), the global mean is 128, and the global standard deviation is 50. After standardization, the value of the pixel may become (200-128) / 50=1.44 (here, for simplicity of explanation, no strict range restriction is imposed).
[0155] Generate a standardized video frame image stream: After pixel-by-pixel standardization, the computer system obtains a new video frame image stream, in which the pixel values of each frame image have been standardized. This new video frame image stream will serve as input data for the subsequent embedding mapping step.
[0156] Through the standardized operation of step S31a, the computer system successfully minimizes the differences in visual characteristics such as brightness and contrast in the video frame image stream, making the data between different video frames more consistent and comparable. This preprocessing method helps to improve the accuracy and stability of subsequent feature extraction and embedding mapping processes, thereby improving the performance of ship flow prediction.
[0157] In step S32, before embedding and mapping the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream, the method further includes:
[0158] Step S32a: Perform quantization mapping operations on the data items in each ship AIS data subset to obtain a data item vector.
[0159] The purpose of step S32a is to convert the discrete data items in the ship AIS data subset into continuous and semantically rich data item vectors so that the subsequent machine learning model can better understand and utilize these data. This operation is similar to the word embedding technology in natural language processing, which captures the similarities and relationships between symbols by mapping discrete symbols to high-dimensional continuous space. Specifically, the ship AIS data subset contains multiple data items, such as the ship's MMSI code (unique identification code), location (latitude and longitude), speed, heading, etc. Although these data items have clear meanings for humans, they are just discrete symbols or values for machine learning models. In order for the model to capture the semantic information behind these symbols, such as the similarities between different ships, the behavior patterns of ships at different speeds and headings, etc., a quantitative mapping operation is required. In step S32a, the computer system quantizes and maps the data items in each ship AIS data subset. This process usually involves the following steps:
[0160] Define the embedding space: First, the computer system needs to define a high-dimensional continuous space to store the mapped data item vectors. The dimension of this space can be determined according to the specific task and the size of the data set, and is usually an integer much larger than the number of original data items.
[0161] Initialize the embedding matrix: Next, the computer system initializes an embedding matrix for each data item type (such as MMSI code, speed level, etc.). Each row of this matrix corresponds to a possible data item value, and each column represents a dimension in the embedding space. When initialized, the values in the matrix can be random or set based on some prior knowledge.
[0162] Mapping data items to embedding space: Then, for each data item in the ship AIS data subset, the computer system looks up the corresponding embedding matrix according to its type and maps the data item to a row in the embedding matrix (or a vector calculated in some way), thereby obtaining a data item vector. This vector is the representation of the data item in the embedding space, which contains the semantic information of the data item.
[0163] Update the embedding matrix (optional): In some cases, the computer system can update the embedding matrix based on the performance of subsequent tasks. This usually involves a training process in which the model tries to minimize a loss function while updating the values in the embedding matrix. However, in the pre-debugging stage of ship flow prediction, this step may be optional because the initialization of the embedding matrix is sufficient to provide valid input data for the subsequent feature extraction and embedding mapping steps.
[0164] Through the quantization mapping operation in step S32a, the computer system successfully converts the discrete data items in the ship AIS data subset into continuous data item vectors. These vectors not only retain the information of the original data items, but also introduce additional semantic and structural information through the embedding space, providing strong support for subsequent feature extraction and ship flow prediction.
[0165] Step S32b: performing a standardization operation on the data item vectors of the data items in each ship AIS data subset to obtain a ship AIS data stream after the standardization operation, so as to perform embedding mapping on the ship AIS data stream after the standardization operation.
[0166] In step S32a, the data items in each ship AIS data subset have been quantized and mapped into data item vectors, which contain the semantic information of the data items, but may still have the problem of inconsistent scales. The purpose of step S32b is to standardize these data item vectors so that they are consistent in numerical scale, providing more standardized and effective input data for the subsequent embedding mapping (encoding) process.
[0167] Specifically, each data subset in the ship AIS data stream contains multiple data item vectors, which represent key information such as the ship's MMSI code, position (latitude and longitude), speed, heading, etc. Since these data item vectors may come from different quantization mapping processes, or the original data itself has scale differences (such as the speed unit may be knots or kilometers per hour), it is necessary to standardize them before embedding mapping.
[0168] In step S32b, the computer system traverses all data item vectors in each ship AIS data subset and performs a standardization operation on each vector. This operation generally includes the following steps:
[0169] Calculate global or local statistics: First, the computer system needs to determine the statistics to be used for normalization. These statistics can be global (i.e. calculated based on the entire ship AIS data stream) or local (i.e. calculated based on the current data subset or a specific set of data items). Common statistics include mean and standard deviation.
[0170] Vector-by-vector normalization: Next, the computer system normalizes each data item vector. This is usually done by subtracting the mean from each element in the vector and dividing by the standard deviation (or a fixed scaling factor) to create a normalized vector. The values of this vector are usually distributed between -1 and 1 (or different depending on the specific normalization method), eliminating the scale differences between the original vectors.
[0171] For example, suppose a data item vector represents the speed of a ship, and its original element value is [10, 20, 30] (the unit may be knots), and the mean speed of the current data subset is 15 and the standard deviation is 5. After standardization, the element value of the vector may become [(10-15) / 5, (20-15) / 5, (30-15) / 5] = [-1, 1, 3].
[0172] Generate standardized ship AIS data stream: After vector-by-vector standardization, the computer system obtains a new ship AIS data stream, in which the data item vectors in each data subset have been standardized. This new data stream will serve as input data for the subsequent embedding mapping step. The embedding mapping in step S32b is different from the embedding mapping in steps S31 and S32 in that it refers more to further processing or encoding (if necessary) of the data item vectors that have been quantized, mapped and standardized in order to better meet the needs of the subsequent model. However, in practical applications, since the data item vectors have been mapped to a high-dimensional continuous space in step S32a, and the standardization operation in step S32b further standardizes the numerical scale of these vectors, the subsequent embedding mapping step is relatively simple or even unnecessary. Through the standardization operation in step S32b, the computer system successfully keeps the data item vectors in the ship AIS data stream consistent in numerical scale. This preprocessing method helps to improve the stability and efficiency of subsequent processing steps, and also helps the model better capture the potential patterns and laws in the data, thereby improving the accuracy of ship flow prediction.
[0173] As an implementation manner, step S35, based on the video frame representation vector, the ship AIS data representation vector and the prior label of the first learning example, obtains the second network debugging error, which may specifically include:
[0174] Step S351: performing a unification operation on the representation vector dimensions of the video frame representation vector and the ship AIS data representation vector to obtain a target ship AIS data representation vector and a target video frame representation vector having consistent dimensions.
[0175] Step S351 ensures that the video frame representation vector and the ship AIS data representation vector can be directly compared in the subsequent similarity measurement process. Since the two representation vectors may be obtained through different feature extraction and embedding mapping methods, their dimensions are often inconsistent, so a dimensionality unification operation is required. In a computer system, when processing a ship flow prediction task, corresponding representation vectors are generated for the video frame image stream and the ship AIS data stream respectively. The video frame representation vector usually contains key visual features in the image, such as the shape, size, and position of the ship, while the ship AIS data representation vector contains dynamic information such as the position, speed, and heading of the ship. However, the dimensions of the two representation vectors may vary depending on the extraction method. In order to accurately evaluate the similarity between the two representation vectors and predict the ship flow based on the similarity, the computer system needs to unify their dimensions first. This process involves a variety of technical methods, and the specific selection depends on the original dimension of the vector, the characteristics of the data, and the requirements of the task. A common dimensionality unification method is linear transformation, especially through a fully connected layer (FC). In this approach, a computer system can add an additional fully connected layer to a lower-dimensional representation vector, whose output dimension matches the dimension of another representation vector. By training this fully connected layer, the computer system can learn a mapping relationship that converts a low-dimensional vector into a high-dimensional vector while retaining or enhancing information that is useful for subsequent tasks.
[0176] However, in the scenario of ship traffic prediction, if the dimensions of the two representation vectors are not much different, or for the sake of computational efficiency, the computer system may also choose a simpler dimensionality unification method, such as truncation, padding, or scaling. For example, if the dimension of the video frame representation vector is slightly higher than that of the ship AIS data representation vector, the computer system may fill zero values or random noise at the end of the ship AIS data representation vector until its dimension is consistent with the video frame representation vector. On the contrary, if the dimension of the video frame representation vector is lower, the computer system may also truncate the ship AIS data representation vector to a suitable dimension, but this method may cause information loss, so it needs to be used with caution. For a specific example, assume that the dimension of the video frame representation vector is 256, and the dimension of the ship AIS data representation vector is 128. In order to unify the dimensions, the computer system may choose to fill 128 zero values at the end of the ship AIS data representation vector to generate a new target ship AIS data representation vector with a dimension of 256. In this way, the computer system obtains two representation vectors with consistent dimensions: the target ship AIS data representation vector and the target video frame representation vector, which can be directly used in the subsequent similarity measurement step. Through the dimensionality unification operation in step S351, the computer system lays a solid foundation for the subsequent ship flow prediction task, ensuring that the characterization vectors from different sources can be compared and analyzed on the same scale.
[0177] Step S352: Obtain the representation vector commonality measurement result between the target ship AIS data representation vector and the target video frame representation vector corresponding to the same first learning example.
[0178] In step S352, by calculating the commonality measurement results between the two representation vectors, the computer system can understand whether they have successfully captured the common characteristics of ship activities in the same time period, which is crucial for subsequent traffic prediction. The commonality measurement results are usually calculated by a similarity measurement function that can quantify the proximity of two vectors in the feature space. In the scenario of ship traffic prediction, commonly used similarity measurement functions include cosine similarity, Euclidean distance, Manhattan distance, etc. Among them, cosine similarity is preferred in many cases because it can ignore the length of the vector and only focus on the similarity in direction. In step S352, the computer system traverses all target ship AIS data representation vectors and target video frame representation vectors corresponding to the same first learning example. For each pair of vectors, the computer system applies the selected similarity measurement function to calculate the commonality measurement results between them.
[0179] Taking cosine similarity as an example, if the calculated cosine similarity value is high (for example, close to 1), it means that the target ship AIS data representation vector and the target video frame representation vector successfully capture the common characteristics of ship activities in the same time period, and the match between them is high. On the contrary, if the similarity value is low, it may indicate that there is a problem in the extraction process of the representation vector, or there is a large difference between the two data sources, which requires further analysis and optimization.
[0180] Through the calculation in step S352, the computer system obtains the commonality measurement results of the representation vectors of each pair of corresponding first learning samples. These results will serve as an important basis for evaluating the performance of the representation information extraction component in subsequent steps, which will help guide the optimization direction of the model and improve the accuracy of ship flow prediction.
[0181] Step S353: Based on the commonality measurement result of the representation vector and the prior label of the first learning example, a second network debugging error is obtained.
[0182] In step S353, by comparing the commonality measurement result of the representation vector with the prior label of the first learning example, the computer system can quantify the accuracy of the model in feature extraction and association matching, thereby obtaining the second network debugging error. This error value not only reflects the performance of the current model, but also provides an important basis for subsequent model optimization.
[0183] In a specific application scenario, the representation vector commonality measurement result is calculated by step S352, which measures the similarity between the target ship AIS data representation vector and the target video frame representation vector corresponding to the same first learning sample. The prior label clearly indicates which video frames correspond to which AIS data subsets, that is, they describe the ship activities in the port during the same time period. In step S353, the computer system traverses all first learning samples, and for each pair of samples, it obtains the corresponding representation vector commonality measurement result and prior label. Then, the computer system determines whether the representation vector commonality measurement result correctly reflects the correspondence between the video frame and the AIS data based on the prior label.
[0184] In order to quantify this correctness or error, the computer system usually defines a loss function. The loss function is a function used in machine learning to evaluate the difference between the model's predicted value and the true value. The smaller the value, the better the model performance. In step S353, the specific form of the loss function may vary depending on the task requirements and model characteristics, but common choices include mean square error (MSE), cross entropy loss, etc.
[0185] Taking mean square error as an example, assume that for a first learning example, the commonality measurement result of the representation vector is s (a value between 0 and 1, indicating similarity), and the prior label is a binary variable y (1 indicates that the video frame corresponds to the AIS data, and 0 indicates that it does not correspond). However, in practical applications, since the commonality measurement result of the representation vector does not directly give a binary judgment, but gives a similarity score, it is necessary to convert this score into a form that can be compared with the prior label. A simple method is to set a threshold (such as 0.5) and judge the similarity score higher than the threshold as corresponding (that is, predict 1), otherwise it is judged as non-corresponding (that is, predicted as 0). But a more common practice is to directly use the difference between the similarity score and the prior label to calculate the loss.
[0186] In most cases, since the commonality measurement result of the representation vector does not directly correspond to a binary classification problem (i.e., whether the video frame corresponds to the AIS data), it is more likely to treat this problem as a regression problem or a sorting problem. However, in order to conform to the description of this step and simplify the explanation, we can assume that there is a loss function that can quantify the difference between the commonality measurement result of the representation vector and the prior label. Finally, the computer system traverses all the first learning samples, calculates the loss value corresponding to each sample, and accumulates or averages these loss values to obtain the second network debugging error. This error value reflects the performance of the current model in correctly associating the video frame with the AIS data. If the error is large, it means that the model has problems in feature extraction or association matching, and further optimization and adjustment are required; if the error is small, it means that the model already has good performance. By continuously iteratively optimizing this debugging error value, the computer system can gradually improve the accuracy of the model, thereby providing more reliable support for subsequent ship traffic prediction.
[0187] As an implementation manner, step S353, based on the commonality measurement result of the representation vector and the prior label of the first learning example, obtains the second network debugging error, which may specifically include:
[0188] Step S3531: Determine the positive learning samples and the negative learning samples in the first learning samples of the same training group through the prior labels of each first learning sample, wherein the positive learning sample represents the first learning sample whose prior label indicates that the information of the ship AIS data learning sample is associated with the port surveillance video learning sample; the negative learning sample represents the first learning sample whose prior label indicates that the information of the ship AIS data learning sample is not associated with the port surveillance video learning sample.
[0189] In step S3531, the computer system uses the prior labeling information of the first learning sample to classify the learning samples in the same training batch, and distinguishes between positive learning samples (positive samples) in which there is information association between the ship AIS data learning samples and the port surveillance video learning samples and negative learning samples (negative samples) in which there is no information association.
[0190] In the task of ship flow prediction, the first learning sample library contains a large number of learning samples, each of which contains ship AIS data learning samples, port surveillance video learning samples and prior tags between them. These prior tags are manually annotated to indicate whether the AIS data and video data describe the ship activities in the port in the same time period. For example, if the prior tag of a sample is 1, it means that the AIS data and video data in the sample are associated, that is, they record the ship status of the port in the same time period; if the prior tag is 0, it means that they are not associated.
[0191] When training a model, in order to improve computing efficiency and memory utilization, batch processing is usually used, that is, multiple learning examples are combined into a training group (batch) for simultaneous processing. In step S3531, the computer system determines which first learning examples are included in the training group currently being processed.
[0192] Next, the computer system traverses these samples and checks their prior labels. For each sample, the computer system classifies it as a positive learning sample or a negative learning sample according to the value of its prior label. Specifically, if the prior label of a sample is 1, indicating that the AIS data and the video data are associated, then the sample is regarded as a positive learning sample; if the prior label is 0, indicating that the data is not associated, then the sample is regarded as a negative learning sample. For example: Assume that the training group currently being processed contains 10 first learning samples, and their prior labels are [1, 0, 1, 1, 0, 1, 0, 0, 1,1]. In step S3531, the computer system traverses these labels and classifies the samples according to their values. Finally, the computer system identifies the first three, fifth, sixth, and eighth samples as negative learning samples (because their prior labels are 0), and the remaining samples are positive learning samples (because their prior labels are 1).
[0193] Through this step, the computer system prepares the necessary data set for the subsequent performance evaluation step. In step S3532, the computer system will further use these positive learning samples and negative learning samples, combined with their corresponding representation vector commonality measurement results, to calculate the second network debugging error, thereby evaluating the performance of the representation information extraction component.
[0194] Step S3532: Determine the second network debugging error through the commonality measurement results of the representation vectors corresponding to the positive learning samples and the commonality measurement results of the representation vectors corresponding to the negative learning samples in the first learning samples of the same training group; wherein the second network debugging error is positively correlated with the commonality measurement results of the representation vectors corresponding to the positive learning samples; and the second network debugging error is negatively correlated with the commonality measurement results of the representation vectors corresponding to the negative learning samples.
[0195] In step S3532, the computer system uses the commonality measurement results of the representation vectors corresponding to the positive learning samples and the negative learning samples in the same training group to calculate the second network debugging error. In step S3532, the computer system processes the commonality measurement results of the representation vectors of the positive learning samples and the negative learning samples respectively. For the positive learning samples, since their AIS data and video data are associated, the system expects the commonality measurement results of the representation vectors of these samples to be higher, that is, the similarity is higher. On the contrary, for the negative learning samples, since their data are not associated, the computer system expects the commonality measurement results of the representation vectors of these samples to be lower, that is, the similarity is lower. In order to quantify the performance of the model in distinguishing these two types of samples, the computer system defines a loss function. This loss function takes the commonality measurement results of the representation vectors of the positive learning samples and the negative learning samples as input and outputs a scalar value, namely, the second network debugging error. This error value reflects the performance of the model on the current training group, and the smaller the error, the better the model performance.
[0196] When defining the loss function, the computer system ensures that the second network debugging error is positively correlated with the commonality measurement result of the representation vector corresponding to the positive learning sample, that is, the higher the similarity, the smaller the error; at the same time, the error is negatively correlated with the commonality measurement result of the representation vector corresponding to the negative learning sample, but it should be noted that the "negative correlation" here does not mean that the higher the similarity, the larger the error (because negative samples should not be similar), but that the system punishes those negative samples with abnormally high similarity through the design of the loss function, while rewarding those negative samples with low similarity. A common choice of loss function is Binary Cross-Entropy Loss or its variants. For positive learning samples, the computer system can treat them as positive classes (label is 1), and for negative learning samples, as negative classes (label is 0). Then, the computer system calculates the loss of each sample based on the commonality measurement result of the representation vector and the true label. Specifically, for positive learning samples, if the commonality measurement result of the representation vector is close to 1 (indicating high similarity), the loss will be small; if the result is low, the loss will be large. For negative learning examples, if the representation vector commonality measure result is close to 0 (indicating low similarity), the loss will be small; but if the result is abnormally high (i.e., the data is unrelated but the representation vectors are similar), the loss will be large.
[0197] For example, suppose a training group contains 4 positive learning samples and 2 negative learning samples. For the positive learning samples, their representation vector commonality measurement results are [0.9, 0.85, 0.92, 0.88] (close to 1, indicating high similarity); for the negative learning samples, their measurement results are [0.1, 0.05] (close to 0, indicating low similarity). The computer system calculates the loss based on these measurement results and the corresponding labels (1 for positive samples and 0 for negative samples), and accumulates the losses of all samples to obtain the second network debugging error of the training group. Since the similarity of positive samples is generally high and the similarity of negative samples is generally low, this error value can be relatively small, indicating that the model performs well on the current training group. However, if an abnormally high similarity value (for example, 0.5) appears in the negative sample, the loss of the sample will increase significantly, resulting in an increase in the overall error value, suggesting that the model needs to be further optimized to distinguish unrelated data.
[0198] As an implementation mode, in step S500, after the estimated ship flow data of the next monitoring period is output based on the ship flow estimation network, the method further includes:
[0199] Step S600: Obtain the actual ship flow corresponding to the next monitoring period.
[0200] In the actual application of ship flow prediction, after the computer system completes the output of the estimated ship flow data for the next monitoring period, it needs to obtain the actual ship flow data within the same monitoring period in order to check and verify the estimated results. The acquisition of actual ship flow usually depends on multiple data sources and real-time monitoring systems.
[0201] First, the computer system can be connected to the port's real-time monitoring system. These systems capture and record the activities of ships entering and leaving the port, berthing, and operating in real time through cameras, radars and other equipment installed in key areas of the port. The system can automatically extract key information such as the number, type, and timestamp of ships from these monitoring devices and generate corresponding ship flow data. These data usually exist in the form of time series, reflecting the activities of ships in the port at different time points. In addition to the real-time monitoring system, the computer system may also obtain real ship flow data from the ship automatic identification system (AIS). The AIS system is one of the necessary navigation equipment for modern ships. It can send dynamic information such as the position, speed, and heading of the ship in real time. By receiving and processing AIS data, the computer system can obtain the real-time status of all ships in the sea area near the port and further calculate the ship flow. In addition, the computer system may also obtain real ship flow data from other channels such as maritime administration departments and shipping companies. These data sources may provide more comprehensive and detailed information on ship activities, including the loading status of ships, sailing plans, destination ports, etc. By integrating and analyzing this information, the computer system can construct a more accurate and complete real ship flow data set. In the process of obtaining real ship traffic data, the computer system needs to consider the real-time, accuracy and completeness of the data. Due to the dynamic characteristics of ship traffic, the computer system needs to ensure that the acquired data can reflect the latest and most realistic ship activities. At the same time, the computer system also needs to clean and pre-process the data to remove noise and outliers to ensure the accuracy and consistency of the data.
[0202] Taking a port as an example, the computer system may capture the entry and exit records, location information and other data of ships in the port regularly (e.g., every hour) by connecting to the port's real-time monitoring system and AIS system. After cleaning and preprocessing, these data are integrated into a time series data set, reflecting the actual ship flow situation of the port at different time points. In step S600, the computer system obtains the actual ship flow data corresponding to the next monitoring cycle through this process, providing strong support for subsequent verification and validation work.
[0203] Step S700: based on the estimated ship flow data of the next monitoring period, the actual ship flow corresponding to the next monitoring period is verified to obtain a verification result.
[0204] By comparing the estimated data with the real data, the computer system can evaluate the accuracy of the prediction model and provide a reliable basis for subsequent decision-making. In step S500, the computer system has output the estimated ship flow data for the next monitoring period based on the ship flow estimation network. In order to verify the reliability of these data, step S700 requires the system to compare and analyze these estimated data with the real ship flow in the same monitoring period. First, the computer system obtains the real ship flow data corresponding to the next monitoring period from the data source. These data may come from multiple channels such as the real-time monitoring system of the port, the ship AIS data, and the statistical reports of the maritime administration. The system will clean and preprocess these data to ensure the accuracy and consistency of the data. Next, the computer system aligns the estimated ship flow data and the real ship flow data in time. Due to the delay in data collection and processing, the estimated data may not be completely synchronized with the real data. Therefore, the computer system adjusts the estimated data to the time point corresponding to the real data according to the timestamp information to ensure the comparability between the two. After completing the data alignment, the computer system selects a suitable error calculation method to quantify the difference between the estimated data and the real data. Common error calculation methods include mean square error (MSE), mean absolute error (MAE), relative error, etc. These indicators can intuitively reflect the accuracy of the estimated data.
[0205] Taking the mean square error as an example, the computer system calculates the average of the squares of the difference between the estimated ship flow data and the actual ship flow data. The smaller this value is, the smaller the difference between the estimated data and the actual data is, and the higher the accuracy of the estimation model. After obtaining the error value, the computer system compares it with the preset error confidence interval. The error confidence interval is determined based on historical data, model performance, business needs and other factors, and it reflects the reasonable fluctuation range of the estimated error. If the calculated error value falls within the confidence interval, then the estimated ship flow data or the actual ship flow for the next monitoring period can be considered reliable. This means that the performance of the estimation model in the current monitoring period is as expected, and the estimation result has a high degree of credibility.
[0206] However, if the error value exceeds the confidence interval, it means that the estimated ship flow data or the actual ship flow may be abnormal. This may be due to a variety of reasons, such as the estimation model fails to fully capture the dynamic change characteristics of the ship flow, there are noise or outliers in the data source, there are errors in the data collection and processing process, etc. In this case, the computer system needs to further check the data source, adjust the model parameters or adopt other methods to improve the accuracy of the estimation. Through the implementation of step S700, the computer system can effectively verify and evaluate the estimated ship flow data. This not only helps to improve the accuracy and reliability of the prediction model, but also provides strong support for decision-making in the fields of port management, shipping planning, etc. In practical applications, this step is of great significance to ensure the accuracy and credibility of the prediction results.
[0207] The present application embodiment provides a computer system, such as Figure 2 As shown, the computer system 100 includes: a processor 101 and a memory 103. The processor 101 and the memory 103 are connected, such as through a bus 102. Optionally, the computer system 100 may also include a transceiver 104. It should be noted that in actual applications, the transceiver 104 is not limited to one, and the structure of the computer system 100 does not constitute a limitation on the embodiments of the present application.
[0208] An embodiment of the present application provides a computer system. The computer system in the embodiment of the present application includes: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and when the one or more programs are executed by the processor, the above method is implemented.
[0209] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A ship flow prediction method based on computer vision, characterized in that: The method comprises: Acquire multiple remote sensing images of the target monitoring area during the target monitoring cycle; Performing target detection on the multiple remote sensing images to obtain ship detection results, wherein the ship detection results include ship positions and ship categories; Based on the target tracking algorithm, the detected ship is tracked to obtain the ship's driving parameters; Obtaining ship flow data of a target monitoring period based on the ship driving parameter statistics; Loading the target monitoring period ship flow data into the ship flow estimation network, and outputting the estimated ship flow data for the next monitoring period based on the ship flow estimation network; The ship flow estimation network includes a characterization information extraction component and a flow estimation component, and the ship flow estimation network is debugged by the following steps: Acquire a first learning sample library, the first learning sample library including a plurality of first learning samples and a priori labels of the first learning samples, the first learning samples including a port surveillance video learning sample and a ship AIS data learning sample, the priori label is used to indicate an association relationship between the ship AIS data learning sample and the port surveillance video learning sample; Performing a splitting operation on the port monitoring video learning sample in the first learning sample to obtain a video frame image stream, and performing a splitting operation on the ship AIS data learning sample in the first learning sample to obtain a ship AIS data stream; Pre-debugging the representation information extraction component based on the video frame image stream corresponding to the port monitoring video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample, and the priori label of the first learning sample; Acquire a ship flow data learning sample library, wherein the ship flow data learning sample library includes a plurality of second learning samples, wherein the second learning samples include past ship flow data in the ship flow data and actual ship flow in a subsequent monitoring period corresponding to the past ship flow data; According to the past ship flow data in the second learning example and the actual ship flow in a subsequent monitoring period corresponding to the past ship flow data, the flow estimation component and the pre-debugging characterization information extraction component are optimized and debugged in detail; Among them, according to the past ship flow data in the second learning example and the actual ship flow in the next monitoring period corresponding to the past ship flow data, the flow estimation component and the pre-debugging characterization information extraction component are optimized and debugged in detail, including: Performing feature embedding mapping on the past ship flow data to obtain an embedding mapping representation vector of the past ship flow data; Performing distribution feature embedding mapping on the past ship flow data to obtain a distribution embedding mapping representation vector of the past ship flow data; Integrate the embedding mapping representation vector and the distribution embedding mapping representation vector of the past ship flow data to obtain a past embedding representation vector; Extracting representation information based on the past embedded representation vector by the representation information extraction component after pre-debugging, to obtain a representation vector of past ship traffic data; The flow estimation component estimates based on the characterization vector of past ship flow data to obtain estimated ship flow data for a subsequent monitoring period corresponding to the past ship flow data; Based on the actual ship flow and the estimated ship flow data of the latter monitoring period, a first network debugging error is obtained; The component parameters of the pre-debugging characterization information extraction component and the traffic estimation component are optimized according to the first network debugging error until the detail optimization debugging cutoff requirement is met.
2. The method according to claim 1, characterized in that The characterization information extraction component includes a joint focus projection module, a cross-layer identity connection and standardization module, and a multi-layer perceptron module; the component parameters of the characterization information extraction component after the pre-debugging and the traffic estimation component are optimized according to the first network debugging error, including: Fixing component parameters of the joint focus projection module and the multi-layer perceptron module; Optimize component parameters of the traffic estimation component and the cross-layer constant connection and standardization module according to the first network debugging error.
3. The method according to claim 1, characterized in that: The pre-debugging of the representation information extraction component based on the video frame image stream corresponding to the port monitoring video learning sample in the first learning sample, the ship AIS data stream corresponding to the ship AIS data learning sample and the priori label of the first learning sample includes: Performing embedding mapping on the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, wherein the representation vector of each video frame in the set of video frame embedding representation vectors is obtained by integrating the embedding mapping representation vector and the distribution embedding mapping representation vector of the video frame; Embedding and mapping the ship AIS data stream to obtain a set of ship AIS data representation vectors of the ship AIS data stream, wherein the representation vector of each ship AIS data subset in the set of ship AIS data representation vectors is obtained by integrating the embedding mapping representation vector and the distribution embedding mapping representation vector of the ship AIS data subset; Extracting representation information from the video frame embedded representation vector set by the representation information extraction component to obtain a video frame representation vector; Extracting the representation information from the ship AIS data representation vector set by the representation information extraction component to obtain the ship AIS data representation vector; Obtaining a second network debugging error based on the video frame representation vector, the ship AIS data representation vector, and the priori label of the first learning example; Optimizing component parameters of the characterization information extraction component based on the second network debugging error until a pre-debugging cutoff requirement is met.
4. The method according to claim 3, characterized in that The embedding mapping is performed on the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, including: Performing distribution feature embedding mapping on each video frame in the video frame image stream to obtain a distribution embedding mapping representation vector of each video frame; Performing feature embedding mapping on each video frame in the video frame image stream to obtain an embedding mapping representation vector of each video frame; For each video frame in the video frame image stream, integrating the distribution embedding mapping representation vector and the embedding mapping representation vector of the video frame to obtain a representation vector of the video frame; According to distribution information of video frames in the video frame image stream, the representation vectors of multiple video frames are merged to obtain a set of video frame embedding representation vectors of the video frame image stream; The embedding and mapping the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream includes: Performing distribution feature embedding mapping on each ship AIS data subset in the ship AIS data stream to obtain a distribution embedding mapping representation vector of each ship AIS data subset; Performing feature embedding mapping on each ship AIS data subset in the ship AIS data stream to obtain an embedding mapping representation vector of each ship AIS data subset; For each ship AIS data subset in the ship AIS data stream, integrating the distribution embedding mapping representation vector and the embedding mapping representation vector of the ship AIS data subset to obtain a representation vector of the ship AIS data subset; According to the distribution information of the ship AIS data subsets in the ship AIS data stream, the characterization vectors of multiple ship AIS data subsets are merged to obtain a set of ship AIS data characterization vectors of the ship AIS data stream.
5. The method according to claim 3, characterized in that: Before embedding and mapping the video frame image stream to obtain a set of video frame embedding representation vectors of the video frame image stream, the method further includes: Performing a standardization operation on the pixel value of each pixel in each of the video frames to obtain a video frame image stream after the standardization operation, so as to perform embedding mapping on the video frame image stream after the standardization operation; Before embedding and mapping the ship AIS data stream to obtain a set of ship AIS data characterization vectors of the ship AIS data stream, the method further includes: Performing a quantization mapping operation on the data items in each of the ship AIS data subsets to obtain a data item vector; A standardization operation is performed on the data item vectors of the data items in each of the ship AIS data subsets to obtain a ship AIS data stream after the standardization operation, so as to embed and map the ship AIS data stream after the standardization operation.
6. The method according to claim 3, characterized in that The obtaining a second network debugging error based on the video frame representation vector, the ship AIS data representation vector, and the priori label of the first learning sample includes: Performing a unification operation on the representation vector dimensions of the video frame representation vector and the ship AIS data representation vector to obtain a target ship AIS data representation vector and a target video frame representation vector having consistent dimensions; Obtaining a representation vector commonality measurement result between the target ship AIS data representation vector and the target video frame representation vector corresponding to the same first learning example; Based on the commonality measurement result of the representation vector and the prior label of the first learning example, a second network debugging error is obtained.
7. The method according to claim 6, characterized in that The obtaining a second network debugging error based on the commonality measurement result of the representation vector and the priori label of the first learning sample includes: By means of the prior labels of the first learning samples, a positive learning sample and a negative learning sample in the first learning sample of the same training group are determined, wherein the positive learning sample represents a first learning sample whose prior label indicates that the information of the ship AIS data learning sample is associated with the port surveillance video learning sample; and the negative learning sample represents a first learning sample whose prior label indicates that the information of the ship AIS data learning sample is not associated with the port surveillance video learning sample; The second network debugging error is determined by the commonality measurement results of the representation vectors corresponding to the positive learning samples and the commonality measurement results of the representation vectors corresponding to the negative learning samples in the first learning samples of the same training group; wherein the second network debugging error is positively correlated with the commonality measurement results of the representation vectors corresponding to the positive learning samples; and the second network debugging error is negatively correlated with the commonality measurement results of the representation vectors corresponding to the negative learning samples.
8. The method according to claim 1, characterized in that After the estimated ship flow data for the next monitoring period is output based on the ship flow estimation network, the method further includes: Obtain the actual ship flow corresponding to the next monitoring period; Based on the estimated ship flow data of the next monitoring period, the actual ship flow corresponding to the next monitoring period is checked to obtain a verification result.
9. A computer system, characterized in that: include: one or more processors; Memory; one or more computer programs; The one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and when the one or more computer programs are executed by the processors, the method according to any one of claims 1 to 8 is implemented.
