Image classification method, apparatus, readable medium and electronic device
By acquiring and fusing multimodal information from images, the problem of small inter-class differences and large intra-class differences in fine-grained image classification is solved, thereby improving the accuracy of image classification results.
Patent Information
- Application Number
- CN202210112946.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-01-29
AI Technical Summary
Existing technologies struggle to accurately perform fine-grained image classification tasks, especially due to the small inter-class differences between different subclasses and the large intra-class differences within a single subclass, leading to inaccurate image classification results.
By acquiring multimodal information of the image to be classified, including textual information, spatiotemporal information, and attribute information, and using a pre-trained image classification model to fuse the image encoding vector and the multimodal encoding vector, the image classification result is determined.
This improves the accuracy of fine-grained image classification and ensures the accuracy of image classification results.
Smart Images

Figure CN114511744B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and more specifically, to an image classification method, apparatus, readable medium, and electronic device. Background Technology
[0002] Image classification is an image processing method that categorizes images into different classes based on the different features reflected in the image information. Fine-grained image classification, as an important research direction in image classification, has wide applications in various fields. The goal of fine-grained image classification is to further refine the subclassification of images belonging to the same category. However, due to the small inter-class differences between different subclasses and the large intra-class differences within a single subclass, fine-grained image classification is quite difficult, making it hard to accurately complete the task and thus affecting the accuracy of the image classification results. Summary of the Invention
[0003] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] In a first aspect, this disclosure provides an image classification method, the method comprising:
[0005] Acquire the image to be classified and its multimodal information; the multimodal information includes text information, spatiotemporal information, and attribute information;
[0006] Based on the image to be classified and the multimodal information, the image classification result of the image to be classified is determined by a pre-trained image classification model;
[0007] The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and to fuse the image encoding vector and the multimodal encoding vector to obtain the target classification vector, and to determine the image classification result based on the target classification vector.
[0008] Secondly, this disclosure provides an image classification apparatus, the apparatus comprising:
[0009] The acquisition module is used to acquire the image to be classified and its multimodal information; the multimodal information includes text information, spatiotemporal information, and attribute information.
[0010] The processing module is used to determine the image classification result of the image to be classified based on the image to be classified and the multimodal information, using a pre-trained image classification model;
[0011] The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and to fuse the image encoding vector and the multimodal encoding vector to obtain the target classification vector, and to determine the image classification result based on the target classification vector.
[0012] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of this disclosure.
[0013] Fourthly, this disclosure provides an electronic device, comprising:
[0014] A storage device on which computer programs are stored;
[0015] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect of this disclosure.
[0016] Through the above technical solution, this disclosure obtains the image to be classified and its multimodal information, and determines the image classification result of the image to be classified using a pre-trained image classification model based on the image to be classified and the multimodal information. The multimodal information includes text information, spatiotemporal information, and attribute information. The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and fuses the image encoding vector and the multimodal encoding vector to obtain the target classification vector. Based on the target classification vector, the image classification result is determined. This disclosure, by combining multimodal information with the image to be classified using an image classification model, can accurately complete fine-grained image classification tasks and ensure the accuracy of the image classification results.
[0017] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote 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. In the drawings:
[0019] Figure 1 This is a flowchart illustrating an image classification method according to an exemplary embodiment;
[0020] Figure 2 It is based on Figure 1 The illustrated embodiment shows a flowchart of step 102;
[0021] Figure 3 This is a schematic diagram illustrating an image classification model according to an exemplary embodiment;
[0022] Figure 4 This is a flowchart illustrating a training image classification model according to an exemplary embodiment;
[0023] Figure 5 This is a block diagram illustrating an image classification apparatus according to an exemplary embodiment;
[0024] Figure 6 It is based on Figure 5 The illustrated embodiment shows a block diagram of a processing module;
[0025] Figure 7 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0026] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0027] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0028] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.
[0029] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0030] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0031] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0032] Figure 1 This is a flowchart illustrating an image classification method according to an exemplary embodiment. Figure 1 As shown, the method may include the following steps:
[0033] Step 101: Obtain the image to be classified and its multimodal information, which includes text information, spatiotemporal information and attribute information.
[0034] For example, the main task of fine-grained image classification is to further subdivide images belonging to the same basic category, such as identifying car models, dog breeds, flower types, and bird species. Because the inter-class differences between different subclasses are small, and there are significant intra-class differences within a single subclass, relying solely on the visual information of the image is insufficient to effectively complete fine-grained image classification, affecting the accuracy of the classification results. In reality, in addition to the visual information of the image itself, information from different modalities, such as textual information, spatiotemporal information, and attribute information, can play an important role in the fine-grained recognition of different subclasses. Therefore, fine-grained image classification can be performed by comprehensively utilizing multimodal information from different modalities based on the image itself.
[0035] Specifically, the first step is to acquire the image to be classified and its multimodal information. Multimodal information can be understood as multi-source auxiliary information used for fine-grained image classification of the image to be classified. This information can include text information, spatiotemporal information, and attribute information (this is just an example; multimodal information can also include other information, such as audio information). For instance, when the image to be classified is an image acquired by a terminal through an image acquisition device, OCR (Optical Character Recognition) technology can be used to extract the text in the image as its text information. Simultaneously, the location coordinates of the image acquisition device and the time when the image was acquired can be used as the image's spatiotemporal information. Furthermore, the image's pixel count, resolution, size, color, saturation, and brightness can be used as its attribute information. The terminal can be a mobile terminal such as a smartphone, tablet, smartwatch, or smart bracelet, or a fixed terminal such as a desktop computer. The image acquisition device can be a camera, image sensor, or other device capable of acquiring images.
[0036] Step 102: Based on the image to be classified and multimodal information, determine the image classification result of the image to be classified using a pre-trained image classification model.
[0037] The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information. The image encoding vector and the multimodal encoding vector are fused to obtain the target classification vector, and the image classification result is determined based on the target classification vector.
[0038] For example, an image classification model that utilizes multimodal information for fine-grained image classification can be pre-trained. After acquiring the image to be classified and the multimodal information, these can be input into the trained model. The model first encodes the image to be classified, obtaining an image encoding vector. Simultaneously, it encodes the multimodal information using vector representation, obtaining a multimodal encoding vector. The model then fuses the image encoding vector and the multimodal encoding vector to obtain a target classification vector containing both the image features of the image to be classified and the multimodal features (which can include text features, spatiotemporal features, and attribute features). Finally, the model determines the image classification result based on the obtained target classification vector. For instance, in a fine-grained image classification scenario where flowers are classified, the classification result could be the type of flower, such as "plum blossom," "rose," or "peony."
[0039] In summary, this disclosure acquires the image to be classified and its multimodal information, and determines the image classification result based on the image to be classified and the multimodal information using a pre-trained image classification model. The multimodal information includes textual information, spatiotemporal information, and attribute information. The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and then fuses the image encoding vector and the multimodal encoding vector to obtain the target classification vector. Based on the target classification vector, the image classification result is determined. This disclosure, by combining multimodal information with the image classification model to perform image classification, can accurately complete fine-grained image classification tasks and ensure the accuracy of the image classification results.
[0040] Figure 2 It is based on Figure 1 The illustrated embodiment shows a flowchart of step 102. For example... Figure 2 As shown, the image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier. Step 102 may include the following steps:
[0041] Step 1021: The image to be classified is encoded by the image encoding module to obtain the image encoding vector.
[0042] Step 1022: Obtain the multimodal feature vector corresponding to the multimodal information through the multimodal information encoding module, and encode the multimodal feature vector to obtain the multimodal encoding vector.
[0043] Step 1023: The image coding vector and the multimodal coding vector are fused by the information fusion module to obtain the target classification vector.
[0044] Step 1024: Determine the image classification result using a classifier based on the target classification vector.
[0045] For example, such as Figure 3 As shown, an image classification model can include an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier. After acquiring the image to be classified and the multimodal information, the image to be classified can be input into the image encoding module to obtain the image encoding vector output by the image encoding module, and then the image encoding vector is sent to the information fusion module. The image encoding module can be a convolutional module, in which case the image encoding vector can have a shape of M. 2 *d image patch vector, M 2This represents the number of image blocks to be divided. Simultaneously, multimodal information can be input into the multimodal information encoding module to obtain the multimodal encoded vector output by the multimodal information encoding module, and then sent to the information fusion module. The multimodal information encoding module can be a multilayer perceptron, in which case the multimodal encoded vector can be a vector of shape N*d. Then, the information fusion module can fuse the image encoded vector, the multimodal encoded vector, and the preset encoded vector to obtain a fused vector, and determine the target classification vector based on the fused vector. The preset encoded vector can be a randomly initialized vector, and the information fusion module can be a self-attention-based encoder.
[0046] In one scenario, the preset encoding vector may include a first preset encoding vector and a second preset encoding vector, and the fusion vector may include a first fusion vector and a second fusion vector. Step 1023 can be implemented in the following way:
[0047] The image coding vector is downsampled by the information fusion module to obtain the first image coding vector. The first image coding vector, the multimodal coding vector and the first preset coding vector are then fused to obtain the first fused vector.
[0048] The first image coding vector is downsampled by the information fusion module to obtain the second image coding vector. The second image coding vector, the multimodal coding vector, and the second preset coding vector are then fused to obtain the second fused vector.
[0049] The target classification vector is determined based on the first fusion vector and the second fusion vector.
[0050] Specifically, the process of obtaining the target classification vector from the image encoding vector and the multimodal encoding vector by the information fusion module can be divided into two stages. In the first stage, the information fusion module downsamples the image encoding vector to obtain a first image encoding vector. Then, it fuses the first image encoding vector and the multimodal encoding vector (i.e., fusing image information and multimodal information of the image to be classified) using a first preset encoding vector (i.e., a randomly initialized vector) to obtain a first fused vector. In the second stage, the information fusion module downsamples the first image encoding vector to obtain a second image encoding vector. Then, it fuses the second image encoding vector and the multimodal encoding vector using a second preset encoding vector (i.e., a randomly initialized vector) to obtain a second fused vector. Finally, the first fused vector and the second fused vector can be fused through 1D convolution to obtain the target classification vector.
[0051] It should be noted that the difference between the two stages lies in the input image size. For example, when the image to be classified is 384*384 pixels, the information fusion module can input an image of 48*48 pixels. In this case, the first stage input image size is 48*48 pixels. After the first downsampling, the image size will be halved, becoming 24*24 pixels. Then, the second stage input image size is 24*24 pixels. After the second downsampling, the image size will also be halved, becoming 12*12 pixels.
[0052] Figure 4 This is a flowchart illustrating a training image classification model according to an exemplary embodiment. For example... Figure 4 As shown, the image classification model is trained through the following steps:
[0053] Step 201: Obtain the training sample set. The training sample set includes training classification images, training multimodal information of the training classification images, and the corresponding training image classification results.
[0054] For example, firstly, based on the image category to be classified in fine-grained terms, a large number of images of that category, along with their multimodal information, can be obtained. For instance, if the image category is birds, images containing birds, such as sparrows, parrots, and pigeons, can be collected from the internet or databases. Each acquired image can then be used as a training classification image, and its multimodal information can be used as the corresponding training multimodal information. Each training classification image is then manually labeled to obtain the classification result for each training classification image. Finally, a training sample set can be constructed using all the training classification images, the training multimodal information for each training classification image, and the classification results for each training classification image.
[0055] Step 202: Train the preset model based on the training sample set to obtain the image classification model.
[0056] Furthermore, during the training phase, the training multimodal information is first occluded according to the occlusion ratio to obtain a processed training sample set. Then, a preset model is trained based on this processed training sample set to obtain a candidate model. The occlusion ratio is then reduced by a preset step size (e.g., 5%) to obtain an updated occlusion ratio. This process is repeated until the occlusion ratio is less than a preset threshold, and the candidate model is then used as the image classification model. In this way, at the beginning of training, some or all of the training multimodal information is occluded (e.g., if the occlusion ratio is 100%, all training multimodal information is occluded at the beginning of training, meaning only training classification images are used for model training). Subsequently, the occlusion ratio is gradually reduced (i.e., the proportion of training multimodal information is increased) to train the model, thus obtaining the final image classification model. The reason for this training method is that image information is more difficult to learn than multimodal information, and image information is still the main information used for fine-grained image classification. By adopting this training method, even if multimodal information is missing, the image classification model can still perform fine-grained image classification based solely on image information.
[0057] Once the image classification model has been trained, it can be used according to actual needs. For example, you can input only the image to be classified, replace the multimodal information with a vector of all zeros, and predict the image classification result based solely on the image to be classified. Alternatively, you can input both the image to be classified and the multimodal information, and use the multimodal information to predict the image classification result.
[0058] In summary, this disclosure acquires the image to be classified and its multimodal information, and determines the image classification result based on the image to be classified and the multimodal information using a pre-trained image classification model. The multimodal information includes textual information, spatiotemporal information, and attribute information. The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and then fuses the image encoding vector and the multimodal encoding vector to obtain the target classification vector. Based on the target classification vector, the image classification result is determined. This disclosure, by combining multimodal information with the image classification model to perform image classification, can accurately complete fine-grained image classification tasks and ensure the accuracy of the image classification results.
[0059] Figure 5 This is a block diagram illustrating an image classification apparatus according to an exemplary embodiment. Figure 5 As shown, the device 300 includes:
[0060] The acquisition module 301 is used to acquire the image to be classified and its multimodal information. The multimodal information includes text information, spatiotemporal information, and attribute information.
[0061] The processing module 302 is used to determine the image classification result of the image to be classified based on the image to be classified and multimodal information, using a pre-trained image classification model.
[0062] The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information. The image encoding vector and the multimodal encoding vector are fused to obtain the target classification vector, and the image classification result is determined based on the target classification vector.
[0063] Optionally, the image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier. Processing module 302 is used for:
[0064] The image to be classified is encoded by the image encoding module to obtain the image encoding vector.
[0065] The multimodal information encoding module obtains the multimodal feature vectors corresponding to the multimodal information, and encodes the multimodal feature vectors to obtain the multimodal encoded vectors.
[0066] The image coding vector and the multimodal coding vector are fused by the information fusion module to obtain the target classification vector.
[0067] The image classification result is determined by the classifier based on the target classification vector.
[0068] Optionally, the processing module 302 is used for:
[0069] The information fusion module fuses the image coding vector, multimodal coding vector, and preset coding vector to obtain a fused vector, and the target classification vector is determined based on the fused vector.
[0070] Optionally, the processing module 302 is used for:
[0071] The image coding vector is downsampled by the information fusion module to obtain the first image coding vector. The first image coding vector, the multimodal coding vector and the first preset coding vector are then fused to obtain the first fused vector.
[0072] The first image coding vector is downsampled by the information fusion module to obtain the second image coding vector. The second image coding vector, the multimodal coding vector, and the second preset coding vector are then fused to obtain the second fused vector.
[0073] The target classification vector is determined based on the first fusion vector and the second fusion vector.
[0074] Optionally, the processing module 302 is used to train the image classification model in the following manner:
[0075] Obtain the training sample set. The training sample set includes training classification images, training multimodal information of the training classification images, and the corresponding training image classification results.
[0076] The image classification model is obtained by training the preset model using the training sample set.
[0077] Figure 6 It is based on Figure 5 The illustrated embodiment shows a block diagram of a processing module. For example... Figure 6 As shown, the processing module 302 includes:
[0078] The occlusion submodule 3021 is used to perform occlusion processing on the training multimodal information according to the occlusion ratio to obtain the processed training sample set.
[0079] The training submodule 3022 is used to train the preset model based on the processed training sample set to obtain the model to be determined.
[0080] The occlusion submodule 3023 is also used to reduce the occlusion ratio according to a preset proportional step size to obtain an updated occlusion ratio.
[0081] Repeat the process of occlusion processing of the training multimodal information according to the occlusion ratio to obtain the processed training sample set, and then reduce the occlusion ratio according to the preset ratio step size to obtain the updated occlusion ratio, until the occlusion ratio is less than the preset ratio threshold, and then use the undetermined model as the image classification model.
[0082] In summary, this disclosure acquires the image to be classified and its multimodal information, and determines the image classification result based on the image to be classified and the multimodal information using a pre-trained image classification model. The multimodal information includes textual information, spatiotemporal information, and attribute information. The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and then fuses the image encoding vector and the multimodal encoding vector to obtain the target classification vector. Based on the target classification vector, the image classification result is determined. This disclosure, by combining multimodal information with the image classification model to perform image classification, can accurately complete fine-grained image classification tasks and ensure the accuracy of the image classification results.
[0083] The following is for reference. Figure 7 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 1The diagram below shows the structure of the terminal device or server 600. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0084] like Figure 7 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0085] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0086] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via 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, it performs the functions defined in the methods of embodiments of this disclosure.
[0087] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0088] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0089] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0090] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire an image to be classified and multimodal information of the image to be classified; the multimodal information includes text information, spatiotemporal information, and attribute information; determine an image classification result of the image to be classified based on the image to be classified and the multimodal information using a pre-trained image classification model; wherein the image classification model is used to acquire an image encoding vector corresponding to the image to be classified and a multimodal encoding vector corresponding to the multimodal information, fuse the image encoding vector and the multimodal encoding vector to obtain a target classification vector, and determine the image classification result based on the target classification vector.
[0091] Computer program code for performing the operations of this disclosure can 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, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone 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 remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0093] The modules described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the modules are not necessarily limiting in certain circumstances; for example, an acquisition module can also be described as "a module for acquiring images to be classified and multimodal information".
[0094] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0095] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0096] According to one or more embodiments of this disclosure, Example 1 provides an image classification method, the method comprising: acquiring an image to be classified and multimodal information of the image to be classified; the multimodal information including text information, spatiotemporal information, and attribute information; determining an image classification result of the image to be classified by using a pre-trained image classification model based on the image to be classified and the multimodal information; wherein the image classification model is used to acquire an image encoding vector corresponding to the image to be classified and a multimodal encoding vector corresponding to the multimodal information, and to fuse the image encoding vector and the multimodal encoding vector to obtain a target classification vector, and to determine the image classification result based on the target classification vector.
[0097] According to one or more embodiments of this disclosure, Example 2 provides the method of Example 1, wherein the image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier; the step of determining the image classification result of the image to be classified based on the image to be classified and the multimodal information, through a pre-trained image classification model, includes: encoding the image to be classified by the image encoding module to obtain the image encoding vector; obtaining the multimodal feature vector corresponding to the multimodal information by the multimodal information encoding module, and encoding the multimodal feature vector to obtain the multimodal encoding vector; fusing the image encoding vector and the multimodal encoding vector by the information fusion module to obtain the target classification vector; and determining the image classification result by the classifier based on the target classification vector.
[0098] According to one or more embodiments of this disclosure, Example 3 provides the method of Example 2, wherein fusing the image coding vector and the multimodal coding vector through the information fusion module to obtain the target classification vector includes: fusing the image coding vector, the multimodal coding vector and the preset coding vector through the information fusion module to obtain a fused vector, and determining the target classification vector based on the fused vector.
[0099] According to one or more embodiments of this disclosure, Example 4 provides the method of Example 3, wherein the preset encoding vector includes a first preset encoding vector and a second preset encoding vector, and the fusion vector includes a first fusion vector and a second fusion vector; the step of fusing the image encoding vector, the multimodal encoding vector, and the preset encoding vector through the information fusion module to obtain a fusion vector, and determining the target classification vector based on the fusion vector, includes: downsampling the image encoding vector through the information fusion module to obtain a first image encoding vector, and fusing the first image encoding vector, the multimodal encoding vector, and the first preset encoding vector to obtain the first fusion vector; downsampling the first image encoding vector through the information fusion module to obtain a second image encoding vector, and fusing the second image encoding vector, the multimodal encoding vector, and the second preset encoding vector to obtain the second fusion vector; and determining the target classification vector based on the first fusion vector and the second fusion vector.
[0100] According to one or more embodiments of this disclosure, Example 5 provides a method according to any one of Examples 1-4, wherein the image classification model is trained by: obtaining a training sample set; the training sample set includes training classification images, training multimodal information of the training classification images, and training image classification results corresponding to the training classification images; and training a preset model according to the training sample set to obtain the image classification model.
[0101] According to one or more embodiments of this disclosure, Example 6 provides the method of Example 5, wherein training a preset model based on the training sample set to obtain the image classification model includes: occluding the training multimodal information according to an occlusion ratio to obtain a processed training sample set; training the preset model based on the processed training sample set to obtain a pending model; reducing the occlusion ratio by a preset ratio step size to obtain an updated occlusion ratio; repeating the steps of occluding the training multimodal information according to the occlusion ratio to obtain a processed training sample set until reducing the occlusion ratio by a preset ratio step size to obtain an updated occlusion ratio, until the occlusion ratio is less than a preset ratio threshold, and using the pending model as the image classification model.
[0102] According to one or more embodiments of this disclosure, Example 7 provides an image classification apparatus, the apparatus comprising: an acquisition module, configured to acquire an image to be classified and multimodal information of the image to be classified; the multimodal information including text information, spatiotemporal information, and attribute information; and a processing module, configured to determine an image classification result of the image to be classified based on the image to be classified and the multimodal information using a pre-trained image classification model; wherein the image classification model is configured to acquire an image encoding vector corresponding to the image to be classified and a multimodal encoding vector corresponding to the multimodal information, fuse the image encoding vector and the multimodal encoding vector to obtain a target classification vector, and determine the image classification result based on the target classification vector.
[0103] According to one or more embodiments of this disclosure, Example 8 provides the apparatus of Example 7, wherein the image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier; the processing module is configured to: encode the image to be classified by the image encoding module to obtain the image encoding vector; obtain the multimodal feature vector corresponding to the multimodal information by the multimodal information encoding module, and encode the multimodal feature vector to obtain the multimodal encoding vector; fuse the image encoding vector and the multimodal encoding vector by the information fusion module to obtain the target classification vector; and determine the image classification result by the classifier based on the target classification vector.
[0104] According to one or more embodiments of the present disclosure, Example 9 provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the methods described in Examples 1 to 6.
[0105] According to one or more embodiments of this disclosure, Example 10 provides an electronic device including: a storage device having a computer program stored thereon; and a processing device for executing the computer program in the storage device to implement the steps of the methods described in Examples 1 to 6.
[0106] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0107] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0108] Although the subject matter has been described using language specific to structural features and / or methodological logic, 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. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. An image classification method, characterized in that, The method includes: Acquire the image to be classified and its multimodal information; the multimodal information includes text information, spatiotemporal information, and attribute information; Based on the image to be classified and the multimodal information, the image classification result of the image to be classified is determined by a pre-trained image classification model; The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and to fuse the image encoding vector and the multimodal encoding vector to obtain the target classification vector, and to determine the image classification result based on the target classification vector. The image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier; the step of determining the image classification result of the image to be classified based on the image to be classified and the multimodal information using a pre-trained image classification model includes: The image to be classified is encoded by the image encoding module to obtain the image encoding vector; The multimodal information encoding module obtains the multimodal feature vector corresponding to the multimodal information, and encodes the multimodal feature vector to obtain the multimodal encoding vector; The image encoding vector and the multimodal encoding vector are fused by the information fusion module to obtain the target classification vector; The classifier determines the image classification result based on the target classification vector. The step of fusing the image coding vector and the multimodal coding vector through the information fusion module to obtain the target classification vector includes: The information fusion module fuses the image encoding vector, the multimodal encoding vector, and the preset encoding vector to obtain a fused vector, and determines the target classification vector based on the fused vector. The preset encoding vector includes a first preset encoding vector and a second preset encoding vector, and the fusion vector includes a first fusion vector and a second fusion vector; the step of fusing the image encoding vector, the multimodal encoding vector, and the preset encoding vector through the information fusion module to obtain a fusion vector, and determining the target classification vector based on the fusion vector, includes: The image encoding vector is downsampled by the information fusion module to obtain a first image encoding vector, and the first image encoding vector, the multimodal encoding vector, and the first preset encoding vector are fused to obtain a first fused vector. The information fusion module downsamples the first image encoding vector to obtain a second image encoding vector, and then fuses the second image encoding vector, the multimodal encoding vector, and the second preset encoding vector to obtain a second fused vector. The target classification vector is determined based on the first fusion vector and the second fusion vector.
2. The method according to claim 1, characterized in that, The image classification model was trained in the following way: Obtain a training sample set; the training sample set includes training classification images, training multimodal information of the training classification images, and training image classification results corresponding to the training classification images; The image classification model is obtained by training the preset model using the training sample set.
3. The method according to claim 2, characterized in that, The step of training a preset model based on the training sample set to obtain the image classification model includes: The training multimodal information is occluded according to the occlusion ratio to obtain the processed training sample set; The preset model is trained based on the processed training sample set to obtain the undetermined model; The occlusion ratio is reduced according to a preset step size to obtain an updated occlusion ratio. Repeat the steps of occlusion processing of the training multimodal information according to the occlusion ratio to obtain the processed training sample set, and then reduce the occlusion ratio according to the preset ratio step size to obtain the updated occlusion ratio, until the occlusion ratio is less than the preset ratio threshold, and then use the undetermined model as the image classification model.
4. An image classification device, characterized in that, The device includes: The acquisition module is used to acquire the image to be classified and its multimodal information; the multimodal information includes text information, spatiotemporal information, and attribute information. The processing module is used to determine the image classification result of the image to be classified based on the image to be classified and the multimodal information, using a pre-trained image classification model; The image classification model is used to obtain the image encoding vector corresponding to the image to be classified and the multimodal encoding vector corresponding to the multimodal information, and to fuse the image encoding vector and the multimodal encoding vector to obtain the target classification vector, and to determine the image classification result based on the target classification vector. The image classification model includes an image encoding module, a multimodal information encoding module, an information fusion module, and a classifier; the processing module is used for: The image to be classified is encoded by the image encoding module to obtain the image encoding vector; The multimodal information encoding module obtains the multimodal feature vector corresponding to the multimodal information, and encodes the multimodal feature vector to obtain the multimodal encoding vector; The image encoding vector and the multimodal encoding vector are fused by the information fusion module to obtain the target classification vector; The classifier determines the image classification result based on the target classification vector. The processing module is used for: The information fusion module fuses the image encoding vector, the multimodal encoding vector, and the preset encoding vector to obtain a fused vector, and determines the target classification vector based on the fused vector. The preset encoding vector includes a first preset encoding vector and a second preset encoding vector; the fusion vector includes a first fusion vector and a second fusion vector; the processing module is used for: The image encoding vector is downsampled by the information fusion module to obtain a first image encoding vector, and the first image encoding vector, the multimodal encoding vector, and the first preset encoding vector are fused to obtain a first fused vector. The information fusion module downsamples the first image encoding vector to obtain a second image encoding vector, and then fuses the second image encoding vector, the multimodal encoding vector, and the second preset encoding vector to obtain a second fused vector. The target classification vector is determined based on the first fusion vector and the second fusion vector.
5. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processing device, it implements the steps of the method described in any one of claims 1-3.
6. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-3.
Citation Information
Patent Citations
Class identification method and device for target image
CN112926700A