Stress nephogram prediction generation method and system based on improved pix2pix network

By improving the Pix2Pix network framework, constructing a U-Net generator and a PatchGAN discriminator, and embedding permutation self-attention and character recognition modules, the problem of complex and time-consuming calculations in traditional finite element analysis software is solved, achieving efficient and accurate generation of stress cloud diagrams and meeting the rapid iteration needs of engineering design.

CN122454366APending Publication Date: 2026-07-24TAIYUAN UNIVERSITY OF SCIENCE AND TECHNOLOGY +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TAIYUAN UNIVERSITY OF SCIENCE AND TECHNOLOGY
Filing Date
2026-06-23
Publication Date
2026-07-24

Smart Images

  • Figure CN122454366A_ABST
    Figure CN122454366A_ABST
Patent Text Reader

Abstract

The application discloses a stress nephogram prediction generation method and system based on an improved Pix2Pix network, constructs the improved Pix2Pix network, introduces a finite element nephogram character recognition module at the end of the encoder of a U-Net generator network, and improves numerical prediction accuracy. Secondly, a permutation self-attention module is combined in a skip connection layer to fuse global information and improve generation quality. Finally, a PatchGAN discriminator network model is optimized to improve model discrimination ability and deepen the understanding of stress nephogram feature information by the network. Experimental results show that the generated stress nephogram has significant improvements in objective evaluation indexes and subjective visual effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing technology. It relates to a method and system for predicting and generating stress cloud maps based on an improved Pix2Pix network. Background Technology

[0002] Static stress analysis is a common type of finite element structural analysis. It assesses the reliability of a design by applying various loads to components and analyzing the resulting stress, strain, and deformation. This process is typically used to ensure that a project can withstand various stresses under service and load conditions, and to monitor and evaluate the stability of the structure, as well as its performance in the event of natural disasters or unexpected events.

[0003] Traditional methods rely on finite element analysis software for simulation calculations. This method requires the establishment of accurate geometric and material models, the generation of fine meshes, and the application of boundary conditions and loads. The calculation process is complex and time-consuming, with a single simulation typically taking several hours, making it difficult to meet the needs of rapid iteration and real-time response in engineering design.

[0004] Furthermore, FEA analysis heavily relies on manual operation by professional engineers, including parameter setting, task submission, result extraction, and post-processing, resulting in high labor costs and low automation. When analyzing multiple load conditions, a large number of simulation tasks need to be repeatedly executed, leading to inefficiency and hindering the construction of load-response databases.

[0005] Although artificial intelligence technology has begun to be applied to structural mechanics prediction, existing conventional network models, such as the "encoder-decoder" model, cannot effectively learn the generation rules of stress contour maps, and the prediction accuracy and efficiency need to be improved. Summary of the Invention

[0006] The purpose of this invention is to provide a method and system for predicting and generating stress cloud maps based on an improved Pix2Pix network. Based on the Pix2Pix network framework, an improved U-Net generator network and an optimized discriminator network are built, which significantly improves the generated stress cloud maps in terms of both objective evaluation indicators and subjective visual effects.

[0007] The technical solution to achieve the purpose of this invention is as follows: A method for predicting and generating stress contour maps based on an improved Pix2Pix network includes the following steps: S01: Obtain a sample of a real stress cloud map; S02: Construct an improved Pix2Pix model, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. S03: The generator network learns to generate stress contour maps and sends them to the discriminator network. The discriminator learns from real stress contour map samples and makes a true or false judgment on the generated stress contour map. Based on the judgment result, the discriminator optimizes its own parameters through a loss function. The generator uses the feedback signal from the discriminator to adjust the network weights through the backpropagation algorithm and iteratively obtains a convergent and stable improved Pix2Pix model. The convergent and stable improved Pix2Pix model is used to generate stress contour maps for the target working condition.

[0008] In a preferred embodiment, the U-Net generator is an improved U-Net generator, in which a character recognition module is embedded at the encoder end of the U-Net generator network. The character recognition module is used for the segmentation, correction, and recognition of the bottom scale and numerical labels of the stress cloud diagram, and the extracted numerical information is used to construct the numerical constraint loss.

[0009] In a preferred embodiment, the processing method of the character recognition module includes: The color feature map output by the encoder is converted into a grayscale image, and edge features are extracted using the Canny operator. The edge pixel distribution of the current feature map is statistically analyzed, and the binarization threshold is dynamically adjusted with the edge pixel ratio as a constraint. Based on the binarized edge features, the scale region at the bottom of the cloud map is located by the boundary extraction algorithm, and a local image containing only the scale is obtained by cropping, removing interference from irrelevant backgrounds; By calculating the difference between RGB channels and the local standard deviation, the gray border of the ruler is identified and removed, and the internal color bar area is extracted. The colored bar region is segmented based on coordinate information, converted into a binary image, and then the corresponding numerical information is extracted using optical character recognition methods.

[0010] In a preferred embodiment, the calculation method for the displacement self-attention module includes: in, For the input feature map, To replace the output of the attention module, , , , , , There are three independent linear transformation layers. This is a dimensionality reshaping operation that converts a two-dimensional feature map into a one-dimensional sequence. These are query, key, and value, respectively. This is a compression substitution operation, applied only to the K and V branches; in, The input feature map is divided into two sub-feature groups by average along the channel dimension. This is a 1×1 convolution operation. For space-channel permutation operations, global spatial information is encoded into the channel dimension. This is a channel-level splicing operation; The formula for calculating attention weights is: in, The scaled dot product attention score. For each location's feature dimension, For normalization function, It is a sine and cosine position code used to inject spatial position information.

[0011] In the preferred embodiment, the PatchGAN discriminator network includes two 1×1 convolutional blocks at the beginning and end, and four compression modules in the middle. The initial 1×1 convolutional block maps the 3-channel input feature map to a 64-channel feature map. The four cascaded compression modules perform downsampling operations on the feature map in sequence. Each compression module contains two 3×3 convolutional layers. After the first convolutional layer, batch normalization, Dropout, and LeakyReLU activation functions are sequentially connected. After the second convolutional layer, batch normalization and LeakyReLU activation functions are sequentially connected, and spatial dimension downsampling is achieved through max pooling. The final 1×1 convolutional block maps the high-dimensional features to a single-channel output.

[0012] In the preferred technical solution, the PatchGAN discriminator network outputs a true or false judgment of the input image to verify the matching degree of the cloud map. The PatchGAN discriminator outputs a 4×4 single-channel probability matrix through layer-by-layer convolution operations. Each element in the matrix corresponds to the true or false probability of a 34×34 overlapping region in the input image. Finally, the loss of the discriminator is the average value of the binary classification cross-entropy loss of all image patches.

[0013] In the preferred technical solution, the total composite loss function of the U-Net generator is: in, To standardize the fight against losses, , These are preset positive real number weighting coefficients. For structural loss, For numerical constraint loss; Generators against loss for: in, This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation The predicted stress contour map output by the generator. The discriminator's output for generating the contour map; Structural loss for: in, This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This represents the average value of the absolute difference between each pixel. Numerical constraint loss : in, For character recognition module, To extract and save the numerical labels of real cloud images in advance, Mean squared error loss function.

[0014] In the preferred technical solution, the discriminator adversarial loss function is: in, This represents the loss term of the discriminator for real samples. This represents the loss term of the discriminator for the generated samples. This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation This represents the discriminator's output on the true cloud map.

[0015] This invention also discloses a stress contour map prediction and generation system based on an improved Pix2Pix network, used to implement the aforementioned stress contour map prediction and generation method based on an improved Pix2Pix network, comprising: The module for acquiring real stress contour maps obtains real stress contour map samples. An improved Pix2Pix model construction module is constructed, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. The network training and prediction module involves a generator network learning to generate stress contour maps, which are then fed into a discriminator network. The discriminator learns from real stress contour map samples and determines whether the generated stress contour map is true or false. Based on the discrimination results, the discriminator optimizes its parameters using a loss function. The generator uses the feedback signal from the discriminator to adjust the network weights through a backpropagation algorithm, iteratively obtaining a convergent and stable improved Pix2Pix model. This convergent and stable improved Pix2Pix model is then used to generate stress contour maps for the target working condition.

[0016] The present invention also discloses a computer storage medium storing a computer program, which, when executed, implements the above-described method for generating stress cloud maps based on an improved Pix2Pix network.

[0017] 1. Compared with the prior art, the significant advantages of this invention are: This invention is based on the Pix2Pix network framework, and builds an improved U-Net generator network and an optimized discriminator network, which enables the improved Pix2Pix model to have good generation and generalization capabilities. The generated stress cloud map has significantly improved both objective evaluation indicators and subjective visual effects.

[0018] 2. Embedding a permutation self-attention module in the skip connections between the encoder and the corresponding level decoder of the U-Net generator network focuses on the structure and digital regions, enhances the transmission of detailed features, and improves the generation quality.

[0019] 3. The PatchGAN discriminator network model was optimized. It adopts a fully convolutional architecture with an initial convolutional block, four downsampling compression modules, and a final convolutional block. This architecture can convert three-channel input images into single-channel prediction outputs, perform more detailed evaluation of image blocks, improve the model's discriminative ability, and deepen the network's understanding of stress cloud map feature information, thereby enhancing the discriminative ability.

[0020] 4. By introducing a finite element contour map character recognition module at the encoder end of the U-Net generator network, the number in the finite element contour map can be accurately identified, capturing the mapping relationship between numerical values ​​and structures, and improving the accuracy of numerical prediction. Attached Figure Description

[0021] Figure 1 This is a flowchart of the stress cloud map prediction and generation method based on the improved Pix2Pix network in this embodiment; Figure 2 This is a diagram showing the overall structure of the improved Pix2Pix network in this embodiment; Figure 3 This is a flowchart of the character recognition module in this embodiment; Figure 4 This is a schematic diagram of the substitution self-attention mechanism in this embodiment; Figure 5 This is a schematic diagram illustrating the classification of output matrix elements by the discriminator in this embodiment; Figure 6 This is a flowchart illustrating the data preparation and model initialization process in this embodiment. Figure 7 This is a flowchart of the iterative training phase in this embodiment; Figure 8 The training process loss curves for the generator and discriminator in this embodiment are shown. Figure 9 A stress contour plot was generated for 12.1 t in this embodiment; Figure 10 A stress contour plot was generated for 13.8 t in this embodiment; Figure 11 This is the actual stress cloud diagram for 13.0 t in this embodiment; Figure 12 A stress contour plot was generated for the 36.8 t in this embodiment; Figure 13 This is the actual stress cloud diagram for 36.8 t in this embodiment; Figure 14 This is a statistical curve showing the relative error rate between the generated value and the true value in this embodiment. Figure 15 This is a trend chart of the three indicators in this embodiment; Figure 16(a)-(c) are the stress cloud map index curves generated for different models in this embodiment. Detailed Implementation

[0022] The principle of this invention is as follows: An improved Pix2Pix model is proposed, introducing a finite element cloud image character recognition module at the encoder end of the U-Net generator network to improve numerical prediction accuracy. A PSA module is embedded in the skip connections between the encoder and the corresponding level decoder of the U-Net generator network, focusing on structural and digital regions and enhancing the transmission of detailed features. The PatchGAN discriminator network model is optimized, employing a fully convolutional architecture with an initial convolutional block, four downsampling compression modules, and a final convolutional block. This architecture can convert a three-channel input image into a single-channel prediction output, enabling more detailed evaluation of image blocks and improving discriminative ability.

[0023] Example 1: like Figure 1 The method for predicting and generating stress contour maps based on an improved Pix2Pix network is shown, and includes the following steps: S01: Obtain a sample of a real stress cloud map; S02: Construct an improved Pix2Pix model, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. S03: The generator network learns to generate stress contour maps and sends them to the discriminator network. The discriminator learns from real stress contour map samples and makes a true or false judgment on the generated stress contour map. Based on the judgment result, the discriminator optimizes its own parameters through a loss function. The generator uses the feedback signal from the discriminator to adjust the network weights through the backpropagation algorithm and iteratively obtains a convergent and stable improved Pix2Pix model. The convergent and stable improved Pix2Pix model is used to generate stress contour maps for the target working condition.

[0024] Stress cloud maps are structured image data that must satisfy the mapping relationship between lifting weight parameters and image generation, and the generated result must conform to physical laws. Based on the Pix2Pix conditional generative adversarial network framework, consisting of an improved U-Net generator and a PatchGAN discriminator, it can achieve fully automatic prediction of stress cloud maps for automobile crane booms, while ensuring the accuracy of stress distribution texture and numerical annotation. Through the game between the generator and the discriminator, the generative adversarial network can generate images with rich details and reasonable distribution, outperforming the traditional "encoder-decoder" model. The overall prediction and generation process is as follows: Figure 1 As shown, the real stress contour map samples include 30 stress contour maps corresponding to different lifting weights, with the image name corresponding to the lifting weight. These are input into the Pix2Pix model. The generator network first determines its parameters using a random initialization strategy, learns to generate stress contour maps, and then sends the generated stress contour maps to the discriminator network. The discriminator learns from the real stress contour map samples and makes a judgment on whether the generated stress contour map is real or fake. Based on the judgment result, the discriminator optimizes its own parameters through a loss function to improve its ability to distinguish between real and fake images. The generator uses the feedback signal from the discriminator to automatically adjust the network weights through a backpropagation algorithm, making the generated stress contour map more visually and numerically similar to the real one. The adversarial process is repeated, and after 200 iterations, a convergent and stable Pix2Pix generator network is obtained. Using the convergent generator network, stress contour maps are generated for the target working condition, and a two-dimensional comparison is made with the corresponding real stress contour map, both visually and numerically. The quality evaluation of generated images employs three metrics: Structural Similarity (SSIM), Peak Signal-to-Noise Ratio (PSNR), and Level-Limited Image Similarity Measures (LPIPS), to quantitatively assess the visual similarity, structural consistency, and perceptual realism between the generated and real stress contour maps. Numerical accuracy is evaluated using Relative Error Rate (RPE) and Mean Relative Error Rate (MRPE) to measure the deviation between the stress values ​​in the generated contour map and the actual stress values, verifying the accuracy of numerical predictions. Further verification of numerical regularity is conducted to confirm whether the generated stress values ​​conform to mechanical laws and engineering logic, avoiding abnormal results that violate physical common sense. Finally, model generalization is verified by generating stress contour maps corresponding to unfamiliar lifting weights to test the regularity of the boom structure and evaluate the model's engineering applicability. Based on the combined verification results of image quality, numerical accuracy, regularity, and generalization, the optimal generator model is saved for subsequent direct prediction of finite element stress contour maps.

[0025] In a preferred implementation, the U-Net generator is an improved U-Net generator, in which a character recognition module is embedded at the encoder end of the U-Net generator network. The character recognition module is used for the segmentation, correction and recognition of the bottom scale and numerical labels of the stress cloud map, and the extracted numerical information is used to construct the numerical constraint loss.

[0026] In a preferred implementation, the character recognition module's processing methods include: The color feature map output by the encoder is converted into a grayscale image, and edge features are extracted using the Canny operator. The edge pixel distribution of the current feature map is statistically analyzed, and the binarization threshold is dynamically adjusted with the edge pixel ratio as a constraint. Based on the binarized edge features, the scale region at the bottom of the cloud map is located by the boundary extraction algorithm, and a local image containing only the scale is obtained by cropping, removing interference from irrelevant backgrounds; By calculating the difference between RGB channels and the local standard deviation, the gray border of the ruler is identified and removed, and the internal color bar area is extracted. The colored bar region is segmented based on coordinate information, converted into a binary image, and then the corresponding numerical information is extracted using optical character recognition methods.

[0027] In a preferred implementation, the computation method for permuting the attention module includes: in, For the input feature map, To replace the output of the attention module, , , , , , There are three independent linear transformation layers. This is a dimensionality reshaping operation that converts a two-dimensional feature map into a one-dimensional sequence. These are query, key, and value, respectively. This is a compression substitution operation, applied only to the K and V branches; in, The input feature map is divided into two sub-feature groups by average along the channel dimension. This is a 1×1 convolution operation. For space-channel permutation operations, global spatial information is encoded into the channel dimension. This is a channel-level splicing operation; The formula for calculating attention weights is: in, The scaled dot product attention score. For each location's feature dimension, For normalization function, It is a sine and cosine position code used to inject spatial position information.

[0028] In a preferred implementation, the PatchGAN discriminator network includes two 1×1 convolutional blocks at the beginning and end, and four compression modules in the middle. The initial 1×1 convolutional block maps the 3-channel input feature map to a 64-channel feature map. The four cascaded compression modules perform downsampling operations on the feature map in sequence. Each compression module contains two 3×3 convolutional layers. After the first convolutional layer, batch normalization, Dropout, and LeakyReLU activation functions are sequentially connected. After the second convolutional layer, batch normalization and LeakyReLU activation functions are sequentially connected, and spatial dimension downsampling is achieved through max pooling. The final 1×1 convolutional block maps the high-dimensional features to a single-channel output.

[0029] In a preferred implementation, the PatchGAN discriminator network outputs a true / false judgment of the input image to verify the matching degree of the cloud map. The PatchGAN discriminator outputs a 4×4 single-channel probability matrix through layer-by-layer convolution operations. Each element in the matrix corresponds to the true / false probability of a 34×34 overlapping region in the input image. Finally, the loss of the discriminator is the average value of the binary cross-entropy loss of all image patches.

[0030] In a preferred implementation, the total composite loss function of the U-Net generator is: in, To standardize the fight against losses, , These are preset positive real number weighting coefficients. For structural loss, For numerical constraint loss; Generators against loss for: in, This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation The predicted stress contour map output by the generator. The discriminator's output for generating the contour map; Structural loss for: in, This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This represents the average value of the absolute difference between each pixel. Numerical constraint loss : in, For character recognition module, To extract and save the numerical labels of real cloud images in advance, Mean squared error loss function.

[0031] The discriminator adversarial loss function is: in, This represents the loss term of the discriminator for real samples. This represents the loss term of the discriminator for the generated samples. This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation This represents the discriminator's output on the true cloud map.

[0032] Another embodiment provides a stress contour map prediction and generation system based on an improved Pix2Pix network, used to implement the aforementioned stress contour map prediction and generation method based on an improved Pix2Pix network, comprising: The module for acquiring real stress contour maps obtains real stress contour map samples. An improved Pix2Pix model construction module is constructed, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. The network training and prediction module involves a generator network learning to generate stress contour maps, which are then fed into a discriminator network. The discriminator learns from real stress contour map samples and determines whether the generated stress contour map is true or false. Based on the discrimination results, the discriminator optimizes its parameters using a loss function. The generator uses the feedback signal from the discriminator to adjust the network weights through a backpropagation algorithm, iteratively obtaining a convergent and stable improved Pix2Pix model. This convergent and stable improved Pix2Pix model is then used to generate stress contour maps for the target working condition.

[0033] Specifically, the workflow of the stress cloud map prediction and generation system based on the improved Pix2Pix network is described below using a preferred embodiment as an example: like Figure 2 As shown, the input stress cloud map first undergoes initialization processing by the input module to extract basic visual features. The result then serves as the input to the encoder module. A 3-layer convolutional encoder aggregates the global semantic features of the boom structure through progressive downsampling. A character recognition module, embedded at the encoder's end, achieves accurate segmentation, correction, and recognition of the bottom scale and numerical annotations of the cloud map through four stages: image preprocessing, scale extraction, color bar extraction, and character recognition. The extracted numerical information is used to construct a numerical constraint loss, ensuring the generated result conforms to the physical laws of stress distribution.

[0034] The overall process of the character recognition module is as follows: Figure 3 As shown. In the image preprocessing stage, the color feature map output by the encoder is first converted into a grayscale image, and edge features are extracted using the Canny operator. To address the poor robustness of a fixed binarization threshold under different contrast and noise levels in finite element cloud maps, an adaptive binarization threshold selection strategy based on the edge pixel ratio is proposed. The edge pixel distribution of the current feature map is statistically analyzed, and the binarization threshold is dynamically adjusted with the edge pixel ratio as a constraint. This preserves complete character edges while maximally suppressing background noise, laying the foundation for subsequent ruler localization and character recognition. In the ruler extraction stage, based on the binarized edge features, the ruler region at the bottom of the cloud map is located using a boundary extraction algorithm. A local image containing only the ruler is cropped, removing interference from irrelevant backgrounds. In the color bar extraction stage, a gray area determination method with dual constraints of dual-channel difference and standard deviation is proposed. By calculating the difference between RGB channels and the local standard deviation, the gray border of the ruler is accurately identified and removed, extracting the pure internal color bar region, thus achieving dedicated segmentation and correction of the ruler in the finite element cloud map. Finally, the color blocks are segmented based on the coordinate information, converted into binary images, and then the corresponding numerical information is extracted using optical character recognition technology.

[0035] A PSA module is embedded in the skip connection between the encoder and the corresponding level decoder. This module uses the region mask output by the character recognition module to guide attention, focusing only on structural and numerical regions, enhancing the transmission of detailed features, and avoiding edge blurring and numerical distortion caused by downsampling. The decoder module consists of three upsampled decoders, which, combined with the encoder features enhanced by PSA, progressively reconstruct the spatial details of the stress contour map. Finally, the output of the decoder module, after processing by the output module, generates the stress contour map.

[0036] like Figure 4The diagram shows the permutation self-attention mechanism. The essential difference between it and the standard self-attention mechanism is that it only performs compression permutation operations on the K and V branches, while the Q branch retains the original features. This significantly reduces computational complexity while preserving complete spatial details. Figure 4 (a) shows the input feature map The compression and displacement operation is represented as: (1) in, The input feature map is divided into two sub-feature groups by average along the channel dimension. . For 1×1 convolution operations, the number of channels is compressed to . For spatial-channel permutation operations, the feature dimension is changed from Convert to This encodes global spatial information into the channel dimension. This is a channel-dimensional concatenation operation, restoring the output feature map dimension to [value missing]. By compressing only half of the channels and performing permutations, the computational cost of subsequent matrix multiplications is reduced by 75% while preserving the original feature details.

[0037] The complete computational process of substitution self-attention is as follows: Figure 4 As shown in (b), its mathematical expression is as follows: (2) in, For the input feature map, , , . , , There are three independent linear transformation layers. This is a dimensionality reshaping operation that converts a two-dimensional feature map into a one-dimensional sequence. For sequence length, The feature dimension for each location. The above compression and replacement operation applies only to the K and V branches.

[0038] The formula for calculating attention weights is: (3) in, The scaled dot product attention score, divided by This is to avoid the gradient vanishing of the SoftMax function due to excessively large feature dimensions. Sine and cosine position codes are used to inject spatial position information and solve the permutation invariance problem of self-attention. The calculation formula is as follows: (4) in, It is the spatial location index of the pixel. It is a feature dimension index. The attention scores are mapped to the range of 0-1 using a normalization function, resulting in the final attention weight matrix. The weighted attention features are then linearly transformed and residually connected to the original input features to obtain the final output feature map. This residual connection effectively alleviates the vanishing gradient problem in deep networks and improves the training stability of the model.

[0039] The PatchGAN discriminator network consists of convolutional layers that sample a three-channel input image into a single-channel predicted output. It comprises two 1×1 convolutional blocks at the beginning and end, and four compression modules in the middle. The initial 1×1 convolutional block maps the 3-channel input feature map to a 64-channel feature map, completing the initial expansion of the feature dimension. Subsequently, the four cascaded compression modules sequentially perform downsampling operations on the feature map. Each compression module contains two 3×3 convolutional layers. After the first convolutional layer, batch normalization, Dropout, and LeakyReLU activation functions are sequentially applied. After the second convolutional layer, batch normalization and LeakyReLU activation functions are sequentially applied, and spatial dimension downsampling is achieved through max pooling. Finally, the last 1×1 convolutional block maps the high-dimensional features into a single-channel output, outputting a "true / false" judgment of the input image. The discriminator not only needs to determine the authenticity of the image itself but also needs to verify the matching degree between the weight and the cloud map, ensuring that the generated cloud map is consistent with the weight. Figure 5 This describes the process by which the PatchGAN discriminator classifies each element in the output matrix. In traditional generative adversarial networks (GANs), the discriminator uses a whole-image discrimination model, only needing to determine the realness of the entire image. The PatchGAN discriminator, however, can classify each patch of the input image as real or fake, rather than the entire image. Through layer-by-layer convolution operations, the discriminator ultimately outputs a 4×4 single-channel probability matrix, where each element corresponds to the real / fake probability of a 34×34 overlapping region in the input image. The final loss of the discriminator is the average of the binary cross-entropy losses for all image patches.

[0040] The training process is as follows: The model training process first enters the data preparation stage, such as... Figure 6 As shown. First, 30 sets of finite element stress cloud map data are loaded, the images are normalized, and the lifting weight parameters are standardized. Then, the model initialization stage is entered, and an improved Pix2Pix model consisting of a generator and a discriminator is constructed. The total composite loss function of the generator is set as: (5) in, It uses Pix2Pix's standard adversarial loss to ensure the realism of the generated images. , These are preset positive real number weighting coefficients used to adjust the contribution ratio of each loss item to the total loss. The structural loss is used to calculate the pixel error between the generated cloud image and the real cloud image. Numerical constraint loss is used to ensure that the generated results conform to physical laws. The generator employs adversarial loss. for: (6) in, These are the lifting capacity operating parameters. The predicted stress contour map output by the generator. The discriminator outputs the generated cloud map.

[0041] Structural loss for: (7) in, Represents the true stress contour plot, It represents the average value of the absolute difference between pixels.

[0042] To ensure that the generated results conform to the physical laws of stress distribution and to address the inaccuracy of the original Pix2Pix numerical prediction, a numerical constraint loss is proposed. : (8) in, This is a finite element cloud map character recognition module. To extract and save the numerical labels of real cloud images in advance, Mean squared error loss function.

[0043] The discriminator adversarial loss function is: (9) (10) (11) in, This represents the discriminator's loss term for real samples, used to measure the discriminator's ability to correctly identify the real stress contour map corresponding to the input working condition parameters. This represents the loss term of the discriminator for the generated samples, used to measure the discriminator's ability to correctly identify spurious stress contour maps output by the generator. This represents the discriminator's output on the true cloud map.

[0044] set up This ensures that the generated stress cloud map possesses good visual realism, structural accuracy, and physical plausibility. Simultaneously, the Adam optimizer, batch size of 1, and training parameters of 200 training epochs are configured.

[0045] Then it enters the iterative training phase, such as Figure 7 As shown, the training iterations are initialized to 1. Batch iterations are performed on the training set, generating stress contour maps using a generator. A discriminator then determines the authenticity of the image and the matching degree between the lifting weight and the contour map. Next, backpropagation updates the model parameters and calculates the total loss and component losses. Every 25 iterations, the generated validation set results are output and compared with the real contour maps. Afterward, it is determined whether the training iterations have reached 200 and the loss has converged. If not, the iterations are incremented by 1, and after 100 iterations, the learning rate is linearly decayed to 0.00001, then batch iterations continue. If the conditions are met, the training is complete, the trained model weights are saved, and the training convergence curve and intermediate validation results are output. Figure 8 The diagram shows the generator and discriminator losses during the training process. The entire training process is stable and converges well, without exhibiting common problems such as mode collapse, gradient vanishing, or over-training of the discriminator. This indicates that the proposed improved Pix2Pix model has good training stability and convergence, and can effectively learn the generation rules of the stress cloud map of the automobile crane boom.

[0046] Training results 1. Analysis of the regularity of generated stress cloud diagrams After the model training was completed, to verify its regularity in the engineering stress contour map generation task, based on the target load parameters, the model was driven to generate stress contour maps with lifting capacities of 12.1t and 13.8t, respectively, as follows: Figure 9 Figure 10 As shown. Select Figure 11 The actual stress cloud diagram of 13.0t shown is used as a reference benchmark, and the variation patterns of the color legend values ​​are compared and analyzed. The statistical values ​​of the main indicators are shown in Table 1. Table 1. Statistical Analysis of Key Indicators As the input lifting capacity increases, the overall stress level of the boom structure in the generated stress cloud map shows a significant increasing trend, and the corresponding color legend value range expands upwards accordingly. When the lifting capacity increases from 12.1t to 13.8t, the minimum stress value in the generated cloud map increases from 8.24674 to 8.97456, and the maximum stress value increases from 3.48×10⁸ to 3.77×10⁸. This trend aligns with the basic theory that "structural stress is positively correlated with external load," validating the physical rationality and consistency of the generated results. Compared to the actual stress cloud map, the generated stress cloud map is more closely aligned, including various parameter values, boom stress distribution characteristics, and equivalent stress cloud map color legends, effectively replicating the basic characteristics of the actual stress cloud map.

[0047] 2. Verification of the authenticity of the generated stress cloud map To verify the authenticity of the stress contour maps generated by the model, lifting weights of 7.9t, 16.4t, 26.6t, 36.8t, and 45.3t were randomly selected from the dataset. The trained model generated corresponding stress contour maps for each weight and compared them with the actual stress contour maps. Figure 12 Figure 13 The images show the generated stress contour plot and the actual stress contour plot for a 36.8t lifting weight. A comparison reveals discrepancies in the values ​​between the two sets of images, and the degrees of these discrepancies differ.

[0048] Compare the generated stress contour maps corresponding to the four sets of data with the values ​​of the bottom color legends in the actual stress contour maps. L1~L9 represent values ​​from left to right. Take the difference between the generated value and the actual value at the same position, take the absolute value, and then divide it by the actual value to obtain the relative error rate of the generated stress contour map. Calculate the relative error rates of L1~L9 for each of the four sets of data. Figure 14 The figure shows the statistical results of the relative error rate between the generated and actual values. As can be seen from the graph, the relative error rate is below 2.0%, indicating relative stability. The average relative error rate is 0.9%, which meets the actual engineering requirements.

[0049] Stress cloud maps for 30 lifting conditions were generated in the dataset, and each was compared with a real stress cloud map under the same condition. The Structural Similarity Index (SSIM), Peak Signal-to-Noise Ratio (PSNR), and Portfolio Image Similarity Scale (LPIPS) were used as image quality evaluation standards. SSIM values ​​range from 0 to 1; a higher value indicates a more accurate structural reconstruction of the generated stress cloud map. PSNR measures pixel-level error, i.e., the difference in pixel values ​​between the generated and real images; a higher value indicates more accurate stress color reproduction. LPIPS measures perceptual similarity, the visual realism of the generated image; a lower value indicates that it looks more like a real stress cloud map to the human eye. The comparison results are as follows: Figure 15As shown, SSIM is stable at 0.94, perfectly reproducing the rod structure and color gradient, conforming to the structural specifications of mechanical simulation. PSNR is stable at around 19dB, which is above average pixel reproduction accuracy. LPIPS is stable at 0.08, and the human eye perceives it almost identically to the real cloud image, representing excellent perceptual similarity.

[0050] 3. Model Comparison The stress contour plots generated by this model are compared with those generated by the U-Net model and the classic Pix2Pix model, as follows: Figure 16 As shown. Since the U-Net model and the classic Pix2Pix model cannot make numerical predictions, the comparison is only based on the image generation quality dimension. The average PSNR, SSIM, and LPIPS of the stress contour map generated by the improved Pix2Pix model are 20.12dB, 0.8859, and 0.1341, respectively, which are significantly better than the stress contour map generated by the U-Net model (16.74dB, 0.6075, 0.3048) and the stress contour map generated by the classic Pix2Pix model (18.86dB, 0.6367, 0.2557).

[0051] The advantage of deep learning models lies in significantly reducing time consumption. Table 2 compares the time consumption of the improved Pix2Pix model with that of Ansys in batch generation of stress cloud maps.

[0052] Table 2 Comparison of batch generation time The results show that, once the model is trained, in a task with 100 generated models, the deep learning model generates models 2.5 orders of magnitude faster than Ansys.

[0053] In another embodiment, a computer storage medium stores a computer program that, when executed, implements the above-described stress cloud map prediction generation method based on an improved Pix2Pix network.

[0054] The above implementation method will not be elaborated further here.

[0055] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A method for predicting and generating stress cloud maps based on an improved Pix2Pix network, characterized in that, Includes the following steps: S01: Obtain a sample of a real stress cloud map; S02: Construct an improved Pix2Pix model, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. S03: The generator network learns to generate stress cloud maps and sends the generated stress cloud maps to the discriminator network. The discriminator learns from real stress cloud map samples and makes a true or false judgment result on the generated stress cloud map. Based on the discrimination results, the discriminator optimizes its own parameters through the loss function, and the generator uses the feedback signal from the discriminator to adjust the network weights through the backpropagation algorithm, iteratively obtaining a convergent and stable improved Pix2Pix model. The convergent and stable improved Pix2Pix model is then used to generate stress cloud maps for the target working condition.

2. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 1, characterized in that, The U-Net generator is an improved U-Net generator, in which a character recognition module is embedded at the encoder end of the U-Net generator network. The character recognition module is used for the segmentation, correction and recognition of the bottom scale and numerical labels of the stress cloud diagram, and the extracted numerical information is used to construct the numerical constraint loss.

3. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 2, characterized in that, The processing method of the character recognition module includes: The color feature map output by the encoder is converted into a grayscale image, and edge features are extracted using the Canny operator. The edge pixel distribution of the current feature map is statistically analyzed, and the binarization threshold is dynamically adjusted with the edge pixel ratio as a constraint. Based on the binarized edge features, the scale region at the bottom of the cloud map is located by the boundary extraction algorithm, and a local image containing only the scale is obtained by cropping, removing interference from irrelevant backgrounds; By calculating the difference between RGB channels and the local standard deviation, the gray border of the ruler is identified and removed, and the internal color bar area is extracted. The colored bar region is segmented based on coordinate information, converted into a binary image, and then the corresponding numerical information is extracted using optical character recognition methods.

4. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 1, characterized in that, The calculation method for the displacement self-attention module includes: in, For the input feature map, To replace the output of the attention module, , , , , , There are three independent linear transformation layers. This is a dimensionality reshaping operation that converts a two-dimensional feature map into a one-dimensional sequence. These are query, key, and value, respectively. This is a compression substitution operation, applied only to the K and V branches; in, The input feature map is divided into two sub-feature groups by average along the channel dimension. This is a 1×1 convolution operation. For space-channel permutation operations, global spatial information is encoded into the channel dimension. This is a channel-level splicing operation; The formula for calculating attention weights is: in, The scaled dot product attention score. For each location's feature dimension, For normalization function, It is a sine and cosine position code used to inject spatial position information.

5. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 1, characterized in that, The PatchGAN discriminator network includes two 1×1 convolutional blocks at the beginning and end, and four compression modules in the middle. The initial 1×1 convolutional block maps the 3-channel input feature map to a 64-channel feature map. The four cascaded compression modules perform downsampling operations on the feature map in sequence. Each compression module contains two 3×3 convolutional layers. After the first convolutional layer, batch normalization, Dropout, and LeakyReLU activation functions are sequentially connected. After the second convolutional layer, batch normalization and LeakyReLU activation functions are sequentially connected, and spatial dimension downsampling is achieved through max pooling. The final 1×1 convolutional block maps the high-dimensional features to a single-channel output.

6. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 1, characterized in that, The PatchGAN discriminator network outputs a true / false judgment of the input image and verifies the matching degree of the cloud map. The PatchGAN discriminator outputs a 4×4 single-channel probability matrix through layer-by-layer convolution operations. Each element in the matrix corresponds to the true / false probability of a 34×34 overlapping region in the input image. Finally, the loss of the discriminator is the average value of the binary cross-entropy loss of all image patches.

7. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 2, characterized in that, The total composite loss function of the U-Net generator is: in, To standardize the fight against losses, , These are preset positive real number weighting coefficients. For structural loss, For numerical constraint loss; Generators against loss for: in, This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation The predicted stress contour map output by the generator. The discriminator's output for generating the contour map; Structural loss for: in, This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This represents the average value of the absolute difference between each pixel. Numerical constraint loss : in, For character recognition module, To extract and save the numerical labels of real cloud images in advance, Mean squared error loss function.

8. The stress cloud map prediction and generation method based on the improved Pix2Pix network according to claim 1, characterized in that, The discriminator adversarial loss function is: in, This represents the loss term of the discriminator for real samples. This represents the loss term of the discriminator for the generated samples. This indicates that all operating condition parameters in the training set... True stress cloud map The joint mathematical expectation of the sample pairs is calculated. This indicates that all operating condition parameter samples in the training set... The mathematical expectation of the calculation This represents the discriminator's output on the true cloud map.

9. A stress contour map prediction and generation system based on an improved Pix2Pix network, used to implement the stress contour map prediction and generation method based on an improved Pix2Pix network as described in any one of claims 1-8, characterized in that, include: The module for acquiring real stress contour maps obtains real stress contour map samples. An improved Pix2Pix model construction module is constructed, which is based on the Pix2Pix conditional generative adversarial network framework and consists of a U-Net generator and a PatchGAN discriminator. A permutation self-attention module is embedded in the skip connection between the encoder and the corresponding level decoder of the U-Net generator network to fuse global information. The PatchGAN discriminator network is optimized by adopting a fully convolutional architecture with an initial convolutional block, four downsampling compression modules and a final convolutional block to convert the three-channel input image into a single-channel prediction output. The network training and prediction module consists of a generator network that learns to generate stress cloud maps and sends the generated stress cloud maps to a discriminator network. The discriminator learns from real stress cloud map samples and makes a true or false judgment on the generated stress cloud maps. Based on the discrimination results, the discriminator optimizes its own parameters through the loss function, and the generator uses the feedback signal from the discriminator to adjust the network weights through the backpropagation algorithm, iteratively obtaining a convergent and stable improved Pix2Pix model. The convergent and stable improved Pix2Pix model is then used to generate stress cloud maps for the target working condition.

10. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the stress cloud map prediction and generation method based on the improved Pix2Pix network as described in any one of claims 1-8.