Navigation accident analysis method and device, computer equipment and storage medium

By constructing a shipping accident knowledge graph and a Bayesian network analysis model, the problem of low accuracy and efficiency of large language models in analyzing shipping accidents is solved, and efficient and accurate risk warnings for shipping accidents are achieved.

CN120994793AActive Publication Date: 2025-11-21SHANGHAI JIAOTONG UNIV

Patent Information

Application Number
CN202511150096.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2025-11-21
Estimated Expiration
2045-08-15

AI Technical Summary

Technical Problem

In existing technologies, large language models cannot accurately extract the causes of shipping accidents when analyzing them, resulting in inaccurate risk warning conclusions and low efficiency.

Method used

A shipping accident knowledge graph is constructed. The retrieval enhancement generation method and Bayesian network analysis model are adopted. The query statement is generated by parsing the question through a large language model, the knowledge graph is retrieved and the probability of causal chain is calculated, and the answer is generated.

Benefits of technology

It improves the accuracy and efficiency of shipping accident analysis, enabling accurate identification of accident causes and providing reliable risk warning conclusions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994793A_ABST
    Figure CN120994793A_ABST
Patent Text Reader

Abstract

The invention discloses a shipping accident analysis method. The method comprises the following steps: constructing a shipping accident knowledge graph; inputting questions, retrieving the shipping accident knowledge graph by adopting a retrieval enhancement generation method, and generating answers; wherein the retrieval enhancement generation method is adopted to retrieve the shipping accident knowledge graph and generate the answer, and the method comprises the following steps of: analyzing a question by adopting a large language model to generate a query statement; retrieving in the shipping accident knowledge graph according to the query statement, outputting nodes and edges matched with the query statement from the shipping accident knowledge graph, and generating a Bayesian network according to the matched nodes and edges; generating a query result according to the conditional probability of a target node and a father node thereof and / or the posterior probability of a child node thereof in the Bayesian network, and inputting the query result into the large language model; and the large language model generates an answer according to the query result. The invention further discloses a shipping accident analysis device, computer equipment and a storage medium. The method comprises the following steps: extracting and storing shipping accident data by adopting a large language model in combination with a knowledge graph, and analyzing the shipping accident data in combination with a Bayesian network analysis model to obtain an occurrence probability of a complete causal chain from causes to accident results in an accident, so that objective and accurate accident causals are sorted out for complex shipping accidents, and the probability of occurrence of the complete causal chain is improved. And reliable conclusions and suggestions are provided for subsequent shipping businesses.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of shipbuilding and shipping technology, and in particular to a method, apparatus, computer equipment, and storage medium for analyzing shipping accidents. Background Technology

[0002] In the maritime transport industry, shipping accidents pose a serious threat to shipping safety. Existing shipping accidents are typically recorded and stored in the form of accident reports. In subsequent shipping operations, reviewing these reports can serve as an early warning and guide for upcoming operations.

[0003] A common method of incident report analysis is manual analysis, which involves manually collecting incident reports related to shipping operations, extracting information from these reports, and using this information to issue early warnings for shipping operations, while also making corresponding adjustments and plans. However, manual analysis of shipping incident reports is inefficient and relies on personal experience, resulting in relatively one-sided results that are difficult to efficiently and accurately warn of shipping risks and provide corresponding countermeasures.

[0004] Large language models, trained on massive databases, can understand and analyze user questions and then output answers in natural language, which is expected to overcome the problem of low efficiency in manual analysis. However, shipping accidents are complex, and existing large language models still face many difficulties in extracting report semantics and clarifying the causes of accidents, which makes it impossible for large language models to accurately analyze the causes of shipping accidents and warn of shipping risks. Summary of the Invention

[0005] In view of the technical problems existing in the prior art, this application provides a shipping accident analysis method and apparatus, which can solve the problem that large language models cannot accurately predict shipping risks and provide reasonable guidance solutions.

[0006] Firstly, this application provides a method for analyzing shipping accidents, the method comprising: Constructing a knowledge graph of shipping accidents; Input a question, and use a retrieval enhancement generation method to search the shipping accident knowledge graph and generate an answer; Among them, a retrieval enhancement generation method is used to retrieve information from the shipping accident knowledge graph and generate answers, including: A large language model is used to parse the problem and generate query statements; The system retrieves the query statement from the shipping accident knowledge graph, outputs the nodes and edges that match the query statement, and generates a Bayesian network based on the matching nodes and edges. Based on the conditional probability of the target node and its parent node and / or the posterior probability of its child nodes in the Bayesian network, the query results are generated and input into the large language model. The large language model generates answers based on the query results.

[0007] Optionally, a shipping accident knowledge graph can be constructed, including: We provide shipping accident data, use a large language model to extract shipping accident information and the relationships between shipping accident information from the data, construct an ontology model of shipping accident information, input the ontology model into the shipping accident database, and obtain a shipping accident knowledge graph.

[0008] Optionally, a large language model is used to extract shipping accident information and the relationships between shipping accident information from shipping accident data, and to construct an ontology model of shipping accident information, including: Based on shipping accident information and the relationships between shipping accident information, a large language model is used to supplement the missing shipping accident elements.

[0009] Optionally, a large language model is used to parse the problem and generate query statements, including: The large language model generates a first target field that matches the shipping accident element type based on the user input question and the preset shipping accident element type; the large language model also generates a second target field that matches the shipping accident information based on the user input question. Generate a first query statement based on the first target field, and generate a second query statement based on the second target field.

[0010] Optionally, the large language model generates a first target field that matches the shipping accident element type based on the user input question and preset shipping accident element types, including: The large language model extracts fields that match the shipping accident element types from the question based on the preset shipping accident element types, and fills in supplementary fields for missing shipping accident element types. The first target field is generated based on the matching and supplementary fields.

[0011] Optionally, the query is retrieved from the shipping accident knowledge graph, and nodes and edges matching the query are output. A Bayesian network is generated based on the matching nodes and edges, including: For each query statement, a query is performed on the shipping accident knowledge graph. Target nodes that match the query statement are selected from the shipping accident knowledge graph. Starting from the target node, the edges of the target node are extended level by level to obtain at least one causal chain containing the target node. A Bayesian network is generated based on at least one causal chain.

[0012] Optionally, starting from the target node, extending along the edges of the target node level by level, at least one causal chain containing the target node is obtained, including: Mark the target node as level 0, and extend from the target node level by level. For each level of extension to a parent node, the parent node's marking level increases by 1, and for each level of extension to a child node, the child node's marking level decreases by 1, until the end is reached. Based on the target node and the nodes extended from the target node, obtain at least one causal chain containing the target node. Specifically, for multiple identical parent nodes, the highest level number among them is taken; for multiple identical child nodes, the lowest level number among them is taken.

[0013] Optionally, the large language model generates answers based on the query results, including: The first answer is generated based on the first query statement, and the second answer is generated based on the second query statement. The first answer and the second answer are merged, and the content with low credibility in the content of the first answer and the second answer is removed to generate an answer.

[0014] Secondly, this application provides an embodiment of a shipping accident analysis device, the device comprising: The data module is used to store the constructed shipping accident knowledge graph; The retrieval module takes a question as input, parses it using a large language model, and generates a query statement. It then searches the shipping accident knowledge graph for matching nodes and edges, generating a Bayesian network based on these matching nodes and edges. The module generates query results based on the conditional probabilities of the target node and its parent node, and / or its posterior probabilities with its child nodes. These results are then input into the large language model, which generates an answer based on the query results.

[0015] Thirdly, this application provides an embodiment of a computer device for performing the shipping accident analysis method.

[0016] Fourthly, this application provides an embodiment of a storage medium for storing a program capable of executing the shipping accident analysis method.

[0017] The technical solution provided in this application includes at least the following technical effects: By employing a Bayesian network analysis model to analyze shipping accident data, the side probabilities and joint probabilities of shipping accident information are calculated to obtain the probability of occurrence of the complete causal chain from cause to effect in an accident. This allows for the identification of objective and accurate causal relationships in complex shipping accidents, thereby providing reliable conclusions for subsequent shipping operations. Meanwhile, addressing the issues of unstructured, lengthy, and interfering information in shipping accident reports, and the reliance of Bayesian network analysis models on structured data to construct directed acyclic graphs (DAGs), this paper employs a knowledge graph to store shipping accident information, forming a shipping accident knowledge graph containing nodes and edges. Simultaneously, a retrieval-enhanced generation method is used to extract information from the knowledge graph and distinguish shipping accident elements directly related to the shipping accidents from the shipping accident information. This allows for simple and efficient extraction of queried nodes and edges from the shipping accident knowledge graph, generating a DAG. Finally, to address the problem of redundant shipping accident information easily interfering with the accurate answer generation of Bayesian network models, the paper parses the user input question, extracts fields related to shipping accident elements to generate a first query statement, and fields related to shipping accident information to generate a second query statement. The answer is then generated based on the first and second query statements, overcoming potential errors in answers generated using a single query statement. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the devices shown in these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating a shipping accident analysis method in one embodiment; Figure 2 This is a schematic diagram of the process of using a retrieval enhancement generation method to retrieve and generate answers from a shipping accident knowledge graph in one embodiment; Figure 3 This is shipping accident information in one embodiment; Figure 4 This is a shipping accident ontology model in one embodiment; Figure 5 This is a shipping accident knowledge graph in one embodiment; Figure 6 One embodiment is a Bayesian network based on collision incidents; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0021] Shipping accidents pose a significant threat to the shipping industry, and past accidents are typically documented in shipping accident reports. Analyzing these reports helps clarify the causes of accidents, enabling preventative measures to mitigate future incidents. However, the sheer volume and length of shipping accident reports make manual analysis inefficient. While large language models can overcome the inefficiency of manual analysis, the complexity of shipping accident causes and the use of unstructured languages ​​in these reports lead to biases in extracting accident information and providing risk warnings for impending events. Consequently, the reliability of risk warning conclusions is lower than that of manual analysis. To address the aforementioned problems, this embodiment provides a method for analyzing shipping accidents. For example... Figures 1-2 As shown, the method includes the following steps: S1. Construct a knowledge graph of shipping accidents; S2. Input the question, and use the retrieval enhancement generation method to retrieve the shipping accident knowledge graph and generate an answer; Among them, a retrieval enhancement generation method is used to retrieve information from the shipping accident knowledge graph and generate answers, including: S201. Use a large language model to parse the problem and generate a query statement; S202. Retrieve from the shipping accident knowledge graph according to the query statement, output the nodes and edges that match the query statement from the shipping accident knowledge graph, and generate a Bayesian network based on the matching nodes and edges. S203. Based on the conditional probability of the target node and its parent node and / or the posterior probability of its child nodes in the Bayesian network, generate query results and input the query results into the large language model. S204. The large language model generates answers based on the query results.

[0022] Among them, a knowledge graph is a structured semantic knowledge base used to store and represent real-world entities and their relationships; a large language model is an artificial intelligence model based on deep learning that can understand and generate natural language through text training; a retrieval-enhanced generation method is a method that combines information retrieval with large language model text generation, including the steps of retrieving relevant knowledge, constructing enhanced prompts, and generating answers; a Bayesian network is a probabilistic graphical model, including directed acyclic graphs and conditional probabilities, used to describe the probabilistic dependencies between random variables, and the Bayesian network analysis model is an analysis tool based on Bayesian networks; a causal chain refers to a progressive causal relationship between multiple random variables, which constitute a chain from cause to effect.

[0023] This embodiment pre-constructs a shipping accident knowledge graph containing shipping accident data, and uses a retrieval-enhanced generation method to extract relevant shipping accident information from the shipping accident knowledge graph and generate answers, which greatly improves the accuracy of accident information extraction and the efficiency of accident report analysis. A Bayesian network analysis model is used to calculate the causal probability of accidents, transforming shipping accidents with complex causes into clear causal chains and causal probabilities, eliminating the subjectivity and bias of manual analysis, and improving the reliability of risk warning conclusions.

[0024] In one possible embodiment, constructing a shipping accident knowledge graph includes: We provide shipping accident data, use a large language model to extract shipping accident information and the relationships between shipping accident information from the data, construct an ontology model of shipping accident information, input the ontology model into the shipping accident database, and obtain a shipping accident knowledge graph.

[0025] Among them, shipping accident data refers to information that can reflect shipping accidents, including text, numbers, and images and any combination thereof; shipping accident information refers to structured fields obtained after being extracted from shipping accident data by a large language model; and shipping accident ontology model refers to a model constructed based on shipping accident information and its relationships.

[0026] In one possible implementation, the large language model includes the DeepSeek-R1 model; Specifically, the large language model learns from pre-validated knowledge.

[0027] Specifically, the knowledge to be verified in advance includes professional terms and fixed names in the shipping industry, such as known ship types, port names, and waterway names.

[0028] Shipping accident data is typically expressed using natural language and domain-specific terminology, exhibiting significant unstructured characteristics. Large language models struggle to efficiently and accurately extract information from this unstructured data and generate structured shipping accident information. To address this issue, this embodiment employs a pre-validated knowledge learning method. Pre-validated knowledge is imported into the large language model, enabling it to accurately extract shipping accident information from reports based on prompts, thereby improving the efficiency and accuracy of shipping accident information extraction.

[0029] In one possible embodiment, shipping accident data includes shipping accident reports.

[0030] Shipping accident reports are used to represent shipping accident information. For each shipping business scope, a sufficient number of shipping accident reports to cover that scope can be selected to construct a shipping accident knowledge graph. For domestic shipping business, shipping accident reports published by the China Maritime Safety Administration can be selected to construct the shipping accident knowledge graph.

[0031] In one possible embodiment, shipping accident information includes vessel information, accident information, investigation information, and environmental information, such as... Figure 3 As shown.

[0032] Optionally, ship information includes basic ship information, ship construction information, technical parameters, safety information, operational information, and power system.

[0033] Optionally, the accident information includes the accident type, accident name, accident location, accident time, accident details, and extent of damage.

[0034] Optionally, the investigation information may include the investigating unit, the investigation period, the determination of responsibility, and safety management recommendations.

[0035] Optionally, environmental information includes day / night information, weather conditions, and navigation conditions.

[0036] Optionally, the relationship between shipping accident information can be confirmed by statements in the shipping accident data that indicate the interrelationship between shipping accident information. Such statements include "occurred at", "due to", "resulting in", "attributed to", etc., to determine that there is a relationship between the shipping accident information before and after the statement.

[0037] Optionally, a shipping accident ontology model can be constructed based on shipping accident information and its relationships, such as... Figure 4 As shown.

[0038] The shipping accident ontology model includes tables.

[0039] Shipping accident data, especially shipping accident reports, often contain a large amount of text, numbers, and images that are not related to the basic information of the accident. By extracting shipping accident information and the relationships between shipping accident information, a shipping accident ontology model can be constructed, which can transform lengthy reports into concise, clear, and well-structured shipping accident ontology models, thereby facilitating the construction of shipping accident knowledge graphs.

[0040] In some cases, the lack of a unified format for shipping accident reports leads to variations in the types of shipping accident information disclosed in different reports. Consequently, some shipping accident reports may be missing certain types of shipping accident information. When using a large language model to extract shipping accident information from these reports, the missing types of information can result in an incomplete shipping accident ontology model, affecting the construction of the knowledge graph and the analysis of shipping accidents.

[0041] For example, in a ship collision accident caused by poor visibility at night, the report might only record that the collision was caused by the negligence of the watch officer, without mentioning the environmental information related to nighttime navigation. In this case, the large language model extracting the accident information from the report would not include the environmental information related to nighttime navigation. When a user asks a question involving nighttime navigation, the large language model will naturally be unable to extract the causal chain of the accident, leading to inaccurate subsequent analysis and incorrect risk warnings.

[0042] To address the aforementioned issues, in one embodiment, a large language model is employed to extract shipping accident information and the relationships between shipping accident information from shipping accident data, constructing an ontology model of shipping accident information. The embodiment also includes: Based on shipping accident information and the relationships between shipping accident information, a large language model is used to supplement the missing shipping accident elements.

[0043] Specifically, the types of elements in shipping accidents include: basic ship information, accident information, and environmental information; Shipping accident elements refer to shipping accident information directly related to the cause of the accident; among them, basic ship information is used to reflect the ship's operation during the accident; accident information is used to reflect the shipping accident report's determination of the accident; and environmental information is used to reflect the meteorological conditions of the ship during the accident.

[0044] By clarifying shipping accident information, the causal relationship of shipping accidents can be more accurately determined.

[0045] The method of supplementing missing shipping accident elements using a large language model includes: using shipping accident data to deduce missing shipping accident elements through reasoning, and searching trusted external databases to obtain the missing shipping accident elements.

[0046] For example, regarding the aforementioned shipping accident report, the large language model, after structuring and extracting shipping accident elements, discovered that the report lacked information on the weather conditions at the time of the accident. The large language model first infers whether the accident occurred during the day or night based on the specific time recorded in the report, and supplements the environmental information with the day / night information element. Then, based on the time and location of the accident, the large language model retrieves the weather information for that location from a reliable external database for that day, and supplements the environmental information with the weather conditions element. Thus, when a user asks about the risks of navigating a certain waterway at night, the large language model structures the user's question and identifies shipping accident elements, including nighttime navigation, thereby accurately extracting the aforementioned shipping accident data from the knowledge graph.

[0047] In one possible embodiment, the shipping accident knowledge graph includes a shipping accident knowledge graph based on the Neo4j graph database.

[0048] The process involves extracting shipping accident information from a large language model, storing the information in a CVS format file, and then converting the CVS format file containing the shipping accident information into a Neo4j graph database to obtain a shipping accident knowledge graph based on the Neo4j graph database.

[0049] Specifically, the CVS format files storing shipping accident information are converted into a Neo4j graph database. This includes traversing the CVS format files storing shipping accident information, filtering out invalid values, storing shipping accident information of the same type into a set and removing duplicates, then establishing relationships between different types of shipping accident information, calling a deduplication function to ensure that each set of relationships is unique, and then using a py2neo database to connect the above set to the Neo4j database. For each piece of shipping accident information and the relationships between shipping accident information, corresponding nodes and edges are created in the Neo4j database, thus obtaining a shipping accident knowledge graph based on the Neo4j graph database.

[0050] Shipping accidents have complex causes, and shipping accident data varies greatly in complexity. While traditional relational databases can store shipping accident information, they struggle to comprehensively and accurately represent the relationships between these events, especially causal relationships. The Neo4j graph database represents shipping accident information in a graphical structure, clearly and intuitively displaying the complex relationships between these events, while also facilitating subsequent retrieval and querying.

[0051] In one possible embodiment, the input questions include questions using structured language.

[0052] Specifically, the structured language questions involve selecting questions from a set of predefined questions in the interactive interface.

[0053] In one possible embodiment, the input problem includes problems with unstructured languages.

[0054] Specifically, questions in unstructured language can include those submitted via a text input dialog box using natural language, or those submitted via voice dialogue using natural language.

[0055] Expanding the input formats for questions can improve the convenience of user interaction.

[0056] In one possible implementation, a large language model is used to parse the problem and generate a query statement, including: The large language model extracts target fields that match shipping accident information from the question and generates query statements based on the target fields.

[0057] When users only query past shipping incidents, their input usually contains content closely related to the incident. In this case, a large language model can be used to extract target fields that match the shipping incident information from the question, and the query can be generated based on these target fields, thus generating the query efficiently.

[0058] Typically, queries include multiple fields related to shipping accident information, but the degree of correlation between these fields and the accidents varies, which may affect the accuracy of subsequent risk warnings. For example, when a user inquires about the risk of a certain type of vessel passing through a certain waterway on a certain day, the large language model will retrieve relevant accident information from the knowledge graph based on the vessel type, date, and waterway. The retrieved data may include other unrelated accidents in the waterway mentioned in the question, leading to incorrect risk warning conclusions.

[0059] To address this issue, in one possible implementation, a large language model is used to parse the question and generate a query statement, including: The big language model extracts a first target field from the question that matches the shipping accident element type based on the preset shipping accident element type; the big language model also extracts a second target field from the question that matches the shipping accident information. Generate a first query statement based on the first target field, and generate a second query statement based on the second target field.

[0060] Shipping accident elements are a type of shipping accident information more closely related to the occurrence of the accident. Identifying shipping accident elements helps to eliminate interference from other shipping accident information in the analysis results. This embodiment parses the shipping accident information involved in the question based on preset shipping accident element types. It uses a first target field that matches the shipping accident element type and retains a second target field that matches the shipping accident information. This approach allows for precise identification of the causes of shipping accidents, eliminating shipping accident information unrelated to the accident, while still fully extracting the content of the user's question, avoiding omissions in subsequent analysis.

[0061] In some cases, user input may be incomplete. For example, in shipping risk warning scenarios, weather conditions are a crucial factor in predicting shipping accident risks. However, users typically don't proactively disclose weather conditions when requesting risk warnings. For instance, if a user wants to assess the risk of a ship passing through a certain waterway on a specific day, they usually only specify the date, waterway, and vessel type in their question using natural language, without actively querying the weather conditions for that waterway on that date and including them in the input. This leads to an overemphasis on shipping accident elements related to that specific waterway when searching the knowledge graph. Consequently, it fails to incorporate past shipping accidents related to weather conditions into the causal chain and also includes other unrelated shipping accidents occurring in that waterway. This results in biased probability calculations by the Bayesian network analysis model, leading to incorrect risk warning conclusions. For example, while ship aging is a significant factor leading to shipping accidents, users rarely disclose the age of their ships. Large language models also cannot identify the age of ships involved in user questions. This makes it difficult to incorporate the age of ships into the causal chain when searching for shipping accident elements from the knowledge graph, thus weakening the reliability of risk warning conclusions.

[0062] To address the aforementioned issues, in one possible embodiment, the large language model generates a first target field that matches the shipping accident element type based on the user input question and preset shipping accident element types, including: The large language model extracts fields that match the shipping accident element types from the question based on the preset shipping accident element types, and fills in supplementary fields for missing shipping accident element types. The first target field is generated based on the matching and supplementary fields.

[0063] Optionally, the types of shipping accident elements include basic ship information, accident information, and environmental information.

[0064] For shipping accident element types with missing fields, supplementary fields should be entered, including: The system uses a large language model to search trusted external databases and fills the search results into supplementary fields. For shipping accident element types that still lack fields, the system prompts the user to enter supplementary fields.

[0065] Specifically, when parsing a problem, the large language model breaks it down based on predefined shipping accident element types, identifying the first target field corresponding to each type. For shipping accident element types with missing fields, the large language model first searches a trusted external database to fill in the missing elements. Then, for elements that are still missing, the model prompts the user to enter the missing fields. If the user enters the missing fields, the shipping accident element type is completed, and a query is generated accordingly. If the user does not enter any missing fields, a query is generated based on the existing target fields.

[0066] For example, other target shipping accident factors include weather factors and vessel age. When a user asks about the risk of a vessel transporting goods through a certain waterway on a certain day, the big data language model will structure the user's question, identifying the fields of shipping time, waterway, and transported goods. The big data language model will then traverse the types of shipping accident factors, identifying that shipping time and waterway belong to the basic elements of shipping accidents, and identifying missing weather conditions and basic vessel information. For weather conditions and basic vessel information, the big data language model will first search in a trusted external database, and then query the corresponding weather conditions based on the date and waterway in the question, generating supplementary fields. For basic vessel information, the big data language model cannot find it in a trusted external database, so it will prompt the user to supplement it. After the user supplements the basic vessel information, the big data language model will generate supplementary fields based on the information provided by the user, and then generate the corresponding query statement based on the supplemented first target field.

[0067] Using the above method, this embodiment can classify the content of user input questions according to their relevance to shipping accidents and supplement missing content, providing strong data support for subsequent Bayesian network analysis.

[0068] In one implementation, the query statement is used to perform a query on a shipping accident knowledge graph. For a shipping accident knowledge graph based on the Neo4j graph database, the query statement includes a Cypher statement.

[0069] In one implementation, the large language model learns from cue words.

[0070] The cue word learning process includes importing cue word templates into a large language model.

[0071] Specifically, the prompt template includes role setting, question and answer background, and answer requirements. For example, the role setting is a shipping accident analysis expert, the question and answer background is to assess the probability of shipping accident risks, and the answer requirements include giving risk assessment conclusions and recommendations.

[0072] Shipping accident data is typically expressed using natural language and domain-specific terminology, exhibiting significant unstructured characteristics. Large language models struggle to efficiently and accurately extract information from this unstructured data and generate structured shipping accident information. To address this issue, this embodiment employs a prompt word learning method, importing prompt word templates into the large language model, enabling the model to accurately generate the user's desired response based on the prompt words.

[0073] Typically, user-input questions are presented in natural language. However, due to the specialized terminology and fixed names used in the shipping industry, large language models can easily extract incorrect information from natural language queries. Therefore, this embodiment performs pre-defined prompt word learning on the large language model. By learning pre-defined prompt words, the large language model can semantically complete and accurately extract information from natural language queries based on these prompt words, resulting in accurate query targets and retrieval suggestions, which are then transformed into query statements.

[0074] In one possible embodiment, the process involves retrieving data from a shipping accident knowledge graph based on a query statement, outputting nodes and edges matching the query statement from the shipping accident knowledge graph, and generating a Bayesian network based on the matching nodes and edges, including: For each query statement, a query is performed on the shipping accident knowledge graph. Target nodes that match the query statement are selected from the shipping accident knowledge graph. Starting from the target node, the edges of the target node are extended level by level to obtain at least one causal chain containing the target node. A Bayesian network is generated based on at least one causal chain.

[0075] In one possible embodiment, starting from the target node, extending stepwise along the edges of the target node, at least one causal chain containing the target node is obtained, including: Mark the target node as level 0, and extend it level by level from the target node. For each level of extension to the parent node, the parent node's marking level increases by 1, and for each level of extension to the child node, the child node's marking level decreases by 1, until the end is reached. Based on the target node and the nodes extended from the target node, obtain at least one causal chain containing the target node.

[0076] By labeling nodes with depth values, we can ensure that the causal relationships between nodes are presented in the form of cause above effect, which is convenient for integrating causal chains into Bayesian networks and also conforms to the logic of human cognition.

[0077] Because there is no fixed template for shipping accident reports, different reports have different recording habits regarding the causes of accidents. This can lead to some shipping accident reports omitting certain causal links. For example, the causal chain of "driver fatigue - ignoring oncoming vessels - collision" might be omitted in some shipping accident reports as "driver fatigue - collision." This results in different shipping accident reports assigning the same cause multiple different levels to the same accident. The resulting Bayesian network neither conforms to human cognitive logic nor is conducive to accurate analysis by Bayesian network analysis models.

[0078] To address the aforementioned issues, in one possible embodiment, the target node is marked as level 0, and the node is extended level by level from the target node. For each level of extension to a parent node, the parent node's marking level increases by 1, and for each level of extension to a child node, the child node's marking level decreases by 1, until the extension reaches the end. The method further includes: For multiple identical parent nodes, take the highest level number among them; for multiple identical child nodes, take the lowest level number among them.

[0079] By using the above method, this embodiment unifies the level of the same node, avoiding the problem of the same node being assigned multiple levels.

[0080] In one possible embodiment, query results are generated based on the conditional probabilities of the target node and its parent node and / or its posterior probabilities with its child nodes in the Bayesian network, including: A Bayesian network analysis model is used to calculate the conditional and posterior probabilities of adjacent nodes in the Bayesian network, and to calculate the joint conditional and / or joint posterior probabilities of causal chains. Based on the joint conditional and / or joint posterior probability chains, target causal chains are selected. Based on the nodes in the target causal chains, the corresponding shipping accident information and the relationships between shipping accident information are output to form query results.

[0081] Among them, the Bayesian network consisting of at least one causal chain is a directed acyclic graph.

[0082] Since Bayesian network analysis models are only applicable to directed acyclic graphs (DAGs), a corresponding DAG needs to be constructed for the target nodes in the shipping accident knowledge graph in order to use a Bayesian network analysis model. This embodiment extracts the causal chains containing the target nodes and combines these chains into a directed acyclic Bayesian network, which can be used by the Bayesian network analysis model to calculate conditional probabilities and / or posterior probabilities.

[0083] Among them, conditional probability is used to represent the probability of the target node occurring given that its parent node has occurred.

[0084] The posterior is used to describe the probability of a target node occurring given that its child nodes have occurred.

[0085] The joint conditional probability is used to represent the probability of a target node occurring given that its multi-level parent nodes have occurred.

[0086] Among them, the joint posterior is used to describe the probability of the occurrence of the target node given that its multi-level child nodes have occurred.

[0087] By combining the calculation of joint conditional probability and / or joint posterior probability, the causes and / or consequences of shipping accident information corresponding to the target node can be evaluated, thereby providing a shipping warning related to the shipping accident information.

[0088] Shipping accidents are typically caused by complex factors, and shipping accident knowledge graphs cannot adequately represent the interrelationships among shipping accident information with intricate causal relationships. This embodiment introduces a Bayesian network analysis model to quantify the causes and / or consequences of accident factors by calculating the joint conditional probability and / or joint posterior probability of shipping accident information. This helps to clarify the causes and consequences of complex shipping accident information and improve the reliability of shipping early warning systems.

[0089] In one possible implementation, the large language model generates an answer based on the query results, including: The first answer is generated based on the first query statement, and the second answer is generated based on the second query statement. The first answer and the second answer are merged, and the content with low credibility in the content of the first answer and the second answer is removed to generate an answer.

[0090] When users ask questions using natural language, the questions may omit certain fields that affect shipping accident analysis, or they may contain certain fields that interfere with the analysis. By filtering out fields related to shipping accident element types from the questions to generate the first query statement and the first answer, and filtering out fields related to shipping accident information from the questions to generate the second query statement and the second answer, multiple answers can be obtained without using multiple large language models or multiple data sources. This allows for the generation of a more credible and accurate answer based on the multiple answers.

[0091] In one implementation, removing content with low credibility from the first and second answers includes replacing the content with low credibility with the content of the answer with high credibility; for example, for factual questions with a single, clear answer, when there is a contradiction between the content of the first and second answers, the content of the first answer is used to replace the corresponding content of the first answer.

[0092] In one implementation, removing content with low credibility from the first and second answers includes adding the content of the low-credibility answers to the content of the high-credibility answers; for example, for questions involving quantity statistics, when the quantity counted in the first answer and the quantity counted in the second answer are different, it is possible to consider adding the quantity counted in the second answer after deduplication to the quantity counted in the first answer, thereby forming a more complete data statistics.

[0093] Optionally, the credibility of the response includes the confidence score of the response; Optionally, the credibility of the first answer may be considered higher than that of the second answer; In this embodiment, since the first answer is generated based on a first query statement that is more relevant to shipping accidents, a simple and efficient method is to determine that the credibility of the first answer is higher than that of the second answer.

[0094] Optionally, the answer may include a structured template.

[0095] The structured template includes at least one of the following: accident name, accident time, accident location, vessel type, weather, accident cause, and accident result.

[0096] Optionally, the response may include a natural language response.

[0097] The query results are input into a large language model and combined with one or more of the historical answer records and knowledge base text to form a semantically complete context, which is then used to answer in unstructured natural language.

[0098] Optionally, the answer may include a picture.

[0099] The images include maps generated by calling the map component; The images also include knowledge graphs.

[0100] The present invention also provides an embodiment of a shipping accident analysis device, the device comprising: The data module is used to store the constructed shipping accident knowledge graph; The retrieval module is used to input questions and employs retrieval enhancement generation methods to search the shipping accident knowledge graph and generate answers. Among them, a retrieval enhancement generation method is used to retrieve information from the shipping accident knowledge graph and generate answers, including: A large language model is used to parse the problem and generate query statements; Based on the query, find the target node in the shipping accident knowledge graph and output at least one causal chain in the shipping accident knowledge graph that contains the target node; The conditional probability of the target node and its parent node and / or its child node in the causal chain are calculated using a Bayesian network analysis model, and the query results are output based on the conditional probability and / or posterior probability. Generate an answer based on the query results.

[0101] The present invention also provides an embodiment of a computer device for performing the shipping accident analysis method.

[0102] The present invention also provides an embodiment of a storage medium for storing a program that can execute the shipping accident analysis method.

[0103] This invention also provides an embodiment of a shipping accident analysis method for a specific application scenario, including: S1. Construct a knowledge graph of shipping accidents; Using collision accident reports publicly available from the China Maritime Safety Administration as shipping accident data, the DeepSeek-R1 model was employed to extract shipping accident information and relationships from the data. The shipping accident information includes "accident name," "accident location," "time of occurrence," "vessel name," "weather conditions," "accident type," "personnel casualties," "property damage," "liability determination," and "accident follow-up." Relationships between these information are determined based on statements indicating interrelationships within the data, such as "occurred at," "due to," "resulting in," and "attributed to," identifying relationships between the information preceding and following these statements. The shipping accident information and their relationships are stored using a dual structure: a vector database and a Neo4j graph database. A shipping accident knowledge graph containing partial information is shown below. Figure 5 As shown.

[0104] S2. Use a large language model to parse the problem and generate query statements; The user inputs a natural language question, for example, "Will a collision occur while sailing in fog?" The DeepSeek-R1 model accepts the input, combines prompt word templates, accident graph content, and ontology structure, and calls a pre-trained language model to semantically complete the question, generating query targets including "sailing in fog" and "collision" along with search suggestions. The `deepseek_generate(prompt, files)` method is then called to generate a Cypher query statement based on pre-defined prompt word system information and structured information such as graph attribute definitions and relation definitions.

[0105] S3. Retrieve from the shipping accident knowledge graph according to the query statement, output the nodes and edges that match the query statement from the shipping accident knowledge graph, and generate a Bayesian network based on the matching nodes and edges. Execute a Cypher query in the Neo4j database's shipping accident knowledge graph, calling the `execute_and_visualize_query(query)` method. Extract all shipping accident information matching the Cypher query and the relationships between these accidents from the knowledge graph, forming Bayesian networks containing "navigation in fog," "collision," and the relationships between these accidents, as shown below. Figure 6 As shown.

[0106] S4. Generate query results based on the conditional probability of the target node and its parent node and / or the posterior probability of its child nodes in the Bayesian network, and input the query results into the large language model. Calculate the conditional probability of each chain segment in the Bayesian network, output the corresponding shipping accident information and the relationship between shipping accident information as the query result, and send the query result to the DeepSeek-R1 model.

[0107] S5. The large language model generates answers based on the query results; For the query results, the DeepSeek-R1 model enables context enhancement, combining historical answers and knowledge base text to form a complete context. The model returns the natural language answer "The probability of collision is high when sailing in fog," and the system organizes a structured output template, calling the map component to generate an answer map.

[0108] This invention also provides an embodiment to demonstrate the accuracy of the shipping accident analysis method of this invention compared to the large language model analysis method in analyzing shipping accidents, including: Six datasets were constructed, each containing 50 different shipping accident reports. For each dataset, four questions related to the number of accidents and their corresponding correct answers were prepared. The questions included the accident location, time, and weather, as shown in Table 1. Table 1. Dataset and Problems For each dataset, a knowledge graph was constructed using the shipping accident analysis method of this invention, and the DeepSeek-R1 model was used for access. Then, questions corresponding to each dataset were posed, and answers were collected and compared with the correct answers. The accuracy of the answers was calculated by dividing the number of accidents in the answers by the number of correct accidents. The results are shown in Table 2. Table 2. Accuracy of Deepseek-R1 model and the method of this invention in answering questions. It is evident that this system significantly outperforms DeepSeek in terms of generation accuracy, providing more precise and targeted answers. This fully demonstrates the advantages of domain knowledge enhancement and structured support in intelligent question answering, offering more reliable intelligent assistance for shipping safety management in complex scenarios.

[0109] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0110] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for analyzing shipping accidents, characterized in that, Includes the following steps: Constructing a knowledge graph of shipping accidents; Input a question, and use a retrieval enhancement generation method to search the shipping accident knowledge graph and generate an answer; Among them, a retrieval enhancement generation method is used to retrieve information from the shipping accident knowledge graph and generate answers, including: The problem is parsed using a large language model to generate a query statement; The query statement is used to retrieve data from the shipping accident knowledge graph. Nodes and edges that match the query statement are output from the shipping accident knowledge graph. A Bayesian network is generated based on the matching nodes and edges. Based on the conditional probability of the target node and its parent node and / or the posterior probability of its child nodes in the Bayesian network, a query result is generated, and the query result is input into the large language model. The large language model generates an answer based on the query results.

2. The shipping accident analysis method according to claim 1, characterized in that, Constructing the shipping accident knowledge graph includes: The system provides shipping accident data, uses the large language model to extract shipping accident information and the relationships between the shipping accident information from the shipping accident data, constructs an ontology model of shipping accident information, and inputs the ontology model into the shipping accident database to obtain the shipping accident knowledge graph.

3. The shipping accident analysis method according to claim 2, characterized in that, Using the aforementioned large language model, shipping accident information and the relationships between the shipping accident information are extracted from the shipping accident data, and an ontology model of shipping accident information is constructed, including: Based on the shipping accident information and the relationships between the shipping accident information, a large language model is used to supplement the missing shipping accident elements.

4. The shipping accident analysis method according to claim 1, characterized in that, The problem is parsed using a large language model to generate query statements, including: The large language model generates a first target field that matches the shipping accident element type based on the user input question and preset shipping accident element types; the large language model also generates a second target field that matches the shipping accident information based on the user input question. A first query statement is generated based on the first target field, and a second query statement is generated based on the second target field.

5. The shipping accident analysis method according to claim 1, characterized in that, The large language model generates a first target field that matches the shipping accident element type based on the user input question and preset shipping accident element types, including: The large language model extracts fields that match the shipping accident element types from the question based on the preset shipping accident element types, and fills in supplementary fields for fields that are missing in the shipping accident element types. The first target field is generated based on the matching field and the supplementary field.

6. The shipping accident analysis method according to claim 5, characterized in that, Based on the query statement, a search is performed in the shipping accident knowledge graph. Nodes and edges matching the query statement are output from the shipping accident knowledge graph. A Bayesian network is generated based on the matching nodes and edges, including: The query statement is executed on the shipping accident knowledge graph. Target nodes that match the query statement are selected from the shipping accident knowledge graph. Starting from the target node, the edges of the target node are extended level by level to obtain at least one causal chain containing the target node. The Bayesian network is generated based on the at least one causal chain.

7. The shipping accident analysis method according to claim 4, characterized in that, The large language model generates an answer based on the query results, including: The first answer generated based on the first query statement and the second answer generated based on the second query statement are merged, and content with low credibility in the content of the first answer and the second answer is removed to generate the answer.

8. A shipping accident analysis device, characterized in that, include: The data module is used to store the constructed shipping accident knowledge graph; The retrieval module is used to input a question, parse the question using a large language model, and generate a query statement. Based on the query statement, it retrieves nodes and edges matching the query statement from the shipping accident knowledge graph, and generates a Bayesian network based on the matching nodes and edges. Based on the conditional probabilities of the target node and its parent node and / or its child nodes in the Bayesian network, it generates query results, which are then input into the large language model. The large language model generates an answer based on the query results.

9. A computer device, characterized in that, The computer device is used to execute the shipping accident analysis method according to any one of claims 1-7.

10. A storage medium, characterized in that, The storage medium is used to store a program that can execute the shipping accident analysis method of any of claims 1-7.

Citation Information

Patent Citations

  • Maritime accident assisting method and device based on knowledge graph and electronic equipment

    CN116860984A

  • Foundation pit construction accident knowledge graph construction method based on text mining

    CN119202264A

  • Ship collision risk analysis method and system based on fault tree and Bayesian network

    CN120278271A

Cited By

  • Intelligent decision-making method based on new energy ship multi-dimensional risk coupling modeling and related equipment

    CN121808951A