Pre-training method and device of visual large model and electronic equipment

By introducing a position prediction module into the encoder output position of the large visual model and combining reconstruction and position prediction losses, the problem of the MAE model ignoring spatial structure is solved, the performance of the model in object detection and image segmentation tasks is improved, and the training efficiency is optimized.

CN118917378AActive Publication Date: 2024-11-08BEIJING ACAD OF ARTIFICIAL INTELLLIGENCE
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411397473.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2024-11-08
Estimated Expiration
2044-10-09

AI Technical Summary

Technical Problem

Existing Masked Autoencoders (MAE) models neglect the spatial structure information of images during large-scale visual model pre-training, resulting in an inability to fully learn the position and layout of objects, which affects the performance of visual tasks such as object detection and image segmentation.

Method used

A position prediction module is introduced into the encoder output position of the standard large vision model. By combining the reconstruction loss and the position prediction loss through the total loss function, the pre-training process of the large vision model is optimized, enabling the model to focus on both the content and structure of the image.

Benefits of technology

It improves the model's generalization ability and its ability to model and understand location information, enhances its performance in computer vision tasks, especially in object detection and image segmentation, and optimizes training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917378A_ABST
    Figure CN118917378A_ABST
Patent Text Reader

Abstract

The invention discloses a pre-training method and device for a visual large model and electronic equipment, and belongs to the technical field of artificial intelligence. The pre-training method comprises the following steps: acquiring an unlabeled image, and performing fragmentation and shielding fragmentation processing to obtain a shielding processing image; pre-training the improved visual large model by taking the total loss # imgabs0 # as an optimization target based on the shielding processing image; the improved visual large model is obtained by introducing a position prediction module at an output position of an encoder on the basis of a standard visual large model comprising the encoder and a decoder. The improved visual large model can simultaneously pay attention to the content and the structure of the image in the pre-training process, so that the generalization ability, the understanding ability for position information modeling and the understanding ability for the image content of the model are improved, and the defects of an existing standard visual large model in the aspect of spatial structure understanding are overcome. According to the method, a more powerful pre-training model is provided for a computer vision task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a pre-training method, device and electronic equipment for a large visual model. Background Art

[0002] Currently, Masked Autoencoders (MAE) has become an important solution for pre-training large visual models. MAE is a self-supervised learning model that learns the representation of an image by masking a portion of the image and letting the model reconstruct these masked parts. This pre-training method performs well in the field of computer vision because it can effectively use a large amount of unlabeled image data to pre-train the model.

[0003] However, MAE also has some limitations in "missing spatial position information modeling": the existing MAE model mainly focuses on pixel reconstruction of the image, and directly gives the position information of the unmasked slices in the input of the decoder (docoder) responsible for reconstruction, which reduces the difficulty of pre-training the model to a certain extent, causing the MAE model to ignore the spatial structure information of the image. This means that the MAE model may not be able to fully learn to understand the position and layout of objects in the image, which is very important for certain visual tasks (such as object detection and image segmentation). Summary of the invention

[0004] In order to solve the problems existing in the prior art, the present invention provides the following technical solutions.

[0005] A first aspect of the present invention provides a pre-training method for a large visual model, comprising: Acquire an unlabeled image and perform slice and mask slice processing to obtain a mask-processed image, wherein the mask-processed image includes unmasked image slices and masked image slices; Based on the masking process, the total loss To optimize the goal, the improved visual large model is pre-trained; The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, is the true normalized coordinate of the i-th unmasked image patch; The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

[0006] Preferably, the position prediction module is composed of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

[0007] Preferably, the abscissa and ordinate of the predicted i-th unmasked image slice are calculated according to the following formula: ; in, is the representation of the i-th unmasked image slice after being encoded by the encoder, FFN is the feed-forward layer x The mapping matrix, FFN is the feed-forward layer y The mapping matrix, is the sigmoid activation function, is the normalized horizontal coordinate of the predicted i-th unmasked image patch, is the normalized ordinate of the predicted i-th unoccluded image patch.

[0008] Preferably, the reconstruction loss is calculated according to the following formula: ; in, represents the predicted value of the pixel with coordinates (j, k) in the tth masked image slice, for The corresponding actual values ​​are, M is the size of the tth masked image slice, and L is the number of masked image slices.

[0009] Preferably, the standard visual macro model adopts a MAE model.

[0010] A second aspect of the present invention provides a pre-training device for a large visual model, comprising: A data acquisition module is used to acquire an unlabeled image and perform slice processing and masked slice processing to obtain a masked processed image, wherein the masked processed image includes unmasked image slices and masked image slices; Pre-trained module for processing images based on masking, with a total loss To optimize the goal, the improved visual large model is pre-trained; The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, is the true normalized coordinate of the i-th unmasked image patch; The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

[0011] Preferably, the position prediction module is composed of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

[0012] Preferably, the standard visual macro model adopts a MAE model.

[0013] The present invention also provides a memory storing a plurality of instructions, wherein the instructions are used to implement the pre-training method of the large visual model as described in the first aspect.

[0014] The present invention also provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the pre-training method of the large visual model as described in the first aspect.

[0015] The beneficial effects of the present invention are as follows: the pre-training method, device and electronic device of the visual big model provided by the present invention introduce a position prediction module at the output position of the encoder of the standard visual big model to predict the position of the unobstructed slice in the image, so that the obtained improved visual big model can pay attention to the content and structure of the image at the same time during the pre-training process, thereby improving the generalization ability of the model, the ability to model and understand position information, and the ability to understand image content, and solves the shortcomings of the existing standard visual big model in understanding spatial structure, so as to provide a more powerful pre-training model for computer vision tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic diagram of the process of pre-training the large visual model of the present invention; Figure 2 This is a block diagram of the pre-training implementation process of the large visual model described in the present invention; Figure 3 Schematic diagram of the functional structure of the pre-training device for the large visual model described in the present invention. DETAILED DESCRIPTION

[0017] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0018] The method provided by the present invention can be implemented in the following terminal environment, and the terminal may include one or more of the following components: a processor, a memory, and a display screen. The memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method described in the following embodiment.

[0019] The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory.

[0020] The memory may include random access memory (RAM) or read-only memory (ROM). The memory may be used to store instructions, programs, codes, code sets or instructions.

[0021] The display screen is used to display the user interface of each application.

[0022] In addition, those skilled in the art can understand that the structure of the above terminal does not constitute a limitation on the terminal, and the terminal may include more or fewer components, or combine certain components, or arrange the components differently. For example, the terminal also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, and a power supply, which will not be described in detail here.

[0023] Embodiment 1 like Figure 1 and Figure 2 As shown, the embodiment of the present invention provides a pre-training method for a large visual model, including: S101, obtaining an unlabeled image and performing segmentation and mask segmentation processing to obtain a masked processed image, wherein the masked processed image includes an unmasked image segment and a masked image segment; S102, based on the masked processed image, using a total loss To optimize the goal, the improved visual big model is pre-trained.

[0024] The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, are the true normalized coordinates of the i-th unoccluded image patch.

[0025] The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

[0026] In the present invention, based on the standard visual macro model including an encoder and a decoder, a position prediction module is introduced at the output position of the encoder to obtain an improved visual macro model, such as Figure 2During the pre-training process, the improved visual model not only needs to learn how to reconstruct the masked image slices (from the input image to the target image) given the specific positions of the unmasked slices, but also needs to learn how to predict the positions of the unmasked slices in the image.

[0027] The position prediction module consists of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

[0028] In a preferred embodiment of the present invention, the abscissa and ordinate of the predicted i-th unmasked image slice are calculated according to the following formula: ; in, is the representation of the i-th unmasked image slice after being encoded by the encoder, FFN is the feed-forward layer x The mapping matrix, FFN is the feed-forward layer y The mapping matrix, is the sigmoid activation function, is the normalized horizontal coordinate of the predicted i-th unmasked image patch, is the normalized ordinate of the predicted i-th unobstructed image slice. By introducing a coordinate regression task, the horizontal and vertical coordinates of each unobstructed image slice can be output. In the present invention, this can be achieved through supervised learning, using the actual slice position as a label.

[0029] In the present invention, the reconstruction loss can be calculated according to the following formula: ; in, represents the predicted value of the pixel with coordinates (j, k) in the tth masked image slice, for The corresponding actual values ​​are, M is the size of the tth masked image slice, and L is the number of masked image slices.

[0030] The reconstruction loss can be used to ensure that the model can accurately reconstruct the occluded image slices, and the position prediction loss can be used to ensure that the model can accurately predict the position of the unoccluded image slices. By adjusting the weights in the total loss, the importance of the two losses can be balanced to ensure that the model can achieve good performance on both the reconstruction task and the position prediction task.

[0031] In the present invention, the standard large visual model may adopt the MAE model.

[0032] The improved large visual model trained by the method of the present invention can be applied to various downstream visual tasks, such as image classification, object detection, and image segmentation, etc. The model is fine-tuned according to the requirements of the specific task to achieve the best performance.

[0033] The beneficial effects of the present invention are mainly reflected in the following aspects: 1. Enhanced spatial structure understanding and improved model performance. The improved visual large model provided by the present invention enables the model encoder part to better understand the spatial structure of the image by introducing the position prediction task, thereby showing better performance in tasks such as object detection and image segmentation. Since the position prediction task forces the model to learn the position of each slice in the image, this helps the model capture the position and layout information of objects in the image, which is very important for understanding the spatial relationship between objects and scenes in the image, thereby improving the performance of the model on specific tasks.

[0034] 2. Optimized training efficiency. The introduction of the dynamic masking strategy and the multi-stage training strategy in the present invention enables the model to use data more effectively during the training process, reduces the training time and the consumption of computing resources, and improves the training efficiency. The dynamic masking strategy can ensure that the model is exposed to more diverse image areas during the training process, while the multi-stage training strategy can gradually adjust the training parameters according to the learning progress of the model, thereby improving the training efficiency.

[0035] In general, the beneficial effects of the present invention mainly come from the introduction of the position prediction task, the composite loss function combining the reconstruction loss and the position prediction loss, and the optimization of the training strategy. These improvements enable the model to learn richer image representations during pre-training, improve the generalization ability and task-specific performance of the model, and optimize the training efficiency and the simplicity of downstream task fine-tuning.

[0036] Embodiment 2 like Figure 3As shown, another aspect of the present invention also includes a functional module architecture that corresponds to the aforementioned method flow, that is, the embodiment of the present invention also provides a pre-training device for a large visual model, including: a data acquisition module 301, used to acquire an unlabeled image and perform segmentation and masked segmentation processing to obtain a masked processed image, wherein the masked processed image includes an unmasked image segment and a masked image segment; a pre-training module 302, used to perform a total loss on the masked processed image; To optimize the goal, the improved visual big model is pre-trained.

[0037] The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, is the true normalized coordinate of the i-th unmasked image patch; The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

[0038] Furthermore, the position prediction module is composed of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

[0039] Furthermore, the standard visual large model adopts the MAE model.

[0040] The device can be implemented through the pre-training method of the large visual model provided in the above-mentioned embodiment 1. The specific implementation method can be found in the description of embodiment 1 and will not be repeated here.

[0041] The present invention also provides a memory storing a plurality of instructions, wherein the instructions are used to implement the pre-training method of the large visual model as described in the first embodiment.

[0042] The present invention also provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the pre-training method of the large visual model as described in Example 1.

[0043] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A pre-training method for a large visual model, characterized in that: include: Acquire an unlabeled image and perform slice and mask slice processing to obtain a mask-processed image, wherein the mask-processed image includes unmasked image slices and masked image slices; Based on the masking process, the total loss To optimize the goal, the improved visual large model is pre-trained; The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, is the true normalized coordinate of the i-th unmasked image patch; The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

2. The method for pre-training a large visual model as claimed in claim 1, characterized in that: The position prediction module consists of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is respectively i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

3. The pre-training method of a large visual model as claimed in claim 2, characterized in that: The horizontal coordinate and the vertical coordinate of the predicted i-th unmasked image slice are calculated according to the following formula: ; in, is the representation of the i-th unmasked image slice after being encoded by the encoder, FFN is the feed-forward layer x The mapping matrix, FFN is the feed-forward layer y The mapping matrix, is the sigmoid activation function, is the normalized horizontal coordinate of the predicted i-th unmasked image patch, is the normalized ordinate of the predicted i-th unoccluded image patch.

4. The method for pre-training a large visual model as claimed in claim 1, characterized in that: The reconstruction loss is calculated according to the following formula: ; in, represents the predicted value of the pixel with coordinates (j, k) in the tth masked image slice, for The corresponding actual values ​​are, M is the size of the tth masked image slice, and L is the number of masked image slices.

5. The method for pre-training a large visual model as claimed in claim 1, characterized in that: The standard visual model adopts the MAE model.

6. A pre-training device for a large visual model, characterized in that: include: A data acquisition module is used to acquire an unlabeled image and perform slice processing and masked slice processing to obtain a masked processed image, wherein the masked processed image includes unmasked image slices and masked image slices; Pre-trained module for processing images based on masking, with a total loss To optimize the goal, the improved visual large model is pre-trained; The total loss Calculate according to the following formula: ; ; ; in, is the total loss, To rebuild the losses, is the position prediction loss, It is used for balance and is a hyperparameter, N is the number of unmasked image slices, are the predicted normalized coordinates of the i-th unmasked image patch, is the true normalized coordinate of the i-th unmasked image patch; The improved visual big model is obtained by introducing a position prediction module at the output position of the encoder on the basis of a standard visual big model including an encoder and a decoder; the standard visual big model is used to reconstruct the obscured image slice given the specific position of the unobstructed image slice, and the position prediction module is used to predict the position of the unobstructed image slice in the image.

7. The pre-training device for a large visual model as claimed in claim 6, characterized in that: The position prediction module consists of a feed-forward layer FFN x and FFN y Composition, feed-forward layer FFN x and FFN y The representation h of the i-th unmasked image slice output by the encoder is respectively i As input, after linear layer transformation, the activation function is used to generate the predicted horizontal and vertical coordinates of the i-th unmasked image segment.

8. The pre-training device for a large visual model as claimed in claim 6, characterized in that: The standard visual model adopts the MAE model.

9. A memory, characterized in that: Multiple instructions are stored, and the instructions are used to implement the pre-training method of the large visual model as described in any one of claims 1-5.

10. An electronic device, characterized in that: It includes a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the pre-training method of the large visual model as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Hybrid convolution-transformer architecture based on window mask strategy and self-supervision method

    CN115496919A

  • Method, device, equipment and medium for image coding learning and application

    CN116030318A

  • Skeleton sequence identification method and system based on mask pattern auto-encoder

    CN116434347A

  • Mask image modeling algorithm based on self-supervised learning

    CN116843830A

  • Pavement nondestructive detection and identification method based on small samples

    US20240013368A1