Data processing method and device, equipment and medium

By filtering and weighting complex negative sample data, the problem of simple negative samples affecting the model training effect in batch training is solved, the feature learning and training effect of the model is improved, and the dispersion of the feature distribution space is enhanced.

CN119204261APending Publication Date: 2024-12-27XIAOHONGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411309079.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

When training models through batch processing, there are a large number of simple negative samples and limited information, resulting in low model training effect and insufficient feature learning, which affects the model's feature extraction and training effect.

Method used

By filtering negative sample data, complex negative samples are screened using feature distance loss and weight loss, loss weighting is performed, model training loss is improved, and the model's feature learning ability and training effect are improved.

Benefits of technology

By screening complex negative sample data, the model's sensitivity to features and characterization ability is improved, the model's training effect is improved, the simple negative sample's interference on model training is reduced, and the dispersion of feature distribution space is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119204261A_ABST
    Figure CN119204261A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data processing method and device, equipment and a medium, and is applied to the technical field of computers. The method comprises the following steps: acquiring N sample pairs, taking first sample data in the N sample pairs as anchor point sample data, taking second sample data which are in the same sample pair as the anchor point sample data as positive sample data, taking second sample data which are not in the same sample pair as the anchor point sample data as negative sample data, determining feature distance loss and weight loss of the negative sample data based on sample features of the anchor point sample data, the positive sample data and the negative sample data and a sample screening interval, and taking the negative sample data with the feature distance loss greater than a distance loss threshold as complex negative sample data; and performing loss weighting on the feature distance loss through the weight loss of the complex negative sample data to obtain the training loss of the anchor point sample data so as to determine a model loss value. By adopting the embodiment of the invention, the model training effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, specifically to the field of deep learning technology, and in particular to a data processing method, device, equipment and medium. Background Art

[0002] At present, when training a model through sample pairs, a batch training method can be used. For example, a sample in a sample pair in a training batch can be used as an anchor sample, and the model loss value can be determined through the positive and negative samples of the anchor sample to train the model. Among them, the model loss value of a training batch for the model can be determined through the loss values ​​of all anchor samples in a training batch for the model. Specifically, the loss value of sample A for the model can be determined through an anchor sample (such as sample A), the positive sample of sample A, and all negative samples in the training batch.

[0003] However, the number of all negative samples of an anchor point sample is large, which may include a large number of simple negative samples. These simple negative samples contain very limited information, and the model learns fewer features, which may have some impact when the model learns the feature information of the samples, resulting in low model training effect. Summary of the invention

[0004] The embodiments of the present application provide a data processing method, apparatus, device and medium, which can improve the model training effect by screening negative sample data.

[0005] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:

[0006] Obtain N sample pairs for inputting the initial model; one sample pair includes a first sample data and a second sample data; N is a positive integer greater than 1; the initial model is used to determine the sample characteristics of the first sample data and the sample characteristics of the second sample data;

[0007] Obtain a sample pair i from N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data; i is a positive integer less than or equal to N;

[0008] Determine a feature distance loss and a weight loss of the negative sample data with respect to the anchor sample data based on sample features of the anchor sample data, sample features of the positive sample data, sample features of the negative sample data, and a sample screening interval associated with the negative sample data;

[0009] The negative sample data whose feature distance loss is greater than the distance loss threshold is used as the complex negative sample data of the anchor sample data;

[0010] The feature distance loss of complex negative sample data is weighted by the weight loss of complex negative sample data to obtain the training loss of the anchor sample data for the initial model;

[0011] The model loss value used to train the initial model is determined based on the training loss of the anchor sample data.

[0012] On the other hand, an embodiment of the present application provides a data processing method, the method comprising:

[0013] Obtain first target data and second target data for inputting a target model; the target model is obtained by training the initial model with respect to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is the negative sample data of the anchor sample data, in which the feature distance loss is greater than the distance loss threshold; the anchor sample data and the negative sample data are obtained from N sample pairs used to train the initial model; N is a positive integer greater than 1;

[0014] Inputting the first target data into the target model to obtain the target features of the first target data, and inputting the second target data into the target model to obtain the target features of the second target data;

[0015] The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

[0016] On the one hand, an embodiment of the present application provides a data processing device, the device comprising:

[0017] A sample acquisition module is used to acquire N sample pairs for input into an initial model; a sample pair includes a first sample data and a second sample data; N is a positive integer greater than 1; the initial model is used to determine the sample characteristics of the first sample data and the sample characteristics of the second sample data;

[0018] The sample acquisition module is further used to obtain a sample pair i from the N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data; i is a positive integer less than or equal to N;

[0019] A feature loss determination module, configured to determine a feature distance loss and a weight loss of the negative sample data with respect to the anchor sample data based on sample features of the anchor sample data, sample features of the positive sample data, sample features of the negative sample data, and a sample screening interval associated with the negative sample data;

[0020] A sample screening module is used to use negative sample data whose feature distance loss is greater than a distance loss threshold in the negative sample data as complex negative sample data of anchor sample data;

[0021] A training loss determination module, used to weight the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data, to obtain the training loss of the anchor sample data for the initial model;

[0022] The training loss determination module is also used to determine the model loss value used to train the initial model based on the training loss of the anchor point sample data.

[0023] On the other hand, an embodiment of the present application provides a data processing device, the device comprising:

[0024] A data acquisition module is used to acquire first target data and second target data for input into a target model; the target model is obtained by training the initial model with respect to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is the negative sample data of the anchor sample data, in which the feature distance loss is greater than the distance loss threshold; the anchor sample data and the negative sample data are obtained from N sample pairs used for training the initial model; N is a positive integer greater than 1;

[0025] A model processing module, used for inputting the first target data into the target model to obtain the target features of the first target data, and inputting the second target data into the target model to obtain the target features of the second target data;

[0026] The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

[0027] On the one hand, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute some or all of the steps in the above method.

[0028] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program includes program instructions, which, when executed by a processor, are used to execute some or all of the steps in the above method.

[0029] Accordingly, according to one aspect of the present application, a computer program product is provided, which stores a computer program. The computer program includes program instructions, and when the program instructions are executed by a processor, some or all of the steps in the above method can be implemented.

[0030] In an embodiment of the present application, N sample pairs for inputting the initial model can be obtained, and anchor sample data can be obtained from sample pair i of the N sample pairs, as well as the positive sample data of the anchor sample data and all negative sample data in the N sample pairs. At this time, the sample features of the anchor sample data, the sample features of the positive sample data, and the sample features of the negative sample data can be determined by the initial model, and the feature distance loss and weight loss of the negative sample data for the anchor sample data can be determined based on the aforementioned multiple sample features and the sample screening interval associated with the negative sample data. The feature distance loss can be used to measure the complexity of the negative sample data, and then the negative sample data can be screened according to the feature distance loss. Specifically, the negative sample data with a feature distance loss greater than the distance loss threshold can be used as complex negative sample data of the anchor sample data. The training loss of the anchor sample data for the initial model can be determined based on the weight loss and feature distance loss of the complex negative sample data, thereby obtaining the model loss value for training the initial model. It can be understood that negative samples whose feature distance loss is less than or equal to the distance loss threshold are simple negative samples. Training the initial model with complex negative sample data can prevent the initial model from being disturbed by simple negative samples, and can better learn the feature information in the complex negative sample data. It can improve the sensitivity of the distance measurement between different features, so that the model can learn a more dispersed feature distribution space, and improve the representation ability of the model, thereby improving the model training effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0032] Figure 1 A schematic diagram of a network architecture provided for an embodiment of the present application;

[0033] Figure 2 A schematic diagram of a data processing scenario provided in an embodiment of the present application;

[0034] Figure 3 A flowchart of a data processing method provided in an embodiment of the present application;

[0035] Figure 4 A flowchart of another data processing method provided in an embodiment of the present application;

[0036] Figure 5 A flowchart of another data processing method provided in an embodiment of the present application;

[0037] Figure 6 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;

[0038] Figure 7 A schematic diagram of the structure of another data processing device provided in an embodiment of the present application;

[0039] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0041] The data processing method proposed in the embodiment of the present application is implemented in an electronic device, which can be a server or a terminal. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited to this.

[0042] Among them, Figure 1 As shown, Figure 1A schematic diagram of a network architecture provided for an embodiment of the present application; wherein the network architecture may include a server and a service terminal cluster, wherein the service terminal cluster may include one or more service terminals, and the number of service terminals in the service terminal cluster will not be limited here. A communication connection may exist between service terminals in the service terminal cluster. At the same time, any service terminal in the service terminal cluster may have a communication connection with the server, so that each service terminal in the service terminal cluster may exchange data with the server through the communication connection. The above-mentioned communication connection does not limit the connection method, and may be directly or indirectly connected through a wired communication method, or directly or indirectly connected through a wireless communication method, or through other methods, which are not limited in this application. In addition, it can be understood that the electronic device involved in the embodiment of the present application may be Figure 1 The server shown can also be Figure 1 Any service terminal in the service terminal cluster shown.

[0043] For example, after the target model is obtained through training through the technical solution of the present application, the business terminal can upload the first target data and the second target data to be matched to the server, and the server inputs the first target data and the second target data into the target model to obtain the feature similarity between the first target data and the second target data.

[0044] See also Figure 2 A schematic diagram of a data processing scenario proposed based on the data processing method can be shown as follows: Figure 2 As shown, an electronic device (such as a server or a business terminal) can obtain N sample pairs (such as sample pair 20a, sample pair 20b, ..., sample pair 20n) for training an initial model, where a sample pair includes a first sample data and a second sample data (such as sample pair 20a includes first sample data 211a and second sample data 211b, sample pair 20b includes first sample data 212a and second sample data 212b, ..., sample pair 20n includes first sample data 21na and second sample data 21nb), and the initial model can determine the sample features of the first sample data and the sample features of the second sample data.

[0045] At this time, the first sample data in the sample pair can be used as the anchor sample data (for example, taking the sample pair 20a in the N sample pairs as an example, the first sample data 211a in the sample pair 20a is used as the anchor sample data). It can be understood that the second sample data 211b in the same sample pair as the anchor sample data can be the positive sample data of the anchor sample data, and all the second sample data (such as the second sample data 212b, ..., the second sample data 21nb) that are not in the same sample pair as the anchor sample data can be the negative sample data of the anchor sample data.

[0046] The feature distance loss and weight loss of the negative sample data can be determined based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data. At this time, the negative sample data can be screened according to the feature distance loss. For example, the negative sample data whose feature distance loss is greater than the distance loss threshold can be screened out as the complex negative sample data of the anchor sample data.

[0047] In this way, the training loss of the anchor sample data for the initial model can be determined by the weight loss and feature distance loss of the complex negative sample data to determine the model loss value used to train the initial model. It can be understood that the target model can be obtained by training the initial model through the model loss value. The target model can be used to determine the target features of the input first target data (corresponding to the first sample data) and the second target data (corresponding to the second sample data).

[0048] Optionally, in some embodiments, the electronic device may execute the data processing method to improve the model training effect according to actual business needs, thereby improving the application effect of the target feature. The technical solution of the present application can be applied to any matching scenario, such as an image-text matching scenario, in which case the first target data and the second target data may be image data and text data to be matched. For example, in a scenario where an image is retrieved through text, the text data input by the user can be obtained, and the image data matching the text data can be found in the image database through the text data. For example, the text data is input into the target model to obtain the target feature of the text data, and the image data is input into the target model to obtain the target feature of the image data. In this way, the feature similarity can be determined based on the target feature of the text data and the target feature of the image data to determine whether the image data and the text data match, which can ensure the accuracy of the matching result.

[0049] As another example, it may be an image matching scenario, in which case the first target data and the second target data may be image data to be matched (such as the first image data and the second image data). For example, in a scenario where an image is retrieved through an image, the first image data input by the user may be obtained, and the second image data matching the first image data may be found in the image database through the first image data. For example, the first image data may be input into a target model to obtain the target feature of the first image data, and the second image data may be input into a target model to obtain the target feature of the second image data. In this way, the feature similarity may be determined based on the target feature of the first image data and the target feature of the second image data to determine whether the first image data and the second image data match each other, thereby ensuring the accuracy of the matching result.

[0050] The application scenario of the technical solution of the present application is not limited here. According to different application scenarios, the specific types of the first sample data and the second sample data in the constructed sample pair may be different. The electronic device can determine the complex negative sample data through the technical solution of the present solution, and determine the model loss value for training the initial model through the feature distance loss and weight loss of the complex negative sample data.

[0051] Optionally, the data involved in this application, such as the target model, can be stored in a database, or can be stored in a blockchain, such as through a blockchain distributed system, which is not limited in this application.

[0052] It should be noted that in the specific implementation of the present application, when it comes to scenarios involving obtaining relevant data such as user information, such as obtaining target data uploaded by the user, etc., it is necessary to obtain user permission or consent. That is, when the embodiments of the present application are applied to specific products or technologies, the collection, use and processing of relevant user data comply with relevant laws, regulations and standards in the relevant regions. For example, a prompt message can be issued in the form of an interactive interface to prompt which specific data will be collected or obtained. Specifically, the type and content of these data can be prompted to the user in a list or other manner. Only after receiving a confirmation operation or instruction allowing the collection of data on the interactive interface, the collection and processing of relevant data will be further performed.

[0053] It is understood that the above scenarios are only examples and do not constitute a limitation on the application scenarios of the technical solutions provided in the embodiments of the present application. The technical solutions of the present application can also be applied to other scenarios. For example, it is known to those skilled in the art that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0054] Based on the above description, the present application embodiment proposes a data processing method, which can be executed by the electronic device mentioned above. Figure 3 , Figure 3 A flowchart of a data processing method provided in an embodiment of the present application.

[0055] like Figure 3 As shown, the process of the data processing method of the embodiment of the present application may include the following:

[0056] S101. Obtain N sample pairs for inputting an initial model.

[0057] Wherein, N is a positive integer greater than 1. It can be understood that the N sample pairs refer to sample pairs in a training batch.

[0058] A sample pair includes a first sample data and a second sample data. For example, in a text-image matching scenario, the first sample data may be text data, and the second sample data may be image data that matches the text data. For another example, in an image matching scenario, the first sample data may be image data, and the second sample data may be image data that matches the first sample data. The specific type of sample data that constitutes a sample pair is not limited here.

[0059] The initial model can be used to determine the sample features of the first sample data and the sample features of the second sample data, such as a clip model (a text-image multimodal model) or any neural network model. For example, the initial model may include a first sample feature processing component associated with the first sample data and a second sample feature processing component associated with the second sample data. The first sample feature processing component can perform feature processing on the first sample data to obtain the sample features of the first sample data. The second sample feature processing component can perform feature processing on the second sample data to obtain the sample features of the second sample data.

[0060] It can be understood that the first sample feature processing component in the initial model obtains the first feature processing component in the target model after model training, which is used to determine the target feature of the first target data. The second sample feature processing component in the initial model obtains the second feature processing component in the target model after model training, which is used to determine the target feature of the second target data.

[0061] S102. Obtain a sample pair i from N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data.

[0062] Wherein, i is a positive integer less than or equal to N.

[0063] The first sample data of the sample pair can be used as the anchor sample data. It can be understood that the first sample data and the second sample data of the same sample pair are positive samples of each other, and the first sample data and the second sample data of different sample pairs are negative samples of each other.

[0064] Therefore, taking one sample pair (sample pair i) among the N sample pairs as an example, the first sample data in sample pair i is used as the anchor sample data to obtain the positive sample data and negative sample data of the anchor sample data. For example, the second sample data in all sample pairs except sample pair i is used as the negative sample data of the anchor sample data (in this case, the number of negative sample data is N-1). Alternatively, the second sample data in any specified number of sample pairs among all sample pairs except sample pair i is used as the negative sample data of the anchor sample data (in this case, the number of negative sample data is a specified number).

[0065] S103, determining the feature distance loss and weight loss of the negative sample data with respect to the anchor sample data based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data.

[0066] There are multiple negative sample data, and the multiple negative sample data include the target negative sample data. The feature distance loss and weight loss of each negative sample data are determined in the same way. Here, a negative sample data (target negative sample data) is taken as an example to describe the process of determining the feature distance loss and weight loss.

[0067] Among them, determining the feature distance loss can be based on the positive sample feature distance between the sample features of the anchor sample data and the sample features of the positive sample data, the target negative sample feature distance between the sample features of the anchor sample data and the sample features of the target negative sample data, and the sample screening interval to determine the feature distance loss for the target negative sample data.

[0068] It can be understood that the sample screening interval can be used to determine the feature distance loss to screen out complex negative sample data.

[0069] The feature distance loss determined by the sample screening interval may be that if the sum of the distances between the positive sample feature distance and the sample screening interval is greater than the target negative sample feature distance, the distance difference between the distance sum and the target negative sample feature distance is used as the feature distance loss for the target negative sample data; if the sum of the distances between the positive sample feature distance and the sample screening interval is less than or equal to the target negative sample feature distance, the target distance loss is used as the feature distance loss for the target negative sample data; the target distance loss is less than or equal to the distance loss threshold. For example, if the distance loss threshold is 0, the target distance loss may also be 0 or the distance difference between the distance sum and the target negative sample feature distance.

[0070] It can be understood that when the sum of the distances between the positive sample feature distance and the sample screening interval is greater than the target negative sample feature distance, it means that the target negative sample data is closer to the anchor sample data than the positive sample data, and the target negative sample data is a negative sample that is difficult for the initial model to distinguish. Therefore, the distance difference between the sum and the target negative sample feature distance can be used as the feature distance loss of the target negative sample data, and the distance difference is greater than the distance loss threshold. Therefore, such negative samples can be determined as complex negative sample data through feature distance loss.

[0071] Similarly, when the sum of the distances between the positive sample feature distance and the sample screening interval is less than or equal to the target negative sample feature distance, it means that the target negative sample data is farther away from the anchor sample data than the positive sample data. Then the target negative sample data is a negative sample that is easily distinguished by the initial model, so the target distance loss can be used as the feature distance loss of the target negative sample data. Therefore, such negative samples can be determined as simple negative sample data through the feature distance loss.

[0072] It can be understood that the size of the sample screening interval can adjust the division of complex negative sample data and simple negative sample data. The larger the sample screening interval, the larger the screening interval for complex negative sample data, and the more complex negative sample data in the screening interval, that is, more negative sample data may be retained as complex negative sample data. The smaller the sample screening interval, the smaller the screening interval for complex negative sample data, and the less complex negative sample data in the screening interval, that is, fewer negative sample data that are closer to the anchor sample data may be retained as complex negative sample data.

[0073] Specifically, the sample feature of the anchor sample data is x i , the sample feature of the positive sample data is y i , the sample feature of the target negative sample data is y j For example, the feature distance loss D of the target negative sample data for the anchor sample data is ij The method of determining is:

[0074] D ij =[1- <x i ,y i >-(1- <x i ,y j >)+β] + =[ <x i ,y j >- <x i ,y i >+β] + j≠i

[0075] Among them, β is the sample screening interval; <x i ,yj > is the sample feature x i and sample features y j The cosine value between 1 and <x i ,y j > is the sample feature x i and sample features y j The characteristic distance between;[.] + =max(0,.) is the hinge function.

[0076] It can be understood that when the value of (positive sample feature distance + sample screening interval – target negative sample feature distance) is less than 0, the feature distance loss can be directly set to 0 through the hinge function, which means that the target negative sample data in this case will not participate in the training loss calculation and gradient return.

[0077] It can be understood that this means that the simple negative sample data in all negative sample data of the anchor sample data is filtered to obtain complex negative sample data, and the complex negative sample data refers to the sample data sampled from the negative sample data whose feature distance with the anchor sample data is within a certain sampling distance range. (It can be understood that the simple negative sample data refers to the negative sample data whose feature distance with the anchor sample data is too far compared with the complex negative sample data. This type of simple negative sample data is filtered by setting the corresponding feature distance loss to 0). It can be understood that the sample screening interval can be used to control the size of the sampling distance range of the complex negative sample data.

[0078] Among them, determining the weight loss can be to determine the weight loss for the target negative sample data based on the first feature similarity between the sample features of the anchor sample data and the sample features of the positive sample data, and the second feature similarity between the sample features of the anchor sample data and the sample features of each negative sample data in multiple negative sample data.

[0079] Among them, the method of determining the weight loss through the first feature similarity and the second feature similarity can be to obtain the participation adjustment factor associated with the first feature similarity; and determine the weight loss for the target negative sample data based on the participation adjustment factor, the first feature similarity, and the second feature similarity.

[0080] Specifically, the sample feature of the anchor sample data is x i , the sample feature of the positive sample data is y i , the sample feature of the target negative sample data is y j , the sample feature of the negative sample data is y k For example, the weight loss w of the target negative sample data for the anchor sample data is ij The method of determining is:

[0081]

[0082] in, <x i ,y j > is the sample feature x i and sample features y j The cosine value between (i.e., feature similarity); τ and α represent adjustable hyperparameters; τ is the temperature coefficient; α is the participation adjustment factor, which can be used to control the participation of the positive sample feature distance in the weight multiplier.

[0083] It can be understood that during the training process, the feature similarity between the sample features of the anchor sample data and the sample features of the positive sample data will become larger and larger, and the feature similarity between the sample features of the anchor sample data and the sample features of the negative sample data will become smaller and smaller, so exp( <x i ,y i > / τ) will become larger and larger, exp( <x i ,y k > / τ) will become smaller and smaller, making w ij Therefore, during the training process, the weight loss will be attenuated to a large extent, which will affect the model training effect. Therefore, α is used to control the participation of the first feature similarity of the positive sample feature data in the weight loss, so that the weight loss will not be attenuated to a large extent and will not be attenuated too small.

[0084] S104: Use the negative sample data whose feature distance loss is greater than the distance loss threshold in the negative sample data as the complex negative sample data of the anchor sample data.

[0085] It can be understood that the feature distance loss is used to measure the complexity of the negative sample data of the anchor sample data. When the feature distance loss is greater than the distance loss threshold, it means that the negative sample data is the complex negative sample data of the anchor sample data.

[0086] S105. Weighting the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data to obtain the training loss of the anchor sample data for the initial model.

[0087] S106. Determine a model loss value for training the initial model based on the training loss of the anchor point sample data.

[0088] Among them, the feature distance loss of the complex negative sample data is weighted and summed by the weight loss of the complex negative sample data to obtain the training loss of an anchor sample data for the initial model, so as to achieve a generalized weighted effect.

[0089] It can be understood that N sample pairs can obtain N anchor point sample data, and the average training loss (or the sum of the training losses) of the N anchor point sample data can be used as the model loss value for training the initial model.

[0090] The initial model can be trained by the model loss value, and when the model convergence condition is met, the trained initial model is used as the target model.

[0091] In an embodiment of the present application, N sample pairs for inputting the initial model can be obtained, and anchor sample data can be obtained from sample pair i of the N sample pairs, as well as the positive sample data of the anchor sample data and all negative sample data in the N sample pairs. At this time, the sample features of the anchor sample data, the sample features of the positive sample data, and the sample features of the negative sample data can be determined by the initial model, and the feature distance loss and weight loss of the negative sample data for the anchor sample data can be determined based on the aforementioned multiple sample features and the sample screening interval associated with the negative sample data. The feature distance loss can be used to measure the complexity of the negative sample data, and then the negative sample data can be screened according to the feature distance loss. Specifically, the negative sample data with a feature distance loss greater than the distance loss threshold can be used as complex negative sample data of the anchor sample data. The training loss of the anchor sample data for the initial model can be determined based on the weight loss and feature distance loss of the complex negative sample data, thereby obtaining the model loss value for training the initial model. It can be understood that negative samples whose feature distance loss is less than or equal to the distance loss threshold are simple negative samples. Training the initial model with complex negative sample data can prevent the initial model from being disturbed by simple negative samples, and can better learn the feature information in the complex negative sample data. It can improve the sensitivity of the distance measurement between different features, so that the model can learn a more dispersed feature distribution space, and improve the representation ability of the model, thereby improving the model training effect.

[0092] Based on the above description, the present application embodiment proposes a data processing method, which can be executed by the electronic device mentioned above. Figure 4 , Figure 4 A flowchart of a data processing method provided in an embodiment of the present application.

[0093] like Figure 4 As shown, the process of the data processing method of the embodiment of the present application may include the following:

[0094] S201. Obtain N sample pairs for inputting an initial model.

[0095] S202. Obtain a sample pair i from N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data.

[0096] S203, determining the feature distance loss and weight loss of the negative sample data with respect to the anchor sample data based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data.

[0097] S204: Use the negative sample data whose feature distance loss is greater than the distance loss threshold as the complex negative sample data of the anchor sample data. The specific implementation of steps S201-S204 can be found in the relevant description of the following embodiment, which will not be repeated here.

[0098] S205. Weighting the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data to obtain the training loss for the complex negative sample data, so as to determine the training loss of the anchor sample data for the initial model.

[0099] There are multiple complex negative sample data, and the multiple complex negative sample data include the target complex negative sample data. The training loss can be determined by weighting the feature distance loss of the target complex negative sample data by the weight loss of the target complex negative sample data to obtain the training loss for the target complex negative sample data, and each of the multiple complex negative sample data can be used as the target complex negative sample data until the training loss for each of the multiple complex negative sample data is obtained, and at this time, the sum of the training losses for the multiple complex negative sample data can be used as the training loss of the anchor sample data for the initial model.

[0100] That is to say, for an anchor point sample data, the training loss of an anchor point sample data can be obtained by weighted summing the corresponding feature distance loss using the weight loss of all complex negative sample data.

[0101] S206. Determine a model loss value for training the initial model based on the training loss of the anchor point sample data, and train the initial model based on the model loss value and the model gradient to obtain a target model.

[0102] It can be understood that when i ranges from 1 to N, the training loss of N anchor point sample data can be obtained. At this time, the average training loss of the training loss of the N anchor point sample data can be used as the model loss value, and the initial model is trained by the model loss value until the model converges to obtain the target model.

[0103] Among them, when training the initial model, the model loss formula used to determine the model loss value can be differentiated to obtain the model gradient for the initial model, and the initial model can be trained based on the model loss value and the model gradient (such as using the model loss value to correct the model parameters of the initial model along the direction where the model gradient descends fastest).

[0104] Among them, the model loss formula for determining the model loss value includes a target loss formula associated with the weight loss (used to determine the weight loss).

[0105] Therefore, when determining the model gradient, the target loss formula in the model loss formula can be gradient truncated by the gradient truncation operator to obtain the model loss formula after gradient truncation; the model gradient for the initial model is determined by the model loss formula after gradient truncation.

[0106] That is to say, when training the initial model, only the loss formula other than the target loss formula propagates the gradient (that is, it can be understood that the gradient is propagated by the loss formula associated with the feature distance loss), and after the gradient of the target loss formula is truncated, it only plays a weight role in the model gradient. It can be understood that if the gradient of the target loss formula is not truncated, then when training the initial model, all information in the model loss formula can propagate the gradient.

[0107] Among them, the sample feature of the anchor sample data is x i , the sample feature of the positive sample data is y i , the sample feature of the target negative sample data is y j For example, the model loss value L is determined as follows:

[0108]

[0109] Among them, the training loss of the anchor sample data in sample pair i is L i .

[0110] Among them, the model loss formula after gradient truncation can be:

[0111]

[0112] Among them, sg(.) is the gradient truncation operator, which means that the gradient of the target loss formula associated with the weight loss will be truncate.

[0113] It can be understood that since the target loss formula is relatively complex, if the gradient is propagated, the determined model gradient is relatively complex, and since there are exponents, numerators, and denominators in the target loss formula, the model gradient may suddenly jitter when the gradient is propagated, and gradient attenuation or explosion may occur. After the target loss formula is gradient truncated, the model gradient is obtained by the loss formula associated with the feature distance loss, and the loss formula associated with the feature distance loss is mainly weighted, so the model gradient changes are relatively smooth, so the gradient complexity can be reduced, making the model training effect better.

[0114] In an embodiment of the present application, the feature distance loss and weight loss of the negative sample data for the anchor sample data can be determined based on the sample features and the sample screening interval associated with the negative sample data. The feature distance loss can be used to measure the complexity of the negative sample data, and then the negative sample data can be screened according to the feature distance loss, so as to determine the training loss of the anchor sample data for the initial model according to the weight loss and feature distance loss of the complex negative sample data, thereby obtaining the model loss value, and training the initial model to obtain the target model. It can be understood that by training the initial model with complex negative sample data, the initial model will not be disturbed by simple negative samples, and the feature information in the complex negative sample data can be better learned, the noise caused by the negative sample data can be eliminated, and the sensitivity to the distance measurement between different features can be improved, so that the model can learn a more dispersed feature distribution space, and improve the representation ability of the model, thereby improving the model training effect.

[0115] Based on the above description, the present application embodiment proposes a data processing method, which can be executed by the electronic device mentioned above. Figure 5 , Figure 5 A flowchart of a data processing method provided in an embodiment of the present application.

[0116] like Figure 5 As shown, the process of the data processing method of the embodiment of the present application may include the following:

[0117] S301 : Acquire first target data and second target data for inputting a target model.

[0118] The target model is obtained by training the initial model according to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is the negative sample data of the anchor sample data, and the feature distance loss is greater than the distance loss threshold; the anchor sample data and the negative sample data are obtained from the N sample pairs used to train the initial model; N is a positive integer greater than 1. The training process of the target model can refer to the relevant description of the above embodiment, which will not be repeated here.

[0119] S302: Input the first target data into the target model to obtain the target features of the first target data, and input the second target data into the target model to obtain the target features of the second target data.

[0120] The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

[0121] The first target data is data of the same type as the first sample data, and the second target data is data of the same type as the second sample data.

[0122] For example, in a text-image matching scenario, the text data and image data to be matched can be obtained, and the text data can be used as the first target data and the image data can be used as the second target data. Feature similarity can be used to determine the semantic matching degree between the text information indicated by the first target data and the image information indicated by the second target data. For example, the higher the feature similarity, the higher the semantic matching degree; the lower the feature similarity, the lower the semantic matching degree.

[0123] For example, a text-image matching scenario is a scenario in which a user searches for matching image data through text data. At this time, the user can enter the text data to be retrieved, determine the target features of the text data through the target model, and determine the target features of the image data in the image database. At this time, the feature similarity between the target features of the text data and the target features of the image data can be determined, and then the semantic matching degree between the text information indicated by the first target data and the image information indicated by the second target data can be determined, so as to select image data that matches the text data search from the image data in the image database according to the semantic matching degree.

[0124] The target model includes a first feature processing component associated with the first target data and a second feature processing component associated with the second target data. Determining the target feature may be: inputting the first target data into the first feature processing component, and the first feature processing component performs feature processing on the first target data to obtain the target feature of the first target data; inputting the second target data into the second feature processing component, and the second feature processing component performs feature processing on the second target data to obtain the target feature of the second target data.

[0125] For example, the N sample pairs include sample pairs 1-4, the first sample data in sample pair 1 is used as anchor sample data 1, the second sample data in sample pair 1 is used as positive sample data 1 of anchor sample data 1, and the second sample data in sample pairs 2-4 is used as negative sample data 11-13 of anchor sample data 1, and the feature distance loss and weight loss of negative sample data 11-13 are determined according to the sample features of anchor sample data 1, the sample features of positive sample data 1, the sample features of negative sample data 11-13, and the sample screening interval, and the complex negative sample data (such as negative sample data 11-12) of anchor sample data 1 is screened out from negative sample data 11-13 according to the feature distance loss of negative sample data 11-13, and the feature distance loss of negative sample data 11-12 is weightedly summed according to the weight loss of negative sample data 11-12 to obtain the training loss of anchor sample data 1 for the initial model.

[0126] Among them, determining the feature distance loss of the negative sample data 11 can be based on the positive sample feature distance between the sample features of the anchor sample data 1 and the sample features of the positive sample data 1, the negative sample feature distance between the sample features of the anchor sample data 1 and the sample features of the negative sample data 11, and the sample screening interval to determine the feature distance loss for the negative sample data 11.

[0127] Among them, determining the weight loss of the negative sample data 11 can be based on the first feature similarity between the sample features of the anchor sample data 1 and the sample features of the positive sample data 1, the second feature similarity between the sample features of the anchor sample data 1 and the sample features of each negative sample data in the negative sample data 11-12, and the participation adjustment factor to determine the weight loss for the negative sample data 11.

[0128] Similarly, the first sample data in sample pair 2 is used as anchor sample data 2, the second sample data in sample pair 2 is used as positive sample data 2 of anchor sample data 2, and the second sample data in sample pairs 1, 3, and 4 is used as negative sample data 21-23 of anchor sample data 2. The feature distance loss and weight loss of negative sample data 21-23 are determined according to the sample characteristics of anchor sample data 2, the sample characteristics of positive sample data 2, the sample characteristics of negative sample data 21-23, and the sample screening interval. The complex negative sample data (such as negative sample data 21-22) of anchor sample data 2 is screened out from negative sample data 21-23 according to the feature distance loss of negative sample data 21-23, and the feature distance loss of negative sample data 21-22 is weightedly summed according to the weight loss of negative sample data 21-22 to obtain the training loss of anchor sample data 2 for the initial model.

[0129] Similarly, the first sample data in sample pair 3 is used as anchor sample data 3, and the training loss of anchor sample data 3 for the initial model is obtained in the above manner. The first sample data in sample pair 4 is used as anchor sample data 4, and the training loss of anchor sample data 4 for the initial model is obtained in the above manner.

[0130] Among them, the average training loss of the anchor point sample data 1-4 for the training loss of the initial model can be used as the model loss value for training the initial model.

[0131] In an embodiment of the present application, the target features of the first target data and the target features of the second target data can be obtained according to the target model to determine the feature similarity between the first target data and the second target data. Wherein, the training method of the target model is to determine the feature distance loss and weight loss of the negative sample data for the anchor sample data based on the sample features and the sample screening interval associated with the negative sample data. The feature distance loss can be used to measure the complexity of the negative sample data, and then the negative sample data can be screened according to the feature distance loss, so as to determine the training loss of the anchor sample data for the initial model according to the weight loss and feature distance loss of the complex negative sample data, thereby using the model loss value for training the initial model. It can be understood that by training the initial model with complex negative sample data, the initial model will not be disturbed by simple negative samples, and the feature information in the complex negative sample data can be better learned, and the sensitivity to the distance measurement between different features can be improved, so that the model can learn a more dispersed feature distribution space, and improve the representation ability of the model, thereby improving the model training effect, and then improving the accuracy of feature similarity.

[0132] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. It should be noted that: Figure 6 The data processing device shown is used to execute the application Figure 3 , Figure 4 and Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown, and the specific technical details are not disclosed. Figure 3 , Figure 4 and Figure 5 The data processing device 900 may include: a sample acquisition module 901, a feature loss determination module 902, a sample screening module 903, and a training loss determination module 904. Among them:

[0133] The sample acquisition module 901 is used to acquire N sample pairs for inputting into the initial model; one sample pair includes a first sample data and a second sample data; N is a positive integer greater than 1; the initial model is used to determine the sample characteristics of the first sample data and the sample characteristics of the second sample data;

[0134] The sample acquisition module 901 is further used to acquire a sample pair i from the N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data; i is a positive integer less than or equal to N;

[0135] A feature loss determination module 902 is used to determine a feature distance loss and a weight loss of the negative sample data with respect to the anchor sample data based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data;

[0136] A sample screening module 903 is used to use negative sample data whose feature distance loss is greater than a distance loss threshold in the negative sample data as complex negative sample data of anchor sample data;

[0137] A training loss determination module 904 is used to weight the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data to obtain the training loss of the anchor sample data for the initial model;

[0138] The training loss determination module 904 is further used to determine the model loss value used to train the initial model based on the training loss of the anchor point sample data.

[0139] There are multiple negative sample data, and the multiple negative sample data include target negative sample data;

[0140] The feature loss determination module 902 is used to determine the feature distance loss and weight loss of the negative sample data with respect to the anchor sample data based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data, specifically for:

[0141] Determine the feature distance loss for the target negative sample data based on the positive sample feature distance between the sample feature of the anchor sample data and the sample feature of the positive sample data, the target negative sample feature distance between the sample feature of the anchor sample data and the sample feature of the target negative sample data, and the sample screening interval;

[0142] The weight loss for the target negative sample data is determined based on the first feature similarity between the sample feature of the anchor sample data and the sample feature of the positive sample data, and the second feature similarity between the sample feature of the anchor sample data and the sample feature of each negative sample data in the multiple negative sample data.

[0143] Among them, the feature loss determination module 902 is used to determine the feature distance loss for the target negative sample data based on the positive sample feature distance between the sample feature of the anchor sample data and the sample feature of the positive sample data, the target negative sample feature distance between the sample feature of the anchor sample data and the sample feature of the target negative sample data, and the sample screening interval, specifically for:

[0144] If the sum of the distances between the positive sample feature distance and the sample screening interval is greater than the target negative sample feature distance, the distance difference between the sum of the distances and the target negative sample feature distance is used as the feature distance loss for the target negative sample data; the distance difference is greater than the distance loss threshold;

[0145] If the sum of the distances between the positive sample feature distance and the sample screening interval is less than or equal to the target negative sample feature distance, the target distance loss is used as the feature distance loss for the target negative sample data; the target distance loss is less than or equal to the distance loss threshold.

[0146] Among them, the feature loss determination module 902 is used to determine the weight loss for the target negative sample data based on the first feature similarity between the sample feature of the anchor sample data and the sample feature of the positive sample data, and the second feature similarity between the sample feature of the anchor sample data and the sample feature of each negative sample data in the multiple negative sample data, specifically for:

[0147] Obtaining an engagement adjustment factor associated with the first feature similarity;

[0148] A weight loss for target negative sample data is determined based on the engagement adjustment factor, the first feature similarity, and the second feature similarity.

[0149] There are multiple complex negative sample data, and the multiple complex negative sample data include target complex negative sample data;

[0150] The training loss determination module 904 is used to weight the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data to obtain the training loss of the anchor sample data for the initial model, specifically for:

[0151] The feature distance loss of the target complex negative sample data is weighted by the weight loss of the target complex negative sample data to obtain the training loss for the target complex negative sample data, until the training loss for each complex negative sample data in the multiple complex negative sample data is obtained;

[0152] The sum of the training losses for multiple complex negative sample data is used as the training loss of the anchor sample data for the initial model.

[0153] The training loss determination module 904, when used to determine the model loss value for training the initial model based on the training loss of the anchor point sample data, is specifically used to:

[0154] When i ranges from 1 to N, the training loss of N anchor point sample data is obtained;

[0155] The average training loss of the training losses of N anchor point sample data is taken as the model loss value;

[0156] The initial model is trained using the model loss value until the model converges to obtain the target model.

[0157] Wherein, the model loss formula for determining the model loss value includes a target loss formula associated with the weight loss;

[0158] When the training loss determination module 904 is used to train the initial model through the model loss value, it is specifically used to:

[0159] The target loss formula in the model loss formula is subjected to gradient truncation processing through the gradient truncation operator to obtain the model loss formula after gradient truncation;

[0160] Determine the model gradient for the initial model through the model loss formula after gradient truncation;

[0161] The initial model is trained based on the model loss value and model gradient.

[0162] The specific implementation of the sample acquisition module, the feature loss determination module, the sample screening module, and the training loss determination module can be found in the description of the above embodiment, and will not be described in detail here. It should be understood that the description of the beneficial effects obtained by using the same method will not be described in detail.

[0163] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. It should be noted that: Figure 7 The data processing device shown is used to execute the application Figure 3 , Figure 4 and Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown, and the specific technical details are not disclosed. Figure 3 , Figure 4 and Figure 5 The data processing device 1000 may include: a data acquisition module 1001 and a model processing module 1002.

[0164] The data acquisition module 1001 is used to acquire first target data and second target data for inputting into a target model; the target model is obtained by training the initial model with respect to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is the negative sample data of the anchor sample data, in which the feature distance loss is greater than the distance loss threshold; the anchor sample data and the negative sample data are obtained from N sample pairs used for training the initial model; N is a positive integer greater than 1;

[0165] The model processing module 1002 is used to input the first target data into the target model to obtain the target features of the first target data, and input the second target data into the target model to obtain the target features of the second target data;

[0166] The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

[0167] Wherein, the target model includes a first feature processing component associated with the first target data and a second feature processing component associated with the second target data;

[0168] The model processing module 1002 is specifically used to input the first target data into the target model to obtain the target features of the first target data, and input the second target data into the target model to obtain the target features of the second target data:

[0169] Inputting the first target data into a first feature processing component, and having the first feature processing component perform feature processing on the first target data to obtain target features of the first target data;

[0170] The second target data is input into the second feature processing component, and the second feature processing component performs feature processing on the second target data to obtain the target feature of the second target data.

[0171] The data acquisition module 1001, when used to acquire the first target data and the second target data for inputting the target model, is specifically used to:

[0172] Obtaining text data and image data to be matched;

[0173] Taking the text data as the first target data and the image data as the second target data;

[0174] The feature similarity between the first target data and the second target data is used to determine the semantic matching degree between the text information indicated by the first target data and the image information indicated by the second target data.

[0175] The specific implementation of the data acquisition module and the model processing module can be found in the description of the above embodiments, and will not be described in detail here. It should be understood that the description of the beneficial effects obtained by adopting the same method will not be described in detail either.

[0176] See also Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 1100 includes: at least one processor 1101 and a memory 1102. Optionally, the electronic device may further include a network interface. Among them, the processor 1101, the memory 1102 and the network interface can exchange data, the network interface is controlled by the processor 1101 for sending and receiving messages, the memory 1102 is used to store computer programs, the computer programs include program instructions, and the processor 1101 is used to execute the program instructions stored in the memory 1102. Among them, the processor 1101 is configured to call the program instructions to execute the above method. The memory 1102 may include a volatile memory (volatile memory), such as a random-access memory (random-access memory, RAM); the memory 1102 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (solid-state drive, SSD), etc.; the memory 1102 may also include a combination of the above-mentioned types of memory.

[0177] The processor 1101 may be a central processing unit (CPU). In one embodiment, the processor 1101 may also be a graphics processing unit (GPU). The processor 1101 may also be a combination of a CPU and a GPU. The processor 1101 may be used to call the device control application stored in the memory 1102 to execute the above Figure 3 , Figure 4 and Figure 5 The description of the data processing method in the corresponding embodiment can also be performed as described above. Figure 6 and Figure 7 The description of the data processing device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here.

[0178] In a specific implementation, the device, processor, memory, etc. described in the embodiments of the present application can execute the implementation described in the above method embodiments, and can also execute the implementation described in the embodiments of the present application, which will not be repeated here.

[0179] A computer (readable) storage medium is also provided in the embodiment of the present application, and the computer storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by the processor, the processor can execute some or all of the steps performed in the above method embodiment. Optionally, the computer storage medium can be volatile or non-volatile. The computer readable storage medium can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to the use of the blockchain node, etc.

[0180] An embodiment of the present application provides a computer program product, which may include a computer program. When the computer program is executed by a processor, it can implement some or all of the steps in the above method, which are not described in detail here.

[0181] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0182] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer storage medium, which can be a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0183] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiments and equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Obtain N sample pairs for inputting an initial model; one sample pair includes a first sample data and a second sample data; N is a positive integer greater than 1; the initial model is used to determine the sample characteristics of the first sample data and the sample characteristics of the second sample data; Obtain a sample pair i from the N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data; i is a positive integer less than or equal to N; Determine a feature distance loss and a weight loss of the negative sample data with respect to the anchor sample data based on sample features of the anchor sample data, sample features of the positive sample data, sample features of the negative sample data, and a sample screening interval associated with the negative sample data; Using negative sample data whose feature distance loss is greater than a distance loss threshold in the negative sample data as complex negative sample data of the anchor sample data; Performing loss weighting on the feature distance loss of the complex negative sample data by using the weight loss of the complex negative sample data to obtain the training loss of the anchor point sample data for the initial model; A model loss value for training the initial model is determined based on the training loss of the anchor point sample data.

2. The method according to claim 1, characterized in that There are multiple negative sample data, and the multiple negative sample data include target negative sample data; The determining, based on the sample features of the anchor sample data, the sample features of the positive sample data, the sample features of the negative sample data, and the sample screening interval associated with the negative sample data, the feature distance loss and the weight loss of the negative sample data with respect to the anchor sample data comprises: Determine a feature distance loss for the target negative sample data based on a positive sample feature distance between a sample feature of the anchor sample data and a sample feature of the positive sample data, a target negative sample feature distance between a sample feature of the anchor sample data and a sample feature of the target negative sample data, and the sample screening interval; The weight loss for the target negative sample data is determined based on a first feature similarity between a sample feature of the anchor sample data and a sample feature of the positive sample data, and a second feature similarity between the sample feature of the anchor sample data and a sample feature of each negative sample data in the plurality of negative sample data.

3. The method according to claim 2, characterized in that The determining of the feature distance loss for the target negative sample data based on the positive sample feature distance between the sample feature of the anchor sample data and the sample feature of the positive sample data, the target negative sample feature distance between the sample feature of the anchor sample data and the sample feature of the target negative sample data, and the sample screening interval includes: If the sum of the distances between the positive sample feature distance and the sample screening interval is greater than the target negative sample feature distance, the distance difference between the sum of the distances and the target negative sample feature distance is used as the feature distance loss for the target negative sample data; the distance difference is greater than the distance loss threshold; If the sum of the distances between the positive sample feature distance and the sample screening interval is less than or equal to the target negative sample feature distance, the target distance loss is used as the feature distance loss for the target negative sample data; the target distance loss is less than or equal to the distance loss threshold.

4. The method according to claim 2, characterized in that: The determining of the weight loss for the target negative sample data based on the first feature similarity between the sample feature of the anchor sample data and the sample feature of the positive sample data and the second feature similarity between the sample feature of the anchor sample data and the sample feature of each negative sample data in the plurality of negative sample data comprises: Obtaining a participation adjustment factor associated with the first feature similarity; A weight loss for the target negative sample data is determined based on the engagement adjustment factor, the first feature similarity, and the second feature similarity.

5. The method according to claim 1, characterized in that There are multiple complex negative sample data, and the multiple complex negative sample data include target complex negative sample data; The step of weighting the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data to obtain the training loss of the anchor sample data for the initial model includes: The feature distance loss of the target complex negative sample data is weighted by the weight loss of the target complex negative sample data to obtain a training loss for the target complex negative sample data, until a training loss for each complex negative sample data in the multiple complex negative sample data is obtained; The sum of the training losses for the multiple complex negative sample data is used as the training loss for the anchor sample data for the initial model.

6. A data processing method, characterized in that: The method comprises: Acquire first target data and second target data for inputting a target model; the target model is obtained by training the initial model with respect to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is negative sample data whose feature distance loss is greater than a distance loss threshold in the negative sample data of the anchor sample data; the anchor sample data and the negative sample data are obtained from N sample pairs used to train the initial model; N is a positive integer greater than 1; Inputting the first target data into the target model to obtain target features of the first target data, and inputting the second target data into the target model to obtain target features of the second target data; The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

7. A data processing device, characterized in that: The device comprises: A sample acquisition module, used to acquire N sample pairs for input into an initial model; a sample pair includes a first sample data and a second sample data; N is a positive integer greater than 1; the initial model is used to determine the sample characteristics of the first sample data and the sample characteristics of the second sample data; The sample acquisition module is further used to acquire a sample pair i from the N sample pairs, use the first sample data in the sample pair i as the anchor sample data, use the second sample data in the same sample pair as the anchor sample data as the positive sample data of the anchor sample data, and use the second sample data that is not in the same sample pair as the anchor sample data as the negative sample data of the anchor sample data; i is a positive integer less than or equal to N; A feature loss determination module, configured to determine a feature distance loss and a weight loss of the negative sample data with respect to the anchor sample data based on sample features of the anchor sample data, sample features of the positive sample data, sample features of the negative sample data, and a sample screening interval associated with the negative sample data; A sample screening module, used to use the negative sample data whose feature distance loss is greater than the distance loss threshold in the negative sample data as the complex negative sample data of the anchor sample data; A training loss determination module, configured to weight the feature distance loss of the complex negative sample data by the weight loss of the complex negative sample data, so as to obtain the training loss of the anchor point sample data for the initial model; The training loss determination module is further used to determine a model loss value for training the initial model based on the training loss of the anchor point sample data.

8. A data processing device, characterized in that: The device comprises: A data acquisition module, used to acquire first target data and second target data for input into a target model; the target model is obtained by training the initial model with respect to the model loss value of the initial model; the model loss value is obtained by weighting the feature distance loss of the complex negative sample by the weight loss of the anchor sample data; the complex negative sample is negative sample data whose feature distance loss is greater than a distance loss threshold in the negative sample data of the anchor sample data; the anchor sample data and the negative sample data are obtained from N sample pairs used for training the initial model; N is a positive integer greater than 1; A model processing module, used for inputting the first target data into the target model to obtain the target features of the first target data, and inputting the second target data into the target model to obtain the target features of the second target data; The target feature of the first target data and the target feature of the second target data are used to determine the feature similarity between the first target data and the second target data.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.