Model training method, data processing method, system, electronic device, storage medium and computer program product
By segmenting training images into image patches and introducing prefix and latent terms, a target image reconstruction model is trained, which solves the problems of low accuracy and efficiency in image reconstruction and achieves more efficient image reconstruction results.
Patent Information
- Application Number
- CN202510696867.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2026-11-27
AI Technical Summary
Existing image reconstruction models have low accuracy and efficiency, especially when processing high-resolution images, where they suffer from low reconstruction efficiency and low accuracy.
By segmenting the training image into multiple image blocks, generating a block-based word sequence for each image block, and introducing prefix words and latent words to assist in reconstructing the preset regions of the image, the target image reconstruction model is trained using an autoregressive model.
It improves the accuracy and efficiency of image reconstruction, especially when processing high-resolution images, enabling faster and more accurate capture of details, thus enhancing the overall quality and speed of image reconstruction.
Smart Images

Figure CN123181599A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence technology and image processing technology, and more specifically, to a model training method, a data processing method, a system, an electronic device, a storage medium, and a computer program product. Background Technology
[0002] In image reconstruction applications, the demand for real-time generation of high-resolution images is steadily increasing. The quality of the image encoding and decoding process plays a crucial role in image generation. However, in related technologies, strong bidirectional dependencies exist between image terms during token encoding. This not only increases model complexity but may also lead to compatibility issues with the decoding part, resulting in low reconstruction efficiency and accuracy for certain image regions during the image decoding and reconstruction process.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides a model training method, a data processing method, a system, an electronic device, a storage medium, and a computer program product to at least solve the technical problem of low accuracy and efficiency in image reconstruction by models in related technologies.
[0005] According to one aspect of the embodiments of this application, a model training method is provided, comprising: acquiring a training image; generating a first word sequence and a second word sequence corresponding to the training image, wherein the first word sequence includes: a block word sequence corresponding to multiple image blocks, the multiple image blocks being obtained by image segmentation processing of the training image; the second word sequence includes: multiple prefix words and multiple latent words corresponding to the first word sequence, the multiple prefix words being used to assist in reconstructing image blocks within a preset region in the training image; training an initial image reconstruction model based on the first word sequence and the second word sequence to obtain a target image reconstruction model, wherein the target image reconstruction model is used to perform image reconstruction on a target image to obtain a reconstruction result.
[0006] According to one aspect of the embodiments of this application, a data processing method is provided, comprising: acquiring an input image; performing image reconstruction on the input image using a target image reconstruction model to obtain a reconstructed image; wherein the target image reconstruction model is generated according to the model training method of any one of the above.
[0007] According to one aspect of the embodiments of this application, a data processing method is provided, comprising: acquiring a product image to be reconstructed; performing image reconstruction on the product image to be reconstructed using a target image reconstruction model to obtain a reconstructed product image; wherein the target image reconstruction model is generated according to the model training method of any one of the above.
[0008] According to one aspect of the embodiments of this application, a data processing method is provided, comprising: obtaining a data processing request through a first application programming interface, wherein the request data carried in the data processing request includes: an input image; and returning a data processing response through a second application programming interface, wherein the response data carried in the data processing response includes: a reconstructed image, wherein the reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to the model training method of any one of the above.
[0009] According to one aspect of the embodiments of this application, a data processing method is provided, comprising: acquiring a currently input data processing dialogue request, wherein the request data carried in the data processing dialogue request includes: an input image; responding to the data processing dialogue request and returning a data processing dialogue response, wherein the information carried in the data processing dialogue response includes: a reconstructed image, wherein the reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to any of the above model training methods; and displaying the reconstructed image in a graphical user interface.
[0010] According to one aspect of the embodiments of this application, a data processing method is provided, comprising: displaying an input image on the operation interface in response to an input command applied to the operation interface; and displaying a reconstructed image on the operation interface in response to a processing command applied to the operation interface; wherein the reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to the model training method of any one of the above.
[0011] According to one aspect of the embodiments of this application, a data processing system is provided, comprising: a client for sending an input image; a server connected to the client for performing image reconstruction on the input image using a target image reconstruction model to obtain a reconstructed image; the client is also used to output the reconstructed image; wherein the target image reconstruction model is generated according to the model training method of any one of the above.
[0012] According to one aspect of the embodiments of this application, an electronic device is provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the model training method or the data processing method of any of the above-mentioned methods during runtime.
[0013] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to execute the model training method or the data processing method of any of the above-mentioned methods.
[0014] According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the model training method or the data processing method of any of the above-mentioned methods.
[0015] In this embodiment, a training image is acquired; a first word sequence and a second word sequence corresponding to the training image are generated, wherein the first word sequence includes: a block word sequence corresponding to multiple image blocks, the multiple image blocks being obtained by image segmentation processing of the training image; the second word sequence includes: multiple prefix words and multiple latent words corresponding to the first word sequence, the multiple prefix words being used to assist in reconstructing image blocks within a preset region in the training image; an initial image reconstruction model is trained based on the first word sequence and the second word sequence to obtain a target image reconstruction model, wherein the target image reconstruction model is used to reconstruct the target image to obtain the reconstruction result.
[0016] It is noteworthy that, in this embodiment, on the one hand, the training image is segmented into multiple image blocks, and each image block is converted into a block-based word sequence. This enables the trained target image reconstruction model to process the local features of the image more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (such as the top region of the image) to assist in reconstructing image blocks within that preset region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks in the preset region, enabling it to capture details more quickly and accurately, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves the goal of improving the reconstruction accuracy and efficiency of the target image reconstruction model by generating a first word sequence and a second word sequence, thus realizing the technical effect of improving the reconstruction accuracy and efficiency of the trained target image reconstruction model, and solving the technical problem of low accuracy and efficiency in image reconstruction by models in related technologies.
[0017] It is worth noting that the general description above and the detailed description that follow are merely for illustrative purposes and do not constitute a limitation on this application. Attached Figure Description
[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0019] Figure 1 This is a schematic diagram illustrating an application scenario of a model training method according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of a model training method according to an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of an optional model training process according to an embodiment of this application;
[0022] Figure 4 This is a flowchart of a data processing method according to an embodiment of this application;
[0023] Figure 5 This is a flowchart of another data processing method according to an embodiment of this application;
[0024] Figure 6 This is a flowchart of another data processing method according to an embodiment of this application;
[0025] Figure 7 This is a flowchart of another data processing method according to an embodiment of this application;
[0026] Figure 8 This is a flowchart of another data processing method according to an embodiment of this application;
[0027] Figure 9 This is a structural block diagram of a model training device according to an embodiment of this application;
[0028] Figure 10 This is a structural block diagram of a data processing apparatus according to an embodiment of this application;
[0029] Figure 11 This is a structural block diagram of another data processing apparatus according to an embodiment of this application;
[0030] Figure 12 This is a structural block diagram of another data processing apparatus according to an embodiment of this application;
[0031] Figure 13 This is a structural block diagram of another data processing apparatus according to an embodiment of this application;
[0032] Figure 14 This is a structural block diagram of another data processing apparatus according to an embodiment of this application;
[0033] Figure 15This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0036] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0037] The technical solution provided in this application is mainly implemented using a deep learning model. Deep learning models can be widely applied in fields such as Natural Language Processing (NLP), computer vision, and speech processing. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as to NLP tasks such as text-based sentiment classification, text summarization, and machine translation. Therefore, the main application scenarios of this application include, but are not limited to, digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.
[0038] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows.
[0039] An image tokenizer is a deep learning component used to compress high-dimensional pixel information of an image into a low-dimensional continuous or discrete sequence. Through linear projection and possible quantization, the image tokenizer encodes each image region as a token. These tokens record key features of the image for subsequent visual tasks.
[0040] Autoregressive models are predictive models that refer to previous elements when predicting each output element. In the field of image generation, these models can predict the next pixel based on the generated image pixels in a specific order (such as from left to right or from top to bottom), thereby ensuring the causality and coherence of the image generation process.
[0041] Image reconstruction refers to the process of recovering the original image from a low-dimensional representation after it has been encoded, compressed, or transformed. Image reconstruction typically involves a decoding stage, in which compressed or encoded features are converted back to a high-dimensional image space to reproduce the details and structure of the original image as accurately as possible.
[0042] According to an embodiment of this application, a model training method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0043] The technical solutions provided in this application can employ deep learning models with relatively large parameter scales, such as large models containing billions or even more model parameters. Here, "large model" is merely an example; this application does not limit the number of model parameters supported by the deep learning model used, aiming to meet actual needs. The deep learning models involved in this application can be artificial intelligence-based language models (LanguageMode, LM) or multimodal models (Multimodal Model, MM).
[0044] Considering the limited computing resources of mobile terminals, the methods described above in this application embodiment can be applied to, for example... Figure 1 The application scenarios shown are not limited to these. In, for example... Figure 1In the application scenario shown, the deep learning model is deployed on server 10. Server 10 can connect to one or more client devices 20 via a local area network (LAN), wide area network (WAN), internet connection, or other types of data network. These client devices 20 may include, but are not limited to, smartphones, tablets, laptops, PDAs, personal computers, smart home devices, and in-vehicle devices. Client devices 20 can interact with users through a graphical user interface to invoke the deep learning model, thereby implementing the method provided in this embodiment.
[0045] In this embodiment, the system consisting of a client device and a server can perform the following steps: the client device uploads a training image to the server; the server generates a first word sequence and a second word sequence corresponding to the training image, and trains an initial image reconstruction model based on the first word sequence and the second word sequence to obtain a target image reconstruction model. The first word sequence includes: block word sequences corresponding to multiple image blocks, which are obtained by image segmentation of the training image; the second word sequence includes: multiple prefix words and multiple latent words corresponding to the first word sequence, which are used to assist in reconstructing image blocks within a preset region in the training image; the target image reconstruction model is used to reconstruct the target image to obtain the reconstruction result. Further, the server returns the target image reconstruction model to the client, or the server provides the client with a calling interface for the target image reconstruction model.
[0046] It should be noted that with the rapid development of high-performance computing units, the methods provided in this application embodiment can also be applied to model all-in-one machines in other application scenarios. In one optional embodiment, the model all-in-one machine has multiple built-in models, and users can select one model to adjust as needed to obtain their own model. The high-performance computing unit built into the model all-in-one machine can then directly call the adjusted model to execute the methods provided in this application embodiment. In another optional embodiment, the large model all-in-one machine has a pre-trained model built-in, and the high-performance computing unit built into the model all-in-one machine can then directly call that model to execute the methods provided in this application embodiment.
[0047] Furthermore, when users need to train their own models, they can upload their own datasets via the client. These datasets are then sent to the server, allowing the server to adjust the pre-trained model using the dataset to obtain the user's customized model, which can then be deployed to the production environment. To facilitate users' model adjustment needs, the server provides complete adjustment tools, development frameworks, and processes, supporting multiple adjustment strategies. This allows the adjusted model to better adapt to different application domains and achieve a high degree of customization.
[0048] Under the aforementioned operating environment, this application provides the following: Figure 2 The model training method shown. Figure 2 This is a flowchart of a model training method according to an embodiment of this application. For example... Figure 2 As shown, the method may include the following steps S202 to S206.
[0049] Step S202: Obtain training images.
[0050] The training images mentioned above can be an image dataset used to train a target image reconstruction model. The training images can contain various types of images to enable the target image reconstruction model to learn and adapt to the visual features of different scenes.
[0051] The training images mentioned above can be obtained through various means, such as selecting them from public datasets or private datasets specific to a particular domain, or through web scraping, sensor data acquisition, and user uploads. For the images in the training data, image preprocessing operations (such as cropping, scaling, and grayscale conversion) can be performed to ensure image format consistency and data quality.
[0052] The training images mentioned above can correspond to various application scenarios, such as obstacle detection in autonomous driving, disease diagnosis in medical image analysis, and content recommendation systems in social media. In particular, in image generation, the training images are used to guide the model to learn the structure and style of images in order to generate new images.
[0053] Specifically, in the embodiments of this application, training images are used to help the initial image reconstruction model learn how to effectively encode and decode images. In particular, prefix terms and auxiliary losses can be introduced into the first row of each image, and combined with training in multiple stages, to improve the image reconstruction accuracy and training efficiency of the model.
[0054] In one exemplary application scenario, training images can be real-world images or synthetic images from any source. The training images possess sufficient diversity to cover the range of scenarios where the target image reconstruction model is intended to be applied. The process of acquiring training images is fundamental to building a high-quality target image reconstruction model, ensuring that subsequent learning and optimization can be performed on a broad dataset, thereby improving the generalization ability and accuracy of the target image reconstruction model.
[0055] Step S204: Generate a first word sequence and a second word sequence corresponding to the training image. The first word sequence includes: a block word sequence corresponding to multiple image blocks, which are obtained by image segmentation processing of the training image. The second word sequence includes: multiple prefix words and multiple potential words corresponding to the first word sequence. The multiple prefix words are used to assist in reconstructing image blocks within a preset region in the training image.
[0056] The process of generating the first and second word sequences described above can be implemented by the encoding module in the initial image reconstruction model, or by the word sequence generation component associated with the initial image reconstruction model.
[0057] The process of segmenting the trained image to obtain multiple image patches can be implemented by the initial image reconstruction model or by the image segmentation component associated with the initial image reconstruction model.
[0058] The first word sequence mentioned above may include the block word sequence corresponding to each image patch. The block word sequence refers to the word representation sequence obtained by transforming each image patch after segmentation of the training image, which is used to capture and encode the features within the image patch.
[0059] In generating the first word sequence, the training image is segmented into multiple image patches. Each image patch is transformed into a block word sequence through linear projection, thus obtaining the first word sequence. These block word sequences contain an information summary of each image patch, reflecting the local features of the image patch in the form of a latent representation. The first word sequence is the direct output of the image tagger's encoding stage, providing the basic feature representation for subsequent decoding and generation processes.
[0060] The second lexical sequence described above provides supplementary information about the training images from a global perspective, helping to enhance the model's image reconstruction capabilities, especially in processing predefined image regions. The prefix lexical units described above are used to assist in reconstructing predefined image regions. Prefix lexical units can carry additional contextual information to compensate for potential image reconstruction difficulties due to a lack of contextual relationships. The latent lexical units described above can be abstract lexical units extracted from the first lexical sequence by a deep learning encoder, used to represent the latent features and structure of the image, contributing to efficient image encoding and decoding.
[0061] In the second lexical sequence described above, the number of prefix lexical units can be determined based on the application scenario requirements or the characteristics of the training image. The number of potential lexical units corresponds to the number of block lexical units in the first lexical sequence. The preset region in the training image described above can be the region corresponding to the first row of image blocks among multiple image blocks.
[0062] In an exemplary application scenario, the second lexical sequence is an enhanced lexical sequence obtained by introducing multiple prefix lexical units and quantizing the block lexical sequences in the first lexical sequence. The second lexical sequence contains multiple prefix lexical units and multiple latent lexical units corresponding to the first lexical sequence. The introduction of prefix lexical units aims to assist in reconstructing image patches within a preset region in the training image, especially the starting row of the image, by carrying additional reconstruction information to compensate for the reconstruction challenge caused by the lack of reference lexical units. Latent lexical units are extracted from the first lexical sequence during the quantization process and represent refined feature representations of the image patches. By generating the second lexical sequence, the encoded lexical sequence better meets the generation requirements of the autoregressive model, while the prefix lexical units enhance the reconstruction quality of the starting part of the image, providing an optimized lexical representation for the final image reconstruction and generation.
[0063] According to step S204, this embodiment of the application subdivides the training image into multiple image blocks and generates a corresponding block-based word sequence for each image block, constituting a first word sequence. The first word sequence captures the internal local features of each image block and the relationships between multiple image blocks. Furthermore, the generated second word sequence includes a specific number of prefix words and latent words corresponding to the first sequence. Prefix words are used to support and improve the reconstruction performance of image blocks within a preset region, while latent words maintain the semantic integrity of the image by compressing the information in the first word sequence, while reducing redundancy and helping to improve the efficiency of the encoding and decoding process.
[0064] Step S206: The initial image reconstruction model is trained based on the first word sequence and the second word sequence to obtain the target image reconstruction model, wherein the target image reconstruction model is used to reconstruct the target image to obtain the reconstruction result.
[0065] The initial image reconstruction model mentioned above refers to the initial model set according to a preset framework before training begins. Through iterative training, the initial image reconstruction model evolves into the target image reconstruction model. The target image reconstruction model mentioned above refers to the mature model obtained through training, which has the ability to reconstruct images from word sequences, especially image patches within a preset region, ensuring the realism and continuity of the reconstruction results.
[0066] In this embodiment, an initial image reconstruction model is trained using a first lexical sequence and a second lexical sequence, gradually adjusting the model parameters until the model can accurately reconstruct the training image from the lexical sequence. The target image reconstruction model has the ability to reconstruct images from lexical sequences. The main task of this target image reconstruction model is to receive a lexical sequence input of any target image during the testing or application phase, and output a reconstruction result that matches the lexical sequence. This reconstruction result will be as close as possible to the original target image. By combining the block lexical sequence of the first lexical sequence with the latent and prefix lexical units of the second lexical sequence, the model can not only capture the global and local features of the image, but also exhibit better reconstruction performance when processing preset regions of the image, especially in cases where sufficient contextual information is lacking (such as reconstructing the first row of the image).
[0067] Through steps S202 to S206 described above, this embodiment of the application achieves the function of efficiently generating word sequences from training images, and obtains a target image reconstruction model capable of effectively reconstructing images based on the trained model. In particular, the introduction of prefix words enhances the performance of the target image reconstruction model when processing preset regions of images, overcoming the problem of poor reconstruction quality that may result from a lack of context. Furthermore, by considering both block word sequences and latent word sequences simultaneously during model training, it ensures that even complex images can be accurately and meticulously reconstructed by the target image reconstruction model, thereby improving the overall quality of image reconstruction. Overall, the technical solution of this embodiment significantly improves the accuracy and speed of image reconstruction, especially when processing high-resolution images, achieving excellent visual effects and computational efficiency.
[0068] It is noteworthy that, in this embodiment, on the one hand, the training image is segmented into multiple image blocks, and each image block is converted into a block-based word sequence. This enables the trained target image reconstruction model to process the local features of the image more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (such as the top region of the image) to assist in reconstructing image blocks within that preset region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks in the preset region, enabling it to capture details more quickly and accurately, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves the goal of improving the reconstruction accuracy and efficiency of the target image reconstruction model by generating a first word sequence and a second word sequence, thus realizing the technical effect of improving the reconstruction accuracy and efficiency of the trained target image reconstruction model, and solving the technical problem of low accuracy and efficiency in image reconstruction by models in related technologies.
[0069] In one optional embodiment, according to the model training method, the image patch within the preset region includes: an image patch obtained by segmenting the top region of the image, and the number of prefix words is determined based on the number of image patches obtained by segmenting the top region of the image.
[0070] In an exemplary bottom-up image reconstruction scenario, particularly when the model decodes the image line by line starting from the top left corner in raster scan order, the image patch within the preset region specifically refers to the image patch segmented from the top region of the image. If the initial image reconstruction model is built on an autoregressive model framework, its generative characteristics require that the generation of each word depends on the information of previous words. The image patch in the top region faces the problem of insufficient prior information support in the early stages of reconstruction, especially during the reconstruction of the first line. The initial image reconstruction model struggles to rely on sufficient historical words to recover details and textures, leading to a decrease in reconstruction quality. Therefore, defining the segmented image patch from the top region as the image patch of the preset region can help the model improve the accuracy and efficiency in the early stages of reconstruction.
[0071] However, the definition of the preset region doesn't have to be limited to the top of the image; it can be flexibly adjusted based on the direction of image reconstruction or generation. For example, in a top-down image generation scenario, the preset region might be set as an image patch at the bottom of the image or at a specific edge, ensuring that these boundary patches receive necessary supplementary information during generation, thereby improving image reconstruction results. Similarly, for image generation that spreads outward from the center, the preset region might be distributed around the center point, providing additional contextual information to image patches near the center.
[0072] In this embodiment, the number of prefix words is determined based on the number of image patches obtained from segmenting the top region of the image. This means that during image reconstruction, especially when processing the top region of the image, a set of prefix words can be introduced. The number of these prefix words is determined by the number of image patches segmented from the top of the image (usually the first row).
[0073] Specifically, when the entire training image is segmented into multiple smaller image patches, the top region's image patches, being at the beginning of the sequence, may face reconstruction challenges due to a lack of sufficient contextual information, especially when the model needs to generate subsequent terms based on previous terms. To overcome this problem, prefix terms are introduced. Each prefix term contains additional information about the corresponding image patch, helping the model better understand and reconstruct these image patches.
[0074] For example, if the top region of the image is segmented into 16 image patches, the same number of prefix terms are added, with each prefix term associated with an image patch, providing the contextual and auxiliary information needed for reconstruction. In this way, when image reconstruction begins, the model can not only rely on these prefix terms to improve the reconstruction of the first row of image patches, but also ensure a smoother and more natural reconstruction process, effectively enhancing the overall reconstruction performance of the model.
[0075] For example, if the top region of the image is segmented into 16 image patches, then one more prefix word is added in addition to the aforementioned 16 prefix words. This one prefix word can serve as a guide word for the aforementioned 16 words. The aforementioned guide word does not directly correspond to any specific image patch, but is located at the very beginning of the sequence, used to carry global information or initialize the state of the model.
[0076] According to the above optional embodiments, this application embodiment significantly enhances the reconstruction quality of the top starting row of the image by specifying that image blocks within a preset area originate from the segmentation of the top region of the image, and determines the number of multiple prefix words accordingly. This stabilizes the generation process and promotes the efficient fusion of global and local information. Especially when processing the top region, the prefix words, as an additional signal source, not only carry local image features but also interact with the model's global information, supporting multi-scale and multi-granularity feature learning. This improves model training efficiency and the visual coherence of image reconstruction, ensuring that the generated image possesses both rich detail and realism. The strategy embodied in the above optional embodiments optimizes the accuracy and efficiency of the autoregressive model framework in processing the beginning part of the image, resulting in a better overall reconstruction effect.
[0077] In an optional embodiment, step S204 involves generating a first word sequence and a second word sequence corresponding to the training image, including the following method steps:
[0078] Step S241: Perform image segmentation processing on the training image to obtain multiple non-overlapping image patches;
[0079] Step S242: Linearly project multiple image blocks based on a preset number of channels and a preset image block size to obtain the first word sequence;
[0080] Step S243: Generate a second word sequence by using multiple prefix words and multiple potential words corresponding to the first word sequence.
[0081] In the optional embodiments described above, the input training image is first subjected to image segmentation. During image segmentation, the complete training image is uniformly divided into multiple non-overlapping sub-regions, resulting in multiple image patches. Each image patch independently contains some details and information of the training image and does not share pixels with adjacent image patches, thus ensuring the locality and integrity of image information. This non-overlapping segmentation method lays the foundation for subsequent processing steps, enabling the model to effectively manage image complexity and reduce computational resource requirements.
[0082] The aforementioned preset number of channels refers to the number of feature dimensions set when processing image data. It is usually related to the image's color channels (such as the 3 channels of RGB) and the model's internal representation capability. The preset number of channels determines the width of the feature vector of each image patch after linear projection, thus affecting the model's ability to capture and process image details.
[0083] The aforementioned preset image patch size refers to the fixed size set for image segmentation during the image segmentation process, such as 16×16 pixels. This ensures that all image patches have a consistent size when input to the model, facilitating efficient linear projection and subsequent processing, while also helping to control the computational complexity and number of parameters of the model. Each segmented image patch is converted into a fixed-length vector through linear projection, resulting in the first word sequence, providing the model with structured image information.
[0084] Furthermore, based on a preset number of channels and a preset image patch size, this embodiment of the application uses linear projection to convert the segmented image patches into one-dimensional vectors suitable for further processing, resulting in a first word sequence. The aforementioned linear projection maps high-dimensional data to a lower-dimensional space. In this embodiment, linear projection is used to compress the information of the image patches, enabling the compressed first word sequence to compactly represent the features of the image patches, while also facilitating subsequent encoding and decoding operations.
[0085] Furthermore, in step S243, this embodiment introduces multiple prefix words and combines them with multiple latent words corresponding to the first word sequence to generate a second word sequence. The multiple prefix words are used to carry additional image context information. The multiple latent words are generated during image encoding and serve as feature representations of compressed image blocks. Connecting prefix words with latent words to obtain the second word sequence enhances the expressiveness of the word sequence, making the reconstruction process more accurate and smooth, especially for the reconstruction of image blocks within a preset area.
[0086] For example, the training image is segmented into (h×w) image patches, where h represents the number of segments (i.e., rows) in the height direction and w represents the number of segments (i.e., columns) in the width direction. Based on this, the first word sequence contains (h×w) block word sequences, and correspondingly, the second word sequence contains (h×w) latent words. Furthermore, the number of prefix words is determined based on the number of image patches obtained from the top region of the image, denoted as k. Therefore, the second word sequence contains a total of (k+h×w) words.
[0087] Through steps S241 to S243 described above, this embodiment first performs non-overlapping segmentation on the training image. Then, it performs linear projection based on a preset number of channels and image patch size to generate a first word sequence. Next, it combines this with a specific number of prefix words to generate a second word sequence. This improves the reconstruction accuracy of the initial part of the image. The prefix words supplement missing contextual information, ensuring the coherence of model understanding and reconstruction. Furthermore, linear projection standardizes the representation of image patches, facilitating efficient learning of cross-patch feature associations and enhancing the detail representation of the generated image. Finally, the second word sequence, integrating prefix words and latent words, promotes the model's synergistic use of global and local information, further optimizing the quality and visual effect of image generation. This effectively overcomes problems such as low image reconstruction accuracy caused by insufficient information, resulting in reconstructed images with richer details and a more natural and harmonious visual appearance.
[0088] In an optional embodiment, the initial image reconstruction model includes an initial encoder and an initial decoder. In step S206, the initial image reconstruction model is trained based on a first word sequence and a second word sequence to obtain a target image reconstruction model, including the following method steps:
[0089] Step S261: Concatenate the first word sequence and the second word sequence to obtain the concatenated sequence;
[0090] Step S262: In response to the fact that both the initial encoder and the initial decoder are in a thawed state, the model parameters of the initial encoder are adjusted based on the splicing sequence to obtain the target encoder, and the model parameters of the initial decoder are adjusted based on the splicing sequence to obtain the intermediate decoder.
[0091] Step S263: In response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, the model parameters of the intermediate decoder are adjusted based on the splicing sequence to generate the target decoder.
[0092] Step S264: Determine the target image reconstruction model using the target encoder and target decoder.
[0093] The initial image reconstruction model described above includes an initial encoder and an initial decoder. The initial encoder converts the input training image into a low-dimensional representation, i.e., a sequence of terms, for easy compression and storage. The initial decoder then recovers the high-dimensional pixel information of the image from these term sequences, thus reconstructing the image.
[0094] In the exemplary application scenario, both the initial encoder and the initial decoder adopt the Transformer architecture and have the ability to process sequential data. The initial encoder may establish bidirectional dependencies between words during encoding, while the initial decoder may encounter the problem of reconstructing the first row of pixels when reconstructing the image.
[0095] The concatenated sequence described above is a word sequence obtained by concatenating the first word sequence with the second word sequence. This sequence is used to train and adjust the initial encoder and decoder. The concatenated sequence ensures that the model can process information from the entire image during training.
[0096] In the frozen state described above, the model parameters remain unchanged during training and are no longer updated. In the thawed state described above, the model parameters can continue to learn and optimize, and are updated with each training iteration to improve model performance. In other words, parameter updates are not allowed when the encoder and / or decoder are in a frozen state, and conversely, parameter updates are allowed when the encoder and / or decoder are in a thawed state.
[0097] In this embodiment, the first word sequence and the second word sequence are concatenated to provide complete and continuous input data for subsequent model training. Further, when both the initial encoder and the initial decoder are in a thawed state (i.e., parameter updates are allowed), the first stage of training begins. The model parameters of the initial encoder are adjusted based on the concatenated sequence to reduce the bidirectional dependencies between words during encoding, resulting in the target encoder. Simultaneously, the model parameters of the initial decoder are adjusted based on the concatenated sequence to obtain the intermediate decoder. This process optimizes the initial encoder and initial decoder, enabling the optimized target encoder and intermediate decoder to better match the unidirectional dependencies of the autoregressive model.
[0098] Furthermore, when the target encoder is in a frozen state and the intermediate decoder is in a thawed state, the second stage of training begins. This stage adjusts the model parameters of the intermediate decoder based on the concatenated sequence to generate the target decoder. The second stage of training focuses on improving the details of image reconstruction, particularly in the reconstruction of the first row of pixels. This is achieved by introducing prefix terms to carry additional reconstruction information, compensating for the reconstruction challenges caused by the lack of sufficient reference terms.
[0099] Furthermore, a target image reconstruction model is constructed using a target encoder and a target decoder. This target image reconstruction model undergoes two stages of training, which not only establishes unidirectional dependencies of terms, better aligning with the characteristics of the autoregressive model, but also enhances the continuity and smoothness of image reconstruction through secondary training of the decoder, thereby improving the overall reconstruction quality.
[0100] The target image reconstruction model mentioned above can be an autoregressive model.
[0101] It is readily apparent that the embodiments of this application can significantly improve the performance of the image reconstruction model. First, by adjusting the initial encoder and decoder, the generated target encoder effectively reduces the bidirectional dependency between terms during encoding, making the encoded term sequence more consistent with the unidirectional dependency characteristics of the autoregressive model, thereby promoting accurate modeling of the term sequence by the autoregressive model. Second, through secondary training of the intermediate decoder, the generated target decoder improves the continuity and detail representation of image reconstruction, especially when processing the first row of pixels. By introducing prefix terms carrying additional information, it effectively compensates for the reconstruction problem caused by the lack of sufficient reference terms. Therefore, the target image reconstruction model not only improves the fidelity of image reconstruction but also maintains the generative friendliness of the autoregressive model, achieving a balance between high-quality image reconstruction and efficient generation tasks.
[0102] Through steps S261 to S264 described above, this embodiment of the application optimizes the model for image reconstruction tasks by introducing a two-stage training strategy and prefix terms. This improves the visual quality and detail richness of the reconstructed images, while overcoming the challenge of reconstructing the first row of an image, ensuring the coherence and speed of the generation process. The above technical solution offers significant advantages for visual generation tasks, especially in scenarios requiring high-quality image reconstruction and high generation speed.
[0103] In an optional embodiment, in step S262, the model parameters of the initial encoder are adjusted based on the splicing sequence to obtain the target encoder, including the following method steps:
[0104] Step S2621: In response to the fact that both the initial encoder and the initial decoder are in a thawed state, the initial encoder is used to perform feature encoding processing on the concatenated sequence to obtain a first encoding result, wherein the first encoding result includes: the encoded latent words obtained by the feature encoding processing of the initial encoder;
[0105] Step S2622: Quantize the first encoding result to obtain the first quantization result;
[0106] Step S2623: Using the initial decoder, feature decoding processing is performed on the first quantization result along the grating scanning sequence to obtain multiple first reconstructed image blocks;
[0107] Step S2624: Adjust the model parameters of the initial encoder based on multiple first reconstructed image blocks to obtain the target encoder.
[0108] In the first stage of training, this embodiment first ensures that both the initial encoder and the initial decoder are in a trainable state, i.e., a "thawed state". Then, the initial encoder is used to perform feature encoding processing on the concatenated sequence containing block word sequences and prefix words, transforming the image block representation into a more compact latent representation, resulting in the first encoding result. The first encoding result contains the image information after compression and transformation by the encoder, in the form of encoded latent words, ready to enter the subsequent quantization processing stage to further reduce redundancy and optimize storage and transmission efficiency.
[0109] The quantization process described above is a common technique used to convert continuous feature representations into discrete categories. In this embodiment, a quantization operation is performed on the first encoding result, mapping the encoded latent words to the nearest discrete value in a predefined codebook, generating the first quantization result. This quantization process helps eliminate redundant information in the latent representation while preserving the main features of the image, providing a standardized latent word representation for subsequent decoding and image reconstruction. Quantization is a crucial intermediate step connecting the encoder output and decoder input, ensuring that the decoder can perform effective image reconstruction based on the discrete latent words.
[0110] The aforementioned raster-scan order is a sequence of image pixels or blocks traversed along a fixed path (usually from left to right and from top to bottom). In this embodiment, an initial decoder is used to perform feature decoding on the first quantization result obtained from the quantization process. The feature decoding process follows the raster-scan order to reconstruct image blocks. The initial decoder receives the encoded and quantized latent words and converts these latent words inversely into pixel representations of the image blocks, thereby obtaining multiple first reconstructed image blocks. Each reconstructed image block corresponds to a part of the training image and follows the decoding order, which ensures consistency and coherence between image blocks, as well as the correctness of the image reconstruction result.
[0111] Furthermore, the model parameters of the initial encoder are evaluated and updated based on the first reconstructed image patch, aiming to generate a more optimized target encoder. The aforementioned model parameter adjustment process optimizes the encoder weights using a backpropagation algorithm based on the differences between the reconstructed image patch and the original image patch in the training data, thereby improving the quality of feature encoding and image reconstruction. Simultaneously, the model parameters of the initial decoder are adjusted based on a concatenated sequence containing block-level and prefix word sequences to obtain an intermediate decoder. After the optimized target encoder parameters are frozen, the intermediate decoder further optimizes image reconstruction performance, particularly the reconstruction quality for preset image regions (such as the first row).
[0112] It is noteworthy that the embodiments of this application effectively realize image encoding, quantization, decoding, and iterative optimization of model parameters. The training process described above involves an independent adjustment mechanism for encoder and decoder parameters, as well as the comprehensive application of latent and prefix terms, particularly in addressing the challenge of reconstructing predefined image regions. Specifically, feature encoding and quantization operations based on the concatenated sequence ensure the compactness and standardization of the encoding results, while decoding following the raster scan order guarantees the consistency and sequence of image reconstruction. Thus, through multiple adjustments, the generated target encoder and intermediate decoder can more effectively encode and reconstruct images, especially in local regions and early stages of the image, improving the accuracy and visual quality of image reconstruction while reducing computational resource requirements, achieving a significant improvement in image reconstruction technology.
[0113] Through the above steps S2621 to S2624, the embodiments of this application not only have advantages in image reconstruction, but also open up new possibilities for the application of image reconstruction models based on autoregressive model frameworks in the field of image generation. In particular, when processing high-resolution images, it can achieve better generation results with faster sampling speed.
[0114] In an optional embodiment, in step S2624, the model parameters of the initial encoder are adjusted based on multiple first reconstructed image blocks to obtain the target encoder, including the following method steps:
[0115] Step S2625: Determine the first image reconstruction loss and auxiliary loss based on multiple first reconstructed image blocks, wherein the auxiliary loss is used to represent the reconstruction loss of image blocks within a preset region;
[0116] Step S2626: Adjust the model parameters of the initial encoder using the first image reconstruction loss and auxiliary loss to obtain the target encoder.
[0117] The first image reconstruction loss is used to measure the difference between the first reconstructed image patch and the corresponding part of the original image, thereby guiding the parameter adjustment of the initial encoder and initial decoder. The auxiliary loss is an additional loss calculated for image patches within a preset region, used to optimize the reconstruction effect of the preset region (e.g., the top row of the image). The initial encoder refers to an untrained or unoptimized encoder model used to convert the input image into a sequence of latent words. The target encoder refers to a trained and optimized encoder model capable of performing the image-to-latent word sequence conversion more efficiently and accurately. The initial decoder refers to the decoder model set at the beginning of training, used to convert the latent word sequence into a reconstructed image. The intermediate decoder refers to the decoder generated during the first stage of training, focusing on recovering image patches from the latent word sequence, including the reconstruction quality of image patches within the preset region.
[0118] In the optional embodiments described above, the performance of the initial image reconstruction model in the image reconstruction process is evaluated and quantified based on multiple first reconstructed image patches. Specifically, firstly, the first image reconstruction loss is calculated by comparing the multiple first reconstructed image patches generated by the initial image reconstruction model with corresponding parts in the training image. The calculation of the first image reconstruction loss can employ Mean Squared Error (MSE), Perceptual Loss, or other relevant metrics to measure the difference between the output of the initial image reconstruction model and the actual training image, thereby determining the accuracy and visual quality of the image reconstructed by the initial image reconstruction model.
[0119] Furthermore, an auxiliary loss is determined based on multiple first reconstructed image patches. This auxiliary loss is calculated for image patches within a preset region. The image patches in the preset region lack sufficient reference information in the early stages of reconstruction, resulting in poor reconstruction performance. This embodiment of the application ensures that the model can focus on and optimize the image reconstruction performance of the preset region by performing additional loss calculations on the image patches within the preset region. The calculation of the auxiliary loss can employ mean squared error (MSE) or other loss functions customized according to specific application scenarios to ensure a significant improvement in the reconstruction performance of image patches within the preset region.
[0120] Furthermore, the initial encoder is trained and optimized based on the first image reconstruction loss and the auxiliary loss. The model parameters of the initial encoder are adjusted using the backpropagation algorithm to minimize the values of the first image reconstruction loss and the auxiliary loss, thereby gradually improving the overall performance of the model.
[0121] In the first phase of training, the optimization objective for the initial encoder is to generate a target encoder that can more effectively transform the input image into a compact and information-rich latent representation (i.e., a sequence of latent terms). The process of tuning the model parameters of the initial encoder aims to improve its ability to capture image patch features while ensuring that the latent representation meets the input requirements of the decoder for subsequent image reconstruction.
[0122] In the first phase of training, the optimization goal for the initial decoder is to generate an intermediate decoder. This intermediate decoder learns progressively during training how to accurately reconstruct image patches from latent word sequences, including image patches within a predefined region. The model parameters of the initial decoder are tuned according to the principle of minimizing loss, but with a greater emphasis on the details and coherence of the decoding process, ensuring that the conversion from the latent representation output by the encoder to the visually recognizable image reconstruction result is as accurate as possible.
[0123] Through steps S2625 to S2626 described above, the embodiments of this application can achieve precise control and optimization of the image reconstruction process. Specifically, the combined use of the first image reconstruction loss and the auxiliary loss ensures that the model can not only accurately reconstruct the input image as a whole, but also obtain high-quality reconstruction results for preset regions. The above technical solution not only improves the visual realism of the image, but also solves common problems in the initial stage of image generation for image reconstruction models based on autoregressive model frameworks. In addition, by training the target encoder and intermediate decoder, the embodiments of this application can generate high-quality latent representations that reflect the features of the input image and further reconstruct the image with high precision, thereby providing an effective solution for autoregressive image generation tasks, especially for application scenarios that rely on the accuracy of reconstruction of the initial few rows of image patches.
[0124] In an optional embodiment, in step S263, the model parameters of the intermediate decoder are adjusted based on the concatenated sequence to generate the target decoder, including the following method steps:
[0125] Step S2631: The concatenated sequence is processed by feature encoding using a target encoder to obtain a second encoding result, wherein the second encoding result includes: encoded latent words obtained by feature encoding processing of the target encoder;
[0126] Step S2632: Quantize the second encoding result to obtain the second quantization result;
[0127] Step S2633: Introduce multiple cached terms into the second quantization result to obtain the expanded quantization result;
[0128] Step S2634: Using an intermediate decoder, feature decoding processing is performed on the augmented quantization result along the grating scanning sequence to obtain multiple second reconstructed image blocks;
[0129] Step S2635: Adjust the model parameters of the intermediate decoder based on multiple second reconstructed image blocks to generate the target decoder.
[0130] In the optional embodiments described above, during the second stage of training, the model parameters of the target encoder are frozen and remain unchanged, while the model parameters of the intermediate decoder in the thawed state are adjusted. This ensures that the feature mapping capabilities learned by the target encoder in the first stage of training are preserved, allowing the focus to be placed on further fine-tuning the model parameters of the intermediate decoder.
[0131] The previously generated concatenated sequence is processed by a target encoder that is already in a frozen state to perform feature encoding, resulting in a second encoding result. The second encoding result contains encoded latent words, which are used to represent the high-level features extracted from the concatenated sequence. These high-level features are transformed and compressed by the deep learning architecture of the target encoder to obtain a highly abstract representation of the training image content.
[0132] Furthermore, the second encoding result is quantized to generate a second quantized result. The quantization process described above maps the encoded continuous features to a discrete codebook, aiming to reduce redundancy in feature representation and improve the efficiency of model training and image generation. Through quantization, the encoded latent words in the second encoding result are converted into index values, which correspond to specific items in the codebook. This helps the intermediate decoder learn a more refined and efficient representation.
[0133] Furthermore, in this embodiment, multiple cached terms are added to the second quantization result to obtain an expanded quantization result. The addition of cached terms enhances the continuity and detail consistency of the model's generation. Specifically, by introducing additional contextual information through cached terms, the model can better understand and generate complex image structures. The specific number and location of cached terms can be flexibly set according to the application scenario and model requirements to increase the model's stability during image reconstruction, ensuring natural transitions between generated image segments without obvious visual breaks or inconsistencies.
[0134] Furthermore, using a thawed intermediate decoder, feature decoding is performed on the augmented quantized results along the raster scan sequence to obtain multiple second reconstructed image patches. This feature decoding is the reverse process of encoding, converting the quantized word sequence back to approximate image content. The raster scan sequence is a common line-by-line image reading order, allowing the intermediate decoder to predict image patches one by one, ensuring the coherence and directionality of the generation process. Through this feature decoding process, the intermediate decoder attempts to reconstruct the appearance of the training image based on latent and cached words, verifying the intermediate decoder's generation capability and accuracy.
[0135] Furthermore, based on the generated multiple second reconstructed image patches, the model parameters of the intermediate decoder are adjusted to finally generate the target decoder. This model parameter adjustment process involves comparing the second reconstructed image patches with image patches from the training images, updating the model parameters of the intermediate decoder using a backpropagation algorithm to minimize the differences between the second reconstructed image patches and the image patches from the training images. The goal of this model parameter adjustment is to improve the performance of the target decoder on image reconstruction tasks, ensuring accurate image reconstruction without losing important details. The target decoder should be able to perform image reconstruction more efficiently, whether for images within the training set or unknown test images.
[0136] Through steps S2631 to S2635, this embodiment of the application can efficiently extract feature representations of latent terms from the frozen target encoder, and then significantly improve the reconstruction accuracy of the preset region through the decoding and adjustment process of the intermediate decoder. The above-mentioned model parameter adjustment process optimizes the training strategy of the image reconstruction model, and further enhances the coherence and visual quality of image generation by introducing cached terms. As a result, the generated target decoder not only maintains good image reconstruction performance, but also exhibits stronger capabilities in autoregressive image generation. This embodiment of the application can significantly improve the speed and efficiency of image generation without sacrificing image reconstruction fidelity, providing technical support for large-scale image generation tasks.
[0137] In an optional embodiment, in step S2635, the model parameters of the intermediate decoder are adjusted based on multiple second reconstructed image blocks to generate the target decoder, including the following method steps:
[0138] Step S2636: Determine the second image reconstruction loss based on multiple second reconstructed image blocks;
[0139] Step S2637: Adjust the model parameters of the intermediate decoder using the second image reconstruction loss to generate the target decoder.
[0140] The aforementioned multiple second-reconstructed image patches refer to the set of image patches generated by the intermediate decoder based on the latent word sequence. These patches are used to compare with multiple image patches from the training image to evaluate the reconstruction quality. The aforementioned second-image reconstruction loss is a loss value used to measure the difference between the multiple second-reconstructed image patches and the multiple image patches from the training image, thereby guiding the adjustment of the intermediate decoder model parameters. The aforementioned intermediate decoder refers to the decoder in a preliminary or incompletely optimized state during training, used to convert the latent word sequence into second-reconstructed image patches. The aforementioned target decoder refers to the tuned and optimized decoder, possessing higher-precision image reconstruction capabilities and able to generate images more accurately from the latent word sequence. The aforementioned model parameters refer to the numerical configuration that constitutes the machine learning model architecture, such as the weights and biases of the neural network. The loss function is minimized by adjusting the model parameters during training.
[0141] In the second phase of training, to evaluate the performance of the intermediate decoder during the decoding process, a second image reconstruction loss is determined based on multiple second reconstructed image patches. Specifically, the intermediate decoder decodes the latent word sequence into multiple second reconstructed image patches. The second image reconstruction loss is then calculated by comparing these multiple second reconstructed image patches with corresponding image patches from the training image. The second image reconstruction loss measures the accuracy and fidelity of the intermediate decoder in reproducing the details of the original image.
[0142] For example, the calculation of the second image reconstruction loss typically includes, but is not limited to, mean squared error (MSE), cross-entropy loss, or other loss functions suitable for evaluating image similarity and reconstruction quality. These loss functions provide a quantification method for determining the degree of difference between the image patch output by the decoder and the target ground truth image patch, thereby guiding the adjustment of model parameters.
[0143] It's important to note that determining the second image reconstruction loss based on multiple second reconstructed image patches means that in the second stage of training, no additional auxiliary loss constraints are imposed on prefix words; instead, the loss is calculated directly based on the reconstruction results of subsequent image patches. This allows the intermediate decoder to escape the interference from prefix words, enabling it to focus on optimizing the reconstruction details and coherence of the main image patches. This significantly improves the overall image reconstruction quality while maintaining generative friendliness. Through this approach, the trained target image reconstruction model achieves a better balance between the generation and reconstruction tasks.
[0144] Furthermore, in this embodiment, the calculated second image reconstruction loss is used as a feedback signal to adjust the model parameters of the intermediate decoder to optimize the image reconstruction process. The aforementioned model parameter adjustment process is typically accomplished through backpropagation. The second image reconstruction loss is propagated back to each layer of the model network, updating the weight parameters according to the gradient descent principle to minimize the loss function, thereby improving the decoder's performance. After multiple iterations, the intermediate decoder gradually learns how to more accurately reconstruct the original image from the latent word sequence, achieving higher reconstruction accuracy and visual quality, thus obtaining the target decoder.
[0145] Through steps S2636 to S2637, this embodiment effectively optimizes the model parameters of the intermediate decoder, significantly improving the reconstruction quality from latent word sequences to images, thus obtaining the target decoder. In particular, by introducing a feedback mechanism for the second image reconstruction loss, the trained target decoder can more accurately capture and regenerate image details within the preset region, solving a common problem in image reconstruction models based on autoregressive model frameworks when generating the initial portion of an image. The above technical solution not only enhances the overall performance of the model in image reconstruction tasks but also particularly strengthens the understanding and reconstruction capabilities of key information within the preset region of the image. The final generated target decoder demonstrates significant progress in high-fidelity image reconstruction, especially in the initial stages of processing complex image structures and textures, improving the visual effects and user experience of image generation.
[0146] In one alternative embodiment, according to the model training method, in the concatenated sequence, one-dimensional rotational position encoding is used for multiple prefix words, and two-dimensional rotational position encoding is used for multiple potential words corresponding to the first word sequence.
[0147] In the optional embodiments described above, one-dimensional rotational positional encoding (RoPE) is employed for multiple prefix words in the concatenated sequence. This encoding method allows the model to consider the relative positional information of the prefix words in the linear direction when processing the concatenated sequence. The introduction of these prefix words, especially in the context of image reconstruction, can compensate for the lack of sufficient reference information when the model generates the initial part of the image. One-dimensional rotational positional encoding adds positional features to the prefix words through periodic sine and cosine functions, enabling the model to distinguish different positions in the sequence, thereby processing the prefix words more accurately. Especially in the initial row or column of the image, these prefix words encoded with one-dimensional rotational positional encoding can carry coarse-grained information about the initial part of the image to assist in the generation and decoding of subsequent potential words, ensuring the smoothness and detail integrity of image reconstruction.
[0148] For multiple latent words from the first word sequence, this embodiment employs two-dimensional rotational position encoding (RoPE). Unlike one-dimensional RoPE, two-dimensional RoPE considers the two-dimensional layout of latent words in the image, i.e., their positions in rows and columns. This encoding method enhances the model's sensitivity to spatial location, especially when processing image patches, accurately capturing the relative positional relationships between these patches. By assigning sine and cosine positional features to latent words in two directions respectively, two-dimensional rotational position encoding enables the model to better understand and utilize the local interdependencies between image patches when generating or reconstructing images, thereby improving the quality of image reconstruction. It is particularly suitable for processing finer structures and details in images.
[0149] Through the aforementioned optional embodiments, this application achieves an efficient and accurate positional information embedding mechanism by implementing one-dimensional rotational position encoding on prefix words in the concatenated sequence and applying two-dimensional rotational position encoding to latent words obtained from image patches. This positional information embedding mechanism not only strengthens the model's understanding of the dependencies between words in the image sequence, but also enhances the spatial localization of prefix words, especially when processing the starting line of the image. One-dimensional RoPE enhances the spatial localization of prefix words, providing the model with additional contextual information and compensating for the lack of detail caused by insufficient information in the early stages of autoregressive model generation. Simultaneously, two-dimensional RoPE preserves the two-dimensional structural characteristics of latent words, helping the model to more naturally recover the geometric properties of the image during decoding, thereby improving the overall visual reconstruction quality. The combination of one-dimensional and two-dimensional RoPE encoding significantly optimizes the model's performance in image generation and reconstruction tasks, achieving enhanced precise positional awareness from local to global perspectives, and bringing more stable and higher-quality generation results to the field of image generation.
[0150] In an alternative embodiment, according to the model training method, in response to both the initial encoder and the initial decoder being in a thawed state, the initial encoder adopts a bidirectional attention mechanism, the initial decoder adopts a unidirectional attention mechanism, and / or, in response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, the target encoder adopts a bidirectional attention mechanism, and the intermediate decoder switches from a unidirectional attention mechanism to a bidirectional attention mechanism.
[0151] The initial encoder described above, as part of the image tagger in this embodiment, employs a bidirectional attention mechanism during the feature encoding stage. This mechanism allows each image patch to simultaneously reference preceding and following information during encoding, thereby capturing a more comprehensive contextual relationship. Based on this mechanism, the initial encoder can understand the features of each image patch from a global perspective, ensuring information integrity during the encoding process. The bidirectional attention mechanism is particularly suitable for use in the first stage of training in this embodiment, thereby enhancing mutual understanding between image patches and improving reconstruction accuracy and visual effects.
[0152] The initial decoder, as part of the image tagger, employs a unidirectional attention mechanism during the decoding phase. Unlike the bidirectional attention mechanism of the initial encoder, the unidirectional attention mechanism of the initial decoder ensures that information transmission during the decoding process follows the prediction order of the autoregressive model; that is, the reconstruction of each image patch depends only on the information of the preceding image patches. The introduction of the unidirectional attention mechanism enables the encoded word sequence to conform to the autoregressive characteristics of the decoder, reduces the incoherence in the generation process caused by bidirectional dependence, and lays the foundation for the efficient generation of the subsequent autoregressive model.
[0153] The target encoder described above is an encoder component that has undergone preliminary training and optimization. In the second stage of training in this embodiment, the model parameters of the target encoder are fixed, i.e., in a "frozen state." This means that the target encoder no longer updates its parameters, thereby ensuring the consistency of the encoding process and avoiding unnecessary interference with the encoding effect in subsequent training. Even in the frozen state, the target encoder can still encode image patches using a bidirectional attention mechanism, but its output will be used as a fixed input for the decoder, allowing for a greater focus on optimizing the decoding process.
[0154] In the second phase of training, the intermediate decoder switches from a unidirectional attention mechanism to a bidirectional attention mechanism. This switching scheme further optimizes the coherence and detail of image reconstruction, especially when processing the first row or other key areas of the image, utilizing richer contextual information to enhance the visual quality of the reconstruction. This attention mechanism switching scheme aims to combine the generation consistency advantage of unidirectional attention in the first phase of training with the enhanced detail and global understanding provided by bidirectional attention in the second phase, achieving a balance between high-quality image reconstruction and efficient generation.
[0155] Through the aforementioned optional embodiments, this application achieves fine-grained control over the encoding and decoding processes. In the first stage of training, the encoder employs a bidirectional attention mechanism while the decoder employs a unidirectional attention mechanism, ensuring information richness in the encoding stage and generation coherence in the decoding stage. In the second stage of training, by freezing the parameters of the target encoder, only the attention mechanism of the intermediate decoder is adjusted, switching the intermediate decoder from a unidirectional attention mechanism to a bidirectional attention mechanism. This attention mechanism switching strategy not only maintains the efficiency of the encoding process but also significantly improves the detail quality and coherence of image reconstruction. Therefore, the embodiments of this application greatly enhance the performance of the image reconstruction model based on the autoregressive model framework in high-resolution image generation tasks without sacrificing image reconstruction performance.
[0156] In an exemplary application scenario, based on the above model training method, the following is provided: Figure 3 This illustrates a two-stage model training process. (For example...) Figure 3 As shown, in the first training phase, a token encoder 301 and a causal token decoder 302 are initially trained, which can serve as preliminary image tokenizers. In the second training phase, the encoder and codebook trained in the first training phase are frozen, and an autoregressive image reconstruction model is further trained. Specifically, an image generator 303 and a bidirectional token decoder 304 are specifically trained. It should be noted that after the first training phase is completed, the encoder and codebook are frozen through a separation component 305 to isolate the first and second training phases.
[0157] In such Figure 3 The model training process shown mainly implements the following three technical concepts: First, a causal decoder architecture, which, through the constraint of the causal attention mechanism, makes the compression result of the encoder more consistent with unidirectional dependency and easier to be modeled by subsequent autoregressive models; Second, prefix lexical construction, which introduces additional reconstruction information by constructing prefix lexicals and, together with auxiliary loss, reduces the reconstruction difficulty of the first row of images; Third, a two-stage training method, which improves reconstruction performance while maintaining generative-friendly characteristics by freezing the encoder and codebook and retraining a bidirectional decoder.
[0158] like Figure 3As shown, to avoid bidirectional feature dependencies between encoded latent words, the aforementioned causal decoder architecture is proposed. The input training image is compressed and reconstructed into image blocks along the raster scan sequence, thereby generating a block word sequence. Furthermore, additional learnable latent words are introduced in the word encoder 301. When concatenating these latent words with the block word sequence, they are placed at the beginning of the concatenated sequence, with the number of latent words aligned with the number of autoregressive words. The aforementioned latent words and block word sequences are input into a Transformer network (encoder) with a bidirectional attention mechanism for encoding, obtaining a first encoding result. This first encoding result is then quantized to obtain a first quantization result. Further, the first quantization result is input into a Transformer network (decoder) with a causal attention mechanism in the causal word decoder 302 for image decoding and reconstruction, resulting in multiple first reconstructed image blocks. These multiple first reconstructed image blocks include first reconstructed image blocks in a preset region and other first reconstructed image blocks. An auxiliary loss, which is the mean squared error loss, is calculated based on the first reconstructed image blocks in the preset region. The first image reconstruction loss is calculated based on other first reconstructed image patches. The aforementioned auxiliary loss and first image reconstruction loss are used to adjust the model parameters of the lexical encoder 301 and the causal lexical decoder 302 during the first training phase.
[0159] With the causal decoder architecture described above, the decoding process and the autoregressive encoding reconstruction process in the image tagger can be well aligned in terms of the number of tokens and dependencies, which makes it easier for the encoded tokens to be modeled by the autoregressive model in subsequent stages.
[0160] like Figure 3 As shown, to effectively improve the image reconstruction quality of the first row, in the image generator 303 of the second training phase of this application embodiment, in addition to the second quantization result, prefix terms are introduced as an aid to the reconstruction of the first row. The introduced prefix terms carry coarse information from the first row to reduce the reconstruction difficulty of subsequent potential terms. For example, an additional 17 prefix terms can be introduced to assist in the reconstruction of the first 16 image patches. The first two prefix terms of the 17 prefix terms focus on reconstructing the first image patch, and the remaining 15 prefix terms correspond to one image patch respectively. Regarding the loss constraint, the first 16 image patches (including a copy of the first image patch) can be used as the ground truth labels of the prefix term decoding results, and MSE can be used to calculate the auxiliary loss.
[0161] Still as Figure 3As shown, in image generator 303, prefix terms and the second quantization result are input into a Transformer network (augmented reality) with a causal attention mechanism to generate an image reconstruction, and the cross-entropy loss is calculated based on the reconstruction result. The aforementioned cross-entropy loss is used to fine-tune the model parameters of image generator 303.
[0162] like Figure 3 As shown, in the second training phase, after freezing the encoder and codebook obtained in the first training phase, a Transformer network with a bidirectional attention mechanism can be retrained as the decoder, namely, the bidirectional lexical decoder 304, thereby improving the detail consistency and smoothness of the reconstruction results. In other words, in the second training phase, switching the lexical decoder from a unidirectional attention mechanism to a bidirectional attention mechanism can also introduce buffered lexical units, which are combined with the second quantization result for decoding calculation, thereby expanding the training data and increasing the training computation. Based on this, the buffered lexical units and the second quantization result are input into the bidirectional attention mechanism Transformer network (decoding) for image reconstruction, resulting in multiple second reconstructed image patches. Further, a second image reconstruction loss is calculated based on these multiple second reconstructed image patches. The aforementioned second image reconstruction loss is used to fine-tune the model parameters of the bidirectional lexical decoder 304.
[0163] It should be noted that when calculating the second image reconstruction loss, the auxiliary loss for prefix words can be discarded so that the decoder can focus more on improving the reconstruction quality and detail consistency of the main image patches.
[0164] In the field of autoregressive visual generation, the core task of the model is to predict subsequent terms based on previous terms. However, the encoded terms formed by traditional image taggers during compression exhibit bidirectional dependencies, which contradicts the unidirectional sequential characteristic required by autoregressive models, resulting in low modeling accuracy and efficiency. Existing solutions mostly focus on enhancing the global understanding ability of the autoregressive model itself, such as introducing bidirectional attention mechanisms or global modeling strategies, to improve the quality of visual generation. However, these existing solutions inevitably increase the complexity of the generation process and are still difficult to integrate with autoregressive visual generation, making it difficult to achieve multimodal integration in image reconstruction and generation scenarios.
[0165] However, based on the aforementioned optional embodiments and exemplary application scenarios, this application does not focus on modifying the autoregressive model, but rather designs image lexical representations that better align with unidirectional dependencies. First, this application proposes an image tagger framework, primarily comprising an integrated causal decoder. By suppressing non-causality, it encourages encoded lexical representations to form forward dependency chains in the sequence, thus highly aligning with the modeling strategy of the autoregressive model and simplifying its modeling difficulty. Second, addressing the reconstruction challenge of the first row of an image due to insufficient leading information, this application introduces prefix lexical representations and corresponding auxiliary losses as additional semantic carriers, significantly improving the reconstruction accuracy of this specific part (such as the first row of the image) and ensuring a smooth transition from coarse to fine in the generation process. Finally, this application designs a two-stage training process. In the first training stage, the image tagger produces lexical representations beneficial for image reconstruction. Subsequently, while keeping the encoder and codebook unchanged, the decoder undergoes secondary training, shifting from a unidirectional attention mechanism to a bidirectional attention mechanism to further optimize the reconstruction effect. This achieves simultaneous training and optimization of generation and reconstruction performance, thereby improving generation efficiency while ensuring high-quality output of visual reconstruction.
[0166] As can be seen from the above, this application proposes a technical concept of using a causal decoder to constrain the unidirectionality of encoded terms, a technical concept of image reconstruction performance compensation based on prefix terms, and a two-stage training mechanism for the decoder. Based on this, this application can provide an efficient joint encoding method for image reconstruction models based on a visual autoregressive framework in application scenarios, and provide a two-stage joint training strategy for multimodal unified generative understanding.
[0167] In the aforementioned operating environment, this application also provides, as follows: Figure 4 This illustrates a data processing method. Figure 4 This is a flowchart of a data processing method according to an embodiment of this application, such as... Figure 4 As shown, the data processing method includes:
[0168] Step S401: Obtain the input image;
[0169] Step S402: The input image is reconstructed using a target image reconstruction model to obtain a reconstructed image;
[0170] The target image reconstruction model is generated according to any of the above model training methods.
[0171] The input image can be any image that the user or application wishes to reconstruct or further manipulate. Input images can originate from various scenarios, such as old photos that a user wants to restore, artwork that a designer needs to style, or high-resolution image clips that need to be reconstructed at different scales. Input images can be of any size and format. In particular, to adapt to the trained target image reconstruction model, the input image can be preprocessed to resize it to a specific resolution, convert it to a tensor format readable by the model, etc.
[0172] In the application of the target image reconstruction model, the input image is fed into the pre-trained model for processing. The model generates and decodes the first and second word sequences corresponding to the input image, thereby progressively reconstructing the image. Specifically, the target image reconstruction model decodes the first and second word sequences corresponding to the input image to recover image patches. The latent words in the second word sequence are used to reconstruct the main parts of the image, while multiple prefix words in the second word sequence are used to assist in reconstructing details in preset regions of the image, such as the starting row, to improve the image reconstruction quality in these preset regions. For example, the above decoding process can follow the raster scan order. By progressively decoding the word sequences, the target image reconstruction model can generate a reconstructed image with a high degree of similarity to the input image, thus completing the transformation from input to a high-quality reconstructed image.
[0173] The image reconstruction process based on the target image reconstruction model described above not only demonstrates the model's powerful generation capabilities, but also showcases the model's advantages in processing image details and improving reconstruction efficiency. The final reconstructed image retains the key features of the input image and may have been enhanced or repaired in some aspects, achieving simultaneous improvement in image quality and content.
[0174] In an optional embodiment, the target image reconstruction model includes a target encoder and a target decoder. In step S402, the target image reconstruction model is used to reconstruct the input image to obtain a reconstructed image, including the following method steps:
[0175] Step S421: The input image is processed by a target encoder to obtain a visual sequence, and a preset codebook is queried based on the visual sequence to obtain a continuous vector;
[0176] Step S422: Use a target decoder to perform feature decoding on the continuous vectors to obtain the reconstructed image.
[0177] In the above optional embodiments, the target image reconstruction model, after training and used for image reconstruction, includes a target encoder and a target decoder. In practical applications, when encountering image reconstruction needs such as image inpainting, style transfer, or upgrading a high-resolution image from a low-resolution version, the target image reconstruction model can achieve high-precision and efficient image reconstruction.
[0178] The input image is processed by a target encoder to perform feature encoding, and the resulting visual sequence can be a discrete sequence. A preset codebook is then queried based on this discrete visual sequence to obtain a continuous vector.
[0179] First, the input image is fed into a target encoder, which performs feature encoding processing, converting the input image into a series of discrete visual sequences. These discrete visual sequences can be abstract representations of image features, compressing the spatial structure information of the image into a low-dimensional space for easier model understanding and processing. Subsequently, based on the generated discrete visual sequences, the target encoder queries a pre-defined codebook to find the best-matching code, resulting in a set of continuous vectors. This codebook query process may involve quantization techniques, mapping the discrete visual sequences to specific locations within the codebook. Step S421, described above, implements the conversion from an image to an operable mathematical representation, representing a crucial intermediate step in the image reconstruction process.
[0180] Furthermore, the obtained continuous vectors are fed to the target decoder for feature decoding. The target decoder's task is to transform these continuous vectors back into image space, recovering the original details and structure of the image and generating a reconstructed image. In the decoding stage described above, the target decoder utilizes the learned mapping relationships to progressively decode the abstract feature representations (i.e., continuous vectors), ultimately stitching them together to form a complete image, thus obtaining the reconstructed image. Through this decoding method, even when processing highly complex or high-resolution images, the target image reconstruction model can maintain efficient reconstruction speed and achieve high-quality reconstruction results.
[0181] The image reconstruction method based on the target encoder and target decoder described above demonstrates the powerful capabilities of deep learning technology in image reconstruction tasks. Through the encoding and decoding mechanism, the target image reconstruction model can not only understand the internal structure of the image, but also accurately reproduce these internal structural details during reconstruction, thus meeting the application needs of various image processing and generation.
[0182] In this embodiment, the target compression model is trained according to any of the above-mentioned model training methods. In these methods, on the one hand, the training image is divided into multiple image blocks, and each image block is converted into a block-based word sequence. This allows the trained target image reconstruction model to process local image features more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (e.g., the top region of the image) to assist in reconstructing image blocks within that region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks within a preset region. This allows for faster and more accurate capture of details, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves high-precision and high-efficiency image reconstruction based on the input image by using the target compression model, thus improving the accuracy and efficiency of image reconstruction based on the input image and solving the technical problem of low accuracy and efficiency in related technologies.
[0183] It should be noted that the preferred embodiments of steps S401 to S402 described above can be found in the foregoing description, and will not be repeated here.
[0184] In the aforementioned operating environment, this application also provides, as follows: Figure 5 Another data processing method is shown. Figure 5 This is a flowchart of another data processing method according to an embodiment of this application, such as... Figure 5 As shown, the data processing method includes:
[0185] Step S501: Obtain the product image to be reconstructed;
[0186] Step S502: Use the target image reconstruction model to reconstruct the product image to be reconstructed, and obtain the reconstructed product image;
[0187] The target image reconstruction model is generated according to any of the above model training methods.
[0188] The content displayed in the aforementioned product image to be reconstructed may include a specific product. The product image to be reconstructed can be of any size and format. In particular, in order to adapt to the trained target image reconstruction model, the product image to be reconstructed can be preprocessed to adjust the product image to a specific resolution, convert it into a tensor format that the model can read, etc.
[0189] In the application of the target image reconstruction model, the product image to be reconstructed is fed into the pre-trained target image reconstruction model for processing. The model generates and decodes the first and second word sequences corresponding to the product image to be reconstructed, thereby progressively reconstructing the product image. Specifically, the target image reconstruction model decodes the first and second word sequences corresponding to the product image to be reconstructed to recover image patches. The latent words in the second word sequence are used to reconstruct the main parts of the reconstructed product image, while multiple prefix words in the second word sequence are used to assist in the details of preset regions in the reconstructed product image, such as the starting row of the image, to improve the image reconstruction quality in these preset regions. For example, the above decoding process can follow the raster scan order. By progressively decoding the word sequences, the target image reconstruction model can generate a reconstructed product image with a very high similarity to the product image to be reconstructed, thus completing the transformation from input to a high-quality reconstructed product image.
[0190] The image reconstruction process based on the target image reconstruction model described above not only demonstrates the model's powerful generation capabilities, but also showcases the model's advantages in processing image details and improving reconstruction efficiency. The final reconstructed product image retains the key features of the product image to be reconstructed, and may also be enhanced or repaired in some aspects, achieving simultaneous improvement in image quality and content.
[0191] In this embodiment, the target compression model is trained according to any of the above-mentioned model training methods. In these methods, on the one hand, the training image is divided into multiple image blocks, and each image block is converted into a block-based word sequence. This allows the trained target image reconstruction model to process local image features more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (e.g., the top region of the image) to assist in reconstructing image blocks within that region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks within a preset region. This allows for faster and more accurate capture of details, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves high-precision and high-efficiency image reconstruction based on the input image by using the target compression model, thus improving the accuracy and efficiency of image reconstruction based on the input image and solving the technical problem of low accuracy and efficiency in related technologies.
[0192] It should be noted that the preferred embodiments of steps S501 to S502 described above can be found in the foregoing descriptions, and will not be repeated here.
[0193] In the aforementioned operating environment, this application also provides, as follows: Figure 6 This is another data processing method shown. Figure 6 This is a flowchart of another data processing method according to an embodiment of this application, such as... Figure 6 As shown, the data processing method includes:
[0194] Step S601: Obtain a data processing request through the first application programming interface, wherein the request data carried in the data processing request includes: an input image;
[0195] Step S602: Return a data processing response through the second application programming interface. The response data carried in the data processing response includes: a reconstructed image, which is obtained by reconstructing the input image using a target image reconstruction model.
[0196] The target image reconstruction model described above is generated according to any of the model training methods mentioned above.
[0197] The data processing method described in this application embodiment can run on a cloud server to provide cloud data processing services to clients. The client sends a data processing request by calling a first application programming interface (API). After obtaining the data processing request through the first API, the cloud server generates a reconstructed image according to the data processing method and further returns the reconstructed image to the client through a second API.
[0198] The first and second application programming interfaces (APIs) mentioned above can be the same or different APIs. In one optional embodiment, the interface parameters in the first and second APIs may include, but are not limited to: a global interface identifier, an interface signing key, an interface timestamp, an interface request identifier, and a system call credential identifier. The first API can use a GET request or a POST request as the interface request method to obtain a file processing request. The second API can use a lightweight data exchange format (such as JavaScript Object Notation, or JSON for short) to return a file processing response.
[0199] In this embodiment, the target compression model is trained according to any of the above-mentioned model training methods. In these methods, on the one hand, the training image is divided into multiple image blocks, and each image block is converted into a block-based word sequence. This allows the trained target image reconstruction model to process local image features more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (e.g., the top region of the image) to assist in reconstructing image blocks within that region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks within a preset region. This allows for faster and more accurate capture of details, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves high-precision and high-efficiency image reconstruction based on the input image by using the target compression model, thus improving the accuracy and efficiency of image reconstruction based on the input image and solving the technical problem of low accuracy and efficiency in related technologies.
[0200] It should be noted that the preferred embodiments of steps S601 to S602 described above can be found in the foregoing description, and will not be repeated here.
[0201] In the aforementioned operating environment, this application also provides, as follows: Figure 7 This is another data processing method shown. Figure 7 This is a flowchart of another data processing method according to an embodiment of this application, such as... Figure 7 As shown, the data processing method includes:
[0202] Step S701: Obtain the currently input data processing dialogue request, wherein the request data carried in the data processing dialogue request includes: input image;
[0203] Step S702: In response to the data processing dialogue request, a data processing dialogue response is returned, wherein the information carried in the data processing dialogue response includes: the reconstructed image, which is obtained by reconstructing the input image using a target image reconstruction model;
[0204] Step S703: Display the reconstructed image within the graphical user interface.
[0205] The target image reconstruction model described above is generated according to any of the model training methods mentioned above.
[0206] Based on the above method steps, a visualization scheme for data processing functions is provided. The terminal device provides a graphical user interface (GUI), which displays at least a data processing scenario. The GUI's display content also includes input components (such as text input boxes, voice input controls, etc.) and output components (such as text display windows, image display windows, audio playback windows, etc.). The user inputs a data processing dialog request through the input components to specify the input image for the data processing task. After detecting the user's input, the input image is reconstructed using a target image reconstruction model to obtain a reconstructed image. Furthermore, the reconstructed image is displayed through the output components within the GUI.
[0207] In this embodiment, the target compression model is trained according to any of the above-mentioned model training methods. In these methods, on the one hand, the training image is divided into multiple image blocks, and each image block is converted into a block-based word sequence. This allows the trained target image reconstruction model to process local image features more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (e.g., the top region of the image) to assist in reconstructing image blocks within that region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks within a preset region. This allows for faster and more accurate capture of details, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves high-precision and high-efficiency image reconstruction based on the input image by using the target compression model, thus improving the accuracy and efficiency of image reconstruction based on the input image and solving the technical problem of low accuracy and efficiency in related technologies.
[0208] It should be noted that the preferred embodiments of steps S701 to S703 described above can be found in the foregoing descriptions, and will not be repeated here.
[0209] In the aforementioned operating environment, this application also provides, as follows: Figure 8 This is another data processing method shown. Figure 8 This is a flowchart of another data processing method according to an embodiment of this application, such as... Figure 8 As shown, the data processing method includes:
[0210] Step S801: In response to the input command applied to the operation interface, display the input image on the operation interface;
[0211] Step S802: In response to the processing command applied to the operation interface, the reconstructed image is displayed on the operation interface. The reconstructed image is obtained by reconstructing the input image using the target image reconstruction model.
[0212] The target image reconstruction model described above is generated according to any of the model training methods mentioned above.
[0213] The data processing method provided in this application embodiment can utilize the aforementioned target image reconstruction model to implement a visualized data processing scheme, facilitating human-computer interaction. Users upload input images by triggering input commands on the operation interface. Further, users trigger processing commands on the operation interface, instructing the system to drive the target image reconstruction model to reconstruct the input image according to the aforementioned data processing method, obtaining a reconstructed image. Further, the system displays the reconstructed image within the operation interface for the user.
[0214] In this embodiment, the target compression model is trained according to any of the above-mentioned model training methods. In these methods, on the one hand, the training image is divided into multiple image blocks, and each image block is converted into a block-based word sequence. This allows the trained target image reconstruction model to process local image features more meticulously, improving reconstruction accuracy. On the other hand, prefix words and latent words are introduced. Prefix words provide additional information about a preset region (e.g., the top region of the image) to assist in reconstructing image blocks within that region, while latent words are generated based on the features of the image blocks. By combining prefix words and latent words, the trained target image reconstruction model can better understand the structure and content of the image during image reconstruction, especially when reconstructing image blocks within a preset region. This allows for faster and more accurate capture of details, thereby improving the overall accuracy and efficiency of image reconstruction. In other words, this embodiment achieves high-precision and high-efficiency image reconstruction based on the input image by using the target compression model, thus improving the accuracy and efficiency of image reconstruction based on the input image and solving the technical problem of low accuracy and efficiency in related technologies.
[0215] It should be noted that the preferred embodiments of steps S801 to S802 described above can be found in the foregoing description, and will not be repeated here.
[0216] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0217] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM), random access memory (RAM), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0218] According to an embodiment of this application, an apparatus embodiment for implementing the above-described model training method is also provided. Figure 9 This is a schematic diagram of a model training device according to an embodiment of this application, as shown below. Figure 9 As shown, the device includes: an acquisition module 901 for acquiring training images; a generation module 902 for generating a first word sequence and a second word sequence corresponding to the training images, wherein the first word sequence includes: a block word sequence corresponding to multiple image blocks, the multiple image blocks being obtained by image segmentation processing of the training images; the second word sequence includes: multiple prefix words and multiple latent words corresponding to the first word sequence, the multiple prefix words being used to assist in reconstructing image blocks within a preset region in the training images; and a training module 903 for training an initial image reconstruction model based on the first word sequence and the second word sequence to obtain a target image reconstruction model, wherein the target image reconstruction model is used to reconstruct the target image to obtain the reconstruction result.
[0219] Optionally, in the above model training device, the image blocks within the preset area include: image blocks obtained by segmenting the top region of the image, and the number of prefix words is determined based on the number of image blocks obtained by segmenting the top region of the image.
[0220] Optionally, the generation module 902 is further configured to: perform image segmentation processing on the training image to obtain multiple non-overlapping image blocks; perform linear projection on the multiple image blocks based on a preset number of channels and a preset image block size to obtain a first word sequence; and generate a second word sequence using multiple prefix words and multiple latent words corresponding to the first word sequence.
[0221] Optionally, the initial image reconstruction model includes an initial encoder and an initial decoder. The training module 903 is further configured to: concatenate the first word sequence and the second word sequence to obtain a concatenated sequence; adjust the model parameters of the initial encoder based on the concatenated sequence to obtain a target encoder, and adjust the model parameters of the initial decoder based on the concatenated sequence to obtain an intermediate decoder, in response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state; adjust the model parameters of the intermediate decoder based on the concatenated sequence to generate a target decoder; and determine the target image reconstruction model using the target encoder and the target decoder.
[0222] Optionally, the training module 903 is further configured to: perform feature encoding processing on the concatenated sequence using an initial encoder to obtain a first encoding result, wherein the first encoding result includes: encoded latent words obtained through feature encoding processing of the initial encoder; perform quantization processing on the first encoding result to obtain a first quantization result; perform feature decoding processing on the first quantization result along the raster scanning sequence using an initial decoder to obtain multiple first reconstructed image blocks; and adjust the model parameters of the initial encoder based on the multiple first reconstructed image blocks to obtain a target encoder.
[0223] Optionally, the training module 903 is further configured to: determine a first image reconstruction loss and an auxiliary loss based on multiple first reconstructed image patches, wherein the auxiliary loss is used to represent the reconstruction loss of the image patch within a preset region; and adjust the model parameters of the initial encoder using the first image reconstruction loss and the auxiliary loss to obtain the target encoder.
[0224] Optionally, the training module 903 is further configured to: respond to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, perform feature encoding processing on the concatenated sequence using the target encoder to obtain a second encoding result, wherein the second encoding result includes: encoded latent words obtained through feature encoding processing of the target encoder; perform quantization processing on the second encoding result to obtain a second quantization result; introduce multiple cached words into the second quantization result to obtain an expanded quantization result; use the intermediate decoder to perform feature decoding processing on the expanded quantization result along the raster scanning sequence to obtain multiple second reconstructed image blocks; adjust the model parameters of the intermediate decoder based on the multiple second reconstructed image blocks to generate the target decoder.
[0225] Optionally, the training module 903 is further configured to: determine a second image reconstruction loss based on multiple second reconstructed image patches; and adjust the model parameters of the intermediate decoder using the second image reconstruction loss to generate a target decoder.
[0226] Optionally, in the above-mentioned model training device, one-dimensional rotational position encoding is used for multiple prefix words in the concatenated sequence, and two-dimensional rotational position encoding is used for multiple potential words corresponding to the first word sequence.
[0227] Optionally, in the above model training device, in response to both the initial encoder and the initial decoder being in a thawed state, the initial encoder adopts a bidirectional attention mechanism, the initial decoder adopts a unidirectional attention mechanism, and / or, in response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, the target encoder adopts a bidirectional attention mechanism, and the intermediate decoder switches from a unidirectional attention mechanism to a bidirectional attention mechanism.
[0228] It should be noted that the above-mentioned acquisition module 901, generation module 902 and training module 903 correspond to steps S202 to S206 in the embodiment. The three modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiment.
[0229] According to an embodiment of this application, an apparatus embodiment for implementing the above-described data processing method is also provided. Figure 10 This is a schematic diagram of the structure of a data processing apparatus according to an embodiment of this application, such as... Figure 10 As shown, the device includes: an acquisition module 1001 for acquiring an input image; and a reconstruction module 1002 for reconstructing the input image using a target image reconstruction model to obtain a reconstructed image; wherein the target image reconstruction model is generated according to any of the above-mentioned model training methods.
[0230] Optionally, the target image reconstruction model includes a target encoder and a target decoder. The reconstruction module 1002 is further used to: use the target encoder to perform feature encoding processing on the input image to obtain a visual sequence, and query a preset codebook based on the visual sequence to obtain a continuous vector; use the target decoder to perform feature decoding processing on the continuous vector to obtain a reconstructed image.
[0231] It should be noted here that the above-mentioned acquisition module 1001 and reconstruction module 1002 correspond to steps S401 to S402 in the embodiment. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiment.
[0232] According to an embodiment of this application, another embodiment of an apparatus for implementing the above-described data processing method is also provided. Figure 11 This is a schematic diagram of another data processing apparatus according to an embodiment of this application, such as... Figure 11 As shown, the device includes: an acquisition module 1101 for acquiring a product image to be reconstructed; and a reconstruction module 1102 for reconstructing the product image to be reconstructed using a target image reconstruction model to obtain a reconstructed product image; wherein the target image reconstruction model is generated according to any of the above-mentioned model training methods.
[0233] It should be noted that the acquisition module 1101 and reconstruction module 1102 mentioned above correspond to steps S501 to S502 in the embodiments. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiments.
[0234] According to an embodiment of this application, another embodiment of an apparatus for implementing the above-described data processing method is also provided. Figure 12 This is a schematic diagram of the structure of another data processing apparatus according to an embodiment of this application, such as... Figure 12 As shown, the device includes: a request module 1201, used to obtain a data processing request through a first application programming interface, wherein the request data carried in the data processing request includes: an input image; and a response module 1202, used to return a data processing response through a second application programming interface, wherein the response data carried in the data processing response includes: a reconstructed image, wherein the reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to any of the above-mentioned model training methods.
[0235] It should be noted that the above-mentioned request module 1201 and response module 1202 correspond to steps S601 to S602 in the embodiment. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiment.
[0236] According to an embodiment of this application, another embodiment of an apparatus for implementing the above-described data processing method is also provided. Figure 13 This is a schematic diagram of the structure of another data processing apparatus according to an embodiment of this application, such as... Figure 13 As shown, the device includes: an acquisition module 1301, used to acquire a currently input data processing dialogue request, wherein the request data carried in the data processing dialogue request includes: an input image; a response module 1302, used to respond to the data processing dialogue request and return a data processing dialogue response, wherein the information carried in the data processing dialogue response includes: a reconstructed image, which is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to any of the above model training methods; and a display module 1303, used to display the reconstructed image within a graphical user interface.
[0237] It should be noted that the above-mentioned acquisition module 1301, response module 1302 and display module 1303 correspond to steps S701 to S703 in the embodiment. The three modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiment.
[0238] According to an embodiment of this application, another embodiment of an apparatus for implementing the above-described data processing method is also provided. Figure 14 Figure x3 shows a schematic diagram of another data processing device according to an embodiment of this application. The device includes: a first response module 1401, used to respond to an input command applied to the operation interface and display an input image on the operation interface; and a second response module 1402, used to respond to a processing command applied to the operation interface and display a reconstructed image on the operation interface. The reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to any of the above-mentioned model training methods.
[0239] It should be noted here that the first response module 1401 and the second response module 1402 mentioned above correspond to steps S801 to S802 in the embodiments. The two modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the foregoing embodiments.
[0240] It should be noted that the above-mentioned modules or units may be hardware or software components stored in memory and processed by one or more processors. The above-mentioned modules may also be part of a device and run in a computer terminal.
[0241] It should be noted that the preferred implementation of this embodiment can be found in the relevant descriptions of the foregoing embodiments, and will not be repeated here.
[0242] It should be noted that the preferred embodiments involved in the above embodiments of this application are the same as the solutions, application scenarios and implementation processes provided in the above embodiments, but are not limited to the solutions provided in the above embodiments.
[0243] Embodiments of this application may provide a data processing system, including: a client for sending input images;
[0244] The server connects to the client and is used to reconstruct the input image using a target image reconstruction model to obtain the reconstructed image; the client is also used to output the reconstructed image; wherein, the target image reconstruction model is generated according to any of the above-mentioned model training methods.
[0245] Embodiments of this application may provide an electronic device, including: a memory storing an executable program; and a processor for running the program, wherein the program executes any of the aforementioned model training methods or data processing methods during runtime.
[0246] Figure 15 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 15 As shown, the electronic device 150 may include: one or more (only one is shown in the figure) processors 152, memory 154, memory controller, and peripheral interfaces.
[0247] The aforementioned electronic device can be understood as an integrated smart terminal, including but not limited to servers, desktop computers, personal computers (PCs), all-in-one model machines, etc., and the electronic device may have the model described in the above embodiments of this application pre-installed.
[0248] Specifically, this electronic device can pre-install various types of models, including but not limited to models in natural language processing, visual processing, speech processing, code processing, and multimodal task processing, thus providing diverse model selection. In different product forms, this electronic device can support one or more model usage methods, including but not limited to model training, model invocation, model fine-tuning, model deployment, model inference, and application. In some product forms, this electronic device also supports model management, including but not limited to multi-type model management (supporting the management of discriminative, generative, and other model types), model version control (supporting the control of different model versions), and model evaluation (evaluating model performance and effectiveness based on model evaluation tools). In other product forms, this electronic device can also create applications based on models, providing Application Programming Interface (API) invocation capabilities. Models can be invoked into the created applications through the API interface, and application management tools are provided to manage and monitor the applications.
[0249] Furthermore, the electronic device may also include data management (supporting the creation and management of model tuning datasets), a training center (providing rich training resources to help users learn and master artificial intelligence (AI) technology), and basic control capabilities (providing enterprise-level basic control capabilities to ensure the security and efficient operation of the system). Through the above functions, it provides a comprehensive and integrated device for AI development, training, deployment, and application.
[0250] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the model training method, data processing method, model training device, and data processing device in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the model training method or data processing method in the above embodiments. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to terminal A via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0251] The processor can invoke the executable program stored in the memory through the transmission device to execute any of the model training methods or data processing methods described in the above embodiments.
[0252] Those skilled in the art will understand that, Figure 15 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, and mobile internet devices (MIDs) and other terminal devices. Figure 15 This does not limit the structure of the aforementioned electronic device. For example, electronic device 150 may also include components that are more... Figure 15 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 15 The different configurations shown.
[0253] Those skilled in the art will understand that all or part of the steps in the various model training methods or data processing methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0254] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium includes a stored executable program, wherein, when the executable program runs, it controls the device where the computer-readable storage medium is located to execute any of the aforementioned model training methods or data processing methods.
[0255] Optionally, in this embodiment, the storage medium may be located in an electronic device.
[0256] Optionally, in this embodiment, the computer-readable storage medium is configured to store an executable program, which, when the executable program is running, controls the device where the computer-readable storage medium is located to execute any of the model training methods or data processing methods described in the above embodiments.
[0257] Embodiments of this application also provide a computer program product. Optionally, in this embodiment, the computer program product may include a computer program that, when executed by a processor, implements the model training method or data processing method provided in the above embodiments.
[0258] Embodiments of this application also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which can be used to store a computer program. When the computer program is executed by a processor, it implements the model training method or data processing method provided in the above embodiments.
[0259] Embodiments of this application also provide a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, it implements the model training method or data processing method provided in the above embodiments.
[0260] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0261] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0262] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0263] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0264] If the aforementioned integrated units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the model training method or data processing method described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, ROM, RAM, portable hard drives, magnetic disks, or optical disks.
[0265] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A model training method, characterized in that, include: Acquire training images; Generate a first word sequence and a second word sequence corresponding to the training image, wherein the first word sequence includes: a block word sequence corresponding to multiple image blocks, the multiple image blocks being obtained by image segmentation processing of the training image; the second word sequence includes: multiple prefix words and multiple latent words corresponding to the first word sequence, the multiple prefix words being used to assist in reconstructing image blocks within a preset region in the training image; The initial image reconstruction model is trained based on the first lexical sequence and the second lexical sequence to obtain the target image reconstruction model, wherein the target image reconstruction model is used to reconstruct the target image to obtain the reconstruction result.
2. The model training method according to claim 1, characterized in that, The image blocks within the preset area include: image blocks obtained by segmenting the top region of the image, and the number of prefix words is determined based on the number of image blocks obtained by segmenting the top region of the image.
3. The model training method according to claim 1, characterized in that, Generating the first word sequence and the second word sequence corresponding to the training image includes: The training images are segmented to obtain the multiple non-overlapping image patches; The first word sequence is obtained by linearly projecting the multiple image blocks based on a preset number of channels and a preset image block size. The second word sequence is generated by using the plurality of prefix words and the plurality of potential words corresponding to the first word sequence.
4. The model training method according to claim 1, characterized in that, The initial image reconstruction model includes an initial encoder and an initial decoder. The initial image reconstruction model is trained based on the first lexical sequence and the second lexical sequence. Generating the target image reconstruction model includes: The first word sequence and the second word sequence are concatenated to obtain a concatenated sequence. In response to both the initial encoder and the initial decoder being in a thawed state, the model parameters of the initial encoder are adjusted based on the splicing sequence to obtain the target encoder, and the model parameters of the initial decoder are adjusted based on the splicing sequence to obtain the intermediate decoder. In response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, the model parameters of the intermediate decoder are adjusted based on the splicing sequence to generate the target decoder; The target image reconstruction model is determined using the target encoder and the target decoder.
5. The model training method according to claim 4, characterized in that, The process of adjusting the model parameters of the initial encoder based on the spliced sequence to generate the target encoder includes: The concatenated sequence is subjected to feature encoding processing using the initial encoder to obtain a first encoding result, wherein the first encoding result includes: encoded latent words obtained through feature encoding processing by the initial encoder; The first encoding result is quantized to obtain the first quantization result; Using the initial decoder, the first quantization result is processed by feature decoding along the grating scanning sequence to obtain multiple first reconstructed image blocks; The model parameters of the initial encoder are adjusted based on the plurality of first reconstructed image blocks to generate the target encoder.
6. The model training method according to claim 5, characterized in that, The target encoder is generated by adjusting the model parameters of the initial encoder based on the plurality of first reconstructed image patches, including: A first image reconstruction loss and an auxiliary loss are determined based on the plurality of first reconstructed image blocks, wherein the auxiliary loss is used to represent the reconstruction loss of the image blocks within the preset region; The model parameters of the initial encoder are adjusted using the first image reconstruction loss and the auxiliary loss to generate the target encoder.
7. The model training method according to claim 4, characterized in that, The process of adjusting the model parameters of the intermediate decoder based on the concatenated sequence to generate the target decoder includes: The concatenated sequence is subjected to feature encoding processing using the target encoder to obtain a second encoding result, wherein the second encoding result includes: encoded latent words obtained through feature encoding processing by the target encoder; The second encoding result is quantized to obtain the second quantization result; Multiple cached terms are introduced into the second quantization result to obtain the expanded quantization result; Using the intermediate decoder, the augmented quantization result is subjected to feature decoding processing along the grating scanning sequence to obtain multiple second reconstructed image blocks; The model parameters of the intermediate decoder are adjusted based on the multiple second reconstructed image blocks to generate the target decoder.
8. The model training method according to claim 7, characterized in that, The model parameters of the intermediate decoder are adjusted based on the plurality of second reconstructed image patches to generate the target decoder, including: The second image reconstruction loss is determined based on the plurality of second reconstructed image blocks; The model parameters of the intermediate decoder are adjusted using the second image reconstruction loss to generate the target decoder.
9. The model training method according to claim 5 or 7, characterized in that, In the concatenated sequence, one-dimensional rotational position encoding is used for the plurality of prefix words, and two-dimensional rotational position encoding is used for the plurality of potential words corresponding to the first word sequence.
10. The model training method according to claim 4, characterized in that, In response to both the initial encoder and the initial decoder being in a thawed state, the initial encoder employs a bidirectional attention mechanism, the initial decoder employs a unidirectional attention mechanism, and / or, in response to the target encoder being in a frozen state and the intermediate decoder being in a thawed state, the target encoder employs the bidirectional attention mechanism, and the intermediate decoder switches from the unidirectional attention mechanism to the bidirectional attention mechanism.
11. A data processing method, characterized in that, include: Obtain the input image; The input image is reconstructed using a target image reconstruction model to obtain the reconstructed image; The target image reconstruction model is generated according to the model training method described in any one of claims 1 to 10.
12. The data processing method according to claim 11, characterized in that, The target image reconstruction model includes a target encoder and a target decoder. The target image reconstruction model is used to reconstruct the input image to obtain the reconstructed image, which includes: The target encoder is used to perform feature encoding processing on the input image to obtain a visual sequence, and a preset codebook is queried based on the visual sequence to obtain a continuous vector; The target decoder is used to perform feature decoding processing on the continuous vectors to obtain the reconstructed image.
13. A data processing method, characterized in that, include: Obtain the product image to be reconstructed; The target image reconstruction model is used to reconstruct the product image to be reconstructed, and the reconstructed product image is obtained. The target image reconstruction model is generated according to the model training method described in any one of claims 1 to 10.
14. A data processing method, characterized in that, include: A data processing request is obtained through a first application programming interface, wherein the request data carried in the data processing request includes: an input image; The data processing response is returned through the second application programming interface, wherein the response data carried in the data processing response includes: a reconstructed image, which is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to the model training method of any one of claims 1 to 10.
15. A data processing method, characterized in that, include: Obtain the currently input data processing dialogue request, wherein the request data carried in the data processing dialogue request includes: input image; In response to the data processing dialogue request, a data processing dialogue response is returned, wherein the information carried in the data processing dialogue response includes: a reconstructed image, wherein the reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to the model training method described in any one of claims 1 to 10; The reconstructed image is displayed within a graphical user interface.
16. A data processing method, characterized in that, include: In response to input commands applied to the user interface, the input image is displayed on the user interface; In response to processing instructions applied to the user interface, a reconstructed image is displayed on the user interface. The reconstructed image is obtained by reconstructing the input image using a target image reconstruction model, and the target image reconstruction model is generated according to the model training method described in any one of claims 1 to 10.
17. A data processing system, characterized in that, include: The client is used to send the input image; The server, connected to the client, is used to reconstruct the input image using a target image reconstruction model to obtain a reconstructed image. The client is also used to output the reconstructed image; The target image reconstruction model is generated according to the model training method described in any one of claims 1 to 10.
18. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the model training method according to any one of claims 1 to 10 or the data processing method according to any one of claims 11 to 16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the model training method of any one of claims 1 to 10 or the data processing method of any one of claims 11 to 16.
20. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the model training method of any one of claims 1 to 10 or the data processing method of any one of claims 11 to 16.
