Rail transit construction safety identification model dynamic adaptation method and system

By constructing a scenario parameter memory library and a dynamic expert hybrid mechanism, the dynamic adaptation method of the rail transit construction safety identification model solves the problems of poor cross-scenario adaptability and insufficient sustainable learning ability, achieves rapid adaptation to new scenarios and maintains the performance of old scenarios, and improves the accuracy and efficiency of safety hazard identification.

CN120635839AActive Publication Date: 2025-09-12BEIJING URBAN CONSTRUCTION DESIGN & DEVELOPMENT GROUP CO LIMITED

Patent Information

Application Number
CN202510705139.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-09-12
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

The existing safety hazard identification model for urban rail transit projects has deficiencies in cross-scenario adaptability and sustainable learning capabilities, making it difficult to effectively identify safety hazards in complex and changing construction scenarios.

Method used

A dynamic adaptation method of the rail transit construction safety identification model is adopted. By building a scene parameter memory library, using the dynamic expert hybrid mechanism and low-rank adaptation technology, the optimal expert module is adaptively selected for parameter update, and combined with the multi-task optimization objective function, incremental learning is achieved while retaining old scene knowledge.

Benefits of technology

It improves the model's adaptability and sustainable learning ability in new scenarios, avoids forgetting old scenario knowledge, reduces computing costs, enhances the model's robustness and recognition ability in noisy environments, and improves the safety and reliability of urban rail transit projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635839A_ABST
    Figure CN120635839A_ABST
Patent Text Reader

Abstract

The invention discloses a rail transit construction safety identification model dynamic adaptation method and system. The method comprises the following steps: initializing an urban rail transit engineering construction potential safety hazard identification model and new scene training parameters; reading an urban rail transit engineering construction potential safety hazard identification image and a corresponding label in a new scene, and performing data enhancement operation; selecting a historical scene similar to the current new scene in feature, and setting a weight parameter of a new scene model by taking a corresponding encoder weight as an initial value; carrying out image coding and category prediction on the enhanced image data; calculating a total loss value comprehensively considering classification accuracy and model parameter stability through a multi-task optimization objective function; selecting specific parameters in the image encoder to update through adaptive methods such as a dynamic expert hybrid mechanism and dynamic low-rank adaptation; the problems that an existing continuous learning method is poor in cross-scene adaptability and insufficient in sustainable learning ability in urban rail transit engineering potential safety hazard identification can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of rail transit safety control, and more specifically, relates to a method and system for dynamically adapting a rail transit construction safety identification model. Background Art

[0002] Continuous learning strategies for urban rail transit engineering safety hazard identification models primarily include regularization-based, replay-based, optimization-based, and architecture-based approaches. Regularization-based approaches introduce regularization constraints to limit model parameter changes, preventing new task learning from overwriting key parameters of old tasks. Replay-based approaches mitigate forgetting by storing or generating old task samples for mixed training with new task data. Optimization-based approaches adjust the optimization process to ensure that the gradient update direction is compatible with the old task. Architecture-based approaches dynamically expand or isolate model parameters, allocating dedicated subnetworks for different tasks.

[0003] However, existing continuous learning methods suffer from numerous problems. Regularization-based methods suffer from inaccurate parameter importance estimation, reliance on task boundaries, unsuitability for online or fuzzy task boundary scenarios, and over-regularization that can hinder learning of new tasks. Replay-based methods suffer from the additional memory required to replay raw data, potential privacy issues, and buffer sample selection strategies that can lead to unbalanced representations of old tasks. Optimization-based methods suffer from high computational cost, the need to store gradients or feature spaces of old tasks, increased memory and computational burdens, and sensitivity to task similarity.

[0004] Therefore, there is an urgent need for a new method and system that can effectively solve the problems of poor cross-scenario adaptability and insufficient sustainable learning ability of existing continuous learning methods in identifying safety hazards in urban rail transit projects. Summary of the Invention

[0005] In response to the above-mentioned defects or improvement needs of the existing technology, the present invention provides a dynamic adaptation method and system for a rail transit construction safety identification model, which can efficiently learn new tasks without forgetting old knowledge, and at the same time has the ability to process multi-scale visual features and dynamic scene context to meet the safety hazard identification needs in complex and changeable urban rail transit engineering construction scenarios.

[0006] To achieve the above objectives, one aspect of the present invention provides a method for dynamically adapting a rail transit construction safety identification model, comprising the following steps:

[0007] S1. Initialize the urban rail transit project construction safety hazard identification model and new scenario training parameters;

[0008] S2. Read in the new scenario's urban rail transit project construction safety hazard identification images and corresponding labels, perform data augmentation on these images, and obtain enhanced image data.

[0009] S3. Select historical scenes with similar features to the current new scene from a pre-built scene parameter memory library by image feature comparison; use the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model;

[0010] S4. Input the enhanced image data into the image encoder to obtain a feature vector, input the feature vector into the discriminator, and use the discriminator to map the feature vector to the probability distribution of the category to which the image belongs to obtain the category prediction result of the image;

[0011] S5. Construct a multi-task optimization objective function including classification loss and regularization loss; calculate a total loss value that comprehensively considers classification accuracy and model parameter stability through the multi-task optimization objective function;

[0012] S6. Based on the characteristics of the current task and the total loss value calculated in step S5, which comprehensively considers classification accuracy and model parameter stability, a dynamic expert mixture mechanism and a dynamic low-rank adaptation adaptive method are used to select specific parameters in the image encoder for update, so that the model can adapt to new scenes without forgetting old scenes;

[0013] S7. Check whether the model has completed the predetermined number of training rounds or reached other stopping conditions; if the training is not completed, return to step S2 to continue training; if the training is completed, proceed to the next step;

[0014] S8. Update the scene parameter memory library and store the parameters of the new scene and the updated model information in the scene parameter memory library for use in future training.

[0015] Furthermore, step 1 includes: model structure initialization, optimizer setting, image encoder parameter setting, discriminator parameter setting and other initialization settings;

[0016] Model structure initialization includes determining the model architecture for identifying safety hazards in urban rail transit engineering construction, randomly initializing all model parameters or using pre-trained weights, and setting the discriminator structure to initialize the discriminator.

[0017] The optimizer settings include selecting the optimizer, setting the optimizer's initial learning rate, and gradually reducing the learning rate using a cosine annealing strategy; setting the batch size and the total number of training rounds;

[0018] Image encoder parameter settings include setting the number of visual encoding layers and setting multi-head attention parameters;

[0019] Discriminator parameter setting includes setting the total number of output categories;

[0020] Other initialization settings include setting the random seed, initializing the log and saving path.

[0021] Furthermore, step S2 includes the following steps:

[0022] S21: read new scene images and labels;

[0023] S22: Data cleaning of new scene images and labels;

[0024] S23: Perform data enhancement operations on the cleaned data;

[0025] S24: Standardize the data after data augmentation operation;

[0026] S25: Batching and loading the standardized data.

[0027] Furthermore, step S3 includes:

[0028] S31: Read the new scene image and check the image format to ensure that the format and size of the input image meet the model requirements;

[0029] S32: extracting features from the read new scene image to obtain a feature vector for each image;

[0030] S33: During the scene training process, the image features and corresponding model parameters of the historical scenes are saved to build a scene parameter memory library; after each new scene training is completed, the features of the new scene and the updated model parameters are stored in the scene parameter memory library;

[0031] S34: comparing the feature vector of the new scene image obtained in step S32 with the feature vectors of historical scene images stored in the scene parameter memory library, and calculating the feature distance between them; selecting the historical scene that is most similar to the new scene based on the feature distance;

[0032] S35: Initializing the encoder weight parameters of the new scene model according to the historical scene that is most similar to the new scene; including obtaining the encoder weights corresponding to the historical scene that is most similar to the new scene from the scene parameter memory library; and using the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model.

[0033] Furthermore, step S4 includes:

[0034] S41: Input the image enhanced in step S2 into an image encoder, and perform feature encoding on the input image to obtain a feature vector;

[0035] S42: Input the feature vector output by the image encoder into the discriminator; perform a linear transformation on the input feature vector through the linear layer in the discriminator to obtain the score of each category; normalize the output of the linear layer through the softmax layer to obtain the probability distribution of each category; based on the output of the softmax layer, select the category with the highest probability as the prediction result.

[0036] Furthermore, step S5 includes:

[0037] S51: Define a classification loss function and use the cross entropy loss function as the classification loss function; calculate the classification loss of the model-predicted sample based on the model-predicted category probability obtained in step S4 and the true label read in step S2;

[0038] S52: Define a regularization loss function and use elastic weight consolidation as a regularization method; according to the elastic weight consolidation method, use the model parameters of the old scene to regularize the parameters of the current new scene, and calculate the regularization loss;

[0039] S53: Combine the classification loss and regularization loss into a comprehensive multi-task optimization objective function, and calculate the total loss value that comprehensively considers the model's classification accuracy on new tasks and its ability to retain old tasks.

[0040] Furthermore, in step S51, the classification loss L is expressed by formula (1):

[0041]

[0042] Among them, y i,c is the true label of the i-th sample in category C; p i,c is the probability that the i-th sample belongs to category C predicted by the model; N is the number of samples;

[0043] In step S52, the regularization loss L EWC ; It is expressed by formula (2):

[0044]

[0045] Among them, θ i Indicates the parameters of the current task; F i is the diagonal element of the Fisher information matrix, representing the parameter θ i the importance of represents the optimal parameters on the old scene;

[0046] In step S53, the multi-task optimization objective function L 总 It is expressed by formula (3):

[0047] L总 =L+λL EWC (3)

[0048] Among them, λ is the regularization coefficient, which is used to balance the weights of classification loss and regularization loss.

[0049] Furthermore, step S6 includes:

[0050] S61: Calculate the gradient of the total loss value with respect to the model parameters in step S5 through the back propagation algorithm

[0051] S62: Initialize multiple expert modules in the dynamic expert hybrid mechanism, and adaptively select the optimal expert module for parameter update based on the characteristics of the current task and the gradient of the total loss value with respect to the model parameters;

[0052] S63: performing low-rank decomposition on the parameter weight matrix to be updated into the product of two low-rank matrices;

[0053] S64: After updating the parameters, verify the model to ensure that the model's performance in the new scenario is improved while not forgetting the knowledge of the old scenario; based on the verification results, adjust the learning rate and regularization coefficient to optimize the model training process.

[0054] Furthermore, in step S62, based on the characteristics of the current task and the gradient of the total loss value with respect to the model parameters, the optimal expert module is adaptively selected for parameter update, including:

[0055] S621: Using the ReLU function as the activation function; for each expert module, linearly transform the model's input feature vector using the parameters of the expert module, and then calculate the activation score using the activation function;

[0056] S622: Normalize the activation scores of all expert modules through the softmax function so that their sum is 1;

[0057] S623: According to the normalized activation scores, select the expert module with the highest activation score to perform parameter update.

[0058] A second aspect of the present invention provides a rail transit construction safety identification model dynamic adaptation system, which is used to implement the rail transit construction safety identification model dynamic adaptation method, including:

[0059] Initialization module, used to set the initial state and training parameters of the model;

[0060] The data preprocessing module is used to read the images and corresponding labels of safety hazard identification of urban rail transit engineering construction in new scenarios and perform data enhancement operations on the images;

[0061] The scene parameter memory module is used to store the image features of historical scenes and the corresponding model parameters;

[0062] The model initialization module is used to select the most similar historical scene from the scene parameter memory library according to the characteristics of the new scene image, and initialize the weight of the new scene model with its corresponding encoder weight;

[0063] A feature extraction module is used to extract feature vectors of new scene images using a pre-trained feature extraction network;

[0064] The image encoding and discrimination module is used to input the enhanced image data into the image encoder to obtain the feature vector and predict the category of the image through the discriminator;

[0065] The loss function calculation module is used to construct a multi-task optimization objective function including classification loss and regularization loss, and calculate the total loss value;

[0066] The training control module is used to check whether the model has completed the predetermined number of training rounds or reached other stopping conditions, and control the iteration and termination of the training process;

[0067] The model parameter update module is used to dynamically and adaptively select specific parameters in the image encoder for update based on the gradient of the total loss value through a dynamic expert mixture mechanism and low-rank adaptation;

[0068] Model verification and adjustment module, used to verify the performance of the updated model and adjust the learning rate and regularization coefficient;

[0069] The logging and model saving module records key information during the training process and saves the trained model weights.

[0070] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0071] (1) The dynamic adaptation method and system of the rail transit construction safety identification model of the present invention effectively solves the problems of poor cross-scenario adaptability and insufficient sustainable learning ability of existing continuous learning methods in the identification of safety hazards in urban rail transit projects by introducing a sustainable learning strategy of hybrid expert low-rank adaptation and constructing a scene memory library. The method uses a dynamic expert hybrid mechanism to adaptively select the optimal expert module for parameter update, and combines low-rank adaptation technology to significantly reduce the number of parameters that need to be trained, thereby avoiding forgetting knowledge of old scenes while adapting to new scenes. In addition, by selecting similar scenes from the scene parameter memory library to initialize the encoder weights, incremental learning is achieved, further alleviating the problem of catastrophic forgetting. Compared with the existing technology, the method of the present invention has stronger adaptability in new scenarios and better sustainable learning ability, can more effectively identify safety hazards in urban rail transit project construction, and improve the safety and reliability of urban rail transit projects.

[0072] (2) The present invention's dynamic adaptation method and system for rail transit construction safety identification models addresses the problem of traditional continuous learning methods' poor cross-scenario adaptability and difficulty maintaining recognition capabilities for old scenarios in new ones. By using a dynamic expert hybrid mechanism and low-rank adaptation technology, the model can adaptively select the optimal expert module for parameter updates, thereby rapidly adapting to new scenarios while maintaining performance for old scenarios. This cross-scenario adaptive feature extraction capability significantly improves the model's adaptability.

[0073] (3) The dynamic adaptation method and system of the rail transit construction safety identification model of the present invention addresses the problem that existing methods easily forget the knowledge of old tasks during continuous learning, resulting in a decline in model performance. By constructing a scene parameter memory library, the model can use the knowledge of historical scenes for initialization during new scene training to avoid catastrophic forgetting. This incremental learning method enhances the sustainable learning ability of the model, enabling it to learn new knowledge without forgetting old knowledge when continuously receiving new task data. Since the playback-based method needs to store original data, which may involve privacy issues, by selecting similar scenes from the scene parameter memory library to initialize the encoder weights, the dependence on original data is reduced, thereby alleviating privacy issues to a certain extent.

[0074] (4) The present invention's dynamic adaptation method and system for rail transit construction safety identification models addresses the problem that optimization-based methods require storing gradients or feature spaces of old tasks, which increases memory and computational burdens. Instead, the system employs low-rank adaptation technology to decompose the weight matrix into the product of two low-rank matrices, significantly reducing the number of parameters that need to be trained and thus lowering computational costs. This makes model training more efficient and suitable for resource-constrained environments.

[0075] (5) The dynamic adaptation method and system of the rail transit construction safety identification model of the present invention addresses the problem that the performance of the model may be affected in a noisy environment. By performing operations such as random noise addition through a data preprocessing module, the model can adapt to different lighting environments and noise interference, thereby improving the robustness of the model in practical applications.

[0076] (6) The dynamic adaptation method and system of the rail transit construction safety identification model of the present invention addresses the problem that the learning rate and regularization coefficient may need to be manually adjusted during the model training process. Through the model verification and adjustment module, the learning rate and regularization coefficient can be automatically adjusted according to the verification results, thereby optimizing the model training process and improving training efficiency and model performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 A schematic flow chart of a method for dynamically adapting a rail transit construction safety identification model according to an embodiment of the present invention;

[0078] Figure 2 This is a schematic diagram of the internal logic of a method for dynamically adapting a rail transit construction safety identification model according to an embodiment of the present invention;

[0079] Figure 3 This is a schematic structural diagram of a rail transit construction safety identification model dynamic adaptation system according to an embodiment of the present invention;

[0080] Figure 4 The figure is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0081] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only intended to illustrate the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.

[0082] like Figure 1 and Figure 2 As shown, one aspect of the present invention provides a method for dynamically adapting a rail transit construction safety identification model, comprising the following steps:

[0083] S1. Initialize the urban rail transit project construction safety hazard identification model and new scenario training parameters;

[0084] S2. Preprocessing of training data for new scenarios: Read in images and corresponding labels for identifying safety hazards in urban rail transit construction projects under new scenarios, perform data augmentation on these images, and obtain enhanced image data.

[0085] S3. Select similar scenes from the scene parameter memory to initialize the encoder weights: select historical scenes with similar features to the current new scene from the pre-built scene parameter memory by image feature comparison; use the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model;

[0086] S4, image feature encoding and discriminator prediction: The enhanced image data is input into the image encoder to obtain a feature vector, which is then input into the discriminator. The discriminator maps the feature vector to the probability distribution of the image category to obtain the category prediction result of the enhanced image;

[0087] S5. Calculate the loss function: Construct a multi-task optimization objective function including classification loss and regularization loss; calculate the total loss value that comprehensively considers classification accuracy and model parameter stability (ability to maintain old tasks) through the multi-task optimization objective function;

[0088] S6. Based on the characteristics of the current task and the total loss value calculated in step S5, which comprehensively considers classification accuracy and model parameter stability, the dynamic expert mixture mechanism and low-rank adaptation dynamic LoRA (Low-Rank Adaptation) are used to adaptively select specific parameters in the image encoder for update, so that the model can adapt to new scenes without forgetting old scenes;

[0089] S7. Check whether the model has completed the predetermined number of training rounds or reached other stopping conditions; if the training is not completed, return to step S2 to continue training; if the training is completed, proceed to the next step;

[0090] S8. Update the scene parameter memory library and store the parameters of the new scene and the updated model information in the scene parameter memory library for use in future training.

[0091] Furthermore, step 1 includes: model structure initialization, optimizer setting, image encoder parameter setting, discriminator parameter setting and other initialization settings; wherein,

[0092] Model structure initialization includes: selecting a model architecture to identify safety hazards in urban rail transit construction projects, such as using Siwn-Transformer-Large as an image encoder, which can effectively extract image features; initializing model parameters, randomly initializing all model parameters or using pre-trained weights to ensure that the model has a reasonable initial state at the beginning of training; initializing the discriminator, setting the discriminator structure, such as using a linear layer plus a softmax layer to predict the safety hazard category to which the image belongs based on the feature vector output by the encoder;

[0093] Optimizer settings include: selecting an optimizer, such as the AdamW optimizer, which combines the Adam optimizer's adaptive learning rate adjustment and weight decay strategy to help stabilize the training process; setting the optimizer's initial learning rate, setting the optimizer's initial learning rate to 1e-4, and using a cosine annealing strategy to gradually reduce the learning rate to 1e-6 to ensure that the learning rate can be adaptively adjusted during training to avoid premature convergence or insufficient training; setting the batch size, setting the batch size to 32, which determines the amount of data input to the model during each training, affecting the training speed and stability of the model; setting the total number of training rounds, setting the total number of training rounds to 300, which determines the total number of iterations of model training, ensuring that the model has enough time to learn the features in the data;

[0094] The image encoder parameter settings include: setting the number of visual encoding layers, setting the number of visual encoding layers of the image encoder to [2, 2, 4, 2], which determines the number of layers in different stages of the encoder and affects the depth and complexity of feature extraction; setting the multi-head attention parameters, setting the multi-head attention parameters to [4, 8, 26, 32], which determines the number of heads of the multi-head attention mechanism in each encoding layer, helping the model better capture local and global features in the image;

[0095] The discriminator parameter settings include: setting the total number of output categories. The total number of output categories of the discriminator is set to 80. This determines the number of safety hazard categories that the model can identify, ensuring that the model can cover all possible safety hazard types;

[0096] Other initialization settings include: setting the random seed to ensure the repeatability of experimental results, making operations such as model initialization and data augmentation deterministic; initializing the log and save paths, setting the log recording path and model save path to record key information during training and save the trained model weights;

[0097] Through step S1, the model structure and training parameters are initialized, and a safety hazard identification model for urban rail transit engineering construction with reasonable initial parameter settings is obtained, which is ready for subsequent training and optimization processes.

[0098] Furthermore, the preprocessing of the new scene training data in step S2 is a key step in the dynamic adaptation method of the present invention, which ensures that the data input to the model is of high quality and diverse, thereby improving the robustness and generalization ability of the model; step S2 includes:

[0099] S21: Read new scene images and labels; including

[0100] Read images: Read images from a specified data source to identify safety hazards in urban rail transit construction projects under new scenarios. These images may be taken from construction sites and contain various safety hazard scenarios.

[0101] Read labels: Simultaneously read the labels corresponding to the image. These labels identify the specific category of the safety hazard in the image. Labels can be category indexes (such as numbers 0 to 79, corresponding to 80 categories) or category names (such as "not wearing a helmet" or "equipment failure").

[0102] Data format check: Ensure that the read images and labels are in the correct format. For example, the image format is a common image file format (such as JPEG, PNG), and the label format is a CSV file, JSON file, or directly stored in the database;

[0103] S22: Data cleaning for reading new scene images and labels; including:

[0104] Remove invalid data: Check the validity of images and labels, and remove samples with damaged image files or missing labels. For example, check whether the image file can be opened normally and whether the label is complete and in the expected format;

[0105] Handling outliers: Correct or delete outliers in labels (such as incorrect category labels or missing values). For example, if the category index of a label exceeds the predefined category range, correct it to a reasonable value or delete the sample.

[0106] S23: Perform data enhancement operations on the cleaned data, including:

[0107] Random rotation: Randomly rotate the image with an angle range of -10° to 10°. This helps the model learn the characteristics of the image at different angles and improves the model's robustness to image rotation.

[0108] Random flipping: flip the image horizontally or vertically with a probability of 50%; this can increase the diversity of the data and enable the model to better handle changes in image symmetry;

[0109] Random noise addition: Randomly add Gaussian noise to the image; this helps simulate the noise interference in real scenes and improve the performance of the model in noisy environments;

[0110] Brightness adjustment: Randomly adjust the brightness of the image to simulate scenes under different lighting conditions; for example, by adjusting the contrast and brightness parameters of the image, the model can adapt to different lighting environments;

[0111] Cropping and scaling: Randomly crop and scale the image to ensure that the image size of the input model is consistent; for example, crop the image to a fixed size (such as 224×224 pixels) and scale it appropriately to maintain the aspect ratio of the image;

[0112] S24: Standardize the data after the data enhancement operation; including:

[0113] Pixel value normalization, normalizing the pixel values ​​of the image to the range of 0 to 1; usually achieved by dividing the pixel value by 255 (the maximum pixel value of the image), which helps speed up the model training process;

[0114] Mean and standard deviation normalization, perform mean and standard deviation normalization on the image. Calculate the mean and standard deviation of the image dataset, and then normalize each pixel value;

[0115] S25: Batching and loading the standardized data; including:

[0116] Data batching: organize the preprocessed images and label data into batches so that the model can be trained batch by batch. Divide the data into multiple batches according to the batch size set in step S1 (e.g., 32);

[0117] Data loader settings: Set up the data loader to efficiently load and transfer data during training. The data loader can implement multi-threaded loading, data scrambling and other functions to improve training efficiency.

[0118] Through step S2, preprocessed enhanced image data and corresponding label data can be obtained. These data have higher diversity and quality, can better support the model training process, and improve the robustness and generalization ability of the model;

[0119] Furthermore, selecting similar scenes from the scene parameter memory library to initialize the encoder weights in step S3 is a key step in the method of the present invention. It uses the model parameters of historical scenes to initialize the weights of the new scene model, thereby avoiding catastrophic forgetting and improving the cross-scene adaptability of the model. The following is a detailed breakdown of step S3, including:

[0120] S31: Read the new scene image and check the image format to ensure that the format and size of the input image meet the model requirements;

[0121] Read the images for identifying safety hazards in urban rail transit construction projects in the new scenario; these images are the enhanced image data preprocessed in step S2; check the image format to ensure that the format and size of the input image meet the model requirements, for example, the image size is 224×224 pixels and the format is normalized floating point number;

[0122] S32: Extract features from the read new scene image to obtain a feature vector for each image; including:

[0123] Select a feature extraction network. Use a pre-trained feature extraction network (such as ResNet) to extract features from the new scene image. ResNet is a commonly used deep convolutional neural network that can effectively extract high-level features of images and has good generalization and feature extraction capabilities. Other pre-trained deep learning models, such as VGG and Inception, can also be selected. The specific choice depends on the actual application scenario and data characteristics.

[0124] Extract feature vectors and input the new scene image into the ResNet network to obtain the feature vectors of each image. These feature vectors will be used for subsequent similarity comparison;

[0125] S33: During the scene training process, the image features and corresponding model parameters of the historical scenes are saved to build a scene parameter memory library. After each new scene training is completed, the features of the new scene and the updated model parameters are stored in the scene parameter memory library for use in future new scenes.

[0126] S34: comparing the feature vector of the new scene image obtained in step S32 with the feature vectors of historical scene images stored in the scene parameter memory library, and calculating the feature distance between them; selecting the historical scene most similar to the new scene based on the feature distance; for example, selecting the historical scene with the smallest feature distance as the most similar scene;

[0127] The feature distance calculation method in step S34 includes the Euclidean distance calculation method and the cosine similarity calculation method. Euclidean distance and cosine similarity are two commonly used feature distance calculation methods. Euclidean distance measures the absolute distance between feature vectors, while cosine similarity measures the directional similarity between feature vectors. The specific method to be selected can be determined according to the characteristics and requirements of the actual data.

[0128] S35: Initializing the encoder weight parameters of the new scene model according to the historical scene that is most similar to the new scene; including obtaining the encoder weights corresponding to the historical scene that is most similar to the new scene from the scene parameter memory library; using the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model; this step ensures that the new scene model has an initial state close to the similar historical scene at the beginning of training, thereby improving the convergence speed and performance of the model.

[0129] Step S3 yields a model for identifying safety hazards in urban rail transit construction projects, initialized based on model parameters from historical scenarios similar to the new scenario. This initialization method helps the model quickly adapt to new scenarios while preventing it from forgetting knowledge from previous tasks when learning new ones. The method can effectively utilize knowledge from historical scenarios to initialize the weights of new scenario models, thereby improving the model's cross-scenario adaptability and sustainable learning capabilities.

[0130] Furthermore, the image feature encoding and discriminator prediction in step S4 are the core links in the dynamic adaptation method of the rail transit construction safety identification model. It is responsible for converting the preprocessed image data into feature vectors and performing category prediction based on these feature vectors. The following is a detailed breakdown of step S4, including:

[0131] S41: Input the image enhanced by step S2 into an image encoder, and perform feature encoding on the input image to obtain a feature vector; specifically, the process includes:

[0132] In this invention, the image encoder uses a Siwn-Transformer-Large structure, which can effectively extract high-level features of images. After the enhanced image data is input into the image encoder, it is forward propagated through the encoder's multi-layer network structure to obtain a feature vector for each image. Specifically, the Siwn-Transformer-Large structure gradually extracts local and global features of the image through a multi-head self-attention mechanism and a feedforward neural network. The feature vectors output by the image encoder in this step will serve as input to the subsequent discriminator. These feature vectors contain key information about safety hazards in the image and can support the discriminator in making accurate category predictions.

[0133] The Siwn-Transformer-Large architecture is a Transformer-based deep learning model with powerful feature extraction capabilities. It uses a multi-head self-attention mechanism to capture long-range dependencies in images, while further processing features through a feedforward neural network. This architecture is particularly well-suited for processing complex image data and can extract high-level features that are helpful for identifying safety hazards.

[0134] S42: Input the feature vector output by the image encoder into the discriminator; perform a linear transformation on the input feature vector through the linear layer in the discriminator to obtain the score of each category; normalize the output of the linear layer through the softmax layer to obtain the probability distribution of each category; based on the output of the softmax layer, select the category with the highest probability as the prediction result;

[0135] Among them, the discriminator is used to map the feature vector to the category probability distribution; the structure of the discriminator usually includes a linear layer and a softmax layer, which can predict the category of safety hazards based on the features output by the encoder; the linear layer is responsible for mapping the feature vector to the category score, while the softmax layer normalizes these scores into a probability distribution; the linear layer in the discriminator performs a linear transformation on the input feature vector to obtain the score of each category; these scores reflect the possibility that the image belongs to each category; the output of the linear layer is normalized through the softmax layer to obtain the probability distribution of each category; the output of the softmax layer is a probability vector, in which each element represents the probability that the image belongs to the corresponding category; based on the output of the softmax layer, the category with the highest probability is selected as the prediction result; specifically, the predicted category is the category index with the highest probability;

[0136] The entire forward propagation process in step S4 is automated and implemented using a deep learning framework such as PyTorch or TensorFlow. In practice, you only need to pass the input image data to the model, which will automatically complete the feature encoding and category prediction process.

[0137] Through step S4, the model can obtain the category prediction results of the input image; these prediction results will be used in the subsequent loss function calculation (step S5) to evaluate the performance of the model and guide the update of the model parameters;

[0138] Through the detailed operations of step S4 above, the method of the present invention can effectively convert the input image into feature vectors and make accurate category predictions based on these feature vectors. This provides a basis for subsequent loss function calculation and model parameter update, ensuring that the model can quickly adapt to new scenarios while maintaining its performance in old scenarios.

[0139] Furthermore, the loss function calculation in step S5 is a key step in the dynamic adaptation method of the rail transit construction safety identification model of the present invention. It guides the model training process by constructing a multi-task optimization objective function and comprehensively considering classification accuracy and model parameter stability. The following is a detailed breakdown of step S5, including:

[0140] S51: Define the classification loss function and use the cross-entropy loss function as the classification loss function; calculate the classification loss L of the model-predicted sample based on the model-predicted category probability obtained in step S4 and the true label read in step S2; expressed by formula (1):

[0141]

[0142] Among them, y i,cis the true label of the i-th sample in category C; p i,c is the probability that the i-th sample belongs to category C predicted by the model; N is the number of samples;

[0143] S52: Define the regularization loss function and use Elastic Weight Consolidation (EWC) as the regularization method; according to the EWC method, use the model parameters of the old scene to regularize the parameters of the current new scene and calculate the regularization loss L EWC ; It is expressed by formula (2):

[0144]

[0145] Among them, θ i Indicates the parameters of the current task; F i is the diagonal element of the Fisher information matrix, representing the parameter θ i the importance of represents the optimal parameters on the old scene;

[0146] In step S52, EWC prevents the new task from learning and overwriting the key parameters of the old task by limiting the changes in model parameters;

[0147] S53: Combine the classification loss and regularization loss into a comprehensive multi-task optimization objective function, and calculate the total loss value that comprehensively considers the classification accuracy of the model on the new task and its ability to maintain the old task;

[0148] The multi-task optimization objective function L 总 It is expressed by formula (3):

[0149] L 总 =L+λL EWC (3)

[0150] Among them, λ is the regularization coefficient, which is used to balance the weight of classification loss and regularization loss. By adjusting λ, the influence of regularization loss on the total loss can be controlled;

[0151] The cross entropy loss function used in step S5 is a commonly used loss function in classification tasks. It can effectively measure the difference between the model's predicted probability distribution and the true distribution. It penalizes the model's prediction error so that the model can better learn the classification boundary. Elastic Weight Consolidation (EWC) is an effective regularization method that prevents new tasks from overwriting the key parameters of old tasks by limiting the changes in model parameters. It measures the importance of parameters through the Fisher information matrix to ensure that important parameters are not modified significantly. The regularization coefficient λ is used to balance the weights of classification loss and regularization loss. By adjusting λ, the degree of influence of regularization loss on the total loss can be controlled. If λ is too large, the model may be too conservative and difficult to learn new tasks. If λ is too small, the model may forget the knowledge of old tasks.

[0152] The present invention obtains a total loss value that comprehensively considers classification accuracy and model parameter stability through step S5. This total loss value will be used for subsequent model parameter updates (step S6) to guide the model's training process in new scenarios, ensuring that the model can learn new knowledge without forgetting old knowledge, and ensuring the model's adaptability and sustainable learning ability in new scenarios.

[0153] Furthermore, the model parameter update in step S6 is a key step in the dynamic adaptation method of the rail transit construction safety identification model. It selects specific parameters in the image encoder for update through the dynamic expert mixture mechanism and dynamic low-rank adaptation adaptive method, thereby ensuring that the model does not forget the old scenes while adapting to the new scenes. The following is a detailed breakdown of step S6, including:

[0154] S61: Calculate the gradient of the total loss value with respect to the model parameters in step S5 through the back propagation algorithm

[0155] S62: Initialize multiple expert modules in the dynamic expert hybrid mechanism, and adaptively select the optimal expert module for parameter update based on the characteristics of the current task and the gradient of the total loss value with respect to the model parameters;

[0156] S63: Perform a low-rank decomposition of the parameter weight matrix that needs to be updated into the product of two low-rank matrices, which greatly reduces the number of parameters that need to be trained. This ensures that the model can learn new knowledge without forgetting old knowledge when continuously receiving new task data.

[0157] S64: After updating the parameters, validate the model to ensure that the model's performance in the new scenario is improved while not forgetting the knowledge from the old scenario. Based on the validation results, adjust the learning rate and regularization coefficient to optimize the model training process.

[0158] Furthermore, the gradient of the total loss value with respect to the model parameters in step S61 can reflect the change direction and magnitude of the loss value under the current model parameter settings; it is calculated by formula (4):

[0159]

[0160] in, is the gradient of the classification loss; is the gradient of the regularization loss; λ is the regularization coefficient;

[0161] Furthermore, in step S62, according to the characteristics of the current task and the gradient of the total loss value with respect to the model parameters, the optimal expert module is adaptively selected to perform parameter update, including

[0162] S621: Use the ReLU function as the activation function; for each expert module, perform a linear transformation on the model's input feature vector using the parameters of the expert module, and then calculate the activation score using the activation function; where,

[0163] The ReLU function has the advantages of nonlinearity, simple calculation and ability to avoid the gradient vanishing problem;

[0164] The calculation of activation score is expressed by formula (5):

[0165] S j =RELU(W j x+b j ) (5)

[0166] Among them, S j is the activation score of the j-th expert module; W j x is the weight parameter of the jth expert module, x is the input feature vector of the model, b j is the bias parameter of the jth expert module;

[0167] S622: Normalize the activation scores of all expert modules through the softmax function so that their sum is 1;

[0168] S623: Select the expert module with the highest activation score according to the normalized activation score to perform parameter update;

[0169] Furthermore, the parameter update in step S63 is expressed by formula (6):

[0170]

[0171] Among them, θ t is the parameter that needs to be updated, η is the learning rate;

[0172] Through step S6, a safety hazard identification model for urban rail transit engineering construction is obtained after parameter update. The model has better adaptability in new scenarios while maintaining the performance of old scenarios.

[0173] In step S6, through multiple expert modules, the model can adaptively select the optimal expert module for parameter update based on the characteristics of the current task; this approach enables the model to flexibly adjust specific parameters instead of globally updating all parameters, thereby improving the adaptability and efficiency of the model; low-rank adaptation greatly reduces the number of parameters that need to be trained by decomposing the weight matrix into the product of two low-rank matrices; this not only improves training efficiency, but also ensures that the updated parameters do not have a negative impact on the performance of the old task through the constraints of regularization loss. Regularization loss prevents new task learning from overwriting the key parameters of the old task by limiting the change of parameters. By adjusting the regularization coefficient λ, the weights of classification loss and regularization loss can be balanced, thereby optimizing the training process of the model;

[0174] Through step S6, a parameter-updated urban rail transit project construction safety hazard identification model can be obtained. The model has better adaptability in new scenarios while maintaining the performance of old scenarios; thereby achieving better cross-scenario adaptability and sustainable learning capabilities.

[0175] like Figure 3 As shown, the second aspect of the present invention provides a rail transit construction safety identification model dynamic adaptation system for implementing the above-mentioned adaptation method, including:

[0176] Initialization module, used to set the initial state and training parameters of the model;

[0177] The data preprocessing module is used to read images and corresponding labels for identifying safety hazards in urban rail transit construction projects under new scenarios and perform data enhancement operations on the images. Specific tasks include: reading images and labels; data cleaning (removing invalid data and processing outliers); data enhancement (random rotation, flipping, noise addition, brightness adjustment, etc.); data normalization (pixel value normalization, mean and standard deviation normalization); and data batching and loading.

[0178] The scene parameter memory module is used to store the image features of historical scenes and the corresponding model parameters. Specific tasks include: building and maintaining the scene parameter memory; storing the features and model parameters of historical scenes; and regularly updating the scene parameter memory to add features and parameters of new scenes.

[0179] The model initialization module is used to select the most similar historical scene from the scene parameter memory based on the features of the new scene image and initialize the weights of the new scene model with its corresponding encoder weights. The specific tasks include reading the feature vector of the new scene image; selecting the most similar historical scene from the scene parameter memory; obtaining the encoder weights of the most similar historical scene; and initializing the weight parameters of the new scene model.

[0180] The feature extraction module is used to extract feature vectors of new scene images using a pre-trained feature extraction network. Specific tasks include: selecting a feature extraction network (such as ResNet); inputting the new scene image into the feature extraction network to obtain feature vectors; and calculating the feature distance between feature vectors (such as Euclidean distance or cosine similarity).

[0181] The image encoding and discrimination module is used to input the enhanced image data into the image encoder to obtain the feature vector and predict the category of the image through the discriminator. The specific tasks include: inputting the enhanced image data into the image encoder (such as Siwn-Transformer-Large); extracting the feature vector from the image encoder; inputting the feature vector into the discriminator (linear layer + softmax layer); and outputting the predicted category probability.

[0182] The loss function calculation module is used to construct a multi-task optimization objective function that includes classification loss and regularization loss, and calculate the total loss value. Specific tasks include: calculating classification loss (cross entropy loss); calculating regularization loss (elastic weight consolidation); combining classification loss and regularization loss to obtain the total loss value;

[0183] The model parameter update module is used to dynamically and adaptively select specific parameters in the image encoder for update based on the gradient of the total loss value through the dynamic expert mixture mechanism and low-rank adaptation. Specific tasks include: calculating the gradient of the total loss value through the backpropagation algorithm and updating the model parameters using an optimization algorithm (such as gradient descent); the dynamic expert mixture mechanism: initializing the expert modules, calculating the activation score of each expert module, and selecting the optimal expert module for parameter update; low-rank adaptive update: initializing the low-rank matrix; updating the specific parameter weight matrix;

[0184] The training control module is used to check whether the model has completed the predetermined number of training rounds or reached other stopping conditions, and control the iteration and termination of the training process;

[0185] The model verification and adjustment module is used to verify the performance of the updated model and adjust the learning rate and regularization coefficient. Specific tasks include: verifying the performance of the model in new scenarios; adjusting the learning rate and regularization coefficient to optimize the model training process;

[0186] The logging and model saving module records key information during the training process and saves the trained model weights. Specific tasks include: setting the logging path; recording key information such as loss value and accuracy during training; and saving the trained model weights.

[0187] The interactions between modules include:

[0188] After the initialization module sets the model's initial state and training parameters, it transfers control to the data preprocessing module to begin processing the input data. After the data preprocessing module completes image reading, cleaning, enhancement, normalization, batching, and loading, it sends the preprocessed image data to the feature extraction module for feature vector extraction. After the feature extraction module calculates the feature vectors for the new scene image, it sends these feature vectors to the model initialization module, which selects similar scenes from the scene parameter memory and initializes the encoder weights. Based on the feature vectors provided by the feature extraction module, the model initialization module queries the scene parameter memory module to select the most similar historical scene and obtain the corresponding encoder weights. The model initialization module uses the weights obtained from the scene parameter memory to initialize the model in the image encoding and discrimination module. After the image encoding and discrimination module outputs predicted class probabilities, it sends these probabilities, along with the true labels, to the loss function calculation module for loss calculation. After the loss function calculation module calculates the total loss, it sends the loss value and gradient information to the model parameter update module for updating the model parameters. After updating the parameters, the model parameter update module reports the updated information to the training control module, which decides whether to continue training or terminate. After each training cycle, the Training Control Module transfers control to the Model Verification and Adjustment Module, which verifies model performance and adjusts the learning rate and regularization coefficient as needed. After verifying model performance, the Model Verification and Adjustment Module sends performance metrics and adjusted parameters to the Logging and Model Preservation Module for logging and model preservation. After the model is saved, the Logging and Model Preservation Module updates the Scenario Parameter Memory Module, storing the new scenario's features and model parameters in the memory.

[0189] The interaction between these modules ensures the entire process of data flow, starting from reading and preprocessing the original image, through feature extraction, model initialization, image encoding and discrimination, loss calculation, parameter update, training control, model verification and adjustment, and finally logging and model preservation. Each module is responsible for a specific task, and their output becomes the input of the next module, forming a complete closed-loop system. Through the collaborative work of the above-mentioned modules, the dynamic adaptation system of the rail transit construction safety identification model of the present invention can effectively realize the dynamic adaptation and continuous learning of the model, improve the adaptability and performance of the model in new scenarios, while maintaining the performance of the old scenarios.

[0190] It should be noted that the dynamic adaptation system for the rail transit construction safety identification model provided in this embodiment can be a computer program (including program code) running in a computer device, for example, the dynamic adaptation system for the rail transit construction safety identification model is an application software; the dynamic adaptation system for the rail transit construction safety identification model can be used to execute the corresponding steps in the above method provided in the embodiment of the present invention.

[0191] In some feasible implementations, the rail transit construction safety identification model dynamic adaptation system provided in this embodiment can be implemented by a combination of software and hardware. As an example, the rail transit construction safety identification model dynamic adaptation system provided in the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the rail transit construction safety identification model dynamic adaptation method provided in the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0192] In some feasible implementations, the dynamic adaptation system for the rail transit construction safety identification model provided in this embodiment can be implemented in software form, which can be software in the form of programs and plug-ins, and include a series of modules to implement the dynamic adaptation method for the rail transit construction safety identification model provided in the embodiment of the present invention.

[0193] The dynamic adaptation system of the rail transit construction safety identification model provided in this embodiment effectively solves the problems of poor cross-scenario adaptability and insufficient sustainable learning ability of existing continuous learning methods in the identification of safety hazards in urban rail transit projects by introducing a sustainable learning strategy of hybrid expert low-rank adaptation and constructing a scene memory library. The method utilizes a dynamic expert hybrid mechanism to adaptively select the optimal expert module for parameter update, and combines low-rank adaptation technology to significantly reduce the amount of parameters that need to be trained, thereby avoiding forgetting knowledge of old scenes while adapting to new scenes. In addition, by selecting similar scenes from the scene parameter memory library to initialize the encoder weights, incremental learning is achieved, further alleviating the problem of catastrophic forgetting. Compared with the existing technology, the method of the present invention has stronger adaptability in new scenarios and better sustainable learning ability, can more effectively identify safety hazards in the construction of urban rail transit projects, and improve the safety and reliability of urban rail transit projects.

[0194] A third aspect of the present invention further provides an electronic device, Figure 4 Schematic diagram of the structure of the electronic device of this embodiment. Figure 4 As shown, the electronic device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned electronic device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 4 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.

[0195] like Figure 4 In the electronic device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the various steps of the above decision-making method.

[0196] It should be understood that in some feasible embodiments, the processor 1001 may be a central processing unit (CPU). The processor may also be another general-purpose processor, a DSP, an ASIC, an FPGA, or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc. The general-purpose processor may be a microprocessor or any conventional processor. The memory may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store device type information.

[0197] In a specific implementation, the electronic device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 1 For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0198] The electronic device provided in this embodiment effectively solves the problems of poor cross-scenario adaptability and insufficient sustainable learning ability of existing continuous learning methods in identifying safety hazards in urban rail transit projects by introducing a sustainable learning strategy of hybrid expert low-rank adaptation and constructing a scene memory library. The method utilizes a dynamic expert hybrid mechanism to adaptively select the optimal expert module for parameter update, and combines low-rank adaptation technology to significantly reduce the amount of parameters that need to be trained, thereby avoiding forgetting knowledge of old scenes while adapting to new scenes. In addition, by selecting similar scenes from the scene parameter memory library to initialize the encoder weights, incremental learning is achieved, further alleviating the problem of catastrophic forgetting. Compared with the existing technology, the method of the present invention has stronger adaptability in new scenarios and better sustainable learning ability, can more effectively identify safety hazards in the construction of urban rail transit projects, and improve the safety and reliability of urban rail transit projects.

[0199] The embodiment of the present invention further provides a computer-readable storage medium storing a computer program that is executed by a processor to implement Figure 1 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.

[0200] The computer-readable storage medium provided in this embodiment effectively solves the problems of poor cross-scenario adaptability and insufficient sustainable learning ability of existing continuous learning methods in identifying safety hazards in urban rail transit projects by introducing a sustainable learning strategy of hybrid expert low-rank adaptation and constructing a scene memory library. This method utilizes a dynamic expert hybrid mechanism to adaptively select the optimal expert module for parameter update, and combines low-rank adaptation technology to significantly reduce the amount of parameters that need to be trained, thereby avoiding forgetting knowledge of old scenes while adapting to new scenes. In addition, by selecting similar scenes from the scene parameter memory library to initialize the encoder weights, incremental learning is achieved, further alleviating the problem of catastrophic forgetting. Compared with the existing technology, the method of the present invention has stronger adaptability in new scenarios and better sustainable learning ability, can more effectively identify safety hazards in the construction of urban rail transit projects, and improve the safety and reliability of urban rail transit projects.

[0201] Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include nonvolatile and / or volatile memory. Nonvolatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).

[0202] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A dynamic adaptation method for a rail transit construction safety identification model, characterized in that: The steps include: S1. Initialize the urban rail transit project construction safety hazard identification model and new scenario training parameters; S2. Read in the new scenario's urban rail transit project construction safety hazard identification images and corresponding labels, perform data augmentation on these images, and obtain enhanced image data. S3. Select historical scenes with similar features to the current new scene from a pre-built scene parameter memory library by image feature comparison; use the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model; S4. Input the enhanced image data into the image encoder to obtain a feature vector, input the feature vector into the discriminator, and use the discriminator to map the feature vector to the probability distribution of the category to which the image belongs to obtain the category prediction result of the image; S5. Construct a multi-task optimization objective function including classification loss and regularization loss; calculate a total loss value that comprehensively considers classification accuracy and model parameter stability through the multi-task optimization objective function; S6. Based on the characteristics of the current task and the total loss value calculated in step S5, which comprehensively considers classification accuracy and model parameter stability, a dynamic expert mixture mechanism and a dynamic low-rank adaptation adaptive method are used to select specific parameters in the image encoder for update, so that the model can adapt to new scenes without forgetting old scenes; S7. Check whether the model has completed the predetermined number of training rounds or reached other stopping conditions; if the training is not completed, return to step S2 to continue training; If the training is completed, proceed to the next step; S8. Update the scene parameter memory library and store the parameters of the new scene and the updated model information in the scene parameter memory library for use in future training.

2. A rail transit construction safety identification model dynamic adaptation method according to claim 1, characterized in that: Step 1 includes: model structure initialization, optimizer setting, image encoder parameter setting, discriminator parameter setting and other initialization settings; Model structure initialization includes determining the model architecture for identifying safety hazards in urban rail transit engineering construction, randomly initializing all model parameters or using pre-trained weights, and setting the discriminator structure to initialize the discriminator. The optimizer settings include selecting the optimizer, setting the optimizer's initial learning rate, and gradually reducing the learning rate using a cosine annealing strategy; setting the batch size and the total number of training rounds; Image encoder parameter settings include setting the number of visual encoding layers and setting multi-head attention parameters; Discriminator parameter setting includes setting the total number of output categories; Other initialization settings include setting the random seed, initializing the log and saving path.

3. A rail transit construction safety identification model dynamic adaptation method according to claim 1, characterized in that: Step S2 includes the following steps: S21: read new scene images and labels; S22: Data cleaning of new scene images and labels; S23: Perform data enhancement operations on the cleaned data; S24: Standardize the data after data augmentation operation; S25: Batching and loading the standardized data.

4. A method for dynamic adaptation of a rail transit construction safety identification model according to any one of claims 1 to 3, characterized in that: Step S3 includes: S31: Read the new scene image and check the image format to ensure that the format and size of the input image meet the model requirements; S32: extracting features from the read new scene image to obtain a feature vector for each image; S33: During the scene training process, the image features and corresponding model parameters of the historical scenes are saved to build a scene parameter memory library; after each new scene training is completed, the features of the new scene and the updated model parameters are stored in the scene parameter memory library; S34: comparing the feature vector of the new scene image obtained in step S32 with the feature vectors of historical scene images stored in the scene parameter memory library, and calculating the feature distance between them; selecting the historical scene that is most similar to the new scene based on the feature distance; S35: Initializing the encoder weight parameters of the new scene model according to the historical scene that is most similar to the new scene; including obtaining the encoder weights corresponding to the historical scene that is most similar to the new scene from the scene parameter memory library; and using the encoder weights corresponding to these similar scenes as initial values ​​to set the weight parameters of the new scene model.

5. A method for dynamic adaptation of a rail transit construction safety identification model according to any one of claims 1 to 3, characterized in that: Step S4 includes: S41: Input the image enhanced in step S2 into an image encoder, and perform feature encoding on the input image to obtain a feature vector; S42: Input the feature vector output by the image encoder into the discriminator; perform a linear transformation on the input feature vector through the linear layer in the discriminator to obtain the score of each category; normalize the output of the linear layer through the softmax layer to obtain the probability distribution of each category; based on the output of the softmax layer, select the category with the highest probability as the prediction result.

6. A method for dynamic adaptation of a rail transit construction safety identification model according to any one of claims 1 to 3, characterized in that: Step S5 includes: S51: Define a classification loss function and use the cross entropy loss function as the classification loss function; calculate the classification loss of the model-predicted sample based on the model-predicted category probability obtained in step S4 and the true label read in step S2; S52: Define a regularization loss function and use elastic weight consolidation as a regularization method; according to the elastic weight consolidation method, use the model parameters of the old scene to regularize the parameters of the current new scene, and calculate the regularization loss; S53: Combine the classification loss and regularization loss into a comprehensive multi-task optimization objective function, and calculate the total loss value that comprehensively considers the model's classification accuracy on new tasks and its ability to retain old tasks.

7. A rail transit construction safety identification model dynamic adaptation method according to claim 6, characterized in that: In step S51, the classification loss L is expressed by formula (1): Among them, y i,c is the true label of the i-th sample in category C; p i,c is the probability that the i-th sample belongs to category C predicted by the model; N is the number of samples; In step S52, the regularization loss L EWC ; It is expressed by formula (2): Among them, θ i Indicates the parameters of the current task; F i is the diagonal element of the Fisher information matrix, representing the parameter θ i the importance of represents the optimal parameters on the old scene; In step S53, the multi-task optimization objective function L 总 It is expressed by formula (3): THE 总 =L+λL EWC (3) Among them, λ is the regularization coefficient, which is used to balance the weights of classification loss and regularization loss.

8. A method for dynamic adaptation of a rail transit construction safety identification model according to any one of claims 1 to 3, characterized in that: Step S6 includes: S61: Calculate the gradient of the total loss value with respect to the model parameters in step S5 through the back propagation algorithm S62: Initialize multiple expert modules in the dynamic expert hybrid mechanism, and adaptively select the optimal expert module for parameter update based on the characteristics of the current task and the gradient of the total loss value with respect to the model parameters; S63: performing low-rank decomposition on the parameter weight matrix to be updated into the product of two low-rank matrices; S64: After updating the parameters, verify the model to ensure that the model's performance in the new scenario is improved while not forgetting the knowledge of the old scenario; based on the verification results, adjust the learning rate and regularization coefficient to optimize the model training process.

9. A method for dynamic adaptation of a rail transit construction safety identification model according to claim 8, characterized in that: In step S62, based on the characteristics of the current task and the gradient of the total loss value with respect to the model parameters, the optimal expert module is adaptively selected for parameter update, including: S621: Using the ReLU function as the activation function; for each expert module, linearly transform the model's input feature vector using the parameters of the expert module, and then calculate the activation score using the activation function; S622: Normalize the activation scores of all expert modules through the softmax function so that their sum is 1; S623: According to the normalized activation scores, select the expert module with the highest activation score to perform parameter update.

10. A dynamic adaptation system for rail transit construction safety identification model, characterized in that: A method for dynamically adapting a rail transit construction safety identification model according to any one of claims 1 to 9, comprising: Initialization module, used to set the initial state and training parameters of the model; The data preprocessing module is used to read the images and corresponding labels of safety hazard identification of urban rail transit engineering construction in new scenarios and perform data enhancement operations on the images; The scene parameter memory module is used to store the image features of historical scenes and the corresponding model parameters; The model initialization module is used to select the most similar historical scene from the scene parameter memory library according to the characteristics of the new scene image, and initialize the weight of the new scene model with its corresponding encoder weight; A feature extraction module is used to extract feature vectors of new scene images using a pre-trained feature extraction network; The image encoding and discrimination module is used to input the enhanced image data into the image encoder to obtain the feature vector and predict the category of the image through the discriminator; The loss function calculation module is used to construct a multi-task optimization objective function including classification loss and regularization loss, and calculate the total loss value; The training control module is used to check whether the model has completed the predetermined number of training rounds or reached other stopping conditions, and control the iteration and termination of the training process; The model parameter update module is used to dynamically and adaptively select specific parameters in the image encoder for update based on the gradient of the total loss value through a dynamic expert mixture mechanism and low-rank adaptation; Model verification and adjustment module, used to verify the performance of the updated model and adjust the learning rate and regularization coefficient; The logging and model saving module records key information during the training process and saves the trained model weights.

Citation Information

Patent Citations

  • Multi-task learning intelligent fault diagnosis method based on two-stage gradient weight adaptive optimization

    CN115564038A

  • Real-time security assessment method and device and computer equipment

    CN118194289A

  • Self-adaptive fusion multi-modal data set identification method based on pre-training model

    CN119004168A

  • Rail transit energy efficiency balance dynamic monitoring method and system

    CN119648206A

  • Distributed industrial energy operation optimization platform automatically constructing intelligent models and algorithms

    US11487273B1

Cited By

  • Port element identification method and system based on CV large model

    CN121170713A