CN113408564A - Graph processing method, network training method, device, equipment and storage medium - Google Patents

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

Info

Publication number
CN113408564A
CN113408564A CN202011134804.2A CN202011134804A CN113408564A CN 113408564 A CN113408564 A CN 113408564A CN 202011134804 A CN202011134804 A CN 202011134804A CN 113408564 A CN113408564 A CN 113408564A
Authority
CN
China
Prior art keywords
graph
node
category
feature
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011134804.2A
Other languages
Chinese (zh)
Inventor
徐挺洋
卞天
荣钰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology (Shenzhen) Co Ltd
Original Assignee
Tencent Technology (Shenzhen) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology (Shenzhen) Co Ltd filed Critical Tencent Technology (Shenzhen) Co Ltd
Priority to CN202011134804.2A priority Critical patent/CN113408564A/en
Publication of CN113408564A publication Critical patent/CN113408564A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00—Pattern recognition
    • G06F18/20—Analysing
    • G06F18/24—Classification techniques
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00—Pattern recognition
    • G06F18/20—Analysing
    • G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种图处理方法、网络训练方法、装置、设备以及存储介质,可适用于人工智能等领域。该方法包括:获取待处理图;获取待处理图中各节点的节点特征;对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各候选图类别中确定该节点的类别;基于各节点的类别,对待处理图中的至少一个节点进行相应处理。采用本申请实施例,可基于各候选图类别确定出待处理图中各节点的类别,可提升节点的类别的预测准确性,进而有效对待处理图中节点进行处理,适用性高。

Figure 202011134804

The embodiments of the present application disclose a graph processing method, a network training method, an apparatus, a device, and a storage medium, which are applicable to fields such as artificial intelligence. The method includes: acquiring a graph to be processed; acquiring node features of each node in the graph to be processed; for each node, according to the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category, from each candidate graph category The category of the node is determined in the graph category; based on the category of each node, corresponding processing is performed on at least one node in the graph to be processed. Using the embodiment of the present application, the category of each node in the graph to be processed can be determined based on each candidate graph category, the prediction accuracy of the node category can be improved, and the nodes in the to-be-processed graph can be effectively processed, with high applicability.

Figure 202011134804

Description

图处理方法、网络训练方法、装置、设备以及存储介质Graph processing method, network training method, apparatus, device and storage medium

技术领域technical field

本申请涉及人工智能领域,尤其涉及一种图处理方法、网络训练方法、装置、设备以及存储介质。The present application relates to the field of artificial intelligence, and in particular, to a graph processing method, a network training method, an apparatus, a device, and a storage medium.

背景技术Background technique

在目前人工智能领域对于图中节点的分类任务中,主要通过对样本图中各节点的类别进行标记,并根据节点的节点特征对网络模型进行训练得到节点分类模型,进而通过节点分类模型预测各节点的类别。其中,样本图中各节点的节点特征和已标记的类别作为网络模型的输入信息,通过训练好的节点分类模型输出待测节点的类别。In the current field of artificial intelligence for the classification task of nodes in the graph, the node classification model is obtained by labeling the categories of each node in the sample graph, and the network model is trained according to the node characteristics of the node, and then the node classification model is used to predict each node classification model. The class of the node. Among them, the node features and marked categories of each node in the sample graph are used as the input information of the network model, and the category of the node to be tested is output through the trained node classification model.

然而在实际场景中,由于图中各节点的类别会在一定程度上受图类别的影响,因此现有的节点分类模型训练方法,以及现有的节点类别确定方式往往忽略图类别为节点的类别所带来的影响,从而会严重影响节点分类模型以及节点分类方法的准确率。However, in the actual scene, since the category of each node in the graph will be affected by the graph category to a certain extent, the existing node classification model training methods and the existing node category determination methods often ignore the graph category as the node category. This will seriously affect the accuracy of the node classification model and the node classification method.

综上所述,如何进一步提升节点分类的准确性成为亟需解决的问题。To sum up, how to further improve the accuracy of node classification has become an urgent problem to be solved.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供一种图处理方法、网络训练方法、装置、设备以及存储介质,采用本申请实施例,可提升确定待处理图中节点的类别的准确性,进而有效对待处理图中节点进行处理,适用性高。The embodiments of the present application provide a graph processing method, a network training method, an apparatus, a device, and a storage medium. By adopting the embodiments of the present application, the accuracy of determining the category of the nodes in the graph to be processed can be improved, and the nodes in the graph to be processed can be effectively processed. Handling, high applicability.

第一方面,本申请实施例提供一种图处理方法,该方法包括:In a first aspect, an embodiment of the present application provides a graph processing method, which includes:

获取待处理图;Get the pending graph;

获取上述待处理图中各节点的节点特征;Obtain the node characteristics of each node in the above to-be-processed graph;

对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各上述候选图类别中确定该节点的类别,其中,各上述候选图类别包括上述待处理图的图类别;For each node, according to the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category, the category of the node is determined from each of the candidate graph categories, wherein each of the candidate graph categories includes the above-mentioned candidate graph categories. Graph class for processing graphs;

基于各上述节点的类别,对上述待处理图中的至少一个节点进行相应处理。Based on the category of each of the above-mentioned nodes, corresponding processing is performed on at least one node in the above-mentioned to-be-processed graph.

第二方面,本申请实施例提供了一种节点特征提取网络训练方法,该方法包括:In a second aspect, an embodiment of the present application provides a method for training a node feature extraction network, the method comprising:

获取初始图分类网络,上述初始图分类网络包括依次级联的节点特征提取模块、图特征提取模块和图分类模块;obtaining an initial graph classification network, where the initial graph classification network includes a node feature extraction module, a graph feature extraction module and a graph classification module that are cascaded in sequence;

获取训练数据,上述训练数据中的各样本图标注有样本标签,上述样本标签表征了样本图的真实图类别;Obtain training data, each sample image 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 of the above-mentioned sample graphs into the above-mentioned node feature extraction module to obtain node features of each node of each of the above-mentioned sample graphs;

将各上述节点的节点特征输入至上述图特征提取模块,得到各上述样本图的图特征;Input the node features of each of the above-mentioned nodes into the above-mentioned graph feature extraction module to obtain the graph features of each of the above-mentioned sample graphs;

将各上述样本图的图特征输入至上述图分类模块,得到上述样本图的预测图类别;Input the graph features of each of the above-mentioned sample graphs into the above-mentioned graph classification module to obtain the predicted graph category of the above-mentioned sample graphs;

根据各上述样本图的预测图类别和各上述样本图的样本标签,确定总训练损失值;Determine the total training loss value according to the predicted graph category of each of the above-mentioned sample graphs and the sample label of each of the above-mentioned sample graphs;

根据上述总训练损失值和上述训练数据对上述初始图分类网络进行迭代训练,直至上述总训练损失值符合训练结束条件时,将训练结束时的初始图分类网络中的节点特征提取模块确定为节点特征提取网络。The initial graph classification network is iteratively trained according to the above-mentioned total training loss value and the above-mentioned training data, until the above-mentioned total training loss value meets the training end condition, the node feature extraction module in the initial graph classification network at the end of training is determined as a node Feature extraction network.

第三方面,本申请实施例提供了一种图处理装置,该装置包括:In a third aspect, an embodiment of the present application provides a graph processing apparatus, the apparatus comprising:

图获取模块,用于获取待处理图;The graph acquisition module is used to obtain the graph to be processed;

特征获取模块,用于获取上述待处理图中各节点的节点特征;A feature acquisition module, configured to acquire the node features of each node in the above-mentioned to-be-processed graph;

分类模块,用于对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各上述候选图类别中确定该节点的类别,其中,各上述候选图类别包括上述待处理图的图类别;A classification module, for each node, according to the similarity between the node feature of the node and the graph class feature corresponding to each candidate graph class, determine the class of the node from each of the above-mentioned candidate graph classes, wherein each of the above-mentioned candidate graph classes The graph category includes the graph category of the above-mentioned to-be-processed graph;

图处理模块,用于基于各上述节点的类别,对上述待处理图中的至少一个节点进行相应处理。The graph processing module is configured to perform corresponding processing on at least one node in the graph to be processed based on the category of each of the above-mentioned nodes.

第四方面,本申请实施例提供了一种节点特征提取网络训练装置,该装置用于:In a fourth aspect, an embodiment of the present application provides a node feature extraction network training device, which is used for:

网络获取模块,用于获取初始图分类网络,上述初始图分类网络包括依次级联的节点特征提取模块、图特征提取模块和图分类模块;a network acquisition module, configured to acquire an initial graph classification network, where the initial graph classification network includes a node feature extraction module, a graph feature extraction module and a graph classification module that are cascaded in sequence;

数据获取模块,用于获取训练数据,上述训练数据中的各样本图标注有样本标签,上述样本标签表征了样本图的真实图类别;a data acquisition module, used for acquiring training data, each sample image 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 of the above-mentioned sample graphs into the above-mentioned node feature extraction module to obtain node features of each node of each of the above-mentioned sample graphs;

上述输入模块,用于将各上述节点的节点特征输入至上述图特征提取模块,得到各上述样本图的图特征;The above-mentioned input module is used for inputting the node features of each of the above-mentioned nodes to the above-mentioned graph feature extraction module to obtain the graph features of each of the above-mentioned sample graphs;

上述输入模块,用于将各上述样本图的图特征输入至上述图分类模块,得到上述样本图的预测图类别;The above-mentioned input module is used to input the graph features of each of the above-mentioned sample graphs into the above-mentioned graph classification module to obtain the predicted graph categories of the above-mentioned sample graphs;

损失确定模块,用于根据各上述样本图的预测图类别和各上述样本图的样本标签,确定总训练损失值;The loss determination module is used to determine the total training loss value according to the prediction map category of each of the above-mentioned sample maps and the sample labels of each of the above-mentioned sample maps;

网络确定模块,用于根据上述总训练损失值和上述训练数据对上述初始图分类网络进行迭代训练,直至上述总训练损失值符合训练结束条件时,将训练结束时的初始图分类网络中的节点特征提取模块确定为节点特征提取网络。The network determination module is used to iteratively train the above-mentioned initial graph classification network according to the above-mentioned total training loss value and the above-mentioned training data, until the above-mentioned total training loss value meets the training end condition, classify the nodes in the network with the initial graph at the end of training The feature extraction module is determined as a node feature extraction 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 above-mentioned memory is used to store computer programs;

上述处理器被配置用于在调用上述计算机程序时,执行上述第一方面和/或第二方面任一实施方式所提供的方法。The above-mentioned processor is configured to execute the method provided by any one of the embodiments of the above-mentioned first aspect and/or the second aspect when the above-mentioned computer program is invoked.

第六方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序被处理器执行以实现上述第一方面和/或第二方面任一实施方式所提供的方法。In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program is executed by a processor to implement any one of the first aspect and/or the second aspect. The method provided by the embodiment.

第七方面,本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。电子设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述第一方面和/或第二方面任一实施方式所提供的方法。In a seventh aspect, embodiments of the present application provide a computer program product or computer program, where the computer program product or 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 embodiment of the first aspect and/or the second aspect.

在本申请实施例中,通过确定待处理图中各节点的节点特征与和候选图类别对应的图类别特征之间的相似度,从而基于相似度确定各节点的类别,不仅在节点类别的确定过程中充分考虑各节点自身的节点特征,同时可结合图类别对各节点的类别所带来的影响,进而通过候选图类别确定各节点的类别,可进一步提升确定待处理图中各节点的类别的准确性,适用性高。In this embodiment of the present application, by determining the similarity between the node feature of each node in the graph to be processed and the graph category feature corresponding to the candidate graph category, the category of each node is determined based on the similarity, not only in the determination of the node category In the process, the node characteristics of each node itself are fully considered, and the influence of the graph category on the category of each node can be combined, and then the category of each node can be determined through the candidate graph category, which can further improve the determination of the category of each node in the graph to be processed. accuracy and high applicability.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.

图1是本申请实施例提供的图处理方法的原理示意图;1 is a schematic diagram of the principle of a graph processing method provided by an embodiment of the present application;

图2是本申请实施例提供的图处理方法的流程示意图;2 is a schematic flowchart of a graph processing method provided by an embodiment of the present application;

图3是本申请实施例提供的节点特征的确定方法的原理示意图;3 is a schematic diagram of the principle of a method for determining a node feature provided by an embodiment of the present application;

图4是本申请实施例提供的节点特征的确定方法的流程示意图;4 is a schematic flowchart of a method for determining a node feature provided by an embodiment of the present application;

图5是本申请实施例提供的对待处理图进行处理的一场景示意图;5 is a schematic diagram of a scene for processing a to-be-processed graph provided by an embodiment of the present application;

图6是本申请实施例提供的对待处理图进行处理的另一场景示意图;6 is a schematic diagram of another scenario for processing a to-be-processed graph provided by an embodiment of the present application;

图7是本申请实施例提供的节点特征提取网络的训练方法的流程示意图;7 is a schematic flowchart of a training method for a node feature extraction network provided by an embodiment of the present application;

图8是本申请实施例提供的图分类网络的结构示意图;8 is a schematic structural diagram of a graph classification network provided by an embodiment of the present application;

图9是本申请实施例提供的确定特征距离的方法示意图;9 is a schematic diagram of a method for determining a characteristic distance provided by an embodiment of the present application;

图10是本申请实施例提供的节点特征提取网络的训练方法示意图;10 is a schematic diagram of a training method for a node feature extraction network provided by an embodiment of the present application;

图11是本申请实施例提供的图处理装置的结构示意图;11 is a schematic structural diagram of a graph processing apparatus provided by an embodiment of the present application;

图12是本申请实施例提供的节点特征提取网络训练装置的结构示意图;12 is a schematic structural diagram of a node feature extraction network training device provided by an embodiment of the present application;

图13是本申请实施例提供的电子设备的结构示意图。FIG. 13 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.

说明书manual

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

本申请实施例提供的图处理方法涉及人工智能(Artificial Intelligence,AI)中机器学习(Machine Learning,ML)领域以及计算机视觉技术(Computer Vision,CV)等领域。其中,机器学习(Machine Learning,ML)是专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。计算机视觉技术可用摄影机和电脑代替人眼对目标进行识别、跟踪和测量等机器视觉,并进一步做图进行处理。The graph processing method provided by the embodiments of the present application relates to the field of machine learning (ML) in artificial intelligence (Artificial Intelligence, AI) and the field of computer vision (Computer Vision, CV) and other fields. Among them, machine learning (ML) is the study of how computers simulate or realize human learning behaviors to acquire new knowledge or skills, and to reorganize existing knowledge structures to continuously improve their performance. Computer vision technology can use cameras and computers instead of human eyes to identify, track and measure targets, and further process them.

人工智能是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。如本申请实施例可通过计算机视觉技术识别图中的节点,进而以神经网络为基础,通过机器学习使得机器具备对节点进行分类的性能,从而根据节点的类别对图进行处理。Artificial intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. For example, in the embodiments of the present application, the nodes in the graph can be identified through computer vision technology, and based on the neural network, the machine has the performance of classifying the nodes through machine learning, so that the graph can be processed according to the category of the nodes.

本申请实施例提供的图处理方法还涉及云技术(Cloud technology)中的云计算(cloud computing)、人工智能云服务等领域。在本申请实施例中,通过云计算将图处理方法中涉及到的计算任务分布在大量计算机构成的资源池上以提高图处理的效率。并且还可将图处理方法作为一种人工智能服务,通过人工智能平台提供对应的图处理的人工智能云服务。The graph processing method provided by the embodiment of the present application also relates to the fields of cloud computing (cloud computing), artificial intelligence cloud service, etc. in cloud technology (Cloud technology). In the embodiment of the present application, the computing tasks involved in the graph processing method are distributed on a resource pool formed by a large number of computers through cloud computing to improve the efficiency of graph processing. In addition, the graph processing method can also be used as an artificial intelligence service, and the corresponding artificial intelligence cloud service of graph processing can be provided through the artificial intelligence platform.

参见图1,图1是本申请实施例提供的图处理方法的原理示意图。如图1所示,节点101、节点102、节点103以及节点104为待处理图10中的各节点,其中各节点间的连线可表示节点之间的连接关系,具体关系类型可基于实际应用场景确定,在此不做限制。当待处理图10为用户关系图时,待处理图10中的各节点可表示各用户,节点间的连线表示各用户之间的用户关系(如好友关系),如待处理图10中节点101与节点102、节点103以及节点104均具有好友关系。当待处理图10为知识图谱时,待处理图10中的各节点可表示各知识点,节点间的连续表示各知识点之间的关联关系,图如待处理图10中节点103所代表的知识点与节点101和节点102所代表的知识点之间具有关联关系。Referring to FIG. 1 , FIG. 1 is a schematic schematic diagram of a graph processing method provided by an embodiment of the present application. As shown in FIG. 1 , node 101 , node 102 , node 103 and node 104 are the nodes in FIG. 10 to be processed, wherein the connection between the nodes can represent the connection relationship between the nodes, and the specific relationship type can be based on the actual application The scene is determined, and there is no restriction here. When the to-be-processed Figure 10 is a user relationship diagram, each node in the to-be-processed Figure 10 can represent each user, and the lines between the nodes represent the user relationship (such as a friend relationship) between the users, such as the nodes in the to-be-processed Figure 10 101 has a friend relationship with node 102, node 103, and node 104. When the to-be-processed figure 10 is a knowledge graph, each node in the to-be-processed figure 10 can represent each knowledge point, and the continuity between the nodes represents the association relationship between the various knowledge points, as represented by the node 103 in the to-be-processed figure 10 There is an association relationship between the knowledge points and the knowledge points represented by the nodes 101 and 102 .

进一步的,通过图神经网络可获取待处理图10中各节点的节点特征,即将待处理图10中的各节点特征由向量表示。对于每一节点(以节点104为例),根据节点104的节点特征和各候选图类别对应的图类别特征之间的相似度,从各候选图类别中确定节点104的节点类别。其中,上述候选图类别为预先设置的图的类别,从而从图的类别层面来确定待处理图10中的各节点的类别,进而可基于待处理图10中各节点的列表,对其中任意一个或者多个节点进行相应处理。Further, the node features of each node in Fig. 10 to be processed can be obtained through the graph neural network, that is, the feature of each node in the to-be-processed Fig. 10 is represented by a vector. For each node (taking the node 104 as an example), the node type of the node 104 is determined from each candidate graph category according to the similarity between the node feature of the node 104 and the graph category feature corresponding to each candidate graph category. Wherein, the above candidate graph categories are preset graph categories, so the category of each node in Fig. 10 to be processed can be determined from the category level of the graph, and then based on the list of each node in Fig. 10 to be processed, any one of them can be determined. Or multiple nodes will be processed accordingly.

参见图2,图2是本申请实施例提供的图处理方法的流程示意图。如图2所示,本申请实施例提供的图处理方法可包括如下步骤:Referring to FIG. 2, FIG. 2 is a schematic flowchart of a graph processing method provided by an embodiment of the present application. As shown in FIG. 2 , the graph processing method provided by the embodiment of the present application may include the following steps:

步骤S21、获取待处理图。Step S21, acquiring the graph to be processed.

在一些可行的实施方式中,待处理图可表示对象及其之间的关系,待处理图中的对象称为节点,各对象之间的关系用边来描述。在获取待处理图时,可确定一定范围内的对象以及各对象之间的关系,进而将各对象作为节点,将各对象之间的关系映射为各对象之间的边,以基于各节点和各节点之间的边构成待处理图。In some feasible implementations, the graph to be processed may represent objects and their relationships. The objects in the graph to be processed are called nodes, and the relationships between the objects are described by edges. When acquiring the graph to be processed, the objects within a certain range and the relationship between the objects can be determined, and then each object is used as a node, and the relationship between the objects is mapped to the edge between the objects, so as to be based on the relationship between the nodes and the objects. The edges between the nodes constitute the graph to be processed.

其中,待处理图可用于表示社交网络、信息传播网络、知识图谱、化学分子结构等,具体可基于实际应用场景确定,在此不做限制。例如,在某一社交应用范围内,对于某一用户,可将该用户、与该用户具备社交关系的其他用户(该用户的应用联系人)、以及与该用户的应用联系人具备社交关系的用户作为待处理图中的各节点,将任一节点所表征的用户与其他用户之间的社交关系映射为该节点所对应的各边,进而基于表征各用户的节点以及各节点之间的边构成待处理图。The to-be-processed graph can be used to represent social networks, information dissemination networks, knowledge graphs, chemical molecular structures, etc., which can be determined based on actual application scenarios, and is not limited here. For example, within the scope of a social application, for a user, the user, other users who have a social relationship with the user (the user's application contacts), and users who have a social relationship with the user's application contacts can be As each node in the graph to be processed, the user maps the social relationship between the user represented by any node and other users to the edges corresponding to the node, and then based on the nodes representing each user and the edges between the nodes Constitutes the graph to be processed.

再例如,对于有机物2,4,6-三硝基甲苯来说,2,4,6-三硝基甲苯的化学分子结构可同样用图来表示,即将2,4,6-三硝基甲苯中的官能团(苯环)以及取代基(硝基)作为各节点,将各取代基与官能团之间的化学分子连接关系作为表征各取代基的节点以及表征官能团的节点之间的边,进而基于各节点和各边构成待处理图。For another example, for the organic 2,4,6-trinitrotoluene, the chemical molecular structure of 2,4,6-trinitrotoluene can also be represented by a diagram, that is, 2,4,6-trinitrotoluene The functional group (benzene ring) and the substituent (nitro group) are used as nodes in the Each node and each edge constitute the graph to be processed.

需要特别说明的是,在获取待处理图时的对象选取,以及对象的选取范围可基于实际应用场景需求确定,在此不做限制。如为体现某一社交应用中的用户的好友关系,可基于将该用户以及该用户的应用联系人作为各节点,该用户与其应用联系人的好友关系、以及该用户的应用联系人中互相的好友关系即可作为相对应的节点间的边,如为体现某一消息的传播路径,可将某一时间范围内该消息传播所经过的各用户作为各节点,各节点之间的边即为该消息的传播路径。It should be particularly noted that the object selection when acquiring the to-be-processed graph and the selection range of the object may be determined based on the requirements of the actual application scenario, which is not limited here. In order to reflect the friend relationship of a user in a social application, the user and the user's application contacts can be regarded as nodes, the friend relationship between the user and its application contacts, and the mutual relationship among the user's application contacts. The friend relationship can be used as the edge between the corresponding nodes. For example, to reflect the propagation path of a message, each user through which the message is propagated within a certain time range can be used as each node, and the edge between each node is The propagation path of the message.

步骤S22、获取待处理图中各节点的节点特征。Step S22, acquiring node features of each node in the graph to be processed.

在一些可行的实施方式中,结合图3对确定待处理图中各节点的节点特征的实施方式进行进一步说明,图3是本申请实施例提供的节点特征的确定方法的原理示意图。如图3所示,节点特征提取网络包括初始特征提取子网络,以及与初始特征提取子网络级联的多个节点特征提取子网络。通过初始特征提取子网络可得到待识别图中各节点的初始特征,进一步通过各节点特征提取子网络对每个节点的初始特征进行进一步处理,得到每个节点的节点特征。其中,每个节点特征提取子网络对应一个候选图类别,各节点的节点特征具体确定方法具体可参见图4,图4是本申请实施例提供的节点特征的确定方法的流程示意图。图4所示的节点特征的确定方法可包括如下步骤:In some feasible implementations, the implementation of determining the node characteristics of each node in the to-be-processed graph is further described with reference to FIG. 3 , which is a schematic diagram of the principle of the method for determining the node characteristics provided by the embodiment of the present application. As shown in FIG. 3 , the node feature extraction network includes an initial feature extraction sub-network, and multiple node feature extraction sub-networks cascaded with the initial feature extraction sub-network. The initial feature of each node in the graph to be identified can be obtained through the initial feature extraction sub-network, and the initial feature of each node is further processed through each node feature extraction sub-network to obtain the node feature of each node. Wherein, each node feature extraction sub-network corresponds to a candidate graph category, and the specific method for determining the node feature of each node can be found in FIG. The method for determining node characteristics shown in FIG. 4 may include the following steps:

步骤S221、通过初始特征提取子网络,提取待处理图中各节点的初始特征。Step S221: Extract the initial features of each node in the graph to be processed through the initial feature extraction sub-network.

在一些可行的实施方式中,待处理图中各节点的初始特征可通过初始特征提取子网络得到。具体的,在通过初始特征提取子网络,提取待处理图中各节点的初始特征时,可通过初始特征提取子网络,采用空域卷积的方法直接将卷积操作定义在待处理图中各节点之间的连接关系上,以提取待处理图上的空间特征,进而得到待处理图中各节点经过初步处理后的特征(为方便描述,以下简称第一特征),并将每一节点的第一特征确定为该节点的初始特征。In some feasible implementations, the initial features of each node in the graph to be processed can be obtained through the initial feature extraction sub-network. Specifically, when the initial feature extraction sub-network is used to extract the initial features of each node in the graph to be processed, the convolution operation can be directly defined on each node in the graph to be processed by using the spatial domain convolution method through the initial feature extraction sub-network. In order to extract the spatial features on the graph to be processed, and then obtain the preliminarily processed features of each node in the graph to be processed (for the convenience of description, hereinafter referred to as the first feature), and the first feature of each node is A feature is determined to be the initial feature of the node.

可选的,通过初始特征提取子网络,基于图形信号处理的方法,在待处理图上进行信号处理的变换,如傅立叶变换或者拉普拉斯变换,进而进行待处理图的卷积,从而提取图中各节点的第一特征,并将每一节点的第一特征确定为该节点的初始特征。需要特别说明的是,上述通过初始特征提取子网络提取待处理图中各节点的节点特征的具体实现方式,可基于实际应用场景需求以及初始特征提取子网络的网络机制确定,在此不做限制。Optionally, through the initial feature extraction sub-network, based on the method of graphic signal processing, a signal processing transformation, such as Fourier transform or Laplace transform, is performed on the to-be-processed graph, and then the convolution of the to-be-processed graph is performed to extract The first feature of each node in the graph, and the first feature of each node is determined as the initial feature of the node. It should be noted that the above-mentioned specific implementation of extracting the node features of each node in the graph to be processed through the initial feature extraction sub-network can be determined based on the actual application scenario requirements and the network mechanism of the initial feature extraction sub-network, which is not limited here. .

在一些可行的实施方式中,由于待处理图中各节点之间的连接关系重要程度不同,某一节点与不同相邻节点之间的相对重要性也有差异,因此,为考虑上述问题,可基于图注意力网络对待处理图中各节点的第一特征进行处理,将处理后的特征作为各节点的初始特征。In some feasible implementations, since the importance of the connection relationship between the nodes in the graph to be processed is different, the relative importance between a node and different adjacent nodes is also different. Therefore, in order to consider the above problems, the The graph attention network processes the first feature of each node in the graph to be processed, and uses the processed feature as the initial feature of each node.

具体实现中,在通过初始特征提取子网络获取待处理图中各节点的第一特征之后,可根据该节点的第一特征确定该节点的注意力自相关系数。假设待处理图中各节点的第一特征为

Figure BDA0002736313750000081
待处理图中各节点的初始特征为
Figure BDA0002736313750000082
n为待处理图中节点的个数,此时对于待处理图中的节点i来说,节点i的自相关系数为
Figure BDA0002736313750000083
其中,αk是第k个注意力机制的权重系数,权重系数αk由一个单层的前向神经网络计算得到,即:In a specific implementation, after obtaining the first feature of each node in the graph to be processed through the initial feature extraction sub-network, the attention autocorrelation coefficient of the node can be determined according to the first feature of the node. Assume that the first feature of each node in the graph to be processed is
Figure BDA0002736313750000081
The initial features of each node in the graph to be processed are
Figure BDA0002736313750000082
n is the number of nodes in the graph to be processed. For node i in the graph to be processed, the autocorrelation coefficient of node i is
Figure BDA0002736313750000083
Among them, α k is the weight coefficient of the k-th attention mechanism, and the weight coefficient α k is calculated by a single-layer forward neural network, namely:

Figure BDA0002736313750000084
Figure BDA0002736313750000084

其中,

Figure BDA0002736313750000085
为该层前向神经网络对应的权重向量,LeakyReLU为激活函数,W1为待处理图中各节点所共享的权值矩阵,用于表示待处理图中各节点的第一特征
Figure BDA0002736313750000086
和初始特征
Figure BDA0002736313750000087
之间的转换关系,N(i)为节点i的相邻节点的集合。同理,可根据待处理图中的节点i的第一特征
Figure BDA0002736313750000088
及节点i的各相邻节点的第一特征
Figure BDA0002736313750000089
得到节点i与各相邻节点的互相关系数为
Figure BDA00027363137500000810
其中:in,
Figure BDA0002736313750000085
is the weight vector corresponding to the forward neural network of this layer, LeakyReLU is the activation function, and W 1 is the weight matrix shared by each node in the graph to be processed, which is used to represent the first feature of each node in the graph to be processed
Figure BDA0002736313750000086
and initial features
Figure BDA0002736313750000087
The transformation relationship between N(i) is the set of adjacent nodes of node i. Similarly, according to the first feature of node i in the graph to be processed
Figure BDA0002736313750000088
and the first feature of each adjacent node of node i
Figure BDA0002736313750000089
The cross-correlation coefficient between node i and each adjacent node is obtained as
Figure BDA00027363137500000810
in:

Figure BDA00027363137500000811
Figure BDA00027363137500000811

进一步的,对于节点i来说,通过初始特征提取网络可得到节点i的初始特征

Figure BDA00027363137500000812
即节点i在其自身以及相邻节点影响下的初始特征。其中,K表示注意力机制的数量,||表示拼接过程,σ()表示非线性激活函数。Further, for node i, the initial feature of node i can be obtained through the initial feature extraction network
Figure BDA00027363137500000812
That is, the initial features of node i under the influence of itself and its neighbors. where K represents the number of attention mechanisms, || represents the splicing process, and σ() represents the nonlinear activation function.

可选的,对于待处理图中的任一节点来说,为进一步聚合其相邻节点的节点特征,可在得到该节点的初始特征之后,基于上述注意力机制和该节点的初始特征对该节点的初始特征进行一次或者多次更新,得到该节点最终的初始特征。且在每次更新时,更新前的初始特征可作为上述计算过程中的第一特征,进而基于上述过程得到更新后的初始特征,具体更新次数可基于实际应用场景确定,在此不做限制。例如,将上述初始特征的一次计算过程作为一图卷积层的计算过程,待处理图中各节点的初始特征更新次数可基于初始特征提取子网络中图卷积层的层数确定,其中,各卷积层之间的注意力机制的数量及权重、相对应的前向神经网络的权重向量以及表示各节点的更新前的初始特征和更新后的初始特征之间的转换关系的权重矩阵,可相同也可不同,具体也可基于图卷积层数量和实际应用场景需求确定,在此不做限制。Optionally, for any node in the graph to be processed, in order to further aggregate the node features of its adjacent nodes, after obtaining the initial features of the node, based on the above-mentioned attention mechanism and the initial features of the node. The initial feature of the node is updated one or more times to obtain the final initial feature of the node. And in each update, the initial feature before the update can be used as the first feature in the above calculation process, and then the updated initial feature is obtained based on the above process. The specific update times can be determined based on the actual application scenario, which is not limited here. For example, taking the above-mentioned one-time calculation process of the initial feature as the calculation process of a graph convolution layer, the initial feature update times of each node in the graph to be processed can be determined based on the number of layers of the graph convolution layer in the initial feature extraction sub-network, wherein, The number and weight of the attention mechanism between each convolutional layer, the corresponding weight vector of the forward neural network, and the weight matrix representing the transformation relationship between the initial features before updating and the initial features after updating of each node, It can be the same or different, and it can also be determined based on the number of graph convolution layers and the requirements of the actual application scenario, which is not limited here.

步骤S222、对于每一节点,基于该节点的初始特征,通过各候选图类别对应的节点特征提取子网络,得到该节点对应于各候选图类别的特征。Step S222: For each node, based on the initial feature of the node, extract a sub-network through the node feature corresponding to each candidate graph category, and obtain the feature of the node corresponding to each candidate graph category.

在一些可行的实施方式中,由于基于注意力机制仅可得到基于每一节点自身及其相邻节点的连接关系影响下的初始特征,因此若基于各节点的初始特征直接确定各节点的节点类别,将会导致节点的节点类别出现偏差,节点类别确定不准确的情况。因此,对于待处理图中的每一节点,可根据该节点的初始特征,通过节点特征提取网络中各候选图类别对应的节点特征提取子网络,得到该节点对应于各候选图类别的特征。换句话说,在节点的初始特征自身包含各节点间的连接关系的情况下,通过各候选图类别来进一步将各节点的初始特征进行表示,得到各节点的对应于各候选图类别的特征,以进一步提升节点类别确定的准确性。In some feasible implementations, since only the initial features under the influence of the connection relationship between each node itself and its adjacent nodes can be obtained based on the attention mechanism, if the node category of each node is directly determined based on the initial features of each node , it will lead to the deviation of the node category of the node and the inaccurate determination of the node category. Therefore, for each node in the to-be-processed graph, the node feature extraction sub-network corresponding to each candidate graph category in the network can be extracted according to the initial feature of the node, and the feature of the node corresponding to each candidate graph category can be obtained. In other words, when the initial feature of the node itself includes the connection relationship between the nodes, the initial feature of each node is further represented by each candidate graph category, and the feature of each node corresponding to each candidate graph category is obtained, To further improve the accuracy of node category determination.

具体的,在节点特征提取网络中,各候选图类别对应的节点特征提取子网络与初始特征提取子网络连接,并且各候选图类别为训练节点特征提取网络的过程中预设的不同的图的类别。基于此,对于每一节点来说,通过各节点特征提取子网络,根据各候选图类别对应的图类别特征,得到该节点对应于各候选图类别的特征。即通过各节点特征提取子网络,在各候选图类别影响下对该节点的初始特征进行进一步表示。Specifically, in the node feature extraction network, the node feature extraction sub-network corresponding to each candidate graph category is connected to the initial feature extraction sub-network, and each candidate graph category is a preset of a different graph in the process of training the node feature extraction network. category. Based on this, for each node, through each node feature extraction sub-network, and according to the graph category feature corresponding to each candidate graph category, the feature of the node corresponding to each candidate graph category is obtained. That is, through the feature extraction sub-network of each node, the initial features of the node are further represented under the influence of each candidate graph category.

其中,一个候选图类别对应的图类别特征,为该候选图类别对应的节点特征提取子网络的网络参数,具体网络参数可基于特征提取子网络的实际网络确定,在此不做限制。The graph category feature corresponding to a candidate graph category is the network parameter of the node feature extraction sub-network corresponding to the candidate graph category. The specific network parameters can be determined based on the actual network of the feature extraction sub-network, which is not limited here.

例如,各节点特征提取子网络为基于混合高斯模型的网络,即一个节点特征提取子网络对应混合高斯模型中的一个高斯函数,一个候选图类别对应的图类别特征,为该候选图类别对应于高斯混合高斯模型中的高斯函数的高斯分布参数。其中,上述高斯分布参数包括但不限于高斯函数对应的均值向量和协方差矩阵等,具体可基于实际应用场景需求确定,在此不做限制。具体的,对于待处理图中的节点i来说,通过各节点特征提取子网络,可得到节点i对应于各候选图类别的特征

Figure BDA0002736313750000101
For example, each node feature extraction sub-network is a network based on a Gaussian mixture model, that is, a node feature extraction sub-network corresponds to a Gaussian function in the Gaussian mixture model, and a graph category feature corresponding to a candidate graph category is the candidate graph category corresponding to Gaussian distribution parameters for Gaussian functions in Gaussian mixture Gaussian models. Wherein, the above-mentioned Gaussian distribution parameters include but are not limited to the mean vector and covariance matrix corresponding to the Gaussian function, etc., which can be specifically determined based on the requirements of the actual application scenario, and are not limited here. Specifically, for node i in the graph to be processed, through the feature extraction sub-network of each node, the feature of node i corresponding to each candidate graph category can be obtained
Figure BDA0002736313750000101

Figure BDA0002736313750000102
Figure BDA0002736313750000102

其中,

Figure BDA0002736313750000103
为节点i的初始节点特征,W2为混合高斯模型对应的权重,ωc()为第c个候选图类别对应的高斯函数,
Figure BDA0002736313750000104
表示第c个候选图类别对应的高斯函数的协方差矩阵,
Figure BDA0002736313750000105
表示第c个候选图类别对应的高斯函数的均值向量,即表征该候选图类别的中心。in,
Figure BDA0002736313750000103
is the initial node feature of node i, W 2 is the weight corresponding to the mixture Gaussian model, ω c () is the Gaussian function corresponding to the c-th candidate graph category,
Figure BDA0002736313750000104
represents the covariance matrix of the Gaussian function corresponding to the c-th candidate graph category,
Figure BDA0002736313750000105
Represents the mean vector of the Gaussian function corresponding to the c-th candidate image category, that is, characterizes the center of the candidate image category.

步骤S223、将该节点对应于各候选图类别的特征进行融合,得到该节点的节点特征。Step S223, fuse the features of the node corresponding to each candidate graph category to obtain the node feature of the node.

在一些可行的实施方式中,对于每一节点,可将该节点对应于各候选图类别的特征进行融合,得到该节点在不同候选图类别影响下的节点特征。如基于获取各候选图类别的类别权重,基于各候选图类别的权重,以及该节点对应于各候选图类别的特征进行加权求和得到。或者,将该节点对应于各候选图类别的特征的均值特征作为该节点最终的节点特征,即该节点的节点特征

Figure BDA0002736313750000106
其中C表示各候选图类别的数量,还可基于其他预设融合网络、模型等将该节点对应于各候选图类别的特征进行融合得到该节点的节点特征。In some feasible implementations, for each node, the features of the node corresponding to each candidate graph category may be fused to obtain the node features of the node under the influence of different candidate graph categories. For example, it is obtained based on obtaining the class weight of each candidate graph category, based on the weight of each candidate graph category, and the feature of the node corresponding to each candidate graph category by weighted summation. Or, the mean feature of the feature corresponding to each candidate graph category of the node is taken as the final node feature of the node, that is, the node feature of the node
Figure BDA0002736313750000106
Among them, C represents the number of each candidate graph category, and the node feature of the node can be obtained by fusing the features of the node corresponding to each candidate graph category based on other preset fusion networks, models, etc.

需要特别说明的是,上述融合待处理图中各节点对应于各候选图类别的特征的具体实现方式仅为示例,具体可基于实际应用场景需求确定,在不做限制。It should be particularly noted that the specific implementation of the above-mentioned fusion of the features of each node in the graph to be processed corresponding to each candidate graph category is only an example, which can be determined based on actual application scenario requirements, and is not limited.

步骤S23、对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各候选图类别中确定该节点的类别。Step S23: For each node, according to the similarity between the node feature of the node and the graph class feature corresponding to each candidate graph class, determine the class of the node from each candidate graph class.

在一些可行的实施方式中,在得到待处理图中各节点的节点特征之后,可从各候选图类别中确定出各节点的类别。对于待处理图中每一节点来说,具体可确定该节点的节点特征和各候选图类别对应的图类别特征之间的相似度,进而将最高相似度对应的候选图类别确定为该节点的类别。也就是说,该节点的节点特征与候选图类别对应的图类别特征之间的相似度越高,表示该节点的类别越接近该候选图类别。其中,各候选图类别包括待处理图的图类别,从而在确定各节点的节点类别时,充分考虑到待处理图自身图类别对各节点的类别所带来的影响,提升节点的类别的确定准确度。In some feasible implementations, after the node features of each node in the graph to be processed are obtained, the class of each node can be determined from each candidate graph class. For each node in the graph to be processed, the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category can be determined, and then the candidate graph category corresponding to the highest similarity can be determined as the node’s feature. category. That is to say, the higher the similarity between the node feature of the node and the graph category feature corresponding to the candidate graph category, the closer the category of the node is to the candidate graph category. Among them, each candidate graph category includes the graph category of the graph to be processed, so when determining the node category of each node, the influence of the graph category of the graph to be processed on the category of each node is fully considered, and the determination of the category of the node is improved. Accuracy.

其中,上述节点的节点特征与各候选图类别的图类别特征之间的相似度,包括但不限于欧氏距离、余弦相似度、曼哈顿距离、切比雪夫距离以及杰卡德系数等,具体可基于实际应用场景需求确定,在此不做限制。如当上述相似度为余弦相似度时,各节点的类别

Figure BDA0002736313750000111
可由公式
Figure BDA0002736313750000112
确定,即将最大余弦相似度对应的图类别特征对应的候选图类别,确定为节点的类别。Among them, the similarity between the node features of the above-mentioned nodes and the graph category features of each candidate graph category, including but not limited to Euclidean distance, cosine similarity, Manhattan distance, Chebyshev distance, and Jaccard coefficient, etc. It is determined based on the actual application scenario requirements, and there is no restriction here. For example, when the above similarity is cosine similarity, the category of each node
Figure BDA0002736313750000111
by the formula
Figure BDA0002736313750000112
Determine, that is, determine the candidate graph category corresponding to the graph category feature corresponding to the maximum cosine similarity as the category of the node.

在一些可行的实施方式中,本申请实施例中的图类别用于表征图在某一领域、某一维度的特征。其中,同一图在不同领域不同维度,可能具有不同的图类别,不同图可能具有相同的图类别,也可能具有不同的图类别,具体可基于图构成以及实际应用场景确定,在此不做限制。In some feasible implementations, the graph category in the embodiments of the present application is used to represent the characteristics of the graph in a certain field and a certain dimension. Among them, the same graph may have different graph categories in different fields and different dimensions. Different graphs may have the same graph category or different graph categories, which can be determined based on the graph composition and actual application scenarios, which are not limited here. .

例如,若待处理图表示支付网络,且待处理图中各节点为支付网络中的支付用户。在转账风控领域,待处理图的图类别可能为洗钱网络,即待处理图所表示的支付网络中存在洗钱现象,或者待处理图的图类别可能为正常支付网络,即用户支付行为无异常行为。For example, if the graph to be processed represents a payment network, and each node in the graph to be processed is a payment user in the payment network. In the field of transfer risk control, the graph category of the graph to be processed may be a money laundering network, that is, there is money laundering in the payment network represented by the graph to be processed, or the graph category of the graph to be processed may be a normal payment network, that is, the user's payment behavior is normal Behavior.

可选的,对于支付网络,待处理图的图类别还可能为移动支付网络,即表示支付网络中的支付用户采用移动支付,或者待处理图的图类别还可能银行卡转账,即表示支付用户采用银行卡转账方式支付。Optionally, for the payment network, the graph category of the graph to be processed may also be a mobile payment network, which means that the payment user in the payment network adopts mobile payment, or the graph category of the graph to be processed may also be bank card transfer, which means that the paying user Pay by bank card transfer.

又例如,若待处理图表示社交网络,且待处理图中各节点为社交网络中的社交用户,在信息传播领域,待处理图的图类别可能为谣言转播网络,即待处理图所表示的社交网络中存在谣言传播现象,或者待处理图的图类别可能为正常社交网络(无谣言社交网络)。For another example, if the graph to be processed represents a social network, and each node in the graph to be processed is a social user in the social network, in the field of information dissemination, the graph category of the graph to be processed may be a rumor relay network, that is, the graph represented by the graph to be processed. There is a phenomenon of rumor spreading in the social network, or the graph category of the graph to be processed may be a normal social network (a social network without rumors).

可选的,对于社交网络,待处理图的图类别还可基于用户年龄分类,如中老年社交网络、青少年社交网络等。Optionally, for a social network, the graph category of the graph to be processed may also be classified based on the age of the user, such as a social network for middle-aged and elderly people, a social network for teenagers, and the like.

再例如,若待处理图为任务拓扑图或者程序控制图,且待处理图中各节点为任务拓扑图(程序控制图)中的各任务节点。对于运行角度,待处理图的图类别可能为任务(程序)执行失败,即任务拓扑图中存在执行失败的任务(程序)节点,或者待处理图的图类别可能为任务(程序)执行成功,即任务拓扑图所对应的完整任务(程序)执行可成功执行。For another example, if the graph to be processed is a task topology graph or a program control graph, and each node in the graph to be processed is each task node in the task topology graph (program control graph). For the running perspective, the graph category of the graph to be processed may be that the task (program) failed to execute, that is, there is a task (program) node that failed to execute in the task topology graph, or the graph category of the graph to be processed may be that the task (program) was successfully executed. That is, the complete task (program) corresponding to the task topology map can be executed successfully.

可选的,对于任务拓扑图,在任务执行角度,待处理图的图类别可能为前端任务、后端任务,在任务类型角度,待处理图的图类别还可能为识别任务、分类任务以及翻译任务等等。Optionally, for task topology graphs, from the perspective of task execution, the graph categories of the graphs to be processed may be front-end tasks and back-end tasks, and from the perspective of task types, the graph categories of the graphs to be processed may also be recognition tasks, classification tasks, and translation tasks. tasks, etc.

其中,候选图类别为包括待处理图的图类别,以及待处理图可能的其他图类别的类别集合,具体的图类别数量以及划分可基于实际应用场景需求确定,在此不做限制。The candidate graph category is a graph category including the graph to be processed, and a category set of other graph categories possible for the graph to be processed. The specific number and division of graph categories can be determined based on actual application scenario requirements, which are not limited here.

步骤S24,基于各节点的类别,对待处理图中的至少一个节点进行相应处理。Step S24, based on the category of each node, perform corresponding processing on at least one node in the to-be-processed graph.

在一些可行的实施方式中,在确定待处理图中各节点的类别之后,可对待处理图中的一个或者多个节点进行相应的处理。具体的,可将待处理图中的节点按照节点的类别进行聚类分割,以实现对待处理图的分割。如待处理图为支付网络,基于各节点的类别可将待处理图所表示的支付网络划分为正常支付网络和洗钱网络。其中,对于洗钱网络所对应的支付用户,可及时采取风险预警、限制交易等处理措施。对于正常支付网络所对应的支付用户,可对其进行风险提示以提高其风险防范意识。In some feasible implementations, after the category of each node in the graph to be processed is determined, one or more nodes in the graph to be processed may be processed accordingly. Specifically, the nodes in the graph to be processed may be clustered and segmented according to the types of the nodes, so as to realize the segmentation of the graph to be processed. If the graph to be processed is a payment network, the payment network represented by the graph to be processed can be divided into a normal payment network and a money laundering network based on the category of each node. Among them, for the payment users corresponding to the money laundering network, measures such as risk warning and transaction restriction can be taken in a timely manner. For payment users corresponding to normal payment networks, risk reminders can be given to them to improve their awareness of risk prevention.

可选的,可基于待处理图中各节点的类别对各节点进行筛选,具体可基于各类别的节点的数量,预设的筛选类别等进行筛选,在此不做限制。如待处理图为任务拓扑图,基于不同的节点类别(任务类型)采取不同的任务测试方法。Optionally, each node may be screened based on the category of each node in the to-be-processed graph. Specifically, the screening may be performed based on the number of nodes in each category, a preset screening category, etc., which is not limited here. For example, the to-be-processed graph is a task topology graph, and different task testing methods are adopted based on different node categories (task types).

其中,上述基于待处理图中各节点的类别,对待处理图中的节点进行处理的方法仅为示例,在本申请实施例中不做限制。The above-mentioned method for processing the nodes in the to-be-processed graph based on the category of each node in the to-be-processed graph is merely an example, and is not limited in the embodiments of the present application.

在一些可行的实施方式中,在确定待处理图中各节点的类别之后,还可基于待处理图的图类别,对各节点中节点的类别与待处理图的图类别不同的节点进行相应处理,具体的处理方式可基于实际应用场景需求以及节点的类别以及待处理图的图类别确定,在此不做限制。In some feasible implementations, after the category of each node in the graph to be processed is determined, based on the graph category of the graph to be processed, corresponding processing can also be performed on nodes whose category is different from that of the graph to be processed in each node , the specific processing method can be determined based on the actual application scenario requirements and the category of the node and the graph category of the graph to be processed, which is not limited here.

其中,节点的类别与待处理图的图类别相同,可以理解为二者对应于同一特征,同一行为等,如图类别为谣言传播网络,节点的类别为谣言转播节点均对应于谣言传播,即可说明该节点的类别与图类别相同。同理,可基于相同方式确定待处理图中节点的类别与待处理图的图类别不同的节点。Among them, the category of the node is the same as the category of the graph to be processed. It can be understood that the two correspond to the same feature, the same behavior, etc. The category of the graph is the rumor propagation network, and the category of the node is the rumor relay. Nodes correspond to rumor propagation, that is It can be stated that the class of the node is the same as the class of the graph. In the same way, nodes whose types of nodes in the graph to be processed are different from those of the graph to be processed can be determined based on the same method.

例如,若待处理图的图类别表示其对应的程序控制图运行正常,若基于上述实现方式确定出的待处理图中各节点的类别中存在类别为运行失败的节点,则可对该节点进行程序测试、程序更改或者程序替换等措施。For example, if the graph category of the graph to be processed indicates that the corresponding program control graph is running normally, if there is a node whose category is failed to run in the category of each node in the graph to be processed determined based on the above implementation manner, the node can be processed Measures such as program testing, program changes, or program replacements.

例如,若待处理图的图类别表示其对应的社交网络为正常社交网络(无谣言社交网络),若基于上述实现方式确定出的待处理图中各节点的类别中,存在谣言传播节点。即谣言传播节点为待处理图中节点的类别与待处理图的图类别不同的节点,此时可对该节点进行辟谣,或者向其他非谣言节点进行相应的提醒。For example, if the graph category of the graph to be processed indicates that its corresponding social network is a normal social network (a social network without rumors), if the category of each node in the to-be-processed graph determined based on the above implementation manner, there is a rumor propagating node. That is, the rumor propagation node is a node with a different category of the node in the graph to be processed and the graph category of the graph to be processed. At this time, the node can be refuted, or other non-rumor nodes can be reminded accordingly.

如图5所示,图5是本申请实施例提供的对待处理图进行处理的一场景示意图。在图5中,基于信息传播网络中的各用户以及各用户之间的信息传播关系,可得到待处理图。其中,待处理图中各节点与传播网络中各用户相对应,各节点间的边表示相对应的信息传播关系。当各候选图类别包括谣言(谣言传播网络)和真实信息(无谣言社交网络)两种类别时,基于本申请实施例提供的图处理方法可确定待处理图中各节点的类别,即图5中节点A、节点B、节点C、节点E以及节点F的类别为谣言(谣言传播节点),即节点A、节点B、节点C、节点E以及节点F所对应的用户所传播的信息为谣言。节点D、节点G以及节点H的类别为真实信息(正常用户节点),即节点D、节点G以及节点H所对应的用户所传播的信息为真实信息。As shown in FIG. 5 , FIG. 5 is a schematic diagram of a scenario of processing a graph to be processed according to an embodiment of the present application. In FIG. 5 , a graph to be processed can be obtained based on each user in the information dissemination network and the information dissemination relationship among the users. Among them, each node in the graph to be processed corresponds to each user in the dissemination network, and the edge between each node represents the corresponding information dissemination relationship. When each candidate graph category includes rumors (rumor dissemination network) and real information (rumor-free social network), the category of each node in the graph to be processed can be determined based on the graph processing method provided by the embodiment of the present application, that is, Fig. 5 The categories of node A, node B, node C, node E and node F are rumors (rumor propagation nodes), that is, the information spread by the users corresponding to node A, node B, node C, node E and node F are rumors . The categories of node D, node G, and node H are real information (normal user nodes), that is, the information spread by users corresponding to node D, node G, and node H is real information.

若在确定待处理图的过程中将待处理图的图类别标注为无谣言社交网络,则节点A、节点B、节点C、节点E以及节点F的类别与待处理图的图类别不同,则可对用户A、用户B、用户C、用户E以及用户F进行辟谣处理。进一步可基于各节点间的信息传播关系,可确定出待处理图中的节点A为信息传播源,进而可对用户A采取限制信息传播、信息传播告警等措施。If in the process of determining the graph to be processed, the graph category of the graph to be processed is marked as a rumor-free social network, and the categories of node A, node B, node C, node E, and node F are different from the graph category of the graph to be processed, then User A, user B, user C, user E, and user F can be processed to refute rumors. Further, based on the information dissemination relationship between the nodes, it can be determined that the node A in the graph to be processed is the information dissemination source, and then measures such as restricting information dissemination and information dissemination alarms can be taken for user A.

可选的,还可基于待处理图的图类别,以及待处理图中各节点的节点类别,确定出待处理图中的目标节点,并对该目标节点进行处理。其中,该目标节点可以为改变图类别所代表的待处理图的结构关系、运行逻辑、组成方式等的节点,也可以为节点与待处理图的图类别不相关的节点,具体可基于实际应用场景需求确定,在此不做限制。Optionally, based on the graph category of the graph to be processed and the node category of each node in the graph to be processed, the target node in the graph to be processed is determined, and the target node is processed. The target node can be a node that changes the structural relationship, operation logic, composition, etc. of the to-be-processed graph represented by the graph category, or can be a node that is not related to the graph category of the to-be-processed graph, which may be based on practical applications. Scenario requirements are determined, and there are no restrictions here.

例如,待处理图表示化学分子结构,各节点表示化学分子结构的官能团,待处理图的图类别则可化学分子结构的化学名称,各节点的类别表示各官能团的名称。进而基于待处理图的图类别以及各节点的类别,确定出在该化学名称下该分子结构中错误的官能团,进而该错误的官能团进行更改以基于各官能团所构成的化学分子结构与相对应的化学名称一致。For example, the graph to be processed represents the chemical molecular structure, each node represents the functional group of the chemical molecular structure, the graph category of the to-be-processed graph represents the chemical name of the chemical molecular structure, and the category of each node represents the name of each functional group. Then, based on the graph category of the graph to be processed and the category of each node, the wrong functional group in the molecular structure under the chemical name is determined, and then the wrong functional group is changed based on the chemical molecular structure formed by each functional group. The chemical names are the same.

如图6所示,图6是本申请实施例提供的对待处理图进行处理的另一场景示意图。图6所示了一化学分子结构,其名称被标记为2,4-二硝基乙苯,通过将该分子结构中的官能团基于各官能团的连接关系,可将该化学分子结构以待处理图表示。当个候选图类别包括各官能团以及各取代基时,基于本申请实施例提供的图处理方法可确定待处理图中各节点的节点类别,即图6中节点A的类别为苯环,节点B的类别为甲基,节点C的类别为硝基以及节点E的类别为硝基。由于该化学分子结构初始被标记为2,4-二硝基乙苯,即待处理图的图类别为2,4-二硝基乙苯,在确定各节点的类别过程中将节点B的类别确定为甲基,即节点B对应的官能团为甲基,因此可确定节点B为目标节点。进而可将节点B对应的官能团由甲基更改为乙基,从而使得最终的分子结构为2,4-二硝基乙苯对于的分子结构。As shown in FIG. 6 , FIG. 6 is a schematic diagram of another scenario of processing a to-be-processed graph provided by an embodiment of the present application. Figure 6 shows a chemical molecular structure whose name is labeled as 2,4-dinitroethylbenzene. By using the functional groups in the molecular structure based on the connection relationship of each functional group, the chemical molecular structure can be represented as a to-be-processed map. express. When each candidate graph category includes each functional group and each substituent, the graph processing method provided by the embodiment of the present application can determine the node category of each node in the graph to be processed, that is, the category of node A in FIG. 6 is a benzene ring, and the category of node B The class is methyl, the class of node C is nitro and the class of node E is nitro. Since the chemical molecular structure is initially marked as 2,4-dinitroethylbenzene, that is, the graph class of the graph to be processed is 2,4-dinitroethylbenzene, in the process of determining the class of each node, the class of node B is It is determined to be methyl, that is, the functional group corresponding to node B is methyl, so it can be determined that node B is the target node. Further, the functional group corresponding to node B can be changed from methyl to ethyl, so that the final molecular structure is the molecular structure of 2,4-dinitroethylbenzene.

在本申请实施例中,通过确定待处理图中各节点的节点特征与和候选图类别对应的图类别特征之间的相似度,从而基于相似度确定各节点的类别,不仅在节点类别的确定过程中充分考虑各节点自身的节点特征,同时可结合图类别对各节点的类别所带来的影响,进而通过候选图类别确定各节点的类别,可进一步提升确定待处理图中各节点的类别的准确性。与此同时,由于在确定待处理图中节点的类别过程中有效结合了图类别为节点的类别所带来的应用,因此可进一步提升本申请实施例提供的图处理方法的适用场景,适用性高。In this embodiment of the present application, by determining the similarity between the node feature of each node in the graph to be processed and the graph category feature corresponding to the candidate graph category, the category of each node is determined based on the similarity, not only in the determination of the node category In the process, the node characteristics of each node itself are fully considered, and the influence of the graph category on the category of each node can be combined, and then the category of each node can be determined through the candidate graph category, which can further improve the determination of the category of each node in the graph to be processed. accuracy. At the same time, since the application of the graph category for the node category is effectively combined in the process of determining the category of the nodes in the graph to be processed, the applicable scenarios and applicability of the graph processing method provided by the embodiments of the present application can be further improved. high.

在一些可行的实施方式中,本申请实施例中用于获取待处理图中各节点的节点特征所采用的节点特征提取网络,是根据训练数据预先训练得到的,具体训练过程可参见图7。图7是本申请实施例提供的节点特征提取网络的训练方法的流程示意图,图7所示的节点特征提取网络的训练方法可包括如下步骤:In some feasible implementation manners, the node feature extraction network used for obtaining the node features of each node in the graph to be processed in the embodiments of the present application is obtained by pre-training according to the training data, and the specific training process can be seen in FIG. 7 . FIG. 7 is a schematic flowchart of a training method for a node feature extraction network provided by an embodiment of the present application. The training method for a node feature extraction network shown in FIG. 7 may include the following steps:

步骤S71、获取初始图分类网络以及训练数据。Step S71 , acquiring an initial graph classification network and training data.

在一些可行的实施方式中,在训练节点特征提取网络时,可先获取用于进行训练的初始图分类网络以及训练数据,其中,训练数据中的各样本图标注有样本标签,每个样本图对应的样本标签表征了该样本图的真实图类别。其中,初始图分类网络包括依次级联的节点特征提取模块、图特征提取模块和图分类模块,上述各模块在训练过程中的具体作用可参见步骤S72,在此不做说明。In some feasible implementations, when training the node feature extraction network, the initial graph classification network and training data for training can be obtained first, wherein each sample graph in the training data is marked with a sample label, and each sample graph is marked with a sample label. The corresponding sample label characterizes the real image category of the sample image. The initial graph classification network includes a node feature extraction module, a graph feature extraction module and a graph classification module that are cascaded in sequence. The specific functions of the above modules in the training process can be found in step S72, which is not described here.

其中,本申请实施例中的训练数据可从数据库、云存储中现有的数据中获取,或者以及基于大数据技术获取用于训练节点特征提取网络的训练数据,具体可基于实际应用场景需求确定,在此不做限制。The training data in the embodiments of the present application may be obtained from existing data in databases and cloud storage, or may be obtained based on big data technology for training the node feature extraction network, which may be determined based on actual application scenario requirements. , which is not limited here.

步骤S72、将各样本图输入至节点特征提取模块,得到各样本图的各节点的节点特征,将各节点的节点特征输入至图特征提取模块,得到各样本图的图特征,将各样本图的图特征输入至图分类模块,得到样本图的预测图类别。Step S72, input each sample graph into the node feature extraction module, obtain the node feature of each node of each sample graph, input the node feature of each node into the graph feature extraction module, obtain the graph feature of each sample graph, The graph features are input to the graph classification module to obtain the predicted graph category of the sample graph.

在一些可行的实施方式中,由于本申请实施例提供的图处理方法中,节点特征提取网络可提取待处理图中各节点的节点特征,进而基于各节点的节点特征以及各候选图类别对应的图类别特征确定节点的类别。因此在训练过程中,可基于图特征提取模块以及图分类模块对节点特征提取模块得到的各样本图中各节点的节点特征进行处理以得到各样本图的预测图类别,以根据各样本图的图类别衡量节点特征提取模块所提取的各节点的节点特征是否有效且准确。因此,当各样本图的预测图类别与其样本标签所表征的真实图类别一致时,可说明节点特征提取模块提取到的各节点的节点特征准确无误,因此可将训练结束时的图分类网络中的节点特征提取模块作为训练得到的节点特征提取网络。In some feasible implementations, in the graph processing method provided by the embodiments of the present application, the node feature extraction network can extract the node features of each node in the graph to be processed, and then based on the node features of each node and the corresponding The graph class feature determines the class of a node. Therefore, in the training process, the node features of each node in each sample graph obtained by the node feature extraction module can be processed based on the graph feature extraction module and the graph classification module to obtain the predicted graph category of each sample graph, so as to obtain the predicted graph category of each sample graph according to the The graph category measures whether the node features of each node extracted by the node feature extraction module are valid and accurate. Therefore, when the predicted graph category of each sample graph is consistent with the real graph category represented by the sample label, it can be shown that the node features of each node extracted by the node feature extraction module are accurate, so the graph classification network at the end of training can be classified into the network. The node feature extraction module is used as the node feature extraction network obtained by training.

具体可参见图8,图8是本申请实施例提供的图分类网络的结构示意图。图8示出了基于训练数据对初始图分类网络进行第一次训练的过程,如图8所示,在获取的训练数据后,可将训练数据中的各样本图输入至初始图分类网络中的节点特征提取模块,得到每一样本图中各节点的节点特征。其中,上述节点特征提取模块同样包括初始特征提取子网络以及与初始特征提取子网络连接的各候选图类别对应的节点特征提取子网络,具体可通过初始特征提取子网络提取各样本图中各节点的初始特征,并进一步通过节点特征提取子网络得到各节点的节点特征。其中,通过初始图分类网络中的节点特征提取模块提取各每一样本图中各节点的节点特征的具体实现方式,可参见图2中步骤S22通过节点特征提取网络提取待处理图中各节点的节点特征的实施方式,在此不再赘述。For details, refer to FIG. 8 , which is a schematic structural diagram of a graph classification network provided by an embodiment of the present application. Figure 8 shows the first training process of the initial graph classification network based on the training data. As shown in Figure 8, after the training data is obtained, each sample graph in the training data can be input into the initial graph classification network The node feature extraction module of , obtains the node features of each node in each sample graph. The above-mentioned node feature extraction module also includes an initial feature extraction sub-network and a node feature extraction sub-network corresponding to each candidate graph category connected to the initial feature extraction sub-network. Specifically, each node in each sample graph can be extracted through the initial feature extraction sub-network. , and further obtain the node features of each node through the node feature extraction sub-network. Wherein, for the specific implementation of extracting the node features of each node in each sample graph through the node feature extraction module in the initial graph classification network, please refer to step S22 in FIG. The implementation of the node feature will not be repeated here.

进一步的,将通过节点特征提取模块得到的,每一样本图中各节点的节点特征输入至图特征提取模块中,得到各样本图的图特征。具体的,对于每一样本图,可通过图特征提取模块中的注意力池化网络对各节点的节点特征进行压缩,以减少数据处理量的同时聚合各节点的节点特征,进一步可通过感知机得到各节点对应的注意力分数,并通过softmax函数归一化每一节点的注意力分数得到可清晰表示各节点的重要程度的注意力分布。对于每一样本图,可根据该样本图中各节点的节点特征,以及该样本图中各节点对应的注意力分布,将该样本图中各节点的节点特征转化为固定长度的图特征表示,即得到该样本图的图特征。通过图特征提取模块中的注意力池化网络,可使得类别与该样本图的真实类别相同的节点获得更多的注意力,类别与该样本图的真实类别不同的节点获得较少的注意力,从而使得得到的该样本图的图特征可有效区分各节点的类别。Further, the node features of each node in each sample graph obtained by the node feature extraction module are input into the graph feature extraction module to obtain graph features of each sample graph. Specifically, for each sample graph, the node features of each node can be compressed through the attention pooling network in the graph feature extraction module to reduce the amount of data processing and aggregate the node features of each node. The attention score corresponding to each node is obtained, and the attention score of each node is normalized by the softmax function to obtain the attention distribution that can clearly represent the importance of each node. For each sample graph, according to the node features of each node in the sample graph and the corresponding attention distribution of each node in the sample graph, the node features of each node in the sample graph can be converted into a fixed-length graph feature representation, That is, the graph features of the sample graph are obtained. Through the attention pooling network in the graph feature extraction module, the nodes whose category is the same as the real category of the sample graph can get more attention, and the nodes whose category is different from the real category of the sample graph can get less attention , so that the obtained graph features of the sample graph can effectively distinguish the categories of each node.

其中,在通过感知机得到各节点对应的注意力分数时,感知机的层数和相对应的激活函数可基于实际应用场景确定,在此不做限制。例如,对于一个样本图,该样本图中各节点的节点特征可通过矩阵H表示,在采用两层的多层感知机得到各节点对应的注意力分数时,基于上述实现方式得到的该样本图的图特征E=Attn(H)=softmax(Θ2tanh(Θ1HT))H。其中,tanh()为感知机对应的激活函数,Θ1和Θ2分别为两层感知机中每一层对应的权重,Θ2tanh(Θ1HT)为该样本图中各节点对应的注意力分数,通过softmax函数得到的各节点对应的注意力分布为softmax(Θ2tanh(Θ1HT))。Wherein, when the attention score corresponding to each node is obtained by the perceptron, the number of layers of the perceptron and the corresponding activation function can be determined based on the actual application scenario, which is not limited here. For example, for a sample graph, the node features of each node in the sample graph can be represented by a matrix H. When a two-layer multilayer perceptron is used to obtain the attention score corresponding to each node, the sample graph obtained based on the above implementation manner The graph feature E=Attn(H)=softmax(Θ 2 tanh(Θ 1 H T ))H. Among them, tanh() is the activation function corresponding to the perceptron, Θ 1 and Θ 2 are the weights corresponding to each layer in the two-layer perceptron, respectively, Θ 2 tanh(Θ 1 H T ) is the corresponding weight of each node in the sample graph Attention score, the attention distribution corresponding to each node obtained by the softmax function is softmax(Θ 2 tanh(Θ 1 H T )).

基于上述实现方式,通过图特征提取模型可得到各样本图的图特征,并且通过图特征提取模型中的注意力池化网络可使得节点数量不同的各样本图的图特征具有相同的长度。Based on the above implementation manner, the graph features of each sample graph can be obtained through the graph feature extraction model, and the graph features of each sample graph with different number of nodes can be made to have the same length through the attention pooling network in the graph feature extraction model.

最后,将各样本图的图特征输入至图分类模块中,得到各样本图的预测图类别。具体的,可通过图分类模块,基于每个样本图的图特征单独预测每个样本图的预测图类别,具体预测方式可通过分类算法、相关神经网络等确定,在此不做限制。Finally, the graph features of each sample graph are input into the graph classification module to obtain the predicted graph category of each sample graph. Specifically, the graph classification module can independently predict the predicted graph category of each sample graph based on the graph features of each sample graph. The specific prediction method can be determined by a classification algorithm, a related neural network, etc., which is not limited here.

可选的,当各样本图之间具有关联关系时,为提高各样本图的预测图类别的预测效率,以及结合各样本图之间的关联关系进一步提升各样本图的预测图类别的预测准确度,可通过图分类模块,基于各样本图之间的关联关系构建层次图特征。其中,层次图特征中的一个特征可表示一个样本图的图特征,换句话说,若将层次图特征类比为一个新的图的图特征,则各样本图的图特征可为该新的图中各节点的节点特征。Optionally, when each sample graph has an association relationship, in order to improve the prediction efficiency of the prediction graph category of each sample graph, and further improve the prediction accuracy of the prediction graph category of each sample graph in combination with the association relationship between the sample graphs The graph classification module can be used to construct hierarchical graph features based on the relationship between the sample graphs. Among them, a feature in the feature of the hierarchical graph can represent the graph feature of a sample graph. In other words, if the feature of the hierarchical graph is analogized to the graph feature of a new graph, the graph feature of each sample graph can be the graph feature of the new graph. The node characteristics of each node in .

其中,各样本图之间的关联关系可变现为,各样本图对应于同一社交网络中的不同部分,以及各样本图对应同一化学分子结构中的不同部分,或者基于同一用户的不同社交网络等,具体可基于实际应用场景需求确定,在此不做限制。Among them, the relationship between the sample graphs can be realized as: each sample graph corresponds to different parts of the same social network, and each sample graph corresponds to different parts of the same chemical molecular structure, or different social networks based on the same user, etc. , which can be determined based on the actual application scenario requirements, and is not limited here.

进一步的,可通过图分类模块中的消息传递网络、图卷积网络以及图注意力网络等对层次图特征进行更新,以加强层次图特征中各样本图的图特征至今的关联关系,得到更新后的层次图特征。例如,通过图卷积网络更新层次图特征的具体更新过程如下:Further, the hierarchical graph features can be updated through the message passing network, graph convolutional network, and graph attention network in the graph classification module, so as to strengthen the relationship between the graph features of each sample graph in the hierarchical graph feature so far, and get updated. Later hierarchical graph features. For example, the specific update process of updating hierarchical graph features through a graph convolutional network is as follows:

F=hierGCN(E′)=Concat(E′,σ(AhierE′Θ3));F=hierGCN(E')=Concat(E',σ(A hier E'Θ 3 ));

其中,E′为基于各样本图的图特征E构建的层次图特征,Θ3为图卷积网络对应的权重,Ahier为基于各样本图之间的关联关系构建的关系矩阵,σ()为图卷积网络对应的激活函数,Concat表示拼接操作。Among them, E' is the hierarchical graph feature constructed based on the graph feature E of each sample graph, Θ3 is the corresponding weight of the graph convolutional network, A hier is the relationship matrix constructed based on the relationship between the sample graphs, σ() is the activation function corresponding to the graph convolutional network, and Concat represents the concatenation operation.

通过全连接层和softmax函数对更新后的层次图特征F进行处理,可得到每个样本图为各候选图类别的概率,进而将概率最高的候选图类别作为相对应的样本图的预测图类别。The updated hierarchical graph feature F is processed by the fully connected layer and the softmax function, and the probability that each sample graph is a candidate graph class can be obtained, and then the candidate graph class with the highest probability is used as the predicted graph class of the corresponding sample graph. .

可选的,当各样本图之间不存在关联关系,或者各样本图之间的关联关系未知时,可同样通过图分类模块中的感知机对层次图特征进行更新,以在减少数据处理量的同时,得到更新后的层次图特征,进而根据更新后的层次图特征得到各样本图的预测图类别。Optionally, when there is no association between the sample graphs, or the association between the sample graphs is unknown, the features of the hierarchical graph can also be updated through the perceptron in the graph classification module to reduce the amount of data processing. At the same time, the updated hierarchical graph feature is obtained, and then the predicted graph category of each sample graph is obtained according to the updated hierarchical graph feature.

步骤S73、根据各样本图的预测图类别和各样本图的样本标签,确定总训练损失值。Step S73: Determine the total training loss value according to the predicted graph category of each sample graph and the sample label of each sample graph.

在一些可行的实施方式中,通过训练过程中的总训练损失值可衡量图分类网络的图类别预测能力是否稳定准确,进而在基于图分类网络可准确预测各样本图的图类别的情况下,确定图分类网络中的节点特征提取模块获取各节点的节点特征的能力稳定准确。In some feasible implementations, the total training loss value in the training process can be used to measure whether the graph class prediction ability of the graph classification network is stable and accurate. It is determined that the node feature extraction module in the graph classification network has a stable and accurate ability to obtain the node features of each node.

具体的,可根据各样本图的预测图类别,以及各样本图的样本标签,确定图分类网络训练过程中的第一训练损失值,并将第一训练损失值确定为总训练损失值。其中,第一训练损失值表征了各样本图的预测图类别与其真实图类别之间的差异,第一训练损失值越小表示图分类网络对于样本图的图类别的预测准确度和稳定性越高。其中,第一训练损失值可通过交叉熵函损失函数或者其他分类损失函数计算得到,具体可基于实际应用场景需求确定,在此不做限制。Specifically, the first training loss value in the training process of the graph classification network can be determined according to the predicted graph category of each sample graph and the sample label of each sample graph, and the first training loss value is determined as the total training loss value. Among them, the first training loss value represents the difference between the predicted image category of each sample image and its real image category, and the smaller the first training loss value is, the better the prediction accuracy and stability of the image classification network for the image category of the sample image. high. Wherein, the first training loss value may be calculated by using a cross-entropy function loss function or other classification loss functions, which may be specifically determined based on the requirements of an actual application scenario, which is not limited here.

在一些可行的实施方式中,由于本申请实施例主要通过训练处稳定的图分类网络来得到可准确、稳定获取各节点的节点特征的节点特征提取网络,因此在整体衡量各样本图的预测图类别和真实图类别之间的差异的基础之上,可进一步衡量各样本图基于节点特征提取网络提取的节点特征得到的图特征与各候选图类别的图类别特征的相似度,以进一步评估图分类网络以及节点提取网络的稳定性和准确性。In some feasible implementations, since the embodiment of the present application mainly obtains a node feature extraction network that can accurately and stably obtain the node features of each node by training a stable graph classification network, the prediction graph of each sample graph is measured as a whole. On the basis of the difference between the category and the real graph category, the similarity between the graph features obtained by each sample graph based on the node features extracted by the node feature extraction network and the graph category features of each candidate graph category can be further evaluated to further evaluate the graph. Stability and accuracy of classification networks and node extraction networks.

对于各样本图的图特征,可确定每一样本图的图特征与各候选图类别对应的图类别特征之间的第一特征距离

Figure BDA0002736313750000181
其中,n表示各样本图的图特征的索引,c表示和候选图特征的索引。为进一步凸显各样本图的图特征
Figure BDA0002736313750000191
与各候选图类别对应的图类别特征
Figure BDA0002736313750000192
之间的第一特征距离dnc,可先确定各图特征对应的目标候选图类别,其中,对于一个样本图的图特征来说,其对应的目标候选图类别为与该样本图的真实图类别一致的候选类别。进一步可基于每一图特征与相对应的目标候选图类别的图类别特征之间的第二特征距离来增强相对应的第一特征距离,具体过程如下:For the graph features of each sample graph, the first feature distance between the graph feature of each sample graph and the graph class feature corresponding to each candidate graph class can be determined
Figure BDA0002736313750000181
Among them, n represents the index of the graph feature of each sample graph, and c represents the index of the candidate graph feature. In order to further highlight the graph features of each sample graph
Figure BDA0002736313750000191
Graph class features corresponding to each candidate graph class
Figure BDA0002736313750000192
The first feature distance d nc between them can first determine the target candidate image category corresponding to each image feature. For the image feature of a sample image, the corresponding target candidate image category is the real image of the sample image. Class-consistent candidate classes. Further, the corresponding first feature distance can be enhanced based on the second feature distance between each image feature and the image category feature of the corresponding target candidate image category, and the specific process is as follows:

Figure BDA00027363137500001919
Figure BDA00027363137500001919

其中,μ为上述距离增强过程中的折扣超参数,具体可基于实际应用需求确定,在此不做限制。y(n)表示索引为n的样本图的图特征的真实图类别,

Figure BDA0002736313750000193
表示索引为n的样本图的图特征,与其相对应的目标候选图类别对应的图类别特征之间的第二特征距离,(dnc)enhance表示每一图特征与各候选图类别对应的图类别特征之间的特征距离。Among them, μ is the discount hyperparameter in the above distance enhancement process, which can be determined based on actual application requirements, and is not limited here. y (n) represents the true graph category of the graph feature of the sample graph with index n,
Figure BDA0002736313750000193
Indicates the second feature distance between the graph features of the sample graph with index n and the graph category features corresponding to the corresponding target candidate graph categories, (d nc ) enhance indicates the graph corresponding to each graph feature and each candidate graph category Feature distance between category features.

例如,参见图9,图9是本申请实施例提供的确定特征距离的方法示意图。在图9中,

Figure BDA0002736313750000194
为一个样本图的图特征,图特征
Figure BDA0002736313750000195
与图类别特征
Figure BDA0002736313750000196
之间的第一特征距离为d1,与图类别特征
Figure BDA0002736313750000197
之间的第一特征距离为d2,与图类别特征
Figure BDA0002736313750000198
之间的第一特征距离为d3。当图类别特征
Figure BDA0002736313750000199
对应的候选图类别与图特征
Figure BDA00027363137500001910
对应的样本图的真实类别相同时,图类别特征
Figure BDA00027363137500001911
对应的候选图类别为图特征
Figure BDA00027363137500001912
对应的目标候选图类别,图类别特征
Figure BDA00027363137500001913
与目标候选图类别对应的图类别特征之间的第二特征距离同样为d1,此时将图类别特征
Figure BDA00027363137500001914
与目标候选图类别对应的图类别特征之间的第二特征距离表示为δdy。因此,对于图特征
Figure BDA00027363137500001915
来说,其与图类别特征
Figure BDA00027363137500001916
至今的特征距离为d1+δdy,与图类别特征
Figure BDA00027363137500001917
之间的特征距离为d2+δdy,与图类别特征
Figure BDA00027363137500001918
之间的特征距离为d3+δdy。For example, referring to FIG. 9 , FIG. 9 is a schematic diagram of a method for determining a characteristic distance provided by an embodiment of the present application. In Figure 9,
Figure BDA0002736313750000194
is the graph feature of a sample graph, graph feature
Figure BDA0002736313750000195
with graph category features
Figure BDA0002736313750000196
The distance between the first feature is d 1 , and the graph category feature
Figure BDA0002736313750000197
The distance between the first feature is d 2 , and the graph category feature
Figure BDA0002736313750000198
The first characteristic distance between is d 3 . When graph class features
Figure BDA0002736313750000199
Corresponding candidate graph categories and graph features
Figure BDA00027363137500001910
When the real categories of the corresponding sample images are the same, the graph category features
Figure BDA00027363137500001911
The corresponding candidate graph category is the graph feature
Figure BDA00027363137500001912
Corresponding target candidate graph category, graph category feature
Figure BDA00027363137500001913
The second feature distance between the graph category features corresponding to the target candidate graph category is also d 1 .
Figure BDA00027363137500001914
The second feature distance between graph class features corresponding to the target candidate graph class is denoted as δd y . Therefore, for graph features
Figure BDA00027363137500001915
For example, it is related to the graph category feature
Figure BDA00027363137500001916
The feature distance so far is d 1 +δd y , which is related to the graph category feature
Figure BDA00027363137500001917
The feature distance between is d 2 +δd y , and the graph category feature
Figure BDA00027363137500001918
The characteristic distance between them is d 3 +δd y .

进一步的,通过softmax函数对距离矩阵Denhance进行归一化处理,得到相似度矩阵S=softmax(-Denhance)。其中,距离矩阵Denhance由(dnc)enhance确定,相似度矩阵中的每一行元素表示一个样本图的图特征与各候选图类别对应的图类别特征的相似度,每一列元素表示各样本图的图特征与一个候选图类别对应的图类别特征的相似度。也就是说,相似度矩阵中的任一元素,可表示一个样本图的图特征与一个候选图类别对应的图类别特征之间的相似度。Further, the distance matrix D enhance is normalized by the softmax function to obtain the similarity matrix S=softmax(-D enhance ). Among them, the distance matrix D enhance is determined by (d nc ) enhance , each row element in the similarity matrix represents the similarity between the graph feature of a sample graph and the graph category feature corresponding to each candidate graph category, and each column element represents each sample graph. The similarity between the graph feature of and the graph class feature corresponding to a candidate graph class. That is to say, any element in the similarity matrix can represent the similarity between a graph feature of a sample graph and a graph class feature corresponding to a candidate graph class.

进一步的,可根据上述相似矩阵和各样本图的真实图类别计算第二训练损失值进而根据第一训练损失值和第二训练损失值得到总训练损失值。其中,根据各样本图的真实图类别可构建用于表示各样本图的真实图类别与各候选图类别的关系矩阵。其中,上述关系矩阵中的每一元素表示一个样本图的真实图类别与一个候选图类别之间的关系(如若二者相同,则该元素的值为1,若二者不同,则该元素的值为0),进而每个元素可表示一个样本图的图特征与各候选图类别的图类别特征之间的真实相似度。因此,上述第二训练损失值表征了训练过程中各样本图与各候选类别对应的图类别特征之间的相似度,和各图特征与各图类别特征之间的实际相似度之间的差异。Further, the second training loss value can be calculated according to the above-mentioned similarity matrix and the real picture category of each sample picture, and then the total training loss value can be obtained according to the first training loss value and the second training loss value. Wherein, according to the real image category of each sample image, a relationship matrix for representing the real image category of each sample image and each candidate image category can be constructed. Among them, each element in the above relationship matrix represents the relationship between the real image category of a sample image and a candidate image category (if the two are the same, the value of the element is 1; if the two are different, the value of the element is 1. The value is 0), and each element can represent the real similarity between the graph features of a sample graph and the graph category features of each candidate graph category. Therefore, the above-mentioned second training loss value represents the similarity between each sample graph and the graph category feature corresponding to each candidate category during the training process, and the difference between the actual similarity between each graph feature and each graph category feature .

其中,第二训练损失值可通过交叉熵函损失函数或者其他分类损失函数计算得到,具体可基于实际应用场景需求确定,在此不做限制。Wherein, the second training loss value may be calculated by using a cross-entropy function loss function or other classification loss function, which may be specifically determined based on actual application scenario requirements, and is not limited herein.

可选的,在得到上述第一训练损失值和上述第二训练损失值之后,可获取第一训练损失值对应的第一权重和第二训练损失值对应的第二权重,根据第一训练损失值、第二训练损失值、第一权重和第二权重,确定出总训练损失值L=αLcls+(1-α)Lcon。其中,L为总训练损失值,Lcls为第一训练损失值,Lcon为第二训练损失值,α为第一权重,(1-α)为第二权重,并且α∈[0,1]。Optionally, after obtaining the first training loss value and the second training loss value, the first weight corresponding to the first training loss value and the second weight corresponding to the second training loss value may be obtained. value, the second training loss value, the first weight and the second weight, the total training loss value L=αL cls +(1−α)L con is determined. where L is the total training loss value, L cls is the first training loss value, L con is the second training loss value, α is the first weight, (1-α) is the second weight, and α∈[0,1 ].

步骤S74、根据总训练损失值和训练数据对初始图分类网络进行迭代训练,直至总训练损失值符合训练结束条件时,将训练结束时的图分类网络中的节点特征提取模块确定为节点特征提取网络。Step S74: Perform 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, determine the node feature extraction module in the graph classification network at the end of the training as the node feature extraction module. network.

在一些可行的实施方式中,根据总训练损失值和训练数据中各样本图,基于上述实现方式对初始图分类网络进行训练,并在每次训练过程中通过反向传播网络更新各候选图类别对应的图类别特征以及其他网络、模型参数,进而使得节点特征提取模块得到的节点特征表示更加合理。参见图10,图10是本申请实施例提供的节点特征提取网络的训练方法示意图。如图10所示,对于第一次训练,初始图分类网络的输入为各样本图,通过节点特征提取模块可提取得到各样本图中各节点的节点特征,其中,图注意网络可作为节点特征提起模块中的初始特征提取子网络,用于提取样本图中各节点的初始特征,节点特征提取子网络可基于各节点的初始特征,得到各节点的节点特征。通过图特征模块中的注意力池化网络,可基于每一样本图中各节点的节点特征,得到每一样本图对应的图特征,从而进一步通过图分类模块得到层次图特征,并通过图卷积网络层次图特征进行更新,以根据更新后的层次图特征得到各样本图的预测图类别。In some feasible implementations, according to the total training loss value and each sample graph in the training data, the initial graph classification network is trained based on the above implementation manner, and each candidate graph class is updated through the backpropagation network in each training process The corresponding graph category features and other network and model parameters make the node feature representation obtained by the node feature extraction module more reasonable. Referring to FIG. 10, FIG. 10 is a schematic diagram of a training method for a node feature extraction network provided by an embodiment of the present application. As shown in Figure 10, for the first training, the input of the initial graph classification network is each sample graph, and the node feature of each node in each sample graph can be extracted through the node feature extraction module, in which the graph attention network can be used as the node feature The initial feature extraction sub-network in the module is used to extract the initial features of each node in the sample graph. The node feature extraction sub-network can obtain the node features of each node based on the initial features of each node. Through the attention pooling network in the graph feature module, the graph features corresponding to each sample graph can be obtained based on the node features of each node in each sample graph, so as to further obtain the hierarchical graph features through the graph classification module, and pass the graph volume The hierarchical graph features of the product network are updated to obtain the predicted graph categories of each sample graph according to the updated hierarchical graph features.

当总训练损失值符合训练结束条件时,可将训练结束时的图分类网络中的节点特征提取模型作为节点特征提取网络,进而根据训练得到的节点特征提取网络确定待处理图中各节点的类别。其中,上述训练结束条件可以为上述训练总损失值达到收敛状态,或者为上述训练总损失值低于预设阈值等,具体可基于实际应用场景需求确定,在此不做限制。When the total training loss value meets the training end condition, the node feature extraction model in the graph classification network at the end of the training can be used as the node feature extraction network, and then the node feature extraction network obtained by training can determine the category of each node in the graph to be processed. . Wherein, the above-mentioned training end condition may be that the above-mentioned total training loss value reaches a convergent state, or that the above-mentioned total training loss value is lower than a preset threshold, etc., which may be determined based on actual application scenario requirements, and is not limited here.

在本申请实施例中,由于节点特征提取网络是通过候选图类别的图类别确定各节点的类别的,因此通过训练图分类网络,将训练结束时的图分类网络中的节点特征提取模块作为用于确定节点的类别的节点特征提取网络,一方面可在训练图分类网络过程中通过图类别预测的准确性来衡量节点特征提取模块的准确性,另一方面可通过训练过程中的总训练损失值来不断调整候选图类别对应的图类别特征,进而使得最终得到的节点特征提取网络可根据准确合适的图类别特征来确定各节点的类别,适用性高。In the embodiment of the present application, since the node feature extraction network determines the category of each node according to the graph category of the candidate graph category, by training the graph classification network, the node feature extraction module in the graph classification network at the end of the training is used as the function The node feature extraction network used to determine the category of the node. On the one hand, the accuracy of the graph category prediction can be used to measure the accuracy of the node feature extraction module in the process of training the graph classification network. On the other hand, the total training loss in the training process can be used. The value of the graph category corresponding to the candidate graph category is continuously adjusted, so that the final node feature extraction network can determine the category of each node according to the accurate and appropriate graph category features, which has high applicability.

参见图11,图11是本申请实施例提供的图处理装置的结构示意图。本申请实施例提供的图处理装置包括:Referring to FIG. 11 , FIG. 11 is a schematic structural diagram of a graph processing apparatus provided by an embodiment of the present application. The graph processing apparatus provided by the embodiment of the present application includes:

图获取模块111,用于获取待处理图;The graph obtaining module 111 is used to obtain the graph to be processed;

特征获取模块112,用于获取上述待处理图中各节点的节点特征;A feature acquisition module 112, configured to acquire node features of each node in the above-mentioned to-be-processed graph;

分类模块113,用于对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各上述候选图类别中确定该节点的类别,其中,各上述候选图类别包括上述待处理图的图类别;The classification module 113 is configured to, for each node, determine the class of the node from the above 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 of the above The candidate graph category includes the graph category of the above-mentioned to-be-processed graph;

图处理模块114,用于基于各上述节点的类别,对上述待处理图中的至少一个节点进行相应处理。The graph processing module 114 is configured to perform corresponding processing on at least one node in the graph to be processed based on the category of each of the above-mentioned nodes.

在一些可行的实施方式中,上述特征获取模块112,用于:In some feasible implementation manners, the above-mentioned feature acquisition module 112 is used for:

通过节点特征提取网络得到上述待处理图中各节点的节点特征,其中,上述节点特征提取网络包括初始特征提取子网络,以及与上述初始特征提取子网络连接的各候选图类别对应的节点特征提取子网络;The node features of each node in the graph to be processed are obtained through a node feature extraction network, wherein the node feature extraction network includes an initial feature extraction sub-network, and node feature extraction corresponding to each candidate graph category connected to the initial feature extraction sub-network subnet;

对于每一节点,通过上述初始特征提取子网络,提取上述待处理图中该节点的初始特征;For each node, through the above-mentioned initial feature extraction sub-network, extract the initial feature of the node in the above-mentioned to-be-processed graph;

基于该节点的初始特征,通过各候选图类别对应的节点特征提取子网络,得到该节点对应于各上述候选图类别的特征;Based on the initial feature of the node, a sub-network is extracted through the node feature corresponding to each candidate graph category, and the feature of the node corresponding to each of the above candidate graph categories is obtained;

将该节点对应于各上述候选图类别的特征进行融合,得到该节点的节点特征。The features of the node corresponding to each of the above candidate graph categories are fused to obtain the node feature of the node.

在一些可行的实施方式中,上述特征获取模块112,用于:In some feasible implementation manners, the above-mentioned feature acquisition module 112 is used for:

获取该节点的第一特征,根据该节点的第一特征确定该节点的注意力自相关系数;Obtain the first feature of the node, and determine the attention autocorrelation coefficient of the node according to the first feature of the node;

根据该节点的第一特征,以及该节点的各相邻节点的第一特征,确定该节点与各上述相邻节点的注意力互相关系数;According to the first feature of the node and the first feature of each adjacent node of the node, determine the attention cross-correlation coefficient between the node and each of the above-mentioned adjacent nodes;

根据上述注意力自相关系数、上述注意力互相关系数,确定该节点的初始特征。The initial feature of the node is determined according to the above-mentioned attention autocorrelation coefficient and the above-mentioned attention cross-correlation coefficient.

在一些可行的实施方式中,一个候选图类别对应的图类别特征,为该候选图类别对应的节点特征提取子网络的网络参数。In some feasible implementations, a graph class feature corresponding to a candidate graph class is used to extract network parameters of the sub-network for the node feature corresponding to the candidate graph class.

在一些可行的实施方式中,上述节点特征提取子网络为基于混合高斯模型的网络,一个候选图类别对应的图类别特征,为该候选图类别对应的混合高斯模型的高斯分布参数。In some feasible implementations, the node feature extraction sub-network is a network based on a Gaussian mixture model, and the graph class feature corresponding to a candidate graph category is a Gaussian distribution parameter of the Gaussian mixture model corresponding to the candidate graph category.

在一些可行的实施方式中,上述分类模块113,用于:In some feasible implementation manners, the above-mentioned classification module 113 is used for:

对于每一节点,从该节点的节点特征与各候选图类别对应的图类别特征之间的相似度中确定出最高相似度;For each node, determine the highest similarity from the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category;

将上述最高相似度对应的候选图类别确定为该节点的类别。The category of the candidate graph corresponding to the above highest similarity is determined as the category of the node.

在一些可行的实施方式中,上述图处理模块114,还用于:In some feasible implementation manners, the above-mentioned graph processing module 114 is further configured to:

获取上述待处理图的图类别;Get the graph category of the above pending graph;

根据各上述节点的类别,对各上述节点中节点的类别与上述待处理图的图类别不同的节点进行相应处理。According to the category of each of the above-mentioned nodes, corresponding processing is performed on the nodes whose category of each of the above-mentioned nodes is different from that of the above-mentioned graph to be processed.

参见图12,图12是本申请实施例提供的节点特征提取网络训练装置的结构示意图。本申请实施例提供的训练装置包括:Referring to FIG. 12, FIG. 12 is a schematic structural diagram of a network training device for node feature extraction provided by an embodiment of the present application. The training device provided by the embodiment of the present application includes:

网络获取模块121,用于获取初始图分类网络,上述初始图分类网络包括依次级联的节点特征提取模块、图特征提取模块和图分类模块;The network acquisition module 121 is configured to acquire an initial graph classification network, where the initial graph classification network includes a node feature extraction module, a graph feature extraction module and a graph classification module cascaded in sequence;

数据获取模块122,用于获取训练数据,上述训练数据中的各样本图标注有样本标签,上述样本标签表征了样本图的真实图类别;The data acquisition module 122 is used for acquiring training data, each sample image in the training data is marked with a sample label, and the sample label represents the real image category of the sample image;

输入模块123,用于将各上述样本图输入至上述节点特征提取模块,得到各上述样本图的各节点的节点特征;The input module 123 is configured to input each of the above-mentioned sample graphs into the above-mentioned node feature extraction module to obtain the node features of each node of each of the above-mentioned sample graphs;

上述输入模块123,用于将各上述节点的节点特征输入至上述图特征提取模块,得到各上述样本图的图特征;The above-mentioned input module 123 is used for inputting the node features of each of the above-mentioned nodes to the above-mentioned graph feature extraction module to obtain the graph features of each of the above-mentioned sample graphs;

上述输入模块123,用于将各上述样本图的图特征输入至上述图分类模块,得到上述样本图的预测图类别;The above-mentioned input module 123 is used to input the graph features of each of the above-mentioned sample graphs into the above-mentioned graph classification module to obtain the predicted graph categories of the above-mentioned sample graphs;

损失确定模块124,用于根据各上述样本图的预测图类别和各上述样本图的样本标签,确定总训练损失值;The loss determination module 124 is configured to determine the total training loss value according to the predicted graph category of each of the above-mentioned sample graphs and the sample label of each of the above-mentioned sample graphs;

网络确定模块125,用于根据上述总训练损失值和上述训练数据对上述初始图分类网络进行迭代训练,直至上述总训练损失值符合训练结束条件时,将训练结束时的初始图分类网络中的节点特征提取模块确定为上述节点特征提取网络。The network determination module 125 is configured to iteratively train the above-mentioned initial graph classification network according to the above-mentioned total training loss value and the above-mentioned training data, until the above-mentioned total training loss value meets the training end condition, classify the initial graph classification network at the end of the training. The node feature extraction module is determined to be the above node feature extraction network.

在一些可行的实施方式中,上述损失确定模块124,用于:In some feasible implementations, the above-mentioned loss determination module 124 is used to:

根据各上述样本图的预测图类别和各上述样本图的样本标签,确定第一训练损失值;Determine the first training loss value according to the predicted graph category of each of the above-mentioned sample graphs and the sample label of each of the above-mentioned sample graphs;

确定每一图特征和各上述候选图类别对应的图类别特征之间的特征距离;Determine the feature distance between each image feature and the image category feature corresponding to each of the above candidate image categories;

根据各上述图特征对应的特征距离和各上述候选图类别,确定第二训练损失值;Determine the second training loss value according to the feature distance corresponding to each of the above-mentioned graph features and each of the above-mentioned candidate graph categories;

根据上述第一训练损失值和上述第二训练损失值,确定总训练损失值。The total training loss value is determined according to the above-mentioned first training loss value and the above-mentioned second training loss value.

在一些可行的实施方式中,上述输入模块123,用于:In some feasible implementation manners, the above-mentioned input module 123 is used for:

将各上述节点的节点特征输入至上述图特征提取模块,通过上述图特征提取模块,执行以下操作:The node features of each of the above nodes are input to the above graph feature extraction module, and the following operations are performed by the above graph feature extraction module:

对于每一样本图,根据该样本图中各节点的节点特征,确定该样本图中各节点对应的注意力分布;For each sample graph, according to the node characteristics of each node in the sample graph, determine the attention distribution corresponding to each node in the sample graph;

根据该样本图中各节点的节点特征、以及上述注意力分布,确定该样本图的图特征。According to the node features of each node in the sample graph and the above attention distribution, the graph features of the sample graph are determined.

在一些可行的实施方式中,上述损失确定模块124,用于:In some feasible implementations, the above-mentioned loss determination module 124 is used to:

对于每一图特征,确定该图特征和各上述候选图类别对应的图类别特征之间的第一特征距离;For each graph feature, determine the first feature distance between the graph feature and the graph category feature corresponding to each of the above candidate graph categories;

从各上述候选图类别中确定与该图特征对应的真实图类别一致的目标候选图类别;Determine the target candidate image category that is consistent with the real image category corresponding to the image feature from each of the above candidate image categories;

确定该图特征与上述目标图类别对应的图类别特征之间的第二特征距离,根据上述第一特征距离和上述第二特征距离,确定该图特征和各候选图类别对应的图类别特征之间的特征距离。Determine the second feature distance between the graph feature and the graph category feature corresponding to the target graph category, and determine the difference 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. characteristic distance between.

在一些可行的实施方式中,上述损失确定模块124,用于:In some feasible implementations, the above-mentioned loss determination module 124 is used to:

获取上述第一训练损失值对应的第一权重,以及上述第二训练损失值对应的第二权重;obtaining the first weight corresponding to the above-mentioned first training loss value, and the second weight corresponding to the above-mentioned second training loss value;

根据上述第一训练损失值、上述第二训练损失值、上述第一权重以及上述第二权重,确定总训练损失值。The total training loss value is determined according to the first training loss value, the second training loss value, the first weight, and the second weight.

具体实现中,上述图处理装置可通过其内置的各个功能模块执行如上述图2、图4和/或图7中各个步骤所提供的实现方式,具体可参见上述各个步骤所提供的实现方式,在此不再赘述。In a specific implementation, the above-mentioned image processing apparatus can execute the implementation manners provided by the respective steps in the above-mentioned FIG. 2 , FIG. 4 and/or FIG. 7 through its built-in functional modules. For details, refer to the implementation manners provided by the above-mentioned respective steps. It is not repeated here.

在本申请实施例中,由于节点特征提取网络是通过候选图类别的图类别确定各节点的类别的,因此通过训练图分类网络,将训练结束时的图分类网络中的节点特征提取模块作为用于确定节点的类别的节点特征提取网络,一方面可在训练图分类网络过程中通过图类别预测的准确性来衡量节点特征提取模块的准确性,另一方面可通过训练过程中的总训练损失值来不断调整候选图类别对应的图类别特征,进而使得最终得到的节点特征提取网络可根据准确合适的图类别特征来确定各节点的类别,适用性高。In the embodiment of the present application, since the node feature extraction network determines the category of each node according to the graph category of the candidate graph category, by training the graph classification network, the node feature extraction module in the graph classification network at the end of the training is used as the function The node feature extraction network used to determine the category of the node. On the one hand, the accuracy of the graph category prediction can be used to measure the accuracy of the node feature extraction module in the process of training the graph classification network. On the other hand, the total training loss in the training process can be used. The value of the graph category corresponding to the candidate graph category is continuously adjusted, so that the final node feature extraction network can determine the category of each node according to the accurate and appropriate graph category features, which has high applicability.

参见图13,图13是本申请实施例提供的电子设备的结构示意图。如图13所示,本实施例中的电子设备1000可以包括:处理器1001,网络接口1004和存储器1005,此外,上述电子设备1000还可以包括:用户接口1003,和至少一个通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。其中,用户接口1003可以包括显示屏(Display)、键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1004可以是高速RAM存储器,也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。存储器1005可选的还可以是至少一个位于远离前述处理器1001的存储装置。如图13所示,作为一种计算机可读存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及设备控制应用程序。Referring to FIG. 13 , FIG. 13 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in FIG. 13 , the electronic device 1000 in this embodiment may include: a processor 1001 , a network interface 1004 and a memory 1005 . In addition, the above-mentioned electronic device 1000 may further include: a user interface 1003 , and at least one communication bus 1002 . Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display) and a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. Optionally, the network interface 1004 may include a standard wired interface and a wireless interface (eg, a WI-FI interface). The memory 1004 may be high-speed RAM memory or non-volatile memory, such as at least one disk memory. Optionally, the memory 1005 may also be at least one storage device located away from the aforementioned processor 1001 . As shown in FIG. 13 , the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

在图13所示的电子设备1000中,网络接口1004可提供网络通讯功能;而用户接口1003主要用于为用户提供输入的接口;而处理器1001可以用于调用存储器1005中存储的设备控制应用程序,以实现:In the electronic device 1000 shown in FIG. 13 , the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 program to achieve:

获取待处理图;Get the pending graph;

获取上述待处理图中各节点的节点特征;Obtain the node characteristics of each node in the above to-be-processed graph;

对于每一节点,根据该节点的节点特征与各候选图类别对应的图类别特征之间的相似度,从各上述候选图类别中确定该节点的类别,其中,各上述候选图类别包括上述待处理图的图类别;For each node, according to the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category, the category of the node is determined from each of the candidate graph categories, wherein each of the candidate graph categories includes the above-mentioned candidate graph categories. Graph class for processing graphs;

基于各上述节点的类别,对上述待处理图中的至少一个节点进行相应处理。Based on the category of each of the above-mentioned nodes, corresponding processing is performed on at least one node in the above-mentioned to-be-processed graph.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

通过节点特征提取网络得到上述待处理图中各节点的节点特征,其中,上述节点特征提取网络包括初始特征提取子网络,以及与上述初始特征提取子网络连接的各候选图类别对应的节点特征提取子网络;The node features of each node in the graph to be processed are obtained through a node feature extraction network, wherein the node feature extraction network includes an initial feature extraction sub-network, and node feature extraction corresponding to each candidate graph category connected to the initial feature extraction sub-network subnet;

对于每一节点,通过上述初始特征提取子网络,提取上述待处理图中该节点的初始特征;For each node, through the above-mentioned initial feature extraction sub-network, extract the initial feature of the node in the above-mentioned to-be-processed graph;

基于该节点的初始特征,通过各候选图类别对应的节点特征提取子网络,得到该节点对应于各上述候选图类别的特征;Based on the initial feature of the node, a sub-network is extracted through the node feature corresponding to each candidate graph category, and the feature of the node corresponding to each of the above candidate graph categories is obtained;

将该节点对应于各上述候选图类别的特征进行融合,得到该节点的节点特征。The features of the node corresponding to each of the above candidate graph categories are fused to obtain the node feature of the node.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

获取该节点的第一特征,根据该节点的第一特征确定该节点的注意力自相关系数;Obtain the first feature of the node, and determine the attention autocorrelation coefficient of the node according to the first feature of the node;

根据该节点的第一特征,以及该节点的各相邻节点的第一特征,确定该节点与各上述相邻节点的注意力互相关系数;According to the first feature of the node and the first feature of each adjacent node of the node, determine the attention cross-correlation coefficient between the node and each of the above-mentioned adjacent nodes;

根据上述注意力自相关系数、上述注意力互相关系数,确定该节点的初始特征。The initial feature of the node is determined according to the above-mentioned attention autocorrelation coefficient and the above-mentioned attention cross-correlation coefficient.

在一些可行的实施方式中,一个候选图类别对应的图类别特征,为该候选图类别对应的节点特征提取子网络的网络参数。In some feasible implementations, a graph class feature corresponding to a candidate graph class is used to extract network parameters of the sub-network for the node feature corresponding to the candidate graph class.

在一些可行的实施方式中,上述节点特征提取子网络为基于混合高斯模型的网络,一个候选图类别对应的图类别特征,为该候选图类别对应的混合高斯模型的高斯分布参数。In some feasible implementations, the node feature extraction sub-network is a network based on a Gaussian mixture model, and the graph class feature corresponding to a candidate graph category is a Gaussian distribution parameter of the Gaussian mixture model corresponding to the candidate graph category.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

对于每一节点,从该节点的节点特征与各候选图类别对应的图类别特征之间的相似度中确定出最高相似度;For each node, determine the highest similarity from the similarity between the node feature of the node and the graph category feature corresponding to each candidate graph category;

将上述最高相似度对应的候选图类别确定为该节点的类别。The category of the candidate graph corresponding to the above highest similarity is determined as the category of the node.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

获取上述待处理图的图类别;Get the graph category of the above pending graph;

根据各上述节点的类别,对各上述节点中节点的类别与上述待处理图的图类别不同的节点进行相应处理。According to the category of each of the above-mentioned nodes, corresponding processing is performed on the nodes whose category of each of the above-mentioned nodes is different from that of the above-mentioned graph to be processed.

在一些可行的实施方式中,电子设备1000在用于训练节点特征提取网络时,上述处理器1001用于:In some feasible implementation manners, when the electronic device 1000 is used for training the node feature extraction network, the above-mentioned processor 1001 is used for:

获取初始图分类网络,上述初始图分类网络包括依次级联的节点特征提取模块、图特征提取模块和图分类模块;obtaining an initial graph classification network, where the initial graph classification network includes a node feature extraction module, a graph feature extraction module and a graph classification module that are cascaded in sequence;

获取训练数据,上述训练数据中的各样本图标注有样本标签,上述样本标签表征了样本图的真实图类别;Obtain training data, each sample image 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 of the above-mentioned sample graphs into the above-mentioned node feature extraction module to obtain node features of each node of each of the above-mentioned sample graphs;

将各上述节点的节点特征输入至上述图特征提取模块,得到各上述样本图的图特征;Input the node features of each of the above-mentioned nodes into the above-mentioned graph feature extraction module to obtain the graph features of each of the above-mentioned sample graphs;

将各上述样本图的图特征输入至上述图分类模块,得到上述样本图的预测图类别;Input the graph features of each of the above-mentioned sample graphs into the above-mentioned graph classification module to obtain the predicted graph category of the above-mentioned sample graphs;

根据各上述样本图的预测图类别和各上述样本图的样本标签,确定总训练损失值;Determine the total training loss value according to the predicted graph category of each of the above-mentioned sample graphs and the sample label of each of the above-mentioned sample graphs;

根据上述总训练损失值和上述训练数据对上述初始图分类网络进行迭代训练,直至上述总训练损失值符合训练结束条件时,将训练结束时的初始图分类网络中的节点特征提取模块确定为节点特征提取网络。The initial graph classification network is iteratively trained according to the above-mentioned total training loss value and the above-mentioned training data, until the above-mentioned total training loss value meets the training end condition, the node feature extraction module in the initial graph classification network at the end of training is determined as a node Feature extraction network.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

根据各上述样本图的预测图类别和各上述样本图的样本标签,确定第一训练损失值;Determine the first training loss value according to the predicted graph category of each of the above-mentioned sample graphs and the sample label of each of the above-mentioned sample graphs;

确定每一图特征和各上述候选图类别对应的图类别特征之间的特征距离;Determine the feature distance between each image feature and the image category feature corresponding to each of the above candidate image categories;

根据各上述图特征对应的特征距离和各上述候选图类别,确定第二训练损失值;Determine the second training loss value according to the feature distance corresponding to each of the above-mentioned graph features and each of the above-mentioned candidate graph categories;

根据上述第一训练损失值和上述第二训练损失值,确定总训练损失值。The total training loss value is determined according to the above-mentioned first training loss value and the above-mentioned second training loss value.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

将各上述节点的节点特征输入至上述图特征提取模块,通过上述图特征提取模块,执行以下操作:The node features of each of the above nodes are input to the above graph feature extraction module, and the following operations are performed by the above graph feature extraction module:

对于每一样本图,根据该样本图中各节点的节点特征,确定该样本图中各节点对应的注意力分布;For each sample graph, according to the node characteristics of each node in the sample graph, determine the attention distribution corresponding to each node in the sample graph;

根据该样本图中各节点的节点特征、以及上述注意力分布,确定该样本图的图特征。According to the node features of each node in the sample graph and the above attention distribution, the graph features of the sample graph are determined.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

对于每一图特征,确定该图特征和各上述候选图类别对应的图类别特征之间的第一特征距离;For each graph feature, determine the first feature distance between the graph feature and the graph category feature corresponding to each of the above candidate graph categories;

从各上述候选图类别中确定与该图特征对应的真实图类别一致的目标候选图类别;Determine the target candidate image category that is consistent with the real image category corresponding to the image feature from each of the above candidate image categories;

确定该图特征与上述目标图类别对应的图类别特征之间的第二特征距离,根据上述第一特征距离和上述第二特征距离,确定该图特征和各候选图类别对应的图类别特征之间的特征距离。Determine the second feature distance between the graph feature and the graph category feature corresponding to the target graph category, and determine the difference 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. characteristic distance between.

在一些可行的实施方式中,上述处理器1001用于:In some possible implementations, the above-mentioned processor 1001 is used for:

获取上述第一训练损失值对应的第一权重,以及上述第二训练损失值对应的第二权重;obtaining the first weight corresponding to the above-mentioned first training loss value, and the second weight corresponding to the above-mentioned second training loss value;

根据上述第一训练损失值、上述第二训练损失值、上述第一权重以及上述第二权重,确定总训练损失值。The total training loss value is determined according to the first training loss value, the second training loss value, the first weight, and the second weight.

应当理解,在一些可行的实施方式中,上述处理器1001可以是中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integratedcircuit,ASIC)、现成可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。该存储器可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器的一部分还可以包括非易失性随机存取存储器。例如,存储器还可以存储设备类型的信息。It should be understood that, in some feasible implementation manners, the above-mentioned processor 1001 may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processor, DSP) , an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory, which may include read-only memory and random access memory, provides instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information.

具体实现中,上述电子设备1000可通过其内置的各个功能模块执行如上述图2、图4和/或图7中各个步骤所提供的实现方式,具体可参见上述各个步骤所提供的实现方式,在此不再赘述。In a specific implementation, the electronic device 1000 can execute the implementations provided by the steps in FIG. 2 , FIG. 4 and/or FIG. 7 through its built-in functional modules. For details, please refer to the implementations provided in the above steps. It is not repeated here.

在本申请实施例中,由于节点特征提取网络是通过候选图类别的图类别确定各节点的类别的,因此通过训练图分类网络,将训练结束时的图分类网络中的节点特征提取模块作为用于确定节点的类别的节点特征提取网络,一方面可在训练图分类网络过程中通过图类别预测的准确性来衡量节点特征提取模块的准确性,另一方面可通过训练过程中的总训练损失值来不断调整候选图类别对应的图类别特征,进而使得最终得到的节点特征提取网络可根据准确合适的图类别特征来确定各节点的类别,适用性高。In the embodiment of the present application, since the node feature extraction network determines the category of each node according to the graph category of the candidate graph category, by training the graph classification network, the node feature extraction module in the graph classification network at the end of the training is used as the function The node feature extraction network used to determine the category of the node. On the one hand, the accuracy of the graph category prediction can be used to measure the accuracy of the node feature extraction module in the process of training the graph classification network. On the other hand, the total training loss in the training process can be used. The value of the graph category corresponding to the candidate graph category is continuously adjusted, so that the final node feature extraction network can determine the category of each node according to the accurate and appropriate graph category features, which has high applicability.

本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,被处理器执行以实现图2、图4和/或图7中各个步骤所提供的方法,具体可参见上述各个步骤所提供的实现方式,在此不再赘述。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and is executed by a processor to implement the method provided by each step in FIG. 2 , FIG. 4 and/or FIG. 7 , specifically Reference may be made to the implementation manners provided by the foregoing steps, and details are not described herein again.

上述计算机可读存储介质可以是前述任一实施例提供的任务处理装置的内部存储单元,例如电子设备的硬盘或内存。该计算机可读存储介质也可以是该电子设备的外部存储设备,例如该电子设备上配备的插接式硬盘,智能存储卡(smart media card,SMC),安全数字(secure digital,SD)卡,闪存卡(flash card)等。上述计算机可读存储介质还可以包括磁碟、光盘、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(randomaccess memory,RAM)等。进一步地,该计算机可读存储介质还可以既包括该电子设备的内部存储单元也包括外部存储设备。该计算机可读存储介质用于存储该计算机程序以及该电子设备所需的其他程序和数据。该计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The above-mentioned computer-readable storage medium may be an internal storage unit of the task processing apparatus provided in any of the foregoing embodiments, such as a hard disk or a memory of an electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card equipped on the electronic device, Flash card (flash card), etc. The above-mentioned computer-readable storage medium may also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), and the like. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been or will be output.

本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。电子设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行图2、图4和/或图7中各个步骤所提供的方法。Embodiments of the present application provide a computer program product or computer program, where the computer program product or 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 to cause the computer device to perform the method provided by each step in FIG. 2 , FIG. 4 and/or FIG. 7 .

本申请的权利要求书和说明书及附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或电子设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或电子设备固有的其它步骤或单元。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置展示该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。The terms "first", "second" and the like in the claims and description of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or electronic device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes unlisted steps or units, or optionally also Include other steps or units inherent to these processes, methods, products or electronic devices. Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification is not necessarily all referring to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments. As used in this specification and the appended claims, the term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. Interchangeability, the above description has generally described the components and steps of each example in terms of function. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.

以上所揭露的仅为本申请较佳实施例而已,不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。The above disclosures are only the preferred embodiments of the present application, and cannot be used to limit the scope of the claims of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope of the present application.

Claims (15)

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.
CN202011134804.2A 2020-10-21 2020-10-21 Graph processing method, network training method, device, equipment and storage medium Pending CN113408564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011134804.2A CN113408564A (en) 2020-10-21 2020-10-21 Graph processing method, network training method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011134804.2A CN113408564A (en) 2020-10-21 2020-10-21 Graph processing method, network training method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113408564A true CN113408564A (en) 2021-09-17

Family

ID=77677377

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011134804.2A Pending CN113408564A (en) 2020-10-21 2020-10-21 Graph processing method, network training method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113408564A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114332516A (en) * 2021-11-24 2022-04-12 腾讯科技(深圳)有限公司 Data processing method, data processing device, model training method, model training device, data processing equipment, storage medium and product
CN114511024A (en) * 2022-01-28 2022-05-17 腾讯科技(深圳)有限公司 Node classification method, apparatus, apparatus, medium and computer program product
CN115115031A (en) * 2022-06-28 2022-09-27 支付宝(杭州)信息技术有限公司 Data processing method and device
CN115114484A (en) * 2022-05-13 2022-09-27 腾讯科技(深圳)有限公司 Abnormal event detection method and device, computer equipment and storage medium
CN116151354A (en) * 2023-04-10 2023-05-23 之江实验室 Network node learning method, device, electronic device and storage medium
CN117131252A (en) * 2023-09-12 2023-11-28 广东电网有限责任公司 An electrical node processing method, device, equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5526281A (en) * 1993-05-21 1996-06-11 Arris Pharmaceutical Corporation Machine-learning approach to modeling biological activity for molecular design and to modeling other characteristics
US20090262664A1 (en) * 2008-04-18 2009-10-22 Bonnie Berger Leighton Method for identifying network similarity by matching neighborhood topology
KR20160015005A (en) * 2014-07-30 2016-02-12 에스케이텔레콤 주식회사 Method and apparatus for discriminative training acoustic model based on class, and speech recognition apparatus using the same
CN109447169A (en) * 2018-11-02 2019-03-08 北京旷视科技有限公司 The training method of image processing method and its model, device and electronic system
CN110276406A (en) * 2019-06-26 2019-09-24 腾讯科技(深圳)有限公司 Expression classification method, apparatus, computer equipment and storage medium
CN110598065A (en) * 2019-08-28 2019-12-20 腾讯云计算(北京)有限责任公司 Data mining method and device and computer readable storage medium
US20200053118A1 (en) * 2018-08-10 2020-02-13 Visa International Service Association Replay spoofing detection for automatic speaker verification system
CN111291827A (en) * 2020-02-28 2020-06-16 北京市商汤科技开发有限公司 Image clustering method, device, equipment and storage medium
CN111309923A (en) * 2020-01-22 2020-06-19 腾讯科技(深圳)有限公司 Object vector determination method, model training method, device, equipment and storage medium
CN111582409A (en) * 2020-06-29 2020-08-25 腾讯科技(深圳)有限公司 Image label classification network training method, image label classification method and device
CN111737474A (en) * 2020-07-17 2020-10-02 支付宝(杭州)信息技术有限公司 Method and device for training business model and determining text classification category

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5526281A (en) * 1993-05-21 1996-06-11 Arris Pharmaceutical Corporation Machine-learning approach to modeling biological activity for molecular design and to modeling other characteristics
US20090262664A1 (en) * 2008-04-18 2009-10-22 Bonnie Berger Leighton Method for identifying network similarity by matching neighborhood topology
KR20160015005A (en) * 2014-07-30 2016-02-12 에스케이텔레콤 주식회사 Method and apparatus for discriminative training acoustic model based on class, and speech recognition apparatus using the same
US20200053118A1 (en) * 2018-08-10 2020-02-13 Visa International Service Association Replay spoofing detection for automatic speaker verification system
CN109447169A (en) * 2018-11-02 2019-03-08 北京旷视科技有限公司 The training method of image processing method and its model, device and electronic system
CN110276406A (en) * 2019-06-26 2019-09-24 腾讯科技(深圳)有限公司 Expression classification method, apparatus, computer equipment and storage medium
CN110598065A (en) * 2019-08-28 2019-12-20 腾讯云计算(北京)有限责任公司 Data mining method and device and computer readable storage medium
CN111309923A (en) * 2020-01-22 2020-06-19 腾讯科技(深圳)有限公司 Object vector determination method, model training method, device, equipment and storage medium
CN111291827A (en) * 2020-02-28 2020-06-16 北京市商汤科技开发有限公司 Image clustering method, device, equipment and storage medium
CN111582409A (en) * 2020-06-29 2020-08-25 腾讯科技(深圳)有限公司 Image label classification network training method, image label classification method and device
CN111737474A (en) * 2020-07-17 2020-10-02 支付宝(杭州)信息技术有限公司 Method and device for training business model and determining text classification category

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JUNCHI YU ET AL: "Graph Information Bottleneck for Subgraph Recognition", 《ARXIV》, 13 October 2020 (2020-10-13), pages 1 - 13 *
TIAN BIAN ET AL: "Inverse Graph Identification: Can We Identify Node Labels Given Graph Labels?", 《ARXIV》, 12 July 2020 (2020-07-12), pages 1 - 15 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114332516A (en) * 2021-11-24 2022-04-12 腾讯科技(深圳)有限公司 Data processing method, data processing device, model training method, model training device, data processing equipment, storage medium and product
CN114511024A (en) * 2022-01-28 2022-05-17 腾讯科技(深圳)有限公司 Node classification method, apparatus, apparatus, medium and computer program product
CN114511024B (en) * 2022-01-28 2024-09-10 腾讯科技(深圳)有限公司 Node classification method, device, equipment, medium and computer program product
CN115114484A (en) * 2022-05-13 2022-09-27 腾讯科技(深圳)有限公司 Abnormal event detection method and device, computer equipment and storage medium
CN115115031A (en) * 2022-06-28 2022-09-27 支付宝(杭州)信息技术有限公司 Data processing method and device
CN116151354A (en) * 2023-04-10 2023-05-23 之江实验室 Network node learning method, device, electronic device and storage medium
CN117131252A (en) * 2023-09-12 2023-11-28 广东电网有限责任公司 An electrical node processing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US11983269B2 (en) Deep neural network system for similarity-based graph representations
CN111753895B (en) Data processing method, device and storage medium
CN111582409B (en) Training method of image label classification network, image label classification method and equipment
CN108345587B (en) Method and system for detecting authenticity of comments
CN113961765B (en) Search methods, devices, equipment and media based on neural network models
CN111931859B (en) A multi-label image recognition method and device
CN115129863B (en) Intent recognition method, apparatus, device, storage medium, and computer program product
WO2024002167A1 (en) Operation prediction method and related apparatus
CN111080304A (en) A trusted relationship identification method, device and device
CN112231592A (en) Graph-based network community discovery method, apparatus, device and storage medium
CN111783903A (en) Text processing method, text model processing method and device, and computer equipment
WO2024007119A1 (en) Training method for text processing model, and text processing method and device
CN116524261B (en) An image classification method and product based on multimodal few-shot continuous learning
CN110119860A (en) A kind of rubbish account detection method, device and equipment
CN115063656A (en) Image detection method and device, computer readable storage medium and electronic equipment
CN114595352A (en) Image recognition method, device, electronic device and readable storage medium
CN117011569A (en) Image processing method and related device
CN114332893A (en) Table structure identification method and device, computer equipment and storage medium
CN112784066A (en) Information feedback method, device, terminal and storage medium based on knowledge graph
CN115687764B (en) Training method of vehicle track evaluation model, vehicle track evaluation method and device
CN114625926A (en) Task processing method, device, equipment and storage medium
CN115129885A (en) Entity chain pointing method, device, equipment and storage medium
CN113139052A (en) Rumor detection method and device based on graph neural network feature aggregation
CN113065634B (en) Image processing method, neural network training method and related equipment
CN115062779A (en) Event prediction method and device based on dynamic knowledge graph

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40051399

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination