CN115761320B - Image detection methods, devices, target classification models, media, equipment and products - Google Patents

Image detection methods, devices, target classification models, media, equipment and products

Info

Publication number
CN115761320B
CN115761320B CN202211402940.4A CN202211402940A CN115761320B CN 115761320 B CN115761320 B CN 115761320B CN 202211402940 A CN202211402940 A CN 202211402940A CN 115761320 B CN115761320 B CN 115761320B
Authority
CN
China
Prior art keywords
sample
classification model
target
uncertainty
target classification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211402940.4A
Other languages
Chinese (zh)
Other versions
CN115761320A (en
Inventor
曹佳炯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Digital Service Technology Co ltd
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Digital Service Technology Co ltd
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Digital Service Technology Co ltd, Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Digital Service Technology Co ltd
Priority to CN202211402940.4A priority Critical patent/CN115761320B/en
Publication of CN115761320A publication Critical patent/CN115761320A/en
Application granted granted Critical
Publication of CN115761320B publication Critical patent/CN115761320B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)

Abstract

本说明书实施例提供一种图像检测方法及装置、目标分类模型、计算机可读存储介质、电子设备以及计算机程序产品,该方法包括:先确定目标分类模型,该模型是通过来自第一数据域的训练样本训练得到的,也就是说,其适用于第一数据域中待测图像的检测。基于该模型确定来自上述第一数据域的第一目标样本集所对应的第一不确定性估计,以及确定来自第二数据域(另一数据域)的第二目标样本集所对应的第二不确定性估计。进一步地,根据第一不确定性估计和第二不确定性估计,确定特征偏移量,该特征偏移量能够表征第二数据域与第一数据域之间的特征变化。最终,根据上述目标分类模型和上述特征偏移量,能够确定关于第二数据域中待测图像的检测结果。

This specification provides an image detection method and apparatus, a target classification model, a computer-readable storage medium, an electronic device, and a computer program product. The method includes: first, determining a target classification model, which is trained using training samples from a first data domain, meaning it is suitable for detecting images to be tested in the first data domain. Based on the model, determining a first uncertainty estimate corresponding to a first target sample set from the first data domain, and determining a second uncertainty estimate corresponding to a second target sample set from a second data domain (another data domain). Further, based on the first and second uncertainty estimates, determining a feature offset, which characterizes the feature changes between the second and first data domains. Finally, based on the target classification model and the feature offset, determining the detection result for the image to be tested in the second data domain.

Description

Image detection method, device, object classification model, medium, equipment and product
Technical Field
The present disclosure relates to the field of face recognition technology, and in particular, to an image detection method and apparatus, a target classification model, a computer readable storage medium, an electronic device, and a computer program product.
Background
Currently, a deep learning model for performing identity recognition based on images is a mainstream identity recognition scheme, and because deep learning is data driven, when an identity recognition model applicable to a certain scene is used in another new scene (cross-domain identity recognition problem), the performance of the model is drastically reduced.
Aiming at the cross-domain identification problem, the related art provides a solution to set an identification model for each use scene, specifically, training a new model for the data of the scene whenever the new scene needs to be adapted. However, as the number of scenes increases, the number of models increases linearly, and efficient maintenance is not possible.
It should be noted that the information disclosed in the foregoing background section is only for enhancement of understanding of the background of the present specification and thus may include information that does not form the prior art that is already known to those of ordinary skill in the art.
Disclosure of Invention
The present specification aims to provide an image detection method and apparatus, a target classification model, a computer-readable storage medium, an electronic device, and a computer program product, which can contribute to reduction in the number of maintenance at least to some extent while ensuring recognition accuracy.
Additional features and advantages of the present description will be set forth in the detailed description which follows, or in part will be apparent from the practice of the present description.
According to one aspect of the specification, an image detection method is provided, and the method comprises the steps of determining a target classification model, wherein the target classification model is obtained through training of training samples from a first data field, determining a first uncertainty estimation corresponding to a first target data set through the target classification model, the first target data set is from the first data field, determining a second uncertainty estimation corresponding to a second target data set through the target classification model, the second target data set is from the second data field, determining a characteristic offset according to the first uncertainty estimation and the second uncertainty estimation, and determining a detection result related to an image to be detected in the second data field according to the target classification model and the characteristic offset.
In an exemplary embodiment, the objective classification model comprises an attention mechanism-based discarding structure comprising a squeeze excitation block and a discarding unit, wherein the probability of discarding each element in the training sample by the discarding unit during training from the first data field is determined by the squeeze excitation block adaptive calculation.
In an exemplary embodiment, based on the foregoing scheme, the first uncertainty estimation includes a sample uncertainty estimation, the first target data set includes N samples, N is a positive integer, the determining the first uncertainty estimation corresponding to the first target data set by the target classification model includes performing perturbation processing on at least one local area of an ith sample, respectively, taking a perturbation sample obtained after the perturbation processing as an ith sample subset, i is a positive integer not greater than N, determining the sample uncertainty estimation corresponding to the ith sample by the target classification model without starting the discarding unit, and determining the sample uncertainty estimation included in the first uncertainty estimation according to the sample uncertainty estimation respectively corresponding to the N samples.
In an exemplary embodiment, based on the foregoing, the determining, by the target classification model, a sample uncertainty estimate corresponding to the ith sample without activating the decommissioning unit includes inputting each sample in the ith sample subset to the target classification model without activating the decommissioning unit, respectively, and counting a plurality of outputs of the target classification model to obtain the sample uncertainty estimate corresponding to the ith sample.
In an exemplary embodiment, based on the foregoing scheme, the determining the first uncertainty estimate corresponding to the first target data set by the target classification model further includes inputting the ith sample at least twice into the target classification model when the discarding unit is started, determining a model uncertainty estimate corresponding to the ith sample according to an output of the target classification model, and determining a model uncertainty estimate included in the first uncertainty estimate according to model uncertainty estimates corresponding to the N samples, respectively.
In an exemplary embodiment, based on the foregoing, the step of inputting the ith sample at least twice into the target classification model when the discarding unit is started, and determining the model uncertainty estimate corresponding to the ith sample according to the output of the target classification model, includes inputting the ith sample to twice into the target classification model when the discarding unit is started, and counting a plurality of outputs of the target classification model to obtain the model uncertainty estimate corresponding to the ith sample.
In an exemplary embodiment, based on the foregoing, the method further comprises determining the first uncertainty estimate based on a preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.
In an exemplary embodiment, based on the foregoing scheme, the determining the detection result regarding the image to be detected in the second data domain according to the target classification model and the feature offset includes inputting the image to be detected in the second data domain into the target classification model, wherein the feature input to a classification layer of the target classification model is determined as a target image feature, superimposing the feature offset onto the target image feature to obtain an offset image feature, and performing classification processing on the offset image feature through the classification layer to obtain the detection result regarding the image to be detected in the second data domain.
According to another aspect of the specification, a target classification model is provided, and the target classification model comprises a main network and an attention mechanism-based abandon structure, wherein the attention mechanism-based abandon structure is embedded in the main network;
The target classification model is obtained through training samples from a first data domain, the discarding unit adaptively calculates and determines the probability of discarding each element in the training samples by the extrusion excitation block in the training process of the training samples from the first data domain, the target classification model is used for determining a first uncertainty estimation corresponding to a first target data set and a second uncertainty estimation corresponding to a second target data set, the second target data set is from a second target data set of the second data domain, and the target classification model is further used for determining a detection result related to an image to be detected in the second data domain according to a characteristic offset, wherein the characteristic offset is determined according to the first uncertainty estimation and the second uncertainty estimation.
According to still another aspect of the present specification, there is provided an image detection apparatus including a model determination module, an uncertainty estimation determination module, an offset determination module, and a detection module.
The model determining module is used for determining a target classification model, wherein the target classification model is obtained through training of training samples from a first data field, the uncertainty estimation determining module is used for determining first uncertainty estimation corresponding to a first target data set through the target classification model, the first target data set is from the first data field, the uncertainty estimation module is also used for determining second uncertainty estimation corresponding to a second target data set through the target classification model, the second target data set is from the second data field, the offset determining module is used for determining a characteristic offset according to the first uncertainty estimation and the second uncertainty estimation, and the detecting module is used for determining a detection result of an image to be detected in the second data field according to the target classification model and the characteristic offset.
According to still another aspect of the present specification, there is provided an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the image detection method as in the above embodiment when executing the computer program.
According to an aspect of the present specification, there is provided a computer-readable storage medium having stored therein instructions which, when executed on a computer or a processor, cause the computer or the processor to perform the image detection method as in the above embodiment.
According to another aspect of the present description, there is provided a computer program product containing instructions which, when run on a computer or processor, cause the computer or processor to perform the image detection method as in the above embodiments.
The image detection method and apparatus, the object classification model, the computer-readable storage medium, the electronic device, and the computer program product provided in the embodiments of the present disclosure have the following technical effects:
In the solution provided in the embodiments of the present disclosure, a target classification model is first determined, where the model is obtained by training a training sample from a first data field, that is, the model is suitable for detecting an image to be detected in the first data field. A first uncertainty estimate corresponding to a first target data set from the first data domain is determined based on the model, and a second uncertainty estimate corresponding to a second target data set from a second data domain (another data domain) is determined. Further, a characteristic offset is determined from the second uncertainty estimate and the first uncertainty estimate, the characteristic offset being capable of characterizing a characteristic change between the second data domain and the first data domain. Finally, according to the target classification model and the characteristic offset, a detection result about the image to be detected in the second data domain can be determined. Therefore, in the scheme provided by the embodiment of the specification, the target classification model of the first data domain can detect the image to be detected in the second data domain, and meanwhile, the technical effects of considering the maintenance cost of the model and the performance of cross-domain adaptation can be achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and together with the description, serve to explain the principles of the specification. It is obvious that the drawings in the following description are only some embodiments of the present specification, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a flowchart of an image detection method according to an embodiment of the present disclosure.
Fig. 2 is a flowchart of an image detection method according to another embodiment of the present disclosure.
Fig. 3 is a schematic structural diagram of a target classification model according to an embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a disuse structure based on an attention mechanism according to an embodiment of the present disclosure.
Fig. 5 is a flow chart of a method for determining a sample uncertainty estimate according to an embodiment of the present disclosure.
Fig. 6 is a flow chart of a method for determining a sample uncertainty estimate for a single sample according to an embodiment of the present disclosure.
Fig. 7 is a flow chart of a method for determining model uncertainty estimation according to an embodiment of the present disclosure.
Fig. 8 is a flow chart of a method for determining model uncertainty estimation for a single sample according to an embodiment of the present disclosure.
Fig. 9 is a flowchart of an image detection method according to another embodiment of the present disclosure.
Fig. 10 is a schematic structural diagram of an image detection device according to another embodiment of the present disclosure.
Fig. 11 is a schematic structural diagram of an image detection device according to an embodiment of the present disclosure.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present specification more apparent, the following detailed description of the embodiments of the present specification will be given with reference to the accompanying drawings.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present description as detailed in the accompanying claims.
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many different forms and should not be construed as limited to the examples set forth herein, but rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present specification. One skilled in the relevant art will recognize, however, that the aspects of the specification may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known aspects have not been shown or described in detail to avoid obscuring aspects of the description.
Furthermore, the drawings are only schematic illustrations of the present specification and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
To implement the problem of cross-domain identification, the cross-domain living solutions can be divided into two types, differentiated according to the deployment model version. The first type is as described in the background art, and an identification model is set for each use scene; the second type is a cross-domain living detection method based on single model iteration. Such methods maintain one identity model (typically deployed at a cloud server) for all scenarios. Whenever a new scene is accessed, the model needs to be optimized and adapted. Although only one model is needed to be maintained in the method, the maintenance cost is low, and the overall performance of the model is poor because one model is used in all scenes.
The embodiments of the present specification provide an image detection method and apparatus, an object classification model, a computer-readable storage medium, an electronic device, and a computer program product, which can solve the problems existing in the related art. Specifically, the following details an image detection method embodiment and an object classification model embodiment provided in the present specification by referring to fig. 1 to 9:
fig. 1 is a schematic flow chart of an image detection method according to an embodiment of the present disclosure. Referring to FIG. 1, the embodiment shown in this figure includes S110-S140.
In S110, a target classification model is determined, wherein the target classification model is trained by training samples from the first data domain.
The object classification model in the embodiments of the present disclosure is trained by training samples from the first data domain, that is, the object classification model is applicable to classification prediction of images in the first data domain. For example, for the image a to be measured from the first data field, the classification result about the image a to be measured can be obtained with high accuracy by the target classification model. However, the classification of the image B to be measured cannot be accurately predicted only by inputting the image B to be measured from another data field into the target classification model, which is obtained by training the model with the training sample from the first data field.
In exemplary embodiments, face image-based identification has been rapidly developed and widely used in recent years. While it provides convenience for people's production and life, new safety problems have also emerged. Living body attacks are one of the major security threats faced by current face recognition systems. An attacker can carry out living body attack through means such as a mobile phone photo, a paper mask, a silica gel mask and the like. Once a living attack is successful, the property security and information security of the user are greatly threatened, and thus living attack detection (living attack prevention technique) is necessary. The living body anti-attack is an algorithm technology for detecting and intercepting living body attacks (including attack behaviors such as mobile phone photos, paper photos, masks and the like) in a face recognition system.
It can be seen that the above-described object classification model may be a model for in-vivo protection against attacks. It will be understood, of course, that the embodiment of the present specification will be described taking a model for preventing an attack of a living body as an example, and the object classification model may also be used for distinguishing an identity or the like, and the embodiment of the present specification does not limit the specific function of the object classification model for performing image detection.
For example, different data fields may correspond to different model usage scenarios in which the model application environment is different, the functionality is different, etc. The model use scene can be an office access control use scene, an identity recognition scene of a subway station and the like, and a plurality of scene terminals for paying by face recognition. The second data field in the following embodiments may be an identification scene corresponding to a station such as a subway or a scene of payment by face recognition, etc. in the case where the above-described first data field corresponds to a use scene of an office entrance guard.
The target classification model applicable to the use scene of the office entrance guard cannot obtain a prediction result with high accuracy if the target classification model is directly used for the identification scene of stations such as subways or the scene of payment through the face recognition mode. The embodiment provided by the specification provides a scheme capable of solving the problem of cross-domain identification, and meanwhile, the technical effects of considering the model maintenance cost and the performance of cross-domain adaptation can be achieved. Therefore, for example, the target classification model applicable to the use scene of the office entrance guard can be also used for the identification scene of stations such as subways and the like or the scene of payment through the face recognition mode, and the classification result with high accuracy can be obtained.
In S120, a first uncertainty estimate corresponding to a first target data set from the first data field is determined by the target classification model. And, in S130, determining a second deterministic estimate corresponding to a second target data set from a second data domain by the target classification model.
In an exemplary embodiment, referring to FIG. 2, in one aspect, a first target data set 22 from a first data field is input to a target classification model 300, and the first uncertainty estimate 24 is determined based on the output of the target classification model 300. On the other hand, a second target data set 22 'from a second data domain is input to the target classification model 300, and the second uncertainty estimate 24' is determined based on the output of the target classification model 300. Further, in the present description, the uncertainty difference between two data fields is taken as the feature migration 25, and further, the feature migration 25 is applied to the image 26 to be measured in the new field (i.e. the second data field), so that the classification 27 of the image to be measured in the new field can be predicted by using the target classification model 300.
Where uncertainty estimation refers to outputting a gaussian distribution with mean and variance instead of a predictive probability when predicting using a deep learning model.
In the exemplary embodiment, the uncertainty corresponding to the data field includes two aspects, namely "sample uncertainty estimation", and because of the difference of data between different data fields, "sample uncertainty estimation" is used as the first aspect of uncertainty corresponding to the data field in the embodiment of the present specification. On the other hand, the same model also has differences in the activated neural units in processing data in different data domains, so that "model uncertainty estimation" is used as the second aspect of uncertainty corresponding to the data domain in the embodiments of the present specification. Through the uncertainty of the two aspects, the difference between the two data domains can be effectively measured to determine the characteristic migration quantity, and the accuracy of data detection in the new domain is further ensured based on the characteristic migration quantity.
In an exemplary embodiment, the object classification model 300 is described in detail. For the traditional target classification model, only a single prediction result of a single model structure can be given, and the uncertainty of the model cannot be effectively estimated. In the solution provided in the embodiment of the present disclosure, in order to effectively estimate uncertainty of a model in an inference stage, a result of providing a target classification model includes a main network and an attention mechanism-based discard structure (attention-based discard), where the attention mechanism-based discard structure is embedded in the main network, and the main network may be any classification network. By way of example, referring to fig. 3, a classical CNN (Convolutional Neural Networks, convolutional neural network) Resnet network structure is illustrated as the primary network.
Referring to fig. 3, in the exemplary embodiment, each residual block (residual block) 36 of the Resnet network structure is followed by an attention-based discard structure (attention-based discard) 400. It will be appreciated that the main network Resnet network structure employed in the embodiments of the present description contains 7 residual blocks, and in other exemplary embodiments, the above-described attention mechanism-based discard structure may be embedded after at least one residual block of the main network, e.g., the attention mechanism-based discard structure may be embedded after the 1 st residual block, the attention mechanism-based discard structure may be embedded after the 7 th residual block, etc., and after the attention mechanism-based discard structure is embedded, the model result may be used to determine the model uncertainty estimate.
Therein, attention mechanism based override structure (attention-based dropout) 400 may refer to fig. 4, and an attention mechanism based override structure (attention-based dropout) 400 includes a SE block (Squeeze and Excitation block, squeeze stimulus block) 410 and an override unit (dropout) 420.
It should be noted that, unlike the conventional dropout (the probability of discarding each element in the image is the same), the probability of discarding each element in the image provided by the embodiment of the present disclosure is not the same, and in the embodiment of the present disclosure, during the training process by the training sample from the first data field, the probability of discarding each element in the training sample by the discarding unit dropout 420 is determined by the SE block 410 through adaptive calculation, which is beneficial to protecting important neurons in the model, and further beneficial to improving the overall performance of the model. On the other hand, dropout 420 based may enable the uncertainty estimate of the model to be determined by multiple inferences of the same sample in the model inference phase.
In an exemplary embodiment, in the training process of the target classification model, the dropout 420 is in an on state, image features corresponding to the training samples respectively flow into the SE block 410 and the dropout 420 after passing through the residual block 36, and the probability of discarding each element in the training samples obtained by adaptive learning of the SE block 410 is further output to the dropout 420, so that the dropout 420 can discard the corresponding element in the training samples according to the obtained probability of discarding each element in the training samples.
In an exemplary embodiment, in the training process of the target classification model, the input of the model is a face image from the first data field, and the output of the model is a living body attack probability corresponding to each training sample. The adopted loss function is a classification loss function, specifically, based on the network structure and the loss function of the model, training is performed by an SGD (Stochastic GRADIENT DESCENT, random gradient descent) mode until the model converges.
Further, an embodiment of determining a first uncertainty estimate based on the above-described object classification model trained from training samples from a first data field is described below. As described above, the first uncertainty estimate includes a sample uncertainty estimate and a model uncertainty estimate. The following describes a determination embodiment of a sample uncertainty estimate in connection with fig. 5 and 6, and a determination embodiment of a model uncertainty estimate in connection with fig. 7 and 8. It will be appreciated that in order to ensure the accuracy of the determination of the first uncertainty estimate, the samples used to determine the sample uncertainty estimate and the model uncertainty estimate are identical, both using the first target data set described above. If the first target data set includes N samples, N is a positive integer.
In an exemplary embodiment, referring to FIG. 5, an embodiment of a determination method for sample uncertainty estimation provided by the figure includes S510-S530.
In S510, each of the at least one partial areas of the i-th sample is subjected to a disturbance process, and the disturbance samples obtained after the disturbance process are used as i-th sample subsets, i being a positive integer not greater than N.
Illustratively, referring to fig. 6, the i-th sample is region segmented, and the face image may be segmented into portions, e.g., eyes, mouth, nose, cheek, hair, background, etc., by a face segmentation model. Further, perturbation (e.g., gaussian blur, random erase, etc.) is performed on different image regions, for example, a mouth region in an i-th sample is subjected to gaussian blur to obtain an i 1-th perturbation sample, an eye region in the i-th sample is subjected to gaussian blur to obtain an i 2-th perturbation sample,. In this embodiment, the disturbance sample obtained after the above-described at least one disturbance process is taken as the i-th sample subset 62. The above-described sample processing scheme is referred to as a region-based data augmentation scheme (region-based augmentation) in the embodiments of the present specification.
With continued reference to fig. 5, in S520, a sample uncertainty estimate corresponding to the ith sample is determined by the target classification model without activating a discard unit.
It can be understood that in the process of determining the sample uncertainty estimation, the present embodiment may obtain different outputs about the ith sample after disturbing the ith sample subset obtained after each disturbance sample in the ith sample subset is respectively input into the target classification model, so that the sample uncertainty estimation can be implemented without turning on the reject unit dropout.
Illustratively, referring to FIG. 6, each sample in the ith subset of samples is input to the target classification model 64, respectively, without the reject unit dropout being enabled. Further, a plurality of outputs of the target classification model are counted to obtain a sample uncertainty estimation corresponding to the ith sample. For example, after the i1 st disturbance sample inputs the target classification model 64 of the reject unit dropout not being turned on, the model outputs the probability p i1 that the i1 st disturbance sample belongs to the attack object, after the i2 nd disturbance sample inputs the target classification model 64 of the reject unit dropout not being turned on, the i i2 is input, after the i2 nd disturbance sample inputs the target classification model 64 of the reject unit dropout not being turned on, the model outputs the probability p i2 that the i2 nd disturbance sample belongs to the attack object, the model outputs the probability p ix that the ix disturbance sample belongs to the attack object. Further, counting the average value of the probabilities (p i1,pi2,…,pix) to obtain a sample uncertainty estimation of a single sample, namely obtaining a sample uncertainty estimation corresponding to the ith sample. In other embodiments, other statistics (e.g., variance, etc.) of the probability (p i1,pi2,…,pix) described above may also be used as the sample uncertainty estimate for the i-th sample.
With continued reference to fig. 5, in S530, a sample uncertainty estimate included in the first uncertainty estimate is determined from sample uncertainty estimates corresponding to the N samples, respectively.
Illustratively, the sample uncertainty estimates of the first data domain may be determined by further counting the sample uncertainty estimates corresponding to the N samples, respectively. For example, the mean of the sample uncertainty estimates for the N samples may be counted as the sample uncertainty estimate for the first data field. In other embodiments, other statistics (e.g., variance, etc.) of the sample uncertainty estimates for the N samples may also be used as the sample uncertainty estimates for the first data field.
In an exemplary embodiment, referring to FIG. 7, an embodiment of a determination method for model uncertainty estimation provided by the figure includes S710-S720.
It can be understood that in the process of determining the model uncertainty estimation, the present embodiment may not obtain the subset of the ith sample by disturbing the ith sample, but if the reject unit dropout is turned off, after inputting the ith sample into the target classification model multiple times, the output of the ith sample is single, so that the reject unit dropout needs to be turned on to realize the model uncertainty estimation.
In S710, in the case of starting the discarding unit, the i-th sample is input to the target classification model at least twice, and a model uncertainty estimate corresponding to the i-th sample is determined from the output of the target classification model.
Illustratively, referring to FIG. 8, the ith sample is input into the target classification model multiple times (y times, y being a positive integer greater than 1) to yield a probability of model output of p' i1,p'i2,…,p'iy, respectively. Further, the mean value of the probability (p' i1,p'i2,…,p'iy) is counted to obtain the model uncertainty estimation of the single sample, namely the model uncertainty estimation corresponding to the ith sample is obtained. In other embodiments, other statistics (e.g., variance, etc.) of the probability (p' i1,p'i2,…,p'iy) described above may also be used as the model uncertainty estimate for the i-th sample.
In S720, a model uncertainty estimate included in the first uncertainty estimate is determined according to the model uncertainty estimates corresponding to the N samples, respectively.
For example, the model uncertainty estimates of the first data domain may be determined by counting the model uncertainty estimates corresponding to the N samples. For example, the mean of the model uncertainty estimates for the N samples may be counted as the model uncertainty estimate for the first data domain. In other embodiments, other statistics (e.g., variance, etc.) of the model uncertainty estimates for the N samples described above may also be used as model uncertainty estimates for the first data domain.
Thus far, a determination embodiment has been described with respect to the sample uncertainty estimation and model uncertainty estimation of the first data field described above. It will be appreciated that the statistical value types used are consistent, such as the average value, during the model uncertainty estimation of a single sample (S520), during the model uncertainty estimation of a single sample (S710). During the model uncertainty estimation of the whole sample (S530), and during the model uncertainty estimation of the whole sample (S720), the statistical value types adopted are consistent, such as average values.
Further, the influence coefficients may be set according to the model uncertainty estimation and the influence degree of the sample uncertainty estimation on the feature migration amount, respectively. For example, the model uncertainty estimate M1 has an influence coefficient of 0.3 and the sample uncertainty estimate M2 has an influence coefficient of 0.7, the first uncertainty estimate may be expressed as 0.3 XM1+0.7 XM2.
It should be noted that, since the embodiment for obtaining the second uncertainty estimate (embodiment of S130) is similar to the embodiment for obtaining the first uncertainty estimate (embodiment of S120), the difference is only that the first target data set is from the first data field and the second target data set is from the second data field. Thus, embodiments of the second uncertainty estimate may refer to embodiments of the first uncertainty estimate.
In an exemplary embodiment, referring to fig. 2, after determining the first uncertainty estimate and the second uncertainty estimate, the specification uses a difference between the first uncertainty estimate and the second uncertainty estimate as a feature migration amount 25, and further, applies the feature migration amount 25 to the image 26 to be measured in the new domain (i.e., the second data domain), so as to implement the classification 27 of predicting the image to be measured in the new domain by using the target classification model 300. In an exemplary embodiment, the above-mentioned present feature migration amount 25 is superimposed before the image feature corresponding to the image to be measured in the second data field enters the classification layer of the target classification model.
For example, referring to fig. 9, in the case of using Resnet network structure as the main network, the image 90 to be measured from the second data domain is input to the target classification model 300 (no dropout unit is required to be turned on at this time), and after the image features corresponding to the image 90 to be measured are sequentially processed by the convolution layer 32, the max-pooling layer 34, and the multiple sets of residual blocks and the attention-based discard structure, the image features are input to the average pooling layer 38, and in this embodiment, the features of the classification layer (i.e., the full connection layer 310) input to the target classification model are determined as target image features.
In an exemplary embodiment of the present disclosure, referring to fig. 9, the feature offset 25 is superimposed on the target image feature to obtain an offset image feature. The detection result of the image to be detected 90 in the second data domain can be obtained by classifying the image features after the offset by the classifying layer (i.e., the full connection layer 310). For example, referring to fig. 9, the prediction result of the image to be measured 90 is P, and if P is greater than the preset threshold P, the image to be measured may be determined to be an attack object, otherwise, if P is not greater than the preset threshold P, the image to be measured may be determined to be not an attack object but a living body. For example, in the case where P is greater than the preset threshold value P, it may be determined that the image P to be measured may be an attack object such as a mobile phone photo, a paper mask, a silicone mask, or the like, and in the case where P is not greater than the preset threshold value P, it may be determined that the image P to be measured is derived from a living body. As can be seen, the present description embodiments enable high-precision in-vivo detection (i.e., cross-domain in-vivo detection) between different data domains using the same set of in-vivo algorithms.
In other embodiments, where the Resnet network structure is used as the primary network, the feature offset 25 may be further added to other layers of the object classification model (e.g., added to the input features of the average pooling layer 38) as shown in fig. 9, which is not limited in this disclosure.
Because the offset image features contain the difference between the two data fields, even if the image to be measured is from a new field (namely, the second data field), accurate classification can be realized through the target classification model applicable to the first data field. Therefore, if a target classification model S applicable to a usage scenario of an office entrance guard exists, after determining a characteristic offset between a second data field (corresponding to an identification scenario of a station such as a subway) and a first data field (corresponding to a usage scenario of an office entrance guard), the model S may be used for the identification scenario of the station such as the subway, and meanwhile, the technical effect of taking into account the maintenance cost of the model and the performance of cross-domain adaptation may be achieved.
In the solution provided in the embodiments of the present disclosure, a target classification model is first determined, where the model is obtained by training a training sample from a first data field, that is, the model is suitable for detecting an image to be detected in the first data field. Specifically, on one hand, a spoil structure (attention-based dropout) based on an attention mechanism is added in the target classification model, so that the model uncertainty estimation can be effectively determined through the target classification model, and on the other hand, the sample uncertainty estimation can be effectively determined in a mode of a region-based data addition scheme (region-based augmentation) in the embodiment of the specification. More specifically, a first uncertainty estimate corresponding to a first target data set from the first data domain is determined based on the model, and a second uncertainty estimate corresponding to a second target data set from a second data domain (another data domain) is determined. Further, a characteristic offset is determined from the second uncertainty estimate and the first uncertainty estimate, the characteristic offset being capable of characterizing a characteristic change between the second data domain and the first data domain.
Finally, based on the above-described feature offset including various uncertainty estimates, a detection result regarding the image to be detected in the second data domain can be determined. Therefore, in the scheme provided by the embodiment of the specification, the target classification model of the first data domain can detect the image to be detected in the second data domain, and a special model is not required to be maintained for each scene, and meanwhile, compared with the cross-domain living body detection method based on single model iteration, the cross-domain classification accuracy of the scheme is high. Therefore, the room provided by the embodiment of the specification has the technical effect of taking the model maintenance cost and the cross-domain adaptation performance into consideration.
It should be noted that the above-described figures are only schematic illustrations of processes involved in the method according to the exemplary embodiments of the present specification, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
The following are device embodiments of the present specification that may be used to perform method embodiments of the present specification. For details not disclosed in the device embodiments of the present specification, please refer to the method embodiments of the present specification.
In this case, fig. 10 is a schematic diagram showing the structure of an image detection apparatus to which an embodiment of the present specification can be applied. Referring to fig. 10, the image detection apparatus shown in the figure may be implemented as all or a part of the electronic device by software, hardware, or a combination of both, or may be integrated on a server as a separate module, or may be integrated in the electronic device as a separate module.
The image detection apparatus 1000 described above in the embodiment of the present specification includes a model determination module 1010, an uncertainty estimation determination module 1020, an offset determination module 1030, and a detection module 1040.
The model determining module 1010 is configured to determine a target classification model, where the target classification model is obtained by training a training sample from a first data domain, the uncertainty estimation determining module 1020 is configured to determine a first uncertainty estimation corresponding to a first target data set through the target classification model, the first target data set being from the first data domain, the uncertainty estimation determining module 1020 is further configured to determine a second uncertainty estimation corresponding to a second target data set through the target classification model, the second target data set being from the second data domain, the offset determining module 1030 is configured to determine a feature offset based on the first uncertainty estimation and the second uncertainty estimation, and the detecting module 1040 is configured to determine a detection result regarding an image to be detected in the second data domain based on the target classification model and the feature offset.
In an exemplary embodiment, fig. 11 schematically shows a structural diagram of an image detection apparatus according to another exemplary embodiment of the present specification. Please refer to fig. 11:
In an exemplary embodiment, the objective classification model comprises an attention mechanism-based discarding structure comprising a squeeze excitation block and a discarding unit, wherein the probability of discarding each element in the training sample by the discarding unit during training from the first data field is determined by the squeeze excitation block adaptive calculation.
In an exemplary embodiment, based on the foregoing, the first uncertainty estimate comprises a sample uncertainty estimate, the first target data set comprises N samples, N is a positive integer;
the uncertainty estimation determination module 1020 includes a perturbation unit 10202, a first prediction unit 10204, and a first determination unit 10206.
The method includes a first determining unit 10202 configured to determine a sample uncertainty estimate corresponding to an i-th sample by using the target classification model without starting the discarding unit, and a first determining unit 10206 configured to determine the sample uncertainty estimate included in the first uncertainty estimate according to the sample uncertainty estimates corresponding to the N-th samples, wherein the i-th sample is a subset of the i-th sample obtained after the disturbance processing, i is a positive integer not greater than N, and the target classification model is used for determining the sample uncertainty estimate corresponding to the i-th sample.
In an exemplary embodiment, based on the foregoing, the first prediction unit 10204 is specifically configured to input each sample in the ith sample subset to the target classification model separately without starting the discarding unit, and calculate a plurality of outputs of the target classification model to obtain a sample uncertainty estimate corresponding to the ith sample.
In an exemplary embodiment, the first uncertainty estimate further comprises a model uncertainty estimate, the uncertainty estimate determination module 1020 further comprises a second prediction unit 10204 'and a second determination unit 10206', based on the foregoing scheme.
The second prediction unit 10204 'is configured to input the ith sample into the target classification model at least twice when the discarding unit is started, determine a model uncertainty estimate corresponding to the ith sample according to an output of the target classification model, and the second determination unit 10206' is configured to determine a model uncertainty estimate included in the first uncertainty estimate according to model uncertainty estimates corresponding to the N samples, respectively.
In an exemplary embodiment, based on the foregoing scheme, the second prediction unit 10204' is specifically configured to input the ith sample to the target classification model twice when the discarding unit is started, and calculate a plurality of outputs of the target classification model to obtain a model uncertainty estimate corresponding to the ith sample.
In an exemplary embodiment, based on the foregoing scheme, the uncertainty estimation determination module 1020 is further configured to determine the first uncertainty estimation based on a preset influence coefficient, the sample uncertainty estimation, and the model uncertainty estimation.
In an exemplary embodiment, based on the foregoing scheme, the detection module 1040 is specifically configured to input an image to be detected from the second data domain into the target classification model, where a feature of a classification layer input into the target classification model is determined as a target image feature, superimpose the feature offset onto the target image feature to obtain an offset image feature, and classify the offset image feature by the classification layer to obtain a detection result about the image to be detected in the second data domain.
It should be noted that, in the image detection apparatus provided in the foregoing embodiment, only the division of the foregoing functional modules is used as an example when the image detection method is executed, and in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above.
In addition, the image detection device and the image detection method provided in the foregoing embodiments belong to the same concept, so for details not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the image detection method described in the present disclosure, and the details are not repeated here.
Fig. 12 schematically shows a structural diagram of an electronic device in an exemplary embodiment according to the present specification. Referring to fig. 12, an electronic device 1200 includes a processor 1201 and a memory 1202.
In the embodiment of the present disclosure, the processor 1201 is a control center of a computer system, and may be a processor of a physical machine or a processor of a virtual machine. Processor 1201 may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor 1201 may be implemented in at least one hardware form of Digital Signal Processing (DSP), field-Programmable gate array (fieldprogrammable GATE ARRAY, FPGA), programmable logic array (Programmable Logic Array, PLA). Processor 1201 may also include a main processor, which is a processor for processing data in a wake-up state, and a coprocessor, which is a low-power processor for processing data in a standby state.
In the embodiment of the present disclosure, the processor 1201 is specifically configured to:
The method comprises the steps of determining a target classification model, determining a first uncertainty estimation corresponding to a first target data set through the target classification model, determining a second uncertainty estimation corresponding to a second target data set through the target classification model, determining a characteristic offset according to the first uncertainty estimation and the second uncertainty estimation, and determining a detection result of an image to be detected in the second data field according to the target classification model and the characteristic offset.
Further, the target classification model comprises an attention mechanism-based discarding structure, the attention mechanism-based discarding structure comprises a squeezing excitation block and a discarding unit, and the discarding unit adaptively calculates and determines the probability of discarding each element in a training sample by the squeezing excitation block in the training process of training the sample by the first data field.
The first uncertainty estimation comprises sample uncertainty estimation, wherein the first target data set comprises N samples, N is a positive integer, the first uncertainty estimation corresponding to the first target data set is determined through the target classification model, the first uncertainty estimation comprises the steps of respectively carrying out disturbance processing on at least one local area of an ith sample, taking the disturbance sample obtained after the disturbance processing as an ith sample subset, i is a positive integer not greater than N, determining the sample uncertainty estimation corresponding to the ith sample through the target classification model under the condition that the discarding unit is not started, and determining the sample uncertainty estimation included in the first uncertainty estimation according to the sample uncertainty estimation corresponding to the N samples.
Further, the determining the sample uncertainty estimate corresponding to the ith sample by the target classification model without activating the discarding unit includes inputting each sample in the ith sample subset to the target classification model without activating the discarding unit, and counting a plurality of outputs of the target classification model to obtain the sample uncertainty estimate corresponding to the ith sample.
The first uncertainty estimation further comprises a model uncertainty estimation, wherein the determining of the first uncertainty estimation corresponding to the first target data set through the target classification model comprises the steps of inputting the ith sample into the target classification model at least twice when the discarding unit is started, determining the model uncertainty estimation corresponding to the ith sample according to the output of the target classification model, and determining the model uncertainty estimation included in the first uncertainty estimation according to the model uncertainty estimation corresponding to the N samples.
Further, the step of inputting the ith sample at least twice into the target classification model when the discarding unit is started, and determining a model uncertainty estimate corresponding to the ith sample according to an output of the target classification model includes inputting the ith sample to the target classification model at least twice when the discarding unit is started, and counting a plurality of outputs of the target classification model to obtain a model uncertainty estimate corresponding to the ith sample.
Further, the processor 1201 is further specifically configured to determine the first uncertainty estimate based on a preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.
Further, the determining of the detection result of the image to be detected in the second data domain according to the target classification model and the feature offset includes inputting the image to be detected in the second data domain into the target classification model, wherein the feature of the classification layer input into the target classification model is determined as a target image feature, superimposing the feature offset onto the target image feature to obtain an offset image feature, and classifying the offset image feature through the classification layer to obtain the detection result of the image to be detected in the second data domain.
Memory 1202 may include one or more computer-readable storage media, which may be non-transitory. Memory 1202 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments of the present description, a non-transitory computer readable storage medium in memory 1202 is used to store at least one instruction for execution by processor 1201 to implement the methods in embodiments of the present description.
In some embodiments, the electronic device 1200 further includes a peripheral interface 1203 and at least one peripheral. The processor 1201, the memory 1202, and the peripheral interface 1203 may be connected by a bus or signal lines. The individual peripheral devices may be connected to the peripheral device interface 1203 via buses, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a display 1204, a camera 1205, and an audio circuit 1206.
The peripheral interface 1203 may be used to connect at least one Input/Output (I/O) related peripheral to the processor 1201 and the memory 1202. In some embodiments of the present description, the processor 1201, the memory 1202, and the peripheral interface 1203 are integrated on the same chip or circuit board, and in some other embodiments of the present description, either or both of the processor 1201, the memory 1202, and the peripheral interface 1203 may be implemented on separate chips or circuit boards. The embodiment of the present specification is not particularly limited thereto.
The display 1204 is for displaying a User Interface (UI). The UI may include graphics, text, icons, video, and any combination thereof. When the display 1204 is a touch display, the display 1204 also has the ability to collect touch signals at or above the surface of the display 1204. The touch signal may be input as a control signal to the processor 1201 for processing. At this time, the display 1204 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments of the present disclosure, the display 1204 may be one, and provide a front panel of the electronic device 1200, in other embodiments of the present disclosure, the display 1204 may be at least two, and provided on different surfaces or in a folded design of the electronic device 1200, respectively, and in still other embodiments of the present disclosure, the display 1204 may be a flexible display, provided on a curved surface or a folded surface of the electronic device 1200. Even more, the display 1204 may be arranged in an irregular pattern other than rectangular, i.e., a shaped screen. The display 1204 may be made of a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), an Organic Light-Emitting Diode (OLED), or other materials.
The camera 1205 is used to capture images or video. Optionally, the camera 1205 includes a front camera and a rear camera. In general, a front camera is disposed on a front panel of an electronic device, and a rear camera is disposed on a rear surface of the electronic device. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments of the present description, the camera 1205 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuit 1206 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and the environment, and converting the sound waves into electric signals to be input to the processor 1201 for processing. For purposes of stereo acquisition or noise reduction, the microphone may be multiple and separately disposed at different locations of the electronic device 1200. The microphone may also be an array microphone or an omni-directional pickup microphone.
The power supply 1207 is used to power the various components in the electronic device 1200. The power source 1207 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power source 1207 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
The block diagrams of the electronic device structures shown in the embodiments of the present description do not constitute a limitation of the electronic device 1200, and the electronic device 1200 may include more or less components than illustrated, or may combine some components, or may employ different arrangements of components.
In the description of the present specification, it should be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the terms in this specification will be understood by those of ordinary skill in the art in the light of the specific circumstances. In addition, in the description of the present specification, unless otherwise indicated, "a plurality" means two or more. "and/or" describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate that there are three cases of a alone, a and B together, and B alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
The present description also provides a computer-readable storage medium having instructions stored therein, which when executed on a computer or processor, cause the computer or processor to perform one or more steps of the above embodiments. Each of the constituent blocks of the image detection apparatus may be stored in the computer-readable storage medium if implemented in the form of a software functional unit and sold or used as a separate product. Each of the constituent blocks of the image detection apparatus may be stored in the computer-readable storage medium if implemented in the form of a software functional unit and sold or used as a separate product.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product described above includes one or more computer instructions. When the computer program instructions described above are loaded and executed on a computer, the processes or functions described in accordance with the embodiments of the present specification are all or partially produced. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted across a computer-readable storage medium. The computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (Digital Subscriber Line, DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage media may be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital versatile disk (DIGITAL VERSATILE DISC, DVD)), or a semiconductor medium (e.g., a Solid state disk (Solid STATE DISK, SSD)), or the like.
It should be noted that the foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The foregoing is merely specific embodiments of the present disclosure, but the scope of the disclosure is not limited thereto, and any person skilled in the art who is skilled in the art can easily think about variations or substitutions within the scope of the disclosure of the present disclosure, and it is intended to cover the variations or substitutions within the scope of the disclosure. Accordingly, equivalent variations from the claims of the present specification are intended to be covered by the present specification.

Claims (10)

1.一种图像检测方法,其中,所述方法包括:1. An image detection method, wherein the method comprises: 确定目标分类模型,其中,所述目标分类模型为通过来自第一数据域的训练样本训练得到,所述目标分类模型包括:基于注意力机制的弃用结构,所述基于注意力机制的弃用结构包括:挤压激励块和弃用单元;在通过来自所述第一数据域训练样本训练过程中,所述弃用单元对训练样本中每个元素被丢弃的概率由所述挤压激励块自适应计算确定;所述第一数据域的所述训练样本为图像;A target classification model is determined, wherein the target classification model is trained using training samples from a first data domain, and the target classification model includes: an attention-based discard structure, wherein the attention-based discard structure includes: a squeeze activation block and a discard unit; during the training process using training samples from the first data domain, the probability of each element in the training sample being discarded by the discard unit is adaptively calculated and determined by the squeeze activation block; the training samples in the first data domain are images; 对第一目标数据集中第i样本的至少一个局部区域分别进行扰动处理,将所述扰动处理之后得到的扰动样本作为第i样本子集,所述第一目标数据集来自所述第一数据域,所述第一目标数据集中各样本为图像,所述第一目标数据集包括N个样本,N为正整数,i为不大于N的正整数;在不启动所述弃用单元的情况下,将所述第i样本子集中的每个样本分别输入至所述目标分类模型;统计所述目标分类模型的多个输出,得到所述第i样本对应的样本不确定性估计;根据所述N个样本分别对应的样本不确定性估计,确定所述第一目标数据集的第一不确定性估计所包括的样本不确定性估计;At least one local region of the i-th sample in the first target dataset is perturbed, and the perturbed sample obtained after the perturbing is taken as the i-th sample subset. The first target dataset comes from the first data domain, and each sample in the first target dataset is an image. The first target dataset includes N samples, where N is a positive integer and i is a positive integer not greater than N. Without activating the discard unit, each sample in the i-th sample subset is input into the target classification model. Multiple outputs of the target classification model are counted to obtain the sample uncertainty estimate corresponding to the i-th sample. Based on the sample uncertainty estimates corresponding to the N samples, the sample uncertainty estimate included in the first uncertainty estimate of the first target dataset is determined. 通过所述目标分类模型确定第二目标数据集对应的第二不确定性估计,所述第二目标数据集来自第二数据域;The second uncertainty estimate corresponding to the second target dataset is determined by the target classification model, wherein the second target dataset comes from the second data domain; 根据所述第一不确定性估计和所述第二不确定性估计,确定特征偏移量;The feature offset is determined based on the first uncertainty estimate and the second uncertainty estimate; 根据所述目标分类模型和所述特征偏移量,确定关于所述第二数据域中待测图像的检测结果。Based on the target classification model and the feature offset, the detection result for the image to be tested in the second data domain is determined. 2.根据权利要求1所述的方法,其中,所述第一不确定性估计还包括:模型不确定性估计;2. The method according to claim 1, wherein the first uncertainty estimation further includes: model uncertainty estimation; 所述方法还包括:The method further includes: 在启动所述弃用单元的情况下,将所述第i样本至少两次输入所述目标分类模型,根据所述目标分类模型的输出确定所述第i样本对应的模型不确定性估计;When the deprecation unit is activated, the i-th sample is input into the target classification model at least twice, and the model uncertainty estimate corresponding to the i-th sample is determined based on the output of the target classification model; 根据所述N个样本分别对应的模型不确定性估计,确定所述第一不确定性估计所包括的模型不确定性估计。Based on the model uncertainty estimates corresponding to the N samples, the model uncertainty estimates included in the first uncertainty estimate are determined. 3.根据权利要求2所述的方法,其中,所述在启动所述弃用单元的情况下,将所述第i样本至少两次输入所述目标分类模型,根据所述目标分类模型的输出确定所述第i样本对应的模型不确定性估计,包括:3. The method according to claim 2, wherein, when the deprecation unit is activated, inputting the i-th sample into the target classification model at least twice, and determining the model uncertainty estimate corresponding to the i-th sample based on the output of the target classification model, comprises: 在启动所述弃用单元的情况下,将所述第i样本至两次输入至所述目标分类模型;When the discard unit is activated, the i-th sample is input into the target classification model once or twice; 统计所述目标分类模型的多个输出,得到所述第i样本对应的模型不确定性估计。By statistically analyzing multiple outputs of the target classification model, the model uncertainty estimate corresponding to the i-th sample is obtained. 4.根据权利要求2所述的方法,其中,所述方法还包括:4. The method according to claim 2, wherein the method further comprises: 根据预设影响系数、所述样本不确定性估计和所述模型不确定性估计,确定所述第一不确定性估计。The first uncertainty estimate is determined based on the preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate. 5.根据权利要求1至4中任意一项所述的方法,其中,所述根据所述目标分类模型和所述特征偏移量,确定关于所述第二数据域中待测图像的检测结果,包括:5. The method according to any one of claims 1 to 4, wherein determining the detection result of the image to be tested in the second data domain based on the target classification model and the feature offset comprises: 将来自所述第二数据域中待测图像输入所述目标分类模型,其中,将输入至所述目标分类模型的分类层的特征确定为目标图像特征;The image to be tested from the second data domain is input into the target classification model, wherein the features of the classification layer input into the target classification model are determined as target image features; 将所述特征偏移量叠加至所述目标图像特征,得到偏移后图像特征;The feature offset is superimposed on the target image feature to obtain the offset image feature; 通过所述分类层对所述偏移后图像特征进行分类处理,得到关于所述第二数据域中待测图像的检测结果。The offset image features are classified by the classification layer to obtain the detection result of the image to be tested in the second data domain. 6.一种目标���类模型,���中,所述目标分类模型包括:6. A target classification model, wherein the target classification model comprises: 主网络和基于注意力机制的弃用结构,所述基于注意力机制的弃用结构嵌入在所述主网络中;A main network and an attention-based deprecated structure, wherein the attention-based deprecated structure is embedded in the main network; 所述基于注意力机制的弃用结构包括:挤压激励块和弃用单元;The attention-based abandonment structure includes: a squeezed excitation block and an abandonment unit; 其中,所述目标分类模型为通过来自第一数据域的训练样本训练得到;在通过来自所述第一数据域训练样本训练过程中,所述弃用单元对训练样本中每个元素被丢弃的概率由所述挤压激励块自适应计算确定;The target classification model is trained using training samples from the first data domain; during the training process using training samples from the first data domain, the probability that the discard unit discards each element in the training sample is adaptively calculated by the squeeze excitation block. 所述目标分类模型,用于对第一目标数据集中第i样本的至少一个局部区域分别进行扰动处理,将所述扰动处理之后得到的扰动样本作为第i样本子集,所述第一目标数据集来自所述第一数据域,所述第一目标数据集包括N个样本,N为正整数,i为不大于N的正整数;在不启动所述弃用单元的情况下,确定所述第i样本对应的样本不确定性估计;根据所述N个样本分别对应的样本不确定性估计,确定所述第一目标数据集的第一不确定性估计所包括的样本不确定性估计;The target classification model is used to perturb at least one local region of the i-th sample in the first target dataset, and take the perturbed sample obtained after the perturbation as the i-th sample subset. The first target dataset comes from the first data domain and includes N samples, where N is a positive integer and i is a positive integer not greater than N. Without activating the discard unit, the model determines the sample uncertainty estimate corresponding to the i-th sample. Based on the sample uncertainty estimates corresponding to the N samples, the model determines the sample uncertainty estimate included in the first uncertainty estimate of the first target dataset. 所述目标分类模型,还用于确定第二目标数据集对应的第二不确定性估计,所述第二目标数据集来自第二数据域的第二目标数据集;The target classification model is also used to determine a second uncertainty estimate corresponding to the second target dataset, wherein the second target dataset comes from the second target dataset of the second data domain; 所述目标分类模型,还用于根据特征偏移量,确定关于所述第二数据域中待测图像的检测结果,其中,所述特征偏移量根据所述第一不确定性估计和所述第二不确定性估计确定。The target classification model is further configured to determine the detection result of the image to be tested in the second data domain based on the feature offset, wherein the feature offset is determined based on the first uncertainty estimate and the second uncertainty estimate. 7.一种图像检测装置,其中,所述装置包括:7. An image detection apparatus, wherein the apparatus comprises: 模型确定模块,用于确定目标分类模型,其中,所述目标分类模型为通过来自第一数据域的训练样本训练得到,所述目标分类模型包括:基于注意力机制的弃用结构,所述基于注意力机制的弃用结构包括:挤压激励块和弃用单元;在通过来自所述第一数据域训练样本训练过程中,所述弃用单元对训练样本中每个元素被丢弃的概率由所述挤压激励块自适应计算确定;所述第一数据域的所述训练样本为图像;A model determination module is used to determine a target classification model, wherein the target classification model is trained using training samples from a first data domain, and the target classification model includes: an attention-based discard structure, the attention-based discard structure including: a squeeze activation block and a discard unit; during the training process using training samples from the first data domain, the probability of each element in the training sample being discarded by the discard unit is adaptively calculated and determined by the squeeze activation block; the training samples in the first data domain are images; 不确定估计确定模块,用于对第一目标数据集中第i样本的至少一个局部区域分别进行扰动处理,将所述扰动处理之后得到的扰动样本作为第i样本子集,所述第一目标数据集来自所述第一数据域,所述第一目标数据集中各样本为图像,所述第一目标数据集包括N个样本,N为正整数,i为不大于N的正整数;在不启动所述弃用单元的情况下,将所述第i样本子集中的每个样本分别输入至所述目标分类模型;统计所述目标分类模型的多个输出,得到所述第i样本对应的样本不确定性估计;根据所述N个样本分别对应的样本不确定性估计,确定所述第一目标数据集的第一不确定性估计所包括的样本不确定性估计;An uncertainty estimation determination module is used to perturb at least one local region of the i-th sample in the first target dataset, and take the perturbed sample obtained after the perturbation as the i-th sample subset. The first target dataset comes from the first data domain, and each sample in the first target dataset is an image. The first target dataset includes N samples, where N is a positive integer and i is a positive integer not greater than N. Without activating the discard unit, each sample in the i-th sample subset is input into the target classification model. Multiple outputs of the target classification model are counted to obtain the sample uncertainty estimate corresponding to the i-th sample. Based on the sample uncertainty estimates corresponding to the N samples, the sample uncertainty estimate included in the first uncertainty estimate of the first target dataset is determined. 所述不确定性估计模块,还用于通过所述目标分类模型确定第二目标数据集对应的第二不确定性估计,所述第二目标数据集来自第二数据域;The uncertainty estimation module is further configured to determine a second uncertainty estimate corresponding to the second target dataset through the target classification model, wherein the second target dataset comes from the second data domain; 偏移量确定模块,用于根据所述第一不确定性估计和所述第二不确定性估计,确定特征偏移量;The offset determination module is used to determine the feature offset based on the first uncertainty estimate and the second uncertainty estimate; 检测模块,用于根据所述目标分类模型和所述特征偏移量,确定关于所述第二数据域中待测图像的检测结果。The detection module is used to determine the detection result of the image to be tested in the second data domain based on the target classification model and the feature offset. 8.一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,其中,当所述指令在计算机或处理器上运行时,使得所述计算机或处理器���行如权利要求1至5中任意一项所述的图像检测方法。8. A computer-readable storage medium storing instructions, wherein when the instructions are executed on a computer or processor, the computer or processor causes the computer or processor to perform the image detection method as described in any one of claims 1 to 5. 9.一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1至5中任意一项所述的图像检测方法。9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the image detection method as described in any one of claims 1 to 5. 10.一种包含指令的计算机程序产品,其中,当所述计算机程序产品在计算机或处理器上运行时,使得所述计算机或处理器执行如权利要求1至5中任意一项所述的图像检测方法。10. A computer program product comprising instructions, wherein when the computer program product is run on a computer or processor, the computer or processor causes the computer or processor to perform the image detection method as described in any one of claims 1 to 5.
CN202211402940.4A 2022-11-04 2022-11-04 Image detection methods, devices, target classification models, media, equipment and products Active CN115761320B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211402940.4A CN115761320B (en) 2022-11-04 2022-11-04 Image detection methods, devices, target classification models, media, equipment and products

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211402940.4A CN115761320B (en) 2022-11-04 2022-11-04 Image detection methods, devices, target classification models, media, equipment and products

Publications (2)

Publication Number Publication Date
CN115761320A CN115761320A (en) 2023-03-07
CN115761320B true CN115761320B (en) 2026-04-17

Family

ID=85368931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211402940.4A Active CN115761320B (en) 2022-11-04 2022-11-04 Image detection methods, devices, target classification models, media, equipment and products

Country Status (1)

Country Link
CN (1) CN115761320B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116681950B (en) * 2023-06-15 2026-04-14 广州秉理科技有限公司 Image processing method based on classification uncertainty

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111523663A (en) * 2020-04-22 2020-08-11 北京百度网讯科技有限公司 A model training method, device and electronic device
CN112036495A (en) * 2020-09-02 2020-12-04 常熟理工学院 Garment image classification method based on web crawler and transfer learning
CN112733970A (en) * 2021-03-31 2021-04-30 腾讯科技(深圳)有限公司 Image classification model processing method, image classification method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108846355B (en) * 2018-06-11 2020-04-28 腾讯科技(深圳)有限公司 Image processing method, face recognition device and computer equipment
CN111898683B (en) * 2020-07-31 2023-07-28 平安科技(深圳)有限公司 Image classification method and device based on deep learning and computer equipment
CN112241764B (en) * 2020-10-23 2023-08-08 北京百度网讯科技有限公司 Image recognition method, device, electronic equipment and storage medium
CN114648788A (en) * 2022-02-23 2022-06-21 北京市农林科学院 Quality evaluation method and device for image sample set and storage medium
CN114821250B (en) * 2022-03-23 2024-12-24 支付宝(杭州)信息技术有限公司 A cross-domain model training method, device and equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111523663A (en) * 2020-04-22 2020-08-11 北京百度网讯科技有限公司 A model training method, device and electronic device
CN112036495A (en) * 2020-09-02 2020-12-04 常熟理工学院 Garment image classification method based on web crawler and transfer learning
CN112733970A (en) * 2021-03-31 2021-04-30 腾讯科技(深圳)有限公司 Image classification model processing method, image classification method and device

Also Published As

Publication number Publication date
CN115761320A (en) 2023-03-07

Similar Documents

Publication Publication Date Title
CN109829433B (en) Face image recognition method, device, electronic device and storage medium
US11321575B2 (en) Method, apparatus and system for liveness detection, electronic device, and storage medium
CN111325258B (en) Feature information acquisition method, device, equipment and storage medium
CN111298445B (en) Target account detection method and device, electronic equipment and storage medium
CN118568695B (en) Digital security management method and system based on block chain
WO2021232985A1 (en) Facial recognition method and apparatus, computer device, and storage medium
CN109564618A (en) Learning model for the detection of significant facial area
CN108416265A (en) A kind of method for detecting human face, device, equipment and storage medium
US20140341443A1 (en) Joint modeling for facial recognition
CN107527053A (en) Object detection method and device
CN115810221A (en) Liveness detection method, device, medium, equipment and product
JP7114811B2 (en) Image processing method and apparatus, electronic equipment and storage medium
CN111582383B (en) Attribute identification method and device, electronic device and storage medium
CN115937596A (en) Target detection method and its model training method, device and storage medium
CN114996487B (en) Media resource recommendation method and device, electronic equipment and storage medium
CN115761320B (en) Image detection methods, devices, target classification models, media, equipment and products
CN116012851A (en) Credential detection method, credential detection device, medium, equipment and product
CN114996515A (en) Training method of video feature extraction model, text generation method and device
CN115758364A (en) Security detection method, device, equipment and medium
CN115482590B (en) Attack Target Detection Methods, Devices, Media, Equipment and Products
CN121646808A (en) Model training method and device, text image processing method, equipment and medium
CN206595991U (en) A kind of double-camera mobile terminal
CN115147608B (en) Target detection methods, target detection devices, media, equipment and products
CN114882551B (en) A face recognition processing method, device and equipment based on machine dimension
CN113486829B (en) Face liveness detection method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 310000 Zhejiang Province, Hangzhou City, Xihu District, Xixi Road 543-569 (continuous odd numbers) Building 1, Building 2, 5th Floor, Room 518

Applicant after: Alipay (Hangzhou) Digital Service Technology Co.,Ltd.

Address before: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province

Applicant before: Alipay (Hangzhou) Information Technology Co., Ltd.

Country or region before: China

GR01 Patent grant