A method and apparatus for generating a pre-trained artificial intelligence model
Patent Information
- Application Number
- CN202110173151.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-10-31
- Filing Date
- 2021-02-08
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2041-02-08
AI Technical Summary
[0003]然而,目前的获得预训练AI模型的方法难以获得既能满足较强的泛化能力、又能满足较好的精度的预训练AI模型
[0028] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computing device, cause the computing device to perform the method as described in any of the first aspects.
Smart Images

Figure CN114462290B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence (AI), and more particularly to a method and apparatus for generating pre-trained AI models. Background Technology
[0002] With the continuous development of AI, its applications are becoming increasingly widespread. For different application scenarios, it's often necessary to use AI models tailored to the specific characteristics of those scenarios. Different AI models trained on data from different application scenarios can then be used to perform specific tasks within those scenarios. However, building and training dedicated AI models for specific application scenarios or tasks consumes significant resources and time. Therefore, a better approach is to obtain a pre-trained AI model and then further train it using training data from downstream tasks within the corresponding scenario, thereby acquiring a dedicated AI model that meets the specific needs of the application scenario.
[0003] However, current methods for obtaining pre-trained AI models struggle to produce models that satisfy both strong generalization ability and good accuracy. Summary of the Invention
[0004] This application provides a method for generating a pre-trained AI model. First, self-supervised learning is performed on the original images to obtain a globally effective appearance feature extraction model. Then, based on the obtained appearance feature extraction model, corresponding pseudo-labels are added to each original image. Finally, fully supervised contrastive learning is performed on the images with added pseudo-labels to obtain a general-purpose pre-trained AI model. This allows the general-purpose pre-trained AI model to possess both the generalization ability of global appearance features and the semantic features contained in the pseudo-labels.
[0005] Firstly, a method for generating a pre-trained AI model is provided. The method includes: using multiple original images and a pre-trained appearance feature extraction model to determine the appearance features corresponding to each original image. Then, based on the appearance features corresponding to each original image and the original label of each original image, a corresponding pseudo-label is generated for each original image. In some examples, each original image may have at least one pseudo-label. Then, the original images carrying pseudo-labels are used to train a first initial AI model to obtain a pre-trained AI model. For example, fully supervised contrastive learning training can be performed to obtain the pre-trained AI model. This application extracts the appearance features of the original images using an appearance feature extraction model with strong generalization ability, and then generates pseudo-labels based on the appearance features combined with the pre-stored original labels of the original images. This gives the pseudo-labels appearance information and artificial semantics, and then the pre-trained AI model is obtained by training with the original images carrying pseudo-labels. The aforementioned pre-trained AI model can have generalized appearance features and also has a richer, more fine-grained feature capture capability.
[0006] In one possible implementation, determining a pseudo-label for each original image based on its appearance features and a pre-defined label may include: for each original image, determining its appearance features, i.e., a first appearance feature; and determining the appearance features of at least one other original image that shares the same original label as the original image. In one example, the appearance features of at least one other original image that shares the same original label as the original image can be referred to as a second appearance feature. Then, the similarity between the first and second appearance features is determined. Finally, pseudo-labels are generated for the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition. This application subdivides multiple original images with the same original label and generates more granular pseudo-labels based on the similarity of appearance features between different original images.
[0007] In one possible implementation, determining pseudo-labels for the original image and a subset of other original images whose similarity to the first appearance feature meets a preset condition may include: identifying k other original images based on the similarity between the first and second appearance features; and determining pseudo-labels for the original image corresponding to the first appearance feature and the selected k other original images. In some examples, k is a positive integer. This application generates more fine-grained pseudo-labels for original images with partial similarity to the same original label, thereby giving the original images richer artificial semantics. This allows for the final training of a pre-trained AI model with richer feature capture capabilities.
[0008] In one possible implementation, determining pseudo-labels for the original image and k other original images may include: sorting at least one other original image based on the similarity between a first appearance feature and a second appearance feature. Then, the top k other original images and the original image are selected to generate pseudo-labels. This application selects k other original images by sorting them by similarity, thus ensuring that the selected k original images are more closely matched with the generated pseudo-labels. This allows for the final training of a pre-trained AI model with richer, more fine-grained feature capture capabilities.
[0009] In one possible implementation, determining pseudo-labels for the original image and k other original images may include: determining other original images whose similarity is greater than or equal to a preset similarity threshold based on the similarity between a first appearance feature and a second appearance feature. Then, selecting the original image and the other original images with similarity greater than or equal to the similarity threshold to generate labels. This application can also pre-set a similarity threshold and generate labels for original images with similarity higher than the similarity threshold and the aforementioned original images, so that the original images have richer artificial semantics, and ultimately train a pre-trained AI model with richer, finer-grained feature capture capabilities.
[0010] In one possible implementation, when the number of other original images with a similarity greater than or equal to a similarity threshold is greater than or equal to k, k other original images can be determined according to a preset rule. Then, pseudo-labels are added to the original image and the k other original images. In some examples, k is a positive integer. In this application, pseudo-labels can be generated only for a subset of original images with a similarity greater than or equal to that threshold, thereby avoiding the generation of original images whose semantics are far removed from the pseudo-labels, and further preventing overfitting of the pre-trained AI model in fine-grained segmentation.
[0011] In one possible implementation, the pseudo-labels of the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition are the same. In one example, the pseudo-label is a subclass of the original label.
[0012] In one possible implementation, determining the similarity between the first and second appearance features may include: for each original image, determining the first and second appearance features based on an appearance feature extraction model; then determining the cosine distance between the first and second appearance features, and using the cosine distance as the similarity between the first and second appearance features. This application uses cosine distance, which can better reflect the degree of similarity between two original images.
[0013] In one possible implementation, a pre-trained AI model is obtained by training a first initial AI model using multiple original images carrying pseudo-labels. This may include: using the multiple original images carrying pseudo-labels as input to the first initial AI model, then using a contrastive loss function to determine the difference between the output value and the true value of the first initial AI model, and adjusting the network parameters in the first initial AI model accordingly. After several iterations, a pre-trained AI model is obtained. This application obtains a pre-trained AI model that inherits generalizable appearance features and has richer, finer-grained feature capture capabilities by iterating the first initial AI model using original images carrying pseudo-labels. In one example, fully supervised contrastive learning can be used to train the first initial AI model.
[0014] In one possible implementation, the appearance feature extraction model can be determined in advance by training a second initial AI model using self-supervised learning with multiple original images.
[0015] In one possible implementation, the method may further include: acquiring multiple training data sets for the application scenario; then using the multiple training data sets to train the pre-trained AI model to determine the target AI model for the application scenario. This application can utilize the pre-trained AI model for targeted training, thereby meeting a variety of different task requirements.
[0016] Secondly, an apparatus for generating a pre-trained AI model is provided. The apparatus includes: an acquisition unit for acquiring multiple original images; a pseudo-label generation unit for determining the appearance features of the multiple original images based on the multiple original images and an appearance feature extraction model; and for determining a pseudo-label for each original image based on the appearance features of each original image and a pre-defined original label for each original image; and a first training unit for training a first initial AI model using multiple original images carrying pseudo-labels to obtain a pre-trained AI model. This application extracts the appearance features of the original images using an appearance feature extraction model with strong generalization ability, and then generates pseudo-labels based on the appearance features combined with pre-stored original labels of the original images. This imbues the pseudo-labels with appearance information and artificial semantics, and then trains the pre-trained AI model using the original images carrying pseudo-labels. The aforementioned pre-trained AI model can possess generalized appearance features and also has a richer, more fine-grained feature capture capability.
[0017] In one possible implementation, the pseudo-label generation unit is further configured to: determine the similarity between a first appearance feature and a second appearance feature for each original image. The first appearance feature is an appearance feature of the original image, and the second appearance feature is an appearance feature of at least one other original image that shares the same original label as the original image. Pseudo-labels are determined for the original image and for the other original images corresponding to the second appearance feature whose similarity to the first appearance feature satisfies a preset condition. This application generates more fine-grained pseudo-labels by subdividing multiple original images with the same original label and generating them based on the similarity of appearance features between different original images.
[0018] In one possible implementation, the pseudo-label generation unit is further configured to: determine pseudo-labels for the original image and k other original images based on the similarity between a first appearance feature and a second appearance feature. In one example, k is a positive integer. This application generates more fine-grained pseudo-labels for original images with partial similarity among those sharing the same original label, thereby imbuing the original images with richer artificial semantics. This is to ultimately train a pre-trained AI model with richer, more fine-grained feature capture capabilities.
[0019] In one possible implementation, the pseudo-label generation unit is further configured to: sort at least one other original image based on the similarity between a first appearance feature and a second appearance feature, and determine pseudo-labels for the original image and the top k other original images in the sort. This application can select k other original images by sorting them by similarity, thereby ensuring that the selected k original images are more closely matched with the generated pseudo-labels.
[0020] In one possible implementation, the pseudo-label generation unit is further configured to: determine other original images whose similarity is greater than or equal to a similarity threshold based on the similarity between a first apparent feature and a second apparent feature; and determine pseudo-labels for the original images and other original images whose similarity is greater than or equal to the similarity threshold. This application can also generate labels for original images with a pre-set similarity threshold and for original images whose similarity is higher than the similarity threshold, thereby giving the original images richer artificial semantics and ultimately training a pre-trained AI model with richer, finer-grained feature capture capabilities.
[0021] In one possible implementation, the pseudo-label generation unit is further configured to: if the number of other original images with a similarity greater than or equal to a similarity threshold is greater than or equal to k, then determine k other original images according to a preset rule. In one example, k is a positive integer. Pseudo-labels are then determined for the original image and the k other original images. In this application, pseudo-labels can be generated only for a subset of other original images with a similarity greater than or equal to that threshold, thereby avoiding the generation of original images whose semantics are far removed from the pseudo-labels, and further preventing overfitting of the pre-trained AI model in fine-grained segmentation.
[0022] In one possible implementation, the pseudo-labels of the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition are the same. Here, the pseudo-label is a subclass of the original label.
[0023] In one possible implementation, the pseudo-label generation unit is further configured to: for each original image, determine a first appearance feature and a second appearance feature based on an appearance feature extraction model; determine the cosine distance between the first appearance feature and the second appearance feature, and use the cosine distance as the similarity between the first appearance feature and the second appearance feature. This application uses cosine distance to better reflect the similarity between two original images.
[0024] In one possible implementation, the first training unit is further configured to: use multiple original images carrying pseudo-labels as input to a first initial AI model, and iterate the network parameters in the first initial AI model using a contrastive loss function to obtain a pre-trained AI model. This application obtains a pre-trained AI model that inherits generalizable appearance features and possesses richer, finer-grained feature capture capabilities by iterating the first initial AI model using original images carrying pseudo-labels. In one example, fully supervised contrastive learning can be used to train the first initial AI model.
[0025] In one possible implementation, the apparatus further includes: a second training unit for pre-training a second initial AI model using multiple original images through self-supervised learning to determine an appearance feature extraction model.
[0026] In one possible implementation, the acquisition unit is further configured to acquire multiple training data sets for the application scenario. The apparatus also includes a third training unit configured to train a pre-trained AI model using the multiple training data sets to determine a target AI model for the application scenario. This application can utilize the pre-trained AI model for targeted training, thereby meeting a variety of different task requirements.
[0027] Thirdly, a computing device is provided, comprising: a processor and a memory; when the processor reads and executes instructions stored in the memory, the computing device performs the method of any one of the first aspects described above.
[0028] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computing device, cause the computing device to perform the method as described in any of the first aspects.
[0029] This application discloses a method and apparatus for generating a pre-trained AI model. It extracts the appearance features of the original image using an appearance feature extraction model with strong generalization ability, and then generates pseudo-labels based on these appearance features and pre-stored original labels. The pseudo-labels possess both appearance features and artificial semantics. The pre-trained AI model is then trained using the original image carrying the pseudo-labels. This allows the pre-trained AI model to inherit the generalized appearance features while also possessing a richer, more fine-grained feature capture capability. Attached Figure Description
[0030] Figure 1 This application provides a schematic diagram of an application scenario for a pre-trained AI model.
[0031] Figure 2 This is a schematic diagram illustrating another application scenario of a pre-trained AI model provided in an embodiment of this application.
[0032] Figure 3 A system framework diagram for generating a pre-trained AI model is provided in an embodiment of this application;
[0033] Figure 4 A flowchart illustrating a method for generating a pre-trained AI model, as provided in this application embodiment;
[0034] Figure 5 This is a schematic diagram of an artificial intelligence model network structure provided in an embodiment of this application;
[0035] Figure 6 This is a schematic diagram of another artificial intelligence model network structure provided in an embodiment of this application;
[0036] Figure 7 This is a schematic diagram of a self-supervised contrastive learning architecture;
[0037] Figure 8 This is a schematic diagram of a fully supervised contrastive learning system;
[0038] Figure 9 A flowchart illustrating a method for using a pre-trained AI model, as provided in this application embodiment;
[0039] Figure 10A schematic diagram of an apparatus for generating a pre-trained AI model provided in an embodiment of this application;
[0040] Figure 11 This is a schematic diagram of another apparatus for generating a pre-trained AI model provided in an embodiment of this application. Detailed Implementation
[0041] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0042] This application is mainly used in AI model pre-training scenarios, such as... Figure 1 As shown, obtaining a dedicated AI model, i.e., a fine-grained object classification AI model, requires the assistance of a pre-trained AI model. Therefore, before obtaining the fine-grained object classification AI model, the initial AI model needs to be pre-trained using raw data to obtain a pre-trained AI model. This pre-trained AI model can then be trained using downstream training data from different application scenarios to obtain a dedicated AI model suitable for the corresponding application scenario. For example, the application scenario could be based on fine-grained object classification, which has wide applications such as flower and bird recognition, garbage classification, and pet recognition. The annotation, or labeling, of the training data for these application scenarios often requires a strong professional knowledge background. However, in actual business, the amount of training data available for fine-grained object classification tasks is often very small, with only a few training samples. This makes it difficult to obtain a suitable dedicated AI model by directly using the training data from the application scenario to train the initial AI model. Therefore, a pre-trained AI model is needed to assist. It should be noted that the initial AI model mentioned in this application refers to an untrained AI model. The pre-trained AI model is obtained by pre-training the initial AI model using raw data. Pre-trained AI models can be applied to different application scenarios. By combining the pre-trained AI models with downstream training data, we can obtain dedicated AI models for different application scenarios.
[0043] In fine-grained object classification scenarios, after obtaining a pre-trained AI model, it is then trained using a small amount of fine-grained object classification data to obtain a fine-grained object classification AI model. It can be understood that the fine-grained object classification AI model in the diagram is a dedicated AI model for the fine-grained object classification scenario. This model can perform corresponding classification tasks based on the content of the fine-grained object classification data. For example, if the data is about flowers and birds, the model can classify flowers and birds; similarly, if the data is about garbage, the model can classify and identify different types of garbage.
[0044] Of course, in other application scenarios, such as Figure 2 The object detection application scenario shown can also be used to train a pre-trained AI model by combining it with object detection data, resulting in an object detection AI model. The object detection data in this scenario can be general object detection data or specific object detection data. However, it's understandable that both general and specific object detection data are still relatively scarce compared to image classification. Therefore, obtaining a dedicated AI model still requires the assistance of a pre-trained AI model. Currently, the common practice is to train the model on image classification data to obtain a well-trained pre-trained AI model, and then combine this pre-trained model with object detection data for further training. This can accelerate the model's convergence speed or improve the final converged accuracy, ultimately resulting in a dedicated AI model for specific object detection, i.e., the object detection AI model. It's understandable that if general object detection data is used, the object detection AI model can ultimately identify general objects; if specific object detection data is used, the object detection AI model can ultimately identify specific objects.
[0045] Those skilled in the art will understand that this application can also be applied to speech recognition, text recognition, and other application scenarios. The only difference lies in the data used during training, resulting in the application of the customized AI model to the corresponding scenario. The data used during training may include the raw data used to generate the pre-trained AI model and the downstream training data used for downstream task training. It is understood that the terms "sample," "training sample," and "training data" mentioned in this application are the same concept.
[0046] When pre-training an initial AI model using raw data, either self-supervised learning or fully supervised learning methods are typically employed. Self-supervised learning, also known as unsupervised learning, is a method that learns directly from raw data without requiring manual labels; it is guided by a delegated task. Fully supervised learning, on the other hand, infers functions from labeled training datasets, requiring manual labels to guide the learning of knowledge relevant to the target task. In machine learning, the knowledge learned through self-supervised or fully supervised learning represents the parameters of the corresponding AI model.
[0047] Self-supervised learning is currently a popular research area in computer vision. Compared to fully supervised learning methods, self-supervised contrastive learning methods can learn features with stronger generalization ability. These features can be better used as parameters for pre-trained models to improve the performance of downstream tasks, such as object detection or instance segmentation.
[0048] While current experimental results suggest that self-supervised learning is more suitable than fully supervised learning for pre-training AI models, even with the same training dataset size, this result is surprising from an information theory perspective. Hand-labeled data can be seen as adding human-summarized semantics to the original data. Therefore, labeled datasets contain richer knowledge than unlabeled datasets. Ideally, the knowledge learned by self-supervised learning on the pre-training dataset should be a subset of the knowledge learned by fully supervised learning. Therefore, fully supervised learning should perform better on downstream tasks. However, self-supervised learning actually performs better on downstream tasks due to overfitting. Fully supervised learning often focuses only on regions relevant to the target task, thus acquiring invariant semantic features. Clearly, such semantic features are biased knowledge, performing well only on the target task but difficult to transfer to downstream tasks. Self-supervised learning, on the other hand, sets up surrogate tasks to partition instances, thereby learning global representational features that can describe the entire image. However, although global representation features can be transferred to downstream tasks better than local semantic features, global representation features are relatively coarse and have a weaker ability to capture fine-grained local features.
[0049] Therefore, this application provides a method for generating a pre-trained AI model. It involves extracting the appearance features of the original image using an appearance feature extraction model with strong generalization capabilities, and then generating more fine-grained pseudo-labels based on these appearance features and pre-stored original labels. These pseudo-labels possess both appearance information and artificial semantics. The initial AI model is then trained using the original image carrying the pseudo-labels, resulting in a pre-trained AI model. This allows the pre-trained AI model to inherit the generalized appearance features while also possessing richer, finer-grained feature capture capabilities. Subsequently, the obtained pre-trained AI model can be transferred to downstream tasks to improve their performance. The appearance feature extraction model can be trained using the original image without the original labels.
[0050] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0051] This application will use images as the raw data and training data to describe the solution. Of course, in some cases, text data or voice data can also be used instead, so that the pre-trained AI model obtained after training can be used to perform tasks in the direction of text recognition or voice recognition.
[0052] Figure 3 This is a system framework diagram for generating a pre-trained AI model, provided as an embodiment of this application.
[0053] like Figure 3 As shown, this application provides a system for generating pre-trained AI models. The system first requires acquiring multiple original images. These original images are then input into an appearance feature learning module 301 for unsupervised contrastive learning to obtain an appearance feature extraction model. It is understood that the original images used by the appearance feature learning module 301 during unsupervised contrastive learning may or may not carry original labels. When the original images carry original labels, they are not used during unsupervised contrastive learning training. The trained appearance feature extraction model exhibits good generalization ability and global appearance features. Subsequently, the appearance feature learning module 301 uses the appearance feature extraction model to determine the appearance features of each original image among the multiple original images, and inputs the appearance features of each image into a pseudo-label generator 302. The pseudo-label generator 302 then combines the pre-configured original labels for each original image to generate one or more corresponding pseudo-labels for each original image. When all original images have one or more pseudo-labels, the original images carrying the pseudo-labels can be input into the local supervised contrastive learning module 303 for supervised contrastive learning, resulting in a pre-trained AI model that possesses both generalization ability for global appearance features and semantic feature discrimination ability. After obtaining the pre-trained AI model provided in this application, it can also be combined with downstream training data for targeted downstream task training. That is, the downstream training data and the pre-trained AI model provided in this application are input together into the downstream AI model training module 304 to train a corresponding downstream task detection AI model for specific application scenarios.
[0054] In some examples, the process of inputting the original image into the appearance feature learning module 301 for unsupervised contrastive learning to obtain the appearance feature extraction model can be performed in advance. Therefore, if the above process has been completed in advance, the original image, the original label corresponding to the original image, and the appearance features of each image can be directly input into the pseudo-label generator 302 to generate one or more corresponding pseudo-labels for each original image.
[0055] In one example, the appearance feature learning module 301 can be trained using a self-supervised contrastive learning method to obtain an appearance feature extraction model with good generalization ability. Understandably, this appearance feature extraction model can effectively describe the appearance content of an image. Of course, the appearance feature learning module 301 can also employ other equivalent self-supervised learning methods, which are not limited herein.
[0056] In another example, pseudo-label generator 302 utilizes the appearance features of each original image to further segment the original labels of the original images, generating more fine-grained pseudo-labels. Clearly, the generated pseudo-labels embed both appearance features and human-derived prior semantic information.
[0057] In another example, the locally supervised contrastive learning module 303 utilizes finer-grained pseudo-labels generated by the pseudo-label generator 302 and a contrastive loss function for guidance to perform fully supervised contrastive learning to obtain the pre-trained AI model of this application. This allows the pre-trained AI model of this application to both inherit a good appearance feature space through pseudo-labels and adjust the local space of the appearance feature space through the semantic information contained in the pseudo-labels, making samples with similar appearance features and semantic similarity closer together, while samples with similar appearance features but different semantics are further apart.
[0058] Clearly, the system for generating pre-trained AI models involved in this application can be widely used in downstream tasks such as classification, detection, and segmentation. Therefore, its implementation can be as a built-in pre-trained AI model in cloud services to help downstream users improve the training speed and final accuracy of various downstream tasks.
[0059] Figure 4 This is a flowchart illustrating a method for generating a pre-trained artificial intelligence model, as provided in an embodiment of this application.
[0060] like Figure 4 As shown, this application provides a method for generating pre-trained AI models, which can be run on... Figure 3 In the system shown, it is understood that the above method is mainly used to provide a pre-trained AI model that has both generalization ability and richer, finer-grained feature capture capabilities. This allows the model to better adapt to downstream tasks when performing specific recognition or classification tasks, resulting in a target AI model for the corresponding scenario. The target AI model is the aforementioned dedicated AI model.
[0061] In one example, the method for generating pre-trained AI models involved in this application can also be called a supervised contrast in neighborhood (SCAN) learning method. The above method may include the following steps:
[0062] S401, acquire multiple raw images.
[0063] First, acquire multiple raw images. Understandably, these raw images can be used as pre-training data for a pre-trained AI model.
[0064] S402, based on multiple original images and the appearance feature extraction model, determine the appearance features corresponding to each original image.
[0065] Obtain the appearance feature extraction model, and input multiple original images into the appearance feature extraction model to obtain the appearance features corresponding to each original image.
[0066] In one example, the appearance feature extraction model can be pre-trained by the aforementioned appearance feature learning module 301. For example, before S402, the second initial AI model can be trained using self-supervised learning based on multiple original images. It is understood that the original images used in the self-supervised learning training can be those obtained in S401. If the original images obtained in S401 carry original labels, then the original labels can be ignored during training; that is, the original labels of the original images are not used in the self-supervised learning training. The second initial AI model belongs to the initial AI model involved in this application. It is understood that the initial AI model involved in this application can be an AI model with network structures such as mobile network (mobile net) and residual network (res net). Of course, other equivalent network structures can also be used as the initial AI model, and this application does not limit this.
[0067] In one example, for example Figure 5 The diagram shows the network structure using a mobile net as the second initial AI model. It can be seen that... Figure 5 The diagram illustrates the network structure of a mobile net. It is understandable that... Figure 5 This is just one possible network structure for a mobile net. It can include a 3x3 depthwise separable convolution layer 501, a first batch normalization (BN) layer 502, a first rectified linear unit (ReLU) layer 503, a 1x1 convolution layer 504, a second BN layer 505, and a second ReLU layer 506. The first ReLU layer 503 and the second ReLU layer 506 can also be referred to as activation function layers.
[0068] In another example, for example Figure 6 As shown, ResNet can also be used as the network structure for a second initial AI model. It can be seen that in the ResNet network structure, the original image first passes through a 7×7 convolutional layer, then undergoes pooling, and is input into the residual blocks. Each pair of 3×3 convolutional layers can be considered a residual block, and the output of each residual block is the difference between the output of the second convolutional layer and the input of the residual block. It is understood that in other examples, each residual block may include more or fewer convolutional layers or other layers that may be used, and the kernel size of each convolutional layer can be arbitrarily set according to the actual situation. The values in the figure are only one possible example, and this application does not limit them. At the same time, the number of residual blocks can also be arbitrarily set according to the actual situation.
[0069] Of course, in some other examples, other equivalent or similar network structures can be used as the second initial AI model, and this application does not limit this. It can be understood that the network structure used in this application may include more or fewer layers, such as convolutional layers, pooling layers, fully connected layers, etc., and this application does not limit this.
[0070] Understandably, when training the second initial AI model using self-supervised learning, multiple original images can be used as input, and clustering can be employed for self-supervised learning. It's also understandable that if the original images used for self-supervised learning training have original labels, those labels are used; specifically, the original images obtained in S401 can be used. However, if the original images in S401 have original labels, they can be ignored, and self-supervised learning training can proceed. In some examples, contrastive learning can be used for self-supervised learning training, constructing a representation feature space. Contrastive learning can also be called momentum contrast (MoCo) methods. For example... Figure 7 As shown, Figure 7 The encoder in this context can be understood as the second initial AI model mentioned above. Furthermore, the momentum encoder is maintained periodically during contrastive learning. Through... Figure 7As can be seen, after the original image is input into the encoder (i.e., the second initial AI model), the output q is compared with each vector in the memory queue for similarity. Each vector in the memory queue is a feature vector obtained from the comparison image after passing through the momentum encoder. The output q is compared with each vector in the memory queue one by one, for example, by calculating a contrastive loss function. Then, q vectors with low similarity to any vector in the memory queue are added to the memory queue. If the number of vectors in the memory queue is pre-set, the vector with the closest similarity to q can be replaced when updating the memory queue, thus completing the update. Of course, in some cases, a similarity threshold can be set to determine whether q is similar to the vectors in the memory queue. For example, a first similarity threshold can be set for comparing the output q of the second initial AI model with the memory queue during self-supervised learning training. In some cases, cosine function, Euclidean distance, Manhattan distance, etc., can be used for similarity calculation; this application does not limit this.
[0071] Clearly, this application avoids the limitation of graphics card memory size by introducing a memory queue, enabling the acquisition of a large number of comparison pairs in each batch processing. Furthermore, by continuously updating the memory queue, a large number of images to be compared can be added, and the sample features in the memory queue are updated using momentum updates, making the sample features in the memory queue stable and consistent with the feature space of the original images.
[0072] By employing the aforementioned comparative learning method, the network parameters in the encoder are continuously updated, thereby enabling the final learned appearance feature extraction model to possess good global appearance features.
[0073] In one example, the appearance feature extraction model may include an appearance feature space mapping function f(·) and an appearance feature space momentum mapping function g(·). Here, f(·) is the encoder mentioned in the contrastive learning above, and g(·) is the momentum encoder mentioned in the contrastive learning above.
[0074] In some approaches, this step is often sufficient before the appearance feature extraction model is used as the final pre-trained AI model. However, it is clear that the appearance feature extraction model obtained at this point has only learned global appearance features with strong generalization ability. Since the original images used for training do not have the guidance of the original labels, the resulting appearance feature extraction model is unable to recognize fine-grained semantic information, which leads to a very insufficient feature richness.
[0075] In other solutions, contrastive learning is directly applied to fully supervised training, using a contrastive loss function instead of the traditional normalized exponential loss function (or softmax loss function). For example... Figure 8 This paper presents a supervised contrast learning (SCL) method. In the first stage, positive and negative pairs are constructed in the contrast loss function using the original labels carried in the original images. For example, two different original images are augmented twice, such as first performing 2048-dimensional data augmentation, and then performing 128-dimensional data augmentation. That is, 2048-D and 128-D are shown in the figure. Of course, it is understood that the dimension of the original image during data augmentation can be arbitrarily set according to the actual situation, and the number of data augmentations can also be arbitrarily set according to the actual situation; this application does not impose any restrictions. After constructing the positive and negative pairs in the contrast loss function, normal supervised learning is performed on the backbone neural network. For example, the network parameters in the fully connected (FC) layer of the neural network structure are trained through cross entropy, and normalized through a 1000-D softmax loss function layer. At this time, a pre-trained AI model is obtained. However, it's clear that pre-trained AI models learned through Supervised Contrastive Learning (SCL) only improve performance on specific target tasks. For example, if the original image is labeled "dog," the pre-trained AI model can only improve its performance in recognizing dogs, but not in recognizing other objects such as cats, tables, or horses. In other words, the deep semantics learned by pre-trained AI models using supervised contrastive learning methods are still biased. This leads to severe overfitting of the generated pre-trained AI model to the target task, making it unable to effectively generalize to downstream tasks and compromising performance.
[0076] Therefore, to ensure that the pre-trained AI model can be better transferred to downstream tasks, this application uses self-supervised contrastive learning to train an appearance feature extraction model, and utilizes a self-supervised learning method to obtain an appearance feature extraction model loosely coupled with the task. The obtained appearance feature extraction model can describe the global information of the entire image, thereby achieving instance-level classification. Then, the appearance features of the original image are obtained through the appearance feature extraction model, and pseudo-labels are added to the original image. Therefore, in some examples, after obtaining the appearance feature extraction model, each original image in S401 needs to be input into the appearance feature extraction model to obtain the appearance features corresponding to each original image. For example, if the appearance feature extraction model is obtained using contrastive learning, then f(·) can be used to represent the appearance features of the original image, i.e., the appearance features of the original image x. i The apparent feature is f(x) iIt is understandable that the above process can be completed in the appearance feature learning module 301.
[0077] S403, determine the pseudo-label for each original image based on multiple appearance features and the original labels pre-set in the original images.
[0078] After obtaining the appearance features f(.) of each original image in S402, the appearance feature learning module 301 inputs the appearance features f(.) of each original image into the pseudo-label generator 302, so that the pseudo-label generator 302 can determine the pseudo-label of each original image by combining it with the pre-configured original labels of each original image. It can be understood that each original image can have one or more pseudo-labels.
[0079] In one example, the similarity between different original images can be used to construct pseudo-labels for each original image. For instance, an original image x can be selected from multiple original images obtained in S401. i and determine the original image x i Apparent features f(x) i ), apparent features f(x) i This can be denoted as the first appearance feature. Then, the appearance features of all other original images are determined, and each other original image's appearance feature can be denoted as the second appearance feature. It is understandable that all images other than the original image x... i All other original images can be referred to as original image x. j Then the second apparent feature can be expressed as f(x) j Next, the similarity between the first and second apparent features is determined. For example, the similarity between the first and second apparent features can be calculated using Formula 1.
[0080] similarity(x i x j )=f(x i )*f(x j )...Formula 1
[0081] Among them, similarity(x i x j ) is used to represent the original image x i Compared with the original image x j The similarity between them.
[0082] In one example, the original image x can be used. i Compared with the original image x j The cosine distance between them is used as the original image x i Compared with the original image x jThe similarity between them. Of course, in other examples, any equivalent method such as Euclidean distance or Manhattan distance can be used for replacement, which is not limited here. The pseudo-label generator 302 can be based on similarity(x i x j ), to the original image x i and similarity(x) i x j The original image x that meets the preset conditions j Set the same pseudo-tags.
[0083] Of course, in some cases, to reduce computation and avoid situations where appearances are similar but semantics are completely different, the determination of the original image x... j At this time, it can be determined based on the pre-set original labels. For example, all original images with the same original label are first grouped together, and multiple original images will be divided into at least one group according to the original label. Then, based on each group, any one original image is selected as the original image x. i The remaining original images within the group are used as the original image x. j Calculate the similarity between the appearance features of different original images.
[0084] In one example, the preset condition to be satisfied could be, for each original image x i Determine the x value of each original image. j Compared with the original image x i similarity(x) between i x j And based on similarity(x) i x j Select k original images x according to preset rules j Where k is a positive integer. The original image x... j and k original images x j Identify identical pseudo-labels. In some cases, the preset rule could be based on similarity(x) i x j The size of the original image x is determined by dividing it into smaller and larger values. j Sort the images. And rearrange the original image x... i and similarity(x) i x j The first k original images x in the sorting) j Identify identical pseudo-labels. Alternatively, k original images x can be selected based on any other possible preset rules. jFor example, randomly selecting, or calculating k original images x according to a preset formula. j This application does not impose any limitations on this. Using the above method, each original image in the same group is treated as the original image x. i The calculations will result in each original image in the final group carrying at least one pseudo-label. It is understood that if all original images acquired in S401 are determined using the above method, then each original image acquired in S401 will carry at least one pseudo-label.
[0085] In another example, the preset condition could also be a pre-defined similarity threshold, such as a second similarity threshold. And similarity(x) could be set accordingly. i x j All original images x that are greater than or equal to the second similarity threshold j and the original image x i Identify identical pseudo-labels. Of course, to avoid having too many original images with the same pseudo-labels, in some cases, similarity(x) can be used. i x j The portion of the original image x that is greater than or equal to the second similarity threshold j and the original image x i Identify identical pseudo-labels. For example, identify one or more similarity(x) tags. i x j The original image x is greater than or equal to the second similarity threshold. j And according to similarity(x) i x j The size of the original image x is determined by dividing it into smaller and larger values. j Sort the images. Then select k original images x according to preset rules. j For example, a preset rule could be to select the top k original images x based on their sorting. j Of course, it is also possible to obtain data from one or more original images x according to any other possible preset rules. j Select k original images x j For example, randomly selecting, or calculating k original images x according to a preset formula. j This application does not impose any restrictions.
[0086] Understandably, in some cases, if the value of k is pre-configured, and similarity(x) i x j The original image x is greater than or equal to the second similarity threshold. j When the number of elements is less than k, then all similarities(x) can be used.i x j The original image x is greater than or equal to the second similarity threshold. j and the original image x i Identify identical pseudo-tags.
[0087] The pseudo-labels determined through the above methods are, in essence, derived from the classification of the original labels, with multiple different pseudo-labels assigned to each classification. Therefore, the pseudo-labels determined in this application are subclasses of the corresponding original labels. For example, if the original label is "dog," then the corresponding pseudo-labels could be "dog1," "dog2," "dog3," etc. Furthermore, since the same original image may have high similarity to different original images, each original image may have one or more different pseudo-labels.
[0088] S404, the first initial AI model is trained using the original image carrying pseudo-labels to obtain the pre-trained AI model.
[0089] After the pseudo-label generator 302 determines at least one pseudo-label for each original image, the local supervised contrastive learning module 303 can train the first initial AI model using the original images carrying pseudo-labels, and obtain a pre-trained AI model that possesses both generalization ability with global appearance features and semantic feature discrimination ability. In one example, training the first initial AI model using original images carrying pseudo-labels can be a fully supervised contrastive learning training. It is understood that the first initial AI model is also the initial AI model described in this application.
[0090] In one example, the network structure described in S402 above can be used as the first initial AI model. The original image carrying pseudo-labels is used as input to the first initial AI model, and fully supervised contrastive learning is performed. It is understood that since the input original image carries pseudo-labels, fully supervised contrastive learning can be used to train the first initial AI model. Due to the use of contrastive learning, the first initial AI model can include the mapping function f'(·) corresponding to the encoder and the momentum mapping function g'(·) corresponding to the momentum encoder. The network parameters of the first initial AI model are adjusted using the nearest neighbor adjusted contrastive loss function described in Equation 2, iterating continuously between f'(·) and g'(·).
[0091] Formula 2 can be expressed as follows:
[0092]
[0093] in, x represents the degree of similarity between any original image i and other original images. iand x j Representing different original images, i.e., original image x i and the original image x j . x represents i The corresponding pseudo-tags, x represents j The corresponding pseudo-tag. Indicates x i A data augmentation was performed. Indicates x j Conducted with Different data augmentations. It is understood that data augmentation can be performed using any existing computational method, and this application does not impose any limitations on it. τ represents the temperature function, a pre-defined hyperparameter used for smoothing during the initial AI model training process. b represents b training images pre-selected from multiple original images carrying pseudo-labels as a batch of training samples, where b is a positive integer. b(K+1) represents determining the remaining k original images with the same pseudo-label for each of the b original images. Fully supervised contrastive learning training is then performed based on b(K+1) original images.
[0094] for Then it can be shown in Formula 3.
[0095]
[0096] Where t represents the original image x that is different from the pseudo-label of the original image i. t ,but x represents t The corresponding pseudo-tags, Indicates x t Conducted with Different data augmentations. l This is used to represent the l-th feature in the memory queue during contrastive learning, where the memory queue contains a total of L features, and L is a positive integer.
[0097] This application iterates f'(·) and g'(·) using formulas 2 and 3 above, making images with the same pseudo-label and similar appearance features closer together, while images with different pseudo-labels but similar appearance features are farther apart. This can be understood as follows: in contrastive learning, g'(·+1) = 1 - M*g'(·) + M*f'(·), where M is a pre-set momentum parameter. Therefore, by continuously adjusting the network parameters of f'(·), the network parameters of g'(·) can be dynamically iterated. The iterative update of the network parameters of f'(·) can be calculated through backpropagation based on the output of the contrastive loss function, thus achieving the iterative update of f'(·). Of course, in other examples, any equivalent method can be used to iteratively update the network parameters of f'(·), and this application does not limit this.
[0098] Figure 9 This is a flowchart illustrating a method for using a pre-trained AI model, as provided in an embodiment of this application.
[0099] like Figure 9 As shown, this application also provides a method for using a pre-trained AI model. After obtaining a pre-trained AI model in step S404 that possesses both generalization ability with global appearance features and semantic feature discrimination capability, downstream tasks can be adapted based on the obtained pre-trained AI model. Therefore, after S404, the method further includes:
[0100] S901 acquires multiple training data sets.
[0101] Obtain multiple training datasets for the corresponding application scenario. These multiple training datasets can be used for the same application scenario.
[0102] S902 uses multiple training data to train a pre-trained AI model and determines the target AI model for the corresponding application scenario.
[0103] Multiple training data sets with the same application scenario, obtained in S901, are used as input to the pre-trained AI model obtained in S404. Fully supervised learning is employed for training, ultimately resulting in a target AI model tailored to the application scenario corresponding to the training data. This target AI model then performs the corresponding target task within the application scenario. It is understandable that the pre-trained AI model obtained in S404 possesses both generalization ability for global appearance features and semantic feature discriminative power. Figure 9 The method shown is perfectly compatible with various downstream tasks and yields targeted AI models.
[0104] Through the above Figures 1 to 9The described approach addresses the shortcomings of self-supervised learning or fully supervised learning as methods for generating pre-trained AI models. First, a robust appearance feature space can be learned from large-scale raw images using self-supervised learning. Then, more refined pseudo-labels are generated based on the distance of the original images within the appearance feature space and their corresponding original labels. Next, using a contrastive loss function as guidance, fully supervised contrastive learning is performed under the supervision of the pseudo-labels to obtain a better pre-trained AI model. This results in a pre-trained AI model that possesses both the global appearance features learned by the self-supervised algorithm and semantic knowledge from the original labels. Consequently, the learned feature richness is better, making it more useful for training downstream tasks. Finally, the obtained pre-trained AI model can be used as initialization parameters for downstream tasks to accelerate convergence and improve final model accuracy.
[0105] This application comprehensively considers the advantages and disadvantages of existing self-supervised and fully supervised algorithms as training schemes for pre-trained AI models, and proposes a learning method for efficiently generating pre-trained AI models based on labels. This effectively enhances the appearance feature representation ability and generalization ability of the final pre-trained AI model, and improves the performance of various downstream tasks. For example, in the global appearance feature learning stage, a relatively good appearance feature space can be initialized using relevant self-supervised learning methods. Then, based on the relative position of the original image in the appearance feature space and the original coarse labels, more refined pseudo-labels are generated. The pseudo-labels contain both the original semantic information and the spatial manifold of the appearance features. In the local supervised contrastive fine-tuning stage, fully supervised contrastive learning can be performed under the guidance of pseudo-labels. Therefore, the features of the finally learned pre-trained AI model can not only recover the appearance feature structure of the previous stage well, but also fine-tune the local features, grouping images with more similar semantics together and separating images with different semantics. Thus, the finally learned pre-trained AI model has both the generalization ability of global appearance features and the discriminative power of semantic features.
[0106] It is understandable that the above Figures 1 to 9 The described method uses the image domain as an example only. Of course, if the data is replaced with speech or text data, it can also be applied to the speech domain and text semantic domain, etc. This application does not specify the type of training data.
[0107] Unlike self-supervised algorithms that extract effective pre-training knowledge from large-scale unlabeled data, this application aims to better combine the semantic knowledge provided by the original labels to determine pseudo-labels, thereby further improving the capabilities of the final pre-trained AI model. Unlike fully supervised algorithms that improve performance on a single specific task, this application can also extract knowledge with stronger generalization capabilities, enabling better transfer to downstream tasks.
[0108] Figure 10 This is a schematic diagram of an apparatus for generating a pre-trained AI model provided in an embodiment of this application. It should be understood that... Figure 10 The unit partitioning in the device for generating pre-trained AI models is merely exemplary, and different partitioning methods can be used.
[0109] like Figure 10 As shown, this application provides an apparatus 1000 for generating a pre-trained AI model. The apparatus 1000 includes: an acquisition unit 1001, configured to acquire multiple original images; a pseudo-label generation unit 1002, configured to extract models based on the multiple original images and appearance features, determine the appearance features corresponding to the multiple original images, and determine pseudo-labels for each original image based on the appearance features of each original image and a pre-defined original label for each original image; and a first training unit 1003, configured to train a first initial AI model using the multiple original images carrying pseudo-labels to obtain a pre-trained AI model. In one example, the first training unit 1003 is used to perform fully supervised contrastive learning training on the first initial AI model.
[0110] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: determine the similarity between a first appearance feature and a second appearance feature for each original image. The first appearance feature is an appearance feature of the original image, and the second appearance feature is an appearance feature of at least one other original image that has the same original label as the original image. Pseudo-labels are then determined for the original image and for the other original images corresponding to the second appearance feature whose similarity to the first appearance feature satisfies a preset condition.
[0111] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: determine pseudo-labels for the original image and k other original images based on the similarity between the first appearance feature and the second appearance feature. In one example, k is a positive integer.
[0112] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: sort at least one other original image based on the similarity between the first appearance feature and the second appearance feature, and determine pseudo-labels for the original image and the top k other original images in the sort.
[0113] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: determine other original images whose similarity is greater than or equal to a similarity threshold based on the similarity between a first appearance feature and a second appearance feature; and determine pseudo-labels for the original images and other original images whose similarity is greater than or equal to the similarity threshold.
[0114] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: if the number of other original images with a similarity greater than or equal to a similarity threshold is greater than or equal to k, then determine k other original images according to a preset rule. In one example, k is a positive integer. Pseudo-labels are then determined for the original image and the k other original images.
[0115] In one possible implementation, the pseudo-labels of the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition are the same. Here, the pseudo-label is a subclass of the original label.
[0116] In one possible implementation, the pseudo-label generation unit 1002 is further configured to: for each original image, determine a first appearance feature and a second appearance feature based on an appearance feature extraction model; determine the cosine distance between the first appearance feature and the second appearance feature, and use the cosine distance as the similarity between the first appearance feature and the second appearance feature.
[0117] In one possible implementation, the first training unit 1003 is further configured to: take multiple original images carrying pseudo-labels as input to a first initial AI model, and use a contrastive loss function to iterate the network parameters in the first initial AI model to obtain a pre-trained AI model.
[0118] In one possible implementation, the apparatus 1000 further includes a second training unit 1004, which is used to pre-train a second initial AI model using multiple original images to determine an appearance feature extraction model.
[0119] In one possible implementation, the acquisition unit 1001 is further configured to: acquire multiple training data sets for the application scenario. The apparatus 1000 also includes: a third training unit 1005, configured to train a pre-trained AI model using the multiple training data sets to determine a target AI model for the application scenario.
[0120] This application utilizes a highly generalizable appearance feature extraction model to extract appearance features from the original image, and then generates pseudo-labels based on these appearance features and pre-stored original labels. The pseudo-labels possess both appearance information and artificial semantics, enabling the pre-trained AI model trained using the original image carrying pseudo-labels to inherit the generalizable appearance features while also possessing richer, more fine-grained feature capture capabilities.
[0121] Figure 11 This is a schematic diagram of another apparatus for generating a pre-trained AI model provided in an embodiment of this application.
[0122] like Figure 11As shown, this application provides an apparatus 1100 for generating pre-trained AI models. The apparatus 1100 may include a processor 1101, a memory 1102, a communication interface 1103, and a bus 1104. It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the apparatus 1100. In other embodiments of this application, the apparatus 1100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware, and this application does not impose limitations on them here.
[0123] The processor 1101 can be a processor based on architectures such as Advanced Reduced Instruction Set Computing Machines (ARM), x86, or Microprocessors without Interlocked Pipeline Stages (MIPS). The processor 1101 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units can be independent devices or integrated into one or more processors.
[0124] Memory 1102 may include RAM. RAM can be used to store executable program code, including instructions. RAM may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 1101 executes various functional applications and data processing of device 1100 by running instructions stored in RAM and / or instructions stored in memory disposed within the processor. Of course, in other examples, memory 1102 may also include auxiliary memory or external memory, such as non-removable memory or removable memory cards, etc.
[0125] The communication interface 1103 can be used to acquire raw images or raw training data from other devices via wired or wireless means.
[0126] The processor 1101, memory 1102 and communication interface 1103 are connected via bus 1104 to exchange data.
[0127] When the processor 1101 in the device 1100 provided in this application executes the instructions stored in the memory 1102, it can achieve the above-mentioned functions. Figures 1 to 9 For the specific implementation of any of the functions described in the example, please refer to the following. Figures 1 to 9 The corresponding descriptions in [the document] will not be repeated here.
[0128] This application addresses how to leverage the additional semantic information provided by labels to enhance the capabilities of pre-trained AI models. Recognizing that self-supervised extraction of global features exhibits strong generalization ability but weak semantic detail description, while fully supervised extraction boasts strong semantic feature representation but weak generalization, this application proposes a learning scheme for generating pre-trained AI models based on efficient label utilization. This scheme effectively combines the characteristics of fully supervised and self-supervised learning to better improve the capabilities of pre-trained AI models. For example, a global representation space with good generalization ability can be obtained first through self-supervised learning. Then, pseudo-labels are used to guide the adjustment of various local regions within the representation space, making samples of the same category closer together and samples of different categories but with similar appearances farther apart. Ultimately, without disrupting the global representation space, the distance between samples of the same category and globally similar is reduced compared to the distance between samples of different categories but globally similar. Therefore, the resulting pre-trained AI model not only exhibits strong generalization ability like self-supervised learning methods but also possesses richer fine-grained semantic feature representation, enabling better transfer to downstream tasks.
[0129] This application enhances the feature richness of pre-trained AI models by fully leveraging the apparent features extracted through self-supervision and the semantic features provided by the original labels. Furthermore, it achieves industry-leading performance on publicly available datasets for various downstream tasks.
[0130] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0131] This application also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.
[0132] This application also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application are generated.
[0133] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0134] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.
[0135] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0136] The above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating pre-trained artificial intelligence (AI) models, characterized in that, The method includes: Acquire multiple raw images; Based on the multiple original images and the appearance feature extraction model, the appearance features of the multiple original images are determined; Based on the appearance features of each original image and the pre-defined original label of each original image, determine the pseudo label of each original image; The first initial AI model is trained using the multiple original images carrying the pseudo-labels to obtain a pre-trained AI model; The step of determining the pseudo-label of each original image based on its appearance features and a pre-defined original label includes: For each original image, the similarity between a first appearance feature and a second appearance feature is determined, wherein the first appearance feature is the appearance feature of the original image, and the second appearance feature is the appearance feature of at least one other original image that has the same original label as the original image. Determine pseudo-labels for the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition.
2. The method as described in claim 1, characterized in that, The step of determining pseudo-labels for the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition includes: Based on the similarity between the first appearance feature and the second appearance feature, pseudo-labels are determined for the original image and k other original images, wherein the k other original images are the top k other original images with high similarity in the similarity ranking or other original images with similarity greater than a preset threshold, and k is a positive integer.
3. The method as described in claim 1, characterized in that, The pseudo-labels of the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition are the same, wherein the pseudo-label is a subclass of the original label.
4. The method according to any one of claims 1-3, characterized in that, Determining the similarity between the first apparent feature and the second apparent feature includes: For each original image, the first appearance feature and the second appearance feature are determined according to the appearance feature extraction model; Determine the cosine distance between the first appearance feature and the second appearance feature, and use the cosine distance as the similarity between the first appearance feature and the second appearance feature.
5. The method according to any one of claims 1-3, characterized in that, The step of training a first initial AI model using the multiple original images carrying the pseudo-labels to obtain a pre-trained AI model includes: The multiple original images carrying the pseudo-labels are used as input to the first initial AI model, and the network parameters in the first initial AI model are iteratively updated using a contrastive loss function to obtain the pre-trained AI model.
6. The method according to any one of claims 1-3, characterized in that, The appearance feature extraction model was determined by training a second initial AI model using multiple pre-acquired images through self-supervised learning.
7. The method according to any one of claims 1-3, characterized in that, The method further includes: Acquire multiple training data sets for the application scenario; The pre-trained AI model is trained using the multiple training data to determine the target AI model for the application scenario.
8. An apparatus for generating a pre-trained artificial intelligence model (AI), characterized in that, The device includes: The acquisition unit is used to acquire multiple raw images; A pseudo-label generation unit is used to determine the appearance features of the multiple original images based on the multiple original images and the appearance feature extraction model; and, Based on the appearance features of each original image and the pre-defined original label of each original image, determine the pseudo label of each original image; The first training unit is used to train a first initial AI model using the plurality of original images carrying the pseudo-labels to obtain a pre-trained AI model; The pseudo-tag generation unit is also used for: For each original image, the similarity between a first appearance feature and a second appearance feature is determined, wherein the first appearance feature is the appearance feature of the original image, and the second appearance feature is the appearance feature of at least one other original image that has the same original label as the original image. Determine pseudo-labels for the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition.
9. The apparatus as claimed in claim 8, characterized in that, The pseudo-tag generation unit is also used for: Based on the similarity between the first appearance feature and the second appearance feature, pseudo-labels are determined for the original image and k other original images, wherein the k other original images are the top k other original images with high similarity in the similarity ranking or other original images with similarity greater than a preset threshold, and k is a positive integer.
10. The apparatus as claimed in claim 8, characterized in that, The pseudo-labels of the original image and other original images corresponding to the second appearance feature whose similarity to the first appearance feature meets a preset condition are the same, wherein the pseudo-label is a subclass of the original label.
11. The apparatus according to any one of claims 8-10, characterized in that, The pseudo-tag generation unit is also used for: For each original image, the first appearance feature and the second appearance feature are determined according to the appearance feature extraction model; Determine the cosine distance between the first appearance feature and the second appearance feature, and use the cosine distance as the similarity between the first appearance feature and the second appearance feature.
12. The apparatus according to any one of claims 8-10, characterized in that, The first training unit is also used for: The multiple original images carrying the pseudo-labels are used as input to the first initial AI model, and the network parameters in the first initial AI model are iteratively updated using a contrastive loss function to obtain the pre-trained AI model.
13. The apparatus according to any one of claims 8-10, characterized in that, The device further includes: The second training unit is used to perform self-supervised learning training on the second initial AI model using multiple pre-acquired images to determine the appearance feature extraction model.
14. The apparatus according to any one of claims 8-10, characterized in that, The acquisition unit is also used for: Acquire multiple training data sets for the application scenario; The device further includes: The third training unit is used to train the pre-trained AI model using the multiple training data to determine the target AI model for the application scenario.
15. A computing device, characterized in that, include: Processor and memory; When the processor reads and executes the instructions stored in the memory, the computing device performs the method described in any one of claims 1-7.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computing device, enable the computing device to perform the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Breast X-ray image classification model training method based on implicit apparent learning
CN111415741A
Cross-domain target re-identification method based on feature adversarial learning and self-similarity clustering
CN111738172A