Model training methods, devices, equipment, and media based on difficult negative sample data

By identifying positive and difficult negative sample data, and using a deep learning model for feature extraction and loss calculation, the problem of low training efficiency of traditional negative samples is solved, thereby improving the training effect of the model and the accuracy of medical image recognition.

CN116704201BActive Publication Date: 2026-05-26PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN TECH (SHENZHEN) CO LTD
Filing Date
2023-06-16
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Traditional deep learning models based on negative samples have poor training efficiency and performance, especially in medical image recognition.

Method used

By acquiring target sample data, identifying positive sample data and their corresponding difficult negative sample data, using an initial deep learning model to extract features, and calculating similarity and loss values, the model is trained to improve model performance.

Benefits of technology

It improves the training effect and expressiveness of deep learning models, especially in medical image recognition, enhancing recognition efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116704201B_ABST
    Figure CN116704201B_ABST
Patent Text Reader

Abstract

This invention provides a model training method, apparatus, device, and storage medium, comprising: acquiring target sample data, determining positive sample data and difficult negative sample data; extracting features from the target sample data, positive sample data, and difficult negative sample data using an initial deep learning model to obtain a first feature vector, a second feature vector, and a third feature vector; determining the similarity between the first and second feature vectors and the similarity between the first and third feature vectors to obtain a third similarity value and a fourth similarity value; determining a first loss value and a second loss value; and training the initial deep learning model using the first and second loss values ​​to obtain a target deep learning model. This application aims to improve the training effect and performance of the model based on positive sample data and difficult negative sample data. Especially for medical image recognition models, it can improve the model's recognition efficiency and accuracy for medical images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent medical technology, and in particular to a model training method based on difficult negative sample data, a model training device based on difficult negative sample data, a computer device, and a computer-readable storage medium. Background Technology

[0002] Medical images can often reveal a variety of disease types. For example, fundus images can show various eye diseases such as hemangioma, retinal hemorrhage, and glaucoma. When using deep learning models (such as neural networks) to recognize medical images, the deep learning model must first be trained using sample images.

[0003] Traditional training often relies on negative samples, which are obtained by randomly sampling data of different categories from the sample images. However, training based on negative samples results in poor training efficiency and model performance. Summary of the Invention

[0004] This application provides a model training method based on difficult negative sample data, a model training device based on difficult negative sample data, a computer device, and a computer-readable storage medium, aiming to improve the training effect and performance of the model based on positive sample data and difficult negative sample data.

[0005] To achieve the above objectives, this application provides a model training method based on difficult negative sample data, the method comprising:

[0006] Obtain target sample data, and determine positive sample data and corresponding difficult negative sample data based on the target sample data;

[0007] The target sample data, the positive sample data, and the difficult negative sample data are extracted using an initial deep learning model to obtain the corresponding first feature vector, second feature vector, and third feature vector.

[0008] The similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector are determined respectively to obtain the corresponding third similarity value and fourth similarity value;

[0009] A first loss value is determined based on the third similarity value and the label corresponding to the positive sample data, and a second loss value is determined based on the fourth similarity value and the label corresponding to the difficult negative sample data.

[0010] The initial deep learning model is trained using the first loss value and the second loss value to obtain the target deep learning model.

[0011] To achieve the above objectives, this application also provides a model training apparatus based on difficult negative sample data, characterized in that it includes:

[0012] The acquisition module is used to acquire target sample data and determine positive sample data and corresponding difficult negative sample data based on the target sample data.

[0013] The feature extraction module is used to extract features from the target sample data, the positive sample data, and the difficult negative sample data respectively through the initial deep learning model, so as to obtain the corresponding first feature vector, second feature vector, and third feature vector.

[0014] The similarity calculation module is used to determine the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, respectively, to obtain the corresponding third similarity value and fourth similarity value;

[0015] The loss value determination module is used to determine a first loss value based on the third similarity value and the label corresponding to the positive sample data, and to determine a second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data;

[0016] The model training module is used to train the initial deep learning model using the first loss value and the second loss value to obtain the target deep learning model.

[0017] In addition, to achieve the above objectives, this application also provides a computer device, the computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and, when executing the computer program, implement any of the model training methods based on difficult negative sample data provided in the embodiments of this application.

[0018] In addition, to achieve the above objectives, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement any of the model training methods based on difficult negative sample data provided in the embodiments of this application.

[0019] The model training method, apparatus, computer device, and computer-readable storage medium based on difficult negative sample data disclosed in this application can determine positive sample data and corresponding difficult negative sample data based on target sample data. It then extracts features from the target sample data, positive sample data, and difficult negative sample data using an initial deep learning model, calculates the corresponding similarity and loss values ​​for positive and difficult negative samples, and trains the initial deep learning model based on the loss values ​​to obtain the target deep learning model. Because the deep learning model is trained based on positive sample data and its corresponding difficult negative sample data, it effectively improves the training effect and performance of the deep learning model. Especially for medical image recognition models, it can improve the model's recognition efficiency and accuracy for medical images. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is a schematic diagram of a model training method based on difficult negative sample data provided in an embodiment of this application;

[0022] Figure 2 This is a flowchart illustrating a model training method based on difficult negative sample data provided in an embodiment of this application;

[0023] Figure 3 This is a schematic diagram illustrating the steps for determining difficult negative samples provided in an embodiment of this application;

[0024] Figure 4 This is a schematic diagram illustrating a step for obtaining an uncertain numerical value according to an embodiment of this application;

[0025] Figure 5 This is a schematic block diagram of a model training device based on difficult negative sample data provided in an embodiment of this application;

[0026] Figure 6 This is a schematic block diagram of a computer device provided in one embodiment of this application. Detailed Implementation

[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily need to be performed in the described order. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation. Furthermore, although functional modules are divided in the device diagram, in some cases, a different module division may be used.

[0029] The term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items, as well as all possible combinations, and includes such combinations.

[0030] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0031] like Figure 1 As shown, the model training method based on difficult negative sample data provided in this application embodiment can be applied to, for example... Figure 1The application environment shown includes a terminal device 110 and a server 120, wherein the terminal device 110 can communicate with the server 120 via a network. Specifically, the server 120 acquires target sample data and determines positive sample data and corresponding difficult negative sample data based on the target sample data; then, it extracts features from the target sample data, the positive sample data, and the difficult negative sample data using an initial deep learning model to obtain corresponding first feature vectors, second feature vectors, and third feature vectors; it determines the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, to obtain corresponding third similarity values ​​and fourth similarity values; it determines a first loss value based on the third similarity value and the label corresponding to the positive sample data, and a second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data; finally, it trains the initial deep learning model using the first loss value and the second loss value to obtain a target deep learning model for the terminal device 110. Server 120 can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal device 110 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Terminal device 110 and server 120 can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions.

[0032] Please see Figure 2 , Figure 2 This is a schematic diagram illustrating the steps of a model training method based on difficult negative sample data provided in an embodiment of this application. This model training method based on difficult negative sample data can be applied to a computer device, thereby enabling the training of a deep learning model based on positive sample data and the corresponding difficult negative sample data, effectively improving the training effect and model performance of the deep learning model. Figure 2 As shown, the model training method based on difficult negative sample data includes steps S11 to S15.

[0033] Step S11: Obtain target sample data, and determine positive sample data and corresponding difficult negative sample data based on the target sample data.

[0034] The target sample data is the training data of the deep learning model, such as several medical images used to train the model, which is not limited in this application.

[0035] Furthermore, the medical images to be identified based on the target sample images are positive sample data; sample data that are similar to the positive sample data but different in category are difficult negative sample data.

[0036] It should be noted that this application does not limit the determination of difficult negative sample data. For example, the determination of difficult negative sample data can be achieved through the following embodiments.

[0037] Please see Figure 3 , Figure 3 This is a schematic diagram illustrating the steps for determining difficult negative samples provided in an embodiment of this application. For example... Figure 3 As shown, difficult negative samples can be determined through steps S111 to S114.

[0038] Step S111: Determine positive sample data and several negative sample data based on the target sample data.

[0039] Negative sample data refers to all sample data other than positive sample data. This includes, understandably, difficult negative sample data.

[0040] Based on the above embodiments, the negative sample data and the difficult negative sample data can be medical images, which will be used as an example in this application.

[0041] Optionally, after determining the positive sample data and several negative sample data based on the target sample data, the method further includes: performing data augmentation processing on the positive sample data and each negative sample data to obtain first augmented data and several second augmented data, respectively.

[0042] It's important to note that data augmentation, also known as data amplification, essentially involves making limited data generate value equivalent to more data without substantially increasing the amount of data. For example, medical images can be horizontally flipped, cropped, or rotated. This reduces irrelevant features in the dataset, preventing deep learning models from learning irrelevant features and ultimately improving the overall performance of the model.

[0043] For ease of understanding, this application uses positive sample data B and negative sample data A, C, and D as an example for illustration. After performing data augmentation processing on the positive sample data and each negative sample data, the augmented first augmented data b and the second augmented data a, c, and d can be obtained respectively.

[0044] Step S112: Determine the similarity between the positive sample data and each negative sample data, and obtain the first similarity value corresponding to each negative sample data.

[0045] Specifically, after performing data augmentation processing on the medical image to be identified and other medical images, the similarity between the medical image to be identified and each other medical image can be determined, thereby obtaining the first similarity value between each other medical image and the medical image to be identified.

[0046] Optionally, determining the similarity between positive sample data and each negative sample data to obtain a first similarity value corresponding to each negative sample data includes: determining a first feature vector corresponding to the positive sample data and a second feature vector corresponding to each second enhanced data; determining a first vector modulus based on the first feature vector and a second vector modulus based on the second feature vector; determining the inner product of the transposed first feature vector and the second feature vector, and dividing by the product of the first vector modulus and the second vector modulus to obtain the first similarity value.

[0047] Specifically, this can be expressed by the following formula:

[0048]

[0049] in, The first similarity value; This is the second feature vector corresponding to the second augmented data, that is, the second feature vectors corresponding to a, c, and d respectively; This is the first feature vector corresponding to the positive sample data B; The first vector magnitude; It is the second vector magnitude.

[0050] Understandably, the above formula can be used to calculate the similarity between the positive sample data B and the second enhanced data a, c, d, thereby obtaining the first similarity value between each other medical image and the medical image to be identified.

[0051] It should be noted that this application does not limit the acquisition of the first feature vector and the second feature vector. For example, each other medical image can be convolved and pooled with the medical image to be identified to obtain the first feature vector and the second feature vector.

[0052] Step S113: Based on each first similarity value, determine the uncertainty and diversity of positive sample data and each negative sample data, and obtain the uncertainty value and diversity value corresponding to each negative sample.

[0053] Specifically, after obtaining the first similarity value based on the above embodiments, the uncertainty and diversity of each other medical image and the medical image to be identified can be determined based on the first similarity value, so as to obtain the uncertainty value and diversity value corresponding to each negative sample.

[0054] Please continue reading. Figure 4 , Figure 4 This is a schematic diagram illustrating a step for obtaining an uncertain numerical value, as provided in an embodiment of this application. Figure 4 As shown, the uncertainty value corresponding to each negative sample can be obtained through steps S1131 to S1133.

[0055] Step S1131: Determine the pseudo-label corresponding to each second augmented data and the first gradient vector of the loss value of the positive sample data.

[0056] The pseudo-labeling technique involves using a model trained on labeled data to predict on unlabeled data, filtering samples based on the prediction results, and then re-inputting the samples into the model for training. Therefore, embodiments of this application can use a model trained on randomly selected labeled data to predict, filter, and train several second-enhanced data sets to obtain corresponding pseudo-labels.

[0057] Furthermore, the model can be used to predict the values ​​of the positive sample data model for the medical image to be identified, and the loss value of the medical image to be identified can be obtained based on the difference between the positive sample data model prediction value and the true value. Then, based on the relationship between the loss function and the gradient, the first gradient vector can be obtained.

[0058] Step S1132: Based on the pseudo-label, determine the second gradient vector of the loss value of the corresponding second enhancement function.

[0059] Specifically, it can be expressed by the following formula:

[0060]

[0061] Among them, gx j θ represents the second gradient vector; θ represents the parameters of the initial deep learning model. The pseudo-label; LCE is the loss value; f(x) j ;θ) is the normalized value of the function corresponding to the second enhancement function.

[0062] Furthermore, f(x) j ;θ) can be obtained through the following formula:

[0063]

[0064] as well as

[0065] Where N represents other samples that do not correspond to the second enhancement function; for The corresponding probability value, that is, the normalized value of the function; This is the first similarity value.

[0066] Step S1133: Based on the first gradient vector and the second gradient vector, obtain the uncertainty value corresponding to each negative sample.

[0067] Specifically, the uncertainty value corresponding to each negative sample can be obtained using the following formula:

[0068]

[0069] in, These are values ​​with uncertainties. This is the first gradient vector after the transpose; gx j This is the second gradient vector.

[0070] Therefore, the uncertainty value corresponding to each negative sample can be obtained through the above steps and the corresponding formula.

[0071] Optionally, based on each first similarity value, the diversity of positive sample data and each negative sample data is determined to obtain the diversity value corresponding to each negative sample, including: determining the similarity of each negative sample data to other negative sample data to obtain multiple second similarity values ​​corresponding to each negative sample data; and obtaining the diversity value corresponding to each negative sample based on the multiple second similarity values ​​and the number of samples of the target sample data.

[0072] Specifically, this can be expressed by the following formula:

[0073]

[0074] in, The value represents the diversity; N is the number of samples in the target sample data. This is the second similarity value.

[0075] It should be noted that, in order to avoid repetition, this application will not elaborate on the determination of the second similarity value; please refer to the above embodiments for details.

[0076] Step S114: Based on the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data, determine the difficult negative sample data from several negative sample data.

[0077] After obtaining the first similarity value, uncertainty value, and diversity value corresponding to each other medical image and the medical image to be identified based on the above embodiments, difficult negative sample data can be determined from several other medical images based on preset rules.

[0078] It should be noted that this application does not limit the preset rules. For example, the first similarity value, uncertainty value, and diversity value can be assigned corresponding weights to calculate the total score for each other medical image. Alternatively, the first similarity value, uncertainty value, and diversity value can be directly summed to calculate the total score for each negative sample. Understandably, the negative sample with the highest total score is most likely to be a difficult negative sample.

[0079] Optionally, the above-mentioned determination of difficult negative sample data from several negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each other medical image and the medical image to be identified includes: summing the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data to obtain the score of each negative sample data; comparing the scores of each negative sample data, and determining the negative sample data corresponding to the maximum score as the difficult negative sample data.

[0080] In this embodiment, a medical image to be identified and other medical images besides the one to be identified can be determined based on several medical images used for training the model. Difficult negative samples, i.e., medical images similar to the one to be identified but of a different category, are then determined from these other medical images based on calculation rules for similarity, uncertainty, and diversity. Compared to the technical problem of difficult sampling of difficult negative samples in existing technologies, this embodiment can determine difficult negative samples from negative samples more simply and accurately, thereby improving the training effect of the model based on the superior performance of difficult negative samples.

[0081] Step S12: Use the initial deep learning model to extract features from the target sample data, positive sample data, and difficult negative sample data respectively, and obtain the corresponding first feature vector, second feature vector, and third feature vector.

[0082] Specifically, after determining the difficult negative samples based on the above embodiments, features can be extracted from several medical images used to train the model, the medical images to be identified, and medical images similar to the medical images to be identified but of different categories through the initial deep learning model, to obtain the corresponding first feature vector, second feature vector, and third feature vector.

[0083] Understandably, the first feature vector is a feature vector corresponding to several medical images used to train the model, the second feature vector is a feature vector corresponding to the medical image to be identified, and the third feature vector is a feature vector corresponding to medical images that are similar to the medical image to be identified but of a different category.

[0084] Step S13: Determine the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, respectively, to obtain the corresponding third similarity value and fourth similarity value.

[0085] After obtaining the first, second, and third feature vectors, the similarity between the first and second feature vectors, and the similarity between the first and third feature vectors, can be determined to obtain the corresponding third and fourth similarity values. The third similarity value is the similarity value corresponding to positive sample data; the fourth similarity value is the similarity value corresponding to negative sample labels.

[0086] It should be noted that, in order to avoid repetition, this application will not elaborate on the determination of the third and fourth similarity values; please refer to the above embodiments for details.

[0087] Step S14: Determine the first loss value based on the third similarity value and the label corresponding to the positive sample data, and determine the second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data.

[0088] Step S15: Train the initial deep learning model using the first loss value and the second loss value to obtain the target deep learning model.

[0089] The first loss value can be determined based on the third similarity value and the label corresponding to the positive sample data, and the second loss value can be determined based on the fourth similarity value and the label corresponding to the difficult negative sample data. Specifically, the first loss value is the loss value corresponding to the positive sample data; the second loss value is the loss value corresponding to the difficult negative sample data.

[0090] Furthermore, the label corresponding to positive sample data can be 1, and the label corresponding to difficult negative sample data can be 0; this application does not impose any restrictions on this.

[0091] After obtaining the first loss value and the second loss value, the initial deep learning model can be trained using the first loss value and the second loss value to obtain the target deep learning model.

[0092] Specifically, training can be performed by introducing a first loss value and a second loss value into each intermediate layer of the initial deep learning model. This allows each intermediate layer to have progressively complex feature representation capabilities after training, and the feature representation capabilities between each layer are consistent. This accelerates training convergence while improving the feature transfer capabilities of each intermediate layer, thereby achieving an overall improvement in model performance and ultimately obtaining the target deep learning model.

[0093] In this embodiment, the target deep learning is derived based on the loss function corresponding to positive sample data and the loss function corresponding to difficult negative samples. Therefore, compared with the prior art of training deep learning models based on positive and negative samples, the deep learning model of this application has better training effect and model performance. Especially for medical image recognition models, it can improve the model's recognition efficiency and accuracy of medical images.

[0094] The model training method, apparatus, computer device, and computer-readable storage medium based on difficult negative sample data disclosed in this application can determine positive sample data and corresponding difficult negative sample data based on target sample data. It then extracts features from the target sample data, positive sample data, and difficult negative sample data using an initial deep learning model, calculates the corresponding similarity and loss values ​​for positive and difficult negative samples, and trains the initial deep learning model based on the loss values ​​to obtain the target deep learning model. Because the deep learning model is trained based on positive sample data and its corresponding difficult negative sample data, it effectively improves the training effect and performance of the deep learning model. Especially for medical image recognition models, it can improve the model's recognition efficiency and accuracy for medical images.

[0095] Please see Figure 5 , Figure 5 This is a schematic block diagram of a model training device based on difficult negative sample data according to an embodiment of this application. The model training device based on difficult negative sample data can be configured in a server to execute the aforementioned model training method based on difficult negative sample data.

[0096] like Figure 5 As shown, the model training device 200 based on difficult negative sample data includes: an acquisition module 201, a feature extraction module 202, a similarity calculation module 203, a loss value determination module 204, and a model training module 205.

[0097] The acquisition module 201 is used to acquire target sample data and determine positive sample data and corresponding difficult negative sample data based on the target sample data.

[0098] Feature extraction module 202 is used to extract features from the target sample data, the positive sample data and the difficult negative sample data respectively through an initial deep learning model to obtain the corresponding first feature vector, second feature vector and third feature vector;

[0099] The similarity calculation module 203 is used to determine the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, respectively, to obtain the corresponding third similarity value and fourth similarity value.

[0100] The loss value determination module 204 is used to determine a first loss value based on the third similarity value and the label corresponding to the positive sample data, and to determine a second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data.

[0101] The model training module 205 is used to train the initial deep learning model using the first loss value and the second loss value to obtain the target deep learning model.

[0102] The acquisition module 201 is further configured to: determine the positive sample data and a plurality of negative sample data based on the target sample data; determine the similarity between the positive sample data and each of the negative sample data to obtain a first similarity value corresponding to each of the negative sample data; determine the uncertainty and diversity of the positive sample data and each of the negative sample data based on each of the first similarity values ​​to obtain an uncertainty value and a diversity value corresponding to each of the negative sample data; and determine difficult negative sample data from the plurality of negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each of the negative sample data.

[0103] The acquisition module 201 is further configured to perform data augmentation processing on the positive sample data and each of the negative sample data to obtain first augmented data and several second augmented data respectively.

[0104] The acquisition module 201 is further configured to determine the first feature vector corresponding to the positive sample data and the second feature vector corresponding to each of the second enhanced data; determine the corresponding first vector modulus based on the first feature vector and the corresponding second vector modulus based on the second feature vector; determine the inner product of the first feature vector after transposition and the second feature vector, and divide it by the product of the first vector modulus and the second vector modulus to obtain the first similarity value.

[0105] The acquisition module 201 is further configured to determine the pseudo-label corresponding to each of the second augmented data and the first gradient vector of the loss value of the positive sample data; based on the pseudo-label, determine the second gradient vector of the loss value of the corresponding second augmentation function; and based on the first gradient vector and the second gradient vector, obtain the uncertainty value corresponding to each of the negative samples.

[0106] The acquisition module 201 is further configured to determine the similarity between each negative sample data and other negative sample data, and obtain multiple second similarity values ​​corresponding to each negative sample data; based on the multiple second similarity values ​​and the number of samples of the target sample data, obtain the diversity value corresponding to each negative sample.

[0107] The acquisition module 201 is further configured to sum the first similarity value, uncertainty value and diversity value corresponding to each negative sample data to obtain the score of each negative sample data; compare the scores of each negative sample data, and determine the negative sample data corresponding to the maximum score as the difficult negative sample data.

[0108] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and its modules and units can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0109] The methods and apparatus of this application can be used in a wide variety of general-purpose or special-purpose computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer terminal devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0110] For example, the above-described method and apparatus can be implemented as a computer program, which can be used in, for example... Figure 6 It runs on the computer device shown.

[0111] Please see Figure 6 , Figure 6 This is a schematic diagram of a computer device provided in an embodiment of this application. The computer device may be a server.

[0112] like Figure 6 As shown, the computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include volatile storage media, non-volatile storage media, and internal memory.

[0113] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any model training method based on difficult negative sample data.

[0114] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0115] Internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor, it enables the processor to perform any model training method based on difficult negative sample data.

[0116] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that the structure of this computer device is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0117] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0118] In some embodiments, the processor is used to run a computer program stored in a memory to perform the following steps: acquiring target sample data; determining positive sample data and corresponding difficult negative sample data based on the target sample data; extracting features from the target sample data, the positive sample data, and the difficult negative sample data using an initial deep learning model to obtain corresponding first feature vectors, second feature vectors, and third feature vectors; determining the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, to obtain corresponding third similarity values ​​and fourth similarity values; determining a first loss value based on the third similarity value and the label corresponding to the positive sample data, and determining a second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data; and training the initial deep learning model using the first loss value and the second loss value to obtain a target deep learning model.

[0119] In some embodiments, the processor is further configured to: determine the positive sample data and a plurality of negative sample data based on the target sample data; determine the similarity between the positive sample data and each of the negative sample data to obtain a first similarity value corresponding to each of the negative sample data; determine the uncertainty and diversity of the positive sample data and each of the negative sample data based on each of the first similarity values ​​to obtain an uncertainty value and a diversity value corresponding to each of the negative sample data; and determine difficult negative sample data from the plurality of negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each of the negative sample data.

[0120] In some embodiments, the processor is further configured to perform data augmentation processing on the positive sample data and each of the negative sample data to obtain first augmented data and several second augmented data, respectively.

[0121] In some implementations, the processor is further configured to determine a first feature vector corresponding to the positive sample data and a second feature vector corresponding to each of the second augmented data; determine a corresponding first vector modulus based on the first feature vector and a corresponding second vector modulus based on the second feature vector; determine the inner product of the transposed first feature vector and the second feature vector, and divide it by the product of the first vector modulus and the second vector modulus to obtain the first similarity value.

[0122] In some implementations, the processor is further configured to determine a pseudo-label corresponding to each of the second augmented data and a first gradient vector of the loss value of the positive sample data; based on the pseudo-label, determine a second gradient vector of the loss value of the corresponding second augmentation function; and based on the first gradient vector and the second gradient vector, obtain an uncertainty value corresponding to each of the negative samples.

[0123] In some implementations, the processor is further configured to determine the similarity between each negative sample data and other negative sample data, thereby obtaining a plurality of second similarity values ​​corresponding to each negative sample data; and based on the plurality of second similarity values ​​and the number of samples of the target sample data, to obtain a diversity value corresponding to each negative sample.

[0124] In some implementations, the processor sums the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data to obtain a score for each negative sample data; compares the scores of each negative sample data, and determines the negative sample data corresponding to the maximum score as the difficult negative sample data.

[0125] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed, implement any of the model training methods based on difficult negative sample data provided in this application.

[0126] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.

[0127] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A model training method based on difficult negative sample data, characterized in that, The method includes: Acquire target sample data, and determine positive sample data and corresponding difficult negative sample data based on the target sample data; wherein, the data is medical image data; The target sample data, the positive sample data, and the difficult negative sample data are extracted using an initial deep learning model to obtain the corresponding first feature vector, second feature vector, and third feature vector. The similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector are determined respectively to obtain the corresponding third similarity value and fourth similarity value; A first loss value is determined based on the third similarity value and the label corresponding to the positive sample data, and a second loss value is determined based on the fourth similarity value and the label corresponding to the difficult negative sample data. The initial deep learning model is trained using the first loss value and the second loss value to obtain the target deep learning model; The step of determining positive sample data and corresponding difficult negative sample data based on the target sample data includes: Based on the target sample data, determine the positive sample data and several negative sample data; Determine the similarity between the positive sample data and each of the negative sample data to obtain a first similarity value corresponding to each of the negative sample data; Based on each of the first similarity values, the uncertainty and diversity of the positive sample data and each of the negative sample data are determined, and the uncertainty value and diversity value corresponding to each of the negative samples are obtained. Difficult negative sample data are determined from a plurality of negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data.

2. The method according to claim 1, characterized in that, After determining the positive sample data and several negative sample data based on the target sample data, the process further includes: Data augmentation processing is performed on the positive sample data and each of the negative sample data to obtain first augmented data and several second augmented data, respectively.

3. The method according to claim 2, characterized in that, Determining the similarity between the positive sample data and each of the negative sample data, and obtaining a first similarity value corresponding to each of the negative sample data, includes: Determine the first feature vector corresponding to the positive sample data and the second feature vector corresponding to each of the second augmented data; The first vector modulus is determined based on the first feature vector, and the second vector modulus is determined based on the second feature vector; The inner product of the first feature vector after transpose and the second feature vector is determined and divided by the product of the first vector's magnitude and the second vector's magnitude to obtain the first similarity value.

4. The method according to claim 2, wherein determining the uncertainty between the positive sample data and each negative sample data based on each first similarity value, and obtaining the uncertainty value corresponding to each negative sample, includes: Determine the pseudo-label corresponding to each of the second augmented data, and the first gradient vector of the loss value of the positive sample data; Based on the pseudo-label, determine the second gradient vector of the loss value of the corresponding second enhancement function; Based on the first gradient vector and the second gradient vector, the uncertainty value corresponding to each negative sample is obtained.

5. The method according to claim 2, characterized in that, The step of determining the diversity of the positive sample data and each of the negative sample data based on each of the first similarity values, and obtaining the diversity value corresponding to each negative sample, includes: Determine the similarity between each negative sample data and other negative sample data to obtain multiple second similarity values ​​corresponding to each negative sample data; Based on multiple second similarity values ​​and the number of samples in the target sample data, the diversity value corresponding to each negative sample is obtained.

6. The method according to claim 1, characterized in that, The step of determining difficult negative sample data from a plurality of negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data includes: The first similarity value, uncertainty value and diversity value corresponding to each negative sample data are summed to obtain the score of each negative sample data. The scores of each negative sample data are compared, and the negative sample data corresponding to the maximum score is determined as the difficult negative sample data.

7. A model training device based on difficult negative sample data, characterized in that, The device includes: An acquisition module is used to acquire target sample data, and determine positive sample data and corresponding difficult negative sample data based on the target sample data; wherein, the data is medical image data; The feature extraction module is used to extract features from the target sample data, the positive sample data, and the difficult negative sample data respectively through the initial deep learning model, so as to obtain the corresponding first feature vector, second feature vector, and third feature vector. The similarity calculation module is used to determine the similarity between the first feature vector and the second feature vector, and the similarity between the first feature vector and the third feature vector, respectively, to obtain the corresponding third similarity value and fourth similarity value. The loss value determination module is used to determine a first loss value based on the third similarity value and the label corresponding to the positive sample data, and to determine a second loss value based on the fourth similarity value and the label corresponding to the difficult negative sample data; The model training module is used to train the initial deep learning model using the first loss value and the second loss value to obtain the target deep learning model; The acquisition module is further configured to: determine the positive sample data and several negative sample data based on the target sample data; determine the similarity between the positive sample data and each negative sample data to obtain a first similarity value corresponding to each negative sample data; determine the uncertainty and diversity between the positive sample data and each negative sample data based on each first similarity value to obtain an uncertainty value and a diversity value corresponding to each negative sample; and determine difficult negative sample data from the several negative sample data based on the first similarity value, uncertainty value, and diversity value corresponding to each negative sample data.

8. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement the model training method based on difficult negative sample data as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the model training method based on difficult negative sample data as described in any one of claims 1-6.