Industrial vision multi-downstream task processing method based on large language model

By integrating the image feature encoder and the image-to-text feature converter in the large language model to generate structured output, it solves the problem of insufficient flexibility and efficiency of traditional models in multi-task processing, and achieves high efficiency in multiple downstream tasks of industrial vision. Handling and adaptability improvements.

CN118279724BActive Publication Date: 2024-10-08HANGZHOU HUICUI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410710722.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-10-08
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

Traditional large language models perform poorly in multi-task processing and are difficult to adapt to different types of visual tasks. Each new task requires retraining and data annotation, which is time-consuming and costly, and lacks flexibility and efficiency.

Method used

Adopt an industrial vision multi-downstream task processing method based on a large language model, and integrate the image feature encoder and image-text feature converter to generate structured output, support small sample learning and image prompt tasks, achieve cross-task shared learning, and reduce Retraining requirements to improve model adaptability and efficiency.

Benefits of technology

It achieves efficient and accurate processing of a variety of downstream tasks in industrial vision scenes, enhances the generalization ability and adaptability of the model, reduces deployment complexity and cost, and ensures that the model maintains high performance when tasks change.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118279724B_ABST
    Figure CN118279724B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for processing multiple downstream tasks of industrial vision based on a large language model, comprising the following steps: obtaining an industrial query image and a question text, segmenting the industrial query image into multiple image blocks, sending the image blocks to an image feature encoder to extract image features, and converting the image features into query image tokens; identifying the question text to obtain a visual task type, generating an input text of a large language model according to system settings, the question text, the visual task type, and the query image token; and transmitting the input text to the large language model, wherein the large language model processes different visual tasks according to the specified task type, input system settings, and task requirements. The present invention can efficiently and accurately process multiple downstream tasks in industrial vision scenes, and improve the adaptability and performance of large models on multiple downstream tasks of industrial vision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of visual task application of a large language model, and in particular to an industrial vision multi-downstream task processing method based on a large language model. Background Art

[0002] Currently, traditional large models are usually optimized for a single task, such as object detection or image classification, which makes it difficult for the model to adapt to different types of tasks without retraining and fine-tuning. This specialized approach limits the performance of the model on new tasks or slightly changed tasks.

[0003] Insufficient generalization ability: Since traditional models are mainly trained on specific datasets, which often cover limited scenarios and changes, models often perform poorly when encountering new situations in actual industrial environments, especially when the data distribution changes. Efficiency and cost issues: Whenever a new downstream task is introduced, a large amount of data needs to be collected again and the model needs to be fine-tuned, which is not only time-consuming but also costly, especially in a rapidly changing industrial environment. This approach lacks efficiency.

[0004] In traditional large-model applications, each type of visual task often requires a separate model architecture or requires extensive fine-tuning for each new task. For example, one model may be optimized for image classification, while another is specialized for object detection. This approach not only increases the complexity and cost of deploying multiple models, but also requires a new round of data annotation and model training for each new downstream task, which is time-consuming and costly.

[0005] Industrial vision systems usually require extremely high flexibility and efficiency because they need to quickly adapt to various visual inspection tasks on the production line, such as detecting different types of defects, segmenting multiple objects, counting objects at the same time, etc. These tasks have strict requirements on the data format, processing accuracy and response time, and traditional large models often cannot meet the flexible processing requirements of such multi-tasks. Summary of the invention

[0006] The purpose of the present invention is to overcome the above-mentioned technical deficiencies, propose an industrial vision multi-downstream task processing method based on a large language model, and solve the technical problem that traditional large models in the prior art are often difficult to meet the flexible processing requirements of such multi-tasks.

[0007] In order to achieve the above technical objectives, in a first aspect, the technical solution of the present invention provides an industrial vision multi-downstream task processing method based on a large language model, comprising the following steps:

[0008] Acquire an industrial query image and a question text, segment the industrial query image into a plurality of image blocks, send the image blocks to an image feature encoder to extract image features, and convert the image features into query image tokens;

[0009] Identify the question text to obtain a visual task type, and generate input text for a large language model according to system settings, the question text, the visual task type, and the query image token;

[0010] The input text is input to the large language model, and the large language model processes different visual tasks according to the specified task type, input system settings and task requirements.

[0011] Compared with the prior art, the industrial vision multi-downstream task processing method based on a large language model provided by the present invention has the following beneficial effects:

[0012] This paper proposes an industrial vision multi-downstream task processing method based on a large language model, which efficiently and accurately processes a variety of downstream tasks in industrial vision scenes and improves the adaptability and performance of the large model in industrial vision multi-downstream tasks:

[0013] Model structure optimization: By integrating the image encoder and the image-text feature converter, this paper optimizes the conversion process from industrial images to refined image tokens, ensuring that the model can capture detailed information that is critical to each downstream task. At the same time, a variety of prompt image processing strategies are introduced to support small sample learning and image prompt tasks.

[0014] Structured output of large language models: According to different task requirements, the present invention designs a structured output format, which includes customized output templates for tasks such as image description, target localization, anomaly detection, segmentation, classification and counting, so that the model can generate intuitive and easy-to-understand results.

[0015] Enhanced generalization: We propose a unified model architecture that enhances the model’s generalization to new and unseen scenes by sharing learning across a variety of visual tasks. This approach significantly reduces the need for retraining for specific tasks.

[0016] Efficient multi-tasking capabilities: By integrating multiple downstream vision tasks into a single model, the present invention significantly improves efficiency. This unified approach allows the model to seamlessly switch tasks such as image description, object detection, and anomaly detection without the need for multiple independent models.

[0017] Adaptability and flexibility: The proposed model incorporates dynamic adaptation mechanisms that allow it to adjust on the fly to different task requirements. This adaptability is critical to maintaining high performance in changing industrial vision applications, ensuring that the model remains effective even when task conditions change.

[0018] According to some embodiments of the present invention, generating input text for a large language model further comprises the steps of:

[0019] Acquire an industrial prompt image, divide the industrial prompt image into a plurality of image blocks, send the image blocks to an image feature encoder to extract image features, and convert the image features into prompt image tokens;

[0020] An input text of a large language model is generated according to system settings, the question text, the visual task type, the query image token and the prompt image token.

[0021] According to some embodiments of the present invention, the visual task types include:

[0022] Image description task, object detection task, anomaly detection task, segmentation task, classification task and counting task.

[0023] According to some embodiments of the present invention, before the input text is passed to the large language model, the steps include:

[0024] Creating annotation information for training images to obtain a training data set, including descriptive text annotations, segmentation annotations of salient objects, rotation rectangle annotations, and abnormal region annotations of abnormal images;

[0025] Descriptive text annotation: Provide a detailed description of each training image, including the name of the object appearing in the image, the color of the object, the location of the object, the relative size of the object, and the activity status of the object;

[0026] Salient object segmentation and annotation: Segment and annotate each salient object in the training image, and use pixel-level annotation to define the outline of each salient object, so that the model can recognize and understand the shape and spatial position of each independent object in the image;

[0027] Rotated rectangle annotation: Draw a rotated rectangle for each salient object in the image;

[0028] Abnormal area annotation: For images containing abnormal conditions, annotate the abnormal area, use segmentation annotation to accurately define the location of the abnormality, and provide a description to indicate the nature of the abnormality and the cause of the abnormality;

[0029] The training data set is input into the large language model for alternating task training.

[0030] According to some embodiments of the present invention, data processing for a target detection task comprises the steps of:

[0031] Normalizing the coordinate values ​​of the industrial query image to a range of 0-99, where 0 represents the leftmost (x) or topmost (y) of the image, and 99 represents the rightmost (x) or bottommost (y) of the image;

[0032] Label the position and shape information of each target object. The labeling information of each target object includes the center point coordinates (x, y), width (w), height (h), and rotation angle (θ);

[0033] Center point coordinates (x, y): indicates the position of the center point of the target object in the image;

[0034] Width (w) and height (h): represent the width and height of the target object, respectively. The size is normalized to the range of 0-99, indicating the ratio of the target to the entire image size.

[0035] Rotation angle (θ): indicates the rotation angle of the target object relative to the horizontal line of the image, ranging from -180 degrees to 180 degrees. Angle 0 means no rotation, positive value means clockwise rotation, and negative value means counterclockwise rotation.

[0036] According to some embodiments of the present invention, data processing for anomaly detection tasks includes the steps of:

[0037] Divide the industrial query image into 24x24 grids to obtain 574 image blocks, each image block represents a small part of the image, and the state is represented by 0 or 1, where 0 indicates that the image block does not contain the target object or abnormal area, and 1 indicates that the image block contains the target object or abnormal area;

[0038] For the three consecutive image blocks in each row, all possible state combinations based on the three image blocks are encoded as a number from 0 to 7. Each row is divided into 8 groups of three consecutive image blocks, so each row can be represented by 8 serial numbers between 0 and 7;

[0039] Serial number output: The anomaly detection result of the industrial query image will be output as 24 serial numbers, each serial number corresponds to a row in the image, indicating the anomaly detection status of the industrial query image.

[0040] According to some embodiments of the present invention, the input text is converted into a large language model, comprising the steps of:

[0041] The input text is input into the word embedding model for word vector conversion to obtain a word embedding vector that the model can process

[0042] ,

[0043] in For text content, is the word embedding model, and T is the word embedding vector used for large language model input.

[0044] According to some embodiments of the present invention, after processing different visual tasks, the method further includes the following steps:

[0045] The large language model is fine-tuned using a low-rank adaptive fine-tuning strategy (LoRA) while keeping the feature transformer and image encoder frozen during training.

[0046] In a second aspect, the technical solution of the present invention provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the industrial vision multi-downstream task processing method based on a large language model as described in any one of the first aspects.

[0047] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, wherein the abstract drawings are identical to one of the drawings in the specification:

[0049] Figure 1 A flowchart of a method for processing multiple downstream tasks of industrial vision based on a large language model provided by an embodiment of the present invention;

[0050] Figure 2 An input image for image description provided by an embodiment of the present invention;

[0051] Figure 3a An input image for target detection provided by an embodiment of the present invention;

[0052] Figure 3b An output image of target detection provided by one embodiment of the present invention;

[0053] Figure 4a An input image for anomaly detection provided by one embodiment of the present invention;

[0054] Figure 4b An output image of anomaly detection provided by one embodiment of the present invention;

[0055] Figure 5a An input image for image segmentation provided by an embodiment of the present invention;

[0056] Figure 5bAn output image of image segmentation provided by an embodiment of the present invention;

[0057] Figure 6 An input image for classification provided by one embodiment of the present invention;

[0058] Figure 7a An input image for counting provided by one embodiment of the present invention;

[0059] Figure 7b An output image of counting provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0061] It should be noted that, although the functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0062] In traditional large-model applications, each type of visual task often requires a separate model architecture or requires extensive fine-tuning for each new task. For example, one model may be optimized for image classification, while another is specialized for object detection. This approach not only increases the complexity and cost of deploying multiple models, but also requires a new round of data annotation and model training for each new downstream task, which is time-consuming and costly.

[0063] Industrial vision systems usually require extremely high flexibility and efficiency because they need to quickly adapt to various visual inspection tasks on the production line, such as detecting different types of defects, segmenting multiple objects, counting objects at the same time, etc. These tasks have strict requirements on the data format, processing accuracy and response time, and traditional large models often cannot meet the flexible processing requirements of such multi-tasks.

[0064] In the field of industrial vision, despite the diversity of tasks (such as image description, object detection, anomaly detection, segmentation and counting, etc.), many scenes have a high degree of similarity in visual features. However, traditional large models usually face the difficulty of insufficient generalization ability.

[0065] Traditional models are often trained and optimized for specific tasks, such as separate object detection or anomaly detection models. This over-specialization causes the models to perform poorly when faced with new tasks that only slightly change, because they fail to learn common visual features that can be applied across tasks. In addition, most models are trained on limited datasets that often only cover limited scene variations. This data limitation causes the models to easily experience performance degradation when dealing with new situations that have not been seen in actual industrial environments, because they lack the ability to handle different data distributions.

[0066] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.

[0067] Reference Figure 1 - Figure 7, Figure 1 A flowchart of a method for processing multiple downstream tasks of industrial vision based on a large language model provided by an embodiment of the present invention; Figure 2 An input image for image description provided by an embodiment of the present invention; Figure 3a An input image for target detection provided by an embodiment of the present invention; Figure 3b An output image of target detection provided by one embodiment of the present invention; Figure 4a An input image for anomaly detection provided by one embodiment of the present invention; Figure 4b An output image of anomaly detection provided by one embodiment of the present invention; Figure 5a An input image for image segmentation provided by an embodiment of the present invention; Figure 5b An output image of image segmentation provided by an embodiment of the present invention; Figure 6 An input image for classification provided by one embodiment of the present invention; Figure 7a An input image for counting provided by one embodiment of the present invention; Figure 7b An output image of counting provided by one embodiment of the present invention.

[0068] In one embodiment, an industrial vision multi-downstream task processing method based on a large language model includes the following steps: acquiring an industrial query image and a question text, segmenting the industrial query image into multiple image blocks, sending the image blocks to an image feature encoder to extract image features, and converting the image features into query image tokens; identifying the question text to obtain a visual task type, and generating an input text for a large language model based on system settings, question text, visual task type, and query image tokens; and transforming the input text into a large language model, wherein the large language model processes different visual tasks based on the specified task type, input system settings, and task requirements.

[0069] 1. Image feature extraction: First, the image encoder is used to extract key features from the industrial image and convert these features into image tokens. In addition, feature extraction and tokenization are also performed for the prompt image containing auxiliary information.

[0070] 2. Image-text feature integration: Through the image-text feature converter, the image token is combined with relevant text information (such as task instructions, question text, etc.) to provide comprehensive input for the large language model.

[0071] 3. Large language model processing: Combining image features and text input, the large language model performs in-depth processing based on the specified task type. The model can handle different visual tasks based on the input system settings and task requirements.

[0072] 4. Output generation: Based on the processing results, the model generates structured outputs through specific text templates. These outputs directly correspond to various task requirements, such as descriptive text, target location, anomaly detection results, segmentation information, classification labels, and counting results. For target detection, anomaly detection, and segmentation tasks, the output information needs to be further visualized.

[0073] In order to efficiently and accurately process multiple downstream tasks in industrial vision scenes and improve the adaptability and performance of large models on these tasks, this paper proposes a method for processing multiple downstream tasks of industrial vision based on a large language model. For tasks such as image description, object detection, anomaly detection, segmentation, classification, and counting, this paper implements the following key modifications and optimizations:

[0074] 1) Model structure optimization: By integrating the image encoder and the image-text feature converter, this paper optimizes the conversion process from industrial images to refined image tokens, ensuring that the model can capture detailed information that is critical to each downstream task. At the same time, a variety of prompt image processing strategies are introduced to support small sample learning and image prompt tasks.

[0075] 2) Structured output of large language models: According to different task requirements, the present invention designs a structured output format, which includes customized output templates for tasks such as image description, object localization, anomaly detection, segmentation, classification, and counting, so that the model can generate intuitive and easy-to-understand results;

[0076] 3) Creation of high-quality training sets: In terms of data preparation, the present invention proposes a detailed language description and annotation scheme for industrial visual images.

[0077] Model structure

[0078] (1) Image feature extraction

[0079] - Each input image (size 336x336) is divided into 576 image patches,

[0080] - These image patches are fed into the image feature encoder (based on CLIP's ViT structure), outputs 576 image tokens, each with a dimension of 1024,

[0081] - Output image tokens are passed through an MLP adapter Process it and get the text token: , size is 576x4096,

[0082] ;

[0083] (2) Large language model input

[0084] - The input format is designed to support flexible dialogue modes, including system settings, task types, question text, and query and prompt image tokens. The specific format is:

[0085] [System Settings ] [Task Type ] [Question text ] [Query image start character ] [Query Image Token ] [Query image terminator ] [[Prompt image start character ] [Prompt Image Token ] [Prompt image terminator ] [...]]

[0086] - The prompt image part is optional, you can provide an image prompt as a reference. If there is no prompt image, you don’t need to add it; if there are multiple prompt images, you can add multiple.

[0087] - The text content of the system settings section is set to:

[0088] ="A dialogue focused on industrial vision where an AI assistant provides precise, detail-oriented, and polite responses."

[0089] (Translation: Conversations around industrial vision, where AI assistants provide precise, detail-oriented, and polite responses.)

[0090] - For the task type text, select from the following 6 options:

[0091] =" <describe>" / "<object_detection>" / "<classify_anomaly>" / "<classify_object>" / "<classify_image>" / " <count>"

[0092] - Question text is the user input part;

[0093] -The start and end characters of the query and prompt images are used to mark the beginning and end of the query image and the prompt image, respectively set as:

[0094] ="<query_img_s> "

[0095] ="<query_img_e> "

[0096] ="<prompt_img1_s> "

[0097] ="<prompt_img1_e> "

[0098] Wherein, if there are multiple prompt images, the start and end characters of the prompt images are increased in sequence;

[0099] - Text to word vector conversion: It is a word embedding model, which is used to convert text into an embedding vector that the model can process:

[0100] ,

[0101] in is the text content, and T is the word embedding vector used for large language model input. The model is used to convert all the above text contents;

[0102] - Query image token and the hint image token All are obtained by the image feature extraction method in 3.1.1.

[0103] (3) Large language model output

[0104] - Depending on the task type, the model will have a relatively fixed output format. For the specific output format, please refer to the training set production section.

[0105] - For the object detection task, you need to draw a rectangular box on the input image according to the coordinates, size and rotation angle of the rotated rectangular box in the answer;

[0106] - For anomaly detection and segmentation tasks, it is necessary to mark the abnormal area or segmentation area at the corresponding position on the input image according to the index of the image block in the answer.

[0107] In one embodiment, an industrial vision multi-downstream task processing method based on a large language model includes the following steps: acquiring an industrial query image and a question text, segmenting the industrial query image into multiple image blocks, sending the image blocks to an image feature encoder to extract image features, and converting the image features into query image tokens; identifying the question text to obtain a visual task type, and generating an input text for a large language model based on system settings, question text, visual task type, and query image tokens; and transforming the input text into a large language model, wherein the large language model processes different visual tasks based on the specified task type, input system settings, and task requirements.

[0108] Generating the input text of the large language model also includes the steps of: obtaining an industrial prompt image, dividing the industrial prompt image into multiple image blocks, sending the image blocks to an image feature encoder to extract image features, and converting the image features into prompt image tokens; generating the input text of the large language model according to system settings, question text, visual task type, query image tokens and prompt image tokens.

[0109] Furthermore, the types of visual tasks include: image description tasks, object detection tasks, anomaly detection tasks, segmentation tasks, classification tasks and counting tasks.

[0110] Furthermore, before the input text is fed into the language model, the following steps are included:

[0111] Create annotation information for the training images to obtain the training data set, including descriptive text annotation, segmentation annotation of salient objects, rotation rectangle annotation and abnormal area annotation of abnormal images; Descriptive text annotation: provide a detailed description of each training image, including the name of the object appearing in the image, the color of the object, the position of the object, the relative size of the object and the activity state of the object; Salient object segmentation annotation: segment and annotate each salient object in the training image, and use pixel-level annotation to define the outline of each salient object, so that the model can recognize and understand the shape and spatial position of each independent object in the image; Rotated rectangle annotation: draw a rotation rectangle for each salient object in the image; Abnormal area annotation: for images containing abnormal situations, mark the abnormal area, use segmentation annotation to accurately define the location where the abnormality occurs, and provide a description to point out the nature of the abnormality and the cause of the abnormality; Input the training data set into the large language model for alternating task training.

[0112] Training set creation

[0113] (1) Preliminary data annotation

[0114] Goal: Create rich annotation information for all images, including descriptive text, segmentation annotations of salient objects, rotated rectangle annotations, and abnormal region annotations for abnormal images.

[0115] step:

[0116] -Descriptive text annotation: Provide a detailed description of each image, including the objects that appear in the image, their color, location, relative size, and any notable activity or status. The description should be as comprehensive as possible, covering all important elements and details in the image.

[0117] - Salient object segmentation and annotation: Accurately segment and annotate each salient object in the image. Use pixel-level annotation to define the outline of each object, ensuring that the model can recognize and understand the shape and spatial position of each independent object in the image;

[0118] - Rotated rectangle annotation: Draw a rotated rectangle for each salient object in the image;

[0119] - Anomaly region annotation (only for abnormal images): For images containing abnormalities, the abnormal regions need to be specifically annotated. Use segmentation annotation to accurately define where the abnormality occurs, and provide a brief description indicating the nature and possible cause of the abnormality.

[0120] (2) Data processing method for target detection tasks

[0121] In order to meet the needs of large language models in processing image object detection tasks, this method defines a specific data processing method. This method aims to achieve efficient and accurate object detection by annotating the position and shape information of each target object and converting it into a format that the model can understand.

[0122] Annotation information: The annotation information of each target object includes the center point coordinates (x, y), width (w), height (h), and rotation angle (θ).

[0123] Center point coordinates (x, y): Indicates the position of the center point of the target object in the image. The coordinate values ​​are normalized to the range of 0-99, where 0 represents the leftmost (x) or topmost (y) of the image, and 99 represents the rightmost (x) or bottommost (y) of the image.

[0124] Width (w) and height (h): represent the width and height of the target object respectively. The size is also normalized to the range of 0-99, reflecting the ratio of the target to the entire image size.

[0125] Rotation angle (θ): indicates the rotation angle of the target object relative to the horizontal line of the image, ranging from -180 degrees to 180 degrees. Angle 0 means no rotation, positive value means clockwise rotation, and negative value means counterclockwise rotation.

[0126] (3) Data processing methods for anomaly detection and segmentation tasks

[0127] In order to effectively adapt the image segmentation and anomaly detection tasks to the processing capabilities of a large language model, an innovative data representation method is adopted, which subdivides the image into 24x24 image blocks and uses an encoding mechanism to simplify the model's output to achieve efficient and accurate image segmentation and anomaly detection.

[0128] Image segmentation: First, each input image is divided into 24x24 grids. Each image block in the grid represents a small part of the image, and its state is represented as 0 or 1, where 0 means that the image block does not contain the target object or abnormal area, and 1 means it does.

[0129] Encode the states of three consecutive patches: For three consecutive image patches in each row, encode their states (0 or 1) as a number from 0 to 7. This encoding is based on all possible state combinations of three image patches (i.e. 000, 001, 010, 011, 100, 101, 110, 111), and each combination corresponds to a unique number.

[0130] Row representation: For each row, since it is divided into 8 groups of three consecutive image blocks, each row can be represented by 8 serial numbers between 0 and 7. In this way, all the information of a row is compressed into a serial number consisting of 8 digits. In addition, it is specially stipulated that if an entire row is 0, a single 0 is used to represent the value of a single row.

[0131] Sequence number output: The segmentation or anomaly detection results of each image will be output as 24 sequence numbers, each of which corresponds to a line in the image. These sequence numbers are regarded as words and are connected together to represent the segmentation or anomaly detection status of the entire image.

[0132] Example: If the image block state sequence in a row is 000, 111, 010, 001, 111, 000, 010, 111, and the corresponding encoding sequence numbers are 0, 7, 2, 1, 7, 0, 2, 7, this row is simplified to "07217027".

[0133] (4) Answer template

[0134] The following templates are for reference only. Actual answers may use a variety of different sentence structures and expressions. The diversity of answers will be considered during model training to adapt to various possible inquiries and scenarios.

[0135] Image description task: The answer template for the image description task is the text description in the data annotation.

[0136] Object detection task:

[0137] The purpose is to let the model predict the coordinates, size and rotation angle of the rotated rectangle, so we hope that the answer is simple and fixed, so we make the following design:

[0138] "A / The {object} is located at {x, y, w, h, θ}."

[0139] Anomaly detection tasks:

[0140] The purpose is to let the model determine whether there is an anomaly, and if so, give a description of the anomaly and a binary image encoding to help locate the anomaly:

[0141] No abnormal situation:

[0142] "This image does not contain any abnormalities."

[0143] "There is no {specific abnormality} detected in the image."

[0144] There are abnormal situations:

[0145] "This image contains {type of anomaly} anomalies. The binary map of anomalies is represented by the following sequence: {}, {}, {},...,indicating the distribution of anomalies across the image."

[0146] Segmentation task: Similar to anomaly detection, it is necessary to first determine whether the target exists in the image, and if so, give a binary image encoding:

[0147] There is no corresponding object.

[0148] "This image does not contain any {object}."

[0149] There are objects:

[0150] "The segmentation of the image is represented by the following sequence: {}, {}, {}, ..., indicating the distribution of different regions across the image." (Translation: The segmentation of the image is represented by the following sequence: {}, {}, {}, ..., indicating the distribution of different regions across the image.")

[0151] Classification task: Provide classification results, and the answer is very simple.

[0152] "The image is classified as a {object}."

[0153] Counting tasks: require you to clearly indicate the number of specific objects in an image.

[0154] "There are {} {objects} visible in the image."

[0155] Fine-tuning methods

[0156] (1) Pre-trained Model

[0157] - Image Coder: CLIP-ViT (L-14)

[0158] - Image-to-text feature converter: an MLP adapter pre-trained with BLIP captions on the 558K subset of the LAION-CC-SBU dataset

[0159] - Large language model: Vicuna-v1.5 (7B)

[0160] (2) Fine-tuning method

[0161] - Fine-tune large language models using a low-rank adaptive fine-tuning strategy (LoRA) while keeping the feature transformer and image encoder frozen during training,

[0162] - Alternate training with different tasks,

[0163] - In the segmentation task, if there are multiple objects in the training image, randomly select some of them to ask questions each time.

[0164] - Fine-tuning of few-shot learning includes object detection, anomaly detection, segmentation, classification, and counting tasks.

[0165] (3) Question template:

[0166] The following templates are for reference only. Actual questions will use a variety of different sentence structures and expressions. The diversity of answers will be considered during model training to adapt to various possible inquiries and scenarios.

[0167] Image description task:

[0168] Question template: "Describe the image in detail."

[0169] Object detection task:

[0170] Question template: "Describe the position of {object}."

[0171] Small sample question template: "Describe the position of the object in prompt images."

[0172] Anomaly detection tasks:

[0173] Question template: "Does this image contain any anomalies? If yes, describe the type of anomaly and its distribution."

[0174] Small sample question template: "Does this image contain any anomalies compared with the prompt images? If yes, describe the type of anomaly and its distribution."

[0175] Segmentation Task:

[0176] Question template: "How is the {object} segmented in this image? Describe its boundary and relation to other objects."

[0177] Small sample question template: "How is the {object} in prompt images segmented in this image? Describe its boundary and relation to other objects."

[0178] Classification Task:

[0179] Question template: "Classify the image within one of the given classes: {object1}, {object2}, ... . " (Translation: Classify the image into a given class: {object 1}, {object 2}, ....)

[0180] Small sample question template: "Is this image of the object in prompt images?"

[0181] Counting Task:

[0182] Question template: "How many {object} are in the image?"

[0183] Small sample question template: "How many of the object in prompt images are in the query image?"

[0184] Actual operation effect: the left side below shows image input and text input, and the right side shows the result of the model of the present invention.

[0185] Image Description:

[0186] ,

[0187] ,

[0188] ,

[0189] ,

[0190] ,

[0191] .

[0192] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0193] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0194] In addition, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor or controller, for example, by a processor in the above-mentioned terminal embodiment, so that the above-mentioned processor can execute the industrial vision multi-downstream task processing method based on a large language model in the above-mentioned embodiment.

[0195] It will be appreciated by those skilled in the art that all or some of the steps and systems in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0196] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.

[0197] The specific implementation of the present invention described above does not constitute a limitation on the protection scope of the present invention. Any other corresponding changes and modifications made based on the technical concept of the present invention should be included in the protection scope of the claims of the present invention.< / count> < / describe>

Claims

1. A method for processing multiple downstream tasks of industrial vision based on a large language model, characterized in that: The following steps are involved: Acquire an industrial query image and a question text, segment the industrial query image into a plurality of image blocks, send the image blocks to an image feature encoder to extract image features, and convert the image features into query image tokens; Identify the question text to obtain a visual task type, and generate input text for a large language model according to system settings, the question text, the visual task type, and the query image token; The input text is applied to the large language model, wherein the large language model processes different visual tasks according to the specified task type, input system settings and task requirements; The visual task types include: Image description tasks, object detection tasks, anomaly detection tasks, segmentation tasks, classification tasks, and counting tasks; The data processing of the target detection task includes the following steps: Normalizing the coordinate values ​​of the industrial query image to a range of 0-99, where 0 represents the leftmost x or the topmost y of the image, and 99 represents the rightmost x or the bottommost y of the image; Mark the position and shape information of each target object. The marking information of each target object includes the center point coordinates x, y, width w, height h and rotation angle θ; Center point coordinates x, y: represent the position of the center point of the target object in the image; Width w and height h: represent the width and height of the target object respectively. The size is normalized to the range of 0-99, indicating the ratio of the target to the entire image size. Rotation angle θ: represents the rotation angle of the target object relative to the horizontal line of the image, ranging from -180 degrees to 180 degrees. A rotation angle of 0 means no rotation, a positive value means clockwise rotation, and a negative value means counterclockwise rotation; The data processing for anomaly detection tasks includes the following steps: Divide the industrial query image into 24x24 grids to obtain 574 image blocks, each image block represents a small part of the image, and the state is represented by 0 or 1, where 0 indicates that the image block does not contain the target object or abnormal area, and 1 indicates that the image block contains the target object or abnormal area; For the three consecutive image blocks in each row, all possible state combinations based on the three image blocks are encoded as a number from 0 to 7. Each row is divided into 8 groups of three consecutive image blocks, so each row can be represented by 8 serial numbers between 0 and 7; Serial number output: The anomaly detection result of the industrial query image will be output as 24 serial numbers, each serial number corresponds to a row in the image, indicating the anomaly detection status of the industrial query image.

2. The industrial vision multi-downstream task processing method based on a large language model according to claim 1 is characterized in that: Generating input text for a large language model also includes the following steps: Acquire an industrial prompt image, divide the industrial prompt image into a plurality of image blocks, send the image blocks to an image feature encoder to extract image features, and convert the image features into prompt image tokens; An input text of a large language model is generated according to system settings, the question text, the visual task type, the query image token and the prompt image token.

3. The industrial vision multi-downstream task processing method based on a large language model according to claim 1 is characterized in that: Before the input text is applied to the large language model, the steps include: Creating annotation information for training images to obtain a training data set, including descriptive text annotations, segmentation annotations of salient objects, rotation rectangle annotations, and abnormal region annotations of abnormal images; Descriptive text annotation: Provide a detailed description of each training image, including the name of the object appearing in the image, the color of the object, the location of the object, the relative size of the object, and the activity status of the object; Salient object segmentation and annotation: Segment and annotate each salient object in the training image, and use pixel-level annotation to define the outline of each salient object, so that the model can recognize and understand the shape and spatial position of each independent object in the image; Rotated rectangle annotation: Draw a rotated rectangle for each salient object in the image; Abnormal area annotation: For images containing abnormal conditions, the abnormal area is annotated, and segmentation annotation is used to accurately define the location of the abnormality. At the same time, a description is provided to indicate the nature of the abnormality and the cause of the abnormality. The training data set is input into the large language model for alternating task training.

4. The industrial vision multi-downstream task processing method based on a large language model according to claim 1 is characterized in that: The input text is transformed into the large language model, comprising the steps of: The input text is input into the word embedding model for word vector conversion to obtain a word embedding vector that the model can process T=W e (t) Where t is the text content, W e is the word embedding model, and T is the word embedding vector used for large language model input.

5. The industrial vision multi-downstream task processing method based on a large language model according to claim 1 is characterized in that: After processing different visual tasks, it also includes the steps: The large language model is fine-tuned using a low-rank adaptive fine-tuning strategy (LoRA) while keeping the feature transformer and image encoder frozen during training.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the industrial vision multi-downstream task processing method based on a large language model as described in any one of claims 1 to 5.