Target detection model training method and device, readable storage medium and electronic equipment

By compressing the target detection teacher model and filtering out the background area with a binary mask, a lightweight target detection student model is generated, which solves the problem of poor detection performance and achieves efficient target detection in the field of household robots such as sweepers.

CN120747658APending Publication Date: 2025-10-03UBTECH ROBOTICS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510643383.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Existing object detection models have poor detection performance in lightweight designs, especially in the field of household robots such as sweepers. The background area occupies most of the image, interfering with the knowledge alignment between the teacher model and the student model, resulting in insufficient knowledge transfer of the object area.

Method used

By compressing the preset target detection teacher model, generating a binary mask to filter out the image background area, using the binary mask to perform feature mask filtering on the feature map, determining the loss function of the target detection student model, and training based on the loss function, a lightweight target detection model is obtained.

Benefits of technology

It effectively improves the detection performance of the target detection model and achieves efficient target detection under lightweight design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747658A_ABST
    Figure CN120747658A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of target detection, and particularly relates to a target detection model training method and device, a computer readable storage medium and electronic equipment. The method comprises the following steps: performing model compression on a preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model; generating a binary mask corresponding to the input image; respectively carrying out feature mask filtering on the first feature pattern and the second feature pattern through a binary mask to obtain a first mask feature pattern and a second mask feature pattern; wherein the first feature map is a feature map, extracted by a target detection teacher model, of the input image, and the second feature map is a feature map, extracted by a target detection student model, of the input image; determining a loss function of the target detection student model according to the first mask feature pattern and the second mask feature pattern; and training the target detection student model based on the loss function to obtain a trained target detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of target detection technology, and in particular relates to a target detection model training method, device, computer-readable storage medium and electronic device. Background Art

[0002] With the rapid development of artificial intelligence (AI) and deep learning technologies, AI vision algorithms have been widely used in various smart devices, especially in the field of household robots such as sweepers. During operation, sweepers need to detect obstacles in the environment, identify furniture, and distinguish the material of the ground in real time and accurately to ensure their efficient and safe operation. However, in actual deployment, sweepers have strict requirements on computing resources and power consumption, which requires the visual model to achieve a lightweight design while maintaining high detection performance. Knowledge distillation technology provides a way to make up for this shortcoming by transferring knowledge from a large-scale, high-precision teacher model to a student model with fewer parameters.

[0003] However, in object detection tasks, the background area usually occupies most of the image, which easily interferes with the knowledge alignment between the teacher model and the student model, resulting in insufficient knowledge transfer of the object area and affecting the final detection performance. Summary of the Invention

[0004] In view of this, the embodiments of the present application provide a target detection model training method, device, computer-readable storage medium and electronic device to solve the problem of poor detection performance of the trained model existing in the existing target detection model training method.

[0005] A first aspect of an embodiment of the present application provides a method for training a target detection model, which may include:

[0006] Performing model compression on a preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model;

[0007] Generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image;

[0008] Performing feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image by the target detection teacher model, and the second feature map is a feature map extracted from the input image by the target detection student model;

[0009] Determining a loss function of the object detection student model based on the first mask feature map and the second mask feature map;

[0010] The target detection student model is trained based on the loss function to obtain a trained target detection model.

[0011] In a specific implementation of the first aspect, generating a binary mask corresponding to the input image may include:

[0012] Determine a first pixel point in the input image; wherein the first pixel point is a pixel point within a detection frame;

[0013] Setting the mask value corresponding to the first pixel point to a preset first value;

[0014] Determine a second pixel point in the input image; wherein the second pixel point is a pixel point outside the detection frame;

[0015] The mask value corresponding to the second pixel point is set to a preset second value.

[0016] In a specific implementation of the first aspect, performing feature mask filtering on the first feature map and the second feature map respectively using the binary mask to obtain the first mask feature map and the second mask feature map may include:

[0017] Multiplying the first feature map by the binary mask element-by-element to obtain the first mask feature map;

[0018] The second feature map is element-wise multiplied by the binary mask to obtain the second mask feature map.

[0019] In a specific implementation of the first aspect, determining the loss function of the object detection student model based on the first mask feature map and the second mask feature map may include:

[0020] Determining a distillation loss function of the object detection student model according to the first mask feature map and the second mask feature map;

[0021] The loss function of the target detection student model is determined based on the preset detection task basic loss function and the distillation loss function.

[0022] In a specific implementation of the first aspect, determining the distillation loss function of the object detection student model based on the first mask feature map and the second mask feature map may include:

[0023] Determining corresponding element deviations of the first mask feature map and the second mask feature map;

[0024] Calculating the mean of the corresponding element deviations to obtain a mean of the deviations between the first mask feature map and the second mask feature map;

[0025] Determine a distillation loss function of the target detection student model based on the mean deviation value.

[0026] In a specific implementation of the first aspect, determining the loss function of the object detection student model based on the preset detection task basic loss function and the distillation loss function may include:

[0027] Based on the preset distillation weights, the basic loss function of the detection task and the distillation loss function are weighted averaged to obtain the loss function of the target detection student model.

[0028] In a specific implementation of the first aspect, after training the object detection student model based on the loss function to obtain a trained object detection model, the method may further include:

[0029] Obtain the image to be detected;

[0030] The target detection model is used to perform target detection on the image to be detected to obtain a target detection result of the image to be detected.

[0031] A second aspect of the embodiments of the present application provides a target detection model training device, which may include:

[0032] A model compression module is used to compress the preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model;

[0033] A binary mask generation module is used to generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image;

[0034] A feature mask filtering module is used to perform feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image through the target detection teacher model, and the second feature map is a feature map extracted from the input image through the target detection student model;

[0035] A loss function determination module, configured to determine a loss function of the target detection student model based on the first mask feature map and the second mask feature map;

[0036] The model training module is used to train the target detection student model based on the loss function to obtain a trained target detection model.

[0037] In a specific implementation of the second aspect, the binary mask generation module can be specifically used to: determine a first pixel point in the input image; wherein the first pixel point is a pixel point within the detection frame; set the mask value corresponding to the first pixel point to a preset first value; determine a second pixel point in the input image; wherein the second pixel point is a pixel point outside the detection frame; set the mask value corresponding to the second pixel point to a preset second value.

[0038] In a specific implementation of the second aspect, the feature mask filtering module can be specifically used to: multiply the first feature map by the binary mask element by element to obtain the first mask feature map; and multiply the second feature map by the binary mask element by element to obtain the second mask feature map.

[0039] In a specific implementation of the second aspect, the loss function determination module may include:

[0040] a distillation loss function determining unit, configured to determine a distillation loss function of the object detection student model based on the first mask feature map and the second mask feature map;

[0041] A loss function determination unit is used to determine the loss function of the target detection student model based on a preset detection task basic loss function and the distillation loss function.

[0042] In a specific implementation of the second aspect, the distillation loss function determination unit can be specifically used to: determine the corresponding element deviations of the first mask feature map and the second mask feature map; perform mean calculation on the corresponding element deviations to obtain the mean deviation between the first mask feature map and the second mask feature map; and determine the distillation loss function of the target detection student model based on the mean deviation.

[0043] In a specific implementation of the second aspect, the loss function determination unit can be specifically used to: based on a preset distillation weight, perform weighted averaging on the basic loss function of the detection task and the distillation loss function to obtain the loss function of the target detection student model.

[0044] In a specific implementation of the second aspect, the target detection model training device may further include:

[0045] The target detection module is used to obtain an image to be detected; use the target detection model to perform target detection on the image to be detected, and obtain a target detection result of the image to be detected.

[0046] A third aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned target detection model training methods.

[0047] The fourth aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned target detection model training methods when executing the computer program.

[0048] A fifth aspect of an embodiment of the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the steps of any one of the above-mentioned target detection model training methods.

[0049] Compared with the prior art, the beneficial effects of the embodiments of the present application are as follows: the embodiments of the present application perform model compression on the preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model; generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the image background area; perform feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is the feature map extracted from the input image via the target detection teacher model, and the second feature map is the feature map extracted from the input image via the target detection student model; determine the loss function of the target detection student model based on the first mask feature map and the second mask feature map; train the target detection student model based on the loss function to obtain a trained target detection model. Through the embodiments of the present application, the background area of ​​the image can be filtered out by a binary mask, and only the information of the object area is retained, thereby achieving targeted knowledge distillation and effectively improving the detection performance of the trained model. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0051] Figure 1 This is a flow chart of an embodiment of a target detection model training method in an embodiment of the present application;

[0052] Figure 2 Output diagram of target detection model for input image;

[0053] Figure 3 This is a structural diagram of an embodiment of a target detection model training device in an embodiment of the present application;

[0054] Figure 4 This is a schematic block diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described below are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0056] It will be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0057] It should also be understood that the terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0058] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0059] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0060] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0061] With the rapid development of artificial intelligence (AI) and deep learning technologies, AI vision algorithms have been widely used in various smart devices, especially in the field of household robots such as sweepers. During operation, sweepers need to detect obstacles in the environment, identify furniture, and distinguish the material of the ground in real time and accurately to ensure their efficient and safe operation. However, in actual deployment, sweepers have strict requirements on computing resources and power consumption, which requires the visual model to achieve a lightweight design while maintaining high detection performance. Knowledge distillation technology provides a way to make up for this shortcoming by transferring knowledge from a large-scale, high-precision teacher model to a student model with fewer parameters.

[0062] However, in object detection tasks, the background area usually occupies most of the image, which easily interferes with the knowledge alignment between the teacher model and the student model, resulting in insufficient knowledge transfer of the object area and affecting the final detection performance.

[0063] In view of this, the embodiments of the present application provide a target detection model training method, device, computer-readable storage medium and electronic device to solve the problem of poor detection performance of the trained model existing in the existing target detection model training method.

[0064] In an embodiment of the present application, a binary mask can be used to filter out the background area of ​​the image and only retain the information of the object area, thereby achieving targeted knowledge distillation and effectively improving the detection performance of the trained model.

[0065] The execution subject of the embodiment of the present application can be an electronic device, which may include but is not limited to mobile phones, tablet computers, desktop computers, notebooks, PDAs, sweepers, robots, and servers. It should be noted that the electronic device for model training and the electronic device for target detection can be the same electronic device or different electronic devices. That is, the model training can be performed in one electronic device, and then the trained model can be deployed to another electronic device for target detection.

[0066] See also Figure 1 In one embodiment of the present application, a method for training a target detection model may include:

[0067] Step S101: compress the preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model.

[0068] In the embodiments of the present application, a large-scale obstacle detection dataset for a sweeper robot can be used to train a preset artificial intelligence model to obtain an object detection teacher model. The model structure of the artificial intelligence model can be flexibly configured according to the actual situation and may include, but is not limited to, YOLO, EfficientDet, RetinaNet, or other model structures, which are not specifically limited in the embodiments of the present application.

[0069] like Figure 2 As shown, the target detection teacher model can perform target detection on the input image, and the model prediction information output by it can include the prediction box and the corresponding category and confidence information.

[0070] In an embodiment of the present application, model compression technologies such as channel pruning can be used to compress a lightweight target detection student model based on the target detection teacher model, retain the core feature extraction channel, and reduce redundant parameters.

[0071] Step S102: Generate a binary mask corresponding to the input image.

[0072] In the embodiment of the present application, for each input image, a binary mask M∈{0,1} for filtering out the background area of ​​the image can be generated according to the detection box (BoundingBox) marked on it. H×W , where H and W are the height and width of the input image.

[0073] Specifically, the first pixel point in the input image can be determined, and the mask value corresponding to the first pixel point is set to a preset first value (i.e., 1). The first pixel point is a pixel point within the detection frame, that is, a pixel point in the object area. The second pixel point in the input image can also be determined, and the mask value corresponding to the second pixel point is set to a preset second value (i.e., 0). The second pixel point is a pixel point outside the detection frame, that is, a pixel point in the background area. For example, if a pixel point (i, j) is within the detection frame, it can be used as the first pixel point and M(i, j) = 1 is set. Conversely, if it is outside the detection frame, it can be used as the second pixel point and M(i, j) = 0 is set.

[0074] Step S103: Perform feature mask filtering on the first feature map and the second feature map respectively through a binary mask to obtain a first mask feature map and a second mask feature map.

[0075] Among them, the first feature map is the feature map extracted by the target detection teacher model of the input image, and the second feature map is the feature map extracted by the target detection student model of the input image.

[0076] In an embodiment of the present application, the first feature map may be element-wise multiplied by the binary mask to obtain a first mask feature map, and the second feature map may be element-wise multiplied by the binary mask to obtain a second mask feature map, as shown in the following formula:

[0077]

[0078] Among them, F T is the first feature map, F S is the second feature map, is the Hadamard product (element-wise multiplication), F T ′ is the first mask feature map, F S ′ is the second mask feature map.

[0079] By filtering with a binary mask, the feature information of the background area of ​​the image can be filtered out, and only the feature information of the object area can be retained.

[0080] Step S104: Determine the loss function of the target detection student model based on the first mask feature map and the second mask feature map.

[0081] In an embodiment of the present application, a distillation loss function of the target detection student model can be determined based on the first mask feature map and the second mask feature map.

[0082] Specifically, the corresponding element deviations of the first mask feature map and the second mask feature map can be determined first, and then the corresponding element deviations can be averaged to obtain the mean deviation between the first mask feature map and the second mask feature map. Finally, the distillation loss function of the target detection student model can be determined based on the mean deviation, as shown in the following formula:

[0083]

[0084] in, is the number of first pixels in the input image, used to normalize the loss, L distill is the distillation loss function.

[0085] After determining the distillation loss function, the loss function of the target detection student model can be determined based on the preset detection task basic loss function and the distillation loss function. The detection task basic loss function may include a classification loss function and a position loss function. The specific form of the loss function can be found in the prior art content and will not be described in detail in the present embodiment.

[0086] In this embodiment of the present application, the basic loss function of the detection task and the distillation loss function can be weighted averaged based on the preset distillation weights to obtain the loss function of the target detection student model, as shown in the following formula:

[0087] L total =L stu +λ·L distill

[0088] Wherein, λ is a preset distillation weight used to balance the basic loss function and the distillation loss function of the detection task. Its specific value can be flexibly set according to the actual situation, and is not specifically limited in the embodiment of the present application. stu is the basic loss function for the detection task, L total Loss function for the student model for object detection.

[0089] Step S105: Train the target detection student model based on the loss function to obtain a trained target detection model.

[0090] In each batch of model training, the training loss value of the batch can be calculated according to the loss function, and the model parameters can be adjusted according to the training loss value. In the embodiment of the present application, it is assumed that in the initial state, the model parameter is W1, and the training loss value is back-propagated to modify the model parameter W1 to obtain the modified model parameter W2. After modifying the parameters, the next training process is continued. In this training process, the training loss value is recalculated and the training loss value is back-propagated to modify the model parameter W2 to obtain the modified model parameter W3, ..., and so on. The above process is repeated continuously. The model parameters can be modified in each training process until the preset training conditions are met. The training condition can be that the number of training times reaches a preset number threshold. The number threshold can be set according to actual conditions. For example, it can be set to thousands, tens of thousands, hundreds of thousands or even larger values; the training condition can also be model convergence; since the number of training times may not reach the number threshold, but the model has converged, it may cause unnecessary work to be repeated; or the model may not converge, which may lead to an infinite loop and the training process cannot be terminated. Based on the above two situations, the training condition can also be that the number of training times reaches the number threshold or the model converges. When the training conditions are met, the trained target detection model can be obtained.

[0091] After the target detection model is trained, the target detection model can be used to perform actual target detection. Specifically, an image to be detected can be obtained, and the target detection model can be used to perform target detection on the image to be detected, thereby obtaining a target detection result for the image to be detected.

[0092] In summary, the embodiment of the present application performs model compression on the preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model; generates a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image; performs feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image via the target detection teacher model, and the second feature map is a feature map extracted from the input image via the target detection student model; determines the loss function of the target detection student model based on the first mask feature map and the second mask feature map; trains the target detection student model based on the loss function to obtain a trained target detection model. Through the embodiment of the present application, the background area of ​​the image can be filtered out by a binary mask, and only the information of the object area is retained, thereby achieving targeted knowledge distillation and effectively improving the detection performance of the trained model.

[0093] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean 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.

[0094] Corresponding to the target detection model training method described in the above embodiment, Figure 3 A structural diagram of an embodiment of a target detection model training device provided in an embodiment of the present application is shown.

[0095] In this embodiment, a target detection model training device may include:

[0096] A model compression module 301 is used to compress a preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model;

[0097] A binary mask generation module 302 is configured to generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image;

[0098] A feature mask filtering module 303 is configured to perform feature mask filtering on the first feature map and the second feature map respectively using the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image via the target detection teacher model, and the second feature map is a feature map extracted from the input image via the target detection student model;

[0099] A loss function determination module 304 is configured to determine a loss function of the object detection student model based on the first mask feature map and the second mask feature map;

[0100] The model training module 305 is used to train the target detection student model based on the loss function to obtain a trained target detection model.

[0101] In a specific implementation method of an embodiment of the present application, the binary mask generation module can be specifically used to: determine a first pixel point in the input image; wherein the first pixel point is a pixel point within the detection frame; set the mask value corresponding to the first pixel point to a preset first value; determine a second pixel point in the input image; wherein the second pixel point is a pixel point outside the detection frame; set the mask value corresponding to the second pixel point to a preset second value.

[0102] In a specific implementation of an embodiment of the present application, the feature mask filtering module can be specifically used to: multiply the first feature map by the binary mask element by element to obtain the first mask feature map; and multiply the second feature map by the binary mask element by element to obtain the second mask feature map.

[0103] In a specific implementation of the embodiment of the present application, the loss function determination module may include:

[0104] a distillation loss function determining unit, configured to determine a distillation loss function of the object detection student model based on the first mask feature map and the second mask feature map;

[0105] A loss function determination unit is used to determine the loss function of the target detection student model based on a preset detection task basic loss function and the distillation loss function.

[0106] In a specific implementation of an embodiment of the present application, the distillation loss function determination unit can be specifically used to: determine the corresponding element deviations of the first mask feature map and the second mask feature map; perform mean calculation on the corresponding element deviations to obtain the mean deviation between the first mask feature map and the second mask feature map; and determine the distillation loss function of the target detection student model based on the mean deviation.

[0107] In a specific implementation of an embodiment of the present application, the loss function determination unit can be specifically used to: based on a preset distillation weight, perform weighted averaging on the basic loss function of the detection task and the distillation loss function to obtain the loss function of the target detection student model.

[0108] In a specific implementation of the embodiment of the present application, the target detection model training device may further include:

[0109] The target detection module is used to obtain an image to be detected; use the target detection model to perform target detection on the image to be detected, and obtain a target detection result of the image to be detected.

[0110] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0111] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0112] Figure 4 A schematic block diagram of an electronic device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0113] like Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40. When the processor 40 executes the computer program 42, the steps in the above-mentioned target detection model training method embodiments are implemented, such as Figure 1 Alternatively, when the processor 40 executes the computer program 42, the functions of the modules / units in the above-mentioned device embodiments are realized, for example, Figure 3 Functions of modules 301 to 305 are shown.

[0114] Exemplarily, the computer program 42 may be divided into one or more modules / units, which are stored in the memory 41 and executed by the processor 40 to implement the present application. The one or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 42 in the electronic device 4.

[0115] The electronic device 4 may include but is not limited to mobile phones, tablet computers, desktop computers, notebooks, PDAs, sweepers, robots, servers and other computing devices. It will be understood by those skilled in the art that Figure 4 It is only an example of the electronic device 4 and does not constitute a limitation on the electronic device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 4 may also include input and output devices, network access devices, buses, etc.

[0116] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0117] The memory 41 may be an internal storage unit of the electronic device 4, such as a hard disk or memory of the electronic device 4. The memory 41 may also be an external storage device of the electronic device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. Furthermore, the memory 41 may include both an internal storage unit of the electronic device 4 and an external storage device. The memory 41 is used to store the computer program and other programs and data required by the electronic device 4. The memory 41 may also be used to temporarily store data that has been output or is about to be output.

[0118] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by 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 embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0119] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0120] Those skilled in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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.

[0121] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0122] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0123] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0124] If the integrated module / unit is implemented in the form of 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, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0125] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A target detection model training method, characterized in that: include: Performing model compression on a preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model; Generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image; Performing feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image by the target detection teacher model, and the second feature map is a feature map extracted from the input image by the target detection student model; Determining a loss function of the object detection student model based on the first mask feature map and the second mask feature map; The target detection student model is trained based on the loss function to obtain a trained target detection model.

2. The target detection model training method according to claim 1, characterized in that Generating a binary mask corresponding to the input image includes: Determine a first pixel point in the input image; wherein the first pixel point is a pixel point within a detection frame; Setting the mask value corresponding to the first pixel point to a preset first value; Determine a second pixel point in the input image; wherein the second pixel point is a pixel point outside the detection frame; The mask value corresponding to the second pixel point is set to a preset second value.

3. The target detection model training method according to claim 1, characterized in that The step of performing feature mask filtering on the first feature map and the second feature map respectively by using the binary mask to obtain the first mask feature map and the second mask feature map comprises: Multiplying the first feature map by the binary mask element-by-element to obtain the first mask feature map; The second feature map is element-wise multiplied by the binary mask to obtain the second mask feature map.

4. The target detection model training method according to claim 1, characterized in that Determining a loss function of the target detection student model according to the first mask feature map and the second mask feature map includes: Determining a distillation loss function of the object detection student model according to the first mask feature map and the second mask feature map; The loss function of the target detection student model is determined based on the preset detection task basic loss function and the distillation loss function.

5. The target detection model training method according to claim 4, characterized in that: Determining a distillation loss function of the target detection student model according to the first mask feature map and the second mask feature map includes: Determining corresponding element deviations of the first mask feature map and the second mask feature map; Calculating the mean of the corresponding element deviations to obtain a mean of the deviations between the first mask feature map and the second mask feature map; Determine a distillation loss function of the target detection student model based on the mean deviation value.

6. The target detection model training method according to claim 4, characterized in that: Determining the loss function of the target detection student model based on the preset detection task basic loss function and the distillation loss function includes: Based on the preset distillation weights, the basic loss function of the detection task and the distillation loss function are weighted averaged to obtain the loss function of the target detection student model.

7. The target detection model training method according to any one of claims 1 to 6, characterized in that: After training the target detection student model based on the loss function to obtain a trained target detection model, the method further includes: Obtain the image to be detected; The target detection model is used to perform target detection on the image to be detected to obtain a target detection result of the image to be detected.

8. A target detection model training device, characterized in that: include: A model compression module is used to compress the preset target detection teacher model to obtain a target detection student model corresponding to the target detection teacher model; A binary mask generation module is used to generate a binary mask corresponding to the input image; wherein the binary mask is used to filter out the background area of ​​the image; A feature mask filtering module is used to perform feature mask filtering on the first feature map and the second feature map respectively through the binary mask to obtain a first mask feature map and a second mask feature map; wherein the first feature map is a feature map extracted from the input image through the target detection teacher model, and the second feature map is a feature map extracted from the input image through the target detection student model; A loss function determination module, configured to determine a loss function of the target detection student model based on the first mask feature map and the second mask feature map; The model training module is used to train the target detection student model based on the loss function to obtain a trained target detection model.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the target detection model training method according to any one of claims 1 to 7 are implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the target detection model training method according to any one of claims 1 to 7 are implemented.