Tunnel disease segmentation and labeling method based on fine-tuning visual large model
Through a large visual model based on the Vision Transformer structure and a graphical user interface for tunnel disease detection, the problems of insufficient generalization and high data annotation cost of traditional networks are solved, and efficient and accurate results of tunnel disease detection are achieved, adapting to large-scale detection. need.
Patent Information
- Application Number
- CN202411087834.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional deep learning networks have insufficient generalization in tunnel disease detection, and the cost of data annotation is high, which limits the performance in the field of computer vision and is difficult to adapt to the field of professional industrial inspection.
A large visual model based on the Vision Transformer structure is used to freeze the shallow weights of the image encoder, use the tunnel disease data set to update the deep weights, and perform fast pixel-level annotation and model update through the graphical user interface to achieve efficient model update and data annotation.
It improves the efficiency and accuracy of tunnel disease detection, adapts to large-scale detection and maintenance needs, and achieves efficient model update and data annotation.
Smart Images

Figure CN118629023A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tunnel disease detection, and in particular to a tunnel disease segmentation and labeling method based on a fine-tuning visual macro model. Background Art
[0002] The demand for maintenance and inspection of highway tunnels in my country is huge, and it is foreseeable that it will continue to grow rapidly in the future. Traditional manual inspection methods can no longer meet the needs of large-scale tunnel inspection and maintenance in terms of efficiency, accuracy and safety. In recent years, the use of deep learning networks to detect tunnel defects has become a trend. However, traditional deep learning networks have poor generalization and cannot adapt to tunnel defect detection work with variable features. Recently, the rapid development of visual big models has provided a new method to solve the above problems. Visual big models refer to models that are obtained through large amounts of data training and can be widely transferred to downstream tasks, and have very strong generalization capabilities. However, due to problems such as original training data, visual big models are difficult to adapt to professional industrial inspection fields, such as tunnel defect detection. In addition, due to the high cost of data annotation, the amount of data has always limited the performance of deep learning algorithms in the field of computer vision. Therefore, it is urgent to propose an efficient visual big model fine-tuning algorithm that can not only adapt to tunnel defect detection but also perform efficient data annotation, and can use real-time streaming data during the inspection process to efficiently update the model. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a tunnel defect segmentation and labeling method based on a fine-tuned visual large model.
[0004] In order to solve the above technical problems, the technical solution of the present invention is:
[0005] A tunnel defect segmentation and labeling method based on fine-tuning a large visual model comprises the following steps:
[0006] S1, construct tunnel disease dataset;
[0007] S2, freezes the shallow weights of the image encoder of the visual large model, and obtains the disease segmentation large model after training with the disease dataset;
[0008] S3, build a graphical user interface to enable the large disease segmentation model to obtain bounding box prompts for fast pixel-level annotation;
[0009] S4, repeat S2 and S3 during use to achieve model update.
[0010] Preferably, the construction of the disease dataset in step S1 is specifically as follows:
[0011] The tunnel disease dataset should include the original image of tunnel apparent disease and the binary image obtained by manual annotation using annotation software, where the disease pixel value is 1 and the background pixel value is 0.
[0012] Preferably, the visual macro model in step S2 is specifically:
[0013] The visual large model is designed to complete the semantic segmentation task. The network adopts an encoder-decoder architecture based on the Vision Transformer structure, including three key components: image encoder, bounding box prompt encoder and mask decoder. The image encoder encodes the original image into image embeddings, and the bounding box encodes the input box prompt position to obtain prompt embedding. The two are fused in the image decoder to output mask embeddings, which are then activated by the sigmoid function and restored to the original image size using bilinear interpolation upsampling.
[0014] Preferably, the disease segmentation model in step S2 is:
[0015] After freezing the shallow weights of the visual large model image encoding, the number of frozen layers is N, and the deep weight results of the visual large model image encoder are updated using the tunnel disease dataset.
[0016] Preferably, the measurement indicator of the deep weight result is MIoU or F1-Score:
[0017] (1)
[0018] (2)
[0019] (3)
[0020] (4)
[0021] Where: TP is the number of diseased pixels predicted as diseased, FP is the number of background pixels predicted as diseased, FN is the number of diseased pixels predicted as background, and TN is the number of background pixels predicted as background.
[0022] Preferably, the graphical user interface in step S3 is constructed so that the large disease segmentation model can obtain the boundary box prompt for fast pixel-level annotation as follows:
[0023] Building a graphical user interface refers to creating a visual interface with which users can interact. On this visual interface, the user draws a bounding box as a prompt for the diseased area of the diseased image, and inputs the obtained bounding box as a prompt into the disease segmentation model, so that the disease segmentation model can accurately locate and segment the diseased area.
[0024] Preferably, the model in step S4 is updated as follows:
[0025] In the face of streaming data in actual tunnel defect detection, a graphical user interface is used to quickly annotate defect data, and the number of samples in the defect data set is continuously expanded to obtain a new data set for updating the visual large model.
[0026] The above technical solution has the following advantages:
[0027] The present invention can not only adapt to tunnel disease detection but also perform efficient data labeling, thus effectively improving the efficiency of image processing. The present invention can also use the streaming data in the detection process to efficiently update the model, meeting the needs of large-scale tunnel detection and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flow chart of a tunnel defect segmentation and labeling method based on fine-tuning a large visual model according to the present invention;
[0029] Figure 2 It is a schematic diagram of the disease segmentation model of the present invention. DETAILED DESCRIPTION
[0030] The specific embodiments of the present invention are further described below in conjunction with the accompanying drawings. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0031] As attached Figure 1 As shown, a tunnel defect segmentation and labeling method based on fine-tuning a large visual model comprises the following steps:
[0032] S1, construct tunnel disease dataset;
[0033] S2, freezes the shallow weights of the image encoder of the visual large model, and obtains the disease segmentation large model after training with the disease dataset;
[0034] S3, build a graphical user interface to enable the large disease segmentation model to obtain bounding box prompts for fast pixel-level annotation;
[0035] S4, repeat S2 and S3 during use to achieve model update.
[0036] The construction of the disease data set in step S1 is specifically as follows:
[0037] The tunnel disease data set should include the original image of tunnel apparent disease and the binary image obtained by manual annotation using annotation software, where the disease pixel value is 1 and the background pixel value is 0. The original data image and the annotated binary image should be placed in two separate folders, and the image names should correspond to each other.
[0038] The visual macro model in step S2 is specifically:
[0039] like Figure 2 As shown in the figure, the visual large model is designed to complete the semantic segmentation task. The network adopts an encoder-decoder architecture based on the VisionTransformer structure, including three key components: image encoder, bounding box prompt encoder and mask decoder. The image encoder encodes the original image into image embeddings, and the bounding box encodes the input box prompt position to obtain prompt embedding. The two are fused in the image decoder to output maskembeddings, which are then activated by the sigmoid function and restored to the original image size using bilinear interpolation upsampling.
[0040] Specifically, the image encoder first resizes the image to 1024×1024×3 (“1024” is the number of pixels in the horizontal and vertical directions; “3” is the number of color channels, namely R (red), G (green), and B (blue)), and then discretizes the image into 64×64×768 image embeddings using a convolution operation with a kernel size of 16 and a stride of 16. After expansion, position embedding is added to each patch embedding and then input into a multi-layer transformer. The output vector is then compressed to a feature dimension of 256 through two layers of convolution (kernel sizes are 1 and 3 respectively, and each layer output is connected to LayerNorm2d). In order to better capture the global information in the image sequence, a multi-head self-attention mechanism is used.
[0041] Specifically, the bounding box hint encoder encodes a pair of upper left corner points and lower right corner points of the bounding box into a 256-dimensional vector representation, which is used to describe the position information of the bounding box. Each corner point is encoded by the position coordinates of the point (such as x and y coordinates), and an additional embedding is added to indicate whether the point is located in the upper left corner or the lower right corner of the bounding box. In this way, by combining this information, the encoder can generate a 256-dimensional vector containing the bounding box position features.
[0042] The disease segmentation model in step S2 is:
[0043] After freezing the shallow weights of the visual large model image encoding, the number of frozen layers is N, and the deep weight results of the visual large model image encoder are updated using the tunnel disease dataset. The measurement index of the deep weight results is MIoU or F1-Score:
[0044] (1)
[0045] (2)
[0046] (3)
[0047] (4)
[0048] Where TP is the number of diseased pixels predicted as diseased, FP is the number of background pixels predicted as diseased, FN is the number of diseased pixels predicted as background, and TN is the number of background pixels predicted as background.
[0049] When the image encoder uses a 12-layer Transformer, freezing different shallow weights during training can be obtained in Table 1. When N=8, the model has the best effect and can be used for disease detection.
[0050] Table 1
[0051] Freeze Layers MIoU F1-Score N=0 0.8423 0.8235 N=4 0.8687 0.8534 N=6 0.8635 0.8535 N=8 0.8832 0.8535 N=10 0.8235 0.8123 N=12 0.8132 0.8033
[0052] The graphical user interface in this implementation should include basic functions such as image reading, switching, and storage. First, there should be a boundary box prompt for obtaining the input of tunnel quality inspectors to achieve rapid pre-annotation. There should also be drawing and erasing functions for refining the rapid pre-annotation results to achieve refined annotation.
[0053] The construction of the graphical user interface in step S3 enables the disease segmentation model to obtain the boundary box prompt for rapid pixel-level annotation as follows:
[0054] Building a graphical user interface refers to creating a visual interface with which users can interact. On this visual interface, the user draws a bounding box as a prompt for the diseased area of the diseased image, and inputs the obtained bounding box as a prompt into the disease segmentation model, so that the disease segmentation model can accurately locate and segment the diseased area.
[0055] The disease segmentation model can accept the prompts provided by the user to more accurately locate and segment the disease. The graphical user interface is a visual medium for the interaction between the user and the disease segmentation model, which is used to obtain the user's prompts and input them into the model, so that the model can perform pixel-level segmentation more efficiently and accurately.
[0056] The model update in step S4 is as follows:
[0057] In the face of streaming data in actual tunnel defect detection, a graphical user interface is used to quickly annotate defect data, and the number of samples in the defect data set is continuously expanded to obtain a new data set for updating the visual large model.
[0058] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.
Claims
1. A tunnel defect segmentation and labeling method based on fine-tuning of a large visual model, characterized in that The following steps are involved: S1, construct tunnel disease dataset; S2, freezes the shallow weights of the image encoder of the visual large model, and obtains the disease segmentation large model after training with the disease dataset; S3, build a graphical user interface to enable the large disease segmentation model to obtain bounding box prompts for fast pixel-level annotation; S4, repeat S2 and S3 during use to achieve model update.
2. The tunnel defect segmentation and labeling method based on fine-tuning the large visual model according to claim 1 is characterized by: The construction of the disease data set in step S1 is specifically as follows: The tunnel disease dataset should include the original image of tunnel apparent disease and the binary image obtained by manual annotation using annotation software, where the disease pixel value is 1 and the background pixel value is 0.
3. The tunnel defect segmentation and labeling method based on fine-tuning the large visual model according to claim 1 is characterized in that: The visual macro model in step S2 is specifically: The visual large model is designed to complete the semantic segmentation task. The network adopts an encoder-decoder architecture based on the Vision Transformer structure, including three key components: image encoder, bounding box prompt encoder and mask decoder. The image encoder encodes the original image into image embeddings, and the bounding box encodes the input box prompt position to obtain prompt embedding. The two are fused in the image decoder to output mask embeddings, which are then activated by the sigmoid function and restored to the original image size using bilinear interpolation upsampling.
4. The tunnel defect segmentation and labeling method based on fine-tuning the visual large model according to claim 1 is characterized in that: The disease segmentation model in step S2 is: After freezing the shallow weights of the visual large model image encoding, the number of frozen layers is N, and the deep weight results of the visual large model image encoder are updated using the tunnel disease dataset.
5. The tunnel defect segmentation and labeling method based on fine-tuning the visual large model according to claim 4 is characterized in that: The measurement indicator of the deep weight result is MIoU or F1-Score: (1) (2) (3) (4) Where TP is the number of diseased pixels predicted as diseased, FP is the number of background pixels predicted as diseased, FN is the number of diseased pixels predicted as background, and TN is the number of background pixels predicted as background.
6. The tunnel defect segmentation and labeling method based on fine-tuning the large visual model according to claim 1 is characterized in that: The construction of the graphical user interface in step S3 enables the disease segmentation model to obtain the boundary box prompt for rapid pixel-level annotation as follows: Building a graphical user interface refers to creating a visual interface with which users can interact. On this visual interface, the user draws a bounding box as a prompt for the diseased area of the diseased image, and inputs the obtained bounding box as a prompt into the disease segmentation model, so that the disease segmentation model can accurately locate and segment the diseased area.
7. The tunnel defect segmentation and labeling method based on fine-tuning the large visual model according to claim 1 is characterized in that: The model update in step S4 is as follows: In the face of streaming data in actual tunnel defect detection, a graphical user interface is used to quickly annotate defect data, and the number of samples in the defect data set is continuously expanded to obtain a new data set for updating the visual large model.
Citation Information
Patent Citations
Intelligent detection method, device and equipment for tunnel water leakage image and storage medium
CN115345859A
Ultrasonic image analysis method and related device
CN117237351A
Liveness detection method, training method for liveness detection model, apparatus thereof, and system
WO2022246612A1
Cited By
Method and device for implementing artificial intelligence industrial quality inspection data labeling agent
CN121053483A
