Crack defect image recognition method for flaw detection of ring forgings

By analyzing and feature extraction of the images collected by the ring forgings and training the recognition model, the problem of poor recognition ability in ring forgings in the prior art is solved, and accurate identification and quality control of ring forging images is achieved.

CN119941711APending Publication Date: 2025-05-06BAOLU SEIKO TECH (WUXI) CO LTD
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202510350806.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

The prior art manual identification and traditional crack defect identification models in ring forging flaw detection have problems such as high error recognition rate and poor handling capabilities, and it is difficult to accurately identify different types of crack defects.

Method used

A crack defect image recognition method for ring forging detection is adopted. By collecting images of normal and abnormal ring forgings, a binary outline map is obtained, the number of target areas and the number of edge pixels is calculated, and the feature vector training recognition model is extracted, and the recognition of ring forging images is finally realized.

Benefits of technology

Accurate recognition of ring forging images is achieved, the error recognition rate is reduced, the processing ability is improved, and the quality control of ring forgings is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941711A_ABST
    Figure CN119941711A_ABST
Patent Text Reader

Abstract

The invention discloses a crack defect image recognition method for flaw detection of ring forgings, relates to the field of image recognition, and solves the problem that crack defects corresponding to ring forging images cannot be accurately recognized. The method comprises the following steps: collecting ring forging images corresponding to a plurality of normal ring forgings and ring forging images corresponding to a plurality of abnormal ring forgings; obtaining a ring forging training image set corresponding to the target ring forging; analyzing the ring forge piece training image set corresponding to the target ring forge piece to obtain binary contour diagrams corresponding to the plurality of ring forge pieces; analyzing the binary contour map of the ring forging, and calculating the number of target areas corresponding to the binary contour map and the number of edge pixel points in the target areas; feature extraction is carried out on the ring forging according to the target area, training is carried out according to the feature vectors of the normal ring forging and the feature vectors of the abnormal ring forging to obtain the ring forging recognition model, and the crack defects corresponding to the ring forging image are accurately and effectively recognized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image recognition, in particular to a crack defect image recognition method for ring forging flaw detection. Background Art

[0002] Ring forgings are annular objects that are formed into the required shape or suitable compression force by applying external force to metal blanks through plastic deformation; this force is usually achieved by using a hammer or pressure; the forging process builds a refined grain structure and improves the physical properties of the metal; ring forgings are often used in the automotive and rail transportation fields, aerospace fields, and shipbuilding and marine engineering fields; when cracks appear in ring forgings, timely and accurate identification is particularly important for large-scale production and quality control, which can ensure the stability and consistency of product quality.

[0003] However, currently, manual recognition or traditional crack defect recognition models are often used for flaw detection of ring forgings. However, manual recognition will greatly waste human resources, and traditional crack defect recognition models have poor ability to process different crack defect images and cannot accurately recognize different types of crack images, resulting in a high misrecognition rate.

[0004] To this end, the present invention proposes a crack defect image recognition method for ring forging flaw detection. Summary of the invention

[0005] The purpose of the present invention is to propose a crack defect image recognition method for ring forging flaw detection to solve the problems raised in the above background technology.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] A crack defect image recognition method for ring forging flaw detection, the method comprising:

[0008] Step S1, collecting a plurality of ring forging images corresponding to normal ring forgings and a plurality of ring forging images corresponding to abnormal ring forgings, and obtaining a ring forging training image set corresponding to a target ring forging;

[0009] Step S2, analyzing the ring forging training image set corresponding to the target ring forging to obtain binary contour images corresponding to multiple ring forgings;

[0010] Step S3, analyzing the binary contour image of the ring forging, and calculating the number of target areas corresponding to the binary contour image and the number of edge pixel points in the target area;

[0011] Step S4, extracting features of the ring forgings according to the target area, and training the ring forging recognition model based on the feature vectors of normal ring forgings and the feature vectors of abnormal ring forgings;

[0012] Step S5, photographing a ring forging image of the target ring forging, importing the ring forging image of the target ring forging into a ring forging recognition model, and the ring forging recognition model obtains a recognition result of a normal ring forging or an abnormal ring forging based on the ring forging image.

[0013] Furthermore, the step S2 includes the following sub-steps:

[0014] Step S21, obtaining a ring forging training image set corresponding to a target ring forging, selecting a ring forging image corresponding to any ring forging, and splicing multiple ring forging images of the same ring forging to obtain a ring forging combined image of the corresponding ring forging;

[0015] Step S22, identifying the RGB pixel value of each pixel in the ring forging composite image, and obtaining the R value component RZi, the G value component GZi and the B value component BZi of each pixel, where i is the number of the pixel, i=1, 2, ..., z, and z is a positive integer; and marking the coordinates of the pixel numbered i as (Xi, Yi);

[0016] Step S23, converting the pixel value of the pixel point into a grayscale value HDZi by using a grayscale conversion formula, the grayscale conversion formula is specifically:

[0017] HDZi=A1×RZi+A2×GZi+A3×BZi; wherein A1, A2, and A3 are proportional coefficients with fixed values, A1+A2+A3=1.

[0018] Furthermore, the step S2 further includes the following sub-steps:

[0019] Step S24, the grayscale value of the pixel point in the ring forging combined image is calculated by a filter to obtain the filtered grayscale value LHZi of the corresponding pixel point. The calculation process after the filter is as follows:

[0020] Step S241, setting the size of the sliding window corresponding to the filter to h×h; where h is a constant, preferably 3;

[0021] Step S242, traversing each pixel point in the ring forging combined image through a sliding window;

[0022] Step S243, record the number of pixels actually existing in the sliding window as the effective window range, if the effective window range is equal to h×h, calculate the average grayscale value of all pixels in the sliding window and record it as the filtered grayscale value of the pixel at the center of the sliding window;

[0023] Step S244: if the effective window range is less than h×h, the average grayscale value of the pixels in the sliding window is calculated and recorded as the first grayscale average value; then, the imaginary pixels are filled into the sliding window by using the mirror filling algorithm, and the effective window range of the sliding window is filled to h×h, and the average grayscale value of the pixels in the sliding window is calculated again and recorded as the second grayscale average value;

[0024] Step S245, adding the first grayscale mean value and the second grayscale mean value, taking the average thereof as the filtered grayscale value of the pixel at the center position of the sliding window;

[0025] Step S25, comparing the filtered grayscale value of the pixel point in the ring forging combined image with the grayscale threshold.

[0026] Furthermore, the step S2 further includes the following sub-steps:

[0027] Step S26, if the filtered grayscale value is greater than or equal to the second grayscale threshold, the corresponding pixel point is recorded as an edge pixel point;

[0028] If the filtered grayscale value is greater than or equal to the first grayscale threshold and less than the second grayscale threshold, determine whether the corresponding pixel is adjacent to the edge pixel. If it is adjacent to the edge pixel, the corresponding pixel is recorded as an edge pixel; if it is not adjacent to the edge pixel, the corresponding pixel is recorded as a non-edge pixel.

[0029] If the filtered gray value is less than the first gray threshold, the corresponding pixel point is recorded as a non-edge pixel point; the second gray threshold value is greater than the first gray threshold value;

[0030] Step S27, recording the binary value of the edge pixel point as 1, and recording the binary value of the non-edge pixel point as 0, to obtain a binary contour image corresponding to the ring forging.

[0031] Furthermore, the step S3 includes the following sub-steps:

[0032] Step S31, obtaining any binary contour map, and dividing the binary contour map into multiple target areas;

[0033] Step S32, counting the number of target areas MQSj corresponding to the binary contour image, and counting the number of edge pixels BXS(j, k) in each target area, where j is the number of different ring forgings, k is the number of the target area in the binary contour image, k=1, 2, ..., m, and m is a positive integer;

[0034] Step S33, setting the initial area threshold CYZ=N.

[0035] Furthermore, the step S3 also includes the following sub-steps:

[0036] Step S34, comparing the number of edge pixels in the target area with the initial area threshold, if BXS(j, k)≤CYZ, assigning all binary values ​​of all pixels in the kth target area in the binary contour image to 0; and re-marking the target area in the binary contour image after assigning 0;

[0037] Step S35, if BXS(j, k)>CYZ, the corresponding k-th target area is recorded as a crack area; the ring forging with a crack area is recorded as a calculation abnormal ring forging, and the ring forging without a crack area is recorded as a normal ring forging;

[0038] Step S36, obtaining a first accuracy by calculating the number of abnormal ring forgings and dividing it by the actual number of abnormal ring forgings; obtaining a second accuracy by calculating the number of normal ring forgings and dividing it by the actual number of normal ring forgings.

[0039] Furthermore, the step S3 also includes the following sub-steps:

[0040] Step S37, comparing the first accuracy and the second accuracy with the standard accuracy;

[0041] Step S38, if any one of the first accuracy or the second accuracy is less than the standard accuracy, the initial threshold CYZ is changed to CYZ=N+5, and the above steps are executed again;

[0042] Step S39, if both the first accuracy and the second accuracy are greater than the standard accuracy, the initial threshold is recorded as the final threshold, and the number of target areas MQSj corresponding to the binary contour map and the number of edge pixels BXS(j, k) in the target area are obtained.

[0043] Furthermore, the step S4 includes the following sub-steps:

[0044] Step S41, obtaining any binary contour map, obtaining the number of target areas and the number of edge pixels in the target areas corresponding to the binary contour map, recording the number of target areas as the first eigenvalue, and recording the number of edge pixels as the second eigenvalue;

[0045] Step S42, for any target area, read the grayscale values ​​of the pixels in the target area, and draw a grayscale histogram corresponding to the target area according to the grayscale values ​​of the pixels in the target area;

[0046] Step S43, calculating the grayscale mean HDJ(j, k) in the target area according to the grayscale histogram, and recording the grayscale mean as the third eigenvalue.

[0047] Furthermore, the step S4 further includes the following sub-steps:

[0048] Step S44, calculating the grayscale standard deviation of the pixels in the target area according to the grayscale mean value in the target area, and recording the grayscale standard deviation as the fourth eigenvalue;

[0049] Step S45, calculating the difference in grayscale values ​​between adjacent pixels and taking the absolute value to obtain a pixel difference value, adding the pixel difference values ​​and taking the average value to obtain an average difference degree of the target area, and recording the average difference degree as the fifth eigenvalue;

[0050] Step S46, calculate the third-order moment SJJ(j, k) of the grayscale corresponding to the target area by a formula, and record the third-order moment as the sixth eigenvalue. The calculation formula of the third-order moment is as follows:

[0051] Where p is the number of the pixel in the target area, and the upper limit of p is n.

[0052] Furthermore, the step S4 further includes the following sub-steps:

[0053] Step S47, extracting the first to sixth eigenvalues ​​in all target areas and performing normalization processing; recording the first to sixth eigenvalues ​​corresponding to the normal ring forging as the normal ring forging feature vector, and recording the first to sixth eigenvalues ​​corresponding to the abnormal ring forging as the abnormal ring forging feature vector;

[0054] Step S48, input the normal ring forging feature vector and the abnormal ring forging feature vector into the SVM classification prediction model and the Adaboost classification prediction model, and select the ring forging images corresponding to multiple ring forgings for recognition, until the recognition accuracy of the SVM classification prediction model and the Adaboost classification prediction model are both greater than the preset threshold, and the ring forging recognition model training is completed.

[0055] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0056] 1. The present invention first collects ring forging images corresponding to multiple normal ring forgings and ring forging images corresponding to multiple abnormal ring forgings to obtain a ring forging training image set corresponding to the target ring forging; then analyzes the ring forging training image set corresponding to the target ring forging to obtain binary contour maps corresponding to multiple ring forgings; then analyzes the binary contour map of the ring forging to calculate the number of target areas corresponding to the binary contour map and the number of edge pixel points in the target area; the present invention realizes image analysis of the ring forging training image set.

[0057] 2. The present invention extracts features of the ring forgings according to the target area, trains the ring forging recognition model based on the feature vectors of normal ring forgings and the feature vectors of abnormal ring forgings, and finally captures the ring forging image of the target ring forging, imports the ring forging image of the target ring forging into the ring forging recognition model, and the ring forging recognition model obtains the recognition result of normal ring forgings or abnormal ring forgings based on the ring forging image; the present invention realizes accurate recognition of crack defects corresponding to the ring forging image. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.

[0059] Figure 1 is a flow chart of the method of the present invention;

[0060] Figure 2 It is a schematic diagram of a plurality of ring forging combination images in the present invention;

[0061] Figure 3 is the grayscale histogram in the present invention;

[0062] Figure 4 It is a schematic diagram of the structure of the computer device in the present invention. DETAILED DESCRIPTION

[0063] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0064] Example 1: Please refer to Figure 1-Figure 3 As shown, the technical solution provided by the present invention is: a crack defect image recognition method for ring forging flaw detection, which is used to identify cracks in a target ring forging, and the method is specifically as follows:

[0065] Step S1, collecting a plurality of ring forging images corresponding to normal ring forgings and a plurality of ring forging images corresponding to abnormal ring forgings, and obtaining a ring forging training image set corresponding to a target ring forging;

[0066] Among them, normal ring forgings refer to ring forgings that meet the specified standards and requirements and have no defects and damage, and abnormal ring forgings refer to ring forgings with crack defects; it should be noted that ring forgings with crack defects include different crack types (block cracks, linear cracks or network cracks) and different crack degrees (slight cracks or large cracks);

[0067] Specifically, when photographing the image of the ring forging, extend the camera into the interior of the ring forging, and sequentially shoot in four directions: upward, right, downward, and left. If there are long ring forgings that cannot be photographed in one go, the corresponding ring forgings will be regarded as being composed of multiple ring forgings of the same specification spliced ​​together, and will be photographed sequentially.

[0068] Step S2, analyzing the ring forging training image set corresponding to the target ring forging to obtain binary contour images corresponding to multiple ring forgings;

[0069] In this embodiment, step S2 includes the following sub-steps:

[0070] Step S21, obtaining a ring forging training image set corresponding to a target ring forging, selecting a ring forging image corresponding to any ring forging, and splicing multiple ring forging images of the same ring forging to obtain a ring forging combined image of the corresponding ring forging;

[0071] Step S22, identifying the RGB pixel value of each pixel in the ring forging composite image, and obtaining the R value component RZi, the G value component GZi and the B value component BZi of each pixel, where i is the number of the pixel, i=1, 2, ..., z, and z is a positive integer; and marking the coordinates of the pixel numbered i as (Xi, Yi);

[0072] Step S23, converting the pixel value of the pixel point into a grayscale value HDZi by using a grayscale conversion formula, the grayscale conversion formula is specifically:

[0073] HDZi=A1×RZi+A2×GZi+A3×BZi;wherein, A1, A2, A3 are proportional coefficients with fixed values, A1+A2+A3=1;Preferably, in the present invention, A1 is 0.3, A2 is 0.49, and A3 is 0.21;

[0074] Step S24, the grayscale value of the pixel point in the ring forging combined image is calculated by a filter to obtain the filtered grayscale value LHZi of the corresponding pixel point. The calculation process after the filter is as follows:

[0075] Step S241, setting the size of the sliding window corresponding to the filter to h×h; where h is a constant, preferably 3;

[0076] Step S242, traversing each pixel point in the ring forging combined image through a sliding window;

[0077] Step S243, record the number of pixels actually existing in the sliding window as the effective window range, if the effective window range is equal to h×h, calculate the average grayscale value of all pixels in the sliding window and record it as the filtered grayscale value of the pixel at the center of the sliding window;

[0078] Step S244: if the effective window range is less than h×h, the average grayscale value of the pixels in the sliding window is calculated and recorded as the first grayscale average value; then, the imaginary pixels are filled into the sliding window by using the mirror filling algorithm, and the effective window range of the sliding window is filled to h×h, and the average grayscale value of the pixels in the sliding window is calculated again and recorded as the second grayscale average value;

[0079] Step S245, adding the first grayscale mean value and the second grayscale mean value, taking the average thereof as the filtered grayscale value of the pixel at the center position of the sliding window;

[0080] For example, if the size of the sliding window is 3×3, the center pixel of the sliding window is the pixel in the upper left corner, that is, (0, 0); at this time, the coverage range of the sliding window is (-1, -1) to (1, 1); and the effective window range is (0, 0) to (1, 1), a total of four pixels;

[0081] Obviously 4 < 3 × 3, so we need to use the mirror filling algorithm to fill the sliding window with five imaginary pixels;

[0082] Step S25, comparing the filtered grayscale value of the pixel point in the ring forging combined image with the grayscale threshold;

[0083] Step S26, if the filtered grayscale value is greater than or equal to the second grayscale threshold, the corresponding pixel point is recorded as an edge pixel point;

[0084] If the filtered gray value is greater than or equal to the first gray threshold and less than the second gray threshold, it is determined whether the corresponding pixel is adjacent to the edge pixel. If it is adjacent to the edge pixel, the corresponding pixel is recorded as the edge pixel; if it is not adjacent to the edge pixel, the corresponding pixel is recorded as the non-edge pixel; wherein, when performing adjacent judgment, if the adjacent pixel is unknown, the corresponding adjacent pixel is regarded as a non-edge pixel;

[0085] If the filtered grayscale value is less than the first grayscale threshold, the corresponding pixel point is recorded as a non-edge pixel point;

[0086] Wherein, the second grayscale threshold is greater than the first grayscale threshold;

[0087] Step S27, as Figure 2 As shown, the binary value of the edge pixel point is recorded as 1, and the binary value of the non-edge pixel point is recorded as 0, and the binary contour image corresponding to the ring forging is obtained; wherein 1 represents black and 0 represents white.

[0088] Step S3, analyzing the binary contour image of the ring forging, and calculating the number of target areas corresponding to the binary contour image and the number of edge pixel points in the target area;

[0089] In this embodiment, step S3 includes the following sub-steps:

[0090] Step S31, obtaining any binary contour map, and dividing the binary contour map into a plurality of target areas; when dividing, equal area division is adopted;

[0091] Step S32, counting the number of target areas MQSj corresponding to the binary contour image, and counting the number of edge pixels BXS(j, k) in each target area, where j is the number of different ring forgings, k is the number of the target area in the binary contour image, k=1, 2, ..., m, and m is a positive integer;

[0092] Step S33, setting the initial area threshold CYZ=N; preferably, N=10;

[0093] Step S34, comparing the number of edge pixels in the target area with the initial area threshold, if BXS(j, k)≤CYZ, assigning all binary values ​​of all pixels in the kth target area in the binary contour image to 0; and re-marking the target area in the binary contour image after assigning 0;

[0094] Step S35, if BXS(j, k)>CYZ, the corresponding k-th target area is recorded as a crack area; the ring forging with a crack area is recorded as a calculation abnormal ring forging, and the ring forging without a crack area is recorded as a normal ring forging;

[0095] Step S36, obtaining a first accuracy by dividing the number of abnormal ring forgings by the actual number of abnormal ring forgings; obtaining a second accuracy by dividing the number of normal ring forgings by the actual number of normal ring forgings;

[0096] Step S37, comparing the first accuracy and the second accuracy with the standard accuracy;

[0097] Step S38, if any one of the first accuracy or the second accuracy is less than the standard accuracy, the initial threshold CYZ is changed to CYZ=N+5, and the above steps are executed again;

[0098] Step S39, if both the first accuracy and the second accuracy are greater than the standard accuracy, the initial threshold is recorded as the final threshold, and the number of target areas MQSj corresponding to the binary contour map and the number of edge pixels BXS(j, k) in the target area are obtained.

[0099] Step S4, extracting features of the ring forgings according to the target area, and training the ring forging recognition model based on the feature vectors of normal ring forgings and the feature vectors of abnormal ring forgings;

[0100] In this embodiment, step S4 includes the following sub-steps:

[0101] Step S41, obtaining any binary contour map, obtaining the number of target areas and the number of edge pixels in the target areas corresponding to the binary contour map, recording the number of target areas as the first eigenvalue, and recording the number of edge pixels as the second eigenvalue;

[0102] Step S42, as Figure 3 As shown, for any target area, the grayscale values ​​of the pixels in the target area are read, and a grayscale histogram corresponding to the target area is drawn according to the grayscale values ​​of the pixels in the target area;

[0103] Step S43, calculating the grayscale mean HDJ(j, k) in the target area according to the grayscale histogram, and recording the grayscale mean as the third eigenvalue; wherein the grayscale mean is used to reflect the average brightness of the target area;

[0104] Step S44, calculating the grayscale standard deviation of the pixels in the target area according to the grayscale mean value in the target area, and recording the grayscale standard deviation as the fourth eigenvalue; wherein the grayscale standard deviation is used to reflect the average contrast of the target area;

[0105] Step S45, calculating the difference in grayscale values ​​between adjacent pixels and taking the absolute value to obtain the pixel difference value, adding the pixel difference values ​​and taking the average value to obtain the average difference of the target area, and recording the average difference as the fifth eigenvalue; wherein, the smaller the average difference, the smoother the brightness distribution of the target area;

[0106] Step S46, calculate the third-order moment SJJ(j, k) of the grayscale corresponding to the target area by a formula, and record the third-order moment as the sixth eigenvalue. The calculation formula of the third-order moment is as follows:

[0107] Where p is the number of the pixel in the target area, and the upper limit of p is n;

[0108] Step S47, and so on, extract the first to sixth eigenvalues ​​in all target areas and perform normalization processing; record the first to sixth eigenvalues ​​corresponding to the normal ring forging as the normal ring forging feature vector, and record the first to sixth eigenvalues ​​corresponding to the abnormal ring forging as the abnormal ring forging feature vector;

[0109] Step S48, input the normal ring forging feature vector and the abnormal ring forging feature vector into the SVM classification prediction model and the Adaboost classification prediction model, and select the ring forging images corresponding to multiple ring forgings for recognition, until the recognition accuracy of the SVM classification prediction model and the Adaboost classification prediction model are both greater than the preset threshold, and the ring forging recognition model training is completed.

[0110] Step S5, photographing a ring forging image of the target ring forging, importing the ring forging image of the target ring forging into a ring forging recognition model, and the ring forging recognition model obtains a recognition result of a normal ring forging or an abnormal ring forging according to the ring forging image;

[0111] In this application, if corresponding calculation formulas appear, the above calculation formulas are all dimensionless and take their numerical calculations. The weight coefficients, proportional coefficients and other coefficients in the formulas are set to a result value obtained by quantifying each parameter. The size of the weight coefficient and the proportional coefficient can be determined as long as it does not affect the proportional relationship between the parameter and the result value.

[0112] Embodiment 2: Figure 4 The present invention is a structural diagram of a computer device, which may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The processor can call the logic instructions in the memory to execute a crack defect image recognition method for ring forging flaw detection, the method comprising: collecting a plurality of ring forging images corresponding to normal ring forgings and a plurality of ring forging images corresponding to abnormal ring forgings to obtain a set of ring forging training images corresponding to a target ring forging; analyzing the set of ring forging training images corresponding to the target ring forging to obtain a plurality of binary contour images corresponding to the ring forgings; analyzing the binary contour images of the ring forgings to calculate the number of target areas corresponding to the binary contour images and the number of edge pixels in the target areas; extracting features of the ring forgings according to the target areas, training according to the feature vectors of the normal ring forgings and the feature vectors of the abnormal ring forgings to obtain a ring forging recognition model; photographing the ring forging image of the target ring forging, importing the ring forging image of the target ring forging into the ring forging recognition model, the ring forging recognition model obtaining a recognition result of a normal ring forging or an abnormal ring forging according to the ring forging image.

[0113] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0114] On the other hand, the present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a crack defect image recognition method for ring forging flaw detection provided by the above methods, the method including: collecting ring forging images corresponding to multiple normal ring forgings and ring forging images corresponding to multiple abnormal ring forgings to obtain a ring forging training image set corresponding to a target ring forging; analyzing the ring forging training image set corresponding to the target ring forging to obtain binary contour images corresponding to multiple ring forgings; analyzing the binary contour image of the ring forging to calculate the number of target areas corresponding to the binary contour image and the number of edge pixels in the target area; extracting features of the ring forging according to the target area, and training according to the feature vector of the normal ring forging and the feature vector of the abnormal ring forging to obtain a ring forging recognition model; shooting the ring forging image of the target ring forging, importing the ring forging image of the target ring forging into the ring forging recognition model, and the ring forging recognition model obtains a recognition result of a normal ring forging or an abnormal ring forging based on the ring forging image.

[0115] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, which is implemented when the processor executes the above-mentioned method for crack defect image recognition for ring forging flaw detection, the method comprising: collecting ring forging images corresponding to multiple normal ring forgings and ring forging images corresponding to multiple abnormal ring forgings to obtain a set of ring forging training images corresponding to the target ring forging; analyzing the set of ring forging training images corresponding to the target ring forging to obtain binary contour images corresponding to multiple ring forgings; analyzing the binary contour image of the ring forging to calculate the number of target areas corresponding to the binary contour image and the number of edge pixels in the target area; extracting features of the ring forgings according to the target area, and training according to the feature vector of the normal ring forging and the feature vector of the abnormal ring forging to obtain a ring forging recognition model; photographing the ring forging image of the target ring forging, importing the ring forging image of the target ring forging into the ring forging recognition model, and the ring forging recognition model obtains a recognition result of a normal ring forging or an abnormal ring forging based on the ring forging image.

[0116] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A crack defect image recognition method for ring forging flaw detection, characterized in that: Methods include: Step S1, collecting a plurality of ring forging images corresponding to normal ring forgings and a plurality of ring forging images corresponding to abnormal ring forgings, and obtaining a ring forging training image set corresponding to a target ring forging; Step S2, analyzing the ring forging training image set corresponding to the target ring forging to obtain binary contour images corresponding to multiple ring forgings; Step S3, analyzing the binary contour image of the ring forging, and calculating the number of target areas corresponding to the binary contour image and the number of edge pixel points in the target area; Step S4, extracting features of the ring forgings according to the target area, and training the ring forging recognition model based on the feature vectors of normal ring forgings and the feature vectors of abnormal ring forgings; Step S5, photographing a ring forging image of the target ring forging, importing the ring forging image of the target ring forging into a ring forging recognition model, and the ring forging recognition model obtains a recognition result of a normal ring forging or an abnormal ring forging based on the ring forging image.

2. A crack defect image recognition method for ring forging flaw detection according to claim 1, characterized in that: The step S2 includes the following sub-steps: Step S21, obtaining a ring forging training image set corresponding to a target ring forging, selecting a ring forging image corresponding to any ring forging, and splicing multiple ring forging images of the same ring forging to obtain a ring forging combined image of the corresponding ring forging; Step S22, identifying the RGB pixel value of each pixel in the ring forging composite image, and obtaining the R value component RZi, the G value component GZi and the B value component BZi of each pixel, where i is the number of the pixel, i=1, 2, ..., z, and z is a positive integer; and marking the coordinates of the pixel numbered i as (Xi, Yi); Step S23, converting the pixel value of the pixel point into a grayscale value HDZi by using a grayscale conversion formula, the grayscale conversion formula is specifically: HDZi=A1×RZi+A2×GZi+A3×BZi; wherein A1, A2, and A3 are proportional coefficients with fixed values, A1+A2+A3=1.

3. A crack defect image recognition method for ring forging flaw detection according to claim 2, characterized in that: The step S2 further comprises the following sub-steps: Step S24, the grayscale value of the pixel point in the ring forging combined image is calculated by a filter to obtain the filtered grayscale value LHZi of the corresponding pixel point. The calculation process after the filter is as follows: Step S241, setting the size of the sliding window corresponding to the filter to h×h; Step S242, traversing each pixel point in the ring forging combined image through a sliding window; Step S243, record the number of pixels actually existing in the sliding window as the effective window range, if the effective window range is equal to h×h, calculate the average grayscale value of all pixels in the sliding window and record it as the filtered grayscale value of the pixel at the center of the sliding window; Step S244: if the effective window range is less than h×h, the average grayscale value of the pixels in the sliding window is calculated and recorded as the first grayscale average value; then, the imaginary pixels are filled into the sliding window by using the mirror filling algorithm, and the effective window range of the sliding window is filled to h×h, and the average grayscale value of the pixels in the sliding window is calculated again and recorded as the second grayscale average value; Step S245, adding the first grayscale mean value and the second grayscale mean value, taking the average thereof as the filtered grayscale value of the pixel at the center position of the sliding window; Step S25, comparing the filtered grayscale value of the pixel point in the ring forging combined image with the grayscale threshold.

4. A crack defect image recognition method for ring forging flaw detection according to claim 3, characterized in that: The step S2 further comprises the following sub-steps: Step S26, if the filtered grayscale value is greater than or equal to the second grayscale threshold, the corresponding pixel point is recorded as an edge pixel point; If the filtered grayscale value is greater than or equal to the first grayscale threshold and less than the second grayscale threshold, determine whether the corresponding pixel is adjacent to the edge pixel. If it is adjacent to the edge pixel, the corresponding pixel is recorded as an edge pixel; if it is not adjacent to the edge pixel, the corresponding pixel is recorded as a non-edge pixel. If the filtered gray value is less than the first gray threshold, the corresponding pixel point is recorded as a non-edge pixel point; the second gray threshold value is greater than the first gray threshold value; Step S27, recording the binary value of the edge pixel point as 1, and recording the binary value of the non-edge pixel point as 0, to obtain a binary contour image corresponding to the ring forging.

5. A crack defect image recognition method for ring forging flaw detection according to claim 4, characterized in that: The step S3 includes the following sub-steps: Step S31, obtaining any binary contour map, and dividing the binary contour map into multiple target areas; Step S32, counting the number of target areas MQSj corresponding to the binary contour image, and counting the number of edge pixels BXS(j, k) in each target area, where j is the number of different ring forgings, k is the number of the target area in the binary contour image, k=1, 2, ..., m, and m is a positive integer; Step S33, setting the initial area threshold CYZ=N.

6. A crack defect image recognition method for ring forging flaw detection according to claim 5, characterized in that: The step S3 further comprises the following sub-steps: Step S34, comparing the number of edge pixels in the target area with the initial area threshold, if BXS(j, k)≤CYZ, assigning all binary values ​​of all pixels in the kth target area in the binary contour image to 0; and re-marking the target area in the binary contour image after assigning 0; Step S35, if BXS(j, k)>CYZ, the corresponding k-th target area is recorded as a crack area; the ring forging with a crack area is recorded as a calculation abnormal ring forging, and the ring forging without a crack area is recorded as a normal ring forging; Step S36, obtaining a first accuracy by calculating the number of abnormal ring forgings and dividing it by the actual number of abnormal ring forgings; obtaining a second accuracy by calculating the number of normal ring forgings and dividing it by the actual number of normal ring forgings.

7. A crack defect image recognition method for ring forging flaw detection according to claim 6, characterized in that: The step S3 further comprises the following sub-steps: Step S37, comparing the first accuracy and the second accuracy with the standard accuracy; Step S38, if any one of the first accuracy or the second accuracy is less than the standard accuracy, the initial threshold CYZ is changed to CYZ=N+5, and the above steps are executed again; Step S39, if both the first accuracy and the second accuracy are greater than the standard accuracy, the initial threshold is recorded as the final threshold, and the number of target areas MQSj corresponding to the binary contour map and the number of edge pixels BXS(j, k) in the target area are obtained.

8. A crack defect image recognition method for ring forging flaw detection according to claim 7, characterized in that: The step S4 includes the following sub-steps: Step S41, obtaining any binary contour map, obtaining the number of target areas and the number of edge pixels in the target areas corresponding to the binary contour map, recording the number of target areas as the first eigenvalue, and recording the number of edge pixels as the second eigenvalue; Step S42, for any target area, read the grayscale values ​​of the pixels in the target area, and draw a grayscale histogram corresponding to the target area according to the grayscale values ​​of the pixels in the target area; Step S43, calculating the grayscale mean HDJ(j, k) in the target area according to the grayscale histogram, and recording the grayscale mean as the third eigenvalue.

9. A crack defect image recognition method for ring forging flaw detection according to claim 8, characterized in that: The step S4 further comprises the following sub-steps: Step S44, calculating the grayscale standard deviation of the pixels in the target area according to the grayscale mean value in the target area, and recording the grayscale standard deviation as the fourth eigenvalue; Step S45, calculating the difference in grayscale values ​​between adjacent pixels and taking the absolute value to obtain a pixel difference value, adding the pixel difference values ​​and taking the average value to obtain an average difference degree of the target area, and recording the average difference degree as the fifth eigenvalue; Step S46, calculate the third-order moment SJJ(j, k) of the grayscale corresponding to the target area by a formula, and record the third-order moment as the sixth eigenvalue. The calculation formula of the third-order moment is as follows: Where p is the number of the pixel in the target area, and the upper limit of p is n.

10. A crack defect image recognition method for ring forging flaw detection according to claim 9, characterized in that: The step S4 further comprises the following sub-steps: Step S47, extracting the first to sixth eigenvalues ​​in all target areas and performing normalization processing; recording the first to sixth eigenvalues ​​corresponding to the normal ring forging as the normal ring forging feature vector, and recording the first to sixth eigenvalues ​​corresponding to the abnormal ring forging as the abnormal ring forging feature vector; Step S48, input the normal ring forging feature vector and the abnormal ring forging feature vector into the SVM classification prediction model and the Adaboost classification prediction model, and select the ring forging images corresponding to multiple ring forgings for recognition, until the recognition accuracy of the SVM classification prediction model and the Adaboost classification prediction model are both greater than the preset threshold, and the ring forging recognition model training is completed.

Citation Information

Patent Citations

  • Video information based method for detecting vehicles at intersection

    CN104952256A

  • An image edge detection method and device

    CN109448012A

  • Method and device for improving surface cracks of continuous casting billet

    CN110503641A

  • Pottery tile surface crack detection method and system

    CN110687122A

  • Forge piece surface crack detection method based on multi-scale and multi-layer feature learning

    CN110766662A