Target detection method and apparatus
By constructing a target detection model that correlates faces with specific targets, the problem of insufficient accuracy in small target detection is solved, and more efficient and accurate specific target detection is achieved.
Patent Information
- Application Number
- CN202111447515.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In existing technologies, the small size of the target leads to poor detection accuracy, and specific target features are easily lost, resulting in missed detections.
A target detection model based on face feature extraction and specific target extraction layers based on training samples is adopted. The detection is performed by the correlation between the face and the specific target, and a total loss function is constructed to improve the detection accuracy.
It improves the accuracy and efficiency of specific target detection, avoids overfitting, and enhances the reliability of detection.
Smart Images

Figure CN114399801B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to a target detection method and device. BACKGROUND
[0002] Target detection, also known as target extraction, is an image segmentation based on target geometry and statistical features. With the development of computer technology and the wide application of computer vision principles, real-time tracking research on targets using computer image processing technology is becoming increasingly popular. Dynamic real-time tracking and positioning of targets have wide application value in intelligent traffic systems, intelligent monitoring systems, military target detection, and positioning of surgical instruments in medical navigation surgery. For example, in certain specific monitoring scenarios, behaviors such as answering the phone and smoking are not allowed, and therefore, real-time detection of behaviors such as smoking and making a phone call in the above scenarios is required to issue timely warnings.
[0003] Currently, specific target detection methods mostly use ways such as increasing the features of input, deep and shallow feature maps, attention mechanisms, and oversampling of small target data to improve small target detection accuracy. However, due to the low sample hit rate of specific targets in the detection task, and the small number of pixels and unobvious features, the specific target features are easily lost in the downsampling process, resulting in poor detection accuracy. SUMMARY
[0004] The present application provides a target detection method and device to solve the defect of missing detection due to small targets in the prior art, to realize positioning of specific targets, and to improve the accuracy of specific target detection.
[0005] The present application provides a target detection method, comprising: inputting an acquired to-be-detected picture into a target detection model to obtain a target detection result output by the target detection model; wherein the target detection model is trained based on training samples and corresponding target true values; and the target detection model is used to perform specific target detection on the to-be-detected picture based on face features extracted from the to-be-detected picture to obtain a target detection result.
[0006] According to the target detection method provided by the present application, the target detection result comprises a face detection result and a specific target detection result, and the target detection model comprises: a face feature extraction layer, which performs feature extraction based on the to-be-detected picture to obtain face features; a specific target extraction layer, which performs feature extraction on the to-be-detected picture based on the face features to obtain specific target features; a face detection layer, which performs detection based on the face features to obtain a face detection result; and a specific target detection layer, which performs detection on the specific target features to obtain a specific target detection result.
[0007] According to the target detection method provided by the present application, the feature extraction of the to-be-detected picture based on the face feature comprises: determining a to-be-detected region of the to-be-detected picture based on the face feature; and performing feature extraction on the to-be-detected region to obtain a specific target feature.
[0008] According to the target detection method provided by the present application, the training of the target detection model comprises: obtaining training samples and corresponding target true values thereof; taking the training samples as input data for training, taking the target true values corresponding to the training samples as labels, training a to-be-trained model, and obtaining a target detection model for generating a target detection result of a to-be-detected picture.
[0009] According to the target detection method provided by the present application, the training of the to-be-trained model comprises: inputting the training samples into the to-be-trained model to obtain face prediction results and specific target prediction results output by the to-be-trained model; constructing a face loss function according to the face prediction results and the target true values corresponding to the face prediction results; constructing a specific target loss function according to the specific target prediction results and the target true values corresponding to the specific target prediction results; obtaining a total loss function based on the face loss function and the specific target loss function, and ending the training based on the convergence of the total loss function.
[0010] According to the target detection method provided by the present application, the total loss function is expressed as:
[0011] L=L T +mL face
[0012] Wherein, L represents a loss function, L T represents a specific target loss function, L face represents a face loss function, and m represents a learnable variable, which is the correlation between the face and the specific target.
[0013] The present application further provides a target detection device, comprising: a target detection module, which inputs a to-be-detected picture obtained into a target detection model to obtain a target detection result output by the target detection model; wherein the target detection model is trained based on training samples and corresponding target true values thereof; and the target detection model is used for specific target detection of the to-be-detected picture based on face features extracted from the to-be-detected picture to obtain a target detection result.
[0014] The present application further 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 the target detection method according to any one of the above when executing the program.
[0015] The application further provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the target detection methods described above.
[0016] The application further provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the target detection methods described above.
[0017] The target detection method and device provided by the application extract different target features respectively, and detect specific target features based on the face features extracted first, so that the correlation between the face and the specific target is utilized for target detection, the accuracy of the target detection result is improved, and the efficiency of target detection is improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0019] Figure 1 is a flowchart of the target detection method provided by the application;
[0020] Figure 2 is an architecture diagram of the target detection model provided by the application;
[0021] Figure 3 is a flowchart of training the target detection model provided by the application;
[0022] Figure 4 is a structural diagram of the target detection device provided by the application;
[0023] Figure 5 is a structural diagram of the training module provided by the application;
[0024] Figure 6 is a structural diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0025] In order to make the objects, technical solutions and advantages of the application clearer, the technical solutions in the application will be described clearly and completely below with reference to the drawings in the application. Obviously, the described embodiments are some embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative effort fall within the protection scope of the application.
[0026] Figure 1 A flowchart of a target detection method of the present application is shown, which comprises:
[0027] The obtained to-be-detected picture is input into the target detection model to obtain a target detection result output by the target detection model.
[0028] The target detection model is trained based on training samples and corresponding target true values.
[0029] The target detection model is used to perform specific target detection on the to-be-detected picture based on the face features extracted from the to-be-detected picture, to obtain the target detection result.
[0030] The target detection method of the present application is described below in detail Figures 2-3
[0031] In an optional embodiment, before the obtained to-be-detected picture is input into the target detection model, the method further comprises: obtaining the to-be-detected picture. It should be noted that the obtained to-be-detected picture can be a picture required for behavior recognition, scene recognition, identity recognition, or other target recognition. For example, when automatic driving abnormal behavior detection is required, the obtained to-be-detected picture is derived from a video stream or at least one picture sequence captured in real time by a vehicle for a driving position; for another example, when scene recognition is required for an automatic driving vehicle, the obtained to-be-detected picture is derived from a picture sequence obtained in real time by the vehicle for the environment around the vehicle body, and the to-be-detected picture can be obtained by a radar, a sensor, or a camera of the vehicle body, and the source of the to-be-detected picture is not limited further herein.
[0032] In this embodiment, the obtained to-be-detected picture is input into the target detection model to obtain a target detection result output by the target detection model. Taking detection of specific targets such as cigarettes and mobile phones as an example, since the pixels of such objects as cigarettes and mobile phones are too small, it is not appropriate to use a detection model for a certain target (such as a cigarette or a mobile phone) for detection, and the behaviors of smoking and making a phone call are both related to a face, i.e., the behaviors of smoking and making a phone call both need to be implemented by a person, so the face, which is easier to recognize, can be relied on to detect specific targets such as cigarettes and mobile phones, thereby improving the detection accuracy of the model and avoiding overfitting.
[0033] Specifically, the target detection result comprises a face detection result and a specific target detection result, and the target detection model comprises: a face feature extraction layer, which performs feature extraction based on the to-be-detected picture to obtain face features; a specific target extraction layer, which performs feature extraction on the to-be-detected picture based on the face features to obtain specific target features; a face detection layer, which performs detection based on the face features to obtain the face detection result; and a specific target detection layer, which performs detection on the specific target features to obtain the specific target detection result.
[0034] It should be noted that after the obtained to-be-detected picture is input into the target detection model, corresponding features are extracted based on the specific feature extraction layer of the target detection model, so that detection is performed according to the extracted features respectively, and corresponding targets are obtained, so as to realize multi-target detection and greatly improve the detection efficiency. Figure 2 The target detection model includes multiple convolution layers, a specific convolution layer of which is selected to extract corresponding target features, and the specific convolution layer corresponding to the convolution layer is selected to detect the extracted target features, so as to obtain a target detection result. It should be noted that different targets correspond to different convolution layers for feature extraction and target detection.
[0035] First, the face feature extraction layer performs feature extraction based on the to-be-detected picture to obtain face features, and the specific target extraction layer performs feature extraction on the to-be-detected picture based on the face features to obtain specific target features. It should be noted that since a face is easier to be recognized than other specific targets such as cigarettes and mobile phones, the face feature extraction layer will extract face features first when performing feature extraction, and then use the association between the face and the specific targets such as cigarettes and mobile phones to quickly locate the specific targets such as cigarettes and mobile phones to quickly extract the specific target features, so as to facilitate the improvement of the detection efficiency.
[0036] Further, when performing feature extraction on the to-be-detected picture based on the face features, the following steps are included: determining a to-be-detected region of the to-be-detected picture based on the face features; and performing feature extraction on the to-be-detected region to obtain specific target features.
[0037] Second, the face detection layer performs detection based on the face features to obtain a face detection result, and the specific target detection layer performs detection on the specific target features to obtain a specific target detection result. It should be noted that the face feature extraction layer extracts face features, and the specific target detection layer detects the specific target features extracted by the specific target extraction layer, so as to use different feature layers to detect different targets, thereby improving the efficiency and accuracy of target detection.
[0038] In an optional embodiment, referring to Figure 3 The target detection model is trained, including:
[0039] S31, obtaining a training sample and a target true value corresponding thereto;
[0040] S32, taking the training sample as input data for training, taking the target true value corresponding to the training sample as a label, training the to-be-trained model, and obtaining a target detection model for generating a target detection result of a to-be-detected picture.
[0041] It should be noted that S3N in the present specification does not represent the order of training the target detection model.
[0042] In step S31, the training sample and the corresponding target true value are obtained.
[0043] In the present embodiment, the training sample and the corresponding target true value are obtained, including: collecting training videos or images, and using a face detection method to screen out videos or images containing face information as effective training samples; labeling the effective training samples to obtain the label and the corresponding bounding box information of the face, and to obtain the label and the corresponding bounding box information of specific targets such as cigarettes and phones.
[0044] It should be noted that when collecting training videos or images, the driving behaviors of different drivers in different vehicle driving environments can be recorded, the behavior videos of different drivers smoking or playing mobile phones can be recorded, and some videos of different drivers not smoking and playing mobile phones can be recorded as normal samples. In addition, online downloaded images or images taken by different specific targets can also be used as training samples.
[0045] In order to establish the relevance between specific targets and people, and considering the redundancy between consecutive video frames, when screening the collected training videos, every several frames of the video file are collected to use the face detection algorithm for processing to remove the videos not containing face information; when screening the collected images, the face detection algorithm is directly used for processing to remove the images not containing face information.
[0046] When labeling the effective training samples, the face and the specific targets such as cigarettes and mobile phones are labeled, that is, when the face and the specific targets appear in the image, the bounding box is marked, and the label is set as the face, the cigarette and / or the mobile phone, etc.
[0047] In an optional embodiment, after obtaining the training sample and the corresponding target true value, it further includes: using a data enhancement strategy to perform data enhancement on the training sample. The above-mentioned data enhancement strategy includes image scaling, horizontal mirror flipping, random adjustment of brightness and hue, etc., and the label information of each target is kept unchanged while the bounding box coordinate information is updated according to the corresponding geometric transformation method.
[0048] In step S32, the training sample is used as input data for training, the target true value corresponding to the training sample is used as a label, and the model to be trained is trained to obtain a target detection model for generating a target detection result of a to-be-detected picture.
[0049] In the embodiment, the network to be trained can be an existing network built in the training device, which generally includes a network structure, or other network specified by a user, such as a target detection network FPN, etc. The network to be trained generally includes a feature extraction layer for extracting a corresponding target feature, a target detection layer for detecting each extracted target feature, and a loss function; according to a preset iteration rule, the augmented training sample or the training sample after data augmentation is input into the to-be-trained model for training to obtain a trained target detection model.
[0050] Specifically, the training of the to-be-trained model includes: inputting the training sample into the to-be-trained model to obtain a face prediction result and a specific target prediction result output by the to-be-trained model; constructing a face loss function according to the face prediction result and a target true value corresponding to the face prediction result; constructing a specific target loss function according to the specific target prediction result and a target true value corresponding to the specific target prediction result; obtaining a total loss function based on the face loss function and the specific target loss function, and ending the training based on convergence of the total loss function.
[0051] The total loss function is represented as:
[0052] L = L T + mL face
[0053] Wherein, L represents the loss function, L T represents the specific target loss function, L face represents the face loss function, and m represents a learnable variable, which is the relevance between the face and the specific target.
[0054] In summary, the embodiments of the present application extract different target features respectively, and detect the specific target feature based on the face feature extracted first, so as to utilize the relevance between the face and the specific target for target detection, improve the accuracy of the target detection result, and improve the efficiency of the target detection.
[0055] The target detection device provided by the present application is described below, and the target detection device described below can be correspondingly referred to the target detection method described above.
[0056] Figure 4 A structural schematic diagram of a target detection device is shown, and the device includes:
[0057] The target detection module 41 inputs the acquired to-be-detected picture into the target detection model to obtain a target detection result output by the target detection model;
[0058] Wherein, the target detection model is trained based on the training sample and the target true value corresponding thereto;
[0059] The target detection model is configured to perform specific target detection on the to-be-detected picture based on the face features extracted from the to-be-detected picture, and obtain a target detection result.
[0060] In an optional embodiment, the apparatus further comprises a data acquisition module configured to acquire the to-be-detected picture. It should be noted that the to-be-detected picture acquired can be a picture required for behavior recognition, scene recognition, identity recognition, or other target recognition. For example, when automatic driving abnormal behavior detection is required, the to-be-detected picture is acquired from a video stream or at least one picture sequence captured by a vehicle in real time; for another example, when scene recognition is required for an automatic driving vehicle, the to-be-detected picture is acquired from a picture sequence acquired by the vehicle in real time from the environment around the vehicle, and the to-be-detected picture can be acquired by a radar, a sensor, or a camera of the vehicle, and the source of the to-be-detected picture is not limited herein.
[0061] In this embodiment, the target detection module 41 is configured to input the acquired to-be-detected picture into the target detection model, and obtain a target detection result output by the target detection model. Taking detection of specific targets such as cigarettes and mobile phones as an example, since the pixels of the cigarettes and mobile phones are too small, it is not suitable to use a detection model for a certain target (such as a cigarette or a mobile phone) for detection, and the behaviors of smoking and making a phone call are both related to a face, i.e., the behaviors of smoking and making a phone call both need to be implemented by a person, and therefore, the face which is easier to recognize can be relied on to detect the specific targets such as cigarettes and mobile phones, so as to improve the detection accuracy of the model and avoid overfitting.
[0062] Specifically, the target detection module 41 comprises: a face feature extraction unit configured to perform feature extraction based on the to-be-detected picture, and obtain face features; a specific target extraction unit configured to perform feature extraction on the to-be-detected picture based on the face features, and obtain specific target features; a face detection unit configured to perform detection based on the face features, and obtain a face detection result; and a specific target detection unit configured to perform detection on the specific target features, and obtain a specific target detection result.
[0063] It should be noted that after the acquired to-be-detected picture is input into the target detection model, corresponding features are extracted based on specific feature extraction layers of the target detection model, so that detection is performed according to the extracted features, and corresponding targets are obtained, so as to realize multi-target detection and greatly improve the detection efficiency.
[0064] Further, the specific target extraction unit comprises: a region selection subunit configured to determine a to-be-detected region of the to-be-detected picture based on the face features; and a feature extraction subunit configured to perform feature extraction on the to-be-detected region, and obtain the specific target features.
[0065] In an optional embodiment, the target detection model comprises a face detection model and a specific target detection model. Figure 5The device further comprises a training module for training the target detection model, and the training module comprises:
[0066] a sample acquisition unit 51 for acquiring training samples and corresponding target true values;
[0067] a training unit 52 for training the model to be trained by taking the training samples as input data and the target true values corresponding to the training samples as labels, thereby obtaining a target detection model for generating target detection results of the pictures to be detected.
[0068] In this embodiment, the sample acquisition unit 51 comprises a data acquisition subunit for acquiring training videos or images and screening videos or images containing face information as valid training samples by using a face detection method; and a labeling subunit for labeling the valid training samples to obtain labels and corresponding bounding box information of faces and labels and corresponding bounding box information of specific targets such as cigarettes and phones.
[0069] It should be noted that when acquiring training videos or images, the driving behaviors of different drivers in different vehicle driving environments can be recorded, the behavior videos of different drivers smoking or playing mobile phones can be recorded, and some videos of different drivers not smoking and playing mobile phones can be recorded as normal samples. In addition, images downloaded from the Internet or images taken by photographing different specific targets can also be used as training samples.
[0070] In order to establish the relevance between specific targets and people and consider the redundancy between consecutive video frames, when screening the acquired training videos, every several frames of the video file are acquired and processed by using a face detection algorithm to remove videos not containing face information; when screening the acquired images, the face detection algorithm is directly used for processing to remove images not containing face information.
[0071] When labeling the valid training samples, the face and specific targets such as cigarettes and mobile phones are labeled, that is, when the face and specific targets appear in the image, the bounding box thereof is marked, and the labels are set as face, cigarette and / or mobile phone, etc.
[0072] In an optional embodiment, the training module further comprises a data enhancement unit for performing data enhancement on the training samples by using a data enhancement strategy. The above-mentioned data enhancement strategy includes image scaling, horizontal mirror flipping, random adjustment of brightness and hue, etc., and the label information of each target is kept unchanged while the bounding box coordinate information is updated according to the corresponding geometric transformation method.
[0073] The training unit 52 inputs the training sample as input data used for training, and inputs the target true value corresponding to the training sample as a label, trains the to-be-trained model, and obtains a target detection model for generating a target detection result of the to-be-detected picture. It should be noted that the to-be-trained network can be an existing network built in the training device, which usually includes a network structure, or a user-specified other network, such as a target detection network FPN. The to-be-trained network usually includes a feature extraction layer for extracting a corresponding target feature, a target detection layer for detecting each extracted target feature, and a loss function; according to a preset iteration rule, the above training sample or the training sample after data augmentation is input into the to-be-trained model for training, and a trained target detection model is obtained.
[0074] The training unit 52 includes: a training subunit that inputs a training sample into a to-be-trained model to obtain a face prediction result and a specific target prediction result output by the to-be-trained model; a first loss function obtaining subunit that constructs a face loss function according to the face prediction result and a target true value corresponding to the face prediction result; a second loss function obtaining subunit that constructs a specific target loss function according to the specific target prediction result and a target true value corresponding to the specific target prediction result; and a total loss function obtaining subunit that obtains a total loss function based on the face loss function and the specific target loss function, and ends the training based on convergence of the total loss function.
[0075] It should be noted that when obtaining the total loss function, the total loss function is obtained according to a sum of a product of the face loss function and a variable learning amount and the specific target loss function, so as to facilitate learning of a specific target such as a cigarette or a mobile phone by the face feature extracted by the to-be-trained model in the training process, thereby improving the detection accuracy of the model.
[0076] Figure 6 An example of an entity structure diagram of an electronic device is shown in FIG. 1. Figure 6 As shown in FIG. 1, the electronic device can include a processor 61, a communications interface 62, a memory 63, and a communications bus 64, wherein the processor 61, the communications interface 62, and the memory 63 can communicate with each other through the communications bus 64. The processor 61 can invoke a logical instruction in the memory 63 to execute a target detection method, which includes: inputting a to-be-detected picture obtained into a target detection model to obtain a target detection result output by the target detection model; wherein the target detection model is trained based on a training sample and a target true value corresponding to the training sample; and the target detection model is used for specific target detection of the to-be-detected picture based on a face feature extracted from the to-be-detected picture, to obtain the target detection result.
[0077] In addition, the logic instructions in the memory 63 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0078] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute the target detection method provided by the above-mentioned method. The method comprises: inputting an acquired to-be-detected picture into a target detection model to obtain a target detection result output by the target detection model; wherein the target detection model is trained based on training samples and corresponding target true values; and the target detection model is used for detecting a specific target in the to-be-detected picture based on face features extracted from the to-be-detected picture, to obtain the target detection result.
[0079] In another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the target detection method provided by the above-mentioned method. The method comprises: inputting an acquired to-be-detected picture into a target detection model to obtain a target detection result output by the target detection model; wherein the target detection model is trained based on training samples and corresponding target true values; and the target detection model is used for detecting a specific target in the to-be-detected picture based on face features extracted from the to-be-detected picture, to obtain the target detection result.
[0080] The device embodiments described above are only schematic, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment. Those skilled in the art can understand and implement without creative labor.
[0081] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0082] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A target detection method, characterized in that, include: The acquired image to be detected is input into the target detection model to obtain the target detection result output by the target detection model; The target detection model is trained based on training samples and their corresponding ground truth values. The target detection model is used to perform specific target detection on the image to be detected based on the facial features extracted from the image to be detected, and to obtain the target detection result; The target detection results include face detection results and specific target detection results, and the target detection model includes: The face feature extraction layer extracts features based on the image to be detected to obtain face features; The specific target extraction layer extracts features from the image to be detected based on the facial features to obtain specific target features; The face detection layer performs detection based on the facial features to obtain the face detection result; The specific target detection layer detects the specific target features to obtain the specific target detection result.
2. The target detection method according to claim 1, characterized in that, The step of extracting features from the image to be detected based on the facial features includes: Based on the facial features, the region to be detected in the image to be detected is determined; Feature extraction is performed on the region to be detected to obtain specific target features.
3. The target detection method according to claim 1, characterized in that, Training the object detection model includes: Obtain the training samples and their corresponding target ground values; The training samples are used as input data for training, and the ground truth values of the targets corresponding to the training samples are used as labels to train the model to be trained, thereby obtaining a target detection model used to generate target detection results for the image to be detected.
4. The target detection method according to claim 3, characterized in that, The training of the model to be trained includes: The training samples are input into the model to be trained to obtain the face prediction results and specific target prediction results output by the model to be trained. Based on the face prediction result and the target ground truth value corresponding to the face prediction result, a face loss function is constructed; Based on the prediction results of the specific target and the true value of the target corresponding to the prediction results of the specific target, a loss function for the specific target is constructed; Based on the face loss function and the specific target loss function, the total loss function is obtained, and the training ends when the total loss function converges.
5. The target detection method according to claim 4, characterized in that, The total loss function is expressed as: L=L T +mL face Where L represents the loss function, L T L represents the loss function for a specific objective. face Let represent the face loss function, m represent the learnable variable, and represent the correlation between the face and a specific target.
6. A target detection device, characterized in that, include: The target detection module inputs the acquired image to be detected into the target detection model to obtain the target detection result output by the target detection model; The target detection model is trained based on training samples and their corresponding ground truth values. The target detection model is used to perform specific target detection on the image to be detected based on the facial features extracted from the image to be detected, and to obtain the target detection result; The target detection results include face detection results and specific target detection results, and the target detection model includes: The face feature extraction layer extracts features based on the image to be detected to obtain face features; The specific target extraction layer extracts features from the image to be detected based on the facial features to obtain specific target features; The face detection layer performs detection based on the facial features to obtain the face detection result; The specific target detection layer detects the specific target features to obtain the specific target detection result.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the target detection method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the target detection method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the target detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Behavior detection method and device and electronic equipment
CN112052815A