Attribute-based OOD data detection method and system
Through the attribute-based OOD data detection method, an attribute set representing the attribute set is generated and compared with the test image, which solves the identification problem of the deep neural network in unknown environments and out-of-distribution input, and improves the accuracy and generalization ability of detection.
Patent Information
- Application Number
- CN202411294578.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art When dealing with unknown environments and out-of-distribution (OOD) inputs, deep neural networks are difficult to identify and provide high confidence predictions, and existing methods are too strict in the data distribution assumptions, and detection accuracy is reduced.
The attribute-based OOD data detection method is used to generate a representative attribute set by obtaining the initial prompt, generate an attribute set of the test image based on the test image and the test prompt, and determine whether the image is OOD data through attribute comparison.
It reduces the dependence on data distribution assumptions, improves the accuracy and generalization ability of OOD detection, simplifies the detection process, and improves the real-time and reliability of the model.
Smart Images

Figure CN119339183A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to an attribute-based OOD data detection method and system. Background Art
[0002] With the development of deep learning technology, neural networks have performed well in many fields such as autonomous driving, human-computer interaction, face recognition, and medical image analysis, and have been widely used. As time goes by, neural networks will penetrate deeper into social production and people's lives, but it is necessary to be vigilant that when deploying machine learning models in the open world, it is necessary to ensure the reliability of the model in the presence of out-of-distribution (OOD) inputs. These inputs from unknown distributions are not encountered by the neural network during training, so the model should not give high confidence predictions during testing. Unfortunately, although modern deep neural networks have achieved unprecedented success in the known environment in which they are trained, they often have difficulty handling unknown environments. In particular, neural networks often produce high posterior probabilities when faced with out-of-distribution (OOD) test inputs. In fact, a good neural network model must not only have accuracy within the known distribution, but also be able to identify unknown samples outside the training category, so as to effectively perform OOD detection. This gives rise to the OOD detection task, whose goal is to determine whether the input is in-distribution (ID).
[0003] There are two existing technical solutions. The first is training-based methods, which enhance the OOD detection ability of the model by incorporating regularization or other strategies during model training. Regularization methods use regularization techniques to enable the model to better distinguish between ID (in-distribution) data and OOD (out-of-distribution) data; there are also prototype construction methods based on the use of prototypes during training, which make data from the same ID category more compact and close to the relevant ID-specific prototypes, thereby achieving the best performance on the benchmark. The second is post-processing methods, which perform post-processing or additional analysis on the trained model without retraining the model. Classic methods include neural network-based methods, whose OOD scores are usually designed based on the information of the top layer of the neural network, such as softmax output, logits, and gradients. These methods aim to improve the performance of deep neural networks in processing unknown environments and ensure that they maintain high reliability and accuracy in various complex practical applications. However, training-based methods are too strict in their assumptions about data distribution. For example, when processing natural scene images, complex and diverse background information may lead to reduced detection accuracy. This is because these methods usually assume that the data obeys a specific statistical distribution, while the distribution of actual data may be very complex and diverse, resulting in reduced detection accuracy. The disadvantage of the ex post method is that it requires complex post-processing, such as feature recalculation and parameter adjustment, and the detection performance depends on the training data. The quality of the generated samples may be unstable due to insufficient diversity of the training data. This is because the ex post method relies on the trained model for complex analysis to capture the differences between ID and OOD data. This process has high requirements for parameter adjustment, and the diversity and quality of the generated samples are difficult to guarantee and are easily affected by the training data, thus affecting the stability and accuracy of the detection. Summary of the invention
[0004] The purpose of the present invention is to provide an attribute-based OOD data detection method and system, aiming to solve the above-mentioned problems in the prior art.
[0005] The embodiment of the present invention provides an attribute-based OOD data detection method, comprising:
[0006] Obtaining an initial prompt, generating corresponding candidate attributes according to the initial prompt, selecting a number of representative attributes from the candidate attributes, and obtaining a representative attribute set;
[0007] Acquire a test image and a test prompt, and obtain a set of attributes of the test image based on the test image and the test prompt; and
[0008] The attribute set of the test image is compared with the representative attribute set, and whether the test image is OOD data is determined according to the comparison result.
[0009] The embodiment of the present invention provides an attribute-based OOD data detection system, comprising:
[0010] A selection module is used to obtain an initial prompt, generate corresponding candidate attributes according to the initial prompt, select a number of representative attributes from the candidate attributes, and obtain a representative attribute set;
[0011] A module to be tested, used to obtain a test image and a test prompt, and obtain a set of attributes of the test image based on the test image and the test prompt; and
[0012] The detection module is used to compare the attribute set of the test image with the representative attribute set, and determine whether the test image is OOD data based on the comparison result.
[0013] An embodiment of the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned attribute-based OOD data detection method when executed by the processor.
[0014] An embodiment of the present invention further provides a computer-readable storage medium, on which a program for implementing information transmission is stored, and when the program is executed by a processor, the steps of the above-mentioned attribute-based OOD data detection method are implemented.
[0015] The use of the embodiments of the present invention may include the following beneficial effects: the embodiments of the present invention propose a method based on self-supervised learning tasks, which trains the model to reconstruct images by designing class attribute tasks, thereby improving the OOD (Out-Of-Distribution) detection capability. Different from the regularization and prototype construction methods in the prior art that rely on specific data distribution assumptions, the embodiments of the present invention reduce the dependence on data assumptions through attribute comparison and can better adapt to high-dimensional complex data. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 is a flow chart of an attribute-based OOD data detection method according to an embodiment of the present invention;
[0018] Figure 2 is a flow chart of an OOD detection method based on class attributes according to an embodiment of the present invention;
[0019] Figure 3 Schematic diagram of an attribute-based OOD data detection system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0021] Method Embodiment
[0022] According to an embodiment of the present invention, a method for detecting OOD data based on attributes is provided. Figure 1 is a flow chart of the attribute-based OOD data detection method according to an embodiment of the present invention, such as Figure 1 As shown, the attribute-based OOD data detection method according to an embodiment of the present invention specifically includes:
[0023] Step S101, obtaining an initial prompt, generating corresponding candidate attributes according to the initial prompt, selecting a number of representative attributes from the candidate attributes, and obtaining a representative attribute set, specifically including:
[0024] Input the initial prompt into the natural language processing model GPT-3, generate several sentences corresponding to the initial prompt, split the several sentences into several attributes using the pre-trained language T5 model, identify and delete the class name tag of each of the several attributes through string matching, obtain corresponding candidate attributes, and sample the attributes of each category in the candidate attributes in equal amounts, select several representative attributes from the sampled attributes using the scoring function shown in Formula 1, and obtain a representative attribute set;
[0025]
[0026] Among them, C y represents the representative attribute set of class y, F(c) represents the distinguishability score of attribute c, E() represents the similarity within the attribute, hyperparameters α and β represent the weights of controlling the two sub-functions, c1 and c2 represent the specific concepts in the candidate concept set, S y represents the candidate set of class y;
[0027] Step S102, obtaining a test image and a test prompt, and obtaining a set of attributes of the test image based on the test image and the test prompt, specifically includes:
[0028] Input the test image and the test prompt into the pre-built multimodal large model LLaVA to obtain the corresponding attribute description, and input the attribute description into the pre-trained language T5 model to obtain the attribute set of the test image;
[0029] Step S103, comparing the attribute set of the test image with the representative attribute set, and judging whether the test image is OOD data according to the comparison result, specifically includes:
[0030] The similarity score between the attribute set of the test image and the representative attribute set is calculated using Formula 2 and Formula 3. If the similarity score is greater than or equal to a preset threshold, the test image is in-distribution ID data; if the similarity score is less than the preset threshold, the test image is out-of-distribution OOD data.
[0031]
[0032] Sim final (A)=max i Sim max (A,N) Formula 3;
[0033] Among them, Sim max (A,N y ) represents the image attribute set A and the attribute set N of class y y The maximum similarity between them, sim() means calculating the cosine similarity, N y,K represents the kth attribute of class y, a i Indicates the i-th attribute detected from the test image, Sim final (A) is the maximum similarity value calculated by detecting the image attribute set A to all category attribute sets N, that is, the similarity score.
[0034] The above technical solution of the embodiment of the present invention is described in detail below in combination with the specific situation of the attribute-based OOD data detection method of the embodiment of the present invention.
[0035] The embodiment of the present invention provides an OOD detection method based on class attributes, such as Figure 2 As shown, the specific steps include:
[0036] 1. Generate candidate attributes using a large language model (GPT-3);
[0037] 2. Use the submodule function to select the most representative k attributes from all candidate attributes to form an attribute set;
[0038] 3. Compare the test image and the attribute set to determine whether the image is an OOD image.
[0039] Specifically, the steps of the OOD detection method proposed in the embodiment of the present invention are as follows:
[0040] 1. Generate candidate attributes
[0041] In order to collect class descriptions S for input into the model of the present invention, the present invention prompts GPT-3 by asking "describe what the horse looks like". GPT-3 returns sentences about the target class. The present invention obtains 300 sentences for each category and uses the T5 model to automatically split these sentences into shorter attributes. String matching is used to identify and remove class name tags in each attribute, for example:
[0042] Prompt: describe what the axolorl looks like:
[0043] LLM: The horse has a strong, muscular body with a sleek coat and a long face. Its eyes are large, and its ears are erect and can swivel. The mane and tail are often thick and flowing.
[0044] Extract concept using LM and delete class names:
[0045] Attribute concepts: strong; muscular body with a sleek coat and a long face; eyes is large, ears is erect and can swivel; The mane and tail are oftenthick and flowing.
[0046] 2. Select attribute set
[0047] A superset of candidate attributes S is created using a large language model (GPT) and class names. For each label y∈Y is a label from the set of N categories, Y represents the total set of these labels, S yS is constructed by prompting the language model to generate textual knowledge about y. y represents a candidate set with labels. In this embodiment of the present invention, N is not directly selected from S. c Attributes (N c represents the total number of attributes in the attribute set), but selects k attributes for each class, so that N×k=N c , to ensure that each class has the same number of related attributes in the attribute collection.
[0048] For the k attributes in each class, a scoring function is established to select the most representative attributes with higher coverage. The embodiment of the present invention proposes to use the following scoring function to select the most representative attributes from the candidate set S y Select subset C y , C y Represents a representative data set of class y:
[0049]
[0050] Among them, F(c) represents the distinguishability score of attribute c, E() represents the similarity within the attribute, the hyperparameters α and β represent the weights of controlling the two sub-functions, c1 and c2 represent the specific concepts in the candidate concept set, and the purpose of the first term in this equation is to ensure that the attribute set can select the most representative and informative attributes, and the second term is to ensure that the subset has a good coverage of the candidate subset, so that the selected k attributes can represent the set of this candidate subset, and the two hyperparameters represent the weights of the two sub-functions.
[0051] For the F(c) function, the purpose is to ensure that the attribute set can select the most representative attribute. Therefore, the embodiment of the present invention defines the similarity score Similarity(y, c) between the category and the attribute by selecting the average value of clicks between the image and the text:
[0052]
[0053] Among them, x y is a set of training images with label y, and T() is the encoder of text. The embodiment of the present invention introduces a standardized category association, which is the conditional probability of aligning the feature image of the category with the text embedding of the attribute:
[0054]
[0055] in, It represents the conditional similarity of category y given concept c, which indicates the degree to which concept c is more likely to be related to category y. Similarity(y,c) represents the similarity score between category y and concept c. Similarity(y′ ,c) represents the sum of similarity scores between other categories y' and concept c, where y' is other categories in the category set Y.
[0056] And calculate the negative entropy:
[0057]
[0058] That is, maximize F(c) to ensure that the most informative and representative attributes are selected.
[0059] For the coverage score E(c), its purpose is to minimize the similarity between each element in the subset and the candidate set. Therefore, the embodiment of the present invention uses cosine similarity to determine the similarity between two attributes:
[0060] φ(c1,c2)=cos(T(c1),T(c2))(5);
[0061] Among them, T(c1), T(c2) represent the feature vectors of concepts c1 and c2 extracted by the text encoder T, and φ(c1, c2) is used to calculate the similarity between concepts c1 and c2. The higher the value, the higher the similarity between the two concepts in the feature space, thereby covering different possible appearances of the target category.
[0062] 3. OOD image detection
[0063] For an image to be tested, the embodiment of the present invention inputs the prompt "Please describe the main attributes of the food in the picture" and the test image into the multimodal large model llava, and the model gives an attribute description S. The attribute description S is input into the T5 model to obtain the attribute set A of the picture = {a1, a2, ..., a m}, using this attribute set and the attribute set selected above N = {N i1 ,N i2 ,…,N y,K} to calculate the cosine similarity and calculate its similarity with all categories, N y,K represents the kth attribute of class y, where N is the attribute set of Y classes, and the highest similarity is selected as the similarity score between the image and the known category:
[0064] Sim final (A)=max i Sim max (A,N) (6);
[0065] Among them, Sim final(A) is the maximum similarity value calculated by the detection image attribute set A for all category attribute sets N. For each class y, N y Represents the attribute set of class y, N y,K Represents the kth attribute of class y, and calculates the attribute set A of the image and the attribute set N of the class y The maximum semantic similarity between:
[0066]
[0067] In the formula, Sim max (A,N y ) represents the image attribute set A and the attribute set N of class y y The maximum similarity between i Indicates the i-th attribute detected in the test image. Finally, through the set threshold ε, if the similarity score is greater than or equal to the threshold ε, it is judged as ID; if the similarity score is less than the threshold ε, it is judged as OOD:
[0068]
[0069] In actual applications, the embodiment of the present invention only uses ID data sets (for example: CIFAR10, CIFAR100) to train the neural network model, constructs an attribute set in the early attribute selection, outputs the test image attribute set through the multimodal model in the later stage, and finally uses the image score as the OOD score.
[0070] In summary, the embodiments of the present invention mainly include two aspects: data preprocessing and model training methods. That is, by obtaining the most representative and informative attributes of the ID class from the large language model (GPT), an ID attribute set is constructed. This training method effectively improves the model's ability to recognize OOD data. And through comparison, it can be seen that the embodiments of the present invention not only simplifies the training and detection process, but also directly trains the model to adapt to different image data distributions, effectively improving the generalization ability of the model and the accuracy of OOD detection. Compared with traditional training-based enhancement methods or complex post-processing methods, this method has obvious advantages, especially when dealing with unknown or changing data distributions. Therefore, the embodiments of the present invention have high practical value in practical applications, and are particularly suitable for scenarios requiring high-accuracy OOD detection.
[0071] System Example
[0072] According to an embodiment of the present invention, a property-based OOD data detection system is provided. Figure 3 Schematic diagram of an attribute-based OOD data detection system according to an embodiment of the present invention. Figure 3As shown, the attribute-based OOD data detection system according to an embodiment of the present invention specifically includes:
[0073] The selection module 30 is used to obtain an initial prompt, generate corresponding candidate attributes according to the initial prompt, select a number of representative attributes from the candidate attributes, and obtain a representative attribute set, which is specifically used to:
[0074] Input the initial prompt into the natural language processing model GPT-3, generate several sentences corresponding to the initial prompt, split the several sentences into several attributes using the pre-trained language T5 model, identify and delete the class name tag of each of the several attributes through string matching, obtain corresponding candidate attributes, and sample the attributes of each category in the candidate attributes in equal amounts, select several representative attributes from the sampled attributes using the scoring function shown in Formula 1, and obtain a representative attribute set;
[0075]
[0076] Among them, C y represents the representative attribute set of class y, F(c) represents the distinguishability score of attribute c, E() represents the similarity within the attribute, hyperparameters α and β represent the weights of controlling the two sub-functions, c1 and c2 represent the specific concepts in the candidate concept set, S y represents the candidate set of class y;
[0077] The module to be tested 32 is used to obtain a test image and a test prompt, and obtain a set of attributes of the test image based on the test image and the test prompt, specifically for:
[0078] Input the test image and the test prompt into the pre-built multimodal large model LLaVA to obtain the corresponding attribute description, and input the attribute description into the pre-trained language T5 model to obtain the attribute set of the test image;
[0079] The detection module 34 is used to compare the attribute set of the test image with the representative attribute set, and determine whether the test image is OOD data according to the comparison result, specifically for:
[0080] The similarity score between the attribute set of the test image and the representative attribute set is calculated using Formula 2 and Formula 3. If the similarity score is greater than or equal to a preset threshold, the test image is in-distribution ID data; if the similarity score is less than the preset threshold, the test image is out-of-distribution OOD data.
[0081]
[0082] Sim final(A)=max i Sim max (A,N) Formula 3;
[0083] Among them, Sim max (A,N y ) represents the image attribute set A and the attribute set N of class y y The maximum similarity between them, sim() means calculating the cosine similarity, N y,K represents the kth attribute of class y, a i Indicates the i-th attribute detected from the test image, Sim final (A) is the maximum similarity value calculated by detecting the image attribute set A to all category attribute sets N, that is, the similarity score.
[0084] The embodiment of the present invention is a system embodiment corresponding to the above-mentioned method embodiment. The specific operations of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0085] In summary, the embodiments of the present invention aim to solve the problems of overly strict assumptions on data distribution and complex post-processing in existing detection methods through an attribute-based OOD detection method, so that the model can effectively perform OOD detection in the field of computer vision and improve the accuracy and efficiency of detection. Specifically, the purposes of the embodiments of the present invention include:
[0086] 1. Improve the ability to process high-dimensional complex image data and reduce reliance on data distribution assumptions;
[0087] 2. Ensure the real-time performance of the model and ensure that the neural network model can quickly and effectively provide highly reliable ID prediction results or OOD detection feedback when deployed in a real-time system.
[0088] Meanwhile, the beneficial effects of the embodiments of the present invention include:
[0089] 1. Improve the generalization ability of OOD detection: By judging the task based on attribute similarity, the strict assumptions on data distribution are reduced, so that the model can better adapt to and identify diverse and complex data environments. This method allows the model to learn how to reconstruct images, thereby understanding the basic structure and content of the image, and enhancing the ability to recognize unknown data;
[0090] 2. Simplify the detection process and improve efficiency: The embodiment of the present invention avoids the complicated post-processing steps in the traditional method, such as feature recalculation and parameter adjustment. By constructing an ID attribute set in the training phase, the entire detection process is simplified, and the real-time performance and efficiency of OOD detection are improved;
[0091] 3. Improve the practicality and reliability of the model: By evaluating the attribute similarity score to determine whether an image is OOD, this method is directly based on the most discriminative features of the image and can effectively improve the stability and accuracy of the model in practical applications.
[0092] Device Example 1
[0093] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps described in the method embodiment when executed by the processor.
[0094] Device Example 2
[0095] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps described in the method embodiment are implemented.
[0096] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting out-of-distribution OOD data based on attributes, characterized in that include: Obtaining an initial prompt, generating corresponding candidate attributes according to the initial prompt, selecting a number of representative attributes from the candidate attributes, and obtaining a representative attribute set; Acquire a test image and a test prompt, and obtain a set of attributes of the test image based on the test image and the test prompt; as well as The attribute set of the test image is compared with the representative attribute set, and whether the test image is OOD data is determined according to the comparison result.
2. The method according to claim 1, characterized in that Generate corresponding candidate attributes according to the initial prompt, select several representative attributes from the candidate attributes, and obtain a representative attribute set specifically including: Input the initial prompt into the natural language processing model GPT-3, generate several sentences corresponding to the initial prompt, split the several sentences into several attributes using the pre-trained language T5 model, identify and delete the class name tag of each of the several attributes through string matching, obtain corresponding candidate attributes, and sample the attributes of each category in the candidate attributes in equal amounts, select several representative attributes from the sampled attributes using the scoring function shown in Formula 1, and obtain a representative attribute set; Among them, C y represents the representative attribute set of class y, F(c) represents the distinguishability score of attribute c, E() represents the similarity within the attribute, hyperparameters α and β represent the weights of controlling the two sub-functions, c1 and c2 represent the specific concepts in the candidate concept set, S y represents the candidate set of class y.
3. The method according to claim 1, characterized in that The attribute set of the test image obtained based on the test image and the test prompt specifically includes: The test image and test prompt are input into the pre-built multimodal large model LLaVA to obtain the corresponding attribute description, and the attribute description is input into the pre-trained language T5 model to obtain the attribute set of the test image.
4. The method according to claim 1, characterized in that: Comparing the attribute set of the test image with the representative attribute set, and judging whether the test image is OOD data according to the comparison result specifically includes: The similarity score between the attribute set of the test image and the representative attribute set is calculated using Formula 2 and Formula 3. If the similarity score is greater than or equal to a preset threshold, the test image is in-distribution ID data; if the similarity score is less than the preset threshold, the test image is out-of-distribution OOD data. Sim final (A)=max i Sim max (A,N) Formula 3; Among them, Sim max (A,N y ) represents the image attribute set A and the attribute set N of class y y The maximum similarity between them, sim() means calculating the cosine similarity, N y,K represents the kth attribute of class y, a i Indicates the i-th attribute detected from the test image, Sim f1nal (A) is the maximum similarity value calculated by detecting the image attribute set A to all category attribute sets N, that is, the similarity score.
5. An attribute-based distributed OOD data detection system, characterized in that include: A selection module is used to obtain an initial prompt, generate corresponding candidate attributes according to the initial prompt, select a number of representative attributes from the candidate attributes, and obtain a representative attribute set; The module to be tested is used to obtain a test image and a test prompt, and obtain a property set of the test image based on the test image and the test prompt; as well as The detection module is used to compare the attribute set of the test image with the representative attribute set, and determine whether the test image is OOD data based on the comparison result.
6. The system according to claim 5, characterized in that The selection module is specifically used for: Input the initial prompt into the natural language processing model GPT-3, generate several sentences corresponding to the initial prompt, split the several sentences into several attributes using the pre-trained language T5 model, identify and delete the class name tag of each of the several attributes through string matching, obtain corresponding candidate attributes, and sample the attributes of each category in the candidate attributes in equal amounts, select several representative attributes from the sampled attributes using the scoring function shown in Formula 1, and obtain a representative attribute set; Among them, C y represents the representative attribute set of class y, F(c) represents the distinguishability score of attribute c, E() represents the similarity within the attribute, hyperparameters α and β represent the weights of controlling the two sub-functions, c1 and c2 represent the specific concepts in the candidate concept set, S y represents the candidate set of class y.
7. The system according to claim 5, characterized in that The module to be tested is specifically used for: The test image and test prompt are input into the pre-built multimodal large model LLaVA to obtain the corresponding attribute description, and the attribute description is input into the pre-trained language T5 model to obtain the attribute set of the test image.
8. The system according to claim 5, characterized in that The detection module is specifically used for: The similarity score between the attribute set of the test image and the representative attribute set is calculated using Formula 2 and Formula 3. If the similarity score is greater than or equal to a preset threshold, the test image is in-distribution ID data; if the similarity score is less than the preset threshold, the test image is out-of-distribution OOD data. Sim final (A)=max i Sim max (A,N) Formula 3; Among them, Sim max (A,N y ) represents the image attribute set A and the attribute set N of class y y The maximum similarity between them, sim() means calculating the cosine similarity, N y,K represents the kth attribute of class y, a i Indicates the i-th attribute detected from the test image, Sim final (A) is the maximum similarity value calculated by detecting the image attribute set A to all category attribute sets N, that is, the similarity score.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the attribute-based out-of-distribution OOD data detection method as described in any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by a processor, the steps of the attribute-based out-of-distribution OOD data detection method as described in any one of claims 1-4 are implemented.