Close-range non-homologous difficult sample pair learning method, system and device and storage medium
By updating the weights and retraining during model training, we focus on learning difficult sample pairs of human body features, solving the problems of low learning efficiency and slow convergence speed in the existing technology, and achieving more efficient human body feature recognition capabilities and recognition degrees. .
Patent Information
- Application Number
- CN202410660733.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-27
- Filing Date
- 2024-05-27
- Publication Date
- 2024-08-23
AI Technical Summary
Human body feature recognition models in the existing technology have low learning efficiency for difficult sample pairs, and the model convergence speed is slow. Especially for training sets with rich types of training sample pairs, it is difficult to accurately identify them.
During the model training process, the weights are updated based on the errors of the training sample pairs and training images, and the model is retrained based on the weights to achieve focused learning of difficult sample pairs, using a close-range non-homologous difficult sample pair learning method, including acquisition training Sample pairs, calculate errors and weights, are divided into simple and difficult sample pairs for augmentation and training until the model converges.
It improves the model's learning ability for difficult sample pairs, improves human feature recognition capabilities, accelerates model convergence, and has better balance, learning effect, and recognition.
Smart Images

Figure CN118537677A
Abstract
Description
Background Art
[0002] Human feature model training refers to the use of machine learning or deep learning methods to train a large amount of human image data to recognize and understand the characteristics of the human body. This model can be used in many applications, such as human pose estimation, facial recognition, gesture recognition, etc.
[0003] A certain invention provides a method for assigning weights to sample pairs, the method comprising: obtaining training sample pairs, the training sample pairs comprising a positive sample pair set and a negative sample pair set; calculating the distance of each positive sample pair in the positive sample pair set, and the distance of each negative sample pair in the negative sample pair set; determining the distance distribution of the positive sample pair set according to the distance of each positive sample pair in the positive sample pair set; determining the distance distribution of the negative sample pair set according to the distance of each negative sample pair in the negative sample pair set; determining the weight distribution of the training sample pairs based on the distance distribution of the positive sample pair set and the distance distribution of the negative sample pair set. The present invention also provides a model training method, an electronic device and a storage medium. The present invention can increase the weight of misclassified sample pairs, and during the model training process, increase the contribution of the misclassified samples to the target loss, so as to better correct the model parameters and improve the expressiveness of the model parameters.
[0004] In the prior art, human features such as face, body shape, and palm are recognized in an iterative manner, but the learning efficiency is low for difficult sample pairs and the model converges slowly.
[0005] The disclosure of the above background technology content is only used to assist in understanding the inventive concept and technical solution of the present invention. It does not necessarily belong to the prior art of this patent application. In the absence of clear evidence that the above content has been disclosed on the filing date of this patent application, the above background technology should not be used to evaluate the novelty and creativity of the present application. Summary of the invention
[0006] To this end, during the model training process, the present invention obtains the error of each training sample pair and training image, updates the weights of the training sample pair and the training image according to the error value, and then retrains the model in combination with the weights. This can enable the model to focus on learning difficult sample pairs of human features and accelerate the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide application range, and high recognition.
[0007] In a first aspect, the present invention provides a method for learning close-range non-homologous difficult sample pairs, characterized by comprising:
[0008] Step S1: obtaining a training sample pair, wherein the training sample pair includes at least two training images of different types, the training images include human features, and the training sample pair includes a positive sample pair and a negative sample pair;
[0009] Step S2: Identify the training sample pairs to obtain an initial model;
[0010] Step S3: calculating the error of each training image and the comprehensive error of each training sample pair, and calculating the first weight of each training sample pair according to the comprehensive error, and calculating the second weight of each training image according to the error;
[0011] Step S4: training the training sample pairs according to the first weight and the second weight to obtain a second model;
[0012] Step S5: Repeat steps S3-S4 until the second model converges.
[0013] Optionally, the method for learning close-range non-homologous difficult sample pairs is characterized in that, in step S3, the training sample pairs are divided into simple sample pairs and difficult sample pairs according to the relationship between the comprehensive error and the first threshold, and the simple sample pairs are augmented to improve the diversity of learning.
[0014] Optionally, the method for learning close non-homologous difficult sample pairs is characterized in that, in step S4, the positive sample pairs are divided into a first simple sample pair and a first difficult sample pair according to a second threshold; the negative sample pairs are divided into a second simple sample pair and a second difficult sample pair according to a third threshold; wherein the number of the first difficult sample pairs is the same as the number of the second difficult sample pairs.
[0015] Optionally, the method for learning close-range non-homologous difficult sample pairs is characterized in that the second weight Among them, Δl i is the error, w i is the parameter learned by the model, α i is the weight coefficient; the first weight Among them, Δl j is the comprehensive error, w j is the parameter learned by the model, β j is the weight coefficient.
[0016] Optionally, the method for learning close-range non-homologous difficult sample pairs is characterized by: Among them, α i1 and α i1 It is the weight coefficient of different training images in a set of training sample pairs.
[0017] Optionally, the method for learning close non-homologous difficult sample pairs is characterized in that the second weight Here, a is a preset value less than 1.
[0018] Optionally, the method for learning close-range non-homologous difficult sample pairs is characterized in that step S2 comprises:
[0019] Step S21: randomly selecting part of the data from the training sample pairs to form a small sample pair set;
[0020] Step S22: performing target detection on the small sample pair set to determine the model type;
[0021] Step S23: Select a corresponding deep learning model according to the model type, and train to obtain an initial model.
[0022] In a second aspect, the present invention provides a close non-homologous difficult sample pair learning system, which is used to implement any of the above-mentioned training methods for close non-homologous difficult sample pair learning, and is characterized by comprising:
[0023] An acquisition module, used to acquire a training sample pair, wherein the training sample pair includes at least two training images of different types, the training images include human features, and the training sample pair includes a positive sample pair and a negative sample pair;
[0024] An initial module, used to identify the training sample pairs and obtain an initial model;
[0025] A weight module, used to calculate the error of each training image and the comprehensive error of each training sample pair, and calculate the first weight of each training sample pair according to the comprehensive error, and calculate the second weight of each training image according to the error;
[0026] A training module, used for training the training sample pairs according to the first weight and the second weight to obtain a second model;
[0027] A loop module is used to repeatedly run the weight module and the training module until the second model converges.
[0028] In a third aspect, the present invention provides a close-range non-homologous difficult sample pair learning device, characterized by comprising:
[0029] processor;
[0030] a memory storing executable instructions of the processor;
[0031] The processor is configured to execute the steps of any one of the aforementioned methods for learning close non-homologous difficult sample pairs by executing the executable instructions.
[0032] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a program, characterized in that when the program is executed, the steps of any of the aforementioned methods for learning close non-homologous difficult sample pairs are implemented.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] The present invention can achieve targeted learning of difficult sample pairs by determining the weight values of training sample pairs according to errors during training, and can better learn difficult sample pairs, so that the model has a higher degree of learning for difficult sample pairs and has better human feature recognition ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings in the following descriptions are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work. By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, purposes and advantages of the present invention will become more obvious:
[0036] Figure 1 This is a flowchart of the steps of learning a pair of close-range non-homologous difficult samples in an embodiment of the present invention;
[0037] Figure 2 A flowchart of steps for obtaining an initial model in an embodiment of the present invention;
[0038] Figure 3 Schematic diagram of the structure of a close-range non-homologous difficult sample pair learning system in an embodiment of the present invention;
[0039] Figure 4 is a structural schematic diagram of a device for learning close-range non-homologous difficult sample pairs in an embodiment of the present invention; and
[0040] Figure 5 Schematic diagram of the structure of a computer-readable storage medium in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0042] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein, for example, can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0043] The embodiment of the present invention provides a method for learning close-range non-homologous difficult sample pairs, aiming to solve the problems existing in the prior art.
[0044] The following specific embodiments are used to describe in detail the technical solutions of the present invention and how the technical solutions of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0045] During the model training process, the present invention obtains the errors of each training sample pair and training image, updates the weights of the training sample pair and the training image according to the error value, and then retrains the model in combination with the weights. This enables the model to focus on learning difficult sample pairs of human features and accelerates the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide application range, and high recognition.
[0046] The present invention is aimed at human feature recognition at close range. The training sample pair consisting of RGB image and infrared image is used as an example for explanation. The information collected by RGB image and infrared image is different. When recognizing human features at close range, RGB image obtains human surface information, while infrared image obtains vein information under the human surface. Therefore, RGB image and infrared image are one-to-one corresponding, but the content is not exactly the same. The model needs to consider the difference between the two when training.
[0047] Figure 1 FIG. 1 is a flowchart of the steps of learning a pair of close-range non-homologous difficult samples in an embodiment of the present invention. Figure 1 As shown, in an embodiment of the present invention, a step of learning a pair of close-range non-homologous difficult samples includes:
[0048] Step S1: Obtain training sample pairs.
[0049] In this step, the training sample pair includes at least two training images from different sources. For a non-homologous binocular depth camera, the two images obtained constitute a set of training sample pairs, such as an RGB image and an infrared image taken at the same time. The training image includes human features. The human features in this embodiment can be any feature of the human body, such as face, palm, fingerprint, pupil, body posture, etc. The training sample pair includes a positive sample pair and a negative sample pair. The positive sample pair is a correct image containing human features, and the negative sample pair is an erroneous image that does not contain human features. For example, an image containing a face and eyes can be collected as a positive sample pair, and an image that does not contain a face or eyes can be collected as a negative sample pair. Each training sample pair has a corresponding label for training the model. For the purpose of this embodiment, the human features in the training sample pair are features of the same part, such as all training sample pairs are images containing faces, images containing palms, images containing fingerprints, images containing pupils, or images containing body postures. A training sample pair can contain multiple human features, such as simultaneously containing faces and palms. However, all training sample pairs contain at least one human feature. A training sample pair may also contain multiple target objects with the same human feature, such as multiple faces.
[0050] The training sample pairs can also contain different types of target objects. For example, the positive sample pairs contain real face images and synthetic face images, and the negative sample pairs contain head model face images, synthetic images, camouflaged face images, and images without faces. Due to the rich variety of training sample pairs and the huge difference in the number of images of different types due to the limitation of collection cost, it is difficult for the model to learn some images and it is difficult to accurately identify them.
[0051] For non-homologous binocular images, such as one RGB image and one infrared image, at night, the quality of the RGB image is usually very poor, while the quality of the infrared image is higher, and judgment can be made based on the infrared image.
[0052] Step S2: Identify the training sample pairs to obtain an initial model.
[0053] In this step, a neural network is used to learn the training sample pairs, determine the parameters of the model, and obtain an initial model. The selection of the neural network varies according to the characteristics of the human body. Use a deep learning model (such as a convolutional neural network) to train the training sample pairs, input the positive sample pairs into the network for recognition, and obtain the output results; input the negative sample pairs into the network for recognition, and obtain the output results. By comparing the output results of the positive and negative sample pairs, calculate the loss function (such as cross entropy loss), and update the network parameters according to the gradient descent algorithm until the loss function converges to a smaller value. In this way, we get an initial model that can recognize human features.
[0054] Step S3: Calculate the error of each training image and the comprehensive error of each training sample pair, calculate the first weight of each training sample pair according to the comprehensive error, and calculate the second weight of each training image according to the error.
[0055] In this step, when the initial model detects the training sample pair, it obtains the probability m that the training sample pair is true, and the error is (1-m). The training sample pair is assigned a weight f according to the error. The size of the weight f is proportional to the size of the error. The larger the error, the larger the weight; the smaller the error, the smaller the weight. The comprehensive error refers to the weighted average of all training image errors. For example, the weighted mean square error (WMSLE) can be used as an error metric, and linear regression or other regression methods can be used to calculate the first weight and the second weight.
[0056] The initial model is only used to calculate the error of the training sample pair for the first time. When this step is executed in a loop, the error of the second model is used to calculate the weight of the training sample pair. The weight value of the training sample pair is recalculated in each iterative calculation to obtain the updated weight, so that the model can be learned in a targeted manner, especially for the difficult model that has always existed, which can continue to learn and have a better learning effect.
[0057] During learning, this embodiment recognizes each image in the training sample pair separately, and can use the higher quality images in the training sample pair to assist in judging the lower quality images, thereby improving the model's learning ability for each image in the training sample pair.
[0058] In some embodiments, the training sample pairs are divided into simple sample pairs and difficult sample pairs according to the relationship between the comprehensive error and the first threshold, and the simple sample pairs are augmented to improve the diversity of learning. The augmentation methods include but are not limited to rotation, cropping, contrast, brightness, etc. By augmenting the simple sample pairs, the model has higher robustness for the recognition of simple sample pairs, and at the same time, the labels of the augmented images can be guaranteed to remain unchanged, the cost of manual annotation can be reduced, and the probability of label errors can be reduced. While increasing the weight of the difficult sample pairs, increasing the number of simple sample pairs can not only better learn the difficult sample pairs, but also improve the robustness of the model.
[0059] In some embodiments, the second weight Among them, Δl i is the error, w i is the parameter learned by the model, α i is the weight coefficient; the first weight Among them, Δl j is the comprehensive error, w jis the parameter learned by the model, β j is the weight coefficient. The weight parameter can be set in many ways. When setting the weight coefficient, the larger the error, the larger the weight. The larger the difference between the weights of the sample pairs, the better the model learns for difficult sample pairs. For example, the weights of the sample pairs are set in stages, and the corresponding weight values are assigned according to the errors. At this time, the weights are set to 0.3, 0.5, 1, 2, and 3 respectively. Since the error range is [0,1], the error is divided into five levels [0, 0.2), [0.2, 0.4), [0.4, 0.6), [0.6, 0.8), and [0.8, 1], corresponding to the weights respectively. Among them, α i1 and α i1 is the weight coefficient of different training images in a set of training sample pairs. For example, there are two images in the training sample pair, and the weight of the first image is α 11 , the weight of the second image is α 12 , then α1 and α2 jointly determine the weight β1 of the training sample pair. In this embodiment, β1 is α 11 With α 12 During the training process, the model will first learn the training sample pairs with large errors in both the first image and the second image, followed by the training sample pairs with a large error in the first image and the second image, forming a gradient learning mode that can promote the learning of difficult samples.
[0060] In some embodiments, the second weight Wherein, a is a preset value less than 1. The value of a is preset and can be a constant or a value adaptive to the error of the training sample pair. When a is a constant, it can be any one of 0.5, 0.6, 0.7 or any other value. When a is a value adaptive to the error of the training sample pair, the errors are sorted and the median, the first 1 / 4, the first 1 / 3 or any other percentage of errors are taken as a, so that adaptive weight allocation can be achieved.
[0061] In some embodiments, the training sample pairs with errors greater than the fourth threshold are detected, and if the training sample pairs are erroneous data, the weights are reset to 0. Some data in the training sample pairs may have errors, such as labeling errors, data corruption, etc. This embodiment can improve the stability of the model by detecting the data and verifying the accuracy and completeness of the training sample pairs. Compared with screening all training sample pairs, it has higher efficiency.
[0062] Step S4: training the training sample pairs according to the first weights and the second weights to obtain a second model.
[0063] In this step, a weight training algorithm is used to train the training sample pairs to achieve the effect of learning with different weights. The larger the weight, the better the learning effect. The second model has a better recognition effect on the training sample pairs with large weights. This step comprehensively learns based on the first weight and the second weight, taking into account the overall situation of the training sample pairs and fully considering the differences between the samples, and the obtained second model has better stability.
[0064] In some embodiments, during the training process, the original loss function is no longer used directly to update the network parameters, but the weighted mean square error (WMSLE) is used to calculate the total error of each training sample pair. Then, the total error is adjusted according to the first weight and the second weight to update the network parameters. In this way, we get a more accurate second model.
[0065] In some embodiments, the positive sample pairs are divided into a first simple sample pair and a first difficult sample pair according to a second threshold; the negative sample pairs are divided into a second simple sample pair and a second difficult sample pair according to a third threshold; wherein the number of the first difficult sample pairs is the same as the number of the second difficult sample pairs. This embodiment can make the model learning more complete and more stable.
[0066] Step S5: Repeat steps S3-S4 until the second model converges.
[0067] In this step, steps S3-S4 are repeated until the second model converges. There are multiple ways to judge whether the second model converges. The first is to judge the loss function of the second model. When the loss function no longer decreases, it is judged to be converged. The second is to judge based on the weight value. When the proportion of the training sample with a larger weight is lower than the preset proportion, it is judged to be converged.
[0068] Figure 2 FIG. 1 is a flow chart of steps for obtaining an initial model in an embodiment of the present invention. Figure 2 As shown, in an embodiment of the present invention, a step of obtaining an initial model includes:
[0069] Step S21: Randomly select part of the data from the training sample pairs to form a small sample pair set.
[0070] In this step, when the training sample pairs are very large, the training time is long. You can obtain a small sample pair set by random selection to reduce the time of the initial training. The number of small sample pairs cannot be too small, so it is necessary to set a minimum number of training sample pairs in the small sample pair set.
[0071] Step S22: performing target detection on the small sample pair set to determine the model type.
[0072] In this step, target detection is performed on the small sample pair set to obtain the type of the target object. This step can use multiple detection models for detection. For example, a face detection model is used for detection, followed by a palm detection model, a pupil detection model, etc. Through multiple rounds of detection, the model type in the small sample pair set is determined. For example, if faces are detected in all images in the small sample pair set, but palms and pupils are only detected in some sample pairs, the model type is determined to be a face.
[0073] Step S23: Select a corresponding deep learning model according to the model type, and train to obtain an initial model.
[0074] In this step, a deep learning model is used to train a small sample pair set to obtain an initial model.
[0075] This embodiment randomly selects some sample pairs from the training sample pairs to form a small sample pair set, and determines the model type through detection, and then trains to obtain the initial model. Compared with learning and training all sample pairs, this embodiment has a faster training speed, especially when the number of sample pairs is very large, the training speed can be significantly improved.
[0076] Figure 3 FIG. 1 is a schematic diagram of a structure of a close-range non-homologous difficult sample pair learning system according to an embodiment of the present invention. Figure 3 As shown, a training system for a close-range non-homologous difficult sample pair learning system in an embodiment of the present invention includes:
[0077] An acquisition module, used to acquire a training sample pair, wherein the training sample pair includes at least two training images of different types, the training images include human features, and the training sample pair includes a positive sample pair and a negative sample pair;
[0078] An initial module, used to identify the training sample pairs and obtain an initial model;
[0079] A weight module, used to calculate the error of each training image and the comprehensive error of each training sample pair, and calculate the first weight of each training sample pair according to the comprehensive error, and calculate the second weight of each training image according to the error;
[0080] A training module, used for training the training sample pairs according to the first weight and the second weight to obtain a second model;
[0081] A loop module is used to repeatedly run the weight module and the training module until the second model converges.
[0082] Specifically, the acquisition module is used to obtain training sample pairs. The initial model is trained to obtain the initial model. The weight module and the training module are used to iteratively optimize the model. The loop module is used to control the iterative process to ensure the convergence of the second model.
[0083] During the model training process, this embodiment obtains the error of each training sample pair and training image, and updates the weights of the training sample pair and the training image according to the error value. Then, the model is retrained in combination with the weights. This enables the model to focus on learning difficult sample pairs of human features and accelerates the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide applicability, and high recognition.
[0084] The present invention also provides a training device for learning close non-homologous difficult sample pairs, including a processor and a memory storing executable instructions of the processor. The processor is configured to execute the steps of a training method for learning close non-homologous difficult sample pairs by executing the executable instructions.
[0085] As mentioned above, during the model training process, this embodiment obtains the error of each training sample pair and training image, and updates the weights of the training sample pair and the training image according to the error value, and then retrains the model in combination with the weights. This enables the model to focus on learning difficult sample pairs of human features and accelerate the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide applicability, and high recognition.
[0086] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".
[0087] Figure 4 Schematic diagram of a training device for learning close-range non-homologous difficult sample pairs in an embodiment of the present invention. Figure 4 The electronic device 600 according to this embodiment of the present invention is described. Figure 4 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0088] like Figure 4As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0089] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present invention described in the above-mentioned training method for learning a pair of close non-homologous difficult samples. For example, the processing unit 610 can execute the following steps: Figure 1 Follow the steps shown in .
[0090] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0091] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0092] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0093] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 through the bus 630. It should be understood that although Figure 4Not shown, other hardware and / or software modules may be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0094] In an embodiment of the present invention, a computer-readable storage medium is also provided for storing a program, and when the program is executed, the steps of a training method for learning a pair of close non-homologous difficult samples are implemented. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary embodiments of the present invention described in the above-mentioned training method for learning a pair of close non-homologous difficult samples section of this specification.
[0095] As shown above, during the model training process, this embodiment obtains the error of each training sample pair and training image, and updates the weights of the training sample pair and the training image according to the error value. Then, the model is retrained in combination with the weights. This enables the model to focus on learning difficult sample pairs of human features and accelerate the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide applicability, and high recognition.
[0096] Figure 5 Schematic diagram of the structure of a computer-readable storage medium in an embodiment of the present invention. Figure 5 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0097] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0098] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0099] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0100] During the model training process, this embodiment obtains the error of each training sample pair and training image, and updates the weights of the training sample pair and the training image according to the error value. Then, the model is retrained in combination with the weights. This enables the model to focus on learning difficult sample pairs of human features and accelerates the convergence speed. In particular, it has better balance for training sets with rich types of training sample pairs, and has the advantages of good learning effect, wide applicability, and high recognition.
[0101] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other. The above description of the disclosed embodiments enables professionals and technicians in this field to implement or use the present invention. Various modifications to these embodiments will be obvious to professionals and technicians in this field, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown in this article, but will comply with the widest range consistent with the principles and novel features disclosed herein.
[0102] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art may make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.
Claims
1. A method for learning close non-homologous difficult sample pairs, characterized by: include: Step S1: obtaining a training sample pair, wherein the training sample pair includes at least two training images of different types, the training images include human features, and the training sample pair includes a positive sample pair and a negative sample pair; Step S2: Identify the training sample pairs to obtain an initial model; Step S3: calculating the error of each training image and the comprehensive error of each training sample pair, and calculating the first weight of each training sample pair according to the comprehensive error, and calculating the second weight of each training image according to the error; Step S4: training the training sample pairs according to the first weight and the second weight to obtain a second model; Step S5: Repeat steps S3-S4 until the second model converges.
2. A method for learning close non-homologous difficult sample pairs according to claim 1, characterized in that: In step S3, the training sample pairs are divided into simple sample pairs and difficult sample pairs according to the relationship between the comprehensive error and the first threshold, and the simple sample pairs are augmented to improve the diversity of learning.
3. The method for learning close non-homologous difficult sample pairs according to claim 1, characterized in that: In step S4, the positive sample pairs are divided into first simple sample pairs and first difficult sample pairs according to a second threshold; the negative sample pairs are divided into second simple sample pairs and second difficult sample pairs according to a third threshold; wherein the number of the first difficult sample pairs is the same as that of the second difficult sample pairs.
4. The method for learning close non-homologous difficult sample pairs according to claim 1, characterized in that: The second weight Among them, Δl i is the error, w i is the parameter learned by the model, α i is the weight coefficient; the first weight Among them, Δl j is the comprehensive error, w j is the parameter learned by the model, β j is the weight coefficient.
5. The method for learning close-range non-homologous difficult sample pairs according to claim 4, characterized in that: Among them, α i1 and α i1 It is the weight coefficient of different training images in a set of training sample pairs.
6. The method for learning close non-homologous difficult sample pairs according to claim 1, characterized in that: Second weight Here, a is a preset value less than 1.
7. The method for learning close non-homologous difficult sample pairs according to claim 1, characterized in that: Step S2 includes: Step S21: randomly selecting part of the data from the training sample pairs to form a small sample pair set; Step S22: performing target detection on the small sample pair set to determine the model type; Step S23: Select a corresponding deep learning model according to the model type, and train to obtain an initial model.
8. A close distance non-homologous difficult sample pair learning system, used to implement the close distance non-homologous difficult sample pair learning training method described in any one of claims 1 to 7, characterized in that: include: An acquisition module, used to acquire a training sample pair, wherein the training sample pair includes at least two training images of different types, the training images include human features, and the training sample pair includes a positive sample pair and a negative sample pair; An initial module, used to identify the training sample pairs and obtain an initial model; A weight module, used to calculate the error of each training image and the comprehensive error of each training sample pair, and calculate the first weight of each training sample pair according to the comprehensive error, and calculate the second weight of each training image according to the error; A training module, used for training the training sample pairs according to the first weight and the second weight to obtain a second model; A loop module is used to repeatedly run the weight module and the training module until the second model converges.
9. A device for learning close-range non-homologous difficult sample pairs, characterized in that: include: processor; a memory storing executable instructions of the processor; The processor is configured to execute the steps of the method for learning close non-homologous difficult sample pairs as described in any one of claims 1 to 7 by executing the executable instructions.
10. A computer-readable storage medium for storing a program, characterized in that: When the program is executed, the steps of the method for learning close non-homologous difficult sample pairs described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Target identification method and device and electronic system
CN113361568A
Palm vein data enhancement and feature extraction method for high-degree-of-freedom application scene
CN115063843A
Deep learning model training method based on sample classification
CN116342936A
Heterogeneous face recognition model training method, recognition method, device and equipment
CN116682154A
