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

By deprecating the target classification model and attention mechanism, estimating uncertainty and performing feature shifting, the problem of increased model number in cross-domain identity recognition is solved, achieving efficient maintenance and high-precision cross-domain detection.

CN115761320BActive Publication Date: 2026-04-17ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
Filing Date
2022-11-04
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In the cross-domain identity recognition problem, existing technologies require setting up an identity recognition model for each use case, which leads to a linear increase in the number of models, making them difficult to maintain and causing performance degradation.

Method used

The model is trained using training samples from the first data domain through a target classification model. It combines the discarded structure of the attention mechanism and the regional data augmentation scheme to estimate uncertainty and perform cross-domain detection based on feature offsets.

Benefits of technology

While ensuring recognition accuracy, the number of models to maintain is reduced, cross-domain adaptation performance is improved, and high-precision liveness detection is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761320B_ABST
    Figure CN115761320B_ABST
Patent Text Reader

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.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification 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 Technology

[0002] Currently, deep learning models based on images for identity recognition have become the mainstream identity recognition solution. However, since deep learning is data-driven, the performance of an identity recognition model that is suitable for a certain scenario will drop sharply when it is used in another new scenario (cross-domain identity recognition problem).

[0003] To address the aforementioned cross-domain identity recognition problem, related technologies offer a solution: setting up an identity recognition model for each use case. Specifically, whenever a new scenario needs adaptation, a new model is trained using data from that scenario. However, as the number of scenarios increases, the number of models increases linearly, making efficient maintenance impossible.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this specification, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] The purpose of this specification is 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 that, while ensuring recognition accuracy, can at least to some extent help reduce the number of maintenance required.

[0006] Other features and advantages of this specification will become apparent from the following detailed description, or may be learned in part by practice of this specification.

[0007] According to one aspect of this specification, an image detection method is provided, the method comprising: determining a target classification model, wherein the target classification model is trained using training samples from a first data domain; determining a first uncertainty estimate corresponding to a first target dataset from the first data domain using the target classification model; determining a second uncertainty estimate corresponding to a second target dataset from a second data domain using the target classification model; determining a feature offset based on the first uncertainty estimate and the second uncertainty estimate; and determining a detection result for a test image in the second data domain based on the target classification model and the feature offset.

[0008] In an exemplary embodiment, based on the foregoing scheme, the target classification model includes: an attention-based discard structure, which includes: a squeeze excitation block and a discard unit; during training with 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 excitation block.

[0009] In an exemplary embodiment, based on the foregoing scheme, the first uncertainty estimation includes: sample uncertainty estimation; the first target dataset includes N samples, where N is a positive integer; determining the first uncertainty estimation corresponding to the first target dataset through the target classification model includes: perturbing at least one local region of the i-th sample, and taking the perturbed sample obtained after the perturbing as a subset of the i-th sample, where i is a positive integer not greater than N; determining the sample uncertainty estimation corresponding to the i-th sample through the target classification model without activating the discard unit; and determining the sample uncertainty estimation included in the first uncertainty estimation based on the sample uncertainty estimation corresponding to the N samples respectively.

[0010] In an exemplary embodiment, based on the foregoing scheme, determining the sample uncertainty estimate corresponding to the i-th sample through the target classification model without activating the aforementioned discard unit includes: inputting each sample in the i-th sample subset into the aforementioned target classification model without activating the aforementioned discard unit; and statistically analyzing multiple outputs of the aforementioned target classification model to obtain the sample uncertainty estimate corresponding to the i-th sample.

[0011] In an exemplary embodiment, based on the foregoing scheme, the first uncertainty estimation further includes: model uncertainty estimation; the determination of the first uncertainty estimation corresponding to the first target dataset through the target classification model includes: when the above-mentioned deprecation unit is activated, inputting the i-th sample at least twice into the target classification model, and determining the model uncertainty estimation corresponding to the i-th sample based on the output of the target classification model; and determining the model uncertainty estimation included in the first uncertainty estimation based on the model uncertainty estimation corresponding to the N samples respectively.

[0012] In an exemplary embodiment, based on the foregoing scheme, when the aforementioned discard 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, includes: when the aforementioned discard unit is activated, inputting the i-th sample into the target classification model at least twice; and, statistically analyzing multiple outputs of the target classification model to obtain the model uncertainty estimate corresponding to the i-th sample.

[0013] In an exemplary embodiment, based on the foregoing scheme, the method further includes: determining the first uncertainty estimate based on a preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.

[0014] In an exemplary embodiment, based on the foregoing scheme, determining the detection result of the image to be tested in the second data domain according to the target classification model and the feature offset includes: inputting the image to be tested from the second data domain into the target classification model, wherein the features of the classification layer input to the target classification model are determined as target image features; superimposing the feature offset onto the target image features to obtain offset image features; and classifying the offset image features through the classification layer to obtain the detection result of the image to be tested in the second data domain.

[0015] According to another aspect of this specification, a target classification model is provided, the target classification model comprising: a main network and an attention-based discard structure, wherein the attention-based discard structure is embedded in the main network; the attention-based discard structure comprises: squeezed excitation blocks and discard units;

[0016] 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 of each element in the training samples being discarded by the discard unit is adaptively calculated and determined by the squeeze excitation block. The target classification model is used to determine a first uncertainty estimate corresponding to the first target dataset and a second uncertainty estimate corresponding to the second target dataset, wherein the second target dataset is a second target dataset from the second data domain. The target classification model is also used 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.

[0017] According to another aspect of this specification, an image detection apparatus is provided, the apparatus comprising: a model determination module, an uncertainty estimation determination module, an offset determination module, and a detection module.

[0018] The aforementioned 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; the aforementioned uncertainty estimation determination module is used to determine a first uncertainty estimate corresponding to a first target dataset using the aforementioned target classification model, wherein the first target dataset comes from the aforementioned first data domain; the aforementioned uncertainty estimation module is also used to determine a second uncertainty estimate corresponding to a second target dataset using the aforementioned target classification model, wherein the second target dataset comes from the aforementioned second data domain; the aforementioned offset determination module is used to determine a feature offset based on the aforementioned first uncertainty estimate and the aforementioned second uncertainty estimate; and the aforementioned detection module is used to determine a detection result for the image to be tested in the aforementioned second data domain based on the aforementioned target classification model and the aforementioned feature offset.

[0019] According to another aspect of this specification, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image detection method as described in the above embodiments.

[0020] According to one aspect of this specification, a computer-readable storage medium is provided that stores instructions which, when executed on a computer or processor, cause the computer or processor to perform the image detection method as described in the above embodiments.

[0021] According to another aspect of this specification, a computer program product containing instructions is provided that, when the computer program product is run on a computer or processor, causes the computer or processor to perform the image detection method as described in the above embodiments.

[0022] The image detection method and apparatus, target classification model, computer-readable storage medium, electronic device, and computer program product provided in the embodiments of this specification have the following technical effects:

[0023] In the scheme provided in the embodiments of this specification, a target classification model is first determined. This model is trained using training samples from a first data domain, meaning it is suitable for detecting the image to be tested in the first data domain. Based on this model, a first uncertainty estimate corresponding to a first target dataset from the first data domain and a second uncertainty estimate corresponding to a second target dataset from a second data domain (another data domain) are determined. Further, based on the second and first uncertainty estimates, a feature offset is determined. This feature offset characterizes the feature changes between the second and first data domains. Finally, based on the target classification model and the feature offset, the detection result for the image to be tested in the second data domain can be determined. Thus, in the scheme provided in the embodiments of this specification, the target classification model from the first data domain can detect the image to be tested in the second data domain, while simultaneously achieving a technical effect that balances model maintenance costs and cross-domain adaptation performance.

[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description

[0025] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this specification and, together with the description, serve to explain the principles of this specification. It is obvious that the drawings described below are merely some embodiments of this specification, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0026] Figure 1 This is a schematic flowchart of the image detection method provided in the embodiments of this specification.

[0027] Figure 2 This is a schematic flowchart of an image detection method provided in another embodiment of this specification.

[0028] Figure 3 This is a schematic diagram of the target classification model provided in the embodiments of this specification.

[0029] Figure 4 This is a schematic diagram of the obsolete structure based on the attention mechanism provided in the embodiments of this specification.

[0030] Figure 5 This is a flowchart illustrating the method for determining sample uncertainty estimation provided in the embodiments of this specification.

[0031] Figure 6 This is a flowchart illustrating the method for determining the sample uncertainty estimation of a single sample provided in the embodiments of this specification.

[0032] Figure 7 This is a flowchart illustrating the method for determining model uncertainty estimation provided in the embodiments of this specification.

[0033] Figure 8 This is a flowchart illustrating the method for determining the model uncertainty estimation of a single sample provided in the embodiments of this specification.

[0034] Figure 9 This is a flowchart illustrating an image detection method provided in another embodiment of this specification.

[0035] Figure 10 This is a schematic diagram of the structure of an image detection device provided in another embodiment of this specification.

[0036] Figure 11 This is a schematic diagram of the structure of an image detection device provided in one embodiment of this specification.

[0037] Figure 12 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this specification. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of this specification clearer, the embodiments of this specification will be described in further detail below with reference to the accompanying drawings.

[0039] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.

[0040] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this specification more comprehensive and complete, and to fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of the embodiments described herein. However, those skilled in the art will recognize that the technical solutions described herein may be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., may be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this specification.

[0041] Furthermore, the accompanying drawings are merely illustrative diagrams of this specification and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0042] To address the issue of cross-domain identity recognition, cross-domain liveness detection solutions can be categorized into two types based on the deployed model version. The first type, as described in the background, involves setting up a separate identity recognition model for each use case. The second type is a cross-domain liveness detection method based on a single iterative model. This type of method maintains a single identity recognition model for all scenarios (typically deployed on a cloud server). Whenever a new scenario is introduced, the model needs to be optimized to adapt to the new scenario. While this method only requires maintaining one model, resulting in lower maintenance costs, the overall performance of the model is poor because it uses the same model for all scenarios.

[0043] 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, which can solve the problems existing in related technologies. Specifically, the following will first introduce... Figures 1 to 9 This specification provides a detailed description of the image detection method embodiments and the target classification model embodiments provided in this specification:

[0044] in, Figure 1 This is a schematic flowchart illustrating an image detection method provided in one embodiment of this specification. (Reference) Figure 1 The embodiment shown in the figure includes S110-S140.

[0045] In S110, a target classification model is determined, wherein the target classification model is obtained by training samples from the first data domain.

[0046] The target classification model described in the embodiments of this specification is trained using training samples from the first data domain. In other words, this target classification model is suitable for classifying and predicting images in the first data domain. For example, for a test image A from the first data domain, the target classification model can accurately determine the classification of test image A. However, if only a test image B from another data domain is input into the target classification model, since the model is trained using training samples from the first data domain, it cannot accurately predict the classification of test image B.

[0047] In exemplary embodiments, facial image-based identity recognition has experienced rapid development and widespread application in recent years. While providing convenience for people's production and lives, it has also brought new security challenges. Liveness detection is one of the main security threats currently facing facial recognition systems. Attackers can use methods such as mobile phone photos, paper masks, and silicone masks to launch liveness attacks. Once a liveness attack succeeds, the user's property and information security will be severely threatened, thus necessitating liveness detection (liveness prevention technology). Liveness prevention refers to the algorithmic technology used in facial recognition systems to detect and intercept liveness attacks (including attacks using mobile phone photos, paper photos, and masks).

[0048] It is evident that the aforementioned target classification model can be used for liveness detection. Of course, it is understood that this specification will use a model for liveness detection as an example for illustration, but the aforementioned target classification model can also be used for identity verification, etc. This specification does not limit the specific function of the aforementioned target classification model used for image detection.

[0049] For example, different data domains can correspond to different model usage scenarios, and the model application environment and functions differ in different model usage scenarios. For example, a model usage scenario can be an office access control scenario, an identity recognition scenario in subway stations, or a scenario where payment is made via facial recognition, etc. In the example where the first data domain mentioned above corresponds to the office access control usage scenario, the second data domain in the following embodiments can correspond to an identity recognition scenario in subway stations or a scenario where payment is made via facial recognition, etc.

[0050] The target classification model suitable for office access control scenarios may not achieve high-accuracy prediction results if directly applied to identity recognition scenarios in subway stations or facial recognition payment scenarios. The embodiments provided in this specification offer a solution to the cross-domain identity recognition problem, achieving a balance between model maintenance costs and cross-domain adaptability. Therefore, for example, a target classification model suitable for office access control scenarios can also be used for identity recognition scenarios in subway stations or facial recognition payment scenarios, achieving high-accuracy classification results.

[0051] In S120, a first uncertainty estimate corresponding to the first target dataset is determined using the aforementioned target classification model, wherein the first target dataset originates from the aforementioned first data domain. And in S130, a second deterministic estimate corresponding to the second target dataset is determined using the aforementioned target classification model, wherein the second target dataset originates from the second data domain.

[0052] In an exemplary embodiment, reference is made to Figure 2 On one hand, the first target dataset 22 from the first data domain is input to the 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, the second target dataset 22' from the 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. Furthermore, this specification uses the uncertainty difference between the two data domains as a feature transfer amount 25. Further, by applying this feature transfer amount 25 to the test image 26 in the new domain (i.e., the aforementioned second data domain), the classification 27 of the test image in the new domain can be predicted using the aforementioned target classification model 300.

[0053] Uncertainty estimation refers to the process of using deep learning models to make predictions, where instead of outputting a predicted probability, the model outputs a Gaussian distribution with mean and variance.

[0054] In an exemplary embodiment, the uncertainty corresponding to the aforementioned data domain includes two aspects. First, there is "sample uncertainty estimation." Since data differs between different data domains, this embodiment considers "sample uncertainty estimation" as the first aspect of the uncertainty corresponding to the data domain. Second, the activated neural units also differ when the same model processes data from different data domains. Therefore, this embodiment considers "model uncertainty estimation" as the second aspect of the uncertainty corresponding to the data domain. By using these two aspects of uncertainty, the difference between the two data domains can be effectively measured to determine the feature transfer amount, thereby ensuring the accuracy of data detection in the new domain based on the feature transfer amount.

[0055] In an exemplary embodiment, the target classification model 300 described above will be described in detail first. Traditional target classification models can only provide a single prediction result for a single model structure, and cannot effectively estimate the uncertainty of the model. In the solution provided in the embodiments of this specification, in order to effectively estimate the uncertainty of the model during the inference stage, the result of the target classification model is provided as follows: The target classification model includes: a main network and an attention-based dropout structure, wherein the attention-based dropout structure is embedded in the main network, and the main network can be any classification network. For example, refer to... Figure 3 The classic CNN (Convolutional Neural Networks) ResNet18 network structure will be used as the main network for illustration.

[0056] refer to Figure 3In this exemplary embodiment, an attention-based dropout 400 is embedded after each residual block 36 of the ResNet18 network structure. It is understood that the main ResNet18 network structure used in this embodiment contains 7 residual blocks. In other exemplary embodiments, the aforementioned attention-based dropout can be embedded after at least one residual block of the main network, for example, after the first residual block, and after the seventh residual block, etc. After embedding the attention-based dropout, the model results can be used to determine the model uncertainty estimate.

[0057] Among them, the attention-based dropout structure 400 can be referenced. Figure 4 An attention-based dropout structure 400 includes an SE block (Squeeze and Excitation block) 410 and a dropout unit 420.

[0058] It is important to note that, unlike traditional dropout (which has a uniform probability of discarding each element in an image), the dropout provided in this embodiment does not have a uniform probability of discarding each element in an image. In this embodiment, during training with training samples from the first data domain, the probability of each element in the training samples being discarded by the dropout unit 420 is adaptively calculated and determined by the SE block 410. This helps protect important neurons in the model, thereby improving the overall performance of the model. Furthermore, dropout 420 allows for the determination of model uncertainty estimates during the inference phase by performing multiple inferences on the same sample.

[0059] In an exemplary embodiment, during the training process of the target classification model described above, dropout 420 is enabled. The image features corresponding to the training samples are fed into SE block 410 and dropout 420 after passing through residual block 36. Furthermore, the probability of each element in the training sample being dropped, obtained by adaptive learning in SE block 410, is also output to dropout 420. Thus, dropout 420 can drop the corresponding element in the training sample according to the obtained probability of each element in the training sample being dropped.

[0060] In an exemplary embodiment, during the training of the target classification model described above, the input to the model is a face image from the first data domain, and the output of the model is the liveness attack probability corresponding to each training sample. The loss function used is the classification loss function. Specifically, based on the network structure and loss function of the model described above, training is performed using SGD (Stochastic Gradient Descent) until the model converges.

[0061] Furthermore, the following describes an embodiment for determining the first uncertainty estimate based on the aforementioned target classification model trained using training samples from the first data domain. As mentioned above, the first uncertainty estimate includes sample uncertainty estimation and model uncertainty estimation. The following combines... Figure 5 and Figure 6 This paper introduces a specific implementation method for estimating sample uncertainty, combined with... Figure 7 and Figure 8 An implementation example for determining model uncertainty estimation is described below. It is understood that, to ensure the accuracy of the first uncertainty estimation, the samples used to determine the sample uncertainty estimation and the model uncertainty estimation are consistent, both using the aforementioned first target dataset. Suppose the aforementioned first target dataset includes N samples, where N is a positive integer.

[0062] In an exemplary embodiment, reference is made to Figure 5 The embodiments of the method for determining sample uncertainty estimation provided in this figure include S510-S530.

[0063] In S510, at least one local region of the i-th sample is perturbed, and the perturbed sample obtained after the above perturbing is taken as the i-th sample subset, where i is a positive integer not greater than N.

[0064] For example, refer to Figure 6For the i-th sample, region segmentation can be performed. A face segmentation model can be used to divide the face image into several parts, such as eyes, mouth, nose, cheeks, hair, and background. Further, perturbations (e.g., Gaussian blur, random erase, etc.) are applied to different image regions. For example, Gaussian blurring of the mouth region in the i-th sample yields the i-th perturbation sample, Gaussian blurring of the eye region in the i-th sample yields the i-th perturbation sample, and so on, with random erase applied to the eye region in the i-th sample yielding the ix-th perturbation sample (x represents the number of samples in the i-th sample subset), thus obtaining numerous perturbation samples for the same sample. In this embodiment, the perturbation samples obtained after at least one perturbation process are used as the i-th sample subset 62. In this embodiment, the above sample processing method is referred to as a region-based augmentation scheme.

[0065] Continue to refer to Figure 5 In S520, without activating the discard unit, the sample uncertainty estimate corresponding to the i-th sample is determined by the above target classification model.

[0066] It is understandable that in the process of determining the uncertainty estimation of samples in this embodiment, after perturbing the i-th sample to obtain the i-th sample subset, each perturbed sample in the i-th sample subset is input into the target classification model, and different outputs about the i-th sample can be obtained. Therefore, sample uncertainty estimation can be achieved without enabling dropout.

[0067] For example, refer to Figure 6 Without enabling dropout, each sample in the i-th sample subset is input into the target classification model 64. Further, the multiple outputs of the target classification model are statistically analyzed to obtain the sample uncertainty estimate corresponding to the i-th sample. For example, after the i-th perturbation sample is input into the target classification model 64 without enabling dropout, the model outputs the probability p that the i-th perturbation sample belongs to the attack target. i1 After the i2th perturbation sample is input into the target classification model 64 without enabling dropout, the input p i2 After the i2nd perturbation sample is input into the target classification model 64 without enabling dropout, the model outputs the probability p that the i2th perturbation sample belongs to the attack target. i2 ..., after the ixth perturbation sample is input into the target classification model 64 without enabling dropout, the model outputs the probability p that the ixth perturbation sample belongs to the attack target. ix Furthermore, the above probabilities (p) are statistically analyzed. i1 p i2, ..., p ix The mean of the probabilities (p) is used to obtain the sample uncertainty estimate for a single sample, i.e., the sample uncertainty estimate corresponding to the i-th sample. In other embodiments, the above probabilities (p) can also be used to obtain the sample uncertainty estimate for a single sample. i1 p i2 , ..., p ix Other statistical values ​​(e.g., variance) are used as the sample uncertainty estimate for the i-th sample.

[0068] Continue to refer to Figure 5 In S530, based on the sample uncertainty estimates corresponding to the N samples, the sample uncertainty estimates included in the first uncertainty estimate are determined.

[0069] For example, by statistically analyzing the sample uncertainty estimates corresponding to N samples, the sample uncertainty estimate of the first data domain can be determined. For instance, the mean of the sample uncertainty estimates of the N samples can be used as the sample uncertainty estimate of the first data domain. In other embodiments, other statistical values ​​(e.g., variance) of the sample uncertainty estimates of the N samples can also be used as the sample uncertainty estimate of the first data domain.

[0070] In an exemplary embodiment, reference is made to Figure 7 The embodiments of the method for determining model uncertainty estimation provided in this figure include S710-S720.

[0071] It is understood that in the process of determining the model uncertainty estimate, this embodiment cannot obtain the subset of the i-th sample by perturbing the i-th sample. If the above-mentioned dropout unit is turned off, after inputting the i-th sample into the target classification model multiple times, the output of the i-th sample will be singular. Therefore, the dropout unit needs to be turned on to realize the model uncertainty estimate.

[0072] In S710, when the discard 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.

[0073] For example, refer to Figure 8 Input the i-th sample multiple times (y times, where y is a positive integer greater than 1) into the target classification model, and obtain the model output probability as: p' i1 ,p' i2 ,…,p' iy Furthermore, the above probabilities (p') are statistically analyzed. i1 ,p' i2 ,…,p' iyThe mean of the probabilities (p') is used to obtain the model uncertainty estimate for a single sample, i.e., the model uncertainty estimate corresponding to the i-th sample. In other embodiments, the above probabilities (p') can also be used to obtain the model uncertainty estimate for a single sample. i1 ,p' i2 ,…,p' iy Other statistical values ​​(e.g., variance) are used as estimates of the model uncertainty for the i-th sample.

[0074] In S720, the model uncertainty estimates included in the first uncertainty estimate are determined based on the model uncertainty estimates corresponding to the N samples respectively.

[0075] For example, by statistically analyzing the model uncertainty estimates corresponding to the aforementioned N samples, the model uncertainty estimate for the first data domain can be determined. For instance, the mean of the model uncertainty estimates for the N samples can be used as the model uncertainty estimate for the first data domain. In other embodiments, other statistical values ​​(e.g., variance) of the model uncertainty estimates for the aforementioned N samples can also be used as the model uncertainty estimate for the first data domain.

[0076] This concludes the description of specific implementation examples for sample uncertainty estimation and model uncertainty estimation in the first data domain. It is understood that the type of statistical value used is consistent in both the single-sample model uncertainty estimation process (e.g., S520) and the single-sample model uncertainty estimation process (e.g., S710), such as using the mean. Similarly, the type of statistical value used is consistent in both the overall sample model uncertainty estimation process (e.g., S530) and the overall sample model uncertainty estimation process (e.g., S720), such as using the mean.

[0077] Furthermore, influence coefficients can be set separately based on the degree of influence of model uncertainty estimation and sample uncertainty estimation on feature transfer. For example, if the influence coefficient corresponding to model uncertainty estimation M1 is 0.3 and the influence coefficient corresponding to sample uncertainty estimation M2 is 0.7, then the first uncertainty estimation can be expressed as: 0.3×M1+0.7×M2.

[0078] It should be noted that the specific implementation method for obtaining the second uncertainty estimate (the specific implementation method of S130) is similar to the specific implementation method for obtaining the first uncertainty estimate (the specific implementation method of S120), the only difference being that the first target dataset comes from the first data domain and the second target dataset comes from the second data domain. Therefore, the specific implementation method for the second uncertainty estimate can refer to the specific implementation method for the first uncertainty estimate.

[0079] In an exemplary embodiment, reference may be made to Figure 2After determining the first uncertainty estimate and the second uncertainty estimate, this specification uses the difference between the first uncertainty estimate and the second uncertainty estimate as the feature transfer amount 25. Furthermore, this feature transfer amount 25 is applied to the test image 26 in the new domain (i.e., the second data domain), thereby enabling the prediction of the classification 27 of the test image in the new domain using the target classification model 300. In an exemplary embodiment, the feature transfer amount 25 is superimposed before the image features corresponding to the test image in the second data domain enter the classification layer of the target classification model.

[0080] For example, refer to Figure 9 With the ResNet18 network structure as the main network, the test image 90 from the second data domain is input into the target classification model 300 (dropout unit is not required at this time). After passing through the convolutional layer 32, the max pooling layer 34, and multiple sets of residual blocks and the discard structure based on the attention mechanism, the image features corresponding to the test image 90 are input into the average pooling layer 38. In this embodiment, the features of the classification layer (i.e., the fully connected layer 310) input into the target classification model are determined as the target image features.

[0081] In one exemplary embodiment of this specification, reference is made to Figure 9 The feature offset 25 is superimposed onto the target image features to obtain the offset image features. After classifying the offset image features through a classification layer (i.e., fully connected layer 310), the detection result for the test image 90 in the second data domain can be obtained. For example, refer to... Figure 9 If the prediction result for the image to be tested is p, and p is greater than a preset threshold P, then the image to be tested can be determined to be an attack target. Otherwise, if p is not greater than the preset threshold P, then the image to be tested can be determined to be a live object, not an attack target. For example, if p is greater than the preset threshold P, then the image to be tested p may be an attack target such as a mobile phone photo, a paper mask, or a silicone mask; if p is not greater than the preset threshold P, then the image to be tested p may be a live object. Therefore, the embodiments in this specification can achieve high-precision liveness detection (i.e., cross-domain liveness detection) using the same liveness algorithm across different data domains.

[0082] In other embodiments, when using a ResNet18 network structure as the main network, the feature offset 25 can also be superimposed on, such as... Figure 9 Other layers of the target classification model shown (e.g., superimposed on the input features of the average pooling layer 38) are not limited in this specification.

[0083] Because the offset image features contain the differences between the two data domains, even if the image to be tested comes from the new domain (i.e., the second data domain), it can still be accurately classified using a target classification model applicable to the first data domain. Therefore, if there exists a target classification model S suitable for office access control scenarios, after determining the feature offset between the second data domain (corresponding to identity recognition scenarios in subway stations) and the first data domain (corresponding to office access control scenarios), model S can also be used for identity recognition scenarios in subway stations, simultaneously achieving a balance between model maintenance costs and cross-domain adaptation performance.

[0084] In the scheme provided in the embodiments of this specification, a target classification model is first determined. This model 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. Specifically, on one hand, an attention-based dropout structure is added to the target classification model, thereby effectively determining the model uncertainty estimate. On the other hand, the embodiments of this specification also effectively determine the sample uncertainty estimate using a region-based augmentation scheme. More specifically, based on this model, a first uncertainty estimate corresponding to a first target dataset from the aforementioned first data domain is determined, and a second uncertainty estimate corresponding to a second target dataset from a second data domain (another data domain) is determined. Further, based on the second uncertainty estimate and the first uncertainty estimate, a feature offset is determined, which characterizes the feature changes between the second data domain and the first data domain.

[0085] Finally, based on the feature offsets containing various uncertainty estimates, the detection result for the image to be tested in the second data domain can be determined. It is evident that in the scheme provided by the embodiments of this specification, the target classification model in the first data domain can detect the image to be tested in the second data domain without maintaining a dedicated model for each scene. Furthermore, compared to cross-domain liveness detection methods based on a single model iteration, this scheme achieves higher cross-domain classification accuracy. Therefore, the scheme provided by the embodiments of this specification effectively balances model maintenance costs and cross-domain adaptation performance.

[0086] It should be noted that the above figures are merely illustrative of the processes included in the methods according to exemplary embodiments of this specification, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may, for example, be executed synchronously or asynchronously in multiple modules.

[0087] The following are embodiments of the apparatus described in this specification, which can be used to execute the embodiments of the methods described in this specification. For details not disclosed in the apparatus embodiments of this specification, please refer to the embodiments of the methods described in this specification.

[0088] in, Figure 10 A schematic diagram of an image detection apparatus to which one embodiment of this specification can be applied is shown. Please refer to... Figure 10 The image detection device shown in the figure can be implemented as all or part of an electronic device through software, hardware, or a combination of both. It can also be integrated as an independent module on a server or as an independent module in an electronic device.

[0089] The image detection device 1000 described in the embodiments of this specification includes: a model determination module 1010, an uncertainty estimation determination module 1020, an offset determination module 1030, and a detection module 1040.

[0090] The aforementioned model determination module 1010 is used to determine a target classification model, wherein the target classification model is trained using training samples from a first data domain; the aforementioned uncertainty estimation determination module 1020 is used to determine a first uncertainty estimate corresponding to a first target dataset using the aforementioned target classification model, wherein the first target dataset comes from the aforementioned first data domain; the aforementioned uncertainty estimation determination module 1020 is also used to determine a second uncertainty estimate corresponding to a second target dataset using the aforementioned target classification model, wherein the second target dataset comes from the aforementioned second data domain; the aforementioned offset determination module 1030 is used to determine a feature offset based on the aforementioned first uncertainty estimate and the aforementioned second uncertainty estimate; and the aforementioned detection module 1040 is used to determine a detection result for the image to be tested in the aforementioned second data domain based on the aforementioned target classification model and the aforementioned feature offset.

[0091] In an exemplary embodiment, Figure 11 A schematic diagram illustrating the structure of an image detection apparatus according to another exemplary embodiment of this specification is provided. See also... Figure 11 :

[0092] In an exemplary embodiment, based on the foregoing scheme, the target classification model includes: an attention-based discard structure, which includes: a squeeze excitation block and a discard unit; during training with 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 excitation block.

[0093] In an exemplary embodiment, based on the foregoing scheme, the first uncertainty estimation includes: sample uncertainty estimation; the first target dataset includes N samples, where N is a positive integer;

[0094] The aforementioned uncertainty estimation determination module 1020 includes: a disturbance unit 10202, a first prediction unit 10204, and a first determination unit 10206.

[0095] The aforementioned perturbation unit 10202 is used to perturb at least one local region of the i-th sample, and take the perturbation sample obtained after the perturbation as the i-th sample subset, where i is a positive integer not greater than N; the aforementioned first prediction unit 10204 is used to determine the sample uncertainty estimate corresponding to the i-th sample through the aforementioned target classification model without activating the aforementioned abandonment unit; and the aforementioned first determination unit 10206 is used to determine the sample uncertainty estimate included in the aforementioned first uncertainty estimate based on the sample uncertainty estimates corresponding to the aforementioned N samples respectively.

[0096] In an exemplary embodiment, based on the aforementioned scheme, the first prediction unit 10204 is specifically used to: input each sample in the i-th sample subset into the target classification model without activating the aforementioned deprecation unit; and to statistically analyze the multiple outputs of the target classification model to obtain the sample uncertainty estimate corresponding to the i-th sample.

[0097] In an exemplary embodiment, based on the foregoing scheme, the first uncertainty estimation further includes: model uncertainty estimation; the uncertainty estimation determination module 1020 further includes: a second prediction unit 10204' and a second determination unit 10206'.

[0098] The second prediction unit 10204' is used to input the i-th sample into the target classification model at least twice when the abandonment unit is activated, and determine the model uncertainty estimate corresponding to the i-th sample based on the output of the target classification model; the second determination unit 10206' is used to determine the model uncertainty estimate included in the first uncertainty estimate based on the model uncertainty estimates corresponding to the N samples respectively.

[0099] In an exemplary embodiment, based on the aforementioned scheme, the second prediction unit 10204' is specifically used to: input the i-th sample to the target classification model once or twice when the aforementioned discard unit is activated; and to statistically analyze multiple outputs of the target classification model to obtain the model uncertainty estimate corresponding to the i-th sample.

[0100] In an exemplary embodiment, based on the foregoing scheme, the uncertainty estimation determination module 1020 is further configured to determine the first uncertainty estimate based on the preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.

[0101] In an exemplary embodiment, based on the foregoing scheme, the detection module 1040 is specifically configured to: input the image to be tested from the second data domain into the target classification model, wherein the features of the classification layer input to the target classification model are determined as target image features; superimpose the feature offset onto the target image features to obtain offset image features; and perform classification processing on the offset image features through the classification layer to obtain a detection result for the image to be tested in the second data domain.

[0102] It should be noted that the image detection device provided in the above embodiments is only illustrated by the division of the above functional modules when performing the image detection method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0103] Furthermore, the image detection apparatus and image detection method embodiments provided in the above embodiments belong to the same concept. Therefore, for details not disclosed in the apparatus embodiments of this specification, please refer to the image detection method embodiments described above, which will not be repeated here.

[0104] Figure 12 This schematic diagram illustrates the structure of an electronic device according to an exemplary embodiment of this specification. Please refer to... Figure 12 As shown, the electronic device 1200 includes a processor 1201 and a memory 1202.

[0105] In this embodiment, processor 1201 is the control center of the computer system and can 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 or an 8-core processor. Processor 1201 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). Processor 1201 may also include a main processor and a coprocessor; the main processor is used to process data in the wake-up state, and the coprocessor is a low-power processor used to process data in the standby state.

[0106] In the embodiments described in this specification, the processor 1201 is specifically used for:

[0107] A target classification model is determined, wherein the target classification model is trained using training samples from a first data domain; a first uncertainty estimate is determined using the target classification model for a first target dataset, wherein the first target dataset is from the first data domain; a second uncertainty estimate is determined using the target classification model for a second target dataset, wherein the second target dataset is from a second data domain; a feature offset is determined based on the first uncertainty estimate and the second uncertainty estimate; and a detection result for the image to be tested in the second data domain is determined based on the target classification model and the feature offset.

[0108] Furthermore, the above target classification model includes: an attention-based discard structure, which includes: a squeeze excitation block and a discard unit; during training with training samples from the first data domain, the probability of the discard unit discarding each element in the training sample is adaptively calculated and determined by the squeeze excitation block.

[0109] Further, the aforementioned first uncertainty estimation includes: sample uncertainty estimation; the aforementioned first target dataset includes N samples, where N is a positive integer; the aforementioned determination of the first uncertainty estimation corresponding to the first target dataset through the aforementioned target classification model includes: perturbing at least one local region of the i-th sample, and taking the perturbed sample obtained after the aforementioned perturbing as a subset of the i-th sample, where i is a positive integer not greater than N; determining the sample uncertainty estimation corresponding to the i-th sample through the aforementioned target classification model without activating the aforementioned discard unit; and determining the sample uncertainty estimation included in the aforementioned first uncertainty estimation based on the sample uncertainty estimation corresponding to the aforementioned N samples respectively.

[0110] Furthermore, the above-mentioned determination of the sample uncertainty estimate corresponding to the i-th sample through the target classification model without activating the above-mentioned discard unit includes: inputting each sample in the i-th sample subset into the target classification model respectively without activating the above-mentioned discard unit; and statistically analyzing the multiple outputs of the target classification model to obtain the sample uncertainty estimate corresponding to the i-th sample.

[0111] Furthermore, the aforementioned first uncertainty estimate also includes: model uncertainty estimate; the aforementioned determination of the first uncertainty estimate corresponding to the first target dataset through the aforementioned target classification model includes: when the aforementioned deprecation unit is activated, inputting the aforementioned i-th sample into the aforementioned target classification model at least twice, and determining the model uncertainty estimate corresponding to the aforementioned i-th sample based on the output of the aforementioned target classification model; and, determining the model uncertainty estimate included in the aforementioned first uncertainty estimate based on the model uncertainty estimates corresponding to the aforementioned N samples respectively.

[0112] Furthermore, when the aforementioned 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. This includes: when the aforementioned deprecation unit is activated, the i-th sample is input into the target classification model at least twice; and, multiple outputs of the target classification model are statistically analyzed to obtain the model uncertainty estimate corresponding to the i-th sample.

[0113] Furthermore, the processor 1201 is specifically used to: determine the first uncertainty estimate based on the preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.

[0114] Further, 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 includes: inputting the image to be tested from the second data domain into the target classification model, wherein the features of the classification layer input to the target classification model are determined as target image features; superimposing the feature offset onto the target image features to obtain offset image features; and classifying the offset image features through the classification layer to obtain the detection result of the image to be tested in the second data domain.

[0115] 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 and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments of this specification, the non-transitory computer-readable storage media in memory 1202 is used to store at least one instruction for execution by processor 1201 to implement the methods in the embodiments of this specification.

[0116] In some embodiments, the electronic device 1200 further includes a peripheral device interface 1203 and at least one peripheral device. The processor 1201, memory 1202, and peripheral device interface 1203 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1203 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of a display screen 1204, a camera 1205, and an audio circuit 1206.

[0117] Peripheral interface 1203 can be used to connect at least one input / output (I / O) related peripheral device to processor 1201 and memory 1202. In some embodiments of this specification, processor 1201, memory 1202, and peripheral interface 1203 are integrated on the same chip or circuit board; in some other embodiments of this specification, any one or two of processor 1201, memory 1202, and peripheral interface 1203 can be implemented on separate chips or circuit boards. This specification does not specifically limit the embodiments in this regard.

[0118] Display screen 1204 is used to display a user interface (UI). The UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1204 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1201 for processing. In this case, display screen 1204 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments of this specification, there may be one display screen 1204, which serves as the front panel of electronic device 1200; in other embodiments, there may be at least two display screens 1204, respectively disposed on different surfaces of electronic device 1200 or in a folded design; in still other embodiments, display screen 1204 may be a flexible display screen, disposed on a curved or folded surface of electronic device 1200. Furthermore, display screen 1204 may also be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. The display screen 1204 can be made of materials such as liquid crystal display (LCD) and organic light-emitting diode (OLED).

[0119] Camera 1205 is used to capture images or videos. Optionally, camera 1205 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the electronic device, and the rear-facing camera is located on the back of the electronic device. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, virtual reality (VR) shooting, or other fusion shooting functions. In some embodiments of this specification, camera 1205 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0120] The audio circuit 1206 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input to the processor 1201 for processing. For stereo sound acquisition or noise reduction purposes, there may be multiple microphones, each located in a different part of the electronic device 1200. The microphone may also be an array microphone or an omnidirectional microphone.

[0121] Power supply 1207 is used to supply power to various components in electronic device 1200. Power supply 1207 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 1207 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, and a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0122] The block diagrams of the electronic device shown in the embodiments of this specification do not constitute a limitation on the electronic device 1200. The electronic device 1200 may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0123] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of these terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0124] This specification also provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above-described image detection apparatus are implemented as software functional units and sold or used as independent products, they can be stored in the above-described computer-readable storage medium.

[0125] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).

[0126] It should be noted that the above description describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims may be performed in a different order than that shown in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0127] The above description is merely a specific embodiment of this specification, but the scope of protection of this specification is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this specification should be included within the scope of protection of this specification. Therefore, equivalent variations made in accordance with the claims of this specification are still within the scope of this specification.

Claims

1. An image detection method, wherein, The method includes: 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; 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. The method according to claim 1, wherein, The first uncertainty estimation also includes: model uncertainty estimation; The method further includes: 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; Based on the model uncertainty estimates corresponding to the N samples, the model uncertainty estimates included in the first uncertainty estimate are determined.

3. The method according to claim 2, wherein, 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, including: When the discard unit is activated, the i-th sample is input into the target classification model once or twice; By statistically analyzing multiple outputs of the target classification model, the model uncertainty estimate corresponding to the i-th sample is obtained.

4. The method according to claim 2, wherein, The method further includes: The first uncertainty estimate is determined based on the preset influence coefficient, the sample uncertainty estimate, and the model uncertainty estimate.

5. The method according to any one of claims 1 to 4, wherein, The step of determining the detection result for the image to be tested in the second data domain based on the target classification model and the feature offset includes: 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. A target classification model, wherein, The target classification model includes: 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 will discard each element in the training sample is adaptively calculated and determined by the squeeze excitation block. 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. An image detection device, wherein, The device includes: 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; 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. A computer-readable storage medium storing instructions, wherein, When the instructions are executed on a computer or processor, the computer or processor performs the image detection method as described in any one of claims 1 to 5.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the image detection method as described in any one of claims 1 to 5.

10. A computer program product containing instructions, wherein, When the computer program product is run on a computer or processor, it causes the computer or processor to perform the image detection method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Model training method and device and electronic equipment

    CN111523663A

  • Clothing image classification method based on web crawlers and transfer learning

    CN112036495A

  • Image classification model processing method, image classification method and device

    CN112733970A