Dangerous article risk detection method, device, equipment, medium and program product
By constructing a graph structure of the import and export process of dangerous goods and performing feature enhancement, anomaly prediction models are used to detect abnormal risks, which solves the problem of low accuracy of traditional detection methods and achieves more accurate and efficient identification of abnormal risks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN ACAD OF INSPECTION & QUARANTINE
- Filing Date
- 2025-02-21
- Publication Date
- 2026-07-03
AI Technical Summary
Traditional methods for detecting abnormal risks in the import and export of dangerous goods are relatively simple, with low accuracy in identifying abnormal behavior, making it difficult to accurately identify abnormal risks in the import and export process of dangerous goods.
A graph structure for the import and export of dangerous goods is constructed, and feature enhancement is performed using a graph diffusion algorithm. A pre-trained anomaly prediction model is used for deep learning to identify abnormal risks. This includes constructing an original structure graph, generating a higher-order structure graph based on the graph diffusion algorithm, and using the anomaly prediction model for detection and risk warning.
It improves the accuracy of identifying abnormal situations and the efficiency of data processing in the import and export of dangerous goods, enabling rapid identification of abnormal risks and enhancing the accuracy and information extraction capabilities of the anomaly prediction model.
Smart Images

Figure CN120145246B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, equipment, medium, and program product for detecting the risks of hazardous materials. Background Technology
[0002] With the increasing variety of hazardous chemicals and other dangerous goods, and the growing number of global import and export ports, the interactions between dangerous goods and various trading parties and ports have become more complex and diverse. Normal import and export activities often follow certain patterns and take place at specific ports. If dangerous goods exhibit deviations from these patterns during import and export, potential abnormal risks may exist, posing safety hazards to the regulatory system and the social environment. Therefore, detecting abnormal risks during the import and export of dangerous goods has become crucial.
[0003] Traditional methods for detecting abnormal risks in import and export typically rely on behavioral patterns derived from relevant regulatory rules or simple statistical analysis to identify abnormal behaviors during the import and export of dangerous goods and issue risk warnings when such behaviors are detected. However, these methods are relatively simple and cannot cope with the increasingly complex interactions between import and export entities. Their accuracy in identifying abnormal behaviors is low, making it difficult to accurately pinpoint abnormal risks in the import and export of dangerous goods. Summary of the Invention
[0004] This invention provides a method, apparatus, equipment, medium, and program product for detecting risks of dangerous goods, in order to solve the problem that the abnormal risk detection methods are relatively simple, the accuracy of abnormal behavior identification is low, and it is difficult to accurately identify abnormal risks in the import and export process of dangerous goods.
[0005] In a first aspect, embodiments of this application provide a method for detecting the risk of hazardous materials, including:
[0006] A graph structure is constructed based on the interactive behavior data generated during the import and export process of dangerous goods, resulting in the original structure graph of dangerous goods in the import and export scenario. The nodes of the original structure graph include dangerous goods and the interactive participants of dangerous goods in the import and export process, and the edges of the original structure graph are the interactive behavior data between each node.
[0007] The graph diffusion algorithm is used to perform feature enhancement on the original structure graph to obtain a higher-order structure graph with enhanced features. The nodes in the higher-order structure graph are the same as those in the original structure graph, but the node relationships in the higher-order structure graph are different from those in the original structure graph.
[0008] Based on the original structure diagram and the higher-order structure diagram, a pre-trained anomaly prediction model is used to detect abnormal risks of dangerous goods in the import and export process. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interaction behavior data of the same type of dangerous goods in the import and export process.
[0009] Risk warnings are issued when abnormal risks are detected in the import and export of dangerous goods.
[0010] Optionally, the original structure graph is subjected to feature enhancement processing based on the graph diffusion algorithm to obtain a feature-enhanced higher-order structure graph, including:
[0011] The graph diffusion algorithm is used to perform graph diffusion on the node relationships of the original structure graph to obtain the diffusion matrix of the original structure graph;
[0012] The nearest neighbor algorithm is used to construct the target feature map by node similarity based on the original structural graph.
[0013] Based on the diffusion matrix and the target feature map, graph feature enhancement is performed on the original structure map to obtain a higher-order structure map.
[0014] Optionally, based on the original structure diagram and the higher-order structure diagram, a pre-trained anomaly prediction model is used to detect abnormal risks of dangerous goods during import and export processes, including:
[0015] The original structure graph and the higher-order structure graph are input into the anomaly prediction model. The original structure graph and the higher-order structure graph are compared and learned through a contrastive learning network. The vector output data is based on the contrastive learning network. Anomaly detection network is used to detect anomalies in multiple nodes to obtain risk scores for multiple nodes.
[0016] Based on risk scores at multiple nodes, abnormal risks of dangerous goods during import and export processes are detected.
[0017] When multiple nodes are detected to have risk scores greater than a preset threshold, it is determined that there is an abnormal risk in the import and export process of dangerous goods.
[0018] Optionally, the anomaly prediction model is trained as follows:
[0019] Graph structures are constructed for multiple historical interaction behavior data to obtain historical original graphs of multiple historical interaction behavior data. Feature enhancement processing is then performed on each historical original graph to obtain historical higher-order graphs of multiple historical original graphs.
[0020] Using the original historical image and the corresponding higher-order historical image as training sample pairs, multiple training sample pairs are obtained, and each training sample pair is labeled with a calibration node.
[0021] The training sample pairs are input into the preset network structure. The training sample pairs are compared and learned by the contrastive learning network of the preset network structure to obtain the loss of the contrastive learning network. Based on the vector output data of the contrastive learning network, the anomaly detection network of the preset network structure is used to detect anomalies in the labeled nodes to obtain the loss of the anomaly detection network.
[0022] The total model loss is determined based on the loss of the contrastive learning network and the loss of the anomaly detection network.
[0023] If the total loss of the model does not meet the convergence condition, the parameters of the preset network structure are iteratively trained based on multiple training samples until the total loss of the model meets the convergence condition. The preset network structure with converged output parameters is then used as the anomaly prediction model.
[0024] Secondly, embodiments of this application provide a hazardous materials risk detection device, comprising:
[0025] The construction module is used to construct a graph structure based on the interactive behavior data generated during the import and export process of dangerous goods, so as to obtain the original structure graph of dangerous goods in the import and export scenario. The nodes of the original structure graph include dangerous goods and interactive participants of dangerous goods in the import and export process, and the edges of the original structure graph are the interactive behavior data between each node.
[0026] The processing module is used to perform feature enhancement processing on the original structure graph based on the graph diffusion algorithm to obtain a higher-order structure graph with enhanced features. The nodes in the higher-order structure graph are the same as the nodes in the original structure graph, but the node relationships in the higher-order structure graph are different from those in the original structure graph.
[0027] The detection module is used to detect abnormal risks of dangerous goods in the import and export process based on the original structure diagram and the high-order structure diagram, using a pre-trained anomaly prediction model. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interaction behavior data of the same type of dangerous goods in the import and export process.
[0028] The early warning module is used to issue risk warnings when abnormal risks are detected in the import and export of dangerous goods.
[0029] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device enables the above-described dangerous goods risk detection method.
[0030] Fourthly, embodiments of this application provide a readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned dangerous goods risk detection method.
[0031] Fifthly, embodiments of this application provide a computer program product, including a computer program, which, when run, causes the aforementioned hazardous materials risk detection method to be executed.
[0032] In one solution provided by the aforementioned dangerous goods risk detection method, device, equipment, medium, and program products, a graph structure is constructed based on the interactive behavior data generated during the import and export process of dangerous goods to obtain the original structure graph of dangerous goods in the import and export scenario. The nodes of the original structure graph include dangerous goods and the interactive participants of dangerous goods in the import and export process, and the edges of the original structure graph are the interactive behavior data between each node. Based on the graph diffusion algorithm, feature enhancement processing is performed on the original structure graph to obtain a feature-enhanced higher-order structure graph. The nodes in the higher-order structure graph are the same as the nodes in the original structure graph, but the node relationships in the higher-order structure graph are different from those in the original structure graph. Based on the original structure graph and the higher-order structure graph, a pre-trained anomaly prediction model is used to detect abnormal risks of dangerous goods in the import and export process, and a risk warning is issued when abnormal risks of dangerous goods in the import and export process are detected. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interactive behavior data of the same type of dangerous goods in the import and export process. In this embodiment, a static graph structure is introduced into the import and export risk detection process. The static graph structure represents the interactive relationships between dangerous goods, trading parties, and ports, and then the static graph structure is enhanced to uncover the deep-seated relationships between dangerous goods and various interactive parties. Through the static graph structure and the high-order structure graph, the complex interaction patterns between dangerous goods and various interactive parties in the import and export process can be comprehensively depicted, providing a more diverse and accurate information foundation for subsequent abnormal risk detection. This improves the accuracy of identifying abnormal situations in the import and export process of dangerous goods, thereby enabling accurate identification of abnormal risks in the import and export process of dangerous goods. Attached Figure Description
[0033] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention 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 these drawings without creative effort.
[0034] Figure 1 This is a schematic diagram of an application environment for a hazardous materials risk detection method according to an embodiment of the present invention;
[0035] Figure 2 This is a flowchart illustrating a method for detecting the risk of hazardous materials according to an embodiment of the present invention;
[0036] Figure 3 yes Figure 2 A schematic diagram of the implementation process of step S20;
[0037] Figure 4 This is a schematic diagram of the original structure diagram and diffusion diagram in one embodiment of the present invention;
[0038] Figure 5 This is a schematic diagram of the original structure diagram and the target feature diagram in one embodiment of the present invention;
[0039] Figure 6 This is a schematic diagram of a higher-order structure diagram in one embodiment of the present invention;
[0040] Figure 7 This is a schematic diagram of a training process for an anomaly prediction model in one embodiment of the present invention;
[0041] Figure 8 yes Figure 2 A schematic diagram of the implementation process of step S30;
[0042] Figure 9 This is a schematic diagram of a hazardous materials risk detection device according to an embodiment of the present invention;
[0043] Figure 10 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. It should also be understood that, as used in this specification and the appended claims, the term "and / or" refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0046] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0047] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0048] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0049] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0050] The hazardous materials risk detection method provided in this invention can be applied to, for example... Figure 1 The hazardous materials risk detection system shown includes a user terminal and a hazardous materials risk detection device, wherein the user terminal communicates with the hazardous materials risk detection device via a network.
[0051] When risk detection of hazardous materials is required, such as during the import and export of hazardous materials (e.g., hazardous chemicals), users send risk detection commands to the hazardous materials risk detection device via user terminals. These commands include interactive behavior data generated during the import and export process. Upon receiving the command, the hazardous materials risk detection device constructs a static graph structure based on the interactive behavior data, obtaining the original structure graph of the hazardous materials in the import / export scenario. The nodes of the original structure graph include the hazardous materials themselves and the interactive participants in the import / export process; the edges represent the interactive behavior data between the nodes. After obtaining the original structure graph, the hazardous materials risk detection device performs feature enhancement processing on it using a graph diffusion algorithm, resulting in a higher-order structure graph with enhanced features. The nodes in the higher-order structure graph are the same as those in the original structure graph, but the node relationships in the higher-order structure graph differ from those in the original structure graph. Then, based on the original and higher-order structure diagrams, the hazardous materials risk detection device uses a pre-trained anomaly prediction model to detect abnormal risks in the import and export process of hazardous materials. When anomalies are detected, a risk warning is issued, allowing users to be promptly informed of any abnormalities and take appropriate measures to reduce import and export risks. The anomaly prediction model is a neural network model trained using deep learning on multiple historical interaction data of similar hazardous materials during the import and export process.
[0052] In this embodiment, a static graph structure is introduced into the import and export risk detection system for risk detection. The static graph structure represents the interactive relationships between dangerous goods, trading parties, and ports, among other participants. Feature enhancement is then applied to the static graph structure to uncover deeper relationships between dangerous goods and various participants. The static graph structure and higher-order structure graphs comprehensively depict the complex interaction patterns between dangerous goods and various participants during the import and export process, providing a more diverse and accurate information foundation for subsequent anomaly risk detection. This improves the accuracy of identifying anomalies in the import and export process of dangerous goods, thus enabling accurate identification of abnormal risks. Furthermore, using anomaly prediction models for risk identification and detection improves data processing efficiency while maintaining accuracy, allowing for rapid identification of anomalies in the import and export process of dangerous goods. The anomaly prediction model trained using historical interaction data of similar dangerous goods in the import and export process improves its accuracy, thereby enhancing the accuracy of information extraction and identification from the static graph structure and higher-order structure graphs, further contributing to the accuracy of identifying anomalies in the import and export process of dangerous goods.
[0053] The user terminal includes, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The hazardous materials risk detection device can be a server, which can be implemented using a standalone server or a server cluster consisting of multiple servers. In other embodiments, the hazardous materials risk detection device can also be various personal computers, laptops, smartphones, tablets, or other terminal devices with data computing capabilities.
[0054] In one embodiment, such as Figure 2 As shown, a method for detecting the risk of hazardous materials is provided, which is applied to... Figure 1 Taking the hazardous materials risk detection system in China as an example, the following steps are included:
[0055] S10: Construct a graph structure based on the interactive behavior data generated during the import and export process of dangerous goods to obtain the original structure diagram of dangerous goods in the import and export scenario.
[0056] When risk detection of hazardous materials is required, such as during the import and export of hazardous materials (e.g., hazardous chemicals), users send risk detection commands to the hazardous materials risk detection device through user terminals. These commands include interactive behavior data generated during the import and export process. This interactive behavior data includes data on the interactions between different participating parties regarding the hazardous materials. These participating parties include the parties involved in the hazardous materials transaction (e.g., buyer, seller), ports of entry (e.g., import port, export port), and the parties involved in the storage and transportation of the hazardous materials to the import and export ports. The interactive behavior data generated during the import and export process includes the interaction behavior itself, as well as attribute data related to the interaction behavior, such as basic information about the hazardous materials (e.g., hazardous material category, name, and declaration information), port type, transaction amount, and means of transport.
[0057] Upon receiving the risk detection instruction, the hazardous materials risk detection device constructs a static graph structure based on the interactive behavior data generated by the hazardous materials during the import and export process, obtaining the original structural graph of the hazardous materials in the import and export scenario. The nodes of the original structural graph include the hazardous materials and the interactive participants in the import and export process. The edges of the original structural graph represent the interactive behavior data between the nodes; that is, nodes with interactive behavior are connected by edges. It can be represented as (X,A), where A represents the adjacency matrix of the original structure graph, which is used to represent the connection relationship between any two nodes in the n nodes of the original structure graph; X represents the attribute matrix of all nodes v in the original structure graph.
[0058] This static structure diagram not only represents the basic relationships between dangerous goods, trading parties, and ports, but also displays more detailed information (such as declaration elements, port type, transaction amount, and means of transport) through the attributes between nodes (such as dangerous chemicals, ports, and trading parties) and edges (such as the interaction behavior of import and export). This data structure can comprehensively depict the complex interaction patterns between dangerous goods and ports, trading parties, and transporters in the import and export dangerous goods trading network, thereby providing deeper insights for anomaly detection.
[0059] S20: The original structural graph is enhanced using a graph diffusion algorithm to obtain a higher-order structural graph with enhanced features.
[0060] After obtaining the original structural diagram of the hazardous materials, the hazardous materials risk detection device performs feature enhancement processing on the original structural diagram based on a graph diffusion algorithm to obtain a feature-enhanced higher-order structural diagram. In the higher-order structural diagram, the nodes are the same as those in the original structural diagram, but the node relationships in the higher-order structural diagram are different from those in the original structural diagram.
[0061] For example, a hazardous materials risk detection device can directly expand the adjacency matrix of nodes in the original structural graph based on a graph diffusion algorithm to obtain a diffusion graph of the original structural graph, which serves as the higher-order structural graph after feature enhancement. In other embodiments, the higher-order structural graph can be generated in other ways, which will not be elaborated here.
[0062] S30: Based on the original structure diagram and the higher-order structure diagram, a pre-trained anomaly prediction model is used to detect abnormal risks of dangerous goods in the import and export process.
[0063] After obtaining the original structure diagram and its higher-order structure diagram, the hazardous materials risk detection device acquires a pre-trained anomaly prediction model. This anomaly prediction model is a neural network model trained using deep learning on multiple historical interaction data points of similar hazardous materials during import and export processes. Using such data improves the accuracy of the anomaly prediction model. Based on the original and higher-order structure diagrams, the hazardous materials risk detection device uses the anomaly prediction model to predict anomalies at each node (i.e., hazardous materials and interacting parties) in the original structure diagram. Based on these predictions, the device detects any abnormal risks associated with the hazardous materials during import and export processes.
[0064] S40: Issue a risk warning when abnormal risks are detected during the import and export of dangerous goods.
[0065] When abnormal risks are detected in the import and export of dangerous goods, risk warnings are issued through user terminals.
[0066] Specifically, when anomalies are detected in any node of the original structure diagram, it is determined that there are abnormal risks in the import and export process of dangerous goods, and the node with the abnormality is located. The node with the abnormality is sent to the user terminal as an abnormal risk node for risk warning, so that the user can be informed in a timely manner of the abnormal risks in the import and export process of dangerous goods, as well as the node where the abnormality occurs.
[0067] In this embodiment, a static graph structure is introduced into the import and export risk detection system for risk detection. The static graph structure represents the interactive relationships between dangerous goods, trading parties, and ports, among other participants. Feature enhancement is then applied to the static graph structure to uncover deeper relationships between dangerous goods and various participants. The static graph structure and higher-order structure graphs comprehensively depict the complex interaction patterns between dangerous goods and various participants during the import and export process, providing a more diverse and accurate information foundation for subsequent anomaly risk detection. This improves the accuracy of identifying anomalies in the import and export process of dangerous goods, thus enabling accurate identification of abnormal risks. Furthermore, using anomaly prediction models for risk identification and detection improves data processing efficiency while maintaining accuracy, allowing for rapid identification of anomalies in the import and export process of dangerous goods. The anomaly prediction model trained using historical interaction data of similar dangerous goods in the import and export process improves its accuracy, thereby enhancing the accuracy of information extraction and identification from the static graph structure and higher-order structure graphs, further contributing to the accuracy of identifying anomalies in the import and export process of dangerous goods.
[0068] In one embodiment, such as Figure 3 As shown, step S20, which involves performing feature enhancement processing on the original structure graph based on the graph diffusion algorithm to obtain a higher-order structure graph with enhanced features, specifically includes the following steps:
[0069] S21: The graph diffusion algorithm is used to perform graph diffusion on the node relationships of the original structure graph to obtain the diffusion matrix of the original structure graph.
[0070] The hazardous materials risk detection device uses a graph diffusion algorithm to diffuse the node relationships of the original structural graph, obtaining the diffusion matrix of the original structural graph, which is the diffusion data of the original structural graph. Based on the relationships of each node in the diffusion matrix of the original structural graph, the graph structure can be reconstructed to obtain the diffusion graph of the original structural graph.
[0071] The process of graph diffusion can be represented as follows:
[0072]
[0073] Among them, S diffThe diffusion matrix representing the original structure diagram; Θ k It is a weighting factor that controls the ratio of local structural information to global structural information in the original structural diagram; It is the transition matrix that transforms the adjacency matrix of the original structure graph, where n represents the number of nodes in the original structure graph.
[0074] In one embodiment, a Personal Page Rank (PPR) algorithm can be used to enhance the original graph structure through graph diffusion. The graph diffusion process using PPR, i.e., the diffusion matrix, is determined by the following formula:
[0075] S diff =α(I-(1-α)D -1 / 2 AD -1 / 2 ) -1 ;
[0076] Among them, S diff Let A represent the diffusion matrix of the original structure graph; let A represent the adjacency matrix of the original structure graph. n represents the number of nodes in the original structure graph; I represents the identity matrix of the adjacency matrix; D represents the degree matrix of the adjacency matrix; α is an adjustable parameter of the personalized page ranking algorithm.
[0077] S22: The nearest neighbor algorithm is used to construct a graph based on node similarity from the original structure graph to obtain the target feature map.
[0078] It is important to understand that since the graph diffusion algorithm can establish connections between any two nodes in the original structure graph, the graph diffusion algorithm can be used to spread the node relationships of the original structure graph to obtain a higher-order structure graph. This may introduce noisy edges (i.e., connections between unrelated nodes, or connections between normal and abnormal nodes). Noisy edges will affect the accuracy of the higher-order structure graph.
[0079] Therefore, in this embodiment, the hazardous materials risk detection device uses a nearest neighbor algorithm to construct a target feature map based on node similarity of the original structure map. This allows for filtering of noise edges between nodes based on the structural information shared between the diffusion map and the target feature map, thereby improving the accuracy of the subsequently generated higher-order structure map.
[0080] The hazardous materials risk detection device can calculate the similarity (such as edit distance) between any two nodes in the original structure graph. Based on the similarity between any two nodes in the original structure graph, the K-Nearest Neighbors Algorithm (KNN) is used to update the connection relationship between each node and other nodes, thereby constructing the target feature map.
[0081] S23: Based on the diffusion matrix and the target feature map, perform graph feature enhancement on the original structure map to obtain a higher-order structure map.
[0082] After obtaining the diffusion matrix and the target feature map, graph feature enhancement is performed on the original structure graph based on the diffusion matrix and the target feature map to obtain a higher-order structure graph. For example, the diffusion graph can be directly obtained from the diffusion matrix. The shared edges between the diffusion graph and the target feature map (i.e., edges that both have in common) are retained, and the non-shared edges between the diffusion graph and the target feature map are filtered out to obtain the higher-order structure graph.
[0083] For example, such as Figure 4 As shown, the original structure graph includes nodes 1-8, and the edges (i.e., connections) of each node are shown in the figure. A graph diffusion algorithm is used to diffuse the node relationships of the original structure graph, resulting in a diffused graph of the original structure graph. Figure 5 As shown, a nearest neighbor algorithm (such as the K-nearest neighbor algorithm) is used to construct a graph based on node similarity from the original structure graph, resulting in the target feature map. From Figure 4 what Figure 5 It can be seen that the non-shared edges between the diffusion graph and the target feature graph are the edges between nodes 5 and 8, and the edges between nodes 7 and 8. By retaining the shared edges between the diffusion graph and the target feature graph and filtering out the non-shared edges, the higher-order structure graph can be obtained, as shown in the figure. Figure 6 As shown.
[0084] In this embodiment, a graph diffusion algorithm is used to diffuse the node relationships of the original structural graph to obtain a diffusion matrix. Then, a nearest neighbor algorithm is used to construct a target feature map based on node similarity. Finally, based on the diffusion matrix and the target feature map, graph feature enhancement is performed on the original structural graph to obtain a higher-order structural graph. This method can filter noisy edges between nodes based on the shared structural information of the diffusion graph and the target feature map, improving the accuracy of the higher-order structural graph and enabling accurate mining of the association information between different interactive participants in the import and export process of dangerous goods.
[0085] In one embodiment, step S22, which involves using a nearest neighbor algorithm to construct a target feature map from the original structural graph based on node similarity, specifically includes the following steps:
[0086] S221: Use the cosine similarity algorithm to determine the similarity between each node and other nodes in the original structure graph.
[0087] The hazardous materials risk detection device uses a cosine similarity algorithm to determine the similarity between each node and other nodes in the original structural graph. This similarity is the vector similarity of the nodes.
[0088] The hazardous materials risk detection device needs to perform vector encoding on each node (which may include the node's attribute data) in the original structural diagram to obtain the vector of each node in the original structural diagram; based on the vector of each node in the original structural diagram, the similarity between each node and other nodes is determined. The similarity between a node and other nodes is expressed by the following formula:
[0089]
[0090] in, This represents the cosine similarity between node i and node j in the original structural graph; x represents the transpose of the vector representing node i; j The vector representing node j; ||x i || represents the magnitude of the vector at node i; ||x j || represents the magnitude of the vector at node j.
[0091] S222: Sort nodes in descending order based on their similarity to other nodes, and select the first preset number of nodes as the neighbor nodes of each node.
[0092] After obtaining the similarity between each node and other nodes in the original structural diagram, the hazardous materials risk detection device sorts the other nodes in descending order based on the similarity between each node and other nodes, and selects the top 5 nodes as the node's neighbor nodes.
[0093] S223: Construct the node relationship features based on each node and its neighboring nodes in the original structure graph to obtain the target feature graph.
[0094] The hazardous materials risk detection device constructs a target feature map by analyzing the node relationships between nodes and their neighboring nodes in the original structural diagram. In this target feature map, nodes are connected to their neighboring nodes via edges.
[0095] For example, after determining the neighboring nodes of a node, it is possible to determine whether each node is connected to its neighboring nodes through an edge in the original structure graph. If a node is not connected to its neighboring nodes through an edge, then the unconnected node is connected to its neighboring nodes through an edge. By adding edges between each node and some other nodes, the structural relationship between each node is reconstructed.
[0096] In this embodiment, the cosine similarity algorithm is used to determine the similarity between each node and other nodes in the original structure graph. Based on the similarity between each node and other nodes, the neighboring nodes of each node are sorted in descending order, and the first preset number of neighboring nodes are selected as the neighboring nodes of the node. The node relationship features are constructed according to each node and its neighboring nodes in the original structure graph to obtain the target feature graph. This can increase the edges between each node and some other nodes, reconstruct the structural relationships between each node, and improve the diversity of the node structural relationships in the target feature graph. This allows for the discovery of the association information between different interactive participants in the import and export process of dangerous goods, and improves the subsequent high-order structure graph.
[0097] In one embodiment, step S23, namely, performing graph feature enhancement on the original structure map based on the diffusion matrix and the target feature map to obtain a higher-order structure map, specifically includes the following steps:
[0098] S231: Based on the diffusion matrix and the structure matrix of the target feature map, noise filtering is applied to the adjacency matrix of the original structure map to generate a higher-order structure matrix.
[0099] After obtaining the diffusion matrix and the target feature map, the hazardous materials risk detection device needs to generate a structure matrix of the target feature map based on the structural relationships of the nodes in the target feature map (i.e., the connection relationships between nodes). This structure matrix of the target feature map can be the adjacency matrix of the target feature map. Then, based on the diffusion matrix and the structure matrix of the target feature map, noise filtering is performed on the adjacency matrix of the original structure map to generate a higher-order structure matrix.
[0100] The higher-order structure matrix can be calculated using the following formula:
[0101]
[0102] Among them, S h S represents the higher-order structure matrix; A represents the adjacency matrix of the original structure graph; S represents the higher-order structure matrix. diff S represents the diffusion matrix, i.e., the structure matrix of the diffusion diagram; feat The structure matrix representing the target feature map; This represents the positive summation symbol, i.e., the summation symbol; This represents the symbol for the Hadamard product.
[0103] By using the diffusion matrix and the structure matrix of the target feature map, noise filtering is applied to the adjacency matrix of the original structure map to calculate the higher-order structure matrix. This eliminates the need for shared edge identification and non-shared edge deletion processing of the diffusion matrix for a single point in the diffusion map and the target feature map. The matrix calculation is simple and highly accurate.
[0104] S232: Construct a graph based on the higher-order structure matrix and the attribute matrix of the original structure graph to obtain a higher-order structure graph.
[0105] The hazardous materials risk detection device requires obtaining the attribute matrix of the original structure diagram. This attribute matrix is obtained by extracting the attribute data of the nodes in the original structure diagram. A higher-order structure diagram is then constructed based on the higher-order structure matrix and the attribute matrix of the original structure diagram. Specifically, the connection relationships between nodes are reconstructed according to the higher-order structure matrix, and the attribute data of the nodes in the original structure diagram are restored to the reconstructed structure diagram to obtain the higher-order structure diagram.
[0106] Among them, higher-order structure diagrams It can be represented as (X,S) h ),S h X represents the adjacency matrix of the higher-order structure graph, which is used to represent the connection relationship between any two nodes in the n nodes of the higher-order structure graph; X represents the attribute matrix of all nodes v in the higher-order structure graph, which is also the attribute matrix of the original structure graph.
[0107] In this embodiment, noise filtering is performed on the adjacency matrix of the original structure graph based on the diffusion matrix and the structure matrix of the target feature map to generate a higher-order structure matrix. Then, graph construction is performed based on the higher-order structure matrix and the attribute matrix of the original structure graph to obtain a higher-order structure graph. Graph construction is performed through matrix calculation, which is highly accurate, simple and convenient, and reduces the amount of computation.
[0108] In one embodiment, before step S30, i.e., before detecting abnormal risks of dangerous goods during import and export, the dangerous goods risk detection device needs to first use multiple historical interaction behavior data of similar dangerous goods during import and export to train an anomaly prediction model using deep learning on a preset network structure, so that the anomaly prediction model can be directly used to detect abnormal risks of dangerous goods during import and export. For example, Figure 7 As shown, the anomaly prediction model is trained in the following way:
[0109] S01: Construct graph structures for multiple historical interaction behavior data to obtain historical original graphs of multiple historical interaction behavior data, and perform feature enhancement processing on each historical original graph to obtain historical higher-order graphs of multiple historical original structure graphs.
[0110] The hazardous materials risk detection device acquires multiple historical interaction behavior data of the same type of hazardous materials during the import and export process. Then, it constructs graph structures for each of these historical interaction behavior data points, obtaining historical original graphs. After obtaining these historical original graphs, the device performs feature enhancement processing on each graph to obtain higher-order historical graphs of the historical original structure graphs.
[0111] The process of constructing the historical original graph is the same as the process of constructing the original structure graph mentioned earlier, and the process of obtaining the historical high-order graph is the same as the process of obtaining the high-order structure graph mentioned earlier, so it will not be repeated here.
[0112] S02: Using the original historical image and the corresponding higher-order historical image as training sample pairs, multiple training sample pairs are obtained, and each training sample pair is labeled with a calibration node.
[0113] The hazardous materials risk detection device uses historical original images and corresponding historical high-order images (i.e., historical high-order images of the original images) as training sample pairs to obtain multiple training sample pairs. Each training sample pair has the same calibration node marked on both the historical original image and the historical high-order image, so that subsequent anomaly detection targets can be detected using this calibration node.
[0114] S03: Input the training sample pairs into the preset network structure, perform comparative learning on the training sample pairs through the contrastive learning network of the preset network structure, obtain the loss of the contrastive learning network, and output data based on the vector of the contrastive learning network. Perform anomaly detection on the labeled nodes through the anomaly detection network of the preset network structure, and obtain the loss of the anomaly detection network.
[0115] In this embodiment, the preset network structure includes a contrastive learning network and an anomaly detection network connected in sequence.
[0116] The hazardous materials risk detection device inputs training sample pairs into a preset network structure, performs comparative learning on the training sample pairs through a contrastive learning network to obtain the loss of the contrastive learning network, and outputs data based on the vectors of the contrastive learning network. It then performs anomaly detection on the calibrated nodes through an anomaly detection network to obtain the loss of the anomaly detection network.
[0117] S04: Determine the total model loss based on the loss of the contrastive learning network and the loss of the anomaly detection network.
[0118] The hazardous materials risk detection device determines the total model loss based on the losses of the contrastive learning network and the anomaly detection network. Different balancing parameters can be set for the losses of the contrastive learning network and the anomaly detection network. Based on these balancing parameters, the losses of the contrastive learning network and the anomaly detection network are weighted and summed to obtain the total model loss.
[0119] S05: If the total loss of the model does not meet the convergence condition, continue to iteratively train the parameters of the preset network structure based on multiple training samples until the total loss of the model meets the convergence condition. Then, output the preset network structure with converged parameters as the anomaly prediction model.
[0120] If the total loss of the model does not meet the convergence condition, the parameters of the preset network structure are iteratively trained based on multiple training samples, i.e., steps S03 to S04 are executed until the total loss of the model meets the convergence condition. The preset network structure with converged parameters is then used as the anomaly prediction model.
[0121] This embodiment clarifies the training process of the anomaly prediction model. By constructing a graph structure from multiple historical interaction behavior data, multiple historical original graphs and historical higher-order graphs are obtained. Then, the historical original graphs and corresponding historical higher-order graphs are used as training samples to train the model, obtaining the loss of the contrastive learning network and the loss of the anomaly detection network, thereby determining the total model loss. If the total model loss does not meet the convergence condition, iterative training continues on the parameters of the preset network structure based on multiple training samples until the model converges to obtain the anomaly prediction model. The total model loss determined by the loss of the contrastive learning network and the loss of the anomaly detection network is used as the model optimization objective. During training, this improves the information mining ability of the contrastive learning network on the original and higher-order structure graphs, enabling the extraction of deep correlation information between nodes in the import / export process. This enhances the contrastive learning and anomaly detection capabilities of the anomaly prediction model, improves subsequent anomaly risk detection capabilities, and increases the accuracy of anomaly risk detection during the import / export process.
[0122] In one embodiment, the contrastive learning network includes a sampling module, an encoding module, and a contrastive learning module. Step S03 involves performing contrastive learning on the training sample pairs using a contrastive learning network with a preset network structure to obtain the loss of the contrastive learning network. Specifically, this includes the following steps:
[0123] S031: The sampling module of the contrastive learning network performs sub-graph sampling on the historical original graph and the historical high-order graph of the training sample pair respectively, to obtain multiple original sub-graphs of preset size in the historical original graph and multiple high-order sub-graphs of preset size in the historical high-order graph.
[0124] S032: By using the encoding module of the contrastive learning network to perform low-dimensional encoding on multiple original subgraphs, the encoding vectors of multiple original subgraphs and the first encoding vector of the labeled nodes in the original subgraphs are obtained. By using the encoding module to perform low-dimensional encoding on multiple high-order subgraphs, the encoding vectors of multiple high-order subgraphs and the second encoding vector of the labeled nodes in the high-order subgraphs are obtained.
[0125] S033: Through the contrastive learning module of the contrastive learning network, sample pairs are constructed from the first encoding vector of the labeled node, the encoding vectors of multiple original subgraphs, and the encoding vectors of multiple higher-order subgraphs. Based on the constructed multiple first sample pairs and multiple second sample pairs, contrastive learning is performed to obtain the loss of the contrastive learning network.
[0126] The contrastive learning module of the contrastive learning network constructs sample pairs by combining the first encoding vector of the calibration node with the encoding vectors of multiple original subgraphs. This involves forming a sample pair by combining the first encoding vector of the calibration node with the encoding vector of an original subgraph, resulting in multiple first sample pairs. These first sample pairs include positive and negative sample pairs. Positive sample pairs correspond to original subgraphs containing the calibration node, while negative sample pairs correspond to original subgraphs not containing the calibration node.
[0127] Similarly, sample pairs are constructed by combining the second encoding vector of the calibration node with the encoding vectors of multiple higher-order subgraphs. This involves forming a sample pair by combining the second encoding vector of the calibration node with the encoding vector of a higher-order subgraph, resulting in multiple second sample pairs. These multiple second sample pairs include positive sample pairs and negative sample pairs. Positive sample pairs correspond to higher-order subgraphs that contain the calibration node, while negative sample pairs correspond to higher-order subgraphs that do not contain the calibration node.
[0128] The contrastive learning loss between a node and a subgraph is obtained by performing contrastive learning on multiple first sample pairs and multiple second sample pairs of negative sample pairs, i.e., the first contrastive loss; the contrastive learning loss between a node and a subgraph is obtained by performing contrastive learning on multiple second sample pairs and multiple first sample pairs of negative sample pairs, i.e., the second contrastive loss; the loss of the contrastive learning network is determined based on the first contrastive loss and the second contrastive loss.
[0129] The first contrast loss is expressed by the following formula:
[0130]
[0131] in, Indicates the first comparative loss; This represents the total number of nodes in the original historical graph; This indicates the location of node v in the original historical graph. i Embedded representation, and These represent the encoding vectors of the original subgraphs containing the calibration nodes in positive sample pairs and the encoding vectors of the original subgraphs not containing the calibration nodes in negative sample pairs, respectively. The negative sample pair does not contain the calibration node v i The encoding vector of the higher-order subgraph, where τ is the temperature parameter.
[0132] The second contrast loss is expressed by the following formula:
[0133]
[0134] in, Indicates the second comparative loss; This represents the total number of nodes in the historical high-order graph; This indicates the labeling of node v in the historical high-order graph. i Embedded representation, and represents the encoding vector of the higher-order subgraph containing the labeled node in the positive sample pair, and the encoding vector of the higher-order subgraph not containing the labeled node in the negative sample pair, respectively. The negative sample pair does not contain the calibration node v i The encoding vector of the original subgraph, where τ is the temperature parameter.
[0135] The loss of the contrastive learning network is expressed by the following formula:
[0136]
[0137] in, This represents the loss of the contrastive learning network; Indicates the first comparative loss; This indicates the second comparative loss.
[0138] In this embodiment, the loss of the contrastive learning network is obtained by comparing and analyzing the labeled nodes with the subgraphs of the historical original graph and the historical high-order graph. The loss of the contrastive learning network is then used as the comparison target to optimize the encoding ability of the model, enhance the semantic discriminability of the nodes, and thus improve the accuracy of the encoding vectors of the nodes and subgraphs obtained by the contrastive learning network.
[0139] In one embodiment, the anomaly detection network includes a structure discriminator and an attribute detection module; the loss of the anomaly detection network includes the loss of the structure similarity discriminator and the loss of the attribute detection module; the vector output data of the contrastive learning network includes multiple first sample pairs of the historical original graph and multiple second sample pairs of the historical higher-order graph. In step S03, based on the vector output data of the contrastive learning network, anomaly detection is performed on the labeled nodes through the anomaly detection network with a preset network structure to obtain the loss of the anomaly detection network, specifically including the following steps:
[0140] S034: Based on multiple first sample pairs and multiple second sample pairs, the similarity between the labeled nodes and the subgraph is identified by the structure discriminator, and the loss of the structure discriminator is obtained.
[0141] In this process, multiple first sample pairs based on the historical original graph are used by a structure discriminator to identify the similarity between the labeled nodes in the historical original graph and each original subgraph, thus obtaining the similarity between each original subgraph and the labeled nodes in the historical original graph, which is the node subgraph similarity of multiple first sample pairs. The first structural loss is then calculated based on the node subgraph similarity of multiple first sample pairs. Similarly, multiple second sample pairs based on the historical original graph are used by a structure discriminator to identify the similarity between the labeled nodes in the historical high-order graph and each high-order subgraph, thus obtaining the similarity between each high-order subgraph and the labeled nodes in the historical high-order graph, which is the node subgraph similarity of multiple second sample pairs. The second structural loss is then calculated based on the node subgraph similarity of multiple second sample pairs. Finally, the loss of the structure discriminator is determined based on the first and second structural losses.
[0142] The structural risk of the labeled node in the historical original graph can be obtained by directly using the subgraph similarity of the node subgraphs of the first sample pair. Since multiple first sample pairs include both positive and negative pairs, the sum of the subgraph risk values of the negative pairs in the multiple first samples is subtracted from the sum of the subgraph risk values of the positive pairs in the multiple first samples to obtain the structural risk of the labeled node in the historical original graph, i.e., the first structural risk of the labeled node, which has high accuracy. Similarly, the structural risk of the labeled node in the historical higher-order graph can be obtained by directly using the subgraph similarity of the node subgraphs of the second sample pair. Since multiple first sample pairs include both positive and negative pairs, the sum of the subgraph risk values of the negative pairs in the multiple second samples is subtracted from the sum of the subgraph risk values of the positive pairs in the multiple second samples to obtain the structural risk value of the labeled node in the historical higher-order graph. Then, averaging the structural risk values of the labeled node in the historical original graph and the structural risk values of the labeled node in the historical higher-order graph yields the overall structural risk value of the labeled node, which also has high accuracy.
[0143] The first structural loss is expressed by the following formula:
[0144]
[0145] in, Indicates the first structural loss; The first encoding vector z of the labeled nodes in the first sample pair i The encoding vector e of the original subgraph i Similarity; Bilinear represents the bilinear model; sigmoid(·) represents the logistic function; W is the parameter matrix; y i The constant coefficients of the sample pairs are y when the first sample pair is a positive sample pair. i y is 1; when the first sample pair is a negative sample pair, y i 0; n represents the number of the first sample pair.
[0146] The second structural loss is expressed by the following formula:
[0147]
[0148] in, Indicates the second structural loss; The second encoding vector z represents the calibrated node in the second sample pair. i The encoding vector e of the higher-order subgraph i Similarity; Bilinear represents the bilinear model; sigmoid(·) represents the logistic function; W is the parameter matrix; y i The constant coefficients of the sample pairs, y, are given when the second sample pair is a positive sample pair. i y is 1; when the second sample pair is a negative sample pair, y i It is 0.
[0149] The loss of the structure discriminator is expressed by the following formula:
[0150]
[0151] in, This indicates the loss of the structure discriminator; Indicates the first structural loss; This indicates the loss of the second structure.
[0152] S035: Based on the original subgraph containing the calibration nodes in the historical original graph and the high-order subgraph containing the calibration nodes in the historical high-order graph, the attribute detection module detects the attribute error between the calibration nodes and the subgraph, and obtains the loss of the attribute detection module.
[0153] Specifically, the attribute data of the labeled nodes in the historical original graph is encoded to obtain the attribute vectors of the labeled nodes. A contrastive learning network is used to encode the attribute data of each node in the original subgraph including the labeled nodes (called the target original subgraph) to obtain the attribute encoding vector of each node in the target original subgraph. The attribute encoding vectors of each node in the target original subgraph are concatenated into a one-dimensional vector, and a multilayer perceptron (MLP) is used to map the concatenated one-dimensional vector to obtain an encoding vector with the same dimension as the attribute vector of the labeled nodes. This encoded vector is used as the attribute vector of the target original subgraph, i.e., the first attribute vector. A contrastive learning network is used to encode the attribute data of each node in a high-order subgraph including the calibration node (referred to as the target high-order subgraph), resulting in attribute encoding vectors for each node in the target high-order subgraph. These attribute encoding vectors are concatenated into a one-dimensional vector. A multilayer perceptron (MLP) is then used to map this one-dimensional vector to obtain an encoding vector with the same dimension as the attribute vectors of the calibration nodes. This vector serves as the attribute vector for the target high-order subgraph, thus yielding the second attribute vector. The similarity between the first attribute vector and the attribute vectors of the calibration nodes is determined, resulting in the first attribute loss. Similarly, the similarity between the second attribute vector and the attribute vectors of the calibration nodes is determined, resulting in the second attribute loss.
[0154] In this approach, a multilayer perceptron can be used as the attribute error generator. The attribute encoding vectors of each node in the original target subgraph are mapped to obtain the first attribute vector. The similarity between the first attribute vector and the attribute vector of the calibrated node is determined using the Euclidean norm (L2 norm). This yields the attribute generation error of the calibrated node in the original target subgraph. The attribute generation errors of the calibrated node in different original target subgraphs are averaged to obtain the first attribute loss of the attribute detection module. The first attribute loss is expressed by the following formula:
[0155]
[0156] in, This represents the loss of the first attribute, i.e., the loss of the calibrated node v. i Similarity to its original subgraph; MLP represents the similarity between the MLP and the original subgraph through a multilayer perceptron. i ) represents the first attribute vector, that is, the attribute vector of the original subgraph including the labeled nodes; E i This represents a one-dimensional vector obtained by concatenating the attribute encoding vectors of each node in the original target subgraph; x i Indicates the calibration node v i The attribute vector; n represents the number of original subgraphs including the labeled nodes.
[0157] Similarly, a multilayer perceptron can be used as an attribute error generator to map the attribute number encoding vectors of each node in the target high-order subgraph to obtain the second attribute vector. The Euclidean norm is then used to determine the similarity between the second attribute vector and the second attribute vector of the calibrated node, thus obtaining the attribute generation error of the calibrated node in the target high-order subgraph. Then, the attribute generation errors of the calibrated node in different target original subgraphs are averaged to obtain the second attribute loss of the attribute detection module.
[0158] One approach is to directly use the attribute generation error of the calibration node in the original target subgraph as the attribute risk value of the calibration node in that original target subgraph, and the attribute generation error of the calibration node in the higher-order target subgraph as the attribute risk value of the calibration node in that higher-order target subgraph. By averaging the attribute risk values of the calibration node in the original target subgraph and the higher-order target subgraph, the attribute risk value of the calibration node can be obtained. This method is highly accurate and simple to understand.
[0159] The loss of the attribute detection module is expressed by the following formula:
[0160]
[0161] in, This represents the loss of the attribute detection module; Indicates the loss of the first attribute; This indicates the loss of the second attribute.
[0162] It is important to understand that the essence of attribute anomalies is that a node's attributes differ significantly from those of its neighboring nodes. In this embodiment, by distinguishing the consistency of attributes between a node and its local neighbors, the essence of node attribute anomalies can be captured, providing greater utility for anomaly detection. Based on the node subgraph structure relationship discrimination loss, a node attribute error loss is added, enabling the detection of not only node structure anomalies but also attribute anomalies, thus improving the model's anomaly detection capability.
[0163] In one embodiment, step S04, which involves determining the total model loss based on the loss of the contrastive learning network and the loss of the anomaly detection network, specifically includes the following steps:
[0164] S041: Determine the loss of the structure discriminator and the loss of the attribute detection module in the loss of the anomaly detection network;
[0165] S042: Determine the total model loss based on the loss of the contrastive learning network, the loss of the structure discriminator, and the loss of the attribute detection module.
[0166] The anomaly detection network comprises a structure discriminator and an attribute detection module. The loss of the anomaly detection network includes the loss of the structure discriminator and the loss of the attribute detection module. Based on the balance coefficients of different losses, the losses of the structure discriminator, the attribute detection module, and the contrastive learning network are weighted and summed to obtain the total model loss.
[0167] The total loss of the model is expressed by the following formula:
[0168]
[0169] in, This represents the total loss of the model; This indicates the loss of the structure discriminator; This represents the loss of the attribute detection module; α represents the loss of the contrastive learning network; α and γ represent the balance coefficients for different types of loss, which are constant values.
[0170] In this embodiment, the total model loss is determined based on the loss of the contrastive learning network, the loss of the structure discriminator, and the loss of the attribute detection module. The model training effect can be improved by using the encoding ability of the contrastive learning network, the structural anomaly detection ability of the node subgraph, and the node attribute anomaly detection ability as optimization targets, thereby improving the encoding ability, structural anomaly and attribute anomaly detection ability of the anomaly detection model, and improving the accuracy of subsequent anomaly risk detection.
[0171] In one embodiment, the anomaly prediction model includes a contrastive learning network and an anomaly detection network connected in sequence. For example... Figure 8 As shown, step S30, which involves detecting abnormal risks of dangerous goods during import and export based on the original structure diagram and the higher-order structure diagram, and issuing a risk warning when abnormal risks are detected, specifically includes the following steps:
[0172] S31: Input the original structure graph and the higher-order structure graph into the anomaly prediction model, perform comparative learning on the original structure graph and the higher-order structure graph through a contrastive learning network, and output data based on the vectors of the contrastive learning network. Then, perform anomaly detection on multiple nodes through an anomaly detection network to obtain risk scores for multiple nodes.
[0173] After obtaining the original and higher-order structure graphs, an anomaly prediction model is used to predict node anomalies in both graphs, resulting in risk scores for multiple nodes in the original graph. Alternatively, the original and higher-order structure graphs are directly input into the anomaly prediction model. A contrastive learning network performs comparative learning on the original and higher-order structure graphs, and based on the vector output data from the contrastive learning network, an anomaly detection network detects anomalies in multiple nodes, yielding risk scores for each node.
[0174] S32: Based on the risk scores of multiple nodes, detect the abnormal risks of dangerous goods in the import and export process. When a risk node with a risk score greater than a preset threshold is detected among multiple nodes, determine the abnormal risks of dangerous goods in the import and export process.
[0175] Then, based on the risk scores of multiple nodes, abnormal risks of dangerous goods in the import and export process are detected. When a risk node with a risk score greater than a preset threshold is detected among multiple nodes, it is determined that there are abnormal risks of dangerous goods in the import and export process, and a risk warning is issued for the risk node.
[0176] In this embodiment, an anomaly prediction model is used to predict node anomalies using the original structure graph and the higher-order structure graph. This yields risk scores for multiple nodes in the original structure graph. Based on these risk scores, anomaly risks in the import / export process of hazardous materials are detected. When a node with a risk score exceeding a preset threshold is detected, an anomaly risk is identified in the import / export process, and a risk warning is issued for that node. This anomaly prediction model scores all nodes (i.e., interacting parties) in the import / export process of hazardous materials to identify nodes with anomalies, offering a simple, intuitive, and highly accurate approach.
[0177] In one embodiment, the anomaly prediction model includes a contrastive learning network, an anomaly detection network, and an aggregator connected in sequence. The anomaly detection network includes a structure discriminator for detecting node structural anomalies and an attribute detection module for detecting node attribute anomalies. Step S32 involves performing contrastive learning on the original structure graph and the higher-order structure graph pair through the contrastive learning network, and based on the vector output data of the contrastive learning network, performing anomaly detection on multiple nodes through the anomaly detection network to obtain risk scores for multiple nodes. Specifically, this includes the following steps:
[0178] S321: By using a contrastive learning network, multiple nodes, the original structure graph, and the higher-order structure graph are vector-encoded, and sample pairs are constructed based on the encoded vectors to obtain multiple first sample pairs of the original structure graph and multiple second samples of the higher-order structure graph.
[0179] By using a contrastive learning network, multiple nodes, the original structure graph, and higher-order structure graph pairs are vector-encoded. Sample pairs are then constructed based on these encoded vectors, resulting in multiple first sample pairs of the original structure graph and multiple second sample pairs of the higher-order structure graph. The construction process for the first and second sample pairs is described above and will not be repeated here.
[0180] S322: Based on multiple first sample pairs and multiple second samples, the structural discriminator is used to predict the abnormal node structural relationships in the original structural graph and the higher-order structural graph, and obtain the structural risk values of multiple nodes.
[0181] Specifically, based on multiple first sample pairs of the original structure graph, a structure discriminator is used to identify the similarity between a node in the original structure graph and each original subgraph, thus obtaining the first structural risk value of the node; based on multiple second sample pairs of the higher-order structure graph, a structure discriminator is used to identify the similarity between the node in the higher-order structure graph and each higher-order subgraph, thus obtaining the second structural risk value; and the structural risk value of the node is determined based on the first structural risk value and the second structural risk value.
[0182] The structural risk value includes an overall structural risk value and a local structural risk value. Correspondingly, the structural discriminator includes an overall structural discrimination layer and a local structural discrimination layer. The overall structural discrimination layer is used to: discriminate the similarity between a node in the original structural graph and each original subgraph based on multiple first sample pairs of the original structural graph, thus obtaining the structural risk value of the node in the historical original graph, i.e., the first structural risk value of the node; and discriminate the similarity between the node and each higher-order subgraph in the higher-order structural graph based on multiple second samples of the higher-order structural graph, thus obtaining the structural risk value of the node in the higher-order original graph, i.e., the second structural risk value of the node; and average the second structural risk value and the second structural risk value to output the overall structural risk value of the node. The calculation process of the first and second structural risk values is as described above and will not be repeated here.
[0183] The local structure discrimination layer can be a graph convolutional neural network layer, used to: acquire multiple original subgraphs output by the contrastive learning module after sampling the original structure graph, and acquire multiple high-order subgraphs output by the contrastive learning module after sampling the high-order structure graph; determine the original subgraph containing the node from among the multiple original subgraphs as the target original subgraph, and determine the high-order subgraph containing the node from among the multiple high-order subgraphs as the target high-order subgraph; perform semantic encoding on each node in the target original subgraph, calculate the variance of the encoded vector of each node in the target original subgraph to obtain the vector squared difference of each node in the target original subgraph, and sum the vector squared differences of each node in the target original subgraph using the L1 norm to obtain the first local risk value of the node; perform semantic encoding on each node in the target high-order subgraph, calculate the variance of the encoded vector of each node in the target high-order subgraph to obtain the vector squared difference of each node in the target high-order subgraph, and sum the vector squared differences of each node in the target high-order subgraph using the L1 norm to obtain the second local risk value of the node. Finally, the average of the outliers in the first subgraph and the second subgraph is directly output as the local structural risk value of that node.
[0184] S323: Based on the original structure graph and the higher-order structure graph, the attribute detection module performs node attribute anomaly prediction on the original structure graph and the higher-order structure graph to obtain the attribute risk value of multiple nodes.
[0185] Based on the original structure graph and the higher-order structure graph, the attribute detection module is used to predict the node attribute anomalies in the original structure graph and the higher-order structure graph, and obtain the attribute risk values of multiple nodes.
[0186] S324: The risk score of a node is obtained by aggregating the structural risk value and attribute risk value of the node, and the risk scores of multiple nodes are obtained.
[0187] After obtaining the structural risk value and attribute risk value of multiple nodes, the risk score of the node is obtained by aggregator based on the structural risk value and attribute risk value of the node.
[0188] The structural risk value includes the overall structural risk value and the local structural risk value. Based on the structural risk values and attribute risk values of multiple nodes, the risk scores of multiple nodes are determined, including: normalizing the attribute risk values, overall structural risk values, and local structural risk values of the nodes respectively to obtain normalized attribute risk values, overall structural risk values, and local structural risk values of the nodes; and weighting and summing the normalized attribute risk values, overall structural risk values, and local structural risk values of the nodes according to multiple pre-calibrated balance coefficients to obtain the risk scores of the nodes, and then iterating through each node to obtain the risk scores of multiple nodes.
[0189] The risk score of a node is represented by the following formula:
[0190] score(v i ) = score ns (v i )+α·score gen (v i )+β·score str (v i );
[0191] Among them, score(v i ) represents node v i Risk score; ns (v i ) represents node v i Overall structural risk value; α·score gen (v i ) represents node v i The attribute risk value; score str (v i ) represents node v i The local structural risk value; α and β are the balance coefficients for different risk scores, which are constant values. The value of α is the same as the balance coefficient α for the total loss of the model.
[0192] In this embodiment, the anomaly prediction model includes a contrastive learning network, an anomaly detection network, and an aggregator connected in sequence. The anomaly detection network includes a structure discriminator for detecting node structural anomalies and an attribute detection module for detecting node attribute anomalies. The contrastive learning network performs vector encoding on multiple nodes, the original structure graph, and higher-order structure graph pairs, and constructs sample pairs based on the encoded vectors to obtain multiple first sample pairs of the original structure graph and multiple second samples of the higher-order structure graph pairs. Based on the multiple first sample pairs and multiple second samples, the structure discriminator predicts node structural relationship anomalies in the original and higher-order structure graphs to obtain structural risk values for multiple nodes. Based on the original and higher-order structure graphs, the attribute detection module predicts node attribute anomalies in the original and higher-order structure graphs to obtain attribute risk values for multiple nodes. Based on the original and higher-order structure graphs, the attribute detection module predicts node attribute anomalies in the original and higher-order structure graphs to obtain attribute risk values for multiple nodes. The aggregator calculates the risk score for each node based on its structural and attribute risk values, thus obtaining risk scores for multiple nodes. The calculation process of node risk score is clarified. By evaluating the structural risk value and attribute risk value of the node, the risk score of the node is obtained, which improves the accuracy of node risk score.
[0193] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0194] In one embodiment, a hazardous materials risk detection device is provided, which corresponds one-to-one with the hazardous materials risk detection methods described in the above embodiments. For example... Figure 9 As shown, the hazardous materials risk detection device includes a construction module 901, a processing module 902, a detection module 903, and an early warning module. The detailed descriptions of each functional module are as follows:
[0195] Module 901 is used to construct a graph structure based on the interactive behavior data generated during the import and export process of dangerous goods, so as to obtain the original structure graph of dangerous goods in the import and export scenario. The nodes of the original structure graph include dangerous goods and interactive participants of dangerous goods in the import and export process, and the edges of the original structure graph are the interactive behavior data between each node.
[0196] The processing module 902 is used to perform feature enhancement processing on the original structure graph based on the graph diffusion algorithm to obtain a higher-order structure graph with enhanced features. The nodes in the higher-order structure graph are the same as the nodes in the original structure graph, but the node relationships in the higher-order structure graph are different from those in the original structure graph.
[0197] The detection module 903 is used to detect abnormal risks of dangerous goods in the import and export process based on the original structure diagram and the high-order structure diagram, using a pre-trained anomaly prediction model. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interaction behavior data of the same type of dangerous goods in the import and export process.
[0198] The early warning module is used to issue risk warnings when abnormal risks are detected in the import and export of dangerous goods.
[0199] Optionally, the processing module 902 is specifically used for:
[0200] The graph diffusion algorithm is used to perform graph diffusion on the node relationships of the original structure graph to obtain the diffusion matrix of the original structure graph;
[0201] The nearest neighbor algorithm is used to construct the target feature map by node similarity based on the original structural graph.
[0202] Based on the diffusion matrix and the target feature map, graph feature enhancement is performed on the original structure map to obtain a higher-order structure map.
[0203] Optionally, the detection module 903 is specifically used for:
[0204] The original structure graph and the higher-order structure graph are input into the anomaly prediction model. The original structure graph and the higher-order structure graph are compared and learned through a contrastive learning network. The vector output data is based on the contrastive learning network. Anomaly detection network is used to detect anomalies in multiple nodes to obtain risk scores for multiple nodes.
[0205] Based on the risk scores of multiple nodes, abnormal risks of dangerous goods in the import and export process are detected. When a risk node with a risk score greater than a preset threshold is detected among multiple nodes, it is determined that there are abnormal risks of dangerous goods in the import and export process.
[0206] Optionally, the hazardous materials risk detection device also includes a training module 905, which is used for:
[0207] Graph structures are constructed for multiple historical interaction behavior data to obtain historical original graphs of multiple historical interaction behavior data. Feature enhancement processing is then performed on each historical original graph to obtain historical higher-order graphs of multiple historical original structure graphs.
[0208] Using the original historical image and the corresponding higher-order historical image as training sample pairs, multiple training sample pairs are obtained, and each training sample pair is labeled with a calibration node.
[0209] The training sample pairs are input into the preset network structure. The training sample pairs are compared and learned by the contrastive learning network of the preset network structure to obtain the loss of the contrastive learning network. Based on the vector output data of the contrastive learning network, the anomaly detection network of the preset network structure is used to detect anomalies in the labeled nodes to obtain the loss of the anomaly detection network.
[0210] The total model loss is determined based on the loss of the contrastive learning network and the loss of the anomaly detection network.
[0211] If the total loss of the model does not meet the convergence condition, the parameters of the preset network structure are iteratively trained based on multiple training samples until the total loss of the model meets the convergence condition. The preset network structure with converged output parameters is then used as the anomaly prediction model.
[0212] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0213] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0214] This application also provides an electronic device, which may be a server. For example... Figure 10 As shown, the electronic device 2 includes: at least one processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on at least one processor 20. When the processor 20 executes the computer program 22, it implements the steps in any of the above method embodiments, or when the processor 20 executes the computer program 22, it implements the functions of each module / unit in the above device embodiments.
[0215] For example, a computer program can be divided into one or more modules / units, one or more of which are stored in memory and executed by a processor to complete this application. One or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in an electronic device.
[0216] Those skilled in the art will understand that Figure 9 This is merely an example of an electronic device and does not constitute a limitation on the electronic device. It may include more or fewer components than shown, or combine certain components, or different components. For example, an electronic device may also include input / output devices, network access devices, buses, etc.
[0217] The processor mentioned above can be a central processing unit, or it can be other general-purpose processors, digital signal processors, application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0218] Memory can be an internal storage unit of an electronic device, such as a hard drive or RAM. Memory can also be an external storage device of an electronic device, such as a plug-in hard drive, smart memory card, secure digital card, flash memory card, etc. Furthermore, memory can include both internal and external storage units of an electronic device.
[0219] This application also provides a readable storage medium storing a computer program, which, when executed by a processor, implements the steps described in the above-described method embodiments.
[0220] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0221] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographic device / terminal device, a recording medium, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0222] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0223] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such 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 this application, and should all be included within the protection scope of this application.
Claims
1. A method for detecting the risk of hazardous materials, characterized in that, include: A graph structure is constructed based on the interactive behavior data generated during the import and export process of dangerous goods, resulting in the original structure graph of the dangerous goods in the import and export scenario. The nodes of the original structure graph include the dangerous goods and the interactive participants of the dangerous goods during the import and export process, and the edges of the original structure graph are the interactive behavior data between the nodes. The original structural graph is subjected to feature enhancement processing based on the graph diffusion algorithm to obtain a higher-order structural graph with enhanced features. The nodes in the higher-order structural graph are the same as the nodes in the original structural graph, but the node relationships in the higher-order structural graph are different from those in the original structural graph. Based on the original structure diagram and the higher-order structure diagram, a pre-trained anomaly prediction model is used to detect abnormal risks of the dangerous goods in the import and export process. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interaction behavior data of the same type of dangerous goods in the import and export process. Risk warnings will be issued when abnormal risks are detected in the import and export process of the dangerous goods.
2. The method for detecting the risk of hazardous materials as described in claim 1, characterized in that, The graph diffusion algorithm is used to perform feature enhancement processing on the original structure graph to obtain a feature-enhanced higher-order structure graph, including: The graph diffusion algorithm is used to perform graph diffusion on the node relationships of the original structure graph to obtain the diffusion matrix of the original structure graph; The original structural graph is constructed based on node similarity using the nearest neighbor algorithm to obtain the target feature map; Based on the diffusion matrix and the target feature map, graph feature enhancement is performed on the original structure map to obtain the higher-order structure map.
3. The method for detecting the risk of hazardous materials as described in claim 2, characterized in that, The process of constructing a target feature map by using a nearest neighbor algorithm to perform node similarity-based graph construction on the original structure graph includes: The cosine similarity algorithm is used to determine the similarity between each node and other nodes in the original structural graph; The nodes are sorted in descending order based on their similarity to other nodes, and the first preset number of nodes are selected as the neighbor nodes of each node. Based on the nodes in the original structural graph and their neighboring nodes, the node relationship features are constructed to obtain the target feature graph, in which the nodes are connected to their neighboring nodes.
4. The method for detecting the risk of hazardous materials as described in claim 2, characterized in that, The step of performing graph feature enhancement on the original structure map based on the diffusion matrix and the target feature map to obtain the higher-order structure map includes: Based on the diffusion matrix and the structure matrix of the target feature map, noise filtering is performed on the adjacency matrix of the original structure map to generate a higher-order structure matrix; The higher-order structure graph is obtained by constructing a graph based on the higher-order structure matrix and the attribute matrix of the original structure graph.
5. The method for detecting the risk of hazardous materials as described in claim 1, characterized in that, The method of detecting abnormal risks of dangerous goods during import and export processes using a pre-trained anomaly prediction model based on the original structure diagram and the higher-order structure diagram includes: The anomaly prediction model is used to predict node anomalies in the original structure graph and the higher-order structure graph to obtain risk scores for multiple nodes in the original structure graph. Based on the risk scores of multiple nodes, abnormal risks of the dangerous goods during the import and export process are detected. When a risk node with a risk score greater than a preset threshold is detected among the multiple nodes, it is determined that there are abnormal risks of the dangerous goods during the import and export process.
6. The method for detecting the risk of hazardous materials as described in any one of claims 1-5, characterized in that, The anomaly prediction model is trained in the following manner: Graph structures are constructed for each of the historical interaction behavior data to obtain historical original graphs of the historical interaction behavior data. Feature enhancement processing is then performed on each of the historical original graphs to obtain historical higher-order graphs of the historical original graphs. Using the original historical graph and the corresponding higher-order historical graph as training sample pairs, multiple training sample pairs are obtained, and each training sample pair is labeled with a calibration node. The training sample pairs are input into a preset network structure. The training sample pairs are compared and learned by the contrastive learning network of the preset network structure to obtain the loss of the contrastive learning network. Based on the vector output data of the contrastive learning network, the anomaly detection network of the preset network structure is used to detect anomalies in the calibrated nodes to obtain the loss of the anomaly detection network. The total model loss is determined based on the loss of the contrastive learning network and the loss of the anomaly detection network. If the total loss of the model does not meet the convergence condition, the parameters of the preset network structure are iteratively trained based on multiple training samples until the total loss of the model meets the convergence condition. The preset network structure with converged output parameters is then used as the anomaly prediction model.
7. A hazardous materials risk detection device, characterized in that, include: The construction module is used to construct a graph structure based on the interaction behavior data generated during the import and export process of dangerous goods, and obtain the original structure graph of the dangerous goods in the import and export scenario. The nodes of the original structure graph include the dangerous goods and the interactive participants of the dangerous goods in the import and export process, and the edges of the original structure graph are the interaction behavior data between the nodes. The processing module is used to perform feature enhancement processing on the original structure graph based on the graph diffusion algorithm to obtain a feature-enhanced higher-order structure graph. The nodes in the higher-order structure graph are the same as the nodes in the original structure graph, but the node relationships in the higher-order structure graph are different from those in the original structure graph. The detection module is used to detect abnormal risks of the dangerous goods in the import and export process based on the original structure diagram and the high-order structure diagram, using a pre-trained anomaly prediction model. The anomaly prediction model is a neural network model trained by deep learning using multiple historical interaction behavior data of the same type of dangerous goods in the import and export process. The early warning module is used to issue a risk warning when abnormal risks are detected in the import and export process of the dangerous goods.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the electronic device to implement the dangerous goods risk detection method as described in any one of claims 1 to 6.
9. A readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the dangerous goods risk detection method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is run, the dangerous goods risk detection method according to any one of claims 1 to 6 is executed.