Image multitasking processing method, system, storage medium and electronic device
By combining the large language model and the VQGAN model with the self-attention mechanism and the FFN network, the problem in the existing technology that multiple image tasks require multiple neural network models is solved, achieving fast and efficient image multi-task processing, reducing hardware consumption and processing time and improved intelligence.
Patent Information
- Application Number
- CN202410742180.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-06-11
AI Technical Summary
In the existing technology, image processing tasks require the deployment of multiple independent neural network models, resulting in increased hardware resource consumption and processing time, making it difficult to achieve practical promotion.
The large language model and VQGAN model are used to process images through projection blocks and encoders, combined with the self-attention mechanism and FFN network, to achieve simultaneous processing of multiple image tasks, reducing hardware consumption and processing time.
It achieves fast and efficient processing of multiple image tasks, reduces hardware consumption and processing time, improves intelligence, and is practical.
Smart Images

Figure CN118314445B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of deep learning, and in particular relates to an image multi-task processing method, system, storage medium and electronic device. Background Art
[0002] Image processing refers to the technology of using computers to analyze images to achieve the desired results. Image processing tasks generally include: semantic segmentation, object detection, low-light enhancement, denoising, restoration and colorization.
[0003] In the prior art, a method or neural network model is designed independently for each image processing task. However, different image processing tasks often use different network structure designs. Deploying multiple models requires more hardware resources and more time, which is not conducive to practical promotion and use. Summary of the invention
[0004] In view of the shortcomings of the prior art described above, the object of the present invention is to provide an image multi-tasking processing method, system, storage medium and electronic device, which can realize simultaneous processing of multiple image tasks based on a large language model, effectively reducing hardware consumption and processing time.
[0005] In a first aspect, the present invention provides an image multi-task processing method, which includes the following steps: inputting the image to be processed into the projection block and the encoder of the VQGAN model respectively, and then adding the elements to obtain model input information; obtaining a large language model, wherein the large language model is used to simultaneously process multiple image tasks, wherein the image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration and image coloring; inputting the model input information into the large language model to obtain a multi-task processing prediction result of the image to be processed; and decoding the multi-task processing prediction result based on the decoder of the VQGAN model to obtain a multi-task processing result image of the image to be processed.
[0006] In an implementation of the first aspect, obtaining the large language model includes the following steps:
[0007] Construct training image sets for multiple image tasks;
[0008] Input the images in the training image set into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain model input information;
[0009] Inputting the input information into a large language model to obtain a multi-task processing prediction result of the image;
[0010] A cross entropy loss of the large language model is calculated based on the multi-task processing prediction result, and the large language model is adjusted based on the cross entropy loss until the large language model converges.
[0011] In an implementation of the first aspect, constructing a training image set for multiple image tasks includes the following steps:
[0012] Perform semantic segmentation on the original image to obtain the semantic segmentation map and semantic segmentation annotation;
[0013] Use a rectangular frame to visualize the original image and obtain the target recognition map and target recognition annotation;
[0014] Randomly subtract a value from the original image to obtain a low-brightness image;
[0015] Add the original image and random Gaussian noise element by element to obtain a noisy image;
[0016] The original image is masked with a black random image to obtain a damaged image;
[0017] Grayscale the original image to obtain a grayscale image;
[0018] A training image set is constructed based on the original image, the semantic segmentation map and semantic segmentation annotations, the target recognition map and target recognition annotations, the low-brightness image, the noisy image, the damaged image, and the grayscale image.
[0019] In an implementation of the first aspect, the processing flow of the projection block includes:
[0020] Input the image into the self-attention mechanism to obtain the feature map;
[0021] Pass the Q matrix of the self-attention mechanism through five multi-layer perceptrons respectively, and obtain six sets of coordinate offsets of the coordinates of the feature map elements for each multi-layer perceptron;
[0022] 30 offset elements corresponding to each element in the feature map based on the coordinate offset;
[0023] All offset elements of the feature map are matrix-multiplied with the attention weights and then input into the FFN network to obtain the output of the projection block; wherein the attention weights are obtained by passing the Q matrix through the FFN network and the softmax function.
[0024] In a second aspect, the present invention provides an image multi-task processing system, the system comprising an input information acquisition module, a model acquisition module, an input module and a processing module;
[0025] The input information acquisition module is used to input the image to be processed into the projection block and the encoder of the VQGAN model respectively, and then perform element addition to obtain model input information;
[0026] The model acquisition module is used to acquire a large language model, and the large language model is used to process multiple image tasks simultaneously, and the image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration and image colorization;
[0027] The input module is used to input the model input information into the large language model to obtain the multi-task processing prediction result of the image to be processed;
[0028] The processing module is used to decode the multi-task processing prediction result based on the decoder of the VQGAN model to obtain the multi-task processing result image of the image to be processed.
[0029] In an implementation of the second aspect, the model acquisition module acquires the large language model including the following steps:
[0030] Construct training image sets for multiple image tasks;
[0031] Input the images in the training image set into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain model input information;
[0032] Inputting the input information into a large language model to obtain a multi-task processing prediction result of the image;
[0033] A cross entropy loss of the large language model is calculated based on the multi-task processing prediction result, and the large language model is adjusted based on the cross entropy loss until the large language model converges.
[0034] In an implementation of the second aspect, constructing a training image set for multiple image tasks includes the following steps:
[0035] Perform semantic segmentation on the original image to obtain the semantic segmentation map and semantic segmentation annotation;
[0036] Use a rectangular frame to visualize the original image and obtain the target recognition map and target recognition annotation;
[0037] Randomly subtract a value from the original image to obtain a low-brightness image;
[0038] Add the original image and random Gaussian noise element by element to obtain a noisy image;
[0039] The original image is masked with a black random image to obtain a damaged image;
[0040] Grayscale the original image to obtain a grayscale image;
[0041] A training image set is constructed based on the original image, the semantic segmentation map and semantic segmentation annotations, the target recognition map and target recognition annotations, the low-brightness image, the noisy image, the damaged image, and the grayscale image.
[0042] In an implementation manner of the second aspect, the processing flow of the projection block includes:
[0043] Input the image into the self-attention mechanism to obtain the feature map;
[0044] Pass the Q matrix of the self-attention mechanism through five multi-layer perceptrons respectively, and obtain six sets of coordinate offsets of the coordinates of the feature map elements for each multi-layer perceptron;
[0045] 30 offset elements corresponding to each element in the feature map based on the coordinate offset;
[0046] All offset elements of the feature map are matrix-multiplied with the attention weights and then input into the FFN network to obtain the output of the projection block; wherein the attention weights are obtained by passing the Q matrix through the FFN network and the softmax function.
[0047] In a third aspect, the present invention provides an electronic device, the electronic device comprising: a processor and a memory;
[0048] The memory is used to store computer programs;
[0049] The processor is used to execute the computer program stored in the memory, so that the electronic device executes the above-mentioned image multi-task processing method.
[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned image multi-tasking processing method when executed by an electronic device.
[0051] As described above, the image multi-tasking processing method, system, storage medium and electronic device of the present invention have the following beneficial effects.
[0052] (1) It can process multiple image tasks simultaneously based on a large language model, quickly and efficiently.
[0053] (2) There is no need to set up different network structures for different image processing tasks, which effectively reduces hardware consumption and processing time.
[0054] (3) Highly intelligent and extremely practical. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 Shown is a schematic diagram of a scene of an electronic device in an embodiment of the present invention.
[0056] Figure 2 Shown is a flow chart of an image multi-task processing method in one embodiment of the present invention.
[0057] Figure 3 Shown is a schematic diagram of a training image set in an embodiment of the present invention.
[0058] Figure 4 FIG. 1 is a schematic diagram showing the structure of an image multi-task processing system in an embodiment of the present invention.
[0059] Figure 5 It is a schematic structural diagram of an electronic device of the present invention in one embodiment. DETAILED DESCRIPTION
[0060] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0061] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0062] The following embodiments of the present invention provide an image multitasking processing method, which can be applied to Figure 1 The electronic device shown. The electronic device described in the present invention may include a mobile phone 11 with a wireless charging function, a tablet computer 12, a laptop computer 13, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present invention does not impose any restrictions on the specific type of the electronic device.
[0063] For example, the electronic device may be a station (STAION, ST) in a WLAN with a wireless charging function, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with a wireless charging function, a computing device or other processing device, a computer, a laptop computer, a handheld communication device, a handheld computing device, and / or other devices for communicating on a wireless system and a next generation communication system, such as a mobile terminal in a 5G network, a mobile terminal in a future evolved Public Land Mobile Network (PLMN), or a mobile terminal in a future evolved Non-terrestrial Network (NTN).
[0064] For example, the electronic device can communicate with the network and other devices through wireless communication. The above wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobilecommunication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), Beidou Satellite Navigation System (BDS), Quasi-Zenith Satellite System (QZSS) and / or Satellite Based Augmentation Systems (SBAS).
[0065] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0066] like Figure 2 As shown, in one embodiment, the image multi-task processing method of the present invention includes steps S1 to S4.
[0067] Step S1: Input the image to be processed into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain the model input information.
[0068] Specifically, the image to be processed is first input into the projection block and the encoder of the VQGAN model respectively to obtain the first processing result and the second processing result. Then, the first processing result and the second processing result are element-wise added to obtain the model input information.
[0069] The processing flow of the projection block includes the following steps.
[0070] 11) Input the image into the self-attention mechanism to obtain the feature map.
[0071] 12) The Q matrix of the self-attention mechanism is passed through 5 multilayer perceptrons (MLPs) respectively, and 6 sets of coordinate offsets of the coordinates of the feature map elements are obtained for each multilayer perceptron. Among them, each MLP represents 5 heads. Then each head has 6 sets of 2 offsets (x_offset, y_offset) relative to the coordinates of each element of the feature map.
[0072] 13) Based on the coordinate offset, each element in the feature map corresponds to 5*6=30 offset elements.
[0073] 14) Performing matrix multiplication on all offset elements of the feature map and the attention weights and inputting the matrix multiplication into the FFN network to obtain the output of the projection block; wherein the attention weights are obtained by passing the Q matrix through the FFN network and the softmax function.
[0074] The VQGAN (Taming Transformers for High-Resolution Image Synthesis) model achieves high-definition image synthesis by taming the Transformer model. During training, an image compression model (including two sub-models, the encoder and the decoder) is first trained, and then a model for generating compressed images is trained. During generation, a compressed image is first generated using the second model, and then the first model is used to restore the real image.
[0075] Step S2: obtaining a large language model, wherein the large language model is used to simultaneously process multiple image tasks, wherein the image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration, and image colorization.
[0076] Specifically, Large Language Models (LLMs) are AI models designed to understand and generate human language. They are trained on large amounts of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and more. LLMs are characterized by their large size and contain billions of parameters, which help them learn complex patterns in language data. These models are often based on deep learning architectures such as Transformers, which helps them achieve impressive performance on various NLP tasks.
[0077] In the present invention, the large language model can process multiple image tasks simultaneously, and the image tasks include image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration and image colorization. In this step, a trained large language model or a large language model that has been trained to converge is obtained.
[0078] When training the large language model, the following steps are included.
[0079] 21) Construct training image sets for multiple image tasks.
[0080] like Figure 3 As shown in the figure, the training image set targets six image tasks, including semantic segmentation, object detection, low light enhancement, denoising, inpainting, and colorization. The original image is named image_{N}, where N indicates that there are N original images.
[0081] For image semantic segmentation, semantic segmentation is performed on the original image to obtain the semantic segmentation map and semantic segmentation annotation. The segmentation map is named image_{N} with semantic segmentation annotation.
[0082] For image object detection, the original image is visualized using a rectangular box to obtain the target recognition map and target recognition annotation. The coordinate box information is visualized using a rectangular box on the original image (the color of the rectangular box is defined according to the category, and the same color is used for the same target in the same image); the visualized map is named image_{N} with object detection annotation.
[0083] For image low light enhancement, a value is randomly subtracted from the original image to obtain a low brightness image. A value is randomly sampled from a range of 100 to 250, and the value is subtracted from the original image. The result is named low light image_{N}, i.e., a low brightness image.
[0084] For image denoising, the original image is element-wise added with random Gaussian noise to obtain a noise image, wherein noise values are randomly sampled in the Gaussian noise, and the noise values are element-wise added with the original image to obtain a noise image, which is named noise image_{N}.
[0085] For image restoration, the original image is masked with a black random image to obtain a damaged image, wherein the original image is masked with a random black box or black irregular shape and named as the damaged image damage image_{N}.
[0086] For image colorization, the original image is grayscaled to obtain a grayscale image named gray image_{N}.
[0087] A training image set is constructed based on the original image, the semantic segmentation map and semantic segmentation annotations, the target recognition map and target recognition annotations, the low-brightness map, the noise image, the damaged image, and the grayscale image. For each image task, N sets of image pairs are used. Taking image restoration inpainting as an example, several pairs of damaged images (damage image and original image) are arranged in sequence as a sample. After adding the BOS special character at the beginning of the sample, it is used as input (BOS+N sets of images); after adding the EOS special character after the sample, it is used as a label (N sets of images+EOS).
[0088] 22) The images in the training image set are respectively input into the projection block and the encoder of the VQGAN model, and then element-wise addition is performed to obtain model input information.
[0089] 23) Inputting the input information into a large language model to obtain a multi-task processing prediction result (prediction) of the image.
[0090] 24) Calculating the cross-entropy loss of the large language model based on the multi-task processing prediction result, and adjusting the large language model based on the cross-entropy loss until the large language model converges. The prediction result and the label are subjected to cross-entropy loss calculation, and then gradient direction propagation is performed to obtain a trained large language model.
[0091] Preferably, when training the large language model, it also includes verification (inference) for the trained large language model. Taking image object detection as an example, the input is at least 3 images (the first is the original image image_1, the second is the target recognition image image_1 with object detection annotation, and the third is the image to be recognized image_2). The first two images are equivalent to prompts to the large language model. The large language model will give the detection visualization result of the image to be recognized image_2 according to the prompt; the input passes through the encoder and projection block of the VQGAN model at the same time, and the results are element-wise added and input into the large language model. The large language model gives a multi-task processing prediction result, and finally passes through the decoder of the VQGAN model to restore it to a multi-task processing result image. The multi-task processing result image is the same as the second picture image_2 in the input, and the content is the target detection visualization result of the image to be processed image_2.
[0092] Step S3: input the model input information into the large language model to obtain the multi-task processing prediction result of the image to be processed.
[0093] Step S4: The decoder based on the VQGAN model decodes the multi-task processing prediction result to obtain the multi-task processing result image of the image to be processed.
[0094] The protection scope of the image multitasking method described in the embodiment of the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.
[0095] An embodiment of the present invention further provides an image multi-tasking processing system, which can implement the image multi-tasking processing method described in the present invention. However, the implementation device of the image multi-tasking processing system described in the present invention includes but is not limited to the structure of the image multi-tasking processing system listed in this embodiment. All structural deformations and replacements of the prior art made according to the principles of the present invention are included in the protection scope of the present invention.
[0096] like Figure 4 As shown, in one embodiment, the image multi-task processing system of the present invention includes an input information acquisition module 41 , a model acquisition module 42 , an input module 43 and a processing module 44 .
[0097] The input information acquisition module 41 is used to input the image to be processed into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain the model input information.
[0098] The model acquisition module 42 is connected to the input information acquisition module 41, and is used to obtain a large language model. The large language model is used to process multiple image tasks simultaneously. The image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration and image colorization.
[0099] The input module 43 is connected to the model acquisition module 42 and is used to input the model input information into the large language model to obtain the multi-task processing prediction result of the image to be processed.
[0100] The processing module 44 is connected to the input module 43, and is used to decode the multi-task processing prediction result based on the decoder of the VQGAN model to obtain the multi-task processing result image of the image to be processed.
[0101] The structures and principles of the input information acquisition module 41, the model acquisition module 42, the input module 43 and the processing module 44 correspond one to one with the steps in the above-mentioned image multi-task processing method, so they will not be described in detail here.
[0102] In the several embodiments provided by the present invention, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules / units is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.
[0103] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention. For example, the functional modules / units in the various embodiments of the present invention may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0104] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. 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 each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0105] The embodiment of the present invention also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by instructing the processor through a program, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid-state disk (SSD)), etc.
[0106] An embodiment of the present invention further provides an electronic device, which includes a processor and a memory.
[0107] The memory is used to store computer programs.
[0108] The memory includes: ROM, RAM, disk, USB flash drive, memory card or CD and other media that can store program codes.
[0109] The processor is connected to the memory and is used to execute the computer program stored in the memory so that the electronic device executes the above-mentioned image multi-task processing method.
[0110] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0111] like Figure 5 As shown, the electronic device of the present invention is in the form of a general computing device. The components of the electronic device may include but are not limited to: one or more processors or processing units 51, a memory 52, and a bus 53 connecting different system components (including the memory 52 and the processing unit 51).
[0112] Bus 53 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0113] Electronic devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.
[0114] The memory 52 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 521 and / or cache memory 522. The electronic device may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 523 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 53 via one or more data medium interfaces. The memory 52 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0115] A program / utility 524 having a set (at least one) of program modules 5241 may be stored, for example, in the memory 52, such program modules 5241 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. The program modules 5241 generally perform the functions and / or methods of the embodiments described herein.
[0116] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, displays, etc.), one or more devices that enable a user to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via input / output (I / O) interface 54. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapter 55. Figure 5 As shown, the network adapter 55 communicates with other modules of the electronic device via the bus 53. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0117] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. An image multitasking processing method, characterized in that: The method comprises the following steps: The image to be processed is input into the projection block and the encoder of the VQGAN model respectively, and then the elements are added to obtain the model input information; Acquire a large language model, where the large language model is used to simultaneously process multiple image tasks, where the image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration, and image colorization; Inputting the model input information into the large language model to obtain a multi-task processing prediction result of the image to be processed; The decoder based on the VQGAN model decodes the multi-task processing prediction result to obtain the multi-task processing result image of the image to be processed; The processing flow of the projection block includes: Input the image into the self-attention mechanism to obtain the feature map; The Q matrix of the self-attention mechanism is passed through five multi-layer perceptrons respectively, and six sets of coordinate offsets of the feature map element coordinates are obtained for each multi-layer perceptron; 30 offset elements corresponding to each element in the feature map based on the coordinate offset; All offset elements of the feature map are matrix-multiplied with the attention weights and then input into the FFN network to obtain the output of the projection block; wherein the attention weights are obtained by passing the Q matrix through the FFN network and the softmax function.
2. The image multitasking processing method according to claim 1, characterized in that: Obtaining a large language model involves the following steps: Construct training image sets for multiple image tasks; Input the images in the training image set into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain model input information; Inputting the input information into a large language model to obtain a multi-task processing prediction result of the image; A cross entropy loss of the large language model is calculated based on the multi-task processing prediction result, and the large language model is adjusted based on the cross entropy loss until the large language model converges.
3. The image multitasking processing method according to claim 2, characterized in that: Building a training image set for multiple image tasks involves the following steps: Perform semantic segmentation on the original image to obtain the semantic segmentation map and semantic segmentation annotation; Use a rectangular frame to visualize the original image and obtain the target recognition map and target recognition annotation; Randomly subtract a value from the original image to obtain a low-brightness image; Add the original image and random Gaussian noise element by element to obtain a noisy image; The original image is masked with a black random image to obtain a damaged image; Grayscale the original image to obtain a grayscale image; A training image set is constructed based on the original image, the semantic segmentation map and semantic segmentation annotations, the target recognition map and target recognition annotations, the low-brightness image, the noisy image, the damaged image, and the grayscale image.
4. An image multitasking processing system, characterized in that: The system includes an input information acquisition module, a model acquisition module, an input module and a processing module; The input information acquisition module is used to input the image to be processed into the projection block and the encoder of the VQGAN model respectively, and then perform element addition to obtain model input information; The model acquisition module is used to acquire a large language model, and the large language model is used to process multiple image tasks simultaneously, and the image tasks include one or more combinations of image semantic segmentation, image object detection, image low-light enhancement, image denoising, image restoration and image colorization; The input module is used to input the model input information into the large language model to obtain the multi-task processing prediction result of the image to be processed; The processing module is used to decode the multi-task processing prediction result based on the decoder of the VQGAN model to obtain the multi-task processing result image of the image to be processed; The processing flow of the projection block includes: Input the image into the self-attention mechanism to obtain the feature map; The Q matrix of the self-attention mechanism is passed through five multi-layer perceptrons respectively, and six sets of coordinate offsets of the feature map element coordinates are obtained for each multi-layer perceptron; 30 offset elements corresponding to each element in the feature map based on the coordinate offset; All offset elements of the feature map are matrix-multiplied with the attention weights and then input into the FFN network to obtain the output of the projection block; wherein the attention weights are obtained by passing the Q matrix through the FFN network and the softmax function.
5. The image multi-task processing system according to claim 4, characterized in that: The model acquisition module acquires the large language model including the following steps: Construct training image sets for multiple image tasks; Input the images in the training image set into the projection block and the encoder of the VQGAN model respectively, and then add the elements to obtain model input information; Inputting the input information into a large language model to obtain a multi-task processing prediction result of the image; A cross entropy loss of the large language model is calculated based on the multi-task processing prediction result, and the large language model is adjusted based on the cross entropy loss until the large language model converges.
6. The image multitasking processing system according to claim 5, characterized in that: Building a training image set for multiple image tasks involves the following steps: Perform semantic segmentation on the original image to obtain the semantic segmentation map and semantic segmentation annotation; Use a rectangular frame to visualize the original image and obtain the target recognition map and target recognition annotation; Randomly subtract a value from the original image to obtain a low-brightness image; Add the original image and random Gaussian noise element by element to obtain a noisy image; The original image is masked with a black random image to obtain a damaged image; Grayscale the original image to obtain a grayscale image; A training image set is constructed based on the original image, the semantic segmentation map and semantic segmentation annotations, the target recognition map and target recognition annotations, the low-brightness image, the noisy image, the damaged image, and the grayscale image.
7. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory, so that the electronic device executes the image multitasking processing method according to any one of claims 1 to 3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by an electronic device, the image multitasking processing method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Method for training multi-task processing model, speech synthesis method and related products
CN116259303A
Image generation method and device, equipment, medium and product
CN117058261A
Methods for training generative large language models and for processing image tasks
CN117114063A
Image processing unit
JP2002057880A
Method and apparatus for providing an english writing service applying native language acquisition principles to user terminals using neural networks
KR102658238B1
