Data detection method, detection model updating method and map scene classification method

By using offset constraints in the detection model to detect the output of the model, based on the sample data distribution information of the category of interest, the problem of category of interest limitation in data classification is solved, and the accuracy of data detection and classification is improved.

CN120388201APending Publication Date: 2025-07-29HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410116626.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-26
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

Existing data classification methods are limited by the categories of interest, resulting in the inability to classify or misclassification, affecting the accuracy of data detection and classification.

Method used

By obtaining the target data, inputting the detection model for detection, using the offset to constrain the output of the detection model based on the sample data distribution information of each subclass of interest in the category of interest, quantifying the reasons for insufficient accuracy of the detection result, and then optimizing the detection model.

Benefits of technology

It improves the accuracy of data detection, ensures the accuracy of data classification, and adaptively determines the offset without presuming the distribution of sample data, which has a wider practicality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120388201A_ABST
    Figure CN120388201A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data detection method, a detection model updating method and a map scene classification method. The data detection method comprises the steps of obtaining target data; the target data are input into a detection model for detection, a detection result of whether the target data belong to an interested category is obtained, the interested category comprises at least one interested subcategory, and the detection result is obtained based on output constraint of the offset to the detection model; the offset is obtained based on the distribution information of the sample data of each interested subclass in the interested class. The offset is obtained based on the distribution information of the sample data of each interested sub-class in the interested class, and the reason for insufficient accuracy of the detection result is quantified, so that the output of the detection model is restrained, the detection result is obtained, the accuracy of data detection is improved, the accuracy of data classification is further ensured, and the accuracy of data classification is improved. And the distribution of the sample data is not pre-assumed, the offset is adaptively determined, and the method has wider practicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of data processing, and particularly to a data detection method, a detection model update method, and a map scene classification method. Background Art

[0002] With the development of computer technology, data classification methods represented by classification models (a type of machine learning model), decision trees, nearest neighbor rules, and statistical analysis have been widely applied in many fields such as text, images, bioinformatics, object recommendation, search queries, and social networks.

[0003] Currently, data classification methods are restricted by the categories of interest, that is, multiple subcategories need to be set in advance to determine which subcategory the data belongs to. Therefore, inevitably, they are restricted by the categories of interest. That is, classifying data that does not belong to the categories of interest will result in unclassifiable or misclassified results, reducing the accuracy of data classification. To ensure the accuracy of data classification, it is necessary to pre-detect the data to be classified to determine whether the data belongs to the categories of interest. However, if the accuracy of data detection cannot be guaranteed, it will directly affect the accuracy of subsequent data classification. Therefore, there is an urgent need for a high-accuracy data detection method. Summary of the Invention

[0004] In view of this, the embodiments of this specification provide a data detection method. One or more embodiments of this specification also relate to a detection model update method, a map scene classification method, a data detection device, a detection model update device, a map scene classification device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.

[0005] According to the first aspect of the embodiments of this specification, a data detection method is provided, including:

[0006] Obtain target data;

[0007] Input the target data into a detection model for detection to obtain a detection result on whether the target data belongs to the category of interest, where the category of interest includes at least one subcategory of interest, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample data of each subcategory of interest in the category of interest.

[0008] According to the second aspect of the embodiments of this specification, a detection model update method applied to a cloud-side device is provided, including:

[0009] Obtain a sample set, where the sample set includes sample data belonging to each subcategory of interest in the category of interest, and the category of interest includes at least one subcategory of interest;

[0010] Input each sample data in the sample set into the detection model for detection, obtain the prediction detection result of whether each sample data belongs to the category of interest, and determine the sample data with the prediction detection result belonging to the category of interest as the target sample data;

[0011] Input the target sample data into the classification model for classification, and obtain the predicted subclass of interest to which the target sample data belongs;

[0012] Based on the predicted subclass of interest to which the target sample data belongs and the distribution information of the sample data belonging to the predicted subclass of interest, determine the offset;

[0013] Based on the offset, perform output constraint on the detection model to obtain an updated detection model;

[0014] Send the model parameters of the updated detection model to the terminal device.

[0015] According to the third aspect of the embodiments of this specification, a map scene classification method is provided, which is applied to a cloud-side device and includes:

[0016] Obtain a target map;

[0017] Input the target map into the detection model for detection, and obtain the detection result of whether the target map belongs to a scene map. Among them, the scene map includes at least one scene subclass, and the detection result is obtained based on the output constraint of the detection model on the offset, and the offset is obtained based on the distribution information of the sample maps of each scene subclass in the scene map;

[0018] When the target map belongs to the scene map, input the target map into the classification model for classification, and obtain the target scene subclass to which the target map belongs;

[0019] Feed back the target scene subclass to the terminal device.

[0020] According to the fourth aspect of the embodiments of this specification, a computing device is provided, including:

[0021] A memory and a processor;

[0022] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above method are implemented.

[0023] According to the fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer programs / instructions. When the instructions are executed by the processor, the steps of the above method are implemented.

[0024] According to a sixth aspect of the embodiments of the present specification, there is provided a computer program product, including a computer program / instructions, which when executed by a processor, implement the steps of the above method.

[0025] In one embodiment of the present specification, target data is obtained; the target data is input into a detection model for detection to obtain a detection result as to whether the target data belongs to an interested category, where the interested category includes at least one interested subcategory, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample data of each interested subcategory in the interested category. Obtaining the offset based on the distribution information of the sample data of each interested subcategory in the interested category clearly quantifies the reason for the insufficient accuracy of the detection result output by the detection model, and constrains the output of the detection model based on the offset to obtain the detection result as to whether the target data belongs to the interested category, improving the accuracy of data detection, thereby ensuring the accuracy of data classification. Moreover, no prior assumption is made about the distribution of the sample data, and the offset is adaptively determined, having a wider range of practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a schematic diagram of in-distribution data classification and out-of-distribution data detection;

[0027] Figure 2 is a schematic diagram of model adaptive training;

[0028] Figure 3 is a flowchart of a data detection method provided by an embodiment of the present specification;

[0029] Figure 4 is a front-end schematic diagram of image classification in a data detection method provided by an embodiment of the present specification;

[0030] Figure 5 is a flowchart of a detection model update method provided by an embodiment of the present specification;

[0031] Figure 6 is a flowchart of a map scene classification method provided by an embodiment of the present specification;

[0032] Figure 7 is a processing procedure flowchart of a map scene classification method applied to urban road detection provided by an embodiment of the present specification;

[0033] Figure 8 is a schematic structural diagram of a data detection device provided by an embodiment of the present specification;

[0034] Figure 9 is a schematic structural diagram of a detection model update device provided by an embodiment of the present specification;

[0035] Figure 10 It is a schematic structural diagram of a map scene classification device provided by an embodiment of this specification;

[0036] Figure 11 It is a structural block diagram of a computing device provided by an embodiment of this specification. Specific embodiments

[0037] In the following description, numerous specific details are set forth in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the spirit of this specification. Therefore, this specification is not limited by the specific embodiments disclosed below.

[0038] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more of the associated listed items.

[0039] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0040] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for parsing, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data that have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for the user to select authorization or rejection.

[0041] In one or more embodiments of this specification, a large model refers to a deep learning model with a large number of model parameters, usually including hundreds of millions, tens of billions, hundreds of billions, trillions or even more than one quadrillion model parameters. A large model can also be called a Foundation Model. Through pre-training of a large model with a large amount of unlabeled corpus, a pre-trained model with more than hundreds of millions of parameters is produced. Such a model can adapt to a wide range of downstream tasks and has good generalization ability. For example, Large Language Model (LLM), Multi-modal Pre-training Model, etc.

[0042] When a large model is actually applied, it only needs to be fine-tuned with a small number of samples to be applied to different tasks. Large models can be widely applied in fields such as Natural Language Processing (NLP), computer vision, etc. Specifically, they can be applied to tasks in the field of computer vision such as Visual Question Answering (VQA), Image Caption (IC), image generation, etc., and tasks in the field of natural language processing such as text-based sentiment classification, text summary generation, machine translation, etc. The main application scenarios of large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0043] First, the noun terms involved in one or more embodiments of this specification are explained.

[0044] Convolutional Neural Networks (CNN) model: A multi-layer deep learning model with forward propagation and backward propagation, having a convolutional kernel (filter) for processing feature data.

[0045] Recurrent Neural Network (RNN) model: A recursive deep learning model that recurs in the processing direction of vector representations and whose intermediate layers are connected in a chain.

[0046] Long Short Term Memory (LSTM) model: A deep learning model with the ability to remember long-term and short-term information, having a convolutional kernel for processing feature data.

[0047] Deep self-attention model (Transformer model): A deep learning architecture based on the attention mechanism, used to process sequential data such as natural language.

[0048] Bidirectional Encoder Representations from Transformers (BERT model): A special Transformer model trained using bidirectional Transformer encoders and large-scale unlabeled text data.

[0049] Data detection: Used to detect whether data belongs to several subclasses of interest within a class of interest, including in-distribution data detection and out-of-distribution data detection.

[0050] In-Distribution Classification (ID): Classify data into several subclasses of interest within a class of interest.

[0051] Out-Of-Distribution Detection (OOD): Detect data as not belonging to the class of interest.

[0052] Figure 1 Shows a schematic diagram of in-distribution data classification and out-of-distribution data detection, as Figure 1 shown:

[0053] The class of interest includes 3 subclasses of interest: subclass of interest 1, subclass of interest 2, and subclass of interest 3. Data essentially belongs to 3 subclasses of interest and non-interested classes. Data classification is performed on the data to obtain classification results, including correct classification and misclassification. As Figure 1 shown, in addition to correct in-distribution data and correct out-of-distribution data, data that actually belongs to a subclass of interest may be detected as out-of-distribution data, which is misclassified in-distribution data. It is also possible to detect data that does not belong to a subclass of interest as in-distribution data and classify it into a specific subclass of interest, which is misclassified out-of-distribution data.

[0054] Adaptive training: Refers to using new data for learning in the operating environment to quickly adapt to changes in real-world situations that are unforeseen during the development process. Adaptive training includes links such as self-evaluating algorithm performance, optimizing the model, and scenario migration. For the adaptive training of a detection model, adaptive training is periodic. The steps of adaptive training are as Figure 2 shown, Figure 2 Shows a schematic diagram of model adaptive training, as Figure 2 shown:

[0055] First, adaptively discover classification problems; then, adaptively optimize the detection model; then, adaptively evaluate the detection effect; finally, adaptively update the classification model.

[0056] One of the important ways to achieve adaptive evaluation is out-of-distribution sample data detection. For the objects detected by the object detection algorithm, it is automatically determined whether they belong to the predefined in-distribution interesting categories, so as to evaluate whether the detection algorithm outputs more misdetection results and quantify the performance change of the algorithm.

[0057] Bayes' theorem: It is a standard method in probability statistics to revise the subjective judgment (i.e., prior probability) of the probability distribution by the observed phenomena. Bayes' theorem realizes the reverse inference of unknown causes from known results. The specific calculation formula of Bayes' theorem is as follows in Formula 1:

[0058]

[0059] Among them, P(A|B) represents the probability that event A occurs under the condition that event B occurs, and can also be called conditional probability or posterior probability. P(A) represents the probability that event A occurs, and can also be called prior probability or marginal probability. P(B) represents the probability that event B occurs, and can also be called prior probability, marginal probability or normalization constant. P(A, B) represents the joint probability that event A and event B occur together. P(B|A) represents the probability that event B occurs under the condition that event A occurs, and can also be called likelihood probability or likelihood. P(B|A) / P(B) can also be called normalized likelihood probability or normalized likelihood.

[0060] In the application scenario of data classification, taking the data classification of in-distribution data and out-of-distribution data as an example, let X in represent in-distribution data, X out represent out-of-distribution data, Y in ={1, 2, ……, k} represent the interesting categories in the distribution, including k interesting subcategories. Assume that x is the random data in the sample set (X = X in + X out ), and y is the random interesting subcategory in the interesting category Y in ={1, 2, ……, k} in the distribution.

[0061] The posterior probability of predicting the random data x as the random interesting subcategory y is represented as shown in Formula 2:

[0062]

[0063] Among them, P(y|x) represents the posterior probability of predicting the random data x as the random subclass of interest y, P(x|y) represents the posterior probability of the input being the random data x when predicting the random subclass of interest y. Similarly, it represents the data density under the random subclass of interest, and P(y) represents the prior probability of the random subclass of interest y.

[0064] When considering out-of-distribution data, it is necessary to consider that the random data x is in-distribution data X in The posterior probability is shown in Equation 3:

[0065] P(i|x) = ∑ 1~k P(y|x) = 1 - P(o|x) Equation 3

[0066] Among them, P(i|x) represents the posterior probability that the random data x is in-distribution data X in and P(o|x) represents the posterior probability that the random data x is out-of-distribution data X and P(o|x) represents the posterior probability that the random data x is out-of-distribution data X out of the posterior probability.

[0067] Generally, only by inputting the in-distribution data X in into the classification model f can data classification be completed, while inputting the out-of-distribution data X out into the classification model f cannot complete data classification. Therefore, it is necessary to pre-detect the data to determine whether the data belongs to the category of interest before performing data classification. Therefore, the posterior probability of predicting the random data x in the in-distribution data X in and the out-of-distribution data X out as the subclass of interest y is shown in Equation 4:

[0068]

[0069] Among them, P(y|x) represents the posterior probability of predicting the random data x as the subclass of interest y, P(i, y|x) represents the posterior probability of predicting the random data x as the subclass of interest y when detecting the random data x as in-distribution data i, P(i, y│x) = (P(x, i, y)) / (P(x)) is determined by the definition of Bayes' theorem P(A│B) = (P(A, B)) / (P(B)), P(y|x, i) represents the posterior probability of predicting the in-distribution random data (x, i) as the subclass of interest y, and P(i|x) represents the posterior probability that the random data x is in-distribution data X in of the posterior probability. First, use the detection model g to detect the data, and then use the classification model f to classify the data detected as in-distribution data. Correspondingly, P(y|x, i) can be estimated by the output of the classification model f, and P(i|x) can be estimated by the output of the detection model g.

[0070] For k subclasses of interest, the data distribution under the subclasses of interest is often unbalanced. Therefore, only considering the classification model f, through Bayesian optimization estimation, after evenly considering the data distribution under the subclasses of interest, the balanced posterior probability of predicting the random data x as the subclass of interest y is shown in Equation 5:

[0071]

[0072] Among them, P bal (y|x) represents the balanced posterior probability of predicting the random data x as the subclass of interest y, P(x|y) represents the posterior probability that the input is the random data x when predicting the random subclass of interest y, P(y) represents the prior probability of the random subclass of interest y, P(y|x, i) represents the posterior probability of predicting the in-distribution random data (x, i) as the subclass of interest y, and P(i|x) represents the posterior probability that the random data x is the in-distribution data X in of the posterior probability.

[0073] Thus, through Equation 5, the posterior probability output by the detection model g for the balanced subclasses of interest in the ideal state can be estimated, as shown in Equation 6:

[0074]

[0075] Among them, P bal (i|x) represents the posterior probability output by the detection model g for the balanced subclasses of interest obtained by estimation, P bal (y|x) represents the balanced posterior probability of predicting the random data x as the subclass of interest y, P(y|x, i) represents the posterior probability of predicting the in-distribution random data (x, i) as the subclass of interest y, P(y) represents the prior probability of the random subclass of interest y, and P(i|x) represents the posterior probability output by the detection model g for the unbalanced subclasses of interest obtained by estimation.

[0076] It can be determined that: This offset obtained based on the distribution information of the data of each subclass of interest in the class of interest is the reason for the insufficient accuracy of the detection result output by the detection model g. This offset will result in a lack of sufficient sample data in the tail subclasses of interest of the in-distribution data. In the application process, it is easy to mis-detect the data of the tail subclasses of interest as out-of-distribution samples, or it is easy to misclassify the out-of-distribution data as the head subclasses of interest of the in-distribution data. By constraining the output g(x) of the detection model g based on this offset β(x), more accurate data detection can be achieved, precisely improving the accuracy of data detection, and then ensuring the accuracy of data classification. Moreover, no prior assumption is made about the distribution of the sample data, and the offset is adaptively determined, with more extensive practicality.

[0077] In this specification, a data detection method is provided. This specification also relates to a detection model update method, a map scene classification method, a data detection device, a detection model update device, a map scene classification device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail one by one in the following embodiments.

[0078] See Figure 3 , Figure 3 which shows a flowchart of a data detection method provided by an embodiment of this specification, including the following specific steps:

[0079] Step 302: Obtain target data.

[0080] Embodiments of this specification are applied to the client or server of an application, web page, or applet with data detection capabilities. Among them, the application, web page, or applet can be applications, web pages, or applets in multiple fields, such as text classification, image classification, bioinformatics classification, object recommendation, search query, social network, and machine learning, etc.

[0081] The target data is the data to be detected. The target data can be data of multiple modalities, including but not limited to: text modality, image modality, numerical modality, audio modality, and structured data modality. For example, for the text modality, the target data can be user review texts and social message texts; for another example, for the image modality, the target data can be medical images and video frames, and the target data can also be partial image regions in the entire image; for still another example, for the numerical modality, the target data can be coordinate values and physical measurement values; for still another example, for the audio modality, the target data can be user voice data, video audio, and music audio; for still another example, for the structured data modality, the target data is knowledge graphs, node tree data, and key-value pair data.

[0082] Obtaining the target data can be to obtain target data of the text modality such as user review texts, social message texts, and news articles through data interfaces, data acquisition tools, or directly from application internal log records, etc. It can also be to obtain static images or video frames from an image database or a real-time streaming media service as the target data, and may further perform regional cropping to extract specific image regions as the target data. It can also be to use image data and physical measurement values collected in real time by sensor devices as the target data. It can also be form data input by users or knowledge graphs, node tree data, and key-value pair data stored in a structured database as the target data. It can also be to use voice signals, video signals collected by voice or image acquisition devices, or decoded audio segments read from audio files and video files as the target data.

[0083] Exemplarily, target data is selected from an open sample set containing a large number of animal images. For example, a randomly selected animal image to be detected is obtained. This image may be sourced from a pet photo library uploaded by a user to a social media platform, a photo generated by an image generation model, or a frame captured by a surveillance camera, to obtain the target image x.

[0084] Obtain the target data, which lays a data foundation for subsequent data detection.

[0085] Step 304: Input the target data into the detection model for detection to obtain a detection result on whether the target data belongs to the class of interest, where the class of interest includes at least one subclass of interest, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample data of each subclass of interest in the class of interest.

[0086] The detection model is a machine learning model with data detection capabilities. Essentially, the detection model is a binary classification model that can classify data into in-distribution data or out-of-distribution data. For different modalities of input data, the detection model includes, but is not limited to: text binary classification model, image binary classification model, numerical binary classification model, audio binary classification model, and structured data binary classification model. For different types of machine learning models, the detection model includes, but is not limited to: CNN model, RNN model, LSTM model, Transformer model, BERT model, and large models.

[0087] The detection result is the output result of the detection model, including: belonging to the class of interest and not belonging to the class of interest. The data belonging to the class of interest is the predicted in-distribution data, and the data not belonging to the class of interest is the predicted out-of-distribution data. It should be noted that the detection result may be the direct output of the detection model or not, and is obtained by post-processing the model output. For example, the output of the detection model is the confidence that the target data belongs to the class of interest, or the confidence that the target data belongs to a subclass of interest, and then it is determined whether the target data belongs to the class of interest or not.

[0088] The class of interest is a pre-set data class distribution, which is a detection criterion for detecting whether data is in-distribution data. When the detection result of the target data belongs to the class of interest, the target data is determined to be in-distribution data; when the detection result of the target data does not belong to the class of interest, the target data is determined to be out-of-distribution data. The class of interest includes, but is not limited to: text class, numerical class, object class, image class, semantic class, sentiment class, audio class, and behavior class. The class of interest includes at least one sub-class of interest. For example, in the cat-dog image classification, "cat" and "dog" are determined as image sub-classes. Image data belonging to the "cat" or "dog" image sub-class is in-distribution data, and data not belonging to the "cat" and "dog" image sub-classes is out-of-distribution data. Another example is in sentiment classification, where "positive sentiment" and "negative sentiment" are determined as sentiment sub-classes. Data belonging to the "positive sentiment" or "negative sentiment" sentiment sub-class is in-distribution data, and data not belonging to the "positive sentiment" and "negative sentiment" sentiment sub-classes is out-of-distribution data.

[0089] The sub-class of interest is at least one specific data class pre-set in the class of interest, which is a classification criterion for classifying in-distribution data. Optionally, when the detection result of the target data belongs to the class of interest, the target data is determined to be in-distribution data, and the in-distribution data is classified to determine the classification result of the target data belonging to the sub-class of interest. The sub-class of interest includes, but is not limited to: text sub-class, numerical sub-class, object sub-class, image sub-class, semantic sub-class, sentiment sub-class, audio sub-class, and behavior sub-class. For example, in the cat-dog image classification, "cat" and "dog" are determined as image classes, including the sub-class of interest "cat" and the sub-class of interest "dog". Another example is in sentiment classification, where "positive sentiment" and "negative sentiment" are determined as sentiment classes, including the sub-class of interest "positive sentiment" and the sub-class of interest "negative sentiment".

[0090] The sample data is sample data for training a machine learning model, which can be sample data for training a detection model, or sample data for training a classification model, or sample data for training both a detection model and a classification model. The sample data can be sample data belonging to each interested subclass within the interested category, that is, in-distribution sample data. Optionally, the sample data can also be sample data not belonging to each interested subclass within the interested category, that is, out-of-distribution sample data. For example, in a sentiment classification task, in-distribution sample data: sample texts in the "positive sentiment" sentiment subclass, such as "I really like this mobile phone. It has powerful performance and smooth operation!"; sample texts in the "negative sentiment" sentiment subclass, such as "I am very dissatisfied with this service. The speed of handling problems is too slow." Out-of-distribution sample data: sample texts not belonging to "positive sentiment" and "negative sentiment", for example, "Remember to bring an umbrella tomorrow. It's forecasted to rain." Another example, in an image classification task, in-distribution sample data: sample images in the "cat" image subclass and sample images in the "dog" image subclass. Out-of-distribution sample data: images not belonging to the "cat" and "dog" image subclasses (such as images of birds and fish).

[0091] The distribution information of the sample data is the characteristic information of the distribution characteristics of the sample data in at least one interested subclass. The distribution information of the sample data reflects the distribution characteristics such as the quantity, proportion, and frequency of the sample data in each interested subclass. The distribution information of the sample data can be determined by a statistical algorithm or by using a machine learning algorithm, which is not limited here. The distribution information of the sample data includes but is not limited to: sample quantity, class proportion, feature distribution, and correlation distribution. Among them, the sample quantity is the quantity of the sample data in each interested subclass; the class proportion is the proportion of each interested subclass in the sample data; the feature distribution is, for numerical features, the statistics such as mean, variance, and median obtained by statistically analyzing the sample data in each interested subclass, or for categorical features, the frequency distribution of the interested subclasses obtained by statistically analyzing the sample data in each interested subclass; the correlation analysis is the correlation calculated between the sample data in different interested subclasses. For example, in a sentiment classification task, the distribution information of the sample data includes: Sample quantity: There are 5000 sample data in the "positive sentiment" sentiment subclass and 3000 sample data in the "negative sentiment" sentiment subclass. Class proportion: The "positive sentiment" sentiment subclass accounts for 60%, and the "negative sentiment" sentiment subclass accounts for 40%. Feature distribution: In the "positive sentiment" sentiment subclass, the high-frequency words may be "like", "satisfied", etc., while in the "negative sentiment" sentiment subclass, the high-frequency words may be "dissatisfied", "bad review", etc. Another example, in an image classification task, the distribution information of the sample data includes: Sample quantity: There are 8000 images in the "cat" image subclass and 7000 images in the "dog" image subclass.

[0092] The offset is a constraint parameter for output constraint of the detection model, which is a quantization parameter. The offset is calculated based on the distribution information of the sample data of each interested subclass in the interested category. Through the constraint of the offset, the ability of the detection model to distinguish in-distribution data and out-of-distribution data is optimized. For example, in sentiment classification, the interested subclasses include "positive sentiment" and "negative sentiment". The sample data distribution information shows that the number of samples in the "positive sentiment" subclass is large, and the frequencies of its high-frequency words such as "like" and "satisfied" are much higher than those in the "negative sentiment" subclass. Therefore, during the training process, the detection model may be too sensitive to the "positive sentiment" subclass, resulting in relatively weak recognition ability for the "negative sentiment" subclass. By introducing an offset to adjust the output constraint of the model. According to the sample data distribution information of the "positive sentiment" and "negative sentiment" subclasses, an appropriate offset is calculated, and this offset is used to correct the output result of the detection model.

[0093] Based on the output constraint of the detection model by the offset, the detection result can be constrained by post-processing during the data detection process, or the output can be constrained during the training process of the detection model. For example, the loss value can be constrained, or the predicted detection result of the detection model during the training process can be constrained. This is not limited here.

[0094] The offset obtained based on the distribution information of the sample data of each interested subclass in the interested category can be determined by statistically analyzing the distribution information of the sample data of each interested subclass in the interested category, or by using a machine learning algorithm to determine the offset based on the distribution information of the sample data of each interested subclass in the interested category. It can also be determined by statistically analyzing the output of the machine learning model. For example, the classification probability of the sample data input to the classification model belonging to the predicted interested subclass is statistically determined. This is not limited here.

[0095] Input the target data into the detection model for detection to obtain the detection result of whether the target data belongs to the interested category. The specific method is: input the target data into the detection model for detection to obtain the binary classification probability output by the detection model, and based on the binary classification probability, determine the detection result of whether the target data belongs to the interested category.

[0096] Taking the statistical analysis of the classification probability of the sample data input to the classification model f belonging to the predicted interested subclass as an example, the sample data input to the classification model f is determined as the random data x in the sample set X. The predicted interested subclass to which the sample data output by the classification model f belongs is (y|x), which represents the event of obtaining the interested subclass y under the condition of inputting the random data x, and the corresponding classification probability is P(y|x). At the same time, generally, before inputting the random data x into the classification model f, it is necessary to determine whether the random data x is in-distribution sample data Xin , P(y|x, i) can be determined as the classification probability of the sample data output by the classification model f belonging to the predicted subclass of interest, and the distribution probability of the sample data of each subclass of interest is determined as P(y). The offset can be characterized as Considering that this data detection is a binary classification detection (dividing the input data into in-distribution data or out-of-distribution data), for the detection model g, the output represents the posterior probability P(i|x) that the random data x is in-distribution data X in , and the binary classification probability of the output of the detection model g with output constraint can be characterized as P^bal(i│x) = P(i│x)·∑_y(P(y│x, i)) / P(y). Among them, P(i│x) can be estimated by the normalization function sigmoid function, that is, P(i|x) = sigmoid(g(x)), where g(x) is a linear layer added on the basis of the regression function of in-distribution data or out-of-distribution data to ensure that the output value is mapped between negative infinity and positive infinity.

[0097] Exemplarily, during the process of training the classification model, it is determined that the distribution information of the sample images shows that the proportion of the number of subclasses of "cat" images is 68%, while the proportion of the number of subclasses of "dog" images is 15%, and the rest are out-of-distribution sample images that are neither "cat" nor "dog". This imbalance in class proportions may cause the detection model to be overly sensitive to identifying subclasses of "cat" images during detection, while not sensitive enough to identifying subclasses of "dog" images. Obtain the classification probability P1(y1|x, i) of the sample image output by the classification model belonging to the predicted subclass of interest of "cat", obtain the classification probability P2(y2|x, i) of the sample image output by the classification model belonging to the predicted subclass of interest of "dog", determine the distribution probability of the sample images of the "cat" image subclass as P(y1), determine the distribution probability of the sample images of the "dog" image subclass as P(y2), and determine the offset β(x) as (P1(y1│x, i)) / P(y1)+(P2(y2│x, i)) / P(y2). Input the target image x into the detection model, and the binary classification probability output by the detection model with output constraint is P^bal(i│x) = P(i│x)·[(P1(y1│x, i)) / P(y1)+(P2(y2│x, i)) / P(y2)]. Based on this binary classification probability P^bal(i│x), obtain the detection result of whether the target image x belongs to the class of interest.

[0098] In the embodiments of this specification, an offset is obtained based on the distribution information of the sample data of each interested subclass in the class of interest, clearly quantifying the reasons for the insufficient accuracy of the detection results output by the detection model, and constraining the output of the detection model based on the offset to obtain the detection result of whether the target data belongs to the class of interest, improving the accuracy of data detection, and thus ensuring the accuracy of data classification. Moreover, no prior assumption is made about the distribution of the sample data, and the offset is adaptively determined, having broader practicability.

[0099] In an alternative embodiment of this specification, after step 304, the following specific steps are further included:

[0100] In the case where the detection result belongs to the class of interest, the target data is input into a classification model for classification to obtain the target interested subclass to which the target data belongs.

[0101] The classification model is a machine learning model with a data classification function. Essentially, the classification model is a multi-classification model that can classify data into different interested subclasses. For input data of different modalities, the classification model includes but is not limited to: text multi-classification model, image multi-classification model, numerical multi-classification model, audio multi-classification model, and structured data multi-classification model. For different types of machine learning models, the classification model includes but is not limited to: CNN model, RNN model, LSTM model, Transformer model, BERT model, and large model.

[0102] The target interested subclass to which the target data belongs is the specific data category to which the target data belongs, and is the classification criterion for classifying the data within the distribution of the target data. Optionally, in the case where the detection result of the target data belongs to the class of interest, the target data is determined to be in-distribution data, and the in-distribution data is classified to determine the classification result that the target data belongs to the target interested subclass. The target interested subclasses include but are not limited to: text subclass, numerical subclass, object subclass, image subclass, semantic subclass, emotion subclass, audio subclass, and behavior subclass. For example, in the classification of cat and dog images, "cat" and "dog" are determined as image categories, including the target interested subclass of "cat" and the target interested subclass of "dog". Another example is in emotion classification, where "positive emotion" and "negative emotion" are determined as emotion categories, including the target interested subclass of "positive emotion" and the target interested subclass of "negative emotion".

[0103] In the case where the detection result belongs to an interesting category, the target data is input into a classification model for classification to obtain the target interesting subcategory to which the target data belongs. The specific method is as follows: In the case where the detection result belongs to an interesting category, the target data is input into a classification model for classification to obtain the classification probability output by the classification model, and based on the classification probability, the target interesting subcategory to which the target data belongs is determined.

[0104] Exemplarily, in the case of whether the target image x belongs to an interesting category, the target image x is input into an image classification model for classification to obtain the classification probability P(y|x, i) output by the image classification model: For the "cat" image subcategory, the classification probability P(y1|x, i) is 0.97, and for the "dog" image subcategory, the classification probability P(y2|x, i) is 0.03. Based on this classification probability P(y|x, i), it is determined that the target interesting subcategory to which the target image x belongs is "cat".

[0105] In the embodiments of this specification, in the case where the detection result that the detection result belongs to an interesting category is obtained, the accuracy of data detection is ensured, and then the classification model is used to classify the target data, improving the accuracy of data classification.

[0106] In an alternative embodiment of this specification, step 304 includes the following specific steps:

[0107] The target data is input into a detection model for detection to obtain the detection probability of whether the target data belongs to an interesting category;

[0108] Using the offset as a constraint condition, post-process the detection probability to obtain the detection result of whether the target data belongs to an interesting category.

[0109] The detection probability is the binary classification probability output by the detection model, which is the probability estimate of whether the input data belongs to an interesting category output by the detection model after processing the input data. This probability value usually ranges from 0 to 1. The closer it is to 1, the greater the possibility that the model believes the data belongs to an interesting category, and the closer it is to 0, the greater the possibility that it does not belong to an interesting category. For example, in the classification of cat and dog images, "cat" and "dog" are determined as image subcategories, images belonging to the "cat" or "dog" image category are in-distribution data, and data not belonging to the "cat" and "dog" image subcategories are out-of-distribution data. When an image is input into the detection model, the detection probability output by the detection model is [0.9, 0.1], which means the probability that the image belongs to the "cat" or "dog" image category is 0.9, and the probability that it does not belong to the "cat" and "dog" image subcategories is 0.1.

[0110] Post - processing is an operation to correct, adjust, or optimize the original prediction results after the prediction output of a machine learning model. Post - process the output of the detection model based on the offset, and use the offset to correct the binary classification probability of the original output of the detection model to improve the ability of the detection model to distinguish between in - distribution and out - of - distribution data, and finally obtain an updated detection model. For example, for an image, the original output of the detection model is [0.9, 0.1], which means the probability that the image belongs to the "cat" or "dog" image category is 0.9, and the probability that it does not belong to the "cat" and "dog" image sub - categories is 0.1. After post - processing the model output based on the offset, out - of - distribution images that may be misjudged as the "cat" image sub - category are corrected, so as to perform data detection more accurately, and the corrected output [0.8, 0.2] is obtained, which means that in fact the probability that the image belongs to the "cat" or "dog" image category is 0.8, and the probability that it does not belong to the "cat" and "dog" image sub - categories is 0.2.

[0111] Taking the offset as a constraint condition, post - process the detection probability, as specifically shown in Equation 7:

[0112]

[0113] where \(g(x)\) is the original output of the detection model \(g\), and \(g^{\prime}(x)\) is the post - processed output of the detection model \(g\). By taking the logarithm \(\log\), numerical stability is ensured. bal For example, input the target image \(x\) into the detection model for detection to obtain the detection probability \(P(i|x)\) of whether the target image \(x\) belongs to the category of interest. Through Equation 7, taking the offset \(\beta(x)\) as a constraint condition, post - process the detection probability \(P(i|x)\) to get \(P^{\text{bal}}(i|x)=P(i|x)\cdot\left[\frac{P_1(y_1|x, i)}{P(y_1)}+\frac{P_2(y_2|x, i)}{P(y_2)}\right]\), and obtain the detection result of whether the target data belongs to the category of interest.

[0114] In the embodiments of this specification, by constraining the output of the detection model, the ability of the detection model to distinguish between in - distribution and out - of - distribution data, as well as the overall accuracy and robustness, are improved, the accuracy of data detection is precisely enhanced, and thus the accuracy of data classification is ensured.

[0115] In an alternative embodiment of this specification, before step 304, the following specific steps are further included:

[0116] Obtain a sample set, where the sample set includes sample data belonging to each interested sub - category in the category of interest;

[0117]

[0118] ​Input each sample data in the sample set into the detection model for detection, obtain the prediction detection results of whether each sample data belongs to the category of interest, and determine the sample data with the prediction detection result belonging to the category of interest as the target sample data;

[0119] Input the target sample data into the classification model for classification to obtain the predicted subcategory of interest to which the target sample data belongs;

[0120] Based on the predicted subcategory of interest to which the target sample data belongs and the distribution information of the sample data belonging to the predicted subcategory of interest, determine the offset;

[0121] Based on the offset, perform output constraint on the detection model to obtain an updated detection model.

[0122] The sample set is a set of sample data for training a machine learning model, which contains multiple instances from different categories or subcategories. The sample set includes sample data of each subcategory of interest belonging to the category of interest (for example, "cat" and "dog" in the cat-dog classification task, and "positive sentiment" and "negative sentiment" in the sentiment analysis task).

[0123] In an optional embodiment of this specification, the sample set further includes sample data that does not belong to the category of interest.

[0124] Optionally, the sample set further includes sample data that does not belong to each subcategory of interest in the category of interest, that is, out-of-distribution sample data. The sample set is obtained from the open world, and can be obtained from a sample database, can also be obtained by artificial generation, or can be obtained from an open source data source. For example, for the sample set of the cat-dog image classification task obtained from the open world, it contains 1000 sample images labeled as "cat" and 1000 sample images labeled as "dog", and 10000 unlabeled sample images.

[0125] The sample data is the sample data in the sample set for training a machine learning model and is the sample data for training the detection model. The sample data can be the sample data of each subcategory of interest belonging to the category of interest, that is, in-distribution sample data. Optionally, the sample data can also be the sample data that does not belong to each subcategory of interest in the category of interest, that is, out-of-distribution sample data. For example, in the image classification task, in-distribution sample data: sample images of the "cat" image subcategory and sample images of the "dog" image subcategory. Out-of-distribution sample data: images that do not belong to the "cat" and "dog" image subcategories (such as images of birds and fish).

[0126] The target sample data is the sample data predicted by the detection model to belong to the category of interest during the training process, which is the predicted in-distribution sample data and is not the real in-distribution sample data, and there is a deviation between the two. For details, see Figure 1For example, in the cat-dog classification task, the sample set is input into the detection model to obtain the predicted detection results of whether each sample data belongs to the category of interest: there are 500 sample images predicted to belong to the "cat" image subclass, and these 500 sample images are the target sample images.

[0127] The distribution information of the sample data is the characteristic information of the distribution characteristics of the sample data in at least one subclass of interest. The distribution information of the sample data reflects the distribution characteristics such as the quantity, proportion, and frequency of the sample data in each subclass of interest. The distribution information of the sample data can be determined by a statistical algorithm, and the distribution information of the sample data includes but is not limited to: sample quantity, class proportion, feature distribution, and correlation distribution. Among them, the sample quantity is the quantity of the sample data in each subclass of interest; the class proportion is the proportion of each subclass of interest in the sample data; the feature distribution is, for numerical features, the statistics such as mean, variance, and median obtained by statistically analyzing the sample data in each subclass of interest, or for categorical features, the frequency distribution of the subclasses of interest obtained by statistically analyzing the sample data in each subclass of interest; the correlation analysis is the correlation calculated between the sample data in different subclasses of interest. For example, in the image classification task, the distribution information of the sample data includes: the "cat" image subclass includes 3000 images, and the "dog" image subclass includes 2000 images.

[0128] The predicted detection result is the prediction result obtained after inputting the sample data into the detection model, that is, predicting whether the sample data belongs to the pre-set data class distribution. When the predicted detection result of the sample data belongs to the category of interest, the sample data is determined as in-distribution sample data. When the predicted detection result of the sample data does not belong to the category of interest, the sample data is determined as out-of-distribution sample data. For example, in cat-dog image classification, "cat" and "dog" are determined as image subclasses, and the sample images belonging to the "cat" or "dog" image classes are in-distribution sample data, and the data that does not belong to the "cat" and "dog" image subclasses is out-of-distribution sample data.

[0129] The predicted subclass of interest is the prediction result obtained after inputting the target sample data into the classification model, that is, predicting which specific pre-set data class the target sample data belongs to. For example, after determining that the target sample data belongs to the "cat" or "dog" image class, it is further divided into the "cat" or "dog" image subclasses.

[0130] The updated detection model is the model version after adjusting the output constraint of the detection model based on the offset. By using the offset calculated from the distribution information of the sample data belonging to the predicted subclass of interest to optimize the detection model, the detection model can better adapt to the actual data distribution, optimize the discrimination ability of the detection model for in-distribution data and out-of-distribution data, and improve the accuracy and robustness of the detection model.

[0131] Input each sample data in the sample set into the detection model for detection to obtain the prediction detection results of whether each sample data belongs to the category of interest. The specific method is as follows: Input each sample data in the sample set into the detection model for detection to obtain the binary classification probability output by the detection model. Based on the binary classification probability, determine the prediction detection results of whether each sample data belongs to the category of interest.

[0132] Input the target sample data into the classification model for classification to obtain the predicted subcategory of interest to which the target sample data belongs. The specific method is as follows: Input the target sample data into the classification model for classification to obtain the classification probability output by the classification model. Based on the classification probability, determine the predicted subcategory of interest to which the target sample data belongs.

[0133] Determine the offset based on the predicted subcategory of interest to which the target sample data belongs and the distribution information of the sample data belonging to the predicted subcategory of interest. The specific method is as follows: Based on the classification probability of the predicted subcategory of interest to which the target sample data belongs output by the classification model and the distribution probability of the sample data of each predicted subcategory of interest, determine the offset. Specifically: Taking the statistics of the classification probability of the predicted subcategory of interest to which the sample data output by the classification model f belongs as an example, the sample data input into the classification model f is determined as the random data x in the sample set X. The predicted subcategory of interest to which the sample data output by the classification model f belongs is determined as (y|x), which represents the event of obtaining the subcategory of interest y under the condition of inputting the random data x, and the corresponding classification probability is P(y|x). At the same time, generally before inputting the random data x into the classification model f, it is necessary to determine whether the random data x is the in-distribution sample data X in , P(y|x, i) can be determined as the classification probability of the predicted subcategory of interest to which the sample data output by the classification model f belongs, and the distribution probability of the sample data of each subcategory of interest is determined as P(y). The offset can be characterized as

[0134] Based on the offset, perform output constraint on the detection model to obtain an updated detection model. It can be to perform constraint on the loss value determined based on the prediction detection results based on the offset, and based on the constrained loss value, adjust the model parameters of the detection model to obtain an updated detection model. It can also be to perform output constraint on the prediction detection results based on the offset, determine the loss value based on the prediction detection results, and based on the loss value, adjust the model parameters of the detection model to obtain an updated detection model. This is not limited here.

[0135] Exemplarily, obtain the sample set X from the open world, where the sample set X includes in-distribution sample images X in and out-of-distribution sample images X out, the sample image x is included from the sample set X. Each sample image x in the sample set is input into the detection model g for detection to obtain the binary classification probability P(i│x) output by the detection model g. Based on the binary classification probability P(i│x), it is determined whether each sample image x belongs to the predicted detection result of the image category. The sample image determined to belong to the image category in the predicted detection result is the target sample image (x, i). The target sample image (x, i) is input into the image classification model f for classification to obtain the classification probability P(y|x, i) output by the image classification model. Based on the classification probability P(y|x, i) of the predicted image subclass y to which the target sample image belongs output by the image classification model and the distribution probability P(y) of the sample images of each predicted image subclass, the offset is determined Based on the offset β(x), the loss value Loss determined based on the predicted detection result is constrained. Based on the constrained loss value Loss′, the model parameters of the detection model g are adjusted to obtain the updated detection model g′.

[0136] In the embodiments of this specification, the offset is obtained based on the distribution information of the sample data of each interested subclass in the interested category, which clearly quantifies the reason for the insufficient accuracy of the detection result output by the detection model. And the output of the detection model is constrained based on the offset to obtain an updated detection model, so that the detection model can better adapt to the actual data distribution, optimize the discrimination ability of the detection model for in-distribution data and out-of-distribution data, improve the accuracy and robustness of the detection model, and ensure the accuracy of subsequent data detection.

[0137] In an alternative embodiment of this specification, based on the offset, the output of the detection model is constrained to obtain an updated detection model, including the following specific steps:

[0138] Based on the predicted detection result, determine the predicted loss value of the detection model;

[0139] Taking the offset as a constraint condition, adjust the predicted loss value to obtain the total loss value;

[0140] Based on the total loss value, train the detection model to obtain an updated detection model.

[0141] The predicted loss value is a measure of the gap between the directly determined predicted detection result and the true label. The predicted loss value measures the model performance of the detection model. The predicted loss value includes but is not limited to: cross-entropy loss value, hinge loss value, exponential loss, and squared error loss value. If the target sample data is correctly detected, the predicted loss value is small; conversely, if the target sample data is misdetected, the predicted loss value is large.

[0142] The total loss value is a gap metric between the predicted detection result and the true label determined with the offset as a constraint condition. The total loss value better considers the distribution of sample data of the subclasses of interest compared to the predicted loss value, avoiding the problem of insufficient model performance of the detection model obtained by training caused by uneven distribution (i.e., the inability to clearly distinguish in-distribution and out-of-distribution data), and improving the ability of the detection model to distinguish in-distribution and out-of-distribution data as well as the overall accuracy and robustness.

[0143] Taking the offset as a constraint condition, the predicted loss value is adjusted. Taking the calculation of the binary cross-entropy loss value as an example, it is specifically shown in Formula 8 as follows:

[0144]

[0145] Wherein, is the binary cross-entropy loss function, g(x) is the output of the detection model g, and t represents whether the sample data belongs to the class of interest. By taking the logarithm log, the numerical stability of the loss value is ensured.

[0146] Based on the total loss value, the detection model is trained to obtain an updated detection model. The specific method is: based on the total loss value, the model parameters of the detection model are adjusted to obtain an updated detection model. Further, the model parameters of the detection model are adjusted by the gradient update method.

[0147] Exemplarily, based on the predicted detection result t (t = (x, i) or (x, o)), the predicted binary cross-entropy loss value Loss of the detection model g is determined. Through Formula 8, with the offset β(x) as a constraint condition, the predicted binary cross-entropy loss value Loss is adjusted to obtain the constrained loss value Loss′. Based on the constrained loss value Loss′, the model parameters of the detection model g are adjusted by the gradient update method to obtain an updated detection model g′.

[0148] In the embodiments of this specification, by constraining the predicted loss value, the ability of the detection model to distinguish in-distribution and out-of-distribution data as well as the overall accuracy and robustness are improved, the accuracy of data detection is precisely enhanced, thereby ensuring the accuracy of data classification. Moreover, no prior assumption is made about the distribution of sample data, and the offset is adaptively determined, having a wider range of practicality.

[0149] In an optional embodiment of this specification, based on the predicted subclass of interest to which the target sample data belongs and the distribution information of the sample data belonging to the predicted subclass of interest, the offset is determined, including the following specific steps:

[0150] Obtain the classification probability of the predicted subclass of interest to which the target sample data belongs output by the classification model;

[0151] Determine the distribution probability corresponding to the predicted subclass of interest based on the quantity density of the sample data belonging to the predicted subclass of interest in the sample set;

[0152] Calculate the offset based on the classification probability and the distribution probability.

[0153] In Formulas 1 to 6, and the related descriptions, it is determined that: This offset obtained based on the distribution information of the data of each subclass of interest in the class of interest is the reason for the insufficient accuracy of the detection result output by the detection model g. This offset will result in a lack of sufficient sample data in the tail subclasses of interest in the in-distribution data. In the application process, it is easy to mis-detect the data of the tail subclasses of interest as out-of-distribution samples, or it is easy to mis-classify the out-of-distribution data as the head subclasses of interest in the in-distribution data. Therefore, by determining P(y│x, i) and P(y), the offset β(x) can be correspondingly determined.

[0154] The classification probability of the target sample data output by the classification model belonging to the predicted subclass of interest is the probability estimate of the sample data belonging to the subclass of interest output by the classification model for each preset subclass of interest after processing the input target sample data. For example, in the sentiment analysis task, the target sample data is a user comment, and the classification model outputs the probabilities that this comment belongs to the sentiment subclasses of "positive sentiment" and "negative sentiment" as 0.9 and 0.1 respectively. Another example is that in the cat and dog image classification task, if a target sample image is input into the classification model, the classification model may output the probability that the image is of the "cat" image subclass as 0.9 and the probability that it is of the "dog" image subclass as 0.1. Then the classification model believes that this picture has a 90% probability of being a cat image. The classification probability is essentially a posterior probability (conditional probability), which can only be determined after inputting into the classification model. In the case of inputting the target sample data (x, i) into the classification model, the posterior probability P(y|x, i) of belonging to the predicted subclass of interest y is output.

[0155] The quantity density of the sample data belonging to the predicted subclass of interest in the sample set is the degree of concentration of the quantity of the sample data of the predicted subclass of interest in the sample set, which can be characterized by quantity, proportion, frequency, etc. The quantity density is determined by statistically calculating the quantity of the sample data of the predicted subclass of interest and the total quantity of the sample data in the entire sample set. For example, in a sample set containing 10,000 animal images, if there are 3,000 images of the "cat" image subclass and 2,000 images of the "dog" image subclass, then the quantity density of the sample data of the "cat" image subclass in the sample set is 30%, and the quantity density of the sample data of the "dog" image subclass in the sample set is 20%.

[0156] Predicting the distribution probability corresponding to the subclass of interest is the occurrence probability of the content sample data for predicting the subclass of interest. In practical applications, it is usually calculated based on the distribution of various sample categories in the training set or dataset, and is used to reflect the relative importance or commonness of each subclass of interest in the entire data distribution. For example, if the number densities of the "cat" image subclass and the "dog" image subclass in the dataset are 30% (cat) and 20% (dog) respectively, it means that the probability of randomly selecting a sample data from the sample set and it being the "cat" image subclass is 30%, and the probability of it being the "dog" image subclass is 20%. The distribution probability is essentially a prior probability, which is the prior probability P(y) determined before the input target sample data (x, i) is sent to the classification model.

[0157] In an alternative embodiment of this specification, the number of target sample data is multiple;

[0158] Correspondingly, obtaining the classification probability of the target sample data belonging to the predicted subclass of interest output by the classification model includes the following specific steps:

[0159] Obtain the classification confidence of each target sample data belonging to the predicted subclass of interest output by the classification model;

[0160] Normalize the classification confidence of each target sample data belonging to the predicted subclass of interest to obtain the classification probability of each target sample data belonging to the predicted subclass of interest.

[0161] The classification model is a multi-class machine learning model. Therefore, the classification model outputs the classification confidence of each predicted subclass of interest, and then determines the classification probability of each target sample data belonging to the predicted subclass of interest.

[0162] Normalization processing is a process of adjusting the classification confidence output by the classification model through transformation to have the same scale or unified range. It includes but is not limited to: Min-Max normalization (mapping the values to the interval [0,1]), Z-score standardization (converting the values into the form of a standard normal distribution, that is, the mean is 0 and the standard deviation is 1), and the softmax function, etc. In multi-class tasks, the softmax function is often used to normalize the output layer of the model to ensure that the sum of the probabilities of all classes is 1, so that each class can obtain a valid probability value.

[0163] Given a trained classification model, the posterior probability P(y|x, i) of predicting the target sample data (x, i) as the subclass of interest y can be estimated by the normalization function softmax function, that is, P(y|x, i) = softmax(f(x, i)).

[0164] Exemplarily, the classification confidence of each target sample image (x, i) output by the image classification model f belonging to the predicted interested subclass is f(x, i) = [f1(x, i), f2(x, i), ……, fn(x, i)], then the classification probability after normalization by the softmax function is:

[0165] In the embodiments of the present specification, by normalizing the classification confidence, the accuracy of the determined classification probability is ensured, and the accuracy of the subsequent determined offset is ensured.

[0166] In an optional embodiment of the present specification, based on the quantity density of the sample data belonging to the predicted interested subclass in the sample set, the distribution probability corresponding to the predicted interested subclass is determined, including the following specific steps:

[0167] Count the quantity of the sample data belonging to the predicted interested subclass in the sample set;

[0168] According to the quantity and the total quantity of the sample data in the sample set, determine the quantity density of the sample data belonging to the predicted interested subclass in the sample set;

[0169] Based on the quantity density, determine the distribution probability corresponding to the predicted interested subclass.

[0170] The quantity density of the sample data belonging to the predicted interested subclass in the sample set is the proportion of the quantity of the sample data of a certain predicted interested subclass in the sample set, and its relative density is measured by calculating the frequency between the sample data of the predicted interested subclass and the total sample data of the entire sample set. The concept of quantity density is mainly used to quantify the distribution of each category in the sample set, reflecting the proportion of the sample data of different predicted interested subclasses in the entire data set. A higher quantity density means that the sample data of this interested subclass is more common or frequently appears in the sample set; on the contrary, a lower quantity density indicates that the sample data of this interested subclass is less and sparser in the sample set.

[0171] For the prior probability P(y) representing the randomly interested subclass y, it can be estimated by counting the quantity density of the sample data of each predicted interested subclass in the sample set, that is where n y is the quantity of the sample data of the predicted interested subclass y, n o is the quantity of the out-of-distribution sample images X out and n y' is the quantity of the sample data of each predicted interested subclass y'.

[0172] It should be noted that given the in-distribution sample images X inSample data x of the tail interested subclass, which has a small distribution probability P(y). When the classification probability P(y|x, i) increases, the offset β(x) increases. Compared with the original output P(i│x) of the detection model, the calibrated P(i│x)·β(x) is more likely to classify the in-distribution sample data X in as belonging to the interested category rather than not belonging to the interested category. Given out-of-distribution sample image X out of sample data x′, the classification model f tends to output a large classification probability P(y head |x', i) for the head interested subclass y head and a small classification probability P(y tail |x', i) for the tail interested subclass y tail The offset β(x') decreases. Compared with the original output P(i│x') of the detection model, the calibrated P(i│x')·β(x') is more likely to classify the out-of-distribution sample data X out as not belonging to the interested category rather than belonging to the interested category.

[0173] Exemplarily, obtain the classification probability P(y|x, i) of the predicted interested subclass y to which the target sample image (x, i) output by the image classification model f belongs. Based on the number density ρ(y) of the sample images belonging to the predicted interested subclass y in the sample set, determine the distribution probability P(y) corresponding to the predicted interested subclass. Based on the classification probability P(y|x, i) and the distribution probability P(y), calculate the offset

[0174] In the embodiments of this specification, the offset is calculated specifically, which solves the problem of misdetecting the data of the tail interested subclass as out-of-distribution samples, or misclassifying the out-of-distribution data as the head interested subclass of in-distribution data, and improves the accuracy of data detection.

[0175] Figure 4 shows a front-end schematic diagram of image classification in a data detection method provided by an embodiment of this specification, as Figure 4 shown:

[0176] Obtain the captured image of a road intersection. The captured image includes multiple entities: cars, trees, buildings, roads, billboards, tunnels, etc. Render the captured image on the front - end interface. Using step 302 and step 304, complete the data detection to determine the detection result of whether the image regions where each entity is located belong to the category of interest. In the case where the detection result belongs to the category of interest, perform image classification on the target image region where the target entity is located to obtain the target sub - category of interest to which the target image region where the target entity is located belongs: cars, trees, buildings. After labeling the corresponding target sub - category of interest on the target image region, render it on the front - end interface.

[0177] See Figure 5 , Figure 5 FIG. shows a flowchart of a method for updating a detection model provided by an embodiment of this specification. This method is applied to a cloud - side device and includes the following specific steps:

[0178] Step 502: Obtain a sample set, where the sample set includes sample data belonging to each sub - category of interest in the category of interest, and the category of interest includes at least one sub - category of interest.

[0179] Step 504: Input each sample data in the sample set into the detection model for detection to obtain the predicted detection result of whether each sample data belongs to the category of interest, and determine the sample data with the predicted detection result belonging to the category of interest as the target sample data.

[0180] Step 506: Input the target sample data into the classification model for classification to obtain the predicted sub - category of interest to which the target sample data belongs.

[0181] Step 508: Based on the predicted sub - category of interest to which the target sample data belongs and the distribution information of the sample data belonging to the predicted sub - category of interest, determine the offset.

[0182] Step 510: Based on the offset, perform output constraint on the detection model to obtain an updated detection model.

[0183] Step 512: Send the model parameters of the updated detection model to the terminal device.

[0184] The cloud - side device is a network cloud - side device that provides model training functions and is a virtual device. The end - side device is a terminal device that provides data detection functions and is a physical device. The end - side device and the cloud - side device are connected through a network channel for data transmission. The computing power performance and storage capacity of the cloud - side device are higher than those of the end - side device.

[0185] This embodiment of this specification and the above Figure 3 embodiment are based on the same inventive concept. For the specific manners of steps 502 to 510, see the above Figure 3Examples of pre-updating the detection model are not elaborated here.

[0186] In the embodiments of this specification, an offset is obtained based on the distribution information of the sample data of each interested subclass in the interested category, clearly quantifying the reasons for the insufficient accuracy of the detection results output by the detection model. Based on the offset, the output of the detection model is constrained to obtain an updated detection model, enabling the detection model to better adapt to the actual data distribution, optimizing the ability of the detection model to distinguish in-distribution data and out-of-distribution data, improving the accuracy and robustness of the detection model, ensuring the accuracy of subsequent data detection, and moreover, completing the update of the detection model on cloud-side devices with high computing performance and storage performance, enhancing the accuracy and efficiency of the update.

[0187] See Figure 6 , Figure 6 which shows a flowchart of a map scene classification method provided by an embodiment of this specification. This method is applied to a cloud-side device and includes the following specific steps:

[0188] Step 602: Obtain a target map.

[0189] Step 604: Input the target map into the detection model for detection to obtain a detection result on whether the target map belongs to a scene map. Among them, the scene map includes at least one scene subclass, and the detection result is obtained by constraining the output of the detection model based on the offset, and the offset is obtained based on the distribution information of the sample maps of each scene subclass in the scene map.

[0190] Step 606: In the case where the target map belongs to the scene map, input the target map into the classification model for classification to obtain the target scene subclass to which the target map belongs.

[0191] Step 608: Feed back the target scene subclass to the terminal device.

[0192] The cloud-side device is a network cloud-side device that provides map scene classification functions and is a virtual device. The end-side device is a terminal device where the client or server of a platform such as an application, a web page, or a small program that provides map scene classification functions is located, and it is a physical device. The cloud-side device and the end-side device are connected through a network transmission channel for data transmission. The computing power performance of the cloud-side device is higher than that of the end-side device.

[0193] Embodiments of this specification can be an application, a website, or a small program with map scene classification functions, and the cloud-side device is called through an Application Programming Interface (API). The application, website, or small program includes but is not limited to: Geographic Information System, food delivery platform, logistics platform, traffic control system, urban planning application, environmental detection system, and map navigation.

[0194] The target map is a map scene image to be classified, including but not limited to: satellite image map, terrain image, depth scene image, traffic map, climate map, and photographic scene image. For example, the target map is a Geographic Information System (GIS) map.

[0195] The scene map is a predefined scene category distribution, which is a detection criterion for detecting whether a map is a scene map. When the detection result of the map belongs to the scene map, the map is determined to be in-distribution data. When the detection result of the map does not belong to the scene map, the map is determined to be out-of-distribution data. The scene map includes at least one scene subclass, which contains one or more scene subclasses with specific geographical features or semantic meanings.

[0196] Each scene subclass is at least one specific scene category preset in the scene map, which is a classification criterion for classifying in-distribution data. Optionally, when the detection result of the target map belongs to the scene map, the target map is determined to be in-distribution data, and the in-distribution data is classified to determine the classification result of the target map belonging to the scene subclass. For example, residential areas, commercial areas, park green spaces, buildings, roads, cars, pedestrians, and transportation vehicles, etc.

[0197] The sample map is a sample map scene image for training a machine learning model. It can be a sample map for training a detection model, a sample map for training a classification model, or a sample map for training both a detection model and a classification model. The sample map can be a sample map belonging to each scene subclass in the scene map, that is, in-distribution sample data. Optionally, the sample map can also be a sample map that does not belong to each scene subclass in the scene map, that is, out-of-distribution sample data.

[0198] Other concepts correspond to the embodiments described in the above Figure 3 specification and will not be elaborated here.

[0199] Exemplarily, a traffic scene image captured by a camera at a certain intersection is obtained, and the traffic scene image is input into the detection model for detection to obtain the detection result of whether 10 segmented image regions of the traffic scene image belong to the scene map: image region 1 belongs, image region 2 does not belong,... image region 10 belongs. The 10 segmented image regions are input into the classification model for classification to obtain the target scene subclasses to which the 10 segmented image regions belong: image region 1 belongs to cars, image region 4 belongs to pedestrians,... image region 10 belongs to non-motor vehicles. The target scene subclasses to which the 10 segmented image regions belong: image region 1 belongs to cars, image region 4 belongs to pedestrians,... image region 10 belongs to non-motor vehicles are fed back to the terminal device for rendering.

[0200] In the embodiments of the present specification, an offset is obtained based on the distribution information of the sample maps of each scene subclass in the scene map, clearly quantifying the reasons for the insufficient accuracy of the detection results output by the detection model, and constraining the output of the detection model based on the offset to obtain the detection result of whether the target map belongs to the scene map, improving the accuracy of map detection, and further improving the accuracy of map scene classification. Moreover, no prior assumption is made about the distribution of the sample maps, and the offset is adaptively determined, with broader practicality. In addition, scene map classification is completed on cloud-side devices with high computing performance and storage performance, improving the accuracy and efficiency of classification.

[0201] In an alternative embodiment of the present specification, after step 608, the following specific steps are further included:

[0202] Receiving classification feedback information sent by the user of the terminal device for the target scene subclass;

[0203] In the case where the classification feedback information is classification anomaly, obtaining an updated sample set;

[0204] Based on the updated sample set, determining an updated offset;

[0205] Based on the updated offset, adjusting the output constraint of the detection model to obtain an updated detection model.

[0206] The classification feedback information is the feedback opinion information of the terminal device user on the classification result of the target scene subclass, including the user's confirmation, correction, or feedback information on the classification accuracy. For example, if an image area is recognized as "car", but in fact the area is "pedestrian", the user inputs classification feedback information to feedback this error.

[0207] The updated sample set is a training sample set supplemented or adjusted according to the user's feedback after receiving the classification feedback information. This new sample set contains the original training data and the data newly added or modified according to the user's feedback, aiming to optimize the model performance through the feedback in these actual application scenarios.

[0208] The updated offset is the offset recalculated based on the updated sample set, used to correct the deviation of the detection model in the output constraint. After obtaining the user's classification feedback and updating the sample set accordingly, the system will use the new distribution information to calculate the offset again to more accurately reflect the distribution characteristics of each scene subclass in the real scene.

[0209] The updated detection model is obtained by retraining the detection model after determining the updated offset. When processing the target map, the accuracy of this updated detection model will be improved by taking into account the classification feedback information and the updated offset.

[0210] Exemplarily, when the user views the real-time analysis results of the system, it is found that image region 1 is misclassified as "car", but in fact image region 1 contains "pedestrian". The user sends classification feedback information to the cloud device through the application interface: image region 1 should be classified as "pedestrian". After receiving the user's classification feedback, the cloud device confirms this misclassification situation, adds this misclassified image region to the updated sample set X', and correctly labels it as the "pedestrian" category. At the same time, other similar user feedback samples are collected as supplements to construct the updated sample set X'. According to the updated sample set, the offset β(x)' used to constrain the output in the detection model is recalculated. After obtaining the new offset β(x)', based on the new offset β(x)', the output constraint of the detection model g is adjusted to obtain the updated detection model g'.

[0211] Receive the classification feedback information sent by the user of the receiving terminal device for the target scene subclass; in the case where the classification feedback information is a classification anomaly, obtain the updated sample set; based on the updated sample set, determine the updated offset; based on the updated offset, adjust the output constraint of the detection model to obtain the updated detection model. Through the interactive feedback method, the accuracy of the detection model is further improved, and further the accuracy of the map scene classification is ensured.

[0212] The following combines the attached Figure 7 Taking the application of the map scene classification method provided in this specification in urban road detection as an example, the map scene classification method will be further described. Among them, Figure 7 FIG. shows the processing flowchart of a map scene classification method applied to urban road detection provided by an embodiment of this specification, including the following specific steps:

[0213] Step 702: Obtain a sample set, where the sample set includes in-distribution sample images belonging to each scene subclass in the scene map and out-of-distribution sample images not belonging to the scene map, and the scene map includes multiple scene subclasses.

[0214] Step 704: Input each sample image in the sample set into the detection model for detection, obtain the predicted detection results of whether each sample image belongs to the scene map, and determine the sample images with predicted detection results belonging to the scene map as target sample images.

[0215] Step 706: Input the target sample images into the image classification model for classification, obtain the classification confidence levels of each target sample image belonging to the predicted scene subclasses output by the image classification model, and perform normalization processing on the classification confidence levels of each target sample image belonging to the predicted scene subclasses to obtain the classification probabilities of each target sample image belonging to the predicted scene subclasses.

[0216] Step 708: Count the number of sample images in the sample set that belong to the predicted scene subclasses. Based on the number and the total number of sample images in the sample set, determine the quantity density of the sample images belonging to the predicted scene subclasses in the sample set, and based on the quantity density, determine the distribution probability corresponding to the predicted scene subclasses.

[0217] Step 710: Calculate the offset based on the classification probability and the distribution probability. Based on the offset, perform output constraint on the detection model to obtain an updated detection model.

[0218] Step 712: Obtain the urban road images uploaded by the imaging device.

[0219] Step 714: Input the urban road images into the detection model for detection to obtain the binary classification probabilities output by the detection model.

[0220] Step 716: Based on the offset, perform post-processing on the binary classification probabilities output by the detection model to determine whether the urban road images belong to the detection results of the scene map.

[0221] Step 718: In the case where the detection results belong to the scene map, input the urban road images into the image classification model for classification to obtain the target scene subclasses to which the urban road images belong.

[0222] In the embodiments of this specification, the offset is obtained based on the distribution information of the sample maps of each scene subclass in the scene map, clearly quantifying the reasons for the insufficient accuracy of the detection results output by the detection model. And based on the offset, output constraint is performed on the detection model to obtain the detection results of whether the urban road images belong to the scene map, and the scene classification of the urban road images is completed, solving the problem of misdetection that easily misdetects the data of the tail interesting subclasses as out-of-distribution samples, or easily misclassifies the out-of-distribution data as the head interesting subclasses of the in-distribution data, accurately improving the accuracy of map detection, and further improving the accuracy of map scene classification. Moreover, no prior assumption is made on the distribution of the sample maps, and the offset is adaptively determined, having a wider range of practicability, providing good technical support and result reference for the adaptive classification evaluation service of different urban points.

[0223] Corresponding to the above method embodiments, this specification also provides embodiments of a data detection device. Figure 8 The structural schematic diagram of a data detection device provided by an embodiment of this specification is shown. AsFigure 8 As shown in the figure, the device includes:

[0224] A first acquisition module 802, configured to acquire target data;

[0225] A first detection module 804, configured to input the target data into a detection model for detection, and obtain a detection result indicating whether the target data belongs to an interested category, where the interested category includes at least one interested sub-category, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample data of each interested sub-category in the interested category.

[0226] Optionally, the first detection module 804 is further configured to: input the target data into a detection model for detection, and obtain a detection probability indicating whether the target data belongs to an interested category; use the offset as a constraint condition to post-process the detection probability, and obtain a detection result indicating whether the target data belongs to an interested category.

[0227] Optionally, the device further includes: a model update module, configured to acquire a sample set, where the sample set includes sample data belonging to each interested sub-category in the interested category; input each sample data in the sample set into a detection model for detection, and obtain a predicted detection result indicating whether each sample data belongs to an interested category, and determine the sample data with the predicted detection result belonging to the interested category as target sample data; input the target sample data into a classification model for classification, and obtain a predicted interested sub-category to which the target sample data belongs; based on the predicted interested sub-category to which the target sample data belongs and the distribution information of the sample data belonging to the predicted interested sub-category, determine an offset; based on the offset, perform output constraint on the detection model to obtain an updated detection model.

[0228] Optionally, the model update module is further configured to: based on the predicted detection result, determine a predicted loss value of the detection model; use the offset as a constraint condition to adjust the predicted loss value to obtain a total loss value; based on the total loss value, train the detection model to obtain an updated detection model.

[0229] Optionally, the sample set further includes sample data that does not belong to the interested category.

[0230] Optionally, the model update module is further configured to: obtain a classification probability of the predicted interested sub-category to which the target sample data belongs output by the classification model; based on the number density of the sample data belonging to the predicted interested sub-category in the sample set, determine a distribution probability corresponding to the predicted interested sub-category; calculate an offset based on the classification probability and the distribution probability.

[0231] Optionally, the number of target sample data is multiple;

[0232] Correspondingly, the model update module is further configured to: obtain the classification confidence of each target sample data output by the classification model belonging to the predicted interested subclass; perform normalization processing on the classification confidence of each target sample data belonging to the predicted interested subclass to obtain the classification probability of each target sample data belonging to the predicted interested subclass.

[0233] Optionally, the model update module is further configured to: count the number of sample data belonging to the predicted interested subclass in the sample set; determine the quantity density of the sample data belonging to the predicted interested subclass in the sample set according to the quantity and the total number of sample data in the sample set; determine the distribution probability corresponding to the predicted interested subclass based on the quantity density.

[0234] Optionally, the apparatus further includes: a first classification module configured to, when the detection result belongs to the interested category, input the target data into the classification model for classification to obtain the target interested subclass to which the target data belongs.

[0235] In the embodiments of the present specification, an offset is obtained based on the distribution information of the sample data of each interested subclass in the interested category, clearly quantifying the reason for the insufficient accuracy of the detection result output by the detection model, and constraining the output of the detection model based on the offset to obtain the detection result of whether the target data belongs to the interested category, improving the accuracy of data detection, and thus ensuring the accuracy of data classification. Moreover, no prior assumption is made about the distribution of the sample data, and the offset is adaptively determined, having a wider range of practical applications.

[0236] The above is a schematic solution of a data detection apparatus in this embodiment. It should be noted that the technical solution of this data detection apparatus and the technical solution of the above data detection method belong to the same concept. For the details not described in detail in the technical solution of the data detection apparatus, reference can be made to the description of the technical solution of the above data detection method.

[0237] Corresponding to the above method embodiment, the present specification also provides an embodiment of a detection model update apparatus. Figure 9 FIG. shows a schematic structural diagram of a detection model update apparatus provided by an embodiment of the present specification. As Figure 9 shown, the apparatus is applied to a cloud-side device and includes:

[0238] A second acquisition module 902 configured to acquire a sample set, where the sample set includes sample data belonging to each interested subclass in the interested category, and the interested category includes at least one interested subclass;

[0239] The second detection module 904 is configured to input each sample data in the sample set into a detection model for detection, obtain a predicted detection result of whether each sample data belongs to an interested category, and determine the sample data with a predicted detection result belonging to the interested category as target sample data;

[0240] The second classification module 906 is configured to input the target sample data into a classification model for classification, and obtain a predicted interested subclass to which the target sample data belongs;

[0241] The offset determination module 908 is configured to determine an offset based on the predicted interested subclass to which the target sample data belongs and the distribution information of the sample data belonging to the predicted interested subclass;

[0242] The output constraint module 910 is configured to perform output constraint on the detection model based on the offset to obtain an updated detection model;

[0243] The sending module 912 is configured to send the model parameters of the updated detection model to a terminal device.

[0244] In the embodiments of this specification, an offset is obtained based on the distribution information of the sample data of each interested subclass in the interested category, which clearly quantifies the reason for the insufficient accuracy of the detection result output by the detection model, and the output of the detection model is constrained based on the offset to obtain an updated detection model, enabling the detection model to better adapt to the actual data distribution, optimizing the ability of the detection model to distinguish in-distribution data and out-of-distribution data, improving the accuracy and robustness of the detection model, ensuring the accuracy of subsequent data detection, and moreover, completing the update of the detection model on a cloud-side device with high computing performance and storage performance, enhancing the accuracy and efficiency of the update.

[0245] The above is a schematic solution of a detection model update device in this embodiment. It should be noted that the technical solution of this detection model update device and the technical solution of the above detection model update method belong to the same concept. For the details not described in the technical solution of this detection model update device, reference can be made to the description of the technical solution of the above detection model update method.

[0246] Corresponding to the above method embodiments, this specification also provides embodiments of a map scene classification device. Figure 10 The structural schematic diagram of a map scene classification device provided by an embodiment of this specification is shown. As Figure 10 shown, this device is applied to a cloud-side device and includes:

[0247] The third acquisition module 1002 is configured to acquire a target map;

[0248] The third detection module 1004 is configured to input the target map into a detection model for detection to obtain a detection result as to whether the target map belongs to a scene map, where the scene map includes at least one scene subclass, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample maps of the respective scene subclasses in the scene map;

[0249] The third classification module 1006 is configured to, when the target map belongs to the scene map, input the target map into a classification model for classification to obtain the target scene subclass to which the target map belongs;

[0250] The feedback module 1008 is configured to feedback the target scene subclass to the terminal device.

[0251] Optionally, the apparatus further includes: an update module, configured to receive classification feedback information sent by a user of the terminal device for the target scene subclass; when the classification feedback information is classification anomaly, obtain an updated sample set; determine an updated offset based on the updated sample set; and adjust the output constraint of the detection model based on the updated offset to obtain an updated detection model.

[0252] In the embodiments of the present specification, the offset is obtained based on the distribution information of the sample maps of the respective scene subclasses in the scene map, which clearly quantifies the reason for the insufficient accuracy of the detection result output by the detection model, and the output of the detection model is constrained based on the offset to obtain the detection result as to whether the target map belongs to the scene map, improving the accuracy of map detection, and further improving the accuracy of map scene classification. Moreover, no prior assumption is made about the distribution of the sample maps, and the offset is adaptively determined, having a wider range of practical applications. In addition, scene map classification is completed on a cloud-side device with high computing performance and storage performance, improving the accuracy and efficiency of classification.

[0253] The above is a schematic solution of a map scene classification apparatus according to this embodiment. It should be noted that the technical solution of the map scene classification apparatus and the technical solution of the above map scene classification method belong to the same concept. For the details not described in detail in the technical solution of the map scene classification apparatus, reference can be made to the description of the technical solution of the above map scene classification method.

[0254] Figure 11 The structural block diagram of a computing device provided by an embodiment of the present specification is shown. The components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 through a bus 1130, and a database 1150 is used to store data.

[0255] The computing device 1100 also includes an access device 1140, which enables the computing device 1100 to communicate via one or more networks 1160. Examples of such networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 1140 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, Worldwide Interoperability for Microwave Access (Wi-MAX) interface, Ethernet interface, Universal Serial Bus (USB) interface, cellular network interface, Bluetooth interface, Near Field Communication (NFC).

[0256] In one embodiment of the present specification, the above components of the computing device 1100 and Figure 11 other components not shown may also be connected to each other, for example, via a bus. It should be understood that Figure 11 the block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of the present specification. Those skilled in the art may add or replace other components as needed.

[0257] The computing device 1100 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1100 can also be a mobile or stationary server.

[0258] Among them, the processor 1120 is configured to execute the following computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the above data detection method, detection model update method, or map scene classification method are implemented.

[0259] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solutions of the above data detection method, detection model update method, and map scene classification method belong to the same concept. For the detailed content not described in the technical solution of the computing device, reference can be made to the descriptions of the technical solutions of the above data detection method, detection model update method, or map scene classification method.

[0260] An embodiment of this specification also provides a computer-readable storage medium that stores computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the above task processing method, legal information processing method, or model pre-training method are implemented.

[0261] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solutions of the above task processing method, legal information processing method, and model pre-training method belong to the same concept. For the detailed content not described in the technical solution of the storage medium, reference can be made to the descriptions of the technical solutions of the above task processing method, legal information processing method, or model pre-training method.

[0262] An embodiment of this specification also provides a computer program product, including computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the above task processing method, legal information processing method, or model pre-training method are implemented.

[0263] The above is a schematic solution of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solutions of the above task processing method, legal information processing method, and model pre-training method belong to the same concept. For the detailed content not described in the technical solution of the computer program product, reference can be made to the descriptions of the technical solutions of the above task processing method, legal information processing method, or model pre-training method.

[0264] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the specific order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0265] The computer instructions include computer program code, which may be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memories, read-only memories (ROM), random access memories (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0266] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this specification.

[0267] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0268] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can well understand and utilize this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A data detection method, comprising: Obtaining target data; Inputting the target data into a detection model for detection to obtain a detection result as to whether the target data belongs to an interested category, where the interested category includes at least one interested sub-category, and the detection result is obtained by constraining the output of the detection model based on an offset, and the offset is obtained based on the distribution information of the sample data of each interested sub-category in the interested category.

2. The method according to claim 1, wherein the inputting the target data into a detection model for detection to obtain a detection result as to whether the target data belongs to an interested category comprises: Inputting the target data into a detection model for detection to obtain a detection probability as to whether the target data belongs to an interested category; Using the offset as a constraint condition to post-process the detection probability to obtain a detection result as to whether the target data belongs to an interested category.

3. The method according to claim 1, further comprising, before the inputting the target data into a detection model for detection to obtain a detection result as to whether the target data belongs to an interested category: Obtaining a sample set, where the sample set includes sample data belonging to each interested sub-category in the interested category; Inputting each sample data in the sample set into a detection model for detection to obtain a predicted detection result as to whether each sample data belongs to the interested category, and determining the sample data with the predicted detection result belonging to the interested category as target sample data; Inputting the target sample data into a classification model for classification to obtain a predicted interested sub-category to which the target sample data belongs; Determining an offset based on the predicted interested sub-category to which the target sample data belongs and the distribution information of the sample data belonging to the predicted interested sub-category; Constraining the output of the detection model based on the offset to obtain the updated detection model.

4. The method according to claim 3, wherein the constraining the output of the detection model based on the offset to obtain the updated detection model comprises: Determining a predicted loss value of the detection model based on the predicted detection result; Using the offset as a constraint condition to adjust the predicted loss value to obtain a total loss value; Training the detection model based on the total loss value to obtain the updated detection model.

5. The method according to claim 3, wherein the sample set further includes sample data not belonging to the interested category.

6. The method according to any one of claims 3-5, wherein the determining an offset based on the predicted interested sub-category to which the target sample data belongs and the distribution information of the sample data belonging to the predicted interested sub-category comprises: Obtaining a classification probability of the predicted interested sub-category to which the target sample data belongs output by the classification model; Determining a distribution probability corresponding to the predicted interested sub-category based on the number density of the sample data belonging to the predicted interested sub-category in the sample set; Calculating an offset based on the classification probability and the distribution probability.

7. The method according to claim 6, wherein the number of the target sample data is multiple; The obtaining of the classification probability of the predicted interested subclass to which the target sample data output by the classification model belongs includes: obtaining the classification confidence of each target sample data output by the classification model to the predicted interested subclass; performing normalization processing on the classification confidence of each target sample data to the predicted interested subclass to obtain the classification probability of each target sample data to the predicted interested subclass.

8. The method according to claim 6, wherein the determining of the distribution probability corresponding to the predicted interested subclass based on the quantity density of the sample data belonging to the predicted interested subclass in the sample set includes: counting the quantity of the sample data belonging to the predicted interested subclass in the sample set; determining the quantity density of the sample data belonging to the predicted interested subclass in the sample set according to the quantity and the total quantity of the sample data in the sample set; determining the distribution probability corresponding to the predicted interested subclass based on the quantity density.

9. The method according to claim 1, after the inputting the target data into the detection model for detection to obtain the detection result of whether the target data belongs to the interested category, further includes: in the case that the detection result belongs to the interested category, inputting the target data into the classification model for classification to obtain the target interested subclass to which the target data belongs.

10. A detection model updating method applied to a cloud-side device, including: obtaining a sample set, wherein the sample set includes sample data belonging to each interested subclass in the interested category, and the interested category includes at least one interested subclass; inputting each sample data in the sample set into the detection model for detection to obtain the predicted detection result of whether each sample data belongs to the interested category, and determining the sample data with the predicted detection result belonging to the interested category as the target sample data; inputting the target sample data into the classification model for classification to obtain the predicted interested subclass to which the target sample data belongs; determining an offset based on the predicted interested subclass to which the target sample data belongs and the distribution information of the sample data belonging to the predicted interested subclass; performing output constraint on the detection model based on the offset to obtain the updated detection model; sending the model parameters of the updated detection model to the terminal device.

11. A map scene classification method applied to a cloud-side device, including: obtaining a target map; inputting the target map into the detection model for detection to obtain the detection result of whether the target map belongs to a scene map, wherein the scene map includes at least one scene subclass, and the detection result is obtained by output constraint on the detection model based on an offset, and the offset is obtained based on the distribution information of the sample maps of each scene subclass in the scene map; in the case that the target map belongs to the scene map, inputting the target map into the classification model for classification to obtain the target scene subclass to which the target map belongs; feeding back the target scene subclass to the terminal device.

12. According to the solution described in claim 11, after the target scenario subclass is fed back to the terminal device, the following steps are further included: Receiving the classification feedback information sent by the user of the terminal device for the target scenario subclass; Obtaining an updated sample set in the case where the classification feedback information is abnormally classified; Determining an updated offset based on the updated sample set; Adjusting the output constraint of the detection model based on the updated offset to obtain the updated detection model.

13. A computing device, comprising: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method described in any one of claims 1 to 12 are implemented.

14. A computer-readable storage medium storing computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.

15. A computer program product comprising computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 12 are implemented.