Oil tank base engineering drawing generation method, system and equipment and storage medium
Through image preprocessing and deep learning algorithms, the motor size in the fuel tank base engineering drawings is solved, and the problems of high errors and inconvenient parameter modification in the existing technology are realized, and the automatic generation of fuel tank base engineering drawings and efficient parameter modification are realized.
Patent Information
- Application Number
- CN202411913391.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-05-16
AI Technical Summary
The prior art is difficult to automatically generate fuel tank base engineering drawings, resulting in high errors and inconvenient parameter modification.
By obtaining the input bitmap for image preprocessing, an image size recognition model is constructed based on the YOLOv5 algorithm and the NEXT-VIT network, the motor size chain model is constructed based on the correlation between the motor sizes, the unidentified size is calculated, and the target engineering drawing is finally modified and marked based on the identifiable and unidentified sizes, and the template drawings are generated.
It realizes the automatic generation of fuel tank base engineering drawings, reduces errors, improves the efficiency of parameter modification, and simplifies the engineering drawing generation process.
Smart Images

Figure CN120014099A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graphics generation technology, and in particular to a method, system, electronic equipment and computer-readable storage medium for generating an engineering drawing of a fuel tank base. Background Art
[0002] Although the oil tank base is a modular structure, according to its engineering drawings, different products use different motor powers, resulting in different motor sizes, and thus different motor pad sizes on the base, which need to be modified according to the motor of this product. The relevant dimensions need to be recalculated, the graphics of each view need to be redrawn, the standard parts need to be reselected, the part reference object attributes need to be changed, the material code needs to be changed, etc. The above steps need to be manually operated, and the error rate is high.
[0003] The current technology for image recognition has matured and can realize the conversion of external bitmap data such as PDF and pictures into CAD engineering drawings, or the automatic drawing of graphics using CAD's secondary development interface using programming languages such as Python. However, the existing image recognition technology for engineering drawings targets different features, such as circles and rectangles, dimensions and tolerances, and there is no relevant research on elements of the same type but with different annotation objects, such as specific dimensions such as the length of the motor shaft head and the length of the foot. In addition, the existing technology of Python combined with a third-party library to connect AutoCAD to draw engineering drawings still has the problem of relying on manual input, which is prone to errors. When changing the drawing size, the code needs to be modified again, which is not convenient for scenarios with a large number of parameters that need to be modified.
[0004] Therefore, there is an urgent need for a method for generating a fuel tank base engineering drawing that can realize automatic generation of the fuel tank base engineering drawing, reduce errors, and facilitate parameter modification. Summary of the invention
[0005] Based on this, it is necessary to provide a method, system, electronic device and computer-readable storage medium for generating engineering drawings of a fuel tank base in order to address the above technical problems.
[0006] A method for generating an engineering drawing of an oil tank base comprises the following steps: obtaining an input bitmap, performing image preprocessing on the input bitmap, and obtaining an image file; constructing an image size recognition model based on a YOLOv5 algorithm and a NEXT-VIT network, inputting the image file into the image size recognition model, and obtaining a recognizable size; constructing a motor size chain model based on the correlation between motor sizes, inputting the recognizable size into the motor size chain model, and calculating an unrecognized size; and modifying and marking an existing template drawing according to the recognizable size and the calculated unrecognized size, and obtaining a target engineering drawing.
[0007] In one embodiment, the step of obtaining an input bitmap and performing image preprocessing on the input bitmap to obtain an image file includes: performing image correction on the input bitmap using a perspective transformation function, the formula being:
[0008]
[0009] In the formula, the (x′, y′, z′) vector is the coordinate of the image pixel after transformation, and (x, y, 1) is the original coordinate vector with a new dimension added. The high-pass filter sobel operator is used to perform image denoising on the input bitmap, and two convolution kernels are used to process the input bitmap, and the horizontal gradient of the input bitmap is obtained as follows:
[0010]
[0011] The vertical gradient of the input bitmap is:
[0012]
[0013] According to the gradients in the horizontal and vertical directions, the denoised image is calculated, and the formula is:
[0014] G=|G x |+|G y | (4);
[0015] Where I is the input image matrix.
[0016] In one embodiment, the image size recognition model is constructed based on the YOLOv5-NEXT-VIT neural network, including: obtaining training data of the oil tank base engineering drawing, dividing the training data into three categories and labeling them accordingly, including a first category of data based on the shaft head and the shaft head size, a second category of data based on the motor foot plate size, the motor foot plate gap size and the total length of the motor foot plate, and a third category of data including the foot plate graphics and the size from the foot plate bolt hole to the foot plate edge; performing data enhancement processing on the training data, and randomly dividing it into a training set, a validation set and a test set; constructing a YOLOv5-NEXT-VIT neural network based on the YOLOv5 algorithm and the Next-ViT network, and training the YOLOv5-NEXT-VIT neural network through the training set, the validation set and the test set to obtain a trained image size recognition model.
[0017] In one embodiment, the YOLOv5-NEXT-VIT neural network is constructed based on the YOLOv5 algorithm and the Next-ViT network, including: introducing the Next-ViT network in the backbone network layer of YOLOv5, using the Next-ViT network as the backbone network, the Next-ViT network is composed of multiple PENN modules, and the PENN module includes PatchEmbedding, NCB and NTB modules; introducing a multi-scale convolution module in the neck network layer, and constructing an adaptive multi-scale convolution module including a residual block in the feature pyramid through MSDConv and Res2Block; wherein the adaptive multi-scale convolution module obtains a feature map by downsampling through standard convolution, convolves the feature map with three different convolution kernels, extracts different scale features of the target and fuses them, adds an EMA attention mechanism, and obtains spatial and channel information; wherein the receptive field size calculation formula of the convolution kernel is:
[0018]
[0019] RF i+1 =RF i +(k-1)×S i (6);
[0020] In the formula, S i Represents the product of all previous layer steps, RF i+1 Indicates the receptive field size of the current convolutional layer, RF i Represents the receptive field size of the previous convolutional layer, k represents the size of the convolution kernel; the multi-scale convolution module is used to replace the C3 residual module in YOLOv5, and the input feature map is X∈R C×H×W , where C is the number of channels, H and W are the height and width of the feature map; the input feature map is divided into S subsets, denoted as X i , where i∈{1,2,...,s}, and perform 3×3 convolution on all subsets except the first one, where Y1=X1, the formula is:
[0021] Y i =f(X i ), i=2, 3,...,S; (7);
[0022] In the formula, f(·) represents the execution of a 3×3 convolution operation, Y i After completing the convolution operation of each channel, a connection operation is performed to merge the information from each channel and obtain the merged feature map O∈R C×H×W ,for:
[0023] O=[Y1, Y1+Y2..., Y1+Y2+...+YS ] (8);
[0024] Replace the UpSample of YOLOv5 with the CARAFE module, which includes a kernel function generation module and a feature reconstruction module; the given tensor of the detection head is The form of the self-attention mechanism is:
[0025]
[0026] The attention function is converted into three sequences of attention functions, so that each attention function focuses on one category of images respectively. The formula is:
[0027]
[0028] In the formula, π L represents scale attention, f(·) is a linear function, σ(·) is a sigmoid activation function; according to the semantic importance of different sizes, feature operations of different scales are dynamically fused, and the formula is:
[0029]
[0030] In the formula, π S represents spatial attention, K is the number of spatial sampling positions, and p k is the sampling position, Δp k is the self-learning spatial offset, Δm k For p k The self-learning weights of ; aggregate features of different levels at the same spatial position, the formula is:
[0031]
[0032] In the formula, π C represents task-aware attention, is the characteristic slice of the C channel, [α 1 ,α 2 ,β 1 ,β 2 ] T =θ(·) is a hyperfunction of the self-learning control activation threshold.
[0033] In one embodiment, the step of inputting the image file into the image size recognition model to obtain a recognizable size includes: inputting the image file into the image size recognition model, wherein the image file includes first type data A, second type data B, and third type data C; the first type data includes A1…A n, locate and extract A1, which contains the shaft head dimension feature a1, remove A1 from A2, and the obtained features include the front bolt hole and its dimension feature a2 to the end of the shaft head, and so on, to obtain all the dimension features of the first type of data, namely:
[0034] (A n -A n-1 )→a n (13);
[0035] to a n Perform text recognition, a n Contains multiple data, taking the largest size to get the recognizable size Ma of the first type of data n ,Right now:
[0036]
[0037] Ma n =Max(a n ) (15);
[0038] The second type of data includes the motor foot plate size B1, the motor foot plate gap size B2 and the motor foot plate total length B3; wherein B1 contains multiple motor foot plate sizes, and the x coordinate of each prediction frame is queried The predicted box x coordinates x of A1 a1 The one with the smallest absolute difference between the two is the motor foot closest to the motor shaft head, which is recorded as the motor front foot b1 1 ,have:
[0039]
[0040] For b1 1 Extract the features of the motor front foot plate and identify the parameters, that is, obtain the length dimension Mb1 of the motor front foot plate 1 , remove the B1 containing b1 1 The prediction frame is then removed, and the remaining prediction frame is operated according to formula (16) to obtain the motor foot plate close to the front foot plate of the motor, that is, the second motor foot plate, and the length dimension Mb1 is identified. 2 , and so on, to get the size of all motor feet; for B2, traverse and calculate whether the x coordinate of each empty prediction frame is between the two motor feet obtained from B1, if it is satisfied, it is recorded as empty B2 n , the recognition size is the empty size Mb2 n Otherwise, record Mb2 n is empty;
[0041] For B3, identify the content in the prediction box, take the maximum value and record it as the total length of the motor foot Mb3, that is, the length of each motor foot plus the length of the idle space; calculate the distance between all prediction boxes in the third category data C1 and the motor shaft head prediction box, the formula is:
[0042]
[0043] Take the smallest prediction box and b1 1 The x-coordinate of the prediction frame is compared. If it is less than its value, it is recorded as the edge length of the front bolt foot plate C1 1 , extract and identify the parameters to get the corresponding size Mc1 1 , otherwise determine C1 1 Empty: Take the prediction frame with the largest distance from the motor shaft head prediction frame and match it with the last foot plate b1 n The x-coordinate comparison of the predicted box is as follows:
[0044]
[0045] If it is greater than the value, it is recorded as the rear bolt foot plate edge length characteristic C1 2 , extract and identify the parameters to get the corresponding size Mc1 2 , otherwise Mc1 is determined 2 Empty; save all detected prediction box data and recognized sizes to obtain recognizable sizes.
[0046] In one of the embodiments, the motor dimension chain model is constructed based on the correlation between motor dimensions, the identifiable dimensions are input into the motor dimension chain model, and the unidentified dimensions are calculated, including: obtaining the mutually related dimension chains in the tank base diagram to construct the motor dimension chain model; inputting the identifiable dimensions into the motor dimension chain module, the identifiable dimensions including Class A dimension data, Class B dimension data and Class C dimension data; and sorting the Class A dimension data from small to large according to the prediction frame x coordinate through the motor dimension chain model, i.e., Ma1, Ma2, ..., Ma n , according to the relationship between adjacent dimensions, the total dimension Ma between any number of adjacent features is obtained x-y , the formula is:
[0047]
[0048] In the formula, when x is 1, it represents the distance dimension from any bolt hole feature to the motor shaft head; the motor dimension chain model is used to arrange the B-type dimension data according to the x coordinates of the foot plate and the gap, and the gap element is placed between the two foot plates. The total length of the motor foot plate is inserted at the end of the queue to obtain:
[0049] B=(Mb1 1,Mb2 1 ,Mb1 2 ,...,Mb1 n ,Mb2 n ,Mb1 n+1 ,Mb3) (20);
[0050] According to the above formula, the size of any empty space is calculated to be Mb2 n , which is Mb3 minus the sum of all elements in B except Mb3; fill the obtained gap size into the queue, and use the queue to calculate any b1 n The position and size of the motor foot plate relative to the front foot plate, that is, the queue Mb1 n Sum the previous elements; for C-type dimension data, according to the motor drawing characteristics, the first type of motor A dimension is the motor shaft head size, the second is the distance size from the shaft head to the front bolt hole, and from the third feature onwards, the distance size between the foot plate bolt holes is:
[0051] Mc1 1 =Mb3-Ma 3-n -Mc1 2 (twenty one);
[0052] By Mc1 1 Calculate the size from the end of the motor foot to the motor shaft head Mab1 n , the formula is:
[0053] Ma1b1 n =Ma 1-2 -Mc1 1 +(Mb1 1 +Mb2 1 +…Mb1 n ) (twenty two);
[0054] The motor dimension chain model is used to process the three types of dimension data, A, B, and C, respectively, and all unidentified dimensions in the motor drawing are calculated.
[0055] In one of the embodiments, the existing template drawing is modified and annotated according to the recognizable dimensions and the calculated unrecognized dimensions to obtain a target engineering drawing, including: linking the tank base template drawing through a scripting language, calling a graphics interface function to generate corresponding graphics and features and annotating them; modifying the layer and annotation style of the feature according to the recognizable dimensions and unrecognized dimensions; adding standard parts, adding part reference objects according to the newly added standard parts, and changing the reference object properties according to the newly added standard parts; repeating the above steps until the recognizable dimensions and unrecognized dimensions are called and the target engineering drawing is generated; linking the PLM system to obtain material codes, synchronizing the materials in the target engineering drawing according to the material codes, and saving and uploading the target engineering drawing after material synchronization to the PLM system.
[0056] A fuel tank base engineering drawing generation system, used to implement the above-mentioned fuel tank base engineering drawing generation method, comprising: an image preprocessing module, an image recognition module, a dimension chain generation module and an engineering drawing generation module; the image preprocessing module is used to obtain an input bitmap, perform image preprocessing on the input bitmap, and obtain an image file; the image recognition module is used to construct an image size recognition model based on a YOLOv5 algorithm and a NEXT-VIT network, and input the image file into the image size recognition model to obtain a recognizable size; the dimension chain generation module is used to construct a motor dimension chain model based on the correlation between motor sizes, and input the recognizable size into the motor dimension chain model to calculate an unrecognized size; the engineering drawing generation module is used to modify and annotate an existing template drawing according to the recognizable size and the calculated unrecognized size to obtain a target engineering drawing.
[0057] An electronic device for generating an engineering drawing of a fuel tank base comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of a method for generating an engineering drawing of a fuel tank base described in the above-mentioned embodiments are implemented.
[0058] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a method for generating an engineering drawing of a fuel tank base described in each of the above embodiments.
[0059] Compared with the prior art, the advantages and beneficial effects of the present invention are as follows: the present invention can obtain an image file by acquiring an input bitmap and performing image preprocessing on it, so as to facilitate subsequent accurate engineering drawing generation operations; based on the YOLOv5 algorithm and the NEXT-VIT network, an image size recognition model is constructed, and an image file is input to obtain a recognizable size, thereby realizing automatic recognition of motor drawing size parameters, improving work efficiency, and being able to realize the annotation of multiple objects with the same feature, and obtaining a more comprehensive and accurate parameter annotation engineering drawing; based on the correlation between motor dimensions, a motor dimension chain model is constructed, and a recognizable size is input to calculate an unrecognized size, and the size calculation is performed through the correlation between motor dimensions, so that more comprehensive dimension data can be obtained, and when the dimension modification is required, the associated dimension can be modified synchronously, thereby improving the parameter modification efficiency; according to the recognizable size and the calculated unrecognized size, the template drawing is modified and annotated to obtain the target engineering drawing, thereby realizing the automatic generation of the tank base engineering drawing, and being able to facilitate parameter modification, thereby improving the engineering drawing generation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A schematic diagram of a flow chart of a method for generating an engineering drawing of a fuel tank base in one embodiment;
[0061] Figure 2 A schematic diagram of the structure of a YOLOv5-NEXT-VIT neural network in one embodiment;
[0062] Figure 3 Schematic diagram of the structure of a multi-scale convolution module in one embodiment;
[0063] Figure 4 It is a structural schematic diagram of a system for generating engineering drawings of a fuel tank base in one embodiment;
[0064] Figure 5 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION
[0065] Before describing the specific embodiments of the present invention, the overall concept of the present invention is described as follows:
[0066] The present invention is mainly developed for the engineering drawing generation process. Currently, engineering drawing image generation cannot identify elements of the same type but with different annotation objects, and requires manual parameter input, which is inefficient, has a high error rate, and is inconvenient for parameter modification.
[0067] Therefore, the present invention proposes a method for generating an engineering drawing of a fuel tank base, which obtains an image file by acquiring an input bitmap and performing image preprocessing on it, so as to facilitate subsequent accurate engineering drawing generation operations; based on the YOLOv5 algorithm and the NEXT-VIT network, an image size recognition model is constructed, and an image file is input to obtain a recognizable size, thereby realizing automatic recognition of motor drawing size parameters, improving work efficiency, and being able to realize the annotation of multiple objects with the same feature, and obtaining a more comprehensive and accurate parameter annotation engineering drawing; based on the correlation between motor dimensions, a motor dimension chain model is constructed, and a recognizable size is input to calculate an unrecognized size, and the dimension calculation is performed through the correlation between motor dimensions, so that more comprehensive dimension data can be obtained, and when the dimension modification is required, the associated dimension can be modified synchronously, thereby improving the parameter modification efficiency; according to the recognizable size and the calculated unrecognized size, the template drawing is modified and annotated to obtain a target engineering drawing, thereby realizing automatic generation of the fuel tank base engineering drawing, and being able to facilitate parameter modification, thereby improving the efficiency of engineering drawing generation.
[0068] The present invention can be applied to the engineering drawing drawing of an MVR (Mechanical Vapor Recompression, steam mechanical recompression technology) oil tank base.
[0069] After introducing the overall concept of the present invention, in order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail by specific implementation methods in combination with the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0070] In one embodiment, Figure 1 As shown, a method for generating an engineering drawing of a fuel tank base is provided, comprising the following steps:
[0071] Step S110, obtaining an input bitmap, performing image preprocessing on the input bitmap, and obtaining an image file.
[0072] Specifically, an input bitmap required for engineering drawing drawing is obtained, and image preprocessing is performed on the input bitmap. For example, the OpenCV image preprocessing module is used to perform image enhancement and denoising operations on the input bitmap, and the tilt, distortion and deviation that may exist in the input bitmap are adjusted to obtain a processed image file to facilitate subsequent engineering drawing generation.
[0073] Wherein, step S110 includes: using a perspective transformation function to perform image correction on the input bitmap, the formula is:
[0074]
[0075] In the formula, the (x′, y′, z′) vector is the coordinate of the image pixel after transformation, and (x, y, 1) is the original coordinate vector with a new dimension added. The high-pass filter sobel operator is used to reduce the noise of the input bitmap, and two convolution kernels are used to process the input bitmap, and the horizontal gradient of the input bitmap is obtained as follows:
[0076]
[0077] The vertical gradient of the input bitmap is:
[0078]
[0079] According to the gradients in the horizontal and vertical directions, the denoised image is calculated, and the formula is:
[0080] G=|G x |+|G y | (4);
[0081] Where I is the input image matrix.
[0082] Specifically, during image preprocessing, the perspective transformation function PerspectiveTransformation can be used to correct the tilted and distorted image; in addition, considering that the main components of the motor drawings are horizontal and numerical lines, especially dimension markings, the high-pass filter Sobel operator can be used to reduce image noise while enhancing edge contours and sizes. The original image is processed horizontally and vertically through two convolution kernels to obtain a processed image file.
[0083] Step S120: construct an image size recognition model based on the YOLOv5 algorithm and the NEXT-VIT network, input the image file into the image size recognition model, and obtain a recognizable size.
[0084] Specifically, an image size recognition model is constructed based on the YOLOv5 algorithm and the NEXT-VIT network. By introducing the NEXT-VIT network into the YOLOv5 basic framework, the image size recognition model is not limited to the local features of the motor drawing, thereby enhancing the correlation between the various dimensions of the motor and improving the detection speed and accuracy. The NEXT-VIT network is used as the backbone network, so that the network has the advantages of both convolutional neural networks and self-attention mechanisms, and can capture both local features and all features. The image file is input into the image size recognition model, and the recognizable size is output, thereby realizing the automatic recognition of the size parameters of the motor drawing, improving work efficiency, and being able to realize the labeling of multiple objects in the same feature, and obtaining a more comprehensive and accurate parameter labeled engineering drawing.
[0085] Among them, the steps of building an image size recognition model include: obtaining training data of the oil tank base engineering drawing, dividing the training data into three categories and labeling them accordingly, including a first category of data based on the shaft head and the shaft head size, a second category of data based on the motor foot plate size, the motor foot plate gap size and the total length of the motor foot plate, and a third category of data on the foot plate graphics and the size from the foot plate bolt hole to the foot plate edge; performing data enhancement processing on the training data, and randomly dividing it into a training set, a validation set and a test set; constructing a YOLOv5-NEXT-VIT neural network based on the YOLOv5 algorithm and the Next-ViT network, and training the YOLOv5-NEXT-VIT neural network through the training set, the validation set and the test set to obtain a trained image size recognition model.
[0086] Specifically, since motor drawings are usually marked based on the shaft head size, and a small number are marked based on the motor front foot plate, when the oil tank base engineering drawings with marked dimensions are used as training data, the training data can be divided into three categories and labeled accordingly during the model training stage, namely, the first category of data based on the shaft head and shaft head layer dimensions, the second category of data based on the motor foot plate size, the motor foot plate gap size and the total length of the motor foot plate, and the third category of data on the foot plate graphics and the dimensions from the foot plate bolt hole to the foot plate edge.
[0087] The first type of data is based on the shaft head and its size. The real bounding box includes the shaft head and its size, and the label is A1. The real bounding box includes A1 and the next required size and feature, such as the front bolt hole and its size to the end of the shaft head, and the label is A2. And so on until it includes the last size based on the shaft head and its feature, and the label is An.
[0088] The second type of data includes: the real bounding box contains the motor foot features and their dimensions, labeled as B1; the real bounding box contains the motor foot idle dimensions, labeled as B2; and the real bounding box contains the total length of the motor foot, labeled as B3.
[0089] The third type of data is the real bounding box including the foot plate (which plays the role of fixing the motor) graphics and the size of the foot plate bolt hole to the foot plate edge, and the label is C1.
[0090] In practice, motor drawings are divided into low-voltage and high-voltage, explosion-proof and conventional types. Different types of motors have different shapes and annotations. To prevent the model from overfitting, the training data needs to be enhanced and randomly divided into training sets, validation sets, and test sets. For example, data enhancement is used to increase the number of drawings of each type to 1,000, and the above-mentioned types of motor drawings are randomly shuffled and divided into training sets, validation sets, and test sets in a ratio of 6:2:2 for training model training.
[0091] When building the model, the YOLOv5-NEXT-VIT neural network is built based on the YOLOv5 algorithm and the Next-ViT network. Its structure is as follows Figure 2 As shown, the YOLOv5-NEXT-VIT neural network is trained through the training set, validation set and test set to obtain the trained image size recognition model. The image size recognition model includes an input layer, a backbone network layer, a neck network layer and a detection head, wherein the input layer is used to segment and scale the image file, the backbone network layer is used to extract features from the segmented and scaled image, the neck network layer is used to pool and fuse the extracted features, and the fused features are input to the detection head, which performs feature judgment and outputs the results to obtain the recognizable size of the oil tank base engineering drawing.
[0092] The steps of constructing the YOLOv5-NEXT-VIT neural network include: introducing the Next-ViT network into the backbone network layer of YOLOv5, and enhancing the association between the motor sizes through the self-attention mechanism; using the Next-ViT network as the backbone network to capture local features and global features, the Next-ViT network is composed of multiple PENN modules, and the PENN module includes Patch Embedding, NCB and NTB modules; introducing a multi-scale convolution module into the neck network layer, and constructing an adaptive multi-scale convolution module containing a residual block in the feature pyramid through MSDConv and Res2Block; wherein, the adaptive multi-scale convolution module obtains a feature map by downsampling through standard convolution, convolves the feature map with three different convolution kernels, extracts and fuses the different scale features of the target, adds the EMA attention mechanism, and obtains the spatial and channel information, wherein the calculation formula of the receptive field size of the convolution kernel is:
[0093]
[0094] RF i+1 =RF i +(k-1)×S i (6);
[0095] In the formula, S i Represents the product of all previous layer steps, RF i+1 Indicates the receptive field size of the current convolutional layer, RF i represents the receptive field size of the previous convolutional layer, and k represents the size of the convolution kernel;
[0096] The multi-scale convolution module is used to replace the C3 residual module in YOLOv5. Let the input feature map be X∈R C×H×W, where C is the number of channels, H and W are the height and width of the feature map; the input feature map is divided into S subsets, denoted as X i , where i∈{1,2,...,s}, and perform 3×3 convolution on all subsets except the first one, where Y1=X1, the formula is:
[0097] Y i =f(X i ),i=2,3,...,S; (7);
[0098] In the formula, f(·) represents the execution of a 3×3 convolution operation, Y i After completing the convolution operation of each channel, a connection operation is performed to merge the information from each channel and obtain the merged feature map O∈R C×H×W ,for:
[0099] O=[Y1, Y1+Y2,..., Y1+Y2+...+Y S ] (8);
[0100] Replace the UpSample of YOLOv5 with the CARAFE module, which includes a kernel function generation module and a feature reconstruction module; the given tensor of the detection head is The form of the self-attention mechanism is:
[0101]
[0102] The attention function is converted into three sequences of attention functions, so that each attention function focuses on one category of images respectively. The formula is:
[0103]
[0104] In the formula, π L represents scale attention, f(·) is a linear function, σ(·) is a sigmoid activation function; according to the semantic importance of different sizes, feature operations of different scales are dynamically fused, and the formula is:
[0105]
[0106] In the formula, π S represents spatial attention, and deformable convolution is used to make attention learning sparse. K is the number of spatial sampling positions, and p k is the sampling position, Δp k is the self-learning spatial offset, Δm k For p k The self-learning weights of ; aggregate features of different levels at the same spatial position, the formula is:
[0107]
[0108] In the formula, π C Indicates task-aware attention, automatically choosing to open or close feature channels based on threshold judgment, is the characteristic slice of the C channel, [α 1 ,α 2 ,β 1 ,β 2 ] T =θ(·) is a hyperfunction of the self-learning control activation threshold.
[0109] Specifically, by introducing the Next-ViT network in the Backbone layer of the YOLOv5 basic framework, the self-attention mechanism makes the network not limited to the local features of the motor drawings, enhances the correlation between the various sizes of the motor, and improves the detection speed and accuracy. Using Next-ViT as the backbone network, the network has the advantages of both convolutional neural networks and self-attention mechanisms, that is, the ability to capture local and global features. Next-ViT consists of multiple PENN modules, each of which contains Patch Embedding, NCB and NTB modules. The Neck layer introduces the multi-scale convolution module MSDConv, which gives the network a more flexible and variable receptive field. MSDConv, Res2Block and other modules construct an adaptive multi-scale convolution module containing residual blocks in the feature pyramid. The structure of the multi-scale convolution module is as follows: Figure 3 As shown in the figure, the network has stronger feature expression ability, so that it can extract the features of targets of different scales in the motor drawing. MSDConv first downsamples the feature map through standard convolution, then convolves the feature map with three different convolution kernels to extract the different scale features of the target, then fuses the feature map, and finally adds the EMA (Expectation-MaximizationAttention) attention mechanism to better obtain spatial and channel information.
[0110] The size of the receptive field determines the performance of feature extraction. Calculating the receptive field helps determine the size of the area mapped by the pixels on the output feature map of each layer of the convolutional neural network on the original input image, which facilitates better design of the network architecture and selection of the appropriate convolution kernel size and step size, thereby optimizing the network's performance and computational efficiency.
[0111] The C3_Res2Block multi-scale convolution module is used to replace the C3 residual module of the original YOLOV5, so that the network has stronger feature expression ability, so as to extract the features of targets of different scales in the motor drawings.
[0112] In order to reduce the amount of calculation, YOLOv5's UpSample is replaced with a lightweight general upsampling operator CARAFE (Content-Aware ReAssembly of FEatures), while improving the resolution and quality of the feature map; the CARAFE module consists of two submodules, namely: the kernel function generation module and the feature reassembly module. Kernel function generation is a self-learning-based kernel function generation method that can dynamically generate an adaptive kernel function based on the input feature map, and use it to weight and smooth the reassembled feature map to obtain a more refined and continuous feature map. Feature reassembly is a content-based feature rearrangement method that can divide a low-resolution feature map into multiple small regions and rearrange the features in each region according to a certain order to obtain a high-resolution feature map.
[0113] The object detection head Dyhead based on the attention mechanism unifies multiple object detection heads with attention mechanisms. Due to the high-dimensional tensor, the attention function on all dimensions is very computationally intensive. Therefore, the attention function is converted into three sequences of attention functions, each of which focuses on only one category of data. Dyhead introduces attention mechanisms in different dimensions, allowing the detection head to better capture multi-scale features in motor drawings.
[0114] The step of obtaining a recognizable size through an image size recognition model includes: inputting a picture file into the image size recognition model, the image file includes first-category data A, second-category data B, and third-category data C; the first-category data includes A1…A n , locate and extract A1, which contains the shaft head dimension feature a1, remove A1 from A2, and the obtained features include the front bolt hole and its dimension feature a2 to the end of the shaft head, and so on, to obtain all the dimension features of the first type of data, namely:
[0115] (A n -A n-1 )→a n (13);
[0116] to a n Perform text recognition, a n Contains multiple data, taking the largest size to get the recognizable size Ma of the first type of data n ,Right now:
[0117]
[0118] Ma n =Max(a n ) (15);
[0119] The second type of data includes the motor foot plate size B1, the motor foot plate gap size B2 and the motor foot plate total length B3; among them, B1 contains multiple motor foot plate sizes, query the x coordinate of each prediction box The predicted box x coordinates x of A1 a1 The one with the smallest absolute difference between the two is the motor foot closest to the motor shaft head, which is recorded as the motor front foot b1 1 ,have:
[0120]
[0121] For b1 1 Extract the features of the motor front foot plate and identify the parameters, that is, obtain the length dimension Mb1 of the motor front foot plate 1 , remove the B1 containing b1 1 The prediction frame is then removed, and the remaining prediction frame is operated according to formula (16) to obtain the motor foot plate close to the front foot plate of the motor, that is, the second motor foot plate, and the length dimension Mb1 is identified. 2 , and so on, get the size of all motor foot plates;
[0122] For B2, traverse and calculate whether the x coordinate of each empty prediction frame is between the two motor feet obtained from B1. If it is satisfied, it is recorded as empty B2. n , the recognition size is the empty size Mb2 n Otherwise, record Mb2 n is empty;
[0123] For B3, identify the content in the prediction box, take the maximum value and record it as the total length of the motor foot Mb3, that is, the length of each motor foot plus the length of the idle space; calculate the distance between all prediction boxes in the third category data C1 and the motor shaft head prediction box, the formula is:
[0124]
[0125] Take the smallest prediction box and b1 1 The x-coordinate of the prediction frame is compared. If it is less than its value, it is recorded as the edge length of the front bolt foot plate C1 1 , extract and identify the parameters to get the corresponding size Mc1 1 , otherwise determine C1 1 Empty: Take the prediction frame with the largest distance from the motor shaft head prediction frame and match it with the last foot plate b1 n The x-coordinate comparison of the predicted box is as follows:
[0126]
[0127] If it is greater than the value, it is recorded as the rear bolt foot plate edge length characteristic C1 2 , extract and identify the parameters to get the corresponding size Mc12 , otherwise Mc1 is determined 2 Empty; save all detected prediction box data and recognized sizes to obtain recognizable sizes.
[0128] Specifically, the image file is input into the image size recognition model to identify the features of three categories, A, B, and C, and corresponding operations are performed according to the image size of each category to obtain all identifiable features.
[0129] Step S130, constructing a motor dimension chain model based on the correlation between motor dimensions, inputting the identifiable dimensions into the motor dimension chain model, and calculating the unidentified dimensions.
[0130] Specifically, some motor drawings may not include all required dimensions, such as the front bolt foot edge length Mc1 1 It is not marked, but Mc1 is marked 2 , for this, Mc1 needs to be calculated from other dimensions 1 Therefore, it is necessary to construct a motor dimension chain model based on the dimension correlation of the motor, and calculate the unidentified dimensions based on the known identifiable dimensions through the motor dimension chain model to ensure that all dimension data are obtained. In addition, through the correlation between dimensions, after adjusting a characteristic dimension, the associated dimensions of the characteristic dimension can be adjusted, which is convenient for dimension modification.
[0131] Among them, step S130 includes: obtaining the interrelated dimension chains in the tank base diagram, and constructing a motor dimension chain model; inputting the recognizable dimensions into the motor dimension chain model, and the recognizable dimensions include type A dimension data, type B dimension data, and type C dimension data; sorting the type A dimension data from small to large according to the x coordinate of the prediction frame through the motor dimension chain model, that is, Ma1, Ma2, ..., Man, and obtaining the total dimension Ma between any multiple adjacent features according to the association relationship between adjacent dimensions. x-y , the formula is:
[0132]
[0133] In the formula, when x is 1, it represents the distance from any bolt hole feature to the motor shaft head;
[0134] Through the motor dimension chain model, the B-type dimension data is arranged according to the x-coordinates of the foot plate and the neutral position, and the neutral position element is placed between the two foot plates. The total length of the motor foot plate is inserted into the end of the queue to obtain:
[0135] B=(Mb1 1 ,Mb2 1 ,Mb1 2 ,...,Mb1n ,Mb2 n ,Mb1 n+1 ,Mb3) (20);
[0136] According to the above formula, the size of any empty space is calculated to be Mb2 n , which is Mb3 minus the sum of all elements in B except Mb3; fill the obtained gap size into the queue, and use the queue to calculate any b1 n The position and size of the motor foot plate relative to the front foot plate, that is, the queue Mb1 n Sum the previous elements;
[0137] For the C-type dimension data, according to the motor drawing characteristics, the first motor A-type dimension is the motor shaft head size, the second is the distance size from the shaft head to the front bolt hole, and from the third feature onwards is the distance size between the foot plate bolt holes, so:
[0138] Mc1 1 =Mb3-Ma 3-n -Mc1 2 (twenty one);
[0139] By Mc1 1 Calculate the size from the end of the motor foot to the motor shaft head Mab1 n , the formula is:
[0140] Ma1b1 n =Ma 1-2 -Mc1 1 +(Mb1 1 +Mb2 1 +…Mb1 n ) (twenty two);
[0141] The motor dimension chain model is used to process the three types of dimension data, A, B, and C, respectively, and all unidentified dimensions in the motor drawing are calculated.
[0142] Specifically, the dimensions within the three categories A, B, and C are interrelated, and some dimensions of different categories are also related. A related dimension chain is required when drawing a tank base drawing.
[0143] By obtaining the interrelated dimension chains in the oil tank base diagram, a motor dimension chain model is constructed; all identifiable dimensions are input into the motor dimension chain module, wherein the identifiable dimensions include Class A dimension data, Class B dimension data and Class C dimension data.
[0144] When calculating unidentified dimensions through the motor dimension chain model: For type A dimensions, the motor dimension chain module sorts them from small to large according to the x-coordinate of the prediction frame (that is, from the motor shaft head to other bolt hole features), so that the total size between any number of adjacent features can be obtained. For type B dimensions, the x-coordinates of the foot plate and the gap are used to arrange the foot plate and the gap elements (the gap elements are also put into the queue and placed between the two foot plates), and the total length of the motor foot plate is inserted at the end of the queue. For type C dimensions, the main thing is to calculate Mc1 1 , if Mc1 1 If it is empty, you need to use A, B, and C dimensions for calculation.
[0145] By using the above method, other unidentified dimensions that cannot be directly identified from the motor drawings are calculated from the motor dimension chain model, thereby realizing automatic calculation of the unidentified dimensions to achieve complete marking of all dimensions.
[0146] Step S140, modifying and marking the existing template drawing according to the recognizable dimensions and the calculated unrecognized dimensions to obtain the target engineering drawing.
[0147] Specifically, after obtaining the recognizable dimensions and unrecognized dimensions respectively through identification and dimension chain calculation, the existing template drawings are modified and annotated based on the two types of dimensions to obtain the target engineering drawing of the input bitmap, thereby realizing the automatic generation of the target engineering drawing and improving the efficiency of engineering drawing generation.
[0148] Among them, step S140 includes: linking the tank base template drawing through a scripting language, calling a graphic interface function to generate corresponding graphics and features and annotating them; modifying the layer and annotation style of the feature according to the recognizable dimensions and unrecognized dimensions; adding standard parts, adding part reference objects according to the newly added standard parts, and changing the reference corresponding attributes according to the newly added standard parts; repeating the above steps until the recognizable dimensions and unrecognized dimensions are called and a target engineering drawing is generated; linking the PLM system to obtain the material code, synchronizing the materials in the target engineering drawing according to the material code, and saving the target engineering drawing after material synchronization and uploading it to the PLM system.
[0149] Specifically, all the dimensions obtained are used to draw the tank base, for example, PYAutoCAD is used to call ActiveX API to realize the interaction between Python and CAD, and then programmatic drawing is performed.
[0150] The fuel tank base template drawing is linked through the Python scripting language, and the corresponding functions of the AutoCAD ActiveX API are called to generate and annotate the features such as the motor pad, threaded holes, and text annotations of the fuel tank base. The layer, annotation style and other parameters of the features are modified as needed, standard parts are added, and part reference objects are added for the newly added parts. The properties of the newly added parts are changed according to the newly added parts. The above calling, modifying and adding operations are repeated until all dimensional data are called and the target engineering drawing is obtained; the material code is obtained by interacting with the PLM (Product Lifecycle Management) system, and the material code is synchronously matched with the material in the target engineering drawing. The corresponding material properties are assigned to the matched materials according to the material code. Finally, the synchronized dwg file is saved and uploaded to the PLM system.
[0151] In this embodiment, an image file is obtained by obtaining an input bitmap and performing image preprocessing on it, so as to facilitate subsequent accurate engineering drawing generation operations; based on the YOLOv5 algorithm and the NEXT-VIT network, an image size recognition model is constructed, and an image file is input to obtain a recognizable size, thereby realizing automatic recognition of motor drawing size parameters, improving work efficiency, and being able to realize the annotation of multiple objects with the same feature, and obtaining a more comprehensive and accurate parameter annotation engineering drawing; a motor size chain model is constructed based on the correlation between motor dimensions, and a recognizable size is input to calculate the unrecognized size. The size calculation is performed through the correlation between motor dimensions, so that more comprehensive size data can be obtained, and when the size modification is required, the associated size can be modified synchronously, thereby improving the parameter modification efficiency; according to the recognizable size and the calculated unrecognized size, the template drawing is modified and annotated to obtain the target engineering drawing, thereby realizing the automatic generation of the tank base engineering drawing, and being able to facilitate parameter modification, thereby improving the engineering drawing generation efficiency.
[0152] In one embodiment, some operations when generating an engineering drawing are as follows:
[0153] First, execute the code F2600 = AutoCAD (create_if_not_exists = True), link the opened tank base template dwg file, and create a CAD object named F2600, where F2600 is the drawing code.
[0154] In order to simplify the operation commands, the lower left corner of the frame of the fuel tank base template drawing is fixed to the world coordinate origin of the AutoCAD model space. At the same time, the reference point coordinates of each view are selected and recorded to provide a reference for subsequent feature addition.
[0155] According to the view to be drawn, read the parameters in the dimension chain model, and calculate the point coordinates of the pad feature. For example, the reference coordinates of the view to which the feature needs to be added are (x1, x2), and the offset of the feature point relative to the reference coordinates is (a, b), where a and b are obtained by reading the data of the dimension chain generation module and using the feature position calculation formula. For example, the x-direction offset a of the motor front pad is the length of the compressor shaft head (fixed value) plus the length of the coupling (fixed value), plus the length from the motor shaft head to the motor front foot plate Ma1b1 1 .
[0156] The final coordinates of the feature point are (x1+a,x2+b). This point is added through the APoint function, and then another point is defined in the same way. The two points are connected into a line through the AddLine function. The above commands generate the outline of the motor pad feature. By modifying the LAYER property of the LINE object, the layer of all pad outlines is changed to a thick solid line layer.
[0157] After the outline of the feature is completed, it needs to be annotated, for example, by adding an aligned dimension annotation through the AddDimAligned function, or by adding annotation text at a specified location through AddText.
[0158] In addition, the SendCommand function can directly send the AutoCAD command stream to AutoCAD to complete the function operations that ActiveX does not have. Use -Insert to insert the pre-defined standard parts blocks (dynamic blocks) such as bolts and nuts in the specified directory, and then modify the size of the standard parts through commands such as Stretch and Scale. Send the AMPARTREF command to create a part reference object at the specified location, modify the part reference object name attribute ObjectName to motor pad, Material attribute to Q245A, and other attributes. Since the template file has a BOM pre-added, the newly added part reference will automatically update the BOM.
[0159] By installing the PLM plug-in, the CAD system defines a series of custom functions, and at the same time, additional content is added to the attributes of the objects to implement various PLM functions. Use the dsnmandir command to define the design directory, and the system automatically generates the corresponding folder directory. Then use the dsnnew command to generate a data package in the design directory. Use the SaveAs method to save the fuel tank base drawing to the data package. Use getparnum, pass in parameters assm, MVR, tkbase, supbox, get the material code for the MVR fuel tank base pad and save it to a string, and then assign the material code to the partnumber attribute of the part reference object. For material codes that may already exist, use Findparnum to search for the material code and return the material code, and use the asginpart command to assign the material attributes in the database to the corresponding part reference object. Use the uploadplm command to automatically save and upload the drawing to the PLM system.
[0160] Through the above steps, the automatic drawing of the fuel tank base diagram is completed, which avoids the errors caused by manual input of parameters and improves the efficiency of engineering drawing generation.
[0161] like Figure 4 As shown, a fuel tank base engineering drawing generation system 40 is provided, which is used to implement a fuel tank base engineering drawing generation method as described above, including: an image preprocessing module 41, an image recognition module 42, a dimension chain generation module 43 and an engineering drawing generation module 44; wherein:
[0162] The image preprocessing module 41 is used to obtain an input bitmap, perform image preprocessing on the input bitmap, and obtain an image file;
[0163] The image recognition module 42 is used to construct an image size recognition model based on the YOLOv5 algorithm and the NEXT-VIT network, and input the image file into the image size recognition model to obtain a recognizable size;
[0164] The dimension chain generation module 43 is used to construct a motor dimension chain model based on the correlation between motor dimensions, input the identifiable dimensions into the motor dimension chain model, and calculate the unidentified dimensions;
[0165] The engineering drawing generation module 44 is used to modify and annotate the existing template drawings according to the recognizable dimensions and the calculated unrecognized dimensions to obtain the target engineering drawings.
[0166] In one embodiment, the image recognition module 42 is specifically used to: obtain training data of the tank base engineering drawing, divide the training data into three categories and label them accordingly, including a first category of data based on the shaft head and the shaft head size, a second category of data based on the motor foot plate size, the motor foot plate gap size and the total length of the motor foot plate, and a third category of data on the foot plate graphics and the size from the foot plate bolt hole to the foot plate edge; perform data enhancement processing on the training data, and randomly divide it into a training set, a validation set and a test set; construct a YOLOv5-NEXT-VIT neural network based on the YOLOv5 algorithm and the Next-ViT network, and train the YOLOv5-NEXT-VIT neural network through the training set, the validation set and the test set to obtain a trained image size recognition model.
[0167] In one embodiment, the engineering drawing generation module 44 is specifically used to: link the tank base template drawing through a scripting language, call the graphic interface function to generate corresponding graphics and features and annotate them; modify the layer and annotation style of the feature according to the recognizable dimensions and unrecognized dimensions; add standard parts, add part reference objects according to the newly added standard parts, and change the reference corresponding attributes according to the newly added standard parts; repeat the above steps until the recognizable dimensions and unrecognized dimensions are called and the target engineering drawing is generated; link the PLM system to obtain the material code, synchronize the existing materials, save the target engineering drawing and upload it to the PLM system.
[0168] In one embodiment, an electronic device for generating an engineering drawing of a fuel tank base is provided. The device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the device is used to provide computing and control capabilities. The memory of the device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the device is used to store configuration templates and can also be used to store target web page data. The network interface of the device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating an engineering drawing of a fuel tank base is implemented.
[0169] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the device to which the scheme of the present application is applied. The specific device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0170] In one embodiment, a computer-readable storage medium may be provided, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method described in the aforementioned embodiment. The computer may be part of the above-mentioned fuel tank base engineering drawing generation system.
[0171] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0172] Obviously, those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a computer storage medium (ROM / RAM, magnetic disk, optical disk) and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Therefore, the present invention is not limited to any specific combination of hardware and software.
[0173] The above contents are further detailed descriptions of the present invention in combination with specific implementation methods, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.
Claims
1. A method for generating an engineering drawing of a fuel tank base, characterized in that: The following steps are involved: Obtaining an input bitmap, performing image preprocessing on the input bitmap, and obtaining an image file; Based on the YOLOv5 algorithm and the NEXT-VIT network, an image size recognition model is constructed, and the image file is input into the image size recognition model to obtain a recognizable size; A motor dimension chain model is constructed based on the correlation between motor dimensions, the identifiable dimensions are input into the motor dimension chain model, and unidentified dimensions are calculated; According to the identifiable dimensions and the calculated unidentified dimensions, the existing template drawings are modified and annotated to obtain the target engineering drawings.
2. The method for generating an engineering drawing of a fuel tank base according to claim 1, characterized in that: The step of obtaining an input bitmap and performing image preprocessing on the input bitmap to obtain an image file includes: The input bitmap is corrected using a perspective transformation function, and the formula is: In the formula, the (x′, y′, z′) vector is the coordinate of the image pixel after transformation, and (x, y, 1) is the original coordinate vector with the new dimension added; The input bitmap is subjected to image denoising using a high-pass filter sobel operator, and the input bitmap is processed using two convolution kernels to obtain the horizontal gradient of the input bitmap: The vertical gradient of the input bitmap is: According to the gradients in the horizontal and vertical directions, the denoised image is calculated, and the formula is: G=|G x |+|G y | (4); Where I is the input image matrix.
3. The method for generating an engineering drawing of a fuel tank base according to claim 1, characterized in that: The image size recognition model is constructed based on the YOLOv5-NEXT-VIT neural network, including: Obtain training data of the engineering drawing of the fuel tank base, divide the training data into three categories and label them accordingly, including a first category of data based on the shaft head and the shaft head size, a second category of data based on the motor foot plate size, the motor foot plate gap size and the total length of the motor foot plate, and a third category of data based on the foot plate graphics and the size from the foot plate bolt hole to the foot plate edge; Performing data enhancement processing on the training data, and randomly dividing the data into a training set, a validation set, and a test set; A YOLOv5-NEXT-VIT neural network is constructed based on the YOLOv5 algorithm and the Next-ViT network, and the YOLOv5-NEXT-VIT neural network is trained through the training set, the validation set and the test set to obtain a trained image size recognition model.
4. The method for generating an engineering drawing of a fuel tank base according to claim 3, characterized in that: The YOLOv5-NEXT-VIT neural network is constructed based on the YOLOv5 algorithm and the Next-ViT network, including: The Next-ViT network is introduced into the backbone network layer of YOLOv5, and the Next-ViT network is used as the backbone network. The Next-ViT network is composed of multiple PENN modules, and the PENN module includes Patch Embedding, NCB and NTB modules; A multi-scale convolution module is introduced into the neck network layer. Through MSDConv and Res2Block, an adaptive multi-scale convolution module containing residual blocks is constructed in the feature pyramid. The adaptive multi-scale convolution module obtains feature maps by downsampling through standard convolution, convolves the feature maps with three different convolution kernels, extracts and fuses the different scale features of the target, adds the EMA attention mechanism, and obtains spatial and channel information. Among them, the calculation formula of the receptive field size of the convolution kernel is: RF i+1 =RF i +(k-1)×S i (6); In the formula, S i Represents the product of all previous layer steps, RF i+1 Indicates the receptive field size of the current convolutional layer, RF i Represents the receptive field size of the previous convolutional layer, k represents the size of the convolution kernel; the multi-scale convolution module is used to replace the C3 residual module in YOLOv5, and the input feature map is X∈R C×H×W , where C is the number of channels, H and W are the height and width of the feature map; The input feature map is divided into S subsets, denoted as X i , where i∈{1,2,...,s}, and perform 3×3 convolution on all subsets except the first one, where Y1=X1, the formula is: Y i =f(X i ),i=2,3,...,S; (7); In the formula, f(·) represents the execution of a 3×3 convolution operation, Y i is the output feature map; After completing the convolution operation of each channel, a connection operation is performed to merge the information from each channel and obtain the merged feature map O∈R C×H×W ,for: O=[Y1,Y1+Y2,...,Y1+Y2+...+Y S ] (8); Replace UpSample of YOLOv5 with the CARAFE module, wherein the CARAFE module includes a kernel function generation module and a feature recombination module; The given tensor of the detection head is The form of the self-attention mechanism is: The attention function is converted into three sequences of attention functions, so that each attention function focuses on one category of images respectively. The formula is: In the formula, π L represents scale attention, f(·) is a linear function, and σ(·) is a sigmoid activation function; According to the semantic importance of different sizes, feature operations of different scales are dynamically fused. The formula is: In the formula, π S represents spatial attention, K is the number of spatial sampling positions, and p k is the sampling position, Δp k is the self-learning spatial offset, Δm k For p k The self-learning weights of Aggregate features of different levels at the same spatial position. The formula is: In the formula, π C represents task-aware attention, is the characteristic slice of the C channel, [α 1 ,α 2 ,β 1 ,β 2 ] T =θ(·) is a hyperfunction of the self-learning control activation threshold.
5. The method for generating an engineering drawing of a fuel tank base according to claim 4, characterized in that: The step of inputting the image file into the image size recognition model to obtain a recognizable size includes: Inputting the picture file into the image size recognition model, the image file comprising first type data A, second type data B and third type data C; The first type of data includes A1...A n , locate and extract A1, which contains the shaft head dimension feature a1, remove A1 from A2, and the obtained features include the front bolt hole and its dimension feature a2 to the end of the shaft head, and so on, to obtain all the dimension features of the first type of data, namely: (A n -A n-1 )→a n (13); to a n Perform text recognition, a n Contains multiple data, taking the largest size to get the recognizable size Ma of the first type of data n ,Right now: Me n =Max(a n ) (15); The second type of data includes the motor foot plate size B1, the motor foot plate gap size B2 and the motor foot plate total length B3; Among them, B1 contains multiple motor footplate sizes, query the x coordinate of each prediction box The predicted box x coordinates x of A1 a1 The one with the smallest absolute difference between the two is the motor foot closest to the motor shaft head, which is recorded as the motor front foot b1 1 ,have: b1 1 The predicted box coordinates satisfy For b1 1 Extract the features of the motor front foot plate and identify the parameters, that is, obtain the length dimension Mb1 of the motor front foot plate 1 , remove the B1 containing b1 1 The prediction frame is then removed, and the remaining prediction frame is operated according to formula (16) to obtain the motor foot plate close to the front foot plate of the motor, that is, the second motor foot plate, and the length dimension Mb1 is identified. 2 , and so on, get the size of all motor foot plates; For B2, traverse and calculate whether the x coordinate of each empty prediction frame is between the two motor feet obtained from B1. If it is satisfied, it is recorded as empty B2. n , the recognition size is the empty size Mb2 n Otherwise, record Mb2 n is empty; For B3, identify the content in the prediction box, take the maximum value and record it as the total length of the motor foot plate Mb3, that is, the length of each motor foot plate plus the length of the idle space; Calculate the distance between all prediction boxes in the third category data C1 and the motor shaft head prediction box. The formula is: C1 1 The prediction box satisfies Take the smallest prediction box and b1 1 The x-coordinate of the prediction frame is compared. If it is less than its value, it is recorded as the edge length of the front bolt foot plate C1 1 , extract and identify the parameters to get the corresponding size Mc1 1 , otherwise determine C1 1 Is empty: Take the prediction frame with the largest distance from the motor shaft head prediction frame and combine it with the last foot plate b1 n The x-coordinate comparison of the predicted box is as follows: C1 2 The prediction box satisfies If it is greater than the value, it is recorded as the rear bolt foot plate edge length characteristic C1 2 , extract and identify the parameters to get the corresponding size Mc1 2 , otherwise Mc1 is determined 2 is empty; Save all detected prediction box data and recognized sizes to obtain recognizable sizes.
6. The method for generating an engineering drawing of a fuel tank base according to claim 5, characterized in that: The step of constructing a motor dimension chain model based on the correlation between motor dimensions, inputting the identifiable dimensions into the motor dimension chain model, and calculating unidentified dimensions comprises: Obtain the interrelated dimension chains in the oil tank base drawing and construct a motor dimension chain model; Inputting the identifiable dimensions into the motor dimension chain module, the identifiable dimensions including type A dimension data, type B dimension data and type C dimension data; The motor dimension chain model is used to sort the A-type dimension data from small to large according to the x-coordinate of the prediction frame, i.e., Ma1, Ma2, ..., Ma n , according to the relationship between adjacent dimensions, the total dimension Ma between any number of adjacent features is obtained x-y , the formula is: In the formula, when x is 1, it represents the distance from any bolt hole feature to the motor shaft head; The motor dimension chain model is used to arrange the B-type dimension data according to the x-coordinates of the foot plate and the neutral position, and the neutral position element is placed between the two foot plates. The total length of the motor foot plate is inserted into the end of the queue to obtain: B=(Mb1 1 ,Mb2 1 ,Mb1 2 ,...,Mb1 n ,Mb2 n ,Mb1 n+1 ,Mb3) (20); According to the above formula, the size of any empty space is calculated to be Mb2 n , that is, Mb3 minus the sum of all elements in B except Mb3; Fill the obtained gap size into the queue and use the queue to calculate any b1 n The position and size of the motor foot plate relative to the front foot plate, that is, the queue Mb1 n Sum the previous elements; For the C-type dimension data, according to the motor drawing characteristics, the first motor A-type dimension is the motor shaft head size, the second is the distance size from the shaft head to the front bolt hole, and from the third feature onwards is the distance size between the foot plate bolt holes, so: Mc1 1 =Mb3-Ma 3-n -Mc1 2 (21); By Mc1 1 Calculate the size from the end of the motor foot to the motor shaft head Mab1 n , the formula is: Ma1b1 n =But 1-2 -Mc1 1 +(Mb1 1 +Mb2 1 +…Mb1 n ) (22); The motor dimension chain model is used to process the three types of dimension data, A, B, and C, respectively, and all unidentified dimensions in the motor drawing are calculated.
7. The method for generating an engineering drawing of a fuel tank base according to claim 1, characterized in that: The method of modifying and marking the existing template drawing according to the identifiable dimensions and the calculated unidentified dimensions to obtain the target engineering drawing includes: Link the tank base template through the script language, call the graphic interface function to generate the corresponding graphics and features and mark them; Modify the layer and dimension style of the feature according to the recognized and unrecognized dimensions; Adding a new standard part, adding a part reference object according to the new standard part, and changing the reference object attributes according to the new standard part; Repeat the above steps until the recognizable dimensions and unrecognizable dimensions are called up, and a target engineering drawing is generated; The PLM system is linked to obtain the material code, the material in the target engineering drawing is synchronized according to the material code, and the target engineering drawing after the material synchronization is saved and uploaded to the PLM system.
8. A fuel tank base engineering drawing generation system, characterized in that: A method for generating an engineering drawing of a fuel tank base according to any one of claims 1 to 7, comprising: Image preprocessing module, image recognition module, dimension chain generation module and engineering drawing generation module; The image preprocessing module is used to obtain an input bitmap, perform image preprocessing on the input bitmap, and obtain an image file; The image recognition module is used to construct an image size recognition model based on the YOLOv5 algorithm and the NEXT-VIT network, and input the image file into the image size recognition model to obtain a recognizable size; The dimension chain generation module is used to construct a motor dimension chain model based on the correlation between motor dimensions, input the identifiable dimensions into the motor dimension chain model, and calculate the unidentified dimensions; The engineering drawing generation module is used to modify and annotate the existing template drawings according to the recognizable dimensions and the calculated unrecognized dimensions to obtain the target engineering drawing.
9. An electronic device for generating engineering drawings of a fuel tank base, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.