Human body detection model training method and device, equipment and storage medium
By integrating the training of the teacher model into the student model through an online knowledge distillation method, and using the auxiliary neck module and distillation loss function to train the student model, the problems of long time consumption and high cost in existing methods are solved, and efficient and high-precision human detection model training is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZHIDA TIANJIE COMMERCIAL OPERATION MANAGEMENT CO LTD
- Filing Date
- 2023-02-01
- Publication Date
- 2026-05-08
AI Technical Summary
Existing methods for training human detection models require training a large teacher model in advance, which results in long training times and high costs.
An online knowledge distillation method is adopted to integrate the training of the teacher model into the training of the student model. The student model is trained through an auxiliary neck module, and the distillation loss function is used to guide the training of the student model, so as to obtain a high-precision human detection model in one training.
It shortens the training time of the human detection model, reduces training costs, and maintains the model's high accuracy and generalization ability.
Smart Images

Figure CN116052219B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for training a human body detection model. Background Technology
[0002] Object detection algorithms are widely used in practice, with human detection algorithms, such as the YOLOX algorithm, being particularly common due to their high accuracy. Knowledge distillation, a technique that uses a large model to improve the generalization ability of a small model, has also been widely applied due to its advantages of lossless modeling, speed, and improved accuracy.
[0003] In human detection tasks, knowledge distillation is a method that can improve model accuracy while maintaining inference speed. However, existing human detection model training methods based on knowledge distillation require a large model to be trained in advance as a teacher model, and then the teacher model is used to train the student model to improve its generalization. Because an additional teacher model needs to be trained, the existing human detection model training methods suffer from long training time and high cost. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, apparatus, device, and storage medium for training a human body detection model, in order to solve the problems of long time consumption and high cost in existing human body detection model training methods.
[0005] A first aspect of this application provides a method for training a human detection model, comprising: inputting a training set into a pre-configured student model; extracting features from sample images in the training set using the backbone module of the student model; inputting the feature maps output by the backbone module into a neck module and an auxiliary neck module respectively; performing feature fusion using the neck module and the auxiliary neck module respectively to obtain a fused feature map; obtaining the target value corresponding to each channel of the fused feature map, and converting the target value to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively; calculating the distillation loss based on the feature distribution, and training the neck module of the student model using the distillation loss; and sending the output of the trained neck module to the head module for training to obtain a fully trained human detection model.
[0006] A second aspect of this application provides a human detection model training apparatus, comprising: an extraction module configured to input a training set into a pre-configured student model and extract features from sample images in the training set using the backbone module of the student model; a fusion module configured to input the feature map output by the backbone module into a neck module and an auxiliary neck module respectively, and perform feature fusion using the neck module and the auxiliary neck module respectively to obtain a fused feature map; a conversion module configured to obtain the target value corresponding to each channel of the fused feature map and convert the target value to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively; a calculation module configured to calculate the distillation loss based on the feature distribution and train the neck module of the student model using the distillation loss; and a training module configured to send the output of the trained neck module to the head module for training to obtain a fully trained human detection model.
[0007] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described method.
[0008] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0009] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:
[0010] This paper proposes a method for human detection models. By inputting the training set into a pre-configured student model, the backbone module of the student model extracts features from the sample images in the training set. The feature maps output from the backbone module are then input into the neck module and the auxiliary neck module, respectively. Feature fusion is performed in the neck module and the auxiliary neck module to obtain fused feature maps. The target value for each channel of the fused feature map is obtained and transformed to obtain the feature distributions for the neck module and the auxiliary neck module, respectively. Distillation loss is calculated based on the feature distributions, and the neck module of the student model is trained using the distillation loss. The output of the trained neck module is then sent to the head module for training, resulting in a fully trained human detection model. This application integrates the training of the teacher model into the training of the student model, enabling online knowledge distillation of the human detection model. This allows for high-precision human detection models to be obtained with only one training iteration, shortening the training time and reducing the cost of human detection model training. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a schematic diagram of the human detection model involved in a real-world scenario according to the embodiments of this application;
[0013] Figure 2 This is a flowchart illustrating the human body detection model training method provided in the embodiments of this application;
[0014] Figure 3 This is a schematic diagram of the structure of the human body detection model training device provided in the embodiments of this application;
[0015] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0016] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0017] As described in the background section, object detection algorithms are widely used in practice. One representative and excellent algorithm, YOLOX, is frequently used in industry, such as in human detection projects, due to its high-precision detection performance. Knowledge distillation, a method that uses a large model to improve the generalization ability of a small model, has also been widely applied because it offers the advantages of lossless modeling, speed, and improved model accuracy.
[0018] In human detection tasks, knowledge distillation is a method that can improve model accuracy while maintaining inference speed. However, existing human detection model training methods based on knowledge distillation require a large model to be trained in advance as a teacher model, and then the teacher model is used to train the student model to improve its generalization. Since an additional teacher model needs to be trained, it means more time and effort are required, resulting in long training time and high cost of existing human detection model training methods, which brings inconvenience to actual human detection tasks.
[0019] Traditional knowledge distillation methods for human detection tasks can be divided into two steps: First, train a large model with good generalization ability; second, use the model trained in step one (called the teacher model) in the training process of a second model (called the student model), allowing the student model's output to learn from the teacher model's output, thereby enabling the student model to achieve higher generalization. However, this method of pre-training the large teacher model adds an extra step compared to the normal method of training the student model, which means increased time and cost in model training.
[0020] In view of this, this application provides a method for training a human detection model to solve the above problems. Taking the YOLOX algorithm as an example, this application designs an online knowledge distillation algorithm based on an auxiliary neck module. This algorithm integrates the training of the teacher model into the training of the student model, training both the teacher and student models simultaneously. The output of the teacher model is used to guide the student model online, enabling a high-precision human detection model to be obtained with only one training.
[0021] Figure 1 This is a schematic diagram of the human detection model involved in a real-world scenario according to an embodiment of this application, as shown below. Figure 1 As shown, the human body detection model may specifically include:
[0022] The human detection model in this application only includes a student model, which can be a model built based on the YOLOX object detection algorithm. The student model includes an input module, a trunk module, a neck module, an auxiliary neck module, a head module, and an output module. The trunk module is used to output feature maps of three different scales, while the neck module and the auxiliary neck module are used to perform feature fusion on these three scale feature maps.
[0023] Common knowledge distillation methods require pre-training a large model as a teacher model. This large model typically has one or more modules that are larger than those of the smaller model, usually manifested in a wider or deeper network, or both. Such models have more parameters and are better able to learn generalization from diverse training data. This application uses the neck module as the object of knowledge distillation primarily for the following two reasons, detailed below:
[0024] Firstly, since the number of parameters in the backbone module is usually greater than that in the neck module, the neck module is easier to train than the backbone module. This application chooses to use the neck module with a smaller number of parameters as the auxiliary neck module. If online knowledge distillation trains two types of backbone modules at the same time, it will put a huge pressure on the overall model optimization, resulting in the inability to train both types of backbone modules well.
[0025] Secondly, due to the unique role of the neck module, this application selects the neck module as an auxiliary module. Since the main module outputs feature maps of three different scales, C3, C4, and C5, the localization features (suitable for regression localization) of C3 to C5 decrease sequentially, while the semantic features (suitable for category classification) increase sequentially. The neck module is used to fuse the three layers of features output by the main module, so that the localization features and semantic features of each layer of feature maps complement each other, thereby improving both localization and classification capabilities. If the neck module is weak, then the C3 classification capability, which is suitable for detecting small targets, will be low, while the C5 localization capability, which is suitable for detecting large targets, will be low.
[0026] The auxiliary neck module designed in this application keeps the input and output channels the same as the student model. The main difference is that it increases the number of convolution-batch normalization-activation steps in the CSP (Cross-Stage Local Structure), which increases the depth of the CSP. Since the auxiliary neck module is deeper, its fused output features are more discriminative, thereby guiding the output of the student model's neck module and improving the generalization of the final student model.
[0027] The following is based on Figure 1 The structure of the human body detection model shown is illustrated, and the implementation process of the human body detection model training method of this applicant is described in detail.
[0028] Figure 2 This is a flowchart illustrating the human body detection model training method provided in the embodiments of this application. Figure 2 The training method for human detection models can be executed by a server. For example... Figure 2 As shown, the training method for this human detection model can specifically include:
[0029] S201, Input the training set into the pre-configured student model, and use the backbone module of the student model to extract features from the sample images in the training set;
[0030] S202, The feature map output by the main module is input into the neck module and the auxiliary neck module respectively, and the feature is fused using the neck module and the auxiliary neck module respectively to obtain the fused feature map;
[0031] S203, obtain the target value corresponding to each channel of the fused feature map, and transform the target value to obtain the feature distribution corresponding to the neck module and the auxiliary neck module respectively;
[0032] S204, calculate the distillation loss based on the feature distribution, and use the distillation loss to train the neck module of the student model;
[0033] S205 sends the output of the trained neck module to the head module for training, resulting in a fully trained human detection model.
[0034] Specifically, the human detection model in this application embodiment is a human detection model built based on the YOLOX algorithm. However, it should be understood that the human detection model in this application is not limited to the YOLOX algorithm, and other human detection algorithms are also applicable to this application.
[0035] Furthermore, the training set input into the student model contains a large number of human images with bounding boxes marked in the human images. First, the human images are input into the backbone module of the student model for feature extraction. The backbone module will output feature maps of three different scales, namely C3, C4 and C5 (i.e., three-layer feature maps). Then, the three-layer feature maps are input into the neck module for fusion.
[0036] In some embodiments, the feature maps output by the backbone module are input into the neck module and the auxiliary neck module respectively, and feature fusion is performed using the neck module and the auxiliary neck module respectively, including: using the three-layer feature maps output by the backbone module as inputs to the neck module and the auxiliary neck module respectively; fusing the three-layer feature maps using the neck module and the auxiliary neck module respectively to obtain the fused feature map corresponding to the neck module and the fused feature map corresponding to the auxiliary neck module.
[0037] Specifically, the three-layer feature maps output by the backbone module are input into the neck module and the auxiliary neck module for feature fusion, and the neck module and the auxiliary neck module output their respective fused feature maps. In practical applications, since the auxiliary neck module has a deeper and larger network model structure than the neck module, the auxiliary neck module has a stronger ability to fuse and extract feature maps.
[0038] Furthermore, the outputs of the neck module and the auxiliary neck module are feature maps corresponding to three different scales, each with dimensions N*C*H*W, where N, C, H, and W represent the number of samples, the number of channels, the feature map height, and the feature map width, respectively. Next, the neck module (i.e., the student model) will be distilled channel-by-channel based on the number of channels in each fused feature map.
[0039] It should be noted that both the output of the auxiliary neck module and the output of the neck module are four-dimensional feature maps. The feature map output by the auxiliary neck module has stronger discriminative ability. Therefore, this application allows the output of the neck module to learn from the output of the auxiliary neck module, so that the feature map output by the neck module approximates the feature map output by the auxiliary neck module.
[0040] In some embodiments, obtaining the target value corresponding to each channel of the fused feature map includes: determining the number of channels in the fused feature map, obtaining the feature map height H and feature map width W corresponding to each channel, and using a total of H*W values for each channel as the target value corresponding to each channel.
[0041] Specifically, since each channel of the fused feature map (corresponding to dimension C in the aforementioned embodiments) depicts different targets in the original input map, this application performs distillation on each channel individually, rather than performing distillation on all channels uniformly.
[0042] Furthermore, for each fused feature map, the target value corresponding to each channel of the fused feature map is obtained, and the target value is normalized to obtain the feature distribution corresponding to the auxiliary neck module and the feature distribution corresponding to the neck module. In practical applications, the H*W values corresponding to each channel can be used as the target value for each channel.
[0043] In some embodiments, the target value is transformed to obtain the feature distributions corresponding to the neck module and the auxiliary neck module, respectively, including: normalizing the target value of the fused feature map corresponding to the neck module and the target value of the fused feature map corresponding to the auxiliary neck module, respectively, to obtain the feature distributions corresponding to the neck module and the auxiliary neck module.
[0044] Specifically, a softmax operation (normalization) is performed on each channel's H*W values (i.e., target values) to transform the target values into a feature distribution, which corresponds to the feature distribution of different targets in the original input image. Then, a robust function is used... Calculate distillation loss, where This represents the difference between the outputs of the auxiliary neck module and the student model neck model after channel-by-channel softmax.
[0045] In some embodiments, the distillation loss is calculated based on the characteristic distribution, including using the following robust function to calculate the distillation loss:
[0046]
[0047] in, This represents the difference between the feature distribution of the neck module and the feature distribution of the auxiliary neck module.
[0048] Specifically, this application designs a channel-wise distillation loss, which minimizes the value of the distillation loss function to make the output of the neck module approximate the output of the auxiliary neck module, that is, to make the output of the neck module learn the output of the auxiliary neck module, thereby improving the feature fusion capability of the neck module. Then, the output features are given to the head module to complete the final detection result output.
[0049] In some embodiments, training the neck module of the student model using distillation loss includes: training the neck module of the student model on a channel-by-channel basis using distillation loss calculated for each channel, so as to minimize the difference between the fused feature map output by the neck module and the fused feature map output by the auxiliary neck module.
[0050] Specifically, this application uses a channel-wise distillation loss method to train the neck module, while ensuring that the overall output of the model approximates the labels on the training set. The channel-wise distillation loss function designed in this application represents how the output of the auxiliary neck module guides the student model in learning. By calculating the channel-wise distillation loss function, the difference between the fused feature map output by the neck module and the fused feature map output by the auxiliary neck module is minimized, thereby achieving the purpose of training the neck module (i.e., the student model).
[0051] According to the technical solution provided in the embodiments of this application, this application achieves online distillation by embedding the auxiliary neck module into the training of the student model, avoiding the inconvenience of pre-training a teacher model. The model structure training method provided by this application is one-step, and a model that is better than the ordinary model training method can be obtained after one training. This application improves the generalization of object detection by adding an auxiliary neck module that is larger than the neck module of the student model. The auxiliary neck module of this application uses a deeper structure than the neck module of the student model, which improves the feature fusion capability, which is equivalent to providing the neck module of the student model with the role of a teacher. This application designs a channel-wise distillation loss function, which distills each channel of the feature map separately, and can better learn the features of different targets in the input map.
[0052] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0053] Figure 3 This is a schematic diagram of the structure of the human body detection model training device provided in an embodiment of this application. Figure 3 As shown, the human body detection model training device includes:
[0054] The extraction module 301 is configured to input the training set into a pre-configured student model and use the backbone module of the student model to extract features from the sample images in the training set.
[0055] The fusion module 302 is configured to input the feature map output by the backbone module into the neck module and the auxiliary neck module respectively, and perform feature fusion using the neck module and the auxiliary neck module respectively to obtain the fused feature map;
[0056] The conversion module 303 is configured to obtain the target value corresponding to each channel of the fused feature map, and convert the target value to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively;
[0057] The computation module 304 is configured to calculate the distillation loss based on the feature distribution and use the distillation loss to train the neck module of the student model;
[0058] Training module 305 is configured to send the output of the trained neck module to the head module for training, thereby obtaining a fully trained human detection model.
[0059] In some embodiments, both the teacher model and the student model employ a human body detection model, which includes a trunk module, a neck module, and a head module.
[0060] In some embodiments, Figure 3 The fusion module 302 takes the three-layer feature map output by the backbone module as the input of the neck module and the auxiliary neck module respectively; and uses the neck module and the auxiliary neck module to fuse the three-layer feature map respectively to obtain the fused feature map corresponding to the neck module and the fused feature map corresponding to the auxiliary neck module.
[0061] In some embodiments, Figure 3 The conversion module 303 determines the number of channels in the fused feature map, obtains the feature map height H and feature map width W corresponding to each channel, and uses the H*W values corresponding to each channel as the target value corresponding to each channel.
[0062] In some embodiments, Figure 3 The conversion module 303 performs normalization operations on the target values of the fused feature maps corresponding to the neck module and the auxiliary neck module respectively, to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively.
[0063] In some embodiments, Figure 3 The calculation module 304 uses the following robust function to calculate distillation loss:
[0064]
[0065] in, This represents the difference between the feature distribution of the neck module and the feature distribution of the auxiliary neck module.
[0066] In some embodiments, Figure 3 The computation module 304 uses the distillation loss calculated for each channel to train the neck module of the student model in a channel-by-channel manner to minimize the difference between the fused feature map output by the neck module and the fused feature map output by the auxiliary neck module.
[0067] In some embodiments, the human detection model uses a model created based on the YOLOX algorithm.
[0068] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0069] Figure 4 This is a schematic diagram of the structure of the electronic device 4 provided in an embodiment of this application. Figure 4 As shown, the electronic device 4 of this embodiment includes a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, it implements the steps in the various method embodiments described above. Alternatively, when the processor 401 executes the computer program 403, it implements the functions of each module / unit in the various device embodiments described above.
[0070] For example, computer program 403 may be divided into one or more modules / units, which are stored in memory 402 and executed by processor 401 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 403 in electronic device 4.
[0071] Electronic device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 4 may include, but is not limited to, processor 401 and memory 402. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device may also include input / output devices, network access devices, buses, etc.
[0072] Processor 401 can be a Central Processing Unit (CPU), or 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. A general-purpose processor can be a microprocessor or any conventional processor.
[0073] The memory 402 can be an internal storage unit of the electronic device 4, such as a hard disk or RAM. The memory 402 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 402 can include both internal and external storage units of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device. The memory 402 can also be used to temporarily store data that has been output or will be output.
[0074] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0075] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0076] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0077] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0078] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0079] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0080] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium can be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0081] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for training a human body detection model, characterized in that, include: The training set is input into a pre-configured student model, and the backbone module of the student model is used to extract features from the sample images in the training set. The feature maps output by the backbone module are input into the neck module and the auxiliary neck module, respectively. Feature fusion is then performed using the neck module and the auxiliary neck module to obtain the fused feature map. The auxiliary neck module maintains the same input and output channels as the student model and increases the depth of the cross-stage local structures in the auxiliary neck module to guide the output of the student model's neck module. The target value corresponding to each channel of the fused feature map is obtained, and the target value is transformed to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively; the step of obtaining the target value corresponding to each channel of the fused feature map includes: determining the number of channels in the fused feature map, obtaining the feature map height H and feature map width W corresponding to each channel, and taking H*W values of each channel as the target value corresponding to each channel; The distillation loss is calculated based on the feature distribution, and the neck module of the student model is trained using the distillation loss. The output of the trained neck module is sent to the head module for training, resulting in a fully trained human detection model.
2. The method according to claim 1, characterized in that, The step of inputting the feature maps output by the main module into the neck module and the auxiliary neck module respectively, and performing feature fusion using the neck module and the auxiliary neck module respectively, includes: The three-layer feature map output by the main module is used as the input to the neck module and the auxiliary neck module, respectively. The three-layer feature maps are fused using the neck module and the auxiliary neck module respectively to obtain the fused feature map corresponding to the neck module and the fused feature map corresponding to the auxiliary neck module.
3. The method according to claim 2, characterized in that, The step of transforming the target value to obtain the feature distributions corresponding to the neck module and the auxiliary neck module includes: Normalize the target values of the fused feature maps corresponding to the neck module and the auxiliary neck module respectively to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively.
4. The method according to claim 1, characterized in that, The calculation of distillation loss based on the characteristic distribution includes using the following robust function to calculate the distillation loss: in, This represents the difference between the feature distribution of the neck module and the feature distribution of the auxiliary neck module.
5. The method according to claim 1, characterized in that, The training of the neck module of the student model using the distillation loss includes: The neck module of the student model is trained channel-by-channel using a distillation loss calculated for each channel, so as to minimize the difference between the fused feature map output by the neck module and the fused feature map output by the auxiliary neck module.
6. The method according to any one of claims 1 to 5, characterized in that, The human detection model is a model created based on the YOLOX algorithm.
7. A human body detection model training device, characterized in that, include: The extraction module is configured to input the training set into a pre-configured student model and use the backbone module of the student model to extract features from the sample images in the training set. The fusion module is configured to input the feature map output by the backbone module into the neck module and the auxiliary neck module respectively, and perform feature fusion using the neck module and the auxiliary neck module respectively to obtain the fused feature map; wherein, the auxiliary neck module keeps the input and output channels the same as the student model, and increases the depth of the cross-stage local structure in the auxiliary neck module to guide the output of the student model's neck module; The conversion module is configured to obtain the target value corresponding to each channel of the fused feature map, and convert the target value to obtain the feature distributions corresponding to the neck module and the auxiliary neck module respectively; obtaining the target value corresponding to each channel of the fused feature map includes: determining the number of channels in the fused feature map, obtaining the feature map height H and feature map width W corresponding to each channel, and taking H*W values of each channel as the target value corresponding to each channel; The computation module is configured to calculate the distillation loss based on the feature distribution and use the distillation loss to train the neck module of the student model; The training module is configured to send the output of the trained neck module to the head module for training, resulting in a fully trained human detection model.
8. An electronic device comprising a processor and a memory, the memory being used to store a computer program that, when executed by the processor, implements the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Living body detection model training method and training device
CN113158773A