Image classification method, image display method and electronic equipment
By generating and rewriting title text through a generative language model, zero-sample image classification is achieved, which solves the problem of low image classification display efficiency in the existing technology, improves the accuracy and diversity of image classification, and adapts to the needs of photo album applications.
Patent Information
- Application Number
- CN202410623360.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-09-10
AI Technical Summary
The existing technology relies on a large number of labeled samples for model training in image classification display, which is costly and inefficient in classification display when faced with new scenes or rare samples, making it difficult to meet the needs of photo album applications.
Generative language models are used to generate different types of title texts for the images to be classified, and rewrite them to generate description texts from multiple description angles, achieving zero-sample, unsupervised image classification, reducing costs and improving classification display efficiency.
It improves the accuracy and recall rate of image classification display, provides richer and more diverse title text and description text, enhances the robustness of image classification, and adapts to the display needs of different new scenes or rare samples.
Smart Images

Figure CN118626666A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to an image classification method, an image display method, and an electronic device. Background Art
[0002] In applications with album functions, in order to allow old photos to present some reminders of good memories to users, some pictures with the same features are often displayed to users. For example, some applications will display a group of photos of a certain day in history, a specific person, or a specific place to users in the form of a slideshow. However, when performing image classification and display in related technologies, most of them rely on models that require a large number of labeled samples for training, which is not only costly, but also inefficient in classification and display when facing new scenes or rare samples, and it is difficult to meet the image display requirements in this application scenario. Therefore, a new technical solution is needed to solve such technical problems. Summary of the invention
[0003] In view of this, an embodiment of the present application provides an image classification solution to at least partially solve the above problems.
[0004] According to a first aspect of an embodiment of the present application, an image classification method is provided, including: generating multiple title texts of different types for an image to be classified; rewriting each title text through a generative language model to generate description texts of multiple description angles corresponding to each title text; and classifying the image to be classified according to the obtained description text to obtain a classification result.
[0005] According to a second aspect of an embodiment of the present application, there is provided an image display method, comprising: receiving a trigger operation of a user on an image set, generating an image classification request according to the trigger operation, and sending the image classification request to a server; receiving multiple title texts generated by the server for the image set based on the image classification request, and information of images in the image set corresponding to the multiple title texts, wherein the semantics of the image corresponding to each title text matches the semantics of the title text; and correspondingly displaying the multiple title texts and the images corresponding to the multiple title texts.
[0006] According to a fourth aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store a computer program; the processor is used to execute the image classification method described in the first aspect, the image display method described in the second aspect, or the image display method described in the third aspect by running the computer program stored in the memory.
[0007] According to the fifth aspect of the embodiments of the present application, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image classification method described in the first aspect, the image display method described in the second aspect, or the image display method described in the third aspect is implemented.
[0008] According to the sixth aspect of the embodiments of the present application, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the image classification method described in the first aspect, the image display method described in the second aspect, or the image display method described in the third aspect.
[0009] According to the image classification scheme provided by the embodiment of the present application, multiple title texts of different types can be generated for the image to be classified, and then each title text can be rewritten by a generative language model to generate description texts of multiple description angles corresponding to each title text, and then the image to be classified can be classified according to the obtained description text to obtain a classification result. Therefore, on the one hand, since the scheme does not need to deliberately use a large number of labeled samples for model training before the classified image is classified and displayed, zero-sample, unsupervised image classification can be achieved to facilitate image display, thereby effectively reducing costs and improving the efficiency of classification display when facing new scenes or rare samples; on the other hand, since multiple title texts of different types can be generated for the image to be classified, and each title text can be rewritten by a generative language model to generate description texts of multiple description angles corresponding to each title text, richer and more diverse title texts and description texts can be provided, and through the generative language model, the diversity and coverage of the description texts obtained by rewriting the title text are effectively increased, the robustness of subsequent image classification is improved, and the image can be described more comprehensively, which is convenient for improving the accuracy and recall rate of the classified display of the image to be classified. Based on this, the technical solution of the embodiment of the present application can effectively improve the image classification display effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0011] Figure 1 Schematic diagram of an image classification system according to an embodiment of the present application.
[0012] Figure 2 The figure is a flowchart of a method for image classification according to an embodiment of the present application.
[0013] Figure 3 This is an optional sub-step flowchart of step S106 of an embodiment of the present application.
[0014] Figure 4 This is an optional sub-step flowchart of sub-step S1061 of an embodiment of the present application.
[0015] Figure 5 This is an optional sub-step flowchart of sub-step S1061D of an embodiment of the present application.
[0016] Figure 6 This is a flowchart of an optional sub-step for image filtering according to an embodiment of the present application.
[0017] Figure 7 The figure is a scene diagram of an example of an image classification scheme applicable to an embodiment of the present application.
[0018] Figure 8 The figure is a flowchart of a method for displaying an image according to an embodiment of the present application.
[0019] Fig. 9 The present invention is a scene diagram of an example of an image display solution applicable to an embodiment of the present application.
[0020] Fig.10 The figure is a flowchart of another method for displaying an image according to an embodiment of the present application.
[0021] Fig.11 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0023] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.
[0024] Figure 1 An exemplary system applicable to the embodiment of the present application is shown. Figure 1 As shown, the system 100 may include a cloud service end 102, a communication network 104 and / or one or more user devices 106. Figure 1The example shown is a plurality of user devices 106, and an application with an album function is provided on the user devices 106.
[0025] The cloud server 102 may be any suitable device for storing information, data, programs and / or any other suitable type of content, including but not limited to distributed storage system devices, server clusters, computing cloud server clusters, etc. In some embodiments, the cloud server 102 may perform any suitable function. For example, when the cloud server 102 implements the solution of the embodiment of the present application, in some embodiments, the cloud server 102 may be used to perform an image classification method. As an optional example, in some embodiments, the cloud server 102 may first generate multiple title texts of different types for the image to be classified; then, each title text may be rewritten by a generative language model to generate description texts of multiple description angles corresponding to each title text; and then the image to be classified may be classified according to the obtained description text to obtain a classification result. In some embodiments, the cloud server 102 may receive an image classification request sent by the user device 106, and after classifying the image to be classified in the aforementioned manner, the classification information may be sent to the user device 106, so that the user device 106 displays the image to be classified under its corresponding title text.
[0026] In some embodiments, the communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN) and / or any other suitable communication network. The user device 106 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112), and the communication network 104 can be linked to the cloud service end 102 via one or more communication links (e.g., communication link 114). The communication link can be any communication link suitable for transmitting data between the user device 106 and the cloud service end 102, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.
[0027] Optionally, the user device 106 may be provided with an application having an album function, and the user device 106 may include any one or more user devices suitable for displaying images, interacting with users, etc. In some embodiments, the user device 106 may include any suitable type of device. For example, in some embodiments, the user device 106 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable type of user device.
[0028] For example, when the scheme of the embodiment of the present application is implemented by the user device 106, in some embodiments, the user device 106 can be used to execute the image display method. As an optional example, in some embodiments, the user device 106 can first receive a trigger operation of the user for the image set, generate an image classification request according to the trigger operation, and send the image classification request to the server (cloud server 102); then, the server (cloud server 102) can receive multiple title texts generated for the image set based on the image classification request, and information about images in the image set corresponding to the multiple title texts, and the semantics of the image corresponding to each title text matches the semantics of the title text; then, the multiple title texts and the images corresponding to the multiple title texts are displayed accordingly.
[0029] Based on the above system, the embodiments of the present application provide an image classification scheme and an image display scheme, which are described below through multiple embodiments.
[0030] Figure 2 is a flowchart of the steps of an image classification method according to an embodiment of the present application. According to a first aspect of an embodiment of the present application, an image classification method is provided, referring to Figure 2 As shown, the method includes steps S102, S104 and S106, specifically:
[0031] S102: Generate multiple title texts of different types for the image to be classified.
[0032] Optionally, the title text may be used to describe the image type. When classifying the images to be classified, the images to be classified may be classified under appropriate title texts to facilitate image classification display.
[0033] The specific implementation of step S102 is not limited in the embodiments of the present application. In some optional embodiments, step S102 includes: obtaining first indication information input by a user for indicating the generation of a title text, and generating multiple title texts of different types for the image to be classified according to the first indication information by a generative language model.
[0034] Optionally, the first indication information in the embodiment of the present application may be some text input by the user, which may be used to indicate the generation of the title text. After analyzing the first indication information, the user's intention may be known to generate multiple title texts of different types that meet the user's requirements.
[0035] One implementation of a generative language model is a large language model (LLM), which can generate natural language text, deeply understand the meaning of the text, and handle various natural language tasks. Existing or innovative generative language models can be used to implement the above steps.
[0036] Optionally, a generative language model (such as LLM) may have a matching input interface, and a user may input first indication information for indicating the generation of a title text into the generative language model through the input interface. The generative language model may understand the first indication information, generate and output corresponding multiple title texts as results.
[0037] For example, in an example that is easy to understand, the first indication information input by the user can be "from the perspective of photographic aesthetics, such as image lighting, image composition, image color, image quality, etc., generate a sentence for describing the content of the picture, requiring the language to be concise and the number of words to be within 20 words." Then, a plurality of title texts can be randomly generated through a generative language model (such as LLM). In an example that is easy to understand, the following 6 title texts can be generated: "Element Fusion: A Visual Feast of Multiple Exposures", "Dream Reality: The Aesthetics of Surreal Photography", "Meticulous Indoor Photography", "Sweat and Joy Brought by Swinging Sports", "The Cat Rolling at Home on Weekends and Its Toy Mouse", "A Long Night Chat with You on a Bench Under the Moon". It should be understood that the above-mentioned first indication information and multiple title texts are only used as examples and are not used to limit the embodiments of the present application. For the convenience of citing this example below, this example is recorded as "Example 1" here.
[0038] It should be understood that in the embodiment of the present application, a generative language model (such as LLM) is used to generate multiple title texts according to the first indication information input by the user, which fully utilizes the text generation capability of the generative language model (such as LLM) to provide rich and diverse title texts, providing a basis for image classification and display; in addition, since the user can flexibly input indication information to generate title text for image classification and display, the flexibility of image classification and display is effectively improved, which can better adapt to the classification and display effects of different new scenarios or rare samples, and is conducive to improving the flexibility of product operation of applications that require image classification and display functions (including but not limited to applications with album functions).
[0039] S104: rewriting each title text through a generative language model to generate description texts of multiple description angles corresponding to each title text.
[0040] Generative language models (such as LLM) have been introduced in the previous article and will not be repeated here. Generative language models can be used to rewrite each title text to generate description texts from multiple description angles corresponding to each title text, which can provide richer and more diverse description texts. In addition, the generative language model can effectively increase the diversity and coverage of the description texts obtained by rewriting the title text, improve the robustness of subsequent image classification, and more comprehensively describe the image, which is convenient for improving the accuracy and recall rate of the classified display of the classified images.
[0041] The specific implementation of step S104 is not limited in the embodiments of the present application. In some optional embodiments, step S104 includes: using a generative language model to rewrite each title text multiple times from at least one of image lighting, image composition, image color, image quality, image perspective, image lines, image character expressions, and image environment scenes, to generate description texts within a preset number of words for multiple description angles corresponding to each title text.
[0042] Based on this, in the embodiment of the present application, the title text is rewritten in the above-mentioned manner. On the one hand, the diversity and coverage of the description text obtained by the rewriting process can be effectively increased, thereby improving the robustness of subsequent classification; on the other hand, by generating a description text from at least one of the above multiple description angles, the image can be described more comprehensively compared to a single description angle, thereby improving the accuracy and recall rate of classification display of the classified images; on the other hand, a description text within a preset number of words is obtained, thereby avoiding the situation where the description text is too long, which is conducive to improving simplicity, and is convenient for reducing the amount of calculation in subsequent steps to improve the efficiency of image classification display.
[0043] It should be understood that the preset number of words can be selected as needed, for example, it can be set to 20 words, 30 words, 40 words, 50 words, etc.
[0044] The embodiments of the present application may adopt any suitable method when performing the rewriting process. For example, in some optional embodiments, in step S104, second indication information input by the user for indicating that the title text is to be rewritten may be obtained, and each title text is rewritten according to the second indication information through the generative language model.
[0045] Optionally, the second indication information in the embodiment of the present application may be some text entered by the user, which may be used to instruct the rewriting of the title text. After analyzing the second indication information, the user's intention may be known so as to rewrite the title text to generate description texts from multiple different description angles that meet the user's requirements.
[0046] The generative language model (such as LLM) has been introduced in the previous text and will not be repeated here. Optionally, the user can input the second indication information into the generative language model through the input interface, and the generative language model can understand the second indication information, continue to rewrite the title text generated in step S102, and output corresponding multiple description texts as results.
[0047] For example, let’s continue to use “Example 1” in the above text as an example. Taking the first title text “Element Fusion: A Visual Feast of Multiple Exposures” as an example, after the generative language model performs rewriting, the following two description texts can be obtained: “This multiple exposure picture will bring you a visual shock, integrating different elements to create a unique aesthetic.”, “Multiple exposure photography works, the elements are perfectly integrated, presenting a unique visual feast.” Of course, the two description texts here are only examples. For the convenience of reference below, they are recorded as description text 1 and description text 2 respectively. Other title texts can be inferred from the above examples and will not be repeated here.
[0048] It should be understood that in the embodiment of the present application, a generative language model (such as LLM) is used to rewrite multiple title texts according to the second indication information, which effectively increases the diversity and coverage of the description texts obtained by the rewriting process, improves the robustness of subsequent classification, and can more comprehensively describe the image, thereby improving the accuracy and recall rate of classification display of the classified images. In addition, since the user can flexibly input indication information to achieve the rewriting of multiple title texts to generate description texts for image classification display, the flexibility of image classification display is effectively improved, which can better adapt to the classification display effects of different new scenes or rare samples, and is conducive to improving the flexibility of product operation of applications that require image classification display functions (including but not limited to applications with album functions).
[0049] S106: Classify the image to be classified according to the obtained description text to obtain a classification result.
[0050] After obtaining the description texts of multiple description angles corresponding to each title text, the image to be classified can be classified according to the obtained description text to obtain the classification result, so as to realize the image classification display.
[0051] Based on the optional implementation method of the above steps S102 to S106 in the embodiment of the present application, on the one hand, since the present solution does not need to deliberately use a large number of labeled samples for model training before the classified image is classified and displayed, it can achieve zero-sample, unsupervised image classification, so as to facilitate image display, thereby effectively reducing costs and improving the efficiency of classification display when facing new scenes or rare samples; on the other hand, since multiple title texts of different types can be generated for the classified image, and each title text can be rewritten through a generative language model to generate description texts of multiple description angles corresponding to each title text, richer and more diverse title texts and description texts can be provided, and through a generative language model, the diversity and coverage of the description text obtained by rewriting the title text is effectively increased, the robustness of subsequent image classification is improved, and the image can be described more comprehensively, which is convenient for improving the accuracy and recall rate of classified display of the classified image. Based on this, the technical solution of the embodiment of the present application can effectively improve the image classification display effect.
[0052] The specific implementation of step S106 is not limited in the present application. Figure 3 In the flowchart shown, step S106 includes the following sub-steps S1061 and S1062, specifically:
[0053] S1061: Perform semantic matching on the image to be classified based on the obtained description text, so as to determine a target title text corresponding to the image to be classified from multiple title texts.
[0054] In an embodiment of the present application, after obtaining the description text, semantic matching can be performed on the image to be classified based on the obtained description text through any suitable algorithm to determine the target title text corresponding to the image to be classified from multiple title texts, thereby achieving classification of the image to be classified, so as to facilitate the display of the image to be classified after classification.
[0055] In some optional embodiments, "performing semantic matching on the classified images based on the obtained description text" in step S106 includes: obtaining image quality description information input by the user, and adding the image quality description information to the description text; and performing semantic matching on the classified images based on the description text with the added image quality description information.
[0056] Optionally, the image quality description information may be text content used to describe the image quality of the image, which may be input by the user as required.
[0057] Optionally, when adding the image quality description information to the description text, the image quality description information can be added as a suffix to the end of the description text. For example, as an example, the image quality description information set by the user can be at least one of: bright colors, clear and sharp, high resolution, simple picture, harmonious proportions, visual impact, good layers, vividness, exquisite composition, and strong contrast. Taking the above-mentioned description text 2, that is, "Multiple exposure photographs, the elements are perfectly integrated, presenting a unique visual feast." as an example, the description text 2 with the image quality description information added can be: "Multiple exposure photographs, the elements are perfectly integrated, presenting a unique visual feast. Image quality: bright colors, exquisite composition". Other similar situations can be deduced by analogy and will not be repeated.
[0058] It should be understood that in the embodiment of the present application, by adding descriptions related to image quality to the description text, the details of the description content of the description text are increased, which helps to recall higher quality images when displaying image classification.
[0059] Step S1061 in the embodiment of the present application can be implemented in any manner. In some optional embodiments, step S1061 includes: performing semantic matching on the image to be classified based on the obtained description text through a contrastive language-image pre-training (CLIP) model to determine the target title text corresponding to the image to be classified from multiple title texts.
[0060] The CLIP model is a multimodal pre-trained neural network model that can be used to match images and text. The CLIP model was pre-trained on a large amount of Internet image and text data, and learned how to encode images and text into the same vector space, thereby calculating the semantic similarity between them. The core principle of the CLIP model is contrastive learning. It can use a text encoder and an image encoder to convert text and images into vector representations respectively, and then train the model by calculating the similarity between these vectors, so that the vector representations from paired images and texts are close to each other, while the unpaired ones are far away from each other. The advantage of the CLIP model is that it is an unsupervised learning model that can handle large amounts of unlabeled data and performs well in zero-shot learning tasks, which means that the model can classify without seeing data of a specific category.
[0061] Based on this, in the embodiments of the present application, the CLIP model can be used to effectively implement semantic matching of the image to be classified based on the obtained description text, so as to determine the target title text corresponding to the image to be classified from multiple title texts. On the basis of being able to classify the image to be classified so as to facilitate display after classification, there is no need to deliberately use a large number of labeled samples for model training, and zero-sample, unsupervised image classification and display can be achieved, thereby effectively reducing costs and improving classification and display efficiency when facing new scenes or rare samples.
[0062] In some optional embodiments, referring to Figure 4 As shown in the flowchart, step S1061 includes the following sub-steps S1061A to S1061D, specifically:
[0063] S1061A: For each title text: vectorize the multiple description texts corresponding to the title text respectively to obtain multiple first vectors, perform feature aggregation on the multiple first vectors to obtain a target vector.
[0064] Optionally, the description text can be vectorized by a text encoder in the CLIP model to convert the description text into a semantic vector, thereby obtaining a corresponding first vector, which can realize the conversion of text into a numerical form that can be processed by machine learning.
[0065] The number of dimensions of the first vector obtained in the embodiment of the present application can be arbitrarily set as needed. For example, the first vector can be taken as a 512-dimensional vector as an example below.
[0066] In the embodiment of the present application, after obtaining multiple first vectors corresponding to any title text, the multiple first vectors can be feature aggregated to obtain a comprehensive representation vector (i.e., a target vector), so that the key features of the multiple first vectors can be extracted, and the semantic information of multiple description texts of the title text can be effectively aggregated, which is conducive to improving the accuracy of subsequent classification and display of the classified image through the target vector. The target vector has the same number of dimensions as the first vector. For example, if the first vector is a 512-dimensional vector, the calculated target vector is also a 512-dimensional vector.
[0067] The feature aggregation of the first vectors may be achieved by any method. In some optional embodiments, the "feature aggregation of the multiple first vectors to obtain a target vector" in sub-step S1061A includes: performing average pooling processing on the multiple first vectors to obtain the target vector.
[0068] Based on this, in the embodiment of the present application, by performing average pooling processing on multiple first vectors, the key information of the multiple first vectors can be effectively extracted to obtain a target vector that can aggregate the semantic information of multiple description texts of the title text, which is beneficial to improving the accuracy of subsequent classification and display of the classified images through the target vector.
[0069] For example, take the two description texts of the first title text "Element Fusion: A Visual Feast of Multiple Exposures" mentioned above, namely description text 1 and description text 2 as an example. The first vector of description text 1 is recorded as A = [A0, A1, A2, ..., A511], and the first vector of description text 2 is recorded as B = [B0, B1, B2, ..., B511], both of which are 512-dimensional vectors. Then the first vectors A and B of the two description texts of the title text are average pooled, and the obtained target vector T1 = [(A0+B0) / 2, (A1+B1) / 2, (A2+B2) / 2, ..., (A511+B511) / 2]. It should be understood that the same can be applied to other title texts until the target vectors of all title texts are calculated. In addition, the above two description texts are included only as examples and are not intended to limit the embodiments of the present application. If there are more description texts, they can be calculated by analogy, and will not be repeated here.
[0070] S1061B: Perform vectorization processing on the image to be classified to obtain a second vector.
[0071] Optionally, the image to be classified can be vectorized by an image encoder in the CLIP model to convert the image to be classified into a semantic vector, thereby obtaining a corresponding second vector. The image to be classified can be obtained from an image library, which can be, for example, a photo album in a user device.
[0072] S1061C: Determine first similarities between target vectors and second vectors corresponding to multiple title texts respectively.
[0073] In the embodiment of the present application, the first similarity can represent the degree of matching between the image to be classified and the corresponding title text. The greater the first similarity, the more matching the image to be classified and the title text, and the smaller the first similarity, the less matching the image to be classified and the title text.
[0074] The first similarity can be calculated by any similarity index, such as but not limited to cosine similarity, Euclidean distance, mean square error and other similarity indexes. The larger the index, the greater the first similarity, or the smaller the index, the greater the first similarity. The similarity index can be selected as needed.
[0075] S1061D: Determine a target title text corresponding to the image to be classified from the multiple title texts according to the multiple first similarities.
[0076] After calculating the first similarities between the target vector and the second vector corresponding to the plurality of title texts, the target title text corresponding to the image to be classified can be determined from the plurality of title texts according to the plurality of first similarities and the first preset rule. The first preset rule can be set as required.
[0077] Based on this, in the embodiment of the present application, through the optional implementation of the above-mentioned sub-steps S1061A to S1061D, by calculating the first similarities between the target vector and the second vector corresponding to the multiple title texts, the target title text corresponding to the image to be classified can be effectively determined from the multiple title texts according to the multiple first similarities, thereby effectively realizing semantic matching of the image to be classified based on the obtained description text, realizing accurate classification of the image to be classified, so as to facilitate the display of the image to be classified after classification.
[0078] In some optional embodiments, referring to Figure 5 In the flowchart in, sub-step S1061D includes the following sub-steps S1061D1 to S1061D3, specifically:
[0079] S1061D1: Determine whether there is a first similarity greater than a preset threshold among the multiple first similarities.
[0080] The preset threshold can be set as needed, for example, 80%, 85%, 90%, 95%, etc. A plurality of first similarities can be compared with the preset threshold to determine whether there is a first similarity greater than the preset threshold.
[0081] S1061D2: In response to the existence of a first similarity greater than a preset threshold, a preset number of first similarities among the first similarities greater than the preset threshold are determined as target similarities in descending order.
[0082] The preset number can be set as needed, for example, it can be set to 3, that is, the first similarities ranked in the top 3 among the first similarities greater than the preset threshold are all determined as the target similarities. It can also be set to other values, which are not specifically limited here.
[0083] It should be understood that if the number of first similarities greater than a preset threshold is less than a preset number, all first similarities greater than the preset threshold may be determined as target similarities.
[0084] S1061D3: Determine the title text corresponding to the determined target similarity as the target title text corresponding to the image to be classified.
[0085] Since the target similarity determined in sub-step S1061D2 is the first similarity with the highest size among the multiple first similarities, the corresponding title text is more matched with the image to be classified. Therefore, the title text corresponding to the target similarity can be determined as the target title text corresponding to the image to be classified.
[0086] Based on this, in the embodiment of the present application, through the optional implementation of the above-mentioned sub-steps S1061D1 to S1061D3, the target title text corresponding to the image to be classified can be effectively determined from multiple title texts based on multiple first similarities, thereby achieving accurate classification of the image to be classified, so as to facilitate the display of the image to be classified after classification.
[0087] S1062: Classify the image to be classified into the target title text.
[0088] After determining the target title text, the image to be classified can be classified under the target title text, so as to facilitate display. Optionally, if there are multiple target title texts, the image to be classified can be classified under all of the target title texts.
[0089] It can be understood that for all images (including but not limited to photos or other pictures) in the image library (exemplarily, the image library can be an album in the user's device), each image can be used as an image to be classified to implement the above-mentioned image classification scheme. After multiple images to be classified are classified into title texts, they can be easily classified and displayed to present a group of images with the same title text to the user, thereby giving the user some reminders of good memories.
[0090] Based on this, in the embodiment of the present application, through the optional implementation of the above steps S1061 to S1062, semantic matching is performed on the image to be classified through the description text to determine the target title text corresponding to the image to be classified from multiple title texts, and then the image to be classified is classified under the target title text. The image to be classified can be accurately and effectively classified according to the obtained description text to obtain a classification result, thereby improving the image classification display effect.
[0091] In some optional embodiments, the image classification method in the embodiments of the present application further includes: obtaining image quality filtering information input by a user, and performing image filtering on the image to be classified according to the image quality filtering information.
[0092] Based on this, in the embodiment of the present application, by filtering the images to be classified through the image quality filtering information input by the user, the image quality of the displayed images can be effectively guaranteed, the practicality of the image classification display can be further improved, and the user experience can be improved.
[0093] Optionally, the image quality filtering information may include constructed low-quality image description words or sentences and other texts, which may be constructed manually or generated by a computer. As an example, the low-quality image description words may include at least one of the following: "blurred", "poor quality", "texture distortion", "poor composition", "blurred edges", "distortion", "underexposure", "lens distortion", "cluttered picture", "mobile phone screenshot". There may also be other descriptive words, which are not specifically limited here.
[0094] The specific implementation method of the above-mentioned image filtering is not limited in the embodiments of the present application. Figure 6 The flowchart shown can be implemented through the following steps S202 to S206, specifically:
[0095] S202: Perform vectorization processing on the image quality filtering information to obtain a third vector.
[0096] Optionally, the image quality filter information can be vectorized by a text encoder in the CLIP model to convert the image quality filter information into a semantic vector, thereby obtaining a corresponding third vector, which can realize the conversion of text into a numerical form that can be processed by machine learning.
[0097] S204: Determine a second similarity between the third vector and the second vector.
[0098] As described above, the second vector is a vector obtained by vectorizing the image to be classified. In the embodiment of the present application, the second similarity can represent the degree of matching between the image to be classified and the image quality filtering information. The greater the second similarity, the more matching between the image to be classified and the image quality filtering information, and the smaller the second similarity, the less matching between the image to be classified and the image quality filtering information.
[0099] It should be understood that, since the image quality filtering information may include text such as constructed low-quality image description words or sentences, the greater the second similarity, the lower the image quality of the image to be classified, and the smaller the second similarity, the higher the image quality of the image to be classified. Therefore, image filtering can be implemented in this way.
[0100] The second similarity can be calculated by any similarity index, such as but not limited to cosine similarity, Euclidean distance, mean square error and other similarity indexes. The larger the index, the greater the second similarity, or the smaller the index, the greater the second similarity. The similarity index can be selected as needed.
[0101] S206: Based on the second similarity, determine whether to classify the image to be classified into the determined target title text.
[0102] After calculating the second similarity between the third vector and the second vector, it can be determined whether to classify the image to be classified under the determined target title text according to the plurality of second similarities according to the second preset rule, so as to determine whether to display the image to be classified under the determined target title text. The second preset rule can be set as needed.
[0103] For example, the second preset rule may be that when the second similarity is less than a certain similarity threshold, the image to be classified is determined to be classified under the determined target title text. Otherwise, the image to be classified is discarded and no longer classified under the determined target title text. The similarity threshold can be set as needed, for example, 20%, 15%, 10%, 5%, etc.
[0104] Based on this, in the embodiment of the present application, through the optional implementation of the above steps S202 to S206, the classified images can be effectively filtered according to the image quality filtering information input by the user, ensuring that images with higher image quality are classified under the determined target title text for display, thereby more effectively ensuring the image quality of the displayed images, further improving the practicality of image classification display, and better improving the user experience.
[0105] Below, refer to Figure 7 The schematic diagram of the scene shown in the figure exemplifies the overall implementation process of the image classification scheme of the embodiment of the present application. The overall implementation process can be understood by applying it to a scene in which an application with an album function generates one or more groups of photos of memories for a user.
[0106] Reference Figure 7 In the example shown, under the instruction of the first instruction information input by the user for instructing to generate the title text, a plurality of title texts of different types are generated by a generative language model (such as LLM), such as Figure 7 As shown, the generated multiple title texts of different types are: title texts 1 to N.
[0107] Afterwards, under the instruction of the second instruction information input by the user for instructing to generate the title text, the generated title texts 1 to N are rewritten by a generative language model (such as LLM) to obtain multiple description texts of different angles corresponding to the title texts 1 to N, such as Figure 7 As shown, for title text 1, the multiple description texts obtained by its rewriting process are: description texts 1 to n.
[0108] Afterwards, the image quality description information input by the user is obtained, and the image quality description information is added to the description texts 1 to n, such as Figure 7For the adding example given in , for description text 1, after adding the image quality description information, it can be: "Description text 1. Image quality: XXXX, XXXX", where XXXX can be the text content describing the image quality, such as: bright colors, clear and sharp, high resolution, simple picture, harmonious proportions, visual impact, good hierarchy, vivid, exquisite composition, strong contrast, etc.
[0109] Afterwards, the description text with added image quality description information is semantically matched with the image to be classified.
[0110] Each description text with added image quality description information can be input into the comparative language-image pre-training model (CLIP model), and encoded through its text encoder to realize vectorization processing of the description text, and obtain the first vector corresponding to each of the title texts 1 to N, such as Figure 7 As shown in FIG. 1 , for title text 1, the first vectors obtained by vectorizing description texts 1 to n are respectively: first vectors 1 to n; then, the multiple first vectors corresponding to title texts 1 to N are averagely pooled to achieve feature aggregation of multiple first vectors, and the target vectors of title texts 1 to N are obtained, as shown in FIG. Figure 7 As shown in the figure, for title text 1, its corresponding first vectors 1~n are processed by average pooling to obtain target vector 1. Similarly, for title texts 2~N, target vectors 2~N are obtained respectively, and a total of N target vectors are obtained, namely: target vectors 1~N. The image to be classified can be input into the CLIP model and encoded by its image encoder to realize vectorization processing of the image to be classified and obtain the second vector corresponding to the image to be classified. Then, the similarity between the target vectors 1~N and the second vector is calculated respectively to obtain multiple first similarities, such as Figure 7 As shown, for target vectors 1-N of title texts 1-N, multiple first similarities are obtained respectively: first similarities 1-N.
[0111] Afterwards, it can be determined whether there is a first similarity greater than a preset threshold among the first similarities 1 to N. If there is a first similarity greater than the preset threshold, a preset number of first similarities (for example, the preset number is 3, that is, the first similarities of size Top3) among the first similarities greater than the preset threshold are determined as target similarities in order from large to small, and the title text corresponding to the target similarity is determined as the target title text corresponding to the image to be classified.
[0112] In addition, refer to Figure 7As shown, the image quality filtering information (which may include low image quality descriptors) input by the user can also be obtained and input into a text encoder for encoding to implement vectorized processing of the image quality filtering information, and obtain a third vector corresponding to the image quality filtering information. The third vector and the second vector are then similarly calculated to obtain a second similarity. Based on the second similarity, it can be determined whether to classify the image to be classified into the aforementioned determined target title text, thereby implementing image filtering to ensure the image quality of the displayed image, further improve the practicality of image classification display, and better improve the user experience.
[0113] Afterwards, when the images to be displayed are not filtered out, the images to be displayed can be classified under the target title text for easy display.
[0114] Combination of the above Figure 7 Some of the terms can also be understood by referring to the previous text. Figure 7 The overall implementation process shown is only an example for easy understanding of the embodiment of the present application and is not intended to limit the embodiment of the present application.
[0115] In summary, the image classification scheme provided in the embodiment of the present application, on the one hand, because the scheme does not need to deliberately use a large number of labeled samples for model training before the classified image is classified and displayed, it can achieve zero-sample, unsupervised image classification, so as to facilitate image display, thereby effectively reducing costs and improving the efficiency of classification display when facing new scenes or rare samples; on the other hand, because multiple title texts of different types can be generated for the classified image, and each title text can be rewritten by a generative language model to generate description texts of multiple description angles corresponding to each title text, it is possible to provide richer and more diverse title texts and description texts, and through the generative language model, effectively increase the diversity and coverage of the description text obtained by rewriting the title text, improve the robustness of subsequent image classification, can more comprehensively describe the image, and facilitate the improvement of the accuracy and recall rate of the classified display of the classified image. Based on this, the technical solution of the embodiment of the present application can effectively improve the image classification display effect.
[0116] It can be understood that the above description of the image classification method is only an exemplary description of the embodiments of the present application, and does not constitute any limitation to the embodiments of the present application.
[0117] Figure 81 is a flowchart of the steps of an image display method according to an embodiment of the present application. According to the second aspect of the embodiment of the present application, an image display method is provided, which can be used for a user device. It should be noted that the image display method provided in the second aspect of the embodiment of the present application is related to the image classification method of the first aspect, and can be understood by referring to the contents of the above-mentioned image classification method embodiment. Figure 8 As shown, the image display method includes steps S802, S804 and S806, specifically:
[0118] S802: receiving a trigger operation from a user on an image set, generating an image classification request according to the trigger operation, and sending the image classification request to a server.
[0119] Optionally, the image collection may be an album in a user device (ie, a user terminal). The user device may be provided with an application having an album function, and the album (ie, the image collection) may be established based on the application. The image collection may include multiple images.
[0120] Optionally, the user's trigger operation on the image collection can be a click operation of the user. For example, in one implementation, the user can click a specific button in the album (i.e., the image collection) to perform the trigger operation. Alternatively, other triggering methods can be used to implement the triggering operation, which is not specifically limited here.
[0121] In an embodiment of the present application, an image classification request may be generated according to a trigger operation to send the image classification request to a server for the server to perform image classification.
[0122] S804: Receive multiple title texts generated by the server for the image set based on the image classification request, and information about images in the image set corresponding to the multiple title texts, wherein the semantics of the image corresponding to each title text matches the semantics of the title text.
[0123] The server generates multiple title texts for the image set based on the image classification request, as well as information about the images in the image set corresponding to the multiple title texts, and makes the semantics of the image corresponding to each title text match the semantics of the title text. The relevant content can be understood by referring to the embodiment of the image classification method provided in the first aspect above. Regarding the title text, it can be understood as the title text described above. The server can use each image in the image set as an image to be classified to implement the above-mentioned image classification method.
[0124] That is, the server can implement the above-mentioned image classification in the following manner to obtain information about multiple title texts and images in an image set corresponding to the multiple title texts: obtain first indication information input by the user for indicating the generation of title texts, and generate multiple title texts of different types according to the first indication information; obtain second indication information input by the user for indicating the rewriting of title texts, and rewrite the multiple title texts according to the second indication information to obtain multiple description texts of different description angles corresponding to each title text; perform semantic matching on the image to be classified based on the obtained description text to determine the target title text corresponding to the image to be classified from the multiple title texts; and classify the image to be classified under the target title text. In this way, multiple title texts can be obtained, and the images in the image set can be respectively matched to the title texts, and the semantics of the image corresponding to each title text can be matched with the semantics of the title text.
[0125] It should be understood that a single image in an image set can be mapped to multiple different title texts, so that the single image can be displayed under multiple title texts later. Furthermore, the server can return information about multiple title texts and their corresponding images in the image set to the user device. It should be noted that for the same image, it can belong to only one title text, or it can belong to multiple (at least two) title texts at the same time.
[0126] S806: Displaying a plurality of title texts and images corresponding to the plurality of title texts.
[0127] After the user receives information about multiple title texts and images corresponding to the multiple title texts from the server, the images in the image set can be displayed under the corresponding title texts according to the information about the images corresponding to the multiple title texts, thereby realizing classified display of the images.
[0128] Based on this, in the embodiment of the present application, through the optional image display scheme of the above steps S802 to S806, it is possible to receive a trigger operation of a user on an image collection, generate an image classification request according to the trigger operation, and send the image classification request to the server, and then receive multiple title texts generated by the server for the image collection based on the image classification request, as well as information about images in the image collection corresponding to the multiple title texts, the semantics of the image corresponding to each title text matches the semantics of the title text, and then display the multiple title texts and the images corresponding to the multiple title texts respectively; therefore, the classified display of images in the image collection can be effectively realized, and before the images in the image collection are classified and displayed, there is no need to deliberately use a large number of labeled samples for model training, and zero-sample, unsupervised image classification can be realized to facilitate image display, thereby effectively reducing costs, improving the efficiency of classification display when facing new scenes or rare samples, and effectively improving the image classification display effect.
[0129] Optionally, step S806 may include: displaying a single image in the image set under a plurality of title texts. Displaying a single image under a plurality of title texts is beneficial to the effect of image classification display and improves the user experience.
[0130] Below, refer to Fig. 9 The scene diagram shown in the figure is used to exemplarily illustrate the implementation process of the image display solution of the embodiment of the present application. The implementation process can be understood by applying it to a scene in which an application with an album function generates one or more groups of photos of memories for a user.
[0131] First, step S802 is implemented. The user can trigger the image collection (i.e., album) in the application with the album function in the client (user device) to implement the trigger operation. The client (user device) can generate an image classification request according to the trigger operation and send the image classification request to the server; Fig. 9 As shown, there may be n images in an image collection (i.e., an album), namely images 1 to n. The server may implement an image classification method based on an image classification request, and use each image in images 1 to n as an image to be classified for image classification (which may be understood by referring to the first aspect of the image classification method embodiment), and obtain multiple title texts 1 to N, and information about images in the image collection corresponding to the multiple title texts 1 to N. Then, step S704 is implemented, and the client may receive the multiple title texts 1 to N and the information about images in the image collection corresponding to the multiple title texts 1 to N. Step S806 is then implemented to display the multiple title texts 1 to N and the images corresponding to the multiple title texts 1 to N, so as to realize the classified display of pictures in the image collection. As shown in FIG. Fig. 9As shown, taking title text 1 and title text 2 as examples, image 1, image 2 and image n can be classified and displayed under title text 1, image 1, image 3 and image n-1 can be classified and displayed under title text 2, and the same applies to the others. In addition, it can be seen that a single image can be displayed under different title texts, such as image 1 is displayed under title texts 1, 2, and 3, and image 2 is displayed under title texts 1 and N. In this way, the classified display of images in the image set can be effectively realized, the image classification display effect can be effectively improved, and it is convenient to provide users with a better recall experience.
[0132] It should be understood that Fig. 9 The implementation process shown is only an example for easy understanding of the embodiment of the present application and is not intended to limit the embodiment of the present application.
[0133] Fig.10 It is a flowchart of the steps of another image display method according to an embodiment of the present application. According to the third aspect of the embodiment of the present application, an image display method is provided, which can be used for a user device. It should be noted that the image display method provided in the third aspect of the embodiment of the present application is related to the image classification method of the first aspect and the image display method of the second aspect, and can be understood by referring to the contents of the above-mentioned image classification method and image display method embodiments. Fig.10 As shown, the image display method includes steps S1002, S1004, S1006 and S1008, specifically:
[0134] S1002: Receive natural language task instruction information for instructing to classify an image set.
[0135] Optionally, the image collection may be an album in a user device (ie, a user terminal). The user device may be provided with an application having an album function, and the album (ie, the image collection) may be established based on the application. The image collection may include multiple images.
[0136] Optionally, the natural language task instruction information may refer to a natural language text for classifying the image set. Optionally, the user may input the natural language task instruction information through an input interface on the user device for the server to classify the image. Alternatively, the natural language task instruction information may be input through other input methods such as voice input.
[0137] S1004: Send natural language task indication information to the server, so as to generate multiple title texts for the image set and information of images in the image set corresponding to the multiple title texts based on the natural language task indication information through a generative language model set in the server, and the semantics of the image corresponding to each title text matches the semantics of the title text.
[0138] The user device can indicate natural language task information to the server, and the generative language model set in the server can understand the natural language task indication information to generate corresponding multiple title texts for the image set, as well as information about images in the image set corresponding to the multiple title texts, and make the semantics of the image corresponding to each title text match the semantics of the title text.
[0139] Optionally, the generative language model in the server can generate the first indication information and the second indication information mentioned above based on the natural language task indication information, and then generate multiple title texts of different types for the image set based on the first indication information through the generative language model, and rewrite the multiple title texts based on the second indication information through the generative language model to obtain multiple description texts of different description angles corresponding to each title text, and then semantically match the image to be classified based on the obtained description text to determine the target title text corresponding to the image to be classified from the multiple title texts; classify the image to be classified under the target title text. In this way, multiple title texts can be obtained, and the images in the image set can be respectively matched to the title texts, and the semantics of the image corresponding to each title text can be matched with the semantics of the title text.
[0140] S1006: Receive multiple title texts sent by the server, and information of images in the image set corresponding to the multiple title texts.
[0141] It should be understood that a single image in an image set can be mapped to multiple different title texts, so that the single image can be displayed under multiple title texts later. Furthermore, the server can return information about multiple title texts and their corresponding images in the image set to the user device. It should be noted that for the same image, it can belong to only one title text, or it can belong to multiple (at least two) title texts at the same time.
[0142] S1008: Displaying a plurality of title texts and images corresponding to the plurality of title texts.
[0143] After the user device receives information about multiple title texts and images corresponding to the multiple title texts from the server, the images in the image set can be displayed under the corresponding title texts according to the information about the images corresponding to the multiple title texts, thereby realizing classified display of the images.
[0144] Based on this, in the embodiment of the present application, through the optional image display scheme of the above steps S1002 to S1008, it is possible to receive natural language task indication information for indicating the classification of an image set, and then send the natural language task indication information to the server, so as to generate multiple title texts for the image set based on the natural language task indication information through the generative language model set in the server, and the information of the images in the image set corresponding to the multiple title texts, the semantics of the image corresponding to each title text matches the semantics of the title text, and then receive the multiple title texts sent by the server, and the information of the images in the image set corresponding to the multiple title texts, and then display the multiple title texts and the images corresponding to the multiple title texts respectively; therefore, the classified display of the images in the image set can be effectively realized, and before the images in the image set are classified and displayed, there is no need to deliberately use a large number of labeled samples for model training, and zero-sample, unsupervised image classification can be realized to facilitate image display, thereby effectively reducing costs, improving the efficiency of classification display when facing new scenes or rare samples, and effectively improving the image classification display effect.
[0145] According to a fourth aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store a computer program; the processor is used to execute the image classification method described in the first aspect, the image display method described in the second aspect, or the image display method described in the third aspect by running the computer program stored in the memory.
[0146] Fig.11 1100 is a block diagram of an optional electronic device in an embodiment of the present application. The present application embodiment does not limit the specific implementation of the electronic device 1100. Fig.11 The electronic device 1100 provided in the embodiment of the present application includes: a processor 1102, a communication interface 1104, a memory 1106, and a communication bus 1108. Among them:
[0147] The processor 1102 , the communication interface 1104 , and the memory 1106 communicate with each other via a communication bus 1108 .
[0148] The communication interface 1104 is used to communicate with other electronic devices or servers.
[0149] The processor 1102 is used to execute the computer program 1110, and specifically can execute the relevant steps in any of the aforementioned image classification method or image display method embodiments.
[0150] Specifically, the computer program 1110 may include program codes, which include computer operation instructions.
[0151] The processor 1102 may be a CPU, or a GPU (Graphic Processing Unit), or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0152] The memory 1106 is used to store the computer program 1110. The memory 1106 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0153] The computer program 1110 may be specifically configured to enable the processor 1102 to execute the image classification method or image display method in any of the aforementioned embodiments.
[0154] The specific implementation of each step in the computer program 1110 can refer to the corresponding description of the corresponding steps and units in any of the above-mentioned image classification methods or image display method embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.
[0155] The electronic device 1100 in the embodiment of the present application has been described in detail in the aforementioned image classification method or image display method embodiment, so its related content and beneficial effects can be understood with reference to the above-mentioned method embodiment and will not be repeated here.
[0156] According to a fifth aspect of the embodiments of the present application, the embodiments of the present application further provide a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the image classification method described in the first aspect or the image display method described in the second aspect or the image display method described in the third aspect is implemented. The computer storage medium includes, but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.
[0157] According to the sixth aspect of the embodiments of the present application, the embodiments of the present application also provide a computer program product, including a computer program, which, when executed by a processor, implements the image classification method described in the first aspect or the image display method described in the second aspect or the image display method described in the third aspect.
[0158] The electronic device 1100 / computer storage medium / computer program product embodiment in the embodiment of the present application has been described in detail in the aforementioned image classification method or image display method embodiment, so its related content and beneficial effects can be understood with reference to the above-mentioned method embodiment and will not be repeated here.
[0159] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0160] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0161] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.
[0162] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for specific applications, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0163] The term "including" and its variations used in this document are open inclusions, that is, "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 other embodiment"; the term "some embodiments" means "at least some embodiments". It should be noted that the concepts of "first", "second", etc. mentioned in the embodiments of the present application 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. It should be noted that the modifications of "one" and "multiple" mentioned in the embodiments of the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0164] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. An image classification method, include: Generate multiple caption texts of different types for the classified images; Rewrite each title text through a generative language model to generate description texts of multiple description angles corresponding to each title text; The image to be classified is classified according to the obtained description text to obtain a classification result.
2. The method according to claim 1, in, The step of classifying the image to be classified according to the obtained description text to obtain a classification result includes: Based on the obtained description text, semantic matching is performed on the image to be classified to determine the target title text corresponding to the image to be classified from multiple title texts; Classify the image to be classified into the target title text.
3. The method according to claim 2, in, The semantic matching of the image to be classified based on the obtained description text includes: Acquire image quality description information input by a user, and add the image quality description information to the description text; Semantic matching is performed on the images to be classified based on the description text added with the image quality description information.
4. The method according to claim 2 or 3, in, The method of generating a plurality of title texts of different types for the classified image comprises: obtaining first instruction information input by a user for instructing to generate the title text, and generating a plurality of title texts of different types for the classified image according to the first instruction information by using a generative language model; The rewriting process of each title text by using a generative language model includes: obtaining second indication information input by a user for indicating that the title text should be rewritten, and rewriting each title text according to the second indication information by using a generative language model.
5. The method according to claim 4, in, The semantic matching of the image to be classified based on the obtained description text to determine the target title text corresponding to the image to be classified from the multiple title texts includes: By comparing the language-image pre-trained CLIP model, semantic matching is performed on the image to be classified based on the obtained description text, so as to determine the target title text corresponding to the image to be classified from the multiple title texts.
6. The method according to claim 5, in, The semantic matching of the image to be classified based on the obtained description text to determine the target description text corresponding to the image to be classified from the multiple description texts includes: For each title text: vectorize the multiple description texts corresponding to the title text respectively to obtain multiple first vectors, perform feature aggregation on the multiple first vectors to obtain a target vector; Performing vectorization processing on the image to be classified to obtain a second vector; respectively determining first similarities between target vectors corresponding to the plurality of title texts and the second vector; According to the multiple first similarities, a target title text corresponding to the image to be classified is determined from the multiple title texts.
7. The method according to claim 6, in, The step of performing feature aggregation on the plurality of first vectors to obtain a target vector includes: Average pooling is performed on the multiple first vectors to obtain the target vector.
8. The method according to claim 6, in, The step of determining a target title text corresponding to the image to be classified from the plurality of title texts according to the plurality of first similarities comprises: Determine whether there is a first similarity greater than a preset threshold among the multiple first similarities; In response to the existence of a first similarity greater than a preset threshold, first similarities that are greater than the preset threshold and are ranked first by a preset number in descending order are all determined as target similarities; The title text corresponding to the determined target similarity is determined as the target title text corresponding to the image to be classified.
9. The method according to claim 6, in, The method further comprises: The image quality filtering information input by the user is obtained, and the image to be classified is subjected to image filtering according to the image quality filtering information.
10. The method according to claim 9, in, The performing image filtering on the image to be classified according to the image quality filtering information includes: Performing vector processing on the image quality filtering information to obtain a third vector; determining a second similarity between a third vector and the second vector; Based on the second similarity, it is determined whether to classify the image to be classified into the determined target title text.
11. The method according to any one of claims 1 to 3, in, The rewriting process of each title text by using a generative language model to generate description texts of multiple description angles corresponding to each title text includes: Through the generative language model, each title text is rewritten multiple times based on at least one of the image lighting, image composition, image color, image quality, image perspective, image lines, image character expressions, and image environment scenes to generate description texts within a preset number of words for multiple description angles corresponding to each title text.
12. A method for displaying an image, include: Receiving a trigger operation from a user on an image set, generating an image classification request according to the trigger operation, and sending the image classification request to a server; Receiving a plurality of title texts generated by the server for the image set based on the image classification request, and information of images in the image set corresponding to the plurality of title texts, wherein the semantics of the image corresponding to each title text matches the semantics of the title text; The multiple title texts and the images corresponding to the multiple title texts are displayed accordingly.
13. A method for displaying an image, include: Receiving natural language task instruction information for instructing to classify a collection of images; Sending the natural language task indication information to a server, so as to generate a plurality of title texts for the image set and information of images in the image set corresponding to the plurality of title texts based on the natural language task indication information through a generative language model set in the server, wherein the semantics of the image corresponding to each title text matches the semantics of the title text; Receiving a plurality of title texts sent by the server, and information of images in the image set corresponding to the plurality of title texts respectively; The multiple title texts and the images corresponding to the multiple title texts are displayed accordingly.
14. An electronic device, include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 13 by running the computer program stored in the memory.
Citation Information
Patent Citations
Information classification method and device, storage medium and electronic equipment
CN112231497A
Image processing method and device, electronic equipment and computer readable storage medium
CN116958320A
CLIP-based method for quickly constructing image classification model
CN117409262A
Cross-modal weak supervision for media classification
US20210406601A1
Machine-Learning-Based Identification of Drawing Attributes
US20230053656A1
