Graph processing method, network training method, device, equipment and storage medium

文档序号:8566 发布日期:2021-09-17 浏览:28次 中文

1. A graph processing method, comprising:

acquiring a graph to be processed;

acquiring node characteristics of each node in the graph to be processed;

for each node, determining the class of the node from each candidate graph class according to the similarity between the node feature of the node and the graph class feature corresponding to each candidate graph class, wherein each candidate graph class comprises the graph class of the graph to be processed;

and performing corresponding processing on at least one node in the graph to be processed based on the category of each node.

2. The method according to claim 1, wherein the obtaining the node characteristics of each node in the graph to be processed comprises:

obtaining node characteristics of each node in the graph to be processed through a node characteristic extraction network, wherein the node characteristic extraction network comprises an initial characteristic extraction sub-network and node characteristic extraction sub-networks corresponding to candidate graph categories connected with the initial characteristic extraction sub-network;

the obtaining of the node characteristics of each node in the graph to be processed through the node characteristic extraction network includes:

for each node, extracting the initial feature of the node in the graph to be processed through the initial feature extraction sub-network;

extracting a sub-network through the node characteristics corresponding to each candidate graph category based on the initial characteristics of the node to obtain the characteristics of the node corresponding to each candidate graph category;

and fusing the characteristics of the node corresponding to each candidate graph category to obtain the node characteristics of the node.

3. The method of claim 2, wherein the extracting the initial feature of the node in the graph to be processed through the initial feature extraction sub-network comprises:

acquiring a first characteristic of the node, and determining an attention autocorrelation coefficient of the node according to the first characteristic of the node;

according to the first characteristic of the node and the first characteristics of each adjacent node of the node, determining the attention cross-correlation coefficient of the node and each adjacent node;

and determining the initial characteristics of the node according to the attention autocorrelation coefficient and the attention cross-correlation coefficient.

4. The method of claim 3, wherein a graph class feature corresponding to a candidate graph class extracts the network parameters of the sub-network for the node feature corresponding to the candidate graph class.

5. The method of claim 4, wherein the node feature extraction sub-network is a Gaussian mixture model-based network, and the feature of the candidate graph class is the Gaussian distribution parameter of the Gaussian mixture model corresponding to the candidate graph class.

6. The method according to any one of claims 1 to 5, wherein for each node, determining the class of the node from the candidate graph classes according to the similarity between the node feature of the node and the graph class feature corresponding to each candidate graph class comprises:

for each node, determining the highest similarity from the similarity between the node characteristics of the node and the graph category characteristics corresponding to each candidate graph category;

and determining the candidate graph category corresponding to the highest similarity as the category of the node.

7. The method according to claim 1, wherein said performing the corresponding processing on at least one node in the graph to be processed based on the category of each node comprises:

acquiring the graph category of the graph to be processed;

and according to the category of each node, correspondingly processing the nodes with the categories of the nodes in each node different from the graph category of the graph to be processed.

8. A node feature extraction network training method is characterized by comprising the following steps:

acquiring an initial graph classification network, wherein the initial graph classification network comprises a node feature extraction module, a graph feature extraction module and a graph classification module which are sequentially cascaded;

acquiring training data, wherein each sample icon in the training data is marked with a sample label, and the sample label represents the real image category of the sample image;

inputting each sample graph into the node feature extraction module to obtain the node feature of each node of each sample graph;

inputting the node characteristics of each node into the graph characteristic extraction module to obtain the graph characteristics of each sample graph;

inputting the graph characteristics of each sample graph into the graph classification module to obtain the prediction graph category of the sample graph;

determining a total training loss value according to the prediction graph type of each sample graph and the sample label of each sample graph;

and performing iterative training on the initial graph classification network according to the total training loss value and the training data until the total training loss value meets the training end condition, and determining a node feature extraction module in the initial graph classification network at the training end as a node feature extraction network.

9. The method of claim 8, wherein determining a total training loss value based on the prediction graph class for each of the sample graphs and the sample label for each of the sample graphs comprises:

determining a first training loss value according to the prediction graph type of each sample graph and the sample label of each sample graph;

determining a feature distance between each graph feature and a graph category feature corresponding to each candidate graph category;

determining a second training loss value according to the feature distance corresponding to each graph feature and each candidate graph category;

and determining a total training loss value according to the first training loss value and the second training loss value.

10. The method of claim 8, wherein inputting the node feature of each node into the graph feature extraction module to obtain the graph feature of each sample graph comprises:

inputting the node characteristics of each node into the graph characteristic extraction module, and executing the following operations through the graph characteristic extraction module:

for each sample graph, determining attention distribution corresponding to each node in the sample graph according to the node characteristics of each node in the sample graph;

and determining the graph characteristics of the sample graph according to the node characteristics of each node in the sample graph and the attention distribution.

11. The method of claim 9, wherein determining a feature distance between each graph feature and a graph class feature corresponding to each candidate graph class comprises:

for each graph feature, determining a first feature distance between the graph feature and a graph category feature corresponding to each candidate graph category;

determining a target candidate graph category which is consistent with the real graph category corresponding to the graph feature from all the candidate graph categories;

and determining a second feature distance between the graph feature and the graph category feature corresponding to the target graph category, and determining a feature distance between the graph feature and the graph category feature corresponding to each candidate graph category according to the first feature distance and the second feature distance.

12. The method of any of claims 9 to 11, wherein determining a total training loss value based on the first training loss value and the second training loss value comprises:

acquiring a first weight corresponding to the first training loss value and a second weight corresponding to the second training loss value;

determining a total training loss value according to the first training loss value, the second training loss value, the first weight, and the second weight.

13. A graph processing apparatus, characterized in that the apparatus comprises:

the graph acquisition module is used for acquiring a graph to be processed;

the characteristic acquisition module is used for acquiring the node characteristics of each node in the graph to be processed;

a classification module, configured to, for each node, determine a class of the node from each candidate graph class according to a similarity between a node feature of the node and a graph class feature corresponding to each candidate graph class, where each candidate graph class includes a graph class of the to-be-processed graph;

and the graph processing module is used for correspondingly processing at least one node in the graph to be processed based on the category of each node.

14. An electronic device comprising a processor and a memory, the processor and the memory being interconnected;

the memory is used for storing a computer program;

the processor is configured to perform the method of any of claims 1 to 7 or the method of any of claims 8 to 12 when the computer program is invoked.

15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executed by a processor to implement the method of any of claims 1 to 7 or the method of any of claims 8 to 12.

Background

In the classification task of the nodes in the graph in the current artificial intelligence field, the classification of each node in the sample graph is marked, a network model is trained according to the node characteristics of the nodes to obtain a node classification model, and then the classification of each node is predicted through the node classification model. And the node characteristics and the marked classes of all nodes in the sample graph are used as input information of the network model, and the classes of the nodes to be tested are output through the trained node classification model.

However, in an actual scenario, since the class of each node in the graph is influenced by the class of the graph to some extent, the existing node classification model training method and the existing node class determining method often ignore the influence of the class of the node caused by the class of the graph, and thus the accuracy of the node classification model and the node classification method is seriously influenced.

In summary, how to further improve the accuracy of node classification becomes an urgent problem to be solved.

Disclosure of Invention

The embodiment of the application provides a graph processing method, a network training method, a device, equipment and a storage medium.

In a first aspect, an embodiment of the present application provides a graph processing method, where the method includes:

acquiring a graph to be processed;

acquiring node characteristics of each node in the graph to be processed;

for each node, determining the class of the node from the candidate graph classes according to the similarity between the node feature of the node and the graph class feature corresponding to each candidate graph class, wherein each candidate graph class comprises the graph class of the graph to be processed;

and performing corresponding processing on at least one node in the graph to be processed based on the category of each node.

In a second aspect, an embodiment of the present application provides a node feature extraction network training method, where the method includes:

acquiring an initial graph classification network, wherein the initial graph classification network comprises a node feature extraction module, a graph feature extraction module and a graph classification module which are sequentially cascaded;

acquiring training data, wherein each sample icon in the training data is marked with a sample label, and the sample label represents the real image category of the sample image;

inputting each sample graph to the node feature extraction module to obtain the node features of each node of each sample graph;

inputting the node characteristics of each node into the graph characteristic extraction module to obtain the graph characteristics of each sample graph;

inputting the graph features of the sample graphs into the graph classification module to obtain the prediction graph types of the sample graphs;

determining a total training loss value according to the prediction graph type of each sample graph and the sample label of each sample graph;

and performing iterative training on the initial graph classification network according to the total training loss value and the training data until the total training loss value meets the training end condition, and determining a node feature extraction module in the initial graph classification network at the training end as a node feature extraction network.

In a third aspect, an embodiment of the present application provides a graph processing apparatus, including:

the graph acquisition module is used for acquiring a graph to be processed;

a characteristic obtaining module, configured to obtain node characteristics of each node in the graph to be processed;

a classification module, configured to, for each node, determine a class of the node from each candidate graph class according to a similarity between a node feature of the node and a graph class feature corresponding to each candidate graph class, where each candidate graph class includes a graph class of the to-be-processed graph;

and the graph processing module is used for correspondingly processing at least one node in the graph to be processed based on the type of each node.

In a fourth aspect, an embodiment of the present application provides a node feature extraction network training apparatus, where the apparatus is configured to:

the network acquisition module is used for acquiring an initial graph classification network, and the initial graph classification network comprises a node feature extraction module, a graph feature extraction module and a graph classification module which are sequentially cascaded;

the data acquisition module is used for acquiring training data, wherein each sample icon in the training data is marked with a sample label, and the sample label represents the real image category of the sample image;

an input module, configured to input each sample graph to the node feature extraction module, so as to obtain a node feature of each node of each sample graph;

the input module is configured to input the node features of each node to the graph feature extraction module to obtain the graph features of each sample graph;

the input module is used for inputting the graph characteristics of each sample graph into the graph classification module to obtain the prediction graph type of the sample graph;

a loss determining module, configured to determine a total training loss value according to the prediction graph type of each sample graph and the sample label of each sample graph;

and the network determining module is used for performing iterative training on the initial graph classification network according to the total training loss value and the training data until the total training loss value meets the training ending condition, and determining the node feature extracting module in the initial graph classification network at the training ending time as the node feature extracting network.

In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the processor and the memory are connected to each other;

the memory is used for storing computer programs;

the processor is configured to execute the method provided in any of the embodiments of the first aspect and/or the second aspect when the computer program is called.

In a sixth aspect, the present application provides a computer-readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the method provided in any one of the foregoing first and/or second aspects.

In a seventh aspect, the present application provides a computer program product or a computer program, where the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided by any one of the embodiments of the first aspect and/or the second aspect.

In the embodiment of the application, the similarity between the node characteristics of each node in the graph to be processed and the graph category characteristics corresponding to the candidate graph categories is determined, so that the category of each node is determined based on the similarity, the node characteristics of each node are fully considered in the determination process of the node category, the influence of the graph category on the category of each node can be combined, the category of each node is determined through the candidate graph categories, the accuracy of determining the category of each node in the graph to be processed can be further improved, and the applicability is high.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:基于集成分类模型的分类方法及相关设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!