Image classification method and device, electronic equipment and storage medium

Through the method of image and text feature matching, the description text is updated to quickly identify new image categories, which solves the problem of long recognition time span of new false face attacks in the existing technology, and improves the security of the system and the defense ability against new attacks.

CN118629052APending Publication Date: 2024-09-10BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310254832.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When facing new types of false face attacks, the existing silent liveness detection algorithm has a long iteration process and cannot quickly identify new attacks, resulting in high system security risks.

Method used

By extracting the characteristics of the image to be classified and the characteristics of the description text, based on the image-text feature matching method, the relevant description text is updated to quickly identify new image categories, achieving rapid identification of new image categories without the need for an algorithm iteration process.

Benefits of technology

Without algorithm iteration, it can quickly identify new image categories, reduce system security risks, and improve defense capabilities against new attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118629052A
    Figure CN118629052A
Patent Text Reader

Abstract

Embodiments of the invention disclose an image classification method and apparatus, an electronic device and a storage medium. The method comprises the steps of extracting a first image feature of a to-be-classified image; extracting a first text feature of each description text in the description text set; wherein the description text set corresponds to a target image classification task, and each description text is used for describing each image category under the target image classification task; the description text set is updated along with the updating of the image category; determining a target text feature matched with the first image feature from the first text features; and determining a target category of the to-be-classified image based on an image category corresponding to the target text feature. Through a mode based on image-text feature matching, under the condition that a novel image category appears, an algorithm iteration process does not need to be carried out, and rapid identification of the novel image category can be realized only by updating a related description text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of data processing technology, and in particular to an image classification method, device, electronic device, and storage medium. Background Art

[0002] Silent liveness detection can be considered as a detection technology that directly determines whether the user in front of the camera is a real person without the user's cooperation in completing the prompt action. Silent liveness detection is often implemented through data-driven deep learning algorithms. It can be considered that the training data used for model learning is the determining factor of the algorithm performance effect.

[0003] At present, when the algorithm encounters a new type of fake face attack, the algorithm iteration process (such as the design / collection and processing of attack data, model training based on attack data, model update, etc.) takes a long time. Existing methods cannot quickly identify new attacks, which leads to a high security risk in the system to which the algorithm belongs, and may cause great losses when facing new attacks. Summary of the invention

[0004] The embodiments of the present disclosure provide an image classification method, device, electronic device and storage medium, which can realize rapid recognition of new image categories.

[0005] In a first aspect, an embodiment of the present disclosure provides an image classification method, comprising:

[0006] Extracting a first image feature of the image to be classified;

[0007] Extracting the first text feature of each description text in the description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0008] Determining a target text feature that matches the first image feature from each of the first text features;

[0009] Based on the image category corresponding to the target text feature, a target category of the image to be classified is determined.

[0010] In a second aspect, the present disclosure also provides an image classification device, including:

[0011] An image feature extraction module, used to extract a first image feature of an image to be classified;

[0012] A text feature extraction module, used to extract the first text feature of each description text in a description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0013] An image-text feature matching module, used to determine a target text feature that matches the first image feature from each of the first text features;

[0014] The classification module is used to determine the target category of the image to be classified based on the image category corresponding to the target text feature.

[0015] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] a storage device for storing one or more programs,

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the image classification method as described in any one of the embodiments of the present disclosure.

[0019] In a fourth aspect, the embodiments of the present disclosure further provide a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the image classification method as described in any one of the embodiments of the present disclosure.

[0020] The technical solution of the disclosed embodiment is to extract the first image feature of the image to be classified; extract the first text feature of each description text in the description text set; wherein the description text set corresponds to the target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated; determine the target text feature that matches the first image feature from each first text feature; and determine the target category of the image to be classified based on the image category corresponding to the target text feature. By matching the image and text features, when a new image category appears, it is possible to quickly identify the new image category by simply updating the relevant description text without performing an algorithm iteration process. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0022] Figure 1 A flowchart of an image classification method provided by an embodiment of the present disclosure;

[0023] Figure 2 A framework diagram of executing a classification method based on an image classification model in an image classification method provided by an embodiment of the present disclosure;

[0024] Figure 3 A framework diagram of a training process of a first image encoder of an image classification model in an image classification method provided by an embodiment of the present disclosure;

[0025] Figure 4 A framework diagram of the training process of a text encoder and a feature matching layer of an image classification model in an image classification method provided in an embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of the structure of an image classification device provided by an embodiment of the present disclosure;

[0027] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0034] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0035] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0036] Figure 1 The present invention is a flowchart of an image classification method provided by an embodiment of the present invention. The present invention is applicable to situations where image classification is performed, for example, in situations where facial images are classified into real facial images and false facial images in silent liveness detection. The method can be performed by an image classification device, which can be implemented in the form of software and / or hardware, and can be configured in an electronic device, such as a mobile phone, a computer, etc.

[0037] like Figure 1 As shown, the image classification method provided in this embodiment may include:

[0038] S110, extracting a first image feature of the image to be classified;

[0039] S120, extracting the first text feature of each description text in the description text set; wherein the description text set corresponds to the target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0040] S130, determining a target text feature that matches the first image feature from each first text feature;

[0041] S140: Determine a target category of the image to be classified based on the image category corresponding to the target text feature.

[0042] The image classification method provided in this embodiment can be implemented by a trained deep learning model. The deep learning model can include at least a network structure for extracting image features, a network structure for extracting text features, and a network structure for matching image and text features, and each of the above network structures can be constructed based on an existing related network structure.

[0043] Correspondingly, the first image feature of the image to be classified can be extracted through the network structure for extracting image features; the first text feature of each descriptive text can be extracted through the network structure for extracting text features; the matching degree between each first text feature and the first image feature can be determined through the network structure for matching image and text features, and the first text feature with the highest matching degree can be used as the target text feature that matches the first image feature.

[0044] Different image classification tasks may correspond to different description text sets. The description text set in the embodiment of the present disclosure may correspond to a target image classification task performed on an image to be classified. The target image classification task may include a task of dividing the image to be classified into at least two image categories; accordingly, the description text set may include description texts for describing at least two image categories under the target image classification task. The description text set may be updated as the image category is updated. For example, when the image category under the target image classification task is added, deleted, changed, etc., the description text in the description text set may be added, deleted, and changed accordingly.

[0045] Exemplarily, Table 1 shows a description text set corresponding to a liveness detection task. The image categories under the liveness detection task may include subcategories in the parent category real face category and subcategories in the parent category fake face category; accordingly, the description text set may include description texts for describing subcategories of the real face category and subcategories of the fake face category.

[0046] Table 1

[0047]

[0048] As shown in Table 1, each subcategory can be considered as an image category, and each image category can correspond to at least one description text. The description text can be considered as an explanatory text corresponding to the image category, and can be constructed based on experience or experiments. In some implementations, each image category can also correspond to at least two description texts. In this way, a multi-angle text description can be provided for the image category, which can help improve the classification effect of subsequent images.

[0049] Moreover, for any parent category of the target image classification task, there may be a situation where the parent category only includes one subcategory. For example, in Table 1, for the parent category of the real face class, there may not necessarily be multiple corresponding subcategories, and it can be regarded as its only subcategory and described accordingly.

[0050] Among them, after the first text feature of the description text is extracted for the first time, it can be stored in the preset storage space, and the first text feature in the preset storage space can be updated as the description text in the description text set is updated. Correspondingly, when the first image feature of the image to be classified that needs to be classified is extracted, the first text feature corresponding to each description text can also be directly obtained from the preset storage space. In this way, it is possible to perform feature matching with the first image features of multiple images to be classified by only extracting the features of each description text after the current update, which can save computing resources.

[0051] After determining the target text feature that matches the first image feature, the target category of the image to be classified that currently needs to be classified can be determined based on the image category corresponding to the description text extracted from the target text feature. For example, the subcategory corresponding to the description text extracted from the target text feature can be used as the target category of the facial image; or the parent category to which the subcategory corresponding to the description text extracted from the target text feature belongs can be used as the target category of the facial image.

[0052] In the disclosed embodiment, the update of the image category may occur during any step of the image classification method; accordingly, the description text set may be updated synchronously with the update of the image category. In addition, when the description text set is updated (for example, the description text inside it is added, deleted, changed, etc.), the first text feature corresponding to the description text may also be updated in the preset storage space. Thus, in the image classification process after the image category is updated, the first image feature of the image to be classified can be matched with the first text feature in the latest updated preset storage space to determine the target category of the image to be classified. In the case where the target category is the latest updated image category, it is possible to quickly model new image categories using description texts, and complete zero-sample prediction through cross-modal feature matching, thereby achieving rapid recognition of new image categories.

[0053] In some optional implementations, the method is applied to an image classification model, and at least a portion of the image classification model can be obtained based on knowledge distillation of a multimodal pre-trained model; wherein the multimodal pre-trained model is used to process data in at least image modality and text modality.

[0054] The deep learning model used to perform the image classification method of the present disclosure may be referred to as an image classification model. Figure 2A framework diagram of an image classification method based on an image classification model in an image classification method provided in an embodiment of the present disclosure.

[0055] See also Figure 2 , the image classification model may include at least a first network structure for extracting image features, a second network structure for extracting text features, and a third network structure for matching image and text features. Among them, the image to be classified can be input into the first network structure so that it can extract the first image features; the most recently updated description text in the description text set can be input into the second network structure so that it can extract each first text feature. The first image feature and the first text feature can be input into the third network structure so that it can output the matching degree of each first text feature with the first image feature (for example, a similarity vector), and the first text feature with the highest matching degree can be used as the target text feature that matches the first image feature (for example, Figure 2 Then, the target category can be determined based on the image category corresponding to the target text feature, for example Figure 2 In the example, subcategory 0 or parent category 0 can be determined as the target category.

[0056] Among them, the multimodal pre-trained model can be pre-trained based on large-scale, multimodal general sample data to obtain the ability to extract data features of at least image modality and text modality and the ability to match cross-modal features including at least image-text feature matching, that is, the multimodal pre-trained model can be used to process data of at least image modality and text modality. It can be considered that if the multimodal pre-trained model is trained for downstream tasks based on training data related to the target image classification task, then the trained multimodal pre-trained model can also be called an image classification model, and the image classification method disclosed in the present invention can also be implemented.

[0057] In addition, see again Figure 2 In the image classification model, at least part of the first network structure, the second network structure, and the third network structure in the model can be obtained by knowledge distillation based on the multimodal pre-training model. For example, the first network structure can be obtained by knowledge distillation based on the network structure for extracting image features in the multimodal pre-training model; for example, the second network structure and the third network structure can be obtained by knowledge distillation based on the network structure for extracting text features and the network structure for matching image and text features in the multimodal pre-training model, respectively; for example, the first network structure, the second network structure, and the third network structure are all obtained by knowledge distillation based on the corresponding network structures in the multimodal pre-training model.

[0058] Among these optional implementations, for some image classification tasks, such as liveness detection tasks, the amount of training data is usually very limited, and the multimodal pre-training model is trained based on large-scale general sample data. The image classification model obtained on this basis (for example, the image classification model obtained through downstream task training, knowledge distillation, etc.) will also have a more generalized cross-modal feature matching capability. For target image classification tasks with limited training data, when encountering new image categories, it is also possible to accurately match the new image categories with the new description texts while establishing new descriptions, and complete the recognition of the new image categories. In addition, the image classification model obtained by knowledge distillation is more lightweight than the multimodal pre-training model, which is conducive to improving computing efficiency and model deployment.

[0059] The technical solution of the disclosed embodiment is to extract the first image feature of the image to be classified; extract the first text feature of each description text in the description text set; wherein the description text set corresponds to the target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated; determine the target text feature that matches the first image feature from each first text feature; and determine the target category of the image to be classified based on the image category corresponding to the target text feature. By matching the image and text features, when a new image category appears, it is possible to quickly identify the new image category by simply updating the relevant description text without performing an algorithm iteration process.

[0060] The embodiments of the present disclosure can be combined with the various optional solutions in the image classification method provided in the above embodiments. This embodiment describes in detail the training steps of the image classification model for executing the image classification method.

[0061] In an embodiment of the present disclosure, the image classification model may include a first image encoder, the multimodal pre-training model may include a second image encoder, and the parameter amount of the first image encoder is smaller than the parameter amount of the second image encoder.

[0062] In this embodiment, the network structure for extracting image features in the image classification model can be called the first image encoder, and the network structure for extracting image features in the multimodal pre-training model can be called the second image encoder. The parameter amount of the first image encoder is smaller than the parameter amount of the second image encoder, which can include that the number of network layers of the first image encoder is smaller than the number of network layers of the second image encoder, and / or the number of channels in each layer of the network can be smaller than that of the second image encoder, etc. Therefore, by performing knowledge distillation training on the first image encoder, not only can the image encoding capability of the second image encoder be transferred to the first image encoder, but also a more lightweight image feature extraction network can be obtained.

[0063] For example, Figure 3 This is a framework diagram of the training process of the first image encoder of the image classification model in the image classification method provided by the embodiment of the present disclosure. Figure 3 As shown, in the image classification method provided by this embodiment, the training process of the first image encoder may include:

[0064] The first sample image is encoded by the first image encoder to obtain the second image feature. The first sample image includes the second sample image related to the target image classification task, and may also include a general sample image, such as an image in an open source database such as Image Net, and the general sample image may be irrelevant to the target image classification task. By using the general sample image and the second sample image related to the target image classification task to perform distillation training on the image encoder of the image classification model, the versatility of the image encoder in the image classification model to extract features can be improved.

[0065] The first sample image is encoded by the second image encoder to obtain the third image feature. There is no strict time sequence relationship between the encoding process of the first image encoder and the second image encoder.

[0066] A distillation loss is determined according to the second image feature and the third image feature, and the first image encoder is trained according to the distillation loss. The distillation loss can be determined by an existing feature image loss algorithm, such as mean absolute value loss (L1 Loss). Back propagation can be performed according to the distillation loss to adjust parameters of the first image encoder to achieve distillation training of the first image encoder.

[0067] Figure 3 The training framework shown can be considered to be effective only in the first image encoder training stage. After the training is completed, only the first image encoder part can be retained to achieve the extraction of the first image features of the image to be classified. Since the image encoder has a large amount of computation in the image classification task, the image encoder in the image classification model is obtained by performing knowledge distillation on the image encoder in the multimodal pre-training, which can greatly reduce the amount of computation of the image encoder in the image classification model and help improve computational efficiency.

[0068] In the disclosed embodiment, the image classification model may further include a text encoder and a feature matching layer of a multimodal pre-trained model.

[0069] Among them, after the multimodal pre-training model is pre-trained based on large-scale, multimodal general sample data, the parameters of the text encoder and feature matching layer inside it can be assigned to the text encoder and feature matching layer of the image classification model respectively. Afterwards, the parameters of the text encoder and feature matching layer of the image classification model can be adjusted based on the second sample data related to the image classification task, so that the text encoder and feature matching layer of the image classification model can adapt to the image classification task.

[0070] For example, Figure 4 This is a framework diagram of the training process of the text encoder and feature matching layer of the image classification model in an image classification method provided by an embodiment of the present disclosure. Figure 4 As shown, in the image classification method provided by this embodiment, the training process of the text encoder and the feature matching layer may include:

[0071] Extracting a fourth image feature of a second sample image related to a target image classification task. The first image encoder in the image classification model may be trained first, and the fourth image feature of the second sample image may be extracted through the trained first image encoder. The first image encoder and the text encoder and feature matching layer in the image classification model may also be trained simultaneously to extract the fourth image feature of the second sample image through the first image encoder being trained.

[0072] The description texts corresponding to the image categories under the target image classification task are encoded by the text encoder to obtain the second text features. The description texts in the description text set can be pre-constructed for the image categories under the target image classification task. Accordingly, the description texts can be encoded by the text encoder to obtain the second text features.

[0073] The similarity between each second text feature and the fourth image feature is determined through the feature matching layer, wherein the similarity can represent the matching degree of the image and text features, and the greater the similarity, the higher the image and text matching degree.

[0074] The predicted category of the second sample image is determined based on the similarities. The predicted category of the second sample image can usually be determined based on the image category corresponding to the second text feature with the greatest similarity.

[0075] The supervised loss is determined according to the predicted category and the category label corresponding to the second sample image, and the feature matching layer and the text encoder are trained according to the supervised loss. Among them, the predicted category of each second sample image can constitute a predicted category vector, and the category label corresponding to the second sample image can constitute a label vector. The supervised loss can be determined by an existing loss algorithm between vectors, such as Cross Entropy Loss (CE Loss). Back propagation can be performed according to the supervised loss to adjust the parameters of the text encoder and feature matching layer of the image classification model, so as to realize the supervised training of the text encoder and feature matching layer of the first image classification model.

[0076] Since the text encoder has a small amount of computation in the image classification task, by adjusting the parameters of the text encoder and feature matching layer in the multimodal pre-training using only sample images related to the image classification task, it can not only adapt to the image classification task but also avoid the resource loss caused by this part of the distillation training.

[0077] In some optional implementations, each image category under the target image classification task belongs to a subcategory of a binary classification parent category, and the category label corresponding to the second sample image is a binary classification label; accordingly, determining the predicted category of the second sample image based on each similarity may include: fusing the similarities corresponding to each image category belonging to the same parent category to obtain a binary classification predicted category.

[0078] Referring to the example in Table 1, when the target image classification task is a liveness detection task, each subcategory may be an image category, and may belong to two parent categories, namely, a false face category and a real face category. The category label corresponding to the second sample image is a binary label, and may include two labels, namely, a false face category and a real face category.

[0079] See again Figure 4 In these cases, an additional aggregation layer can be added during the model training process to fuse the similarities corresponding to each image category belonging to the same parent category to obtain the predicted category of the binary classification. In these optional implementations, by fusing the similarities under the same parent category, supervised training of the model based on the binary classification label can be achieved. Among them, similarity fusion can be considered to be performed only in the training phase, but not in the prediction phase, that is, the aggregation layer set in the model can only participate in the training process of the image classification model as an auxiliary module to facilitate the determination of the loss, but it is not a module that needs to be included in the inference of the image classification model.

[0080] The technical solution of the disclosed embodiment describes in detail the training steps of the image classification model for executing the image classification method. Since the amount of computation of the image encoder in the image classification task is relatively large, the image encoder in the image classification model is obtained by performing knowledge distillation on the image encoder in the multimodal pre-training, which can greatly reduce the amount of computation of the image encoder in the image classification model, and is beneficial to improving computational efficiency. Since the amount of computation of the text encoder in the image classification task is relatively small, by only using sample images related to the image classification task to adjust the parameters of the text encoder and feature matching layer in the multimodal pre-training, it can not only adapt to the image classification task, but also avoid the resource loss caused by this part of the distillation training.

[0081] In addition, the image classification method provided in the embodiment of the present disclosure and the image classification method provided in the above embodiment belong to the same public concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and the same technical features have the same beneficial effects in this embodiment and the above embodiment.

[0082] The various optional schemes in the image classification method provided in the embodiment of the present disclosure and the above-mentioned embodiment can be combined. In the image classification method provided in the present embodiment, the target image classification task may include silent liveness detection, and the image category may include subcategories of real face categories and subcategories of false face categories. By classifying facial images into real face images and false face images, it is possible to provide a basis for whether the system executes subsequent services (such as account login, financial payment, access control verification, etc.).

[0083] The image classification method provided in this embodiment, when applied to the scenario of silent living body detection, may include:

[0084] First, a facial image is obtained. In this embodiment, the facial image can be considered as an image to be classified, and the facial image can be collected by a camera of the system.

[0085] Next, the first image feature of the facial image is extracted. The first image feature of the facial image can be extracted by an image encoder in a living body detection model (ie, an image classification model).

[0086] Secondly, extract the first text feature of each description text in the description text set. Wherein, the description text set corresponds to the silent liveness detection, and each description text in the description text set can be used to describe the subcategories of the real face category and the subcategories of the false face category under the silent liveness detection. In addition, the description text set can be updated as the image category is updated, that is, once the subcategories of the real face category and / or the subcategories of the false face category are updated, the description text set is updated accordingly. For example, in some implementations, the description text corresponding to the subcategories of the real face category / virtual face category in the description text set can be updated accordingly in response to an update instruction (such as an update instruction such as adding, deleting, or changing) of the subcategories of the real face category / virtual face category. After each update of the description text set, the first text feature of each description text in the updated description text set can be extracted by the text encoder in the liveness detection model, and it can be stored in the preset storage space together with the description text. Accordingly, the first text feature of each description text can be directly obtained from the preset storage space to save computing resources.

[0087] Thirdly, a target text feature matching the first image feature is determined from each first text feature. The matching degree between each first text feature and the first image feature can be determined by a feature matching layer in a liveness detection model, and the first text feature with the highest matching degree can be used as the target text feature matching the first image feature.

[0088] Finally, the target category of the image to be classified is determined based on the subcategory corresponding to the target text feature.

[0089] In these optional implementations, when a new type of fake face attack appears, a subcategory of the fake face category can be added for the new attack, and a description text of the newly added subcategory can be constructed accordingly. The newly added description text can obtain the corresponding first text feature through the text encoder in the liveness detection model, and then can be matched with the first image feature of the facial image obtained subsequently to detect whether the facial image belongs to the new subcategory. In the absence of training data for a new type of attack, the feature center of the corresponding attack can be efficiently generated by only describing the attack, and such attacks can be recalled by feature matching, which can greatly improve the defense capability against the image category of the new attack in the liveness detection task.

[0090] In the technical solution of the disclosed embodiment, the target image classification task may include silent liveness detection, and the image category includes subcategories of real face categories and subcategories of fake face categories. By classifying facial images into real face images and fake face images, it is possible to provide a basis for whether the system executes subsequent services (such as account login, financial payment, access control verification, etc.). The image classification method provided in the disclosed embodiment and the image classification method provided in the above embodiment belong to the same public concept. The technical details not described in detail in this embodiment can be found in the above embodiment, and the same technical features have the same beneficial effects in this embodiment and in the above embodiment.

[0091] Figure 5 The image classification device provided in this embodiment is applicable to image classification, for example, to classify facial images into real facial images and false facial images in silent liveness detection.

[0092] like Figure 5 As shown, the image classification device provided by the embodiment of the present disclosure may include:

[0093] An image feature extraction module 510 is used to extract a first image feature of an image to be classified;

[0094] A text feature extraction module 520 is used to extract a first text feature of each description text in a description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0095] An image-text feature matching module 530 is used to determine a target text feature that matches the first image feature from each first text feature;

[0096] The classification module 540 is used to determine the target category of the image to be classified based on the image category corresponding to the target text feature.

[0097] In some optional implementations, the method is applied to an image classification model, and at least part of the image classification model is obtained based on knowledge distillation of a multimodal pre-trained model; wherein the multimodal pre-trained model is used to process data in at least image modality and text modality.

[0098] In some optional implementations, the image classification model may include a first image encoder, the multimodal pre-trained model may include a second image encoder, and the parameter amount of the first image encoder is smaller than the parameter amount of the second image encoder;

[0099] Accordingly, the image classification device may further include:

[0100] A model training module is used to train a first image encoder based on the following steps:

[0101] The first sample image is encoded by a first image encoder to obtain a second image feature; the first sample image includes a second sample image related to the target image classification task;

[0102] Encoding the first sample image by a second image encoder to obtain a third image feature;

[0103] A distillation loss is determined according to the second image feature and the third image feature, and the first image encoder is trained according to the distillation loss.

[0104] In some optional implementations, the image classification model may include a text encoder and a feature matching layer of a multimodal pre-trained model;

[0105] The model training module can be used to train the text encoder and feature matching layer based on the following steps:

[0106] extracting a fourth image feature of the second sample image related to the target image classification task;

[0107] Encoding each description text corresponding to each image category under the target image classification task through a text encoder to obtain each second text feature;

[0108] Determining the similarity between each second text feature and the fourth image feature through a feature matching layer;

[0109] Determining a predicted category of the second sample image according to each similarity;

[0110] A supervision loss is determined according to the predicted category and the category label corresponding to the second sample image, and the feature matching module and the text encoder are trained according to the supervision loss.

[0111] In some optional implementations, each image category under the target image classification task is a subcategory of a binary classification parent category, and the category label is a binary classification label;

[0112] Correspondingly, the model training module can be used to: fuse the similarities corresponding to each image category belonging to the same parent category to obtain a binary classification prediction category.

[0113] In some optional implementations, each image category corresponds to at least two description texts.

[0114] In some optional implementations, the target image classification task may include silent living body detection, and the image category may include subcategories of a real face category and subcategories of a fake face category.

[0115] The image classification device provided in the embodiments of the present disclosure can execute the image classification method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0116] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.

[0117] Reference below Figure 6 , which shows an electronic device (eg, Figure 6 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0118] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0119] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0120] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the image classification method of the embodiment of the present disclosure are executed.

[0121] The electronic device provided by the embodiment of the present disclosure and the image classification method provided by the above embodiment belong to the same disclosed concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0122] The embodiments of the present disclosure provide a computer storage medium on which a computer program is stored. When the program is executed by a processor, the image classification method provided by the above embodiments is implemented.

[0123] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or a flash memory (FLASH), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0124] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0125] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0126] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0127] Extract the first image feature of the image to be classified; extract the first text feature of each description text in the description text set; wherein the description text set corresponds to the target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated; determine the target text feature that matches the first image feature from each first text feature; determine the target category of the image to be classified based on the image category corresponding to the target text feature.

[0128] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0129] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0130] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the units and modules do not, in some cases, limit the units and modules themselves.

[0131] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.

[0132] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0133] According to one or more embodiments of the present disclosure, there is provided an image classification method, the method comprising:

[0134] Extracting a first image feature of the image to be classified;

[0135] Extracting the first text feature of each description text in the description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0136] Determining a target text feature that matches the first image feature from each of the first text features;

[0137] Based on the image category corresponding to the target text feature, a target category of the image to be classified is determined.

[0138] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0139] In some optional implementations, the method is applied to an image classification model, and at least part of the image classification model is obtained based on knowledge distillation of a multimodal pre-trained model; wherein the multimodal pre-trained model is at least used to process data in image modality and text modality.

[0140] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0141] In some optional implementations, the image classification model includes a first image encoder, the multimodal pre-trained model includes a second image encoder, and the number of parameters of the first image encoder is smaller than the number of parameters of the second image encoder;

[0142] The training step of the first image encoder includes:

[0143] The first sample image is encoded by the first image encoder to obtain a second image feature; the first sample image includes a second sample image related to the target image classification task;

[0144] encoding the first sample image by using the second image encoder to obtain a third image feature;

[0145] A distillation loss is determined according to the second image feature and the third image feature, and the first image encoder is trained according to the distillation loss.

[0146] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0147] In some optional implementations, the image classification model includes a text encoder and a feature matching layer of the multimodal pre-trained model;

[0148] The training steps of the text encoder and the feature matching layer include:

[0149] Extracting a fourth image feature of the second sample image related to the target image classification task;

[0150] Encoding each description text corresponding to each image category under the target image classification task by the text encoder to obtain each second text feature;

[0151] Determining the similarity between each of the second text features and the fourth image feature through the feature matching layer;

[0152] Determining a predicted category of the second sample image according to each of the similarities;

[0153] A supervision loss is determined according to the predicted category and a category label corresponding to the second sample image, and the feature matching module and the text encoder are trained according to the supervision loss.

[0154] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0155] In some optional implementations, each image category under the target image classification task belongs to a subcategory of a binary classification parent category, and the category label is a binary classification label;

[0156] Correspondingly, determining the predicted category of the second sample image according to the similarities includes: fusing the similarities corresponding to the image categories belonging to the same parent category to obtain a binary predicted category.

[0157] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0158] In some optional implementations, each image category corresponds to at least two description texts.

[0159] According to one or more embodiments of the present disclosure, there is provided an image classification method, further comprising:

[0160] In some optional implementations, the target image classification task includes silent living body detection, and the image category includes subcategories of real face categories and subcategories of false face categories.

[0161] According to one or more embodiments of the present disclosure, there is provided an image classification device, the device comprising:

[0162] An image feature extraction module, used to extract a first image feature of an image to be classified;

[0163] A text feature extraction module, used to extract the first text feature of each description text in a description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated;

[0164] An image-text feature matching module, used to determine a target text feature that matches the first image feature from each of the first text features;

[0165] The classification module is used to determine the target category of the image to be classified based on the image category corresponding to the target text feature.

[0166] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0167] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0168] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. An image classification method, It is characterized in that include: Extracting a first image feature of the image to be classified; Extracting the first text feature of each description text in the description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated; Determining a target text feature that matches the first image feature from each of the first text features; Based on the image category corresponding to the target text feature, a target category of the image to be classified is determined.

2. The method according to claim 1, It is characterized in that The method is applied to an image classification model, and at least part of the image classification model is obtained based on knowledge distillation of a multimodal pre-trained model; wherein the multimodal pre-trained model is at least used to process data in image modality and text modality.

3. The method according to claim 2, It is characterized in that The image classification model includes a first image encoder, the multimodal pre-training model includes a second image encoder, and the parameter amount of the first image encoder is smaller than the parameter amount of the second image encoder; The training step of the first image encoder includes: The first sample image is encoded by the first image encoder to obtain a second image feature; the first sample image includes a second sample image related to the target image classification task; encoding the first sample image by using the second image encoder to obtain a third image feature; A distillation loss is determined according to the second image feature and the third image feature, and the first image encoder is trained according to the distillation loss.

4. The method according to claim 2, It is characterized in that The image classification model includes a text encoder and a feature matching layer of the multimodal pre-trained model; The training steps of the text encoder and the feature matching layer include: Extracting a fourth image feature of the second sample image related to the target image classification task; Encoding each description text corresponding to each image category under the target image classification task by the text encoder to obtain each second text feature; Determining the similarity between each of the second text features and the fourth image feature through the feature matching layer; Determining a predicted category of the second sample image according to each of the similarities; A supervision loss is determined according to the predicted category and a category label corresponding to the second sample image, and the feature matching module and the text encoder are trained according to the supervision loss.

5. The method according to claim 4, It is characterized in that Each image category under the target image classification task belongs to a subcategory of a binary classification parent category, and the category label is a binary classification label; Correspondingly, determining the predicted category of the second sample image according to the similarities includes: fusing the similarities corresponding to the image categories belonging to the same parent category to obtain a binary predicted category.

6. The method according to claim 1, It is characterized in that Each of the image categories corresponds to at least two description texts.

7. The method according to any one of claims 1 to 6, It is characterized in that The target image classification task includes silent living body detection, and the image categories include subcategories of real face categories and subcategories of false face categories.

8. An image classification device, It is characterized in that include: An image feature extraction module, used to extract a first image feature of an image to be classified; A text feature extraction module, used to extract the first text feature of each description text in a description text set; wherein the description text set corresponds to a target image classification task, and each description text is used to describe each image category under the target image classification task; and the description text set is updated as the image category is updated; An image-text feature matching module, used to determine a target text feature that matches the first image feature from each of the first text features; The classification module is used to determine the target category of the image to be classified based on the image category corresponding to the target text feature.

9. An electronic device, It is characterized in that The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the image classification method as described in any one of claims 1-7.

10. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the image classification method according to any one of claims 1 to 7 when executed by a computer processor.

Citation Information

Patent Citations

  • Zero-small sample machine learning method and system for fusing image and text description thereof

    CN112801159A

  • Image classification method and device, computer equipment and medium

    CN114741581A

  • Multi-modal data-based heavy balance long-tail image data classification method

    CN115205592A

  • Image recognition method and device, electronic equipment and storage medium

    CN115331150A