A cross-domain model training method, device and equipment
By obtaining training samples from multiple domains and performing multi-branch classification, the problem of insufficient robustness of risk control models during cross-domain deployment is solved, and a target model adapted to multiple scenarios is generated, which improves the stability and adaptability of the model.
Patent Information
- Application Number
- CN202210288486.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In the field of risk control, the trained risk control model is difficult to adapt to unknown scenarios due to the large differences in characterization during deployment, resulting in insufficient cross-domain robustness.
By obtaining training samples of multiple domains, extracting sample features, generating prediction samples, and performing multi-branch classification based on domain labels, fusion loss values are determined to determine the target loss value to train and generate the target model.
This realizes model training without the need for unknown scenario data, generates target models that are adapted to multiple scenarios, and improves the cross-domain robustness and stability of the model.
Smart Images

Figure CN114821250B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of Internet technology, and in particular to a cross-domain model training method, device and equipment. Background Art
[0002] In the field of risk control, the trained risk control model will encounter a variety of scenarios with very different representations when deployed. This will cause a relatively mature model in one scenario to be incompatible when deployed in an unknown new scenario. That is, the trained model cannot classify cross-domain attacks well and has low cross-domain robustness.
[0003] Based on this, a more stable cross-domain model training solution is needed. Summary of the invention
[0004] The embodiments of this specification provide a cross-domain model training method, apparatus, device and storage medium to solve the following technical problem: a more stable cross-domain model training solution is needed.
[0005] To solve the above technical problems, one or more embodiments of this specification are implemented as follows:
[0006] In a first aspect, an embodiment of the present specification provides a cross-domain model training method, comprising: obtaining training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; extracting sample features of the training samples, and generating predicted samples based on the sample features, wherein the predicted samples have the same domain labels as the training samples; classifying the predicted samples based on the domain labels to generate multiple branches, wherein the multiple branches include a main branch that does not include domain labels, and at least one sub-branch that includes the domain labels; respectively determining loss values of the multiple branches, and fusing the multiple loss values to determine a target loss value; and generating a target model based on the target loss training.
[0007] In a second aspect, an embodiment of the present specification provides a cross-domain model training device, comprising: an acquisition module, which acquires training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; a generation module, which extracts sample features of the training samples, and generates prediction samples based on the sample features, wherein the prediction samples have the same domain labels as the training samples; a classification module, which classifies the prediction samples based on the domain labels to generate multiple branches, wherein the multiple branches include a main branch that does not include domain labels, and at least one sub-branch that includes the domain labels; a loss calculation module, which determines loss values of the multiple branches respectively, and fuses the multiple loss values to determine a target loss value; and a training module, which generates a target model based on the target loss training.
[0008] In a third aspect, an embodiment of the present specification provides an electronic device, including:
[0009] at least one processor; and,
[0010] a memory communicatively connected to the at least one processor; wherein,
[0011] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0012] In a fourth aspect, an embodiment of the present specification provides a non-volatile computer storage medium storing computer executable instructions. When a computer reads the computer executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0013] At least one of the above technical solutions adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; extracting sample features of the training samples, and generating prediction samples based on the sample features, wherein the prediction samples have the same domain labels as the training samples; classifying the prediction samples based on the domain labels to generate multiple branches, wherein the multiple branches include a main branch that does not include domain labels, and at least one sub-branch that includes the domain labels; respectively determining the loss values of the multiple branches, fusing the multiple loss values to determine the target loss value; and generating a target model based on the target loss training. By combining training samples from different domains to perform adversarial classification of multiple branches, model training is achieved without the need for data from unknown scenarios, and a target model that can be adapted to multiple scenarios is generated, which improves the cross-domain robustness in model training and is more stable. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0015] Figure 1 A schematic diagram of a cross-domain model training method provided in an embodiment of this specification;
[0016] Figure 2 A schematic diagram of calculating the target loss value of a model provided in an embodiment of this specification;
[0017] Figure 3 A schematic diagram of a classification framework of a live attack detection model provided in an embodiment of this specification;
[0018] Figure 4 A schematic diagram of the structure of a cross-domain model training device provided in an embodiment of this specification;
[0019] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0020] The embodiments of this specification provide a cross-domain model training method, apparatus, device, and storage medium.
[0021] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0022] In the first aspect, Figure 1 As shown, Figure 1 A flow chart of a cross-domain model training method provided in an embodiment of this specification may include the following steps:
[0023] S101: Acquire training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1.
[0024] In the embodiments of this specification, different domains are sets of different training samples. The samples in the same data set generally come from the same source.
[0025] In different application scenarios, the N domains involved in the training samples may be different. For example, when the model is a facial recognition model, the domain involved may be a first data set from a facial payment scenario in a shopping mall, or a second data set generated when a mobile device pays, or a third data set generated when a user scans his face to clock in at work, etc.
[0026] For another example, when the model is a model for identifying crop diseases, the domain involved may be a collection of satellite images collected by satellites, or it may be pathological images of crop diseases taken in real life, or it may be radiological images obtained based on radiation light (including ultraviolet or infrared rays), etc.
[0027] In one or more embodiments of the present specification, each training sample includes a first label and a second label, wherein the first label is used to characterize positive and negative samples, and the second label is a domain label, which is used to characterize the data set to which the training sample belongs. When there are N domains, it is obvious that there will be N different domain labels in the training sample.
[0028] For example, for a live attack detection model applied to face recognition, the labels contained in its training samples may be in the form of (live sample, training set 1), (live sample, training set 2), (attack sample, training set 2), etc.
[0029] S103, extracting sample features of the training sample, and generating a prediction sample according to the sample features, wherein the prediction sample has the same domain label as the training sample.
[0030] Since the training samples come from different domains, a preset feature extraction module can be used to obtain the sample features of the training samples. In practical applications, different feature extraction methods can be used for training samples from different domains, or the same feature extraction module can be used to extract the sample features of each training sample.
[0031] For example, when the training sample is an image, one or more convolution kernels can be used to scan the image and extract the features of the original image through the convolution kernel. In addition, the dimension of the extracted features can be reduced through pooling layers (including general pooling, overlapping pooling or pyramid pooling, etc.), improving the stability of the model, etc.
[0032] Furthermore, based on the extracted features, one or fully connected layer is adopted, and training samples are generated using logistic regression, so that a classifier can be used to classify the training samples, that is, to determine whether the predicted sample is a positive sample or a negative sample (obviously, the predicted sample is not necessarily correct, and there are always some differences between it and the input training sample), and the difference between the predicted sample and the training sample is used to determine the loss value.
[0033] In addition, it should be noted that in the embodiments of this specification, whether it is the process of extracting features or the process of generating prediction samples, the domain label will not be affected, that is, for a training sample, its domain label is the same as the domain label of the training sample when it is input into the model.
[0034] S105: Classify the predicted samples according to the domain labels to generate multiple branches, wherein the multiple branches include a main branch that does not include the domain label and at least one sub-branch that includes the domain label.
[0035] As mentioned above, it has been determined whether the prediction sample is a positive sample or a negative sample, and the prediction sample also has a domain label. At this time, when the prediction sample is classified in the embodiment of this specification, multiple parallel branches are used for simultaneous classification, including a main branch that does not depend on the domain label, and at least one sub-branch that depends on the domain label to synchronously classify the training sample.
[0036] In other words, in the embodiment of the present specification, a prediction sample is classified once in each branch, and the classifications in each branch are independent of each other.
[0037] The purpose of the main branch is to divide the output prediction samples into two categories. For example, for the live attack risk model in face recognition, the main branch is to divide the output prediction samples into live samples or attack samples, that is, the main branch does not rely on domain labels when classifying; and for the disease detection model, the main branch is to divide the output prediction samples into healthy samples or unhealthy samples.
[0038] The sub-branches can be divided into different domains based on the needs of actual applications. For example, the sub-branches can be to divide the output prediction samples into N negative sample categories corresponding to the N domains based on the domain labels, or the sub-branches can be to divide the output prediction samples into positive and negative sample categories corresponding to the N domains based on the domain labels.
[0039] Alternatively, negative samples or positive samples of a pre-specified domain label may be classified into one category. For example, a sub-branch may be to classify negative samples in the second data set or the third data set into one category.
[0040] It should be noted that, in this process, the negative samples or positive samples refer to the predicted samples that have been classified.
[0041] S107, respectively determine the loss values of the multiple branches, and fuse the multiple loss values to determine the target loss value.
[0042] In the embodiments of this specification, for each branch (including the main branch and the sub-branch), since there are actually multiple independent classification methods, a corresponding loss value will be generated for each classification, so the loss values of the multiple branches can be determined separately, and the multiple loss values can be combined to determine the target loss value. Figure 2 As shown, Figure 2 A schematic diagram of calculating the target loss value of a model provided in an embodiment of this specification.
[0043] S109, generating a target model according to the target loss training.
[0044] The target loss value represents the difference between the predicted samples and the training samples obtained during the training process. Therefore, the parameters in the model (for example, the parameters in the convolution kernel, etc.) can be trained based on the target loss value through forward propagation or back propagation. When a certain convergence condition is reached (for example, the convergence condition can be: the target loss value is less than a predefined threshold, or the prediction accuracy in each branch reaches a certain preset value), the model training is considered successful, and the model at this time is the target model.
[0045] At least one of the above technical solutions adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; extracting sample features of the training samples, and generating prediction samples based on the sample features, wherein the prediction samples have the same domain labels as the training samples; classifying the prediction samples based on the domain labels to generate multiple branches, wherein the multiple branches include a main branch that does not include domain labels, and at least one sub-branch that includes the domain labels; respectively determining the loss values of the multiple branches, fusing the multiple loss values to determine the target loss value; and generating a target model based on the target loss training. By combining training samples from different domains to perform adversarial classification of multiple branches, model training is achieved without the need for data from unknown scenarios, and a target model that can be adapted to multiple scenarios is generated, which improves the cross-domain robustness in model training and is more stable.
[0046] In one embodiment, when calculating the loss values of multiple branches, the same loss function can be used for calculation. For example, the cross entropy loss function (CrossEntropy Loss) is used to calculate the loss value of each branch relative to the training sample. By using the same loss function to calculate the loss value of each branch, the actual relative classification effect of the model on each branch can be intuitively displayed, which is convenient for subsequent adjustments.
[0047] In one embodiment, when calculating the target loss value, the weight distribution of the loss function of the multiple branches can be obtained, and the target loss value can be determined by fusing the multiple loss values according to the weight distribution of the loss function. For example, based on the weight distribution of the loss function, the loss value of each branch is weighted and summed to obtain the target loss value. The weight distribution of the loss function can be predetermined based on actual experience. In this way, the weight distribution of each branch can be adjusted based on actual experience, thereby accelerating the training of the model.
[0048] In one embodiment, the sub-branch may be a first sub-branch including a plurality of categories, wherein the plurality of categories include: N negative sample categories corresponding to the N domains, and a positive sample category. For example, assuming that there are three domains in the training sample, namely domain1, domain2, and domain3, the categories included in the first sub-branch include the following four categories: a negative sample category in domain1, a negative sample category in domain2, a negative sample category in domain3, and a positive sample category.
[0049] In other words, under the classification method of the first sub-branch, when a training sample is determined to be a negative sample, it can be classified into the corresponding negative sample category according to its domain label, and then feedback is given through the loss function. In this way, the model can enhance the discrimination of negative samples in each domain during cross-domain training and improve the adaptability of the model.
[0050] In one embodiment, the sub-branch may be a second sub-branch including a plurality of categories, wherein the plurality of categories include: N positive sample categories corresponding to the N domains. For example, assuming that there are three domains in the training sample, namely domain1, domain2, and domain3, the categories included in the second sub-branch include the following three categories: positive sample categories in domain1, positive sample categories in domain2, and positive sample categories in domain3.
[0051] In other words, under the classification method of the second sub-branch, when a training sample is determined to be a positive sample, it can be classified into the corresponding positive sample category according to its domain label, and then feedback is given through the loss function. When a training sample is determined to be a negative sample, it will be ignored under this classification method and no classification will be performed. In this way, the model can enhance the discrimination of positive samples in each domain during cross-domain training and improve the adaptability of the model.
[0052] After the target model is obtained through training, the method further includes: obtaining data to be identified, and determining whether the data to be identified is a positive sample or a negative sample according to the target model. In this process, the target model no longer requires classification in the sub-branch, and only needs to perform binary classification on the data to be identified through the main branch. The model trained in the above manner can be widely used in various scenarios.
[0053] In order to make the above solution clearer, the present specification also provides an implementation method in a specific application scenario. Figure 3 As shown, Figure 3A schematic diagram of the classification framework of a live attack detection model provided in the embodiments of this specification. The live attack detection model is used to determine whether the face image of the user during face scanning is real or an attack. The attack types mainly include attack technologies such as photos, mobile phones, screens, masks, etc.
[0054] In this scenario, the training samples include normal face samples (also called live samples or positive samples) and abnormal face samples (also called attack samples or negative samples). In this diagram, each training sample also carries a domain label when it is distinguished as a live sample or an attack sample.
[0055] In the revised diagram, D1, D2 and D3 represent three domains, and S1 to S12 represent 12 different training samples. By extracting and classifying features, we get Figure 3 The three branches shown in the figure are as follows: the main branch is a standard live attack detection classification branch that does not depend on domain labels; in the first sub-branch, live data from different domains are regarded as one category (i.e., one positive sample category), while attack data from different domains are different categories (i.e., three negative sample categories corresponding to the three domains); in the second branch, only live class data is constrained, and live data from different domains are classified into different categories (i.e., three positive sample categories corresponding to the three domains).
[0056] Then, by calculating the loss values in each branch and fusing them to obtain the target loss value, end-to-end cross-domain training is achieved. The purpose of the main branch is to divide the training samples into living classes and attack classes, while the purpose of the first sub-branch or the second sub-branch is to divide different domains in the living class. Therefore, in the end-to-end learning process, different branches build adversarial learning relative to the main branch, which helps the model converge to a more robust global optimal point, thereby improving the cross-domain robustness of the model in unknown scenarios.
[0057] Based on the same idea, one or more embodiments of this specification also provide devices and apparatuses corresponding to the above methods, such as Figure 4 , Figure 5 shown.
[0058] In the second aspect, Figure 4 As shown, Figure 4 A schematic diagram of the structure of a cross-domain model training device provided in an embodiment of this specification, the device comprising:
[0059] An acquisition module 401 acquires training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1;
[0060] A generating module 403 extracts sample features of the training sample and generates a prediction sample according to the sample features, wherein the prediction sample has the same domain label as the training sample;
[0061] A classification module 405, classifying the predicted sample according to the domain label to generate multiple branches, wherein the multiple branches include a main branch that does not include the domain label and at least one sub-branch that includes the domain label;
[0062] A loss calculation module 407, which determines the loss values of the multiple branches respectively, and combines the multiple loss values to determine the target loss value;
[0063] The training module 409 generates a target model according to the target loss training.
[0064] Optionally, the loss calculation module 407 adopts the same loss function in the multiple branches to determine the loss values of the multiple branches.
[0065] Optionally, the loss calculation module 407 obtains a weight distribution of loss functions of the multiple branches, and determines a target loss value by fusing the multiple loss values according to the weight distribution of the loss function.
[0066] Optionally, the sub-branch is a first sub-branch comprising multiple categories, and the multiple categories include: N negative sample categories corresponding to the N domains, and one positive sample category.
[0067] Optionally, the sub-branch is a second sub-branch comprising multiple categories, and the multiple categories include: N positive sample categories corresponding to the N domains.
[0068] Optionally, it further includes an identification module 411, which obtains data to be identified and determines whether the data to be identified is a positive sample or a negative sample according to the target model.
[0069] Optionally, the training samples include normal face samples and abnormal face samples, and correspondingly, the data to be identified include facial data to be identified.
[0070] In the third aspect, Figure 5 As shown, Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification, the device includes:
[0071] at least one processor; and,
[0072] a memory communicatively connected to the at least one processor; wherein,
[0073] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0074] In the fourth aspect, based on the same idea, the embodiment of this specification also provides a non-volatile computer storage medium corresponding to the above method, storing computer executable instructions. When the computer reads the computer executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0075] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0076] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0077] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0078] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0079] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0080] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0081] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0082] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0083] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0084] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0085] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0086] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0087] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0088] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0089] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0090] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. A cross-domain model training method, comprising: Acquire training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; Extracting sample features of the training sample, and generating a prediction sample according to the sample features, wherein the prediction sample has the same domain label as the training sample; Classifying the predicted samples according to the domain label to generate multiple branches, wherein the multiple branches include a main branch that does not include the domain label and at least one sub-branch that includes the domain label; Determine the loss values of the multiple branches respectively, and fuse the multiple loss values to determine the target loss value; Generate a target model according to the target loss training; The training samples include normal face samples and abnormal face samples, and correspondingly, the data to be identified include facial data to be identified.
2. The method of claim 1, wherein: Determining the loss values of the multiple branches respectively includes: The same loss function is adopted in the multiple branches to determine the loss values of the multiple branches.
3. The method of claim 1, wherein: Multiple loss values are combined to determine the target loss value, including: Obtain the loss function weight distribution of the multiple branches, and determine the target loss value by fusing the multiple loss values according to the loss function weight distribution.
4. The method of claim 1, wherein: The sub-branch is a first sub-branch including a plurality of categories, wherein the plurality of categories include: N negative sample categories corresponding to the N domains, and a positive sample category.
5. The method of claim 1, wherein: The sub-branch is a second sub-branch including a plurality of categories, and the plurality of categories include: N positive sample categories corresponding to the N domains.
6. The method of claim 1, further comprising: Acquire the data to be identified, and determine whether the data to be identified is a positive sample or a negative sample according to the target model.
7. A cross-domain model training device, comprising: An acquisition module is configured to acquire training samples including N domains, wherein the training samples include domain labels, and N is a natural number greater than 1; A generating module extracts sample features of the training sample and generates a prediction sample according to the sample features, wherein the prediction sample has the same domain label as the training sample; a classification module, classifying the predicted sample according to the domain label to generate a plurality of branches, wherein the plurality of branches include a main branch that does not include the domain label and at least one sub-branch that includes the domain label; A loss calculation module, which determines the loss values of the multiple branches respectively, and fuses the multiple loss values to determine the target loss value; A training module, generating a target model according to the target loss training; The training samples include normal face samples and abnormal face samples, and correspondingly, the data to be identified include facial data to be identified.
8. The device as claimed in claim 7, wherein the loss calculation module adopts the same loss function in the multiple branches to determine the loss values of the multiple branches.
9. In the device as described in claim 7, the loss calculation module obtains the loss function weight distribution of the multiple branches, and determines the target loss value by fusing the multiple loss values according to the loss function weight distribution.
10. In the apparatus of claim 7, the sub-branch is a first sub-branch comprising a plurality of categories, the plurality of categories comprising: There are N negative sample categories corresponding to the N domains, and one positive sample category.
11. In the apparatus of claim 7, the sub-branch is a second sub-branch comprising a plurality of categories, the plurality of categories comprising: N positive sample categories corresponding to the N domains.
12. The device as claimed in claim 7 further includes an identification module, which obtains the data to be identified and determines whether the data to be identified is a positive sample or a negative sample according to the target model.
13. An electronic device, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Unsupervised image classification model training method and device and electronic equipment
CN111832605A
Domain adaptive model training method and device, image detection method and device, equipment and medium
CN111860670A
Cross-domain human body action recognition method based on multi-modal features and adversarial learning
CN112084891A
Pulmonary nodule false positive screening method based on multi-task learning
CN112116603A
Image segmentation data processing method and device, computer equipment and storage medium
CN112419326A
