A concrete test block identification method, device, equipment and medium

By extracting and correcting the contour and texture features of the concrete test block image, and combining the training model to analyze the texture comparison value, the accuracy problem of the identity verification of the concrete test block in the existing technology is solved, and the effectiveness of quality inspection of construction projects is improved.

CN118155060BActive Publication Date: 2024-10-11GUANGZHOU YUEJIAN SANHE SOFTWARE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311787868.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2024-10-11
Estimated Expiration
2043-12-22

AI Technical Summary

Technical Problem

Existing methods for verifying the identity of concrete test blocks are time-consuming and laborious in manual inspection, and the image similarity calculation method cannot effectively analyze changes in surface texture features, resulting in poor accuracy and affecting the effectiveness of quality inspection in construction projects.

Method used

By obtaining the image of the concrete test block, extract and correct the quadrilateral contour and the logo contour, generate a square image, perform texture comparison, and determine whether the texture contrast value is less than the target threshold. Combined with the trained segmentation model and texture comparison model, analysis The texture features in the image are used to determine whether the images are the same test block.

Benefits of technology

It improves the accuracy of concrete test block identity verification, simplifies the testing process, and enhances the authenticity and effectiveness of construction project quality testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118155060B_ABST
    Figure CN118155060B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of concrete test blocks, and discloses a method, device, equipment and medium for identifying concrete test blocks, the method comprising: obtaining a first image and a second image of a concrete test block at different process nodes; extracting the quadrilateral contour and the identification contour of the first image and the second image respectively; correcting and demoulding the first image and the second image based on the quadrilateral contour and the identification contour to obtain a first square image and a second square image; aligning the first square image and the second square image to obtain a first texture image and a second texture image; obtaining a texture contrast value based on the first texture image and the second texture image; judging whether the texture contrast value is less than a target threshold; if so, the first image and the second image correspond to the same concrete test block. The present application can improve the accuracy of verifying the identity of concrete test blocks, and play a better role in ensuring the effectiveness and authenticity of construction project quality inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of concrete test blocks, and in particular to a method, device, equipment and medium for identifying a concrete test block. Background Art

[0002] At present, the external device processing methods for verifying the identity of concrete test blocks include external RFID chips, external QR code tags, and changes in the relative position of external markers. The methods for verifying the identity based on the surface image of the concrete test block mainly include manual visual observation and comparison, image similarity calculation, etc. Among them, the processing methods based on external devices have the possibility of swapping test blocks, which affects the authenticity and validity of the test block quality inspection results and cannot reflect the actual situation. The method of verifying the identity based on the surface image of the concrete test block currently has the following problems:

[0003] 1. Manual inspection is time-consuming and laborious.

[0004] 2. Most of the current image similarity calculation methods apply metric learning, map image features into high-dimensional feature vectors, and then calculate the Euclidean distance or cosine distance between vectors. The image's own features are used as the similarity calculation, and there is a lack of association, analysis, extraction and comprehensive utilization of surface texture feature changes. Due to the characteristics of the concrete solidification process, concrete test blocks will naturally have a small part of the texture changes at different times, such as color, cracks, etc. The current similarity calculation method cannot adjust and filter the texture feature information according to the correlation of the surface texture of concrete test blocks at different times, and the similarity results are easily affected; in addition, the surface texture of concrete test blocks includes many features such as obvious potholes and protrusions, small voids and subtle textures. The current method of calculating similarity will lose most of the texture features on the surface of concrete test blocks.

[0005] Therefore, the existing methods for verifying the identity of concrete test blocks have poor accuracy, which affects the effectiveness of construction project quality inspection. Summary of the invention

[0006] The present application provides a concrete test block identification method, device, equipment and medium, which can improve the accuracy of verifying the identity of concrete test blocks and play a good role in ensuring the effectiveness and authenticity of construction project quality inspection.

[0007] In a first aspect, an embodiment of the present application provides a method for identifying a concrete test block, comprising:

[0008] Acquire a first image and a second image of the concrete test block at different process nodes;

[0009] extracting the quadrilateral outline and the logo outline of the first image and the second image respectively;

[0010] Correcting and demoulding the first image based on the quadrilateral outline and the logo outline to obtain a first square image;

[0011] Correcting and demoulding the second image based on the quadrilateral outline and the logo outline to obtain a second square image;

[0012] Aligning the first square image and the second square image to obtain a first texture image and a second texture image;

[0013] Obtaining a texture comparison value according to the first texture image and the second texture image;

[0014] Determine whether the texture contrast value is less than the target threshold;

[0015] Among them, the target threshold is obtained according to the preset precision and the preset recall;

[0016] If so, the first image and the second image correspond to the same concrete test block.

[0017] Furthermore, the above-mentioned respectively extracting the quadrilateral outline and the logo outline of the first image and the second image includes:

[0018] Inputting the first image into the trained segmentation model to obtain a first surface mask image and a first identification mask image;

[0019] Extracting the contour edge of the first surface mask image and performing regression calculation to obtain the quadrilateral contour of the first image;

[0020] Extracting the contour edge of the first identification mask image and performing regression calculation to obtain the identification contour of the first image;

[0021] Inputting the second image into the trained segmentation model to obtain a second surface mask image and a second identification mask image;

[0022] Extracting the contour edge of the second surface mask image and performing regression calculation to obtain the quadrilateral contour of the second image;

[0023] The contour edge of the second identification mask image is extracted and regression calculation is performed to obtain the identification contour of the second image.

[0024] Furthermore, the above-mentioned extraction of the contour edge line of the first surface mask image and the regression calculation to obtain the quadrilateral contour of the first image includes:

[0025] Using a straight line detection algorithm to identify the edges of the first surface mask image and form an edge set;

[0026] Angle calculation step: obtain the target edge line in the edge line set, and calculate the angle between the target edge line and each edge line, and obtain several parallel edge lines of the target edge line according to the angles with each edge line;

[0027] Distance calculation step: calculate the distance between each parallel edge and the target edge, and divide each parallel edge into the parallel edge subset of the target edge according to the distance;

[0028] Taking each edge line in the edge line set as the target edge line in turn and executing the angle calculation step and the distance calculation step, to obtain a parallel edge subset of each edge line;

[0029] The linear fitting method is used to merge each parallel edge subset to obtain a new edge set;

[0030] Determine whether each parallel edge subset meets the preset requirements;

[0031] If it is satisfied, the 4 longest side lines in the new side line set are taken as the quadrilateral outline of the first image; if it is not satisfied, the 8 longest side lines in the new side line set are taken as the side line set, and the angle calculation step is returned.

[0032] Furthermore, the above-mentioned correction and demoulding of the quadrilateral outline and the logo outline based on the first image to obtain the first square image includes:

[0033] Arrange the vertices in the quadrilateral outline of the first image in a clockwise order;

[0034] Using the image perspective transformation method, a first perspective matrix is ​​obtained that transforms each clockwise-arranged vertex into a square;

[0035] Transform and correct the first image and the logo outline of the first image according to the first perspective matrix to obtain a first square image and the logo outline of the first square image;

[0036] Obtaining a first standard ratio according to the side length of the standard mark and the side length of the standard test block;

[0037] Calculating the ratio of the logo outline of the first square image and the side length of the first square image;

[0038] Determine whether a mold exists based on the side length ratio and the first standard ratio;

[0039] If so, calculate a second standard ratio of the standard mold wall thickness to the standard test block side length;

[0040] Cutting the first square image according to a second standard ratio;

[0041] The side length of the first square image is scaled to the side length of the standard test block.

[0042] Furthermore, the above-mentioned aligning the first square image and the second square image to obtain the first texture image and the second texture image includes:

[0043] The first square image is cropped according to the first identification mask image to obtain a first identification image;

[0044] The second square image is cropped according to the second identification mask image to obtain a second identification image;

[0045] Inputting the first identification image into the trained positioning model to obtain the first positioning coordinates of the first identification image;

[0046] Inputting the second identification image into the trained positioning model to obtain second positioning coordinates of the second identification image;

[0047] The first square image and the second square image are aligned based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image.

[0048] Furthermore, the above-mentioned clipping of the first square image according to the first identification mask image to obtain the first identification image includes:

[0049] The first identification mask image is transformed according to the first perspective matrix to obtain a square identification mask image of the first square image, and a identification position of the unique identification in the first square image is determined according to the square identification mask image;

[0050] Calculate the coordinates of the bounding rectangle of the unique identifier;

[0051] The first square image is clipped according to the circumscribed rectangle coordinates and the marker position to obtain a first marker image.

[0052] Furthermore, the step of inputting the first identification image into the trained positioning model to obtain the first positioning coordinates of the first identification image includes:

[0053] Input the preprocessed first identification image into the trained positioning model to obtain the contour coordinates of the three positioning points;

[0054] The Green's formula is used to calculate the coordinates of each contour to obtain the contour area and contour radius of the three positioning points;

[0055] Determine whether there is a mis-segmented area based on the contour coordinates, contour area and contour radius of the three positioning points;

[0056] If it exists, the mis-segmented area is removed to obtain the positioning area of ​​the three positioning points;

[0057] Obtain the position coordinates of three positioning points according to the positioning area;

[0058] Generate the fourth positioning point according to the position coordinates of the three positioning points and the rectangular structure;

[0059] Arrange the positioning points based on their position coordinates to obtain the position coordinates of the positioning points in the forward direction;

[0060] The position coordinates of the positioning point in the positive direction are used as the first positioning coordinates.

[0061] Furthermore, the above-mentioned aligning the first square image and the second square image based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image includes:

[0062] Using an image perspective transformation method, a marking perspective matrix is ​​obtained for transforming the second positioning coordinates into the first positioning coordinates;

[0063] transforming the second square image using the identification perspective matrix;

[0064] After the second square image is straightened in a preset order, the first square pattern is used as the first texture image, and the second square image is used as the second texture image.

[0065] Furthermore, obtaining the texture contrast value according to the first texture image and the second texture image includes:

[0066] Inputting the first texture image and the second texture image into a trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions;

[0067] The texture contrast value of the concrete specimen was obtained according to the texture contrast scores at various resolutions.

[0068] Furthermore, the first texture image and the second texture image are input into a trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions, including:

[0069] Downsampling the first texture image multiple times to obtain first sampling feature maps with multiple resolutions;

[0070] Downsampling the second texture image multiple times to obtain second sampling feature maps with multiple resolutions;

[0071] Repeat feature extraction, cross fusion and attention fusion on each first sampling feature map according to a preset number of cycles to obtain first feature maps at multiple resolutions;

[0072] Repeat feature extraction, cross fusion and attention fusion on each second sampling feature map according to a preset number of cycles to obtain second feature maps at multiple resolutions;

[0073] Merging each first feature map and each second feature map according to the resolution to obtain a plurality of merged feature maps;

[0074] The texture contrast scores at various resolutions are obtained based on each merged feature map.

[0075] In a second aspect, an embodiment of the present application provides a concrete test block identification device, comprising:

[0076] An acquisition module, used for acquiring a first image and a second image of a concrete test block at different process nodes;

[0077] An extraction module, used to extract the quadrilateral outline and the logo outline of the first image and the second image respectively;

[0078] A first correction and demoulding module is used to correct and demould the first image based on the quadrilateral outline and the logo outline of the first image to obtain a first square image;

[0079] A second correction and demoulding module is used to correct and demould the second image based on the quadrilateral outline and the logo outline to obtain a second square image;

[0080] A texture alignment module, used for aligning the first square image and the second square image to obtain a first texture image and a second texture image;

[0081] A comparison module, used for obtaining a texture comparison value according to the first texture image and the second texture image;

[0082] The judgment module is used to judge whether the texture contrast value is less than a target threshold; wherein the target threshold is obtained according to a preset precision rate and a preset recall rate; if so, the first image and the second image correspond to the same concrete test block.

[0083] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the concrete test block identification method of any of the above embodiments are performed.

[0084] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the concrete test block identification method as described in any of the above embodiments are implemented.

[0085] In summary, compared with the prior art, the technical solution provided in the embodiment of the present application has at least the following beneficial effects:

[0086] The present application provides a method for identifying a concrete test block, which extracts, corrects, demoulds and aligns the first image and the second image of the concrete test block at different process nodes one by one, obtains the first texture image and the second texture image corresponding to the first image and the second image respectively; and then judges whether the first image and the second image are the same concrete test block by comparing the texture values ​​of the first texture image and the second texture image. The above method combines the uniqueness of the surface texture of the concrete test block, the approximate invariance of the surface texture during the entire life cycle of sampling, curing, inspection and testing on site, and the verification of the identity of the concrete test block, and uses image recognition technology to conveniently and quickly extract entities in the images of concrete test blocks at different periods and identify, correct and align their surface textures, analyze the correlation between the surface textures of the two concrete test blocks, effectively improve the accuracy of verifying the identity of the concrete test blocks, and play a good role in ensuring the effectiveness and authenticity of the quality inspection of construction projects. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] Figure 1 A flowchart of a concrete test block identification method provided as an exemplary embodiment of the present application.

[0088] Figure 2 A flowchart of a concrete test block identification method is provided as yet another exemplary embodiment of the present application.

[0089] Figure 3 A flowchart of a quadrilateral outline extraction step is provided for an exemplary embodiment of the present application.

[0090] Figure 4 A structural diagram of a contour extraction module provided for an exemplary embodiment of the present application.

[0091] Figure 5 A flow chart of the correction and demolding steps provided for an exemplary embodiment of the present application.

[0092] Figure 6 A structural diagram of a correction alignment module provided for an exemplary embodiment of the present application.

[0093] Figure 7 A flowchart of the alignment steps provided for an exemplary embodiment of the present application.

[0094] Figure 8 A schematic diagram of constructing a fourth positioning point provided for an exemplary embodiment of the present application.

[0095] Fig. 9 A structural diagram of a texture comparison model provided for an exemplary embodiment of the present application.

[0096] Fig.10 A structural diagram of a feature extraction module provided for an exemplary embodiment of the present application.

[0097] Fig.11 A structural diagram of an attention fusion module provided for an exemplary embodiment of the present application.

[0098] Fig.12 A structural diagram of the HeadBlock convolution module in the output head network provided for an exemplary embodiment of the present application.

[0099] Fig.13 A structural diagram of a concrete test block identification device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0100] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0101] Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of this application.

[0102] See also Figure 1 , the embodiment of the present application provides a concrete test block identification method, which may specifically include:

[0103] Step S1, obtaining a first image and a second image of a concrete test block at different process nodes.

[0104] Specifically, it takes a long time for the concrete test block to be manufactured, maintained and sent for testing. During the entire life cycle of the concrete test block, images of the concrete test block at any two periods are obtained as required as the first image and the second image.

[0105] Step S2, extracting the quadrilateral outline and the logo outline of the first image and the second image respectively.

[0106] Among them, the identification outline is the outline uniquely represented on the first image or the second image; in specific implementation, if the construction unit entrusts the inspection agency to carry out the construction project quality inspection activities, the construction unit or the supervision unit shall witness the construction project quality inspection activities; the witnessing personnel shall make a witness record, record the sampling, sample preparation, identification, sealing, inspection and on-site inspection, and sign for confirmation; the concrete test block shall have a clear, non-detachable unique identification and seal. Therefore, the unique identification of this application can be considered as a plastic card on the concrete test block.

[0107] Step S3, based on the quadrilateral outline and the logo outline of the first image, correct and demould it to obtain a first square image. Correcting the first image means transforming it into a standard square image; demoulding means removing the mold that may exist in the first square image.

[0108] Step S4, based on the quadrilateral outline and the logo outline of the second image, correct and demould it to obtain a second square image. Correcting the second image means transforming it into a standard square image; demoulding means removing the mold that may exist in the second square image.

[0109] Step S5, aligning the first square image and the second square image to obtain a first texture image and a second texture image. Specifically, the alignment process may also involve rotating the two square images.

[0110] Step S6, obtaining a texture contrast value according to the first texture image and the second texture image.

[0111] Step S7, determining whether the texture contrast value is less than a target threshold.

[0112] The target threshold is obtained according to the preset precision and the preset recall.

[0113] Step S8: If yes, the first image and the second image correspond to the same concrete test block.

[0114] The above embodiment provides a concrete test block identification method, which extracts, corrects, demoulds and aligns the first image and the second image of the concrete test block at different process nodes one by one, obtains the first texture image and the second texture image corresponding to the first image and the second image respectively; and then judges whether the first image and the second image are the same concrete test block by comparing the texture values ​​of the first texture image and the second texture image. The above method combines the uniqueness of the surface texture of the concrete test block, the approximate invariance of the surface texture during the entire life cycle of sampling, curing, inspection and testing on site, and the verification of the identity of the concrete test block, and uses image recognition technology to conveniently and quickly extract entities in the images of concrete test blocks at different periods and identify, correct and align their surface textures, analyze the correlation between the surface textures of the two concrete test blocks, effectively improve the accuracy of verifying the identity of the concrete test blocks, and play a good role in ensuring the effectiveness and authenticity of the quality inspection of construction projects.

[0115] In some embodiments, respectively extracting the quadrilateral outline and the logo outline of the first image and the second image includes:

[0116] Step S21: input the first image into the trained segmentation model to obtain a first surface mask image and a first identification mask image.

[0117] Step S22, extracting the contour edge lines of the first surface mask image and performing regression calculation to obtain the quadrilateral contour of the first image.

[0118] Step S23: extract the contour edge of the first marker mask image and perform regression calculation to obtain the marker contour of the first image.

[0119] Step S24: input the second image into the trained segmentation model to obtain a second surface mask image and a second identification mask image.

[0120] Step S25, extracting the contour edge lines of the second surface mask image and performing regression calculation to obtain the quadrilateral contour of the second image.

[0121] Step S26, extracting the contour edge of the second marker mask image and performing regression calculation to obtain the marker contour of the second image.

[0122] Among them, the segmentation model can use the ConvNext-SOLOV2 instance segmentation model. This model uses the SOLOV2 model as the basic framework. Based on the special circumstances that the size ratio of concrete test blocks in the image is basically consistent, the logos are mainly concentrated in the concrete test blocks, and the overlap ratio between the logo center and the test block center is high, ConvNext is used as the backbone network of the model, and the output head of the model is adjusted to effectively improve the segmentation accuracy in segmenting concrete test blocks and logos.

[0123] In the specific implementation process, steps S21-S23 and steps S24-S26 can be executed simultaneously. The step numbers here are only for distinguishing the various steps in this embodiment and are not intended to limit the order in which the steps are implemented.

[0124] The above embodiment uses a trained segmentation model to implement the segmentation of the surface mask image and the identification mask image, so that the segmented image has higher accuracy, which is helpful for the subsequent accurate extraction of contours and textures.

[0125] See also Figure 2 In some embodiments, the method further includes: after acquiring the first image and the second image, preprocessing the first image and the second image so that the sizes of the first image and the second image are both specified sizes of the trained segmentation model.

[0126] Specifically, first, the first image and the second image are scaled to the specified size of the segmentation model according to the long side, and the short side is scaled proportionally; then, the left and right or upper and lower areas of the first image and the second image are filled with 0, so that the image width and height are the specified size of the segmentation model; finally, the first image and the second image are converted into RGB format and standardized, and then converted into tensor format.

[0127] See also Figure 3 In some embodiments, the extraction of the contour edge lines of the first surface mask image and the regression calculation to obtain the quadrilateral contour of the first image includes:

[0128] Step S221: using a line detection algorithm to identify the edges of the first surface mask image and forming an edge set.

[0129] Step S222, angle calculation step: obtain the target sideline in the sideline set, and calculate the angle between the target sideline and each sideline, and obtain a plurality of parallel sidelines of the target sideline according to the angles with each sideline.

[0130] Step S223, distance calculation step: calculate the distance between each parallel sideline and the target sideline, and divide each parallel sideline into a parallel side subset of the target sideline according to the distance.

[0131] Step S224, taking each edge line in the edge line set as a target edge line in turn and executing the angle calculation step and the distance calculation step to obtain a parallel edge subset of each edge line.

[0132] Step S225: Merge each parallel edge subset using a linear fitting method to obtain a new edge set.

[0133] Step S226, determining whether each parallel edge subset meets a preset requirement.

[0134] Step S227, if satisfied, take the 4 longest side lines in the new side line set as the quadrilateral outline of the first image; if not satisfied, take the 8 longest side lines in the new side line set as the side line set, and return to the angle calculation step.

[0135] In some embodiments, the method further comprises:

[0136] After performing closing and opening operations on the first surface mask image, its circumscribed rectangle is obtained.

[0137] The straight line detection threshold is determined according to the long side or the wide side of the circumscribed rectangle; after the straight line detection algorithm is used to identify the edges of the first surface mask image, the edges smaller than the straight line detection threshold are eliminated, and the remaining edges are formed into an edge set.

[0138] Specifically, the first surface mask image is closed and opened to remove noise and smooth the edge of the mask image. The bounding rectangle of the first surface mask image is obtained based on the first surface mask image, and 0.1 times the length of the bounding rectangle is used as the threshold l for line detection. min .

[0139] The 0.1 times length of the circumscribed rectangle may be the minimum value between 0.1 times the length and 0.1 times the width.

[0140] Specifically, the edges of the first surface mask image are identified by the FSD (Fast Line Detectors) and LSD (Line Segment Detector) line detection algorithms respectively, and the edges with a length less than l min are removed to reduce the influence of recognition errors. All the identified edges are combined into a set; the target edge selected for the first time can be the longest edge in the edge set.

[0141] In the specific implementation process, first, based on the edge with the maximum length, calculate the angles between other edges in the set and the longest edge, obtain the parallel edges, then calculate the distances between the parallel edges and it, and divide the parallel edges into two subsets.

[0142] For example, the edge set L = {l 1 , l 2 , l 3 , l 4 ...}, the minimum edge angle is a hyperparameter set according to the actual situation, which can be set to min_angle = 15; the minimum edge distance is obtained from 0.1 times the length of the above-mentioned circumscribed rectangle: dis_min = 2l min ; take out the longest edge l 1 , calculate the angles angle between all edges in the set L = {l 2 , l 3 , l 4 ...} and l 1 . If angle < min_angle or |angle - 180| < min_angle, it means that the edge is parallel to l 1 . Then calculate the distance distance between this edge and l 1 . When the distance distance is less than dis_min, it means that this edge and l 1 are approximately the same contour edge of the concrete test block, otherwise it is the opposite side. In this way, a parallel edge subset L1 = [{l 1 , l 5 ,..}, {l 2 , l 7 ,...}] is divided.

[0143] Loop the above operations on the remaining edges until all the edges in the set are divided into parallel edge subsets, and then linearly fit and merge the edges of each parallel edge subset respectively to finally obtain a new edge set.

[0144] Among them, the preset requirement is that all straight lines in the parallel edge subset represent a contour edge, and there is no approximate edge line; the preset requirement is that all straight lines in the parallel edge subset represent a contour edge, because the FSD and LSD straight line recognition methods will repeatedly recognize the edges of the concrete specimens, and there are many overlapping edge lines and they are generally shorter. The linear fitting in the above steps is to merge the overlapping edge lines to make the edge lines longer and more fitting to the actual edges of the concrete specimens.

[0145] The main purpose of steps S222-S224 is to select all parallel edge lines in the edge set, such as the parallel edge subset L1 = [{l 1 ,l 5 ,..},{l 2 ,l 7 ,...}], there are {l 1 ,l 5 ,..} and {l 2 ,l 7 ,...}, it can be considered that the edges in {l1,l5,..} are approximately overlapped, and then the linear fitting in step S225 is used to merge the nearly overlapping edges to obtain a new edge. 2 ,l 7 ,...} Perform the same operation to get a new edge and add it to the new edge set. Perform the same operation on all subsets to get a new edge set. At this time, there are two types of edges in the new edge set:

[0146] 1) The merged edge is obtained by merging multiple overlapping edges, and in most cases it will be much longer than a single edge.

[0147] 2) A single sideline is generally shorter.

[0148] When the parallel edge subset does not meet the preset requirements, steps S222-S224 are repeated to further select parallel edges and remove randomly identified edges until all parallel edge subsets have exactly one set of parallel edges.

[0149] Furthermore, the first identification mask image is processed in the same manner as the quadrilateral contour, and the identification contour of the unique identification can be obtained. The contour extraction of the second image is consistent with the steps of the first image, and finally the quadrilateral contour of the concrete block surface, the unique identification contour and the mask image of the unique identification of the two images are output.

[0150] The above embodiment realizes accurate extraction of the quadrilateral contour and the marking contour of the concrete test block based on the straight line detection method.

[0151] In some embodiments, the method further comprises:

[0152] Before the first image is input into the trained segmentation model, the image area of ​​the first image and the identification area of ​​the first identification image in the first image are calculated, and the area ratio is obtained according to the image area and the identification area.

[0153] Modify the target object area in the output head of the segmentation model to area ratio.

[0154] Modify the step size and grid in the output header of the segmentation model to the target values.

[0155] Specifically, the segmentation model takes the SOLOV2 model as the basic framework. Based on the special case of concrete test block data, ConvNext is used as the backbone network of the model, and the output head of the model is adjusted to improve the segmentation accuracy.

[0156] The ConvNext model is based on resnet50 and improved according to the swim-transformer architecture. Its performance is significantly improved compared to resnet50 and swim-transformer. ConvNext includes the following details:

[0157] 1. It has 4 stages like resnet50, but the ratio of blocks is 1:1:3:1. The downsampling method of the feature map uses a convolution kernel with a step size of 4 and a size of 4*4.

[0158] 2. Use the reverse bottleneck layer, that is, a three-layer network structure with a large middle layer and small ends.

[0159] 3. Use a large 7*7 convolution kernel.

[0160] 4. Use GELU activation function to replace ReLU activation function, use fewer activation functions, use fewer regularization layers, replace batch normalization (BN) with layer normalization (LN), etc.

[0161] There are certain requirements for capturing concrete test block images, so that the size of the concrete test block in the image is always fixed within a certain range. At the same time, the test block specifications and identification specifications are relatively fixed. Therefore, compared with other segmentation data sets, concrete test block data has certain particularities. The output head of the segmentation model can be adjusted to improve the segmentation accuracy. Specifically:

[0162] 1. The target object scale range in the segmentation model output header is changed from the target object area to the area ratio of the target object to the image. The area ratio range is calculated by the ratio of the concrete test block area, the unique identification area and the image size through the clustering algorithm, which is ((0,0.28), (0.21, 0.34), (0.34, 0.70), (0.65, 0.81), (0.70, 1.0)). At the same time, the comparison between the area and scale range of the target object in the segmentation model is changed to the comparison of the area ratio scale range. This change is more in line with the target object size characteristics of the data set and effectively distinguishes the two instances of the concrete test block and the identification.

[0163] 2. Modify the step size in the segmentation model output head to the target values ​​of 8, 16, and 32, limit the mask area of ​​the target object, and remove the segmentation instances that are too small; modify the grid of the segmentation model output head to the target value [80, 60, 36, 20, 12], increase the output grid size, and make it easier to detect smaller targets, thereby improving the model’s segmentation effect on the logo.

[0164] The segmentation model uses a variety of data enhancement methods and training techniques during training, mainly including: 1. Rotate the center of the image, automatically expand the image size and fill, without losing image data, it can fit concrete test blocks of various angles and improve segmentation accuracy. 2. Add Gaussian noise, use random color transformation, random flipping, random cropping and other enhancements on the image, randomly adjust the image brightness and contrast, etc., to enhance the robustness of the segmentation model. 3. In terms of input image size, use multi-scale training techniques, that is, pre-set the width and height of the pixel size to (768,704), (768,640), (768,576), (768,512), (768,480), (768,448) six image sizes, and randomly select the size of the input image in each epoch. Such multi-scale training can significantly improve the model's robustness to the size of the target object to a certain extent, thereby improving the recognition accuracy.

[0165] The setting of the segmentation model in the above embodiment can further improve the segmentation and extraction of the surface mask image and the identification mask image by the segmentation model, thereby indirectly improving the extraction accuracy and comparison accuracy of the image texture.

[0166] See also Figure 4 and Figure 5 In some embodiments, the above-mentioned correction and demoulding of the quadrilateral outline and the logo outline based on the first image to obtain the first square image includes:

[0167] Step S31, arranging the vertices in the quadrilateral outline of the first image in a clockwise direction.

[0168] Step S32, using an image perspective transformation method to obtain a first perspective matrix that transforms each clockwise-arranged vertex into a square.

[0169] Step S33: transform and correct the first image and the logo outline of the first image according to the first perspective matrix to obtain a first square image and the logo outline of the first square image.

[0170] Specifically, four vertices are obtained according to the quadrilateral outline and arranged clockwise, and then the target target = [[0,0], [size,0], [size,size], [0,size]] is set according to the image size size required by the module. The image perspective transformation method in the opencv library is used to obtain the first perspective matrix M1 of the target from which the four vertices are transformed. The first image can be transformed into a standard square image through M1. At the same time, M1 is also used to perform the same transformations on the unique identifier, concrete block mask and contour points, unique identifier mask and contour points, etc. At this time, the mask images of the concrete block and the unique identifier have been corrected.

[0171] The correction and demoulding of the second image are consistent with the above-mentioned steps for the first image, and will not be repeated here.

[0172] Step S34, obtaining a first standard ratio according to the side length of the standard mark and the side length of the standard test block.

[0173] Step S35, calculating the ratio of the logo outline of the first square image and the side length of the first square image.

[0174] Step S36, judging whether there is a mold according to the side length ratio and the first standard ratio.

[0175] Step S37: If yes, calculate the second standard ratio of the standard mold wall thickness to the standard test block side length.

[0176] Step S38, cutting the first square image according to a second standard ratio.

[0177] Step S39, scaling the side length of the first square image to the side length of the standard test block.

[0178] Specifically, it is assumed that the side length of the standard test block, the side length of the standard identification, and the wall thickness of the standard mold are bl, cl, and ml respectively, and there is a fixed size ratio relationship between the three. After obtaining the identification contour of the unique identification, the ratio of the side length of the identification contour of the first square image to the side length of the first square image can be calculated and compared with the first standard ratio cl / bl to determine whether the concrete test block has a mold. If a mold exists, it is necessary to cut the edge of the first square image containing the mold according to the second standard ratio ml / bl, and then scale the first square image to the same size to achieve adaptive demoulding of the concrete test block.

[0179] The demoulding steps for the second square image are the same as those for the first square image, and will not be described in detail here.

[0180] The above embodiment realizes adaptive demoulding of the corrected concrete test block image, avoids the influence of the mold in the image on the accuracy of subsequent image alignment and texture extraction, and indirectly improves the accuracy of texture comparison values.

[0181] See also Figure 7 In some embodiments, the above-mentioned aligning the first square image and the second square image to obtain the first texture image and the second texture image includes:

[0182] Step S51 : clipping the first square image according to the first identification mask image to obtain a first identification image.

[0183] Step S52: cropping the second square image according to the second identification mask image to obtain a second identification image.

[0184] The first identification image and the second identification image are unique identifications in the first image and the second image.

[0185] Step S53: input the first identification image into the trained positioning model to obtain the first positioning coordinates of the first identification image.

[0186] Step S54: input the second identification image into the trained positioning model to obtain the second positioning coordinates of the second identification image.

[0187] The positioning model may be a trained QR code positioning model. If the QR code does not exist in the first identification image or the QR code positioning model cannot detect the QR code, the coordinates of the center point of the graphic of the fitting identification outline in the first square image are calculated, and according to the coordinates of the center point, the first square image and the unique identification thereon are rotated 90 degrees each time to ensure that the unique identification is rotated to the upper left corner of the concrete test block image to achieve an alignment effect.

[0188] The alignment is also performed for the second square image without a QR code or without a detected QR code.

[0189] Step S55, aligning the first square image and the second square image based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image.

[0190] In some embodiments, the above-mentioned step of clipping the first square image according to the first identification mask image to obtain the first identification image may specifically include the following steps:

[0191] Step S511, transforming the first identification mask image according to the first perspective matrix to obtain a square identification mask image of the first square image, and determining the identification position of the unique identification in the first square image according to the square identification mask image.

[0192] Step S512, calculating the coordinates of the circumscribed rectangle of the unique identifier.

[0193] Step S513 , clipping the first square image according to the circumscribed rectangle coordinates and the marker position to obtain a first marker image.

[0194] Specifically, the position of the unique identifier in the square image of the concrete test block is obtained, and the coordinates of the circumscribed rectangle of the identifier are calculated, so as to crop the image of the unique identifier in the square image of the concrete test block and input it into the QR code positioning model.

[0195] The extraction of the second identification image in the second square image is also achieved by adopting the above steps.

[0196] In some embodiments, the step of inputting the first identification image into a trained positioning model to obtain the first positioning coordinates of the first identification image may further include the following steps:

[0197] Step S531, input the pre-processed first identification image into the trained positioning model to obtain the contour coordinates of three positioning points. The pre-processing operation of the first identification image mainly includes:

[0198] a. Image scaling: scale the first logo image to the specified size of 224 along the long side, and scale the short side in the same proportion, and then fill the left and right or top and bottom areas of the image with 0. At this time, the image width and height are the specified size of 224*224 of the QR code positioning model.

[0199] b. Adaptively adjust image brightness.

[0200] c. Convert to RGB format. Convert the resized image to RGB format.

[0201] d. Convert to tensor format and standardize.

[0202] Specifically, the preprocessed first identification image is input into the trained UNET segmentation model for precise positioning, and the contour coordinates of the three positioning points in the image are obtained.

[0203] Step S532, using Green's formula to calculate each contour coordinate to obtain the contour area and contour radius of the three positioning points. Specifically, using Green's formula to calculate the contour area is to solve the surface integral.

[0204] Green's formula is a mathematical formula that describes the close relationship between the curve integral of the coordinates along the closed curve L on the plane and the double integral on the closed area D enclosed by the curve L. Let D be a plane area. If the partial area enclosed by any closed curve in D belongs to D, then D is called a plane simply connected area. Intuitively speaking, a simply connected area is an area without space, otherwise it is called a complex connected area. When the starting point and the end point of the curve on the xOy plane coincide, the curve is called a closed curve. Let the closed curve L of the plane enclose the plane area D, and stipulate that when a person walks along the closed curve L, the area D is always on the left side of the person. The walking direction of the person is called the positive direction of the curve L with respect to the area D, and vice versa. Since the Green's formula calculates the area of ​​the simply connected domain with the counterclockwise direction as the positive direction, the input edge array is input counterclockwise as needed. If it is input clockwise, the calculated area will be negative. Secondly, all the signed distances from the point to the nearest contour edge are estimated to calculate the inscribed circle of the contour, so as to obtain the contour radius closest to the truth.

[0205] Step S533, judging whether there is a mis-segmented area according to the contour coordinates, contour area and contour radius of the three positioning points.

[0206] Step S534: if it exists, remove the mis-segmented area to obtain the positioning area of ​​the three positioning points.

[0207] Specifically, the initial positioning area can be determined according to the contour coordinates of the three positioning points obtained in step S531, and after the mis-segmented area is removed from the initial positioning area, the positioning area of ​​the three positioning points is obtained.

[0208] Step S535, obtaining the position coordinates of three positioning points according to the positioning area.

[0209] Step S536: Generate a fourth positioning point according to the position coordinates of the three positioning points and the rectangular structure.

[0210] Step S537, arranging the positioning points based on the position coordinates of the positioning points to obtain the position coordinates of the positioning points in the forward direction; and using the position coordinates of the positioning points in the forward direction as the first positioning coordinates.

[0211] Specifically, the positioning model will segment the area of ​​the three positioning points in the QR code logo, and obtain the center position coordinates of the positioning points through comprehensive calculation. The positional relationship of the three positioning points can be obviously known. The fourth positioning point is constructed according to the rectangular structure based on the positional relationship of the three positioning points of the QR code, and then the four points are arranged in order according to the positional relationship. The arrangement order represents the positive direction of the QR code. The positions of the three positioning points and the constructed fourth positioning point are returned to the image transformation stage of the concrete specimen as the first positioning coordinates.

[0212] Specifically, after obtaining the contour coordinates, contour area and radius of the positioning point, detect whether there is a mis-segmented area and calculate the lower right corner point, that is, the position of the fourth positioning point. The specific process is as follows:

[0213] a. First, we need to find a right angle to determine the order of the three positioning points. If two vectors are known to be perpendicular, we can use the perpendicularity theorem: Assume that vector a = (x1, y1) and b = (x2, y2). The necessary and sufficient condition for a⊥b is a·b = 0, that is, (x1x2+y1y2) = 0. Then, we can find two perpendicular vectors by pairing the three positioning points into a vector, thereby eliminating most of the mis-segmented areas. Then, based on the conditions that the lengths of the two vectors are equal and the ratio of the length of the vector to the length of the marker contour is within a certain range, we can eliminate the mis-segmented areas that are too small or too large, thereby determining the accurate positioning area of ​​the three positioning points.

[0214] b. After locating the position information of the three positioning points, the position information of the lower right corner can be determined through mapping to correct the QR code deformity caused by shooting and avoid the impact of downstream recognition. At the same time, the area, radius and ratio of the distance between the three positioning points can be calculated to determine whether there are mis-segmented points.

[0215] like Figure 8 As shown, the calculation formula for the position information of the fourth positioning point in the lower right corner is: point_rd = (point_rt_x, point_ld_y), which is obtained by the position coordinates of the lower left corner positioning point and the upper right corner positioning point.

[0216] The calculation steps for the second positioning coordinates are the same as those for the first positioning coordinates, and will not be repeated here.

[0217] The above embodiment adds the judgment and elimination of mis-segmented areas when determining the positioning areas of the three positioning points, so that the positioning areas of the three positioning points are determined more accurately, and indirectly improves the effect of image alignment.

[0218] In some embodiments, the above-mentioned aligning the first square image and the second square image based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image includes:

[0219] Step S551, using the image perspective transformation method, obtains the identification perspective matrix that transforms the second positioning coordinates into the first positioning coordinates. Specifically, using the two-dimensional code of the first square image, that is, the first positioning coordinates of the first identification image as a reference, the image perspective transformation method in the opencv library is used to transform the second positioning coordinates of the second square image to the direction of the first concrete test block two-dimensional code, thereby obtaining the identification perspective matrix M2.

[0220] Step S552, transforming the second square image using the identification perspective matrix;

[0221] Step S553, after aligning the second square image in a preset order, the first square image is used as the first texture image, and the second square image is used as the second texture image.

[0222] Specifically, the square image of the second concrete test block is transformed using the identification perspective matrix M2, and then the direction of the second concrete test block is corrected in the preset order of upper left, upper right, lower right, and lower left, so as to achieve the alignment of the directions of the two concrete test blocks.

[0223] Finally, the two aligned square images are used as corresponding texture images and input into the texture comparison model.

[0224] The above embodiment realizes the alignment of two concrete test block images, thereby obtaining a high-quality concrete texture image.

[0225] In some embodiments, obtaining the texture contrast value according to the first texture image and the second texture image includes:

[0226] Step S61, inputting the first texture image and the second texture image into a trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions.

[0227] See also Fig. 9 ,The texture comparison model includes a convolution module, multiple BasicBlock feature extraction modules, an ,attention fusion module, a HeadBlock output head module, etc.

[0228] Step S62, obtaining a texture contrast value of the concrete test block according to the texture contrast scores at multiple resolutions.

[0229] After studying a variety of excellent domestic and foreign deep learning algorithm ideas, the accuracy and recognition effect obtained by applying various existing deep learning algorithms cannot achieve the expected results. The main manifestations are that it is impossible to take into account the recognition and comparison of fine and obvious textures, the recognition effect of dry and wet concrete test blocks is poor, the impact of changes in some texture features on the recognition accuracy fluctuates greatly, the recognition focus is placed on the unique identifier, and the edge of the concrete test block has a greater impact on the recognition effect. Therefore, according to the uniqueness of the texture features on the surface of concrete test blocks, the deep learning technology in machine vision is used, and the hrnet model framework is referred to. A deep learning model for the recognition and comparison of concrete test block texture features is independently designed. It can remove the influence of impurity information on the surface of concrete test blocks, and can effectively extract its randomly distributed fine lines, tiny protrusions, irregular holes and other feature information. Among them, multi-resolution recognition enables the model to obtain more texture information about concrete test blocks.

[0230] Specifically, the first texture image and the second texture image are input into the trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions, including:

[0231] Step S611, downsampling the first texture image multiple times to obtain first sampling feature maps with multiple resolutions.

[0232] Step S612, downsampling the second texture image multiple times to obtain second sampling feature maps with multiple resolutions.

[0233] Step S613, repeatedly performing feature extraction, cross fusion and attention fusion on each first sampling feature map according to a preset number of cycles to obtain first feature maps at multiple resolutions.

[0234] Among them, each first sampling feature map is a 4x down-sampled feature map obtained by performing 2 layers of ordinary convolution on the first texture image, and a 4x down-sampled feature map is extracted by a BasicBlock convolution module and then down-sampled by ordinary convolution to obtain 8x, 16x, and 32x down-sampled feature maps.

[0235] Step S614, repeatedly performing feature extraction, cross fusion and attention fusion on each second sampling feature map according to a preset number of cycles to obtain second feature maps at multiple resolutions.

[0236] Among them, each second adopted feature map is a 4x downsampled feature map obtained by performing 2 layers of ordinary convolution on the second texture image, and a 4x downsampled feature map is extracted by a BasicBlock convolution module and then downsampled by ordinary convolution to obtain 8x, 16x, and 32x downsampled feature maps.

[0237] The preset number of cycles is Fig.10 The number of stages can be 3 in this application.

[0238] Specifically, the BasicBlock convolution modules in the model correspond to the resolutions one by one. The sampled feature maps are input into the corresponding BasicBlock convolution modules according to their resolutions for feature extraction. The extracted results are cross-fused and the cross-fusion results are input into the attention fusion module to obtain the attention weights. Attention calculations are performed on the feature maps of the two concrete blocks respectively.

[0239] In each stage, after passing through the BasicBlock convolution module, each resolution feature map is cross-fused with feature maps of other resolutions by upsampling or downsampling operations. Specifically, the resolution feature maps are directly added, such as cross-fusion with 4x, 8x downsampling feature maps and 32x upsampling feature maps when downsampling by 16x, and cross-fusion with 4x, 8x, and 16x downsampling feature maps when downsampling by 32x; each fusion result is input into the attention fusion module to obtain the attention weight, and is directly multiplied with the cross-fusion result, and then input into the next stage after relu activation.

[0240] Among them, the four levels of cross-fusion results are respectively input into the attention fusion module to obtain four attention weights, and the four levels of cross-fusion results are multiplied by the corresponding attention weights.

[0241] Repeat the above steps of feature extraction, cross fusion and attention fusion, and perform three stages of calculation in total; finally, output four feature maps of the two images downsampled by 4 times, 8 times, 16 times and 32 times.

[0242] Step S615: merge each first feature map and each second feature map according to the resolution to obtain a plurality of merged feature maps.

[0243] Step S616, obtaining texture comparison scores at multiple resolutions according to each merged feature map.

[0244] In the specific implementation process, please refer to Fig.10 The backbone network is mainly composed of a common convolutional structure and multiple feature extraction modules (BasicBlock convolutional modules) and multiple attention fusion modules. Fig.10It can be seen that the backbone network has three stages. After a BasicBlock, each stage uses BasicBlock to extract features, and performs texture feature attention fusion at the output, that is, multiplying with the attention weight. The attention fusion module can increase the weight of the area that needs to be paid attention to in the feature map and reduce the weight of other areas according to the surface texture feature information of the two concrete test blocks. After three stages of feature extraction and attention fusion, the influence of other noises can be effectively and gradually removed, and the texture features that the model pays attention to can be extracted.

[0245] In addition, the backbone network uses 4 times, 8 times, 16 times, and 32 times of downsampling to extract the surface texture feature information of the concrete test block. Based on the input image resolution, after a BasicBlock extracts features, it keeps downsampling by 4 times, and increases downsampling by 8 times, 16 times, and 32 times. Then, the three stages are cross-fused to retain the feature information. At this time, the backbone network finally outputs a total of four concrete test block texture feature maps with different resolutions. The high resolution can retain the detailed texture features of the concrete test block surface to a large extent, such as small holes and tiny protrusions; while the low resolution can extract the larger texture features of the concrete test block surface, such as slightly larger holes, conspicuous logos, written text, obvious potholes and protrusions, etc. At the same time, it can filter out most of the impurity information to avoid misjudgment, so that the texture features of each level of the concrete test block surface can be extracted at the maximum level.

[0246] The output head network designs a HeadBlock convolution module for the four feature maps output by the backbone network. The four levels of feature maps of the two test blocks are input into the HeadBlock module respectively, and the feature maps of the same level of the two concrete test block images are merged in pairs, that is, they are merged by channel and then pass through ordinary convolution, and then pass through the SPPF structure and DFC attention mechanism in sequence. Finally, the four levels of texture contrast scores of the concrete test block are obtained through the fully connected layer in the HeadBlock module, and then the four levels of texture contrast scores are comprehensively calculated to obtain the final texture contrast value.

[0247] The BasicBlock convolution module in the above backbone network adopts the CSP local dense connection structure as a whole, and the basic convolution network uses the Ghost phantom convolution structure, which can not only efficiently extract feature maps, but also balance calculations and enhance gradient paths. Its specific functions include: 1. The CSP local dense connection structure increases the gradient path through the block merging strategy, effectively balances calculations, and reduces memory traffic, while the local transition layer can maximize the difference in gradient combinations, which can reuse features and prevent excessive repeated gradient information by truncating the gradient flow; 2. The Ghost phantom convolution structure divides the original convolution layer into two parts, first using half of the convolution kernel to generate the original feature map, and then using a cheap transformation operation (depth-separable convolution) to efficiently produce the other half of the phantom feature map.

[0248] See also Fig.11 The attention fusion module in the backbone network mainly assigns different weights to the surface texture of the samples according to the texture feature information of the two concrete test blocks, and the multi-layer attention fusion can select more appropriate and accurate surface texture features of the concrete test blocks for comparison. The main operations are:

[0249] a. The cross-fusion results of the input are merged by channel to obtain the merged result M12, the size of M12 is 2C*H*W, and the average pooling operation is performed on M12 along the width and height dimensions. Then the average pooling results are transformed and merged to obtain a feature vector of 2C*(H+W)*1. After 1*1 ordinary convolution to compress the channel dimension and activate, a feature vector of C / r*(H+W)*1 is obtained, which is then split into two parts, C / r*H*1 and C / r*W*1. The transformed dimension is then expanded and information is extracted through 1*1 convolution. The output result is activated by sigmoid and then dot-multiplied with the feature map M12 to obtain the weighted merged feature map WM12.

[0250] b. After the weighted merged feature map WM12 undergoes ordinary convolution and depthwise separable convolution operations, it is activated using the sigmoid activation function to obtain an attention weight of size C*H*W, which is used to give different weights to the texture features of the concrete specimens and screen more appropriate and accurate texture areas.

[0251] See also Fig.12 The HeadBlock convolution module of the output head network mainly combines the SPPF structure and the DFC attention mechanism on the basis of the ordinary convolution structure, which can not only extract various important features well, but also filter out impurity features and enhance the connection between various important features. The specific operations are as follows:

[0252] a. The SPPF structure first performs a normal convolution, then uses three 5x5 maximum pooling structures in series and always keeps the size of the feature map unchanged, then merges the normal convolution output and the three pooling structure outputs into one feature map, and finally obtains the output of the SPPF structure through a normal convolution.

[0253] b. The DFC attention mechanism first downsamples the feature map by half by average pooling, then performs depthwise separable convolutions of size 1×7 and 7×1 (vertical and horizontal long-distance attention) in sequence, and finally performs Sigmoid and linear interpolation upsampling to obtain the spatial attention weights of each channel, which can enhance the attention of the channels of the feature map as well as the attention of a certain range of space; the DFC attention mechanism adopts global maximum pooling to concentrate the information of each channel on one point, and then performs linear calculation on the vector to finally obtain the texture comparison scores of the surface textures of the two concrete test blocks.

[0254] In the training process of the concrete block texture recognition and comparison model, a two-stage training method is adopted to train the feature extraction and attention fusion modules in two stages respectively, and a deep supervision method is used to improve the model training efficiency:

[0255] a. In the first stage, the texture recognition and comparison model does not use the attention fusion function. In each stage, the global maximum pooling and fully connected layers are added to predict the texture comparison results, calculate the loss, and update the parameters. The deep supervision method is used to make the model converge faster and learn more surface texture information. The concrete test block data set is sent to the model to learn and extract features. When the loss drops to a stable level or the prediction accuracy of the test set reaches the specified threshold, it means that the model has reached the local optimal solution and the second stage of training begins.

[0256] b. In the second stage, the parameters of the ordinary convolution and BasicBlock in the model backbone network are frozen, and the attention fusion module is added to the model backbone to help the model better focus on the surface texture area of ​​the comparison, while still retaining the global maximum pooling and fully connected layers used in each stage of deep supervision training. At this time, the model training will update the parameters of the attention fusion module and the HeadBlock convolution module, and the deep supervision pooling and fully connected layers will be removed in the inference stage.

[0257] Texture comparison model training uses a variety of data enhancement methods and model training techniques to enhance the robustness of the model, mainly including:

[0258] a. Fill the logo area to reduce the impact of the logo on the comparison of surface texture information.

[0259] b. Randomly rotate one of the texture images slightly to simulate the recognition error of the concrete specimen.

[0260] c. Enhancement methods such as Gaussian noise, salt and pepper noise, color change, random brightness and contrast, random flipping, and random cropping.

[0261] d. Negative samples are randomly replaced with black, white or irrelevant background images.

[0262] e. Adaptive label smoothing.

[0263] f. The texture image is divided into n*m blocks, enhanced and spliced ​​to replace the original image, simulating different environments for shooting concrete test blocks.

[0264] g. The positive sample rotates one of the texture images by n*90 degrees (n∈[1,2,3]) and changes it to a negative sample.

[0265] Finally, when the texture comparison model outputs the texture comparison value, the result is plotted on the original image and returned and displayed together.

[0266] See also Fig.13 Another embodiment of the present application provides a concrete test block identification device, comprising:

[0267] The acquisition module 101 is used to acquire a first image and a second image of the concrete test block at different process nodes.

[0268] The extraction module 102 is used to extract the quadrilateral outline and the logo outline of the first image and the second image respectively.

[0269] The first correction and demoulding module 103 is used to correct and demould the first image based on the quadrilateral outline and the logo outline to obtain a first square image.

[0270] The second correction and demoulding module 104 is used to correct and demould the second image based on the quadrilateral outline and the logo outline to obtain a second square image.

[0271] The texture alignment module 105 is used to align the first square image and the second square image to obtain a first texture image and a second texture image.

[0272] The comparison module 106 is used to obtain a texture comparison value according to the first texture image and the second texture image.

[0273] The judgment module 107 is used to judge whether the texture contrast value is less than a target threshold; wherein the target threshold is obtained according to a preset precision rate and a preset recall rate; if so, the first image and the second image correspond to the same concrete test block.

[0274] The specific limitations of a concrete test block identification device provided in this embodiment can be found in the above embodiment of a concrete test block identification method, which will not be repeated here. Each module in the above concrete test block identification device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0275] The embodiment of the present application provides a computer device, which may include a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer 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 network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the processor executes the steps of a concrete test block identification method as in any of the above embodiments.

[0276] The working process, working details and technical effects of the computer device provided in this embodiment can be found in the above embodiment of a concrete test block identification method, which will not be described in detail here.

[0277] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for identifying a concrete test block as in any of the above embodiments are implemented. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive and / or a memory stick, etc. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The working process, working details and technical effects of the computer-readable storage medium provided in this embodiment can be found in the above embodiment of a method for identifying a concrete test block, and will not be repeated here.

[0278] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0279] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. The above-mentioned embodiments only express several implementation methods of the present application, and their descriptions are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present application, several deformations and improvements can be made, which all belong to the protection scope of the present application. Therefore, the protection scope of the patent of this application shall be based on the attached claims.

Claims

1. A method for identifying a concrete test block, characterized in that: include: Acquire a first image and a second image of the concrete test block at different process nodes; extracting the quadrilateral outline and the logo outline of the first image and the second image respectively; Correcting and demoulding the first image based on the quadrilateral outline and the logo outline to obtain a first square image; Specifically, the vertices in the quadrilateral outline of the first image are arranged clockwise; an image perspective transformation method is used to obtain a first perspective matrix that transforms the clockwise-arranged vertices into a square; Transform and correct the first image and the logo outline of the first image according to the first perspective matrix to obtain the first square image and the logo outline of the first square image; Obtaining a first standard ratio according to the side length of the standard mark and the side length of the standard test block; calculating the ratio of the mark outline of the first square image and the side length of the first square image; judging whether a mold exists according to the side length ratio and the first standard ratio; if so, calculating a second standard ratio of the wall thickness of the standard mold and the side length of the standard test block; Cutting the first square image according to the second standard ratio; scaling the side length of the first square image to the side length of the standard test block; Correcting and demoulding the second image based on the quadrilateral outline and the logo outline to obtain a second square image; Aligning the first square image with the second square image to obtain a first texture image and a second texture image; Obtaining a texture comparison value according to the first texture image and the second texture image; Determining whether the texture comparison value is less than a target threshold; Wherein, the target threshold is obtained according to a preset precision rate and a preset recall rate; If so, the first image and the second image correspond to the same concrete test block.

2. The concrete test block identification method according to claim 1, characterized in that: The extracting of the quadrilateral contour and the logo contour of the first image and the second image respectively comprises: Inputting the first image into a trained segmentation model to obtain a first surface mask image and a first identification mask image; Extracting the contour edge lines of the first surface mask image and performing regression calculation to obtain the quadrilateral contour of the first image; Extracting the contour edge of the first identification mask image and performing regression calculation to obtain the identification contour of the first image; Inputting the second image into the trained segmentation model to obtain a second surface mask image and a second identification mask image; Extracting the contour edge lines of the second surface mask image and performing regression calculation to obtain the quadrilateral contour of the second image; The contour edge of the second identification mask image is extracted and regression calculation is performed to obtain the identification contour of the second image.

3. The concrete test block identification method according to claim 2, characterized in that: The step of extracting the contour edge lines of the first surface mask image and performing regression calculation to obtain the quadrilateral contour of the first image includes: Using a straight line detection algorithm to identify the edges of the first surface mask image and form an edge set; Angle calculation step: obtaining a target sideline in the sideline set, and calculating the angle between the target sideline and each of the sidelines, and obtaining a plurality of parallel sidelines of the target sideline according to the angles with each of the sidelines; Distance calculation step: calculating the distance between each of the parallel sidelines and the target sideline, and dividing each of the parallel sidelines into a parallel side subset of the target sideline according to the distance; Taking each of the edge lines in the edge line set as the target edge line in turn and executing the angle calculation step and the distance calculation step to obtain the parallel edge subset of each edge line; Using a linear fitting method to merge the parallel edge subsets to obtain a new edge set; Determining whether each of the parallel edge subsets meets preset requirements; If so, the four longest sides in the new sideline set are taken as the quadrilateral outline of the first image; if not, the eight longest sides in the new sideline set are taken as the sideline set, and the process returns to the angle calculation step.

4. The concrete test block identification method according to claim 2, characterized in that: The step of aligning the first square image and the second square image to obtain the first texture image and the second texture image includes: Clipping the first square image according to the first identification mask image to obtain a first identification image; Clipping the second square image according to the second identification mask image to obtain a second identification image; Inputting the first identification image into a trained positioning model to obtain first positioning coordinates of the first identification image; Inputting the second identification image into the trained positioning model to obtain second positioning coordinates of the second identification image; The first square image and the second square image are aligned based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image.

5. The concrete test block identification method according to claim 4, characterized in that: The step of clipping the first square image according to the first identification mask image to obtain a first identification image includes: transforming the first identification mask image according to the first perspective matrix to obtain a square identification mask image of the first square image, and determining an identification position of a unique identification in the first square image according to the square identification mask image; Calculate the coordinates of the circumscribed rectangle of the unique identifier; The first square image is clipped according to the circumscribed rectangle coordinates and the marker position to obtain the first marker image.

6. The concrete test block identification method according to claim 4, characterized in that: The step of inputting the first identification image into a trained positioning model to obtain first positioning coordinates of the first identification image includes: Inputting the preprocessed first identification image into the trained positioning model to obtain contour coordinates of three positioning points; The Green's formula is used to calculate the contour coordinates of each of the three positioning points to obtain the contour area and contour radius; Determine whether there is a mis-segmented area based on the contour coordinates, contour area and contour radius of the three positioning points; If it exists, the mis-segmented area is eliminated to obtain the positioning areas of the three positioning points; Obtaining the position coordinates of the three positioning points according to the positioning area; Generate a fourth positioning point according to the position coordinates of the three positioning points and the rectangular structure; Arrange the positioning points based on their position coordinates to obtain the position coordinates of the positioning points in the forward direction; The position coordinates of the forward direction positioning point are used as the first positioning coordinates.

7. The concrete test block identification method according to claim 4, characterized in that: The aligning the first square image and the second square image based on the first positioning coordinates and the second positioning coordinates to obtain the first texture image and the second texture image includes: Using an image perspective transformation method, obtaining an identification perspective matrix for transforming the second positioning coordinates into the first positioning coordinates; transforming the second square image using the identification perspective matrix; After the second square image is straightened in a preset order, the first square pattern is used as the first texture image, and the second square image is used as the second texture image.

8. The concrete test block identification method according to claim 1, characterized in that: The obtaining of a texture contrast value according to the first texture image and the second texture image includes: Inputting the first texture image and the second texture image into a trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions; The texture contrast value of the concrete test block is obtained according to the texture contrast scores at multiple resolutions.

9. The concrete test block identification method according to claim 8, characterized in that: The step of inputting the first texture image and the second texture image into a trained texture comparison model to obtain texture comparison scores of the first texture image and the second texture image at multiple resolutions includes: Downsampling the first texture image multiple times to obtain first sampling feature maps with multiple resolutions; Downsampling the second texture image multiple times to obtain second sampling feature maps with multiple resolutions; Repeating feature extraction, cross fusion and attention fusion on each of the first sampling feature maps according to a preset number of cycles to obtain first feature maps at multiple resolutions; Repeating feature extraction, cross fusion and attention fusion on each of the second sampling feature maps according to the preset number of cycles to obtain second feature maps at multiple resolutions; Merging each of the first feature maps and each of the second feature maps according to resolution to obtain a plurality of merged feature maps; The texture contrast scores at various resolutions are obtained according to the combined feature maps.

10. A concrete test block identification device, characterized in that: include: An acquisition module, used for acquiring a first image and a second image of a concrete test block at different process nodes; An extraction module, used to extract the quadrilateral outline and the logo outline of the first image and the second image respectively; A first correction and demoulding module is used to correct and demould the first image based on its quadrilateral contour and logo contour to obtain a first square image; specifically, the first correction and demoulding module is used to arrange the vertices in the quadrilateral contour of the first image in a clockwise direction; adopt an image perspective transformation method to obtain a first perspective matrix that transforms the clockwise arranged vertices into a square; transform and correct the first image and the logo contour of the first image according to the first perspective matrix to obtain the first square image and the logo contour of the first square image; obtain a first standard ratio according to the standard logo side length and the standard test block side length; calculate the side length ratio of the logo contour of the first square image and the first square image; determine whether a mold exists according to the side length ratio and the first standard ratio; if so, calculate a second standard ratio of the standard mold wall thickness to the side length of the standard test block; Cutting the first square image according to the second standard ratio; scaling the side length of the first square image to the side length of the standard test block; A second correction and demoulding module is used to correct and demould the second image based on the quadrilateral outline and the logo outline to obtain a second square image; A texture alignment module, used for aligning the first square image and the second square image to obtain a first texture image and a second texture image; A comparison module, configured to obtain a texture comparison value according to the first texture image and the second texture image; A judgment module is used to judge whether the texture contrast value is less than a target threshold; wherein the target threshold is obtained according to a preset precision rate and a preset recall rate; if so, the first image and the second image correspond to the same concrete test block.

11. A computer device 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 concrete test block identification method according to any one of claims 1 to 9 are implemented.

12. 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 concrete test block identification method according to any one of claims 1 to 9 are implemented.