Parts inspection method, device and electronic equipment based on image recognition
By using image recognition-based methods in part inspection, marking predicted positions, demarcating inspection areas, and using element recognition algorithms, the problems of slow identification speed and poor compatibility in the prior art are solved, and the efficiency and accuracy of part inspection are achieved.
Patent Information
- Application Number
- CN202411253285.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-09-06
AI Technical Summary
The prior art uses element recognition technology to solve the problem of slow identification speed, poor compatibility and difficult maintenance in part inspection.
The part inspection method based on image recognition is adopted, by marking the predicted position of the target inspection element in the 3D model, demarcating the inspection area, and using the element recognition algorithm to determine the part feature parameters to match the part standard parameters.
It improves the efficiency and accuracy of part inspection, solves the problem of slow element recognition speed, and simplifies the DFM review process.
Smart Images

Figure CN118799856B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent manufacturing technology, and in particular to a parts inspection method and device based on image recognition and electronic equipment thereof. Background Art
[0002] In the field of digital design and manufacturing, part inspection is a key link to ensure product quality and production efficiency. Traditional part inspection methods mainly rely on manual operations, which are inefficient and prone to errors.
[0003] The traditional part inspection method based on primitive recognition determines whether the design meets the manufacturing requirements by identifying the primitives (such as lines, circles, arcs, etc.) in the design file and comparing them with their corresponding manufacturing rules.
[0004] Graphics element recognition technology has high reliability in terms of accuracy. However, in practice, it is found that its algorithm development is complex and time-consuming, and its recognition efficiency and stability are insufficient. It is also sensitive to slight changes in graphics elements, resulting in long review times and increased investment costs. Summary of the invention
[0005] The present invention provides a parts inspection method, device and electronic equipment based on image recognition, which are used to solve the defects of slow recognition speed, poor compatibility and great maintenance difficulty existing in the prior art using primitive recognition technology.
[0006] The present invention provides a parts inspection method based on image recognition, comprising the following steps:
[0007] The predicted position of at least one target inspection element of the part to be tested is marked in the 3D model of the part to be tested.
[0008] According to the predicted position, an inspection area for inspecting the target inspection element is defined in the 3D model.
[0009] Based on the primitive recognition method, the part feature parameters within the inspection area are determined, so as to determine the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
[0010] According to a part inspection method based on image recognition provided by the present invention, the predicted position of the target inspection element is marked in the 3D model of the part to be tested based on the image recognition algorithm, including:
[0011] Obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle;
[0012] Retrieving a template library of the part to be tested, wherein any template contained in the template library is pre-designed or constructed after photographing the area where the target inspection element of the standard part corresponding to the part to be tested is located;
[0013] Perform feature comparison between the detection image and each template image in the template library;
[0014] When it is determined that there is a matching area on the detection image that matches any template image, outputting the coordinates of the feature pixel points corresponding to the matching area;
[0015] The predicted position of the target inspection element is determined according to the characteristic pixel coordinates.
[0016] According to a part inspection method based on image recognition provided by the present invention, the step of determining the predicted position of the target inspection element according to the coordinates of the feature pixel points includes:
[0017] Determine the scale between the pixel coordinates of the detection image and the real coordinates;
[0018] Based on the scale, the feature pixel coordinates are converted into the real coordinates of the predicted position of the target inspection element in the inspection image.
[0019] According to a part inspection method based on image recognition provided by the present invention, the scale is determined in the following manner:
[0020] Generating a cube of a preset size on the interface where the 3D model is located, wherein the cube does not overlap with the 3D model;
[0021] When obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle, synchronously generating an image of the cube at the specific viewing angle in the detection picture;
[0022] The scale is determined by a preset size of the cube and a pixel value of the cube in the detection image.
[0023] According to a part inspection method based on image recognition provided by the present invention, when it is determined that there is a matching area on the detection image that matches any template image, the coordinates of the feature pixel points corresponding to the matching area are output, including:
[0024] In the case where it is determined that there is a matching area on the detection image that matches any template image, determining a positional relationship between the matching area and the image of the cube at the specific viewing angle;
[0025] The coordinates of the feature pixel points corresponding to the matching area are determined according to the positional relationship and the pixel value of the cube in the detection image.
[0026] According to a part inspection method based on image recognition provided by the present invention, the feature comparison between the inspection image and each template image in the template library includes iteratively performing the following steps until the matching area is obtained or all template images in the template library are traversed:
[0027] Retrieve any template image from the template library;
[0028] Slide any one of the template images in the detection image, and determine a feature similarity score between a sliding area image of any one of the templates in the detection image and any one of the template images after each sliding;
[0029] If the highest feature similarity score determined from all feature similarity scores is greater than a preset threshold, it is determined that there is a matching area on the detection image that matches any of the template images;
[0030] Otherwise, reselect any other template image except the template image until all template images in the template library are traversed.
[0031] According to a part inspection method based on image recognition provided by the present invention, the inspection area for inspecting the target inspection element is delineated in the 3D model according to the predicted position, including:
[0032] In the 3D model, a circle is drawn with a preset diameter, taking the real coordinates of the predicted position in the detection image as the center of the circle;
[0033] A cylinder is generated by performing a sweep operation on the drawn circle along the specific viewing direction; the upper and lower bottom surfaces of the cylinder do not protrude from all planes of the part to be measured;
[0034] The area where the cylinder is located is set as the inspection area.
[0035] According to a part inspection method based on image recognition provided by the present invention, the step of obtaining a detection image of the 3D model of the part to be tested at a specific viewing angle includes:
[0036] According to the inspection items and design specifications of the part to be tested, multiple viewing angles are selected to fully display the structural features and positional features of the target inspection element;
[0037] Acquire at least one of the multiple perspectives as the specific perspective for rendering, and acquire the detection picture;
[0038] Correspondingly, if it is determined that there is no matching area on the detection image that matches any template image, a new perspective is selected from the multiple perspectives as the specific perspective for rendering, and a new detection image is obtained until it is determined that there is a matching area on the new detection image that matches any template image or the multiple perspectives are traversed.
[0039] According to a part inspection method based on image recognition provided by the present invention, the template images in the template library are pre-constructed in the following manner:
[0040] According to the inspection items and design specifications of the part to be tested, determine the area where the template image needs to be created, and determine the feature information contained in the template image;
[0041] Use 3D modeling software or 2D design software to draw a picture corresponding to the area as the template picture, or obtain the template picture by photographing and scanning the area of the standard part;
[0042] The template images are stored in the template library, and an index of each template image is established.
[0043] According to a part inspection method based on image recognition provided by the present invention, the method based on primitive recognition determines the part feature parameters within the inspection area, including:
[0044] The 3D model parameters within the inspection area are retrieved to determine the part feature parameters of each inspection point according to the 3D model parameters.
[0045] The present invention also provides a parts inspection device based on image recognition, comprising the following modules:
[0046] The image recognition unit is used to mark the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested.
[0047] An area positioning unit is used to define an inspection area for inspecting the target inspection element in the 3D model according to the predicted position.
[0048] The graphic element inspection unit is used to determine the part feature parameters in the inspection area based on the graphic element recognition method, so as to determine the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
[0049] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned image recognition-based parts inspection methods is implemented.
[0050] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the computer program implements any of the above-mentioned parts inspection methods based on image recognition.
[0051] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned parts inspection methods based on image recognition.
[0052] The image recognition-based parts inspection method, device and electronic device provided by the present invention combine pixel point coordinate conversion technology to quickly locate the coordinate positions of relevant target inspection elements of the part to be tested in the 3D model to determine the inspection area that requires targeted inspection, and then use the primitive recognition algorithm to obtain the part feature parameters of the primitives in the inspection area, thereby effectively solving the problem of slow primitive recognition speed, thereby enabling rapid and accurate part inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 It is a flow chart of DFM inspection using a primitive recognition method in the prior art.
[0055] Figure 2 This is a structural diagram of the prior art inspection item that the two ends of the screw need to have two painted points to interfere with the surface frame.
[0056] Figure 3 It is a schematic diagram of the structure that the prior art inspection item is that the fixing screws of the electric control box and the chassis avoid interference.
[0057] Figure 4 This is one of the flow charts of the parts inspection method based on image recognition provided by the present invention.
[0058] Figure 5 It is a schematic diagram of multiple detection pictures provided by the present invention.
[0059] Figure 6 It is a schematic diagram of the combination of multiple template images in the template library provided by the present invention.
[0060] Figure 7 It is a schematic diagram of the matching results of matching the detection image provided by the present invention with each template image in the template library.
[0061] Figure 8 This is the second flow chart of the parts inspection method based on image recognition provided by the present invention.
[0062] Fig. 9 It is a schematic diagram of a process for determining the predicted position of a part to be tested provided by the present invention.
[0063] Fig.10 It is a schematic diagram of a flow chart of determining the real coordinates of a detection position provided by the present invention.
[0064] Fig.11 It is a schematic diagram of a flow chart of demarcating an inspection area for inspecting a target inspection element in a 3D model provided by the present invention.
[0065] Fig.12 It is a structural schematic diagram of a parts inspection device based on image recognition provided by the present invention.
[0066] Fig.13 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not 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.
[0068] It should be noted that in the description of the present invention, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. The orientation or position relationship indicated by the terms "upper", "lower" and the like is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. Unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0069] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.
[0070] Figure 1 It is a schematic diagram of the process of DFM inspection using the primitive recognition method in the prior art, such as Figure 1 As shown, currently, the DFM inspection is mainly carried out by means of primitive recognition, and its main steps include: obtaining the part name through the properties of the part to be tested, and the time spent on this step is 991ms on average. Then, the part inspection items of the part to be tested are retrieved according to the part name of the part to be tested. Then, by means of primitive recognition, the geometric features related to the part to be tested and the part inspection items are determined directly according to the 3D model parameters of the part to be tested. By collecting parameters such as diameter, length, and angle from these geometric features as part feature parameters related to the part to be tested and the part inspection items, the time spent on this step is 188s on average. Finally, these part feature parameters are compared with the standard feature parameters of the part to be tested to determine the inspection result of the part to be tested based on the comparison results. The time spent on this step is 2s on average.
[0071] It can be seen that the time required to analyze each primitive in the 3D model one by one during the process of part inspection using primitive recognition algorithm accounts for 98.4% of the total time of the entire DFM inspection, indicating that the current primitive recognition algorithm has the disadvantage of low efficiency and cannot meet the needs of rapid inspection. In addition, considering that primitive recognition is very sensitive to slight changes in primitives, factors such as model accuracy, lighting, and viewing angle will affect the recognition results. If primitive recognition is used for the entire 3D model, the stability of the recognition results will be insufficient. Since the development of primitive recognition technology requires an in-depth understanding of the characteristics and rules of primitives and complex programming implementation, this will also lead to a long development cycle and increased investment costs.
[0072] Different CAD software uses different primitive representation methods and data structures, such as SolidWorks, UG, CATIA, etc. Existing primitive recognition algorithms need to be adapted for each software, and recognition rules and algorithms for specific software need to be developed, resulting in poor compatibility. Even for the same primitive type, there may be subtle differences in different CAD software, such as primitive attributes, coordinate systems, parameter settings, etc. Existing primitive recognition algorithms have difficulty accurately identifying these differences, resulting in inaccurate recognition results. The model data formats generated by different CAD software may be different, such as Parasolid, IGES, STEP, etc. Existing primitive recognition algorithms need to be able to handle multiple data formats, and perform conversion and parsing, which increases development difficulty and compatibility issues.
[0073] Figure 2 This is a schematic diagram of the structure where the existing technical inspection item is that the two ends of the screw need to have two painted points to interfere with the face frame. Figure 2 The interference fit relationship between the screw, the painted point and the face frame is shown in Figure 1. Different CAD software may use different methods to represent the painted points (such as points, circles, cylinders, etc.), which makes it difficult for existing primitive recognition algorithms to accurately identify the painted points, and thus it is impossible to determine whether the interference fit relationship complies with the rules.
[0074] Figure 3 This is a schematic diagram of the structure in which the existing technical inspection item is that the fixing screws of the electric control box and the chassis avoid interference. Figure 3 The figure shows the air avoidance relationship between the electric control box and the chassis fixing screws. Different CAD software may use different methods to represent screw holes (such as cylinders, cones, frustums, etc.), which makes it difficult for existing primitive recognition algorithms to accurately identify screw holes, and thus it is impossible to determine whether the air avoidance relationship complies with the rules.
[0075] Therefore, comprehensive Figure 2 and Figure 3As shown in the figure, since the primitive recognition algorithm usually contains a large number of mathematical formulas, logical judgments and data processing processes, the code structure is complex and difficult to understand and maintain. With the update of product design and manufacturing standards, DFM rules will also change. The existing primitive recognition algorithm needs to regularly update the rule base and adjust the code, which increases the maintenance workload. In addition, the update of CAD software version may cause changes in the primitive data format and features. The existing primitive recognition algorithm needs to be adapted according to the software version and the code needs to be modified, which increases the maintenance cost. The existing primitive recognition algorithm is usually developed for specific software and primitive types, and it is difficult to expand to other software and primitive types, resulting in poor code reusability and difficulty in maintenance.
[0076] In summary, the current general primitive recognition methods have the defects of poor compatibility and difficult code maintenance, mainly due to the differences between different CAD software and primitive types. In order to solve these problems, it is necessary to develop a more general and efficient part inspection method.
[0077] Combine the following Figure 4-Figure 13 The invention provides a method, device and electronic equipment for inspecting parts based on image recognition, which aims to achieve more accurate and detailed classification of target areas through the combination of full-color images and multi-spectral images, and can improve the classification efficiency to a certain extent.
[0078] Figure 4 FIG. 1 is one of the flow charts of the method for inspecting parts based on image recognition provided by the present invention, such as Figure 4 As shown, including but not limited to the following steps:
[0079] Step 401 : marking a predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested.
[0080] The target inspection element is an inspection point for inspecting the part to be tested.
[0081] The 3D model of the part to be tested needs to be rendered from a specific perspective to generate a test image. The rendering perspective needs to be able to clearly display the target inspection element, such as selecting a front view, side view, or top view.
[0082] The positioning of the target inspection element in the inspection image can be achieved by selecting a suitable image recognition algorithm. For example, for the identification of the target inspection element screw hole, a target detection algorithm based on deep learning, such as YOLO or Faster-R-CNN, can be used. These artificial intelligence algorithms can accurately identify and locate the target inspection element in the inspection image.
[0083] Finally, the positioning information of the target inspection element obtained in the inspection image can be mapped back to the 3D model, and the predicted position of the target inspection element can be marked in the 3D model.
[0084] As an optional embodiment, the 3D model of the part to be tested can be rendered from a front view angle to generate a test image. The Faster-R-CNN network model can be selected because it performs well in target detection tasks.
[0085] Before this, sample images with screw hole location labels can be collected, such as sample images generated by software such as SolidWorks, UG, and CATIA. These sample images are then used to complete the pre-training of the Faster-R-CNN network model.
[0086] Use the trained model to predict the detection image. After obtaining the location information of the screw hole in the detection image, map the area (or position coordinates) corresponding to the location information obtained in the detection image back to the 3D model, obtain the required predicted position and mark it in the 3D model.
[0087] Step 402: Based on the predicted position, define an inspection area for inspecting the target inspection element in the 3D model.
[0088] In this embodiment, the inspection area can be set to a range of twice the diameter of the screw hole around the predicted position. The inspection area can also be set to a square or a circle, which can be selected according to the target inspection element.
[0089] Step 403, based on the primitive recognition method, determining the part feature parameters within the inspection area, and determining the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
[0090] The primitive recognition method is used to detect primitives in the inspection area. For example, for screw holes, primitive-based dimension measurement methods can be used, such as distance measurement, angle measurement, etc. The primitive recognition method is used to extract part feature parameters in the inspection area, such as the diameter and center position of the screw hole.
[0091] Part standard parameters refer to the characteristic parameters of screw holes specified in part design drawings or specifications, such as diameter, position, etc. Finally, the part characteristic parameters are compared with the part standard parameters to determine whether the screw holes meet the design requirements. The DFM inspection results, such as qualified or unqualified, are output based on the matching results.
[0092] Assume that the inspection area of the target inspection element screw hole has been delineated through the above step 402, and the part feature parameters of the screw hole have been extracted, the diameter of the screw hole is 5mm, and the center position is (100, 200, 50). The screw hole diameter specified in the part design drawing is 5mm and the center position is (100, 200, 50).
[0093] The measured characteristic parameters of the screw holes were compared with the standard parameters of the parts, and it was found that the screw holes met the design requirements, and the DFM review results were output as qualified.
[0094] The parts inspection method provided by the present invention combines the pixel point coordinate conversion technology to quickly locate the coordinate positions of the relevant target inspection elements of the part to be tested in the 3D model to determine the inspection area that requires targeted inspection, and then uses the primitive recognition algorithm to obtain the part feature parameters of the primitives in the inspection area, thereby effectively solving the problem of slow primitive recognition speed, thereby enabling rapid and accurate part inspection.
[0095] Based on the content of the above embodiment, as an optional embodiment, the method of marking the predicted position of the target inspection element in the 3D model of the part to be tested based on the image recognition algorithm includes:
[0096] Obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle;
[0097] Retrieving a template library of the part to be tested, wherein any template contained in the template library is pre-designed or constructed after photographing the area where the target inspection element of the standard part corresponding to the part to be tested is located;
[0098] Perform feature comparison between the detection image and each template image in the template library;
[0099] When it is determined that there is a matching area on the detection image that matches any template image, outputting the coordinates of the feature pixel points corresponding to the matching area;
[0100] The predicted position of the target inspection element is determined according to the characteristic pixel coordinates.
[0101] In this embodiment, a template matching method may be used to compare features between the inspection image and each template image in the template library, mainly by finding the area with the highest similarity, thereby locating the target inspection element.
[0102] It should be noted that in this embodiment, a template library can be constructed in advance, which contains design drawings or photos of the target inspection element area of the standard part corresponding to the part to be tested. Each template image in the template library can be preprocessed, such as grayscale, binarization, etc., to facilitate subsequent feature comparison.
[0103] First, obtain the inspection image under a specific perspective from the 3D model of the part to be inspected, such as the front view, side view or top view, etc. Perform feature comparison between the inspection image and each template image in the template library, for example, using methods such as Normalized Cross-Correlation (NCC) or similarity measurement.
[0104] If there is an area on the inspection image that matches the template image, then the area is the predicted position of the target inspection element. The feature pixel point coordinates are extracted from the matching area, and the feature pixel point coordinates can be the center point coordinates, edge point coordinates, etc. of the matching area.
[0105] Finally, the feature pixel coordinates are mapped back to the 3D model, and the predicted positions of the target inspection elements are marked in the 3D model.
[0106] Figure 5 is a schematic diagram of multiple detection pictures provided by the present invention, Figure 6 It is a schematic diagram of the combination of multiple template images in the template library provided by the present invention.
[0107] like Figure 5 As shown in the figure, suppose a part to be tested is rendered from a specific perspective, and the generated test image is T01. Figure 6 The template library of the part to be tested is shown, and then each template in the template library, including M01.jpg-M10.jpg, is used to perform feature comparison with the test image T01. The feature comparison method can adopt a variety of image processing technologies, such as SIFT, SURF, HOG, etc.
[0108] By comparing the features, we can find the area on the detection image T01 that matches the template image M01.jpg. In this case, we can determine the feature pixel coordinates corresponding to the matching area on the detection image T01. This feature pixel coordinate can be used as a reference point for determining the inspection area in subsequent primitive recognition.
[0109] Specifically, the predicted position of the target inspection element can be determined based on the coordinates of the feature pixel points, combined with the 3D model information and coordinate conversion technology.
[0110] As an optional embodiment, an interpolation algorithm or other image processing technology may be used to convert the coordinates of the feature pixel points into 3D coordinates for determining the predicted position of the target inspection element in the 3D model.
[0111] Figure 7 is a schematic diagram of the matching results of matching the detection image provided by the present invention with each template image in the template library, such as Figure 7 As shown, for Figure 5 Each detection image in the template library can be used to determine the predicted position in the above manner. However, by matching each template in the template library with each detection image, it is found that T01-T06, T08, and T10 all have matching areas that match a template in the template library. At this time, according to the content of the above embodiment, the subsequent inspection work can be continued, and the matching result can be fed back to the user as "OK".
[0112] However, since there are no templates in the template library that match the two detection images T07 and T09, there are two possibilities:
[0113] One possibility is that, when the rendering process of the test image is confirmed to be normal and the result is difficult to determine, a new test image can be re-rendered and the feature matching operation with the template in the template library can be performed again, or the viewing angle of the feature image can be adjusted to collect a new test image. If a test image that meets the matching requirements is not obtained after multiple attempts, an "NG" result is fed back to the user.
[0114] Another possibility is that the template in the template library needs to be updated (for example, product update). In this case, you can manually design or photograph the area where the target inspection element of the standard part corresponding to the part to be tested is located, generate a new template and add it to the template library. Then, re-perform the above operation of marking the predicted position of the target inspection element in the 3D model of the part to be tested.
[0115] The parts inspection method provided by the present invention can quickly locate the inspection position of the target inspection element on the inspection image through image recognition technology. Among them, through feature comparison, the matching area can be accurately found, thereby improving the accuracy of locating the target inspection element.
[0116] In particular, it cleverly integrates image recognition and primitive recognition, uses image recognition algorithm combined with pixel coordinate conversion technology to quickly locate the coordinate position of primitives in 3D models, and then uses primitive recognition algorithm to obtain the part feature parameters of primitives, effectively solving the problems of slow primitive recognition speed and insufficient image recognition accuracy, so that parts inspection can be realized quickly and accurately. Compared with traditional primitive recognition methods, the present invention can effectively simplify the DFM review process and improve inspection efficiency.
[0117] Based on the content of the above embodiment, as an optional embodiment, the present invention also provides a specific implementation method for determining the predicted position of the target inspection element according to the coordinates of the feature pixel point, which mainly includes but is not limited to the following steps:
[0118] Determine the scale between the pixel coordinates of the detection image and the real coordinates;
[0119] Based on the scale, the feature pixel coordinates are converted into the real coordinates of the predicted position of the target inspection element in the inspection image.
[0120] As an optional embodiment, a reference object of known size can be selected in the detection image, such as a square or circle of standard size. The size of the reference object in the detection image is measured using image measurement technology, for example, using pixels as units. At the same time, the real size of the reference object in the real world is measured, for example, using millimeters as units. Finally, the size of the reference object in the detection image is compared with the real size to obtain the scale between the pixel coordinates and the real coordinates.
[0121] According to the determined scale, the coordinates of the feature pixel points can be multiplied by the scale to obtain the actual coordinates of the predicted position of the target inspection element in the inspection image.
[0122] As an optional embodiment, if there is a coordinate offset in the detected image, the obtained real coordinates can be corrected by performing a corresponding offset correction.
[0123] The present invention can convert the feature pixel point coordinates into real coordinates through scale conversion, thereby improving the accuracy of positioning the target inspection element. The real coordinates can be directly used for subsequent primitive recognition and DFM rule comparison without additional coordinate conversion.
[0124] Figure 8 FIG. 2 is a flow chart of a method for inspecting parts based on image recognition provided by the present invention. Figure 8 As shown, the present invention provides a method for determining a scale, which mainly includes but is not limited to:
[0125] Generating a cube of a preset size on the interface where the 3D model is located, wherein the cube does not overlap with the 3D model;
[0126] When obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle, synchronously generating an image of the cube at the specific viewing angle in the detection picture;
[0127] The scale is determined by a preset size of the cube and a pixel value of the cube in the detection image.
[0128] First, on the interface where the 3D model is located, a cube of preset size (for example, a side length of 10 mm) is synchronously generated, and it is ensured that the cube does not overlap with the 3D model of the part to be tested, so that there is no interference between the cube and the 3D model, so that the image of the cube in the test picture can be clearly observed.
[0129] When obtaining the inspection picture of the 3D model of the part to be tested at a specific viewing angle, the image of the generated cube at the same viewing angle is synchronously generated in the inspection picture. This ensures that the image corresponding to the cube and the image corresponding to the part to be tested are in the same inspection picture, which is convenient for subsequent scale determination.
[0130] Use image measurement technology to measure the pixel value of the image corresponding to the cube in the detection image. For example, the pixel value of the side length of the cube is 40pix.
[0131] Since the preset size of the cube is known, such as a side length of 10 mm, the pixel value of the cube in the detection image is compared with the actual size, and the scale between the pixel point coordinates and the actual coordinates is: 40pix / 10mm=10pix / mm.
[0132] The present invention can conveniently determine the scale by generating a cube of preset size in the 3D model. Since the size of the cube is known, the accuracy of the scale can be guaranteed. Most importantly, the method provided by the present invention is applicable to various DFM review scenarios and is not limited by specific 3D modeling software.
[0133] Fig. 9 FIG. 1 is a schematic diagram of a process for determining the predicted position of a part to be tested provided by the present invention, such as Fig. 9 As shown, firstly, a 3D model of the part to be tested is constructed from the 3D model software, and a cube of standard size is simultaneously generated on the interface where the 3D model is located, wherein the standard size can be any known size. Optionally, a regular cube can be selected, and a vertex of the regular cube is used as the coordinate origin to construct a three-dimensional coordinate system.
[0134] Furthermore, the determined coordinate origin is used as the starting point. The cube and the 3D model are rendered from the front view to obtain a detection image of a specific pixel. The specific pixel may be a pixel value that determines the length of the side of the cube used as a reference, for example, the length of the side of the cube is set to 40pix. In this way, the coordinates of the characteristic pixel points of each area position of the 3D model on the detection image can be determined based on the size and position relationship between the image of the 3D model on the detection image and the image of the cube on the detection image.
[0135] Call the template library and perform sliding feature comparison on each template in the template library on the detection image, including iteratively executing the following steps until the matching area is obtained or all template images in the template library are traversed:
[0136] Retrieve any template image from the template library;
[0137] Slide any one of the template images in the detection image, and determine a feature similarity score between a sliding area image of any one of the templates in the detection image and any one of the template images after each sliding;
[0138] If the highest feature similarity score determined from all feature similarity scores is greater than a preset threshold, it is determined that there is a matching area on the detection image that matches any of the template images;
[0139] Otherwise, reselect any other template image except the template image until all template images in the template library are traversed.
[0140] Specifically, the present invention provides a specific embodiment to illustrate how to implement feature comparison between a detection image and each template image in a template library to determine a matching area.
[0141] Step 1: Select a template image from the template library. The template image usually contains the feature information of the target to be identified, such as shape, color, texture, size, etc.
[0142] Step 2: Slide the selected template image on the detection image, just like moving a sliding window on the image. The sliding range of the sliding window can cover the entire detection image, or a sliding range can be set according to actual conditions.
[0143] Step 3: For each slide, perform feature comparison between the slide area image and the selected template image. The feature comparison method may adopt one or a combination of a template matching algorithm, a feature point matching algorithm, and a deep learning method.
[0144] Among them, the template matching algorithm calculates the similarity between the sliding area image and the template image, such as calculating the normalized correlation coefficient. The feature point matching algorithm extracts some feature points from the sliding area image and the template image, such as SIFT or SURF, and then calculates the matching degree between these feature points. The deep learning method uses deep learning models such as convolutional neural networks to extract image features and complete similarity calculations.
[0145] Step 4: Record the similarity score obtained after each slide until all slide positions are traversed and the highest feature similarity score among all feature scores is found.
[0146] Step 5: Compare the highest similarity score with the preset threshold. If the highest feature similarity score is greater than the preset threshold, it is considered that there is an area in the detected image that matches the template; otherwise, it is considered that no matching area is found.
[0147] Step 6: If no matching area is found, reselect other template images in the template library and repeat steps 1 to 5 above until a matching area is found or all template images in the template library are traversed.
[0148] The parts inspection method provided by the present invention can quickly locate the coordinate position of the primitive in the 3D model through the image recognition algorithm, narrow the scope of subsequent primitive recognition, and reduce the complexity of the algorithm. At the same time, the coordinate information provided by the image recognition algorithm helps the primitive recognition algorithm to locate the primitive more accurately and improve the accuracy of dimensional measurement. In this way, there is no need to analyze the primitive features one by one, and the time for a single DFM review item is compressed to less than 10 seconds, which significantly improves the efficiency of DFM review and saves a lot of time.
[0149] As an optional embodiment, when it is determined that there is a matching area on the detection image that matches any template image, outputting the coordinates of feature pixel points corresponding to the matching area includes:
[0150] In the case where it is determined that there is a matching area on the detection image that matches any template image, determining a positional relationship between the matching area and the image of the cube at the specific viewing angle;
[0151] The coordinates of the feature pixel points corresponding to the matching area are determined according to the positional relationship and the pixel value of the cube in the detection image.
[0152] Fig.10 is a schematic diagram of a process for determining the real coordinates of a detection position provided by the present invention, such as Fig.10 As shown, when a matching area (such as Fig.10 ), the positional relationship between the matching area and the cube in the detection image (for example, the positional relationship with the coordinate origin) can be obtained.
[0153] For example, if the horizontal distance between the matching area and the coordinate origin is 10 times the horizontal distance to the lower right corner of the cube in the detection image, then based on the fact that the side length of the cube in the detection image is 40pix, it can be determined that the horizontal coordinate value of the feature pixel point in the matching area is 400pix.
[0154] Similarly, it can be determined that the vertical coordinate value of the feature pixel point in the matching area is 200pix.
[0155] When the coordinate values of the feature pixel points of the matching area are determined to be (400pix, 200pix), the real coordinates of the matching area in the detection image can be calculated according to the determined scale.
[0156] Assuming that the side length of the cube in the detection image is 10mm, the scale is 400 / 10, and the unit is pix / mm. Then we can determine that the coordinate value of the feature pixel point in the matching area is (400pix, 200pix) and the corresponding real coordinate is (100mm, 50mm).
[0157] Fig.11 is a schematic diagram of a process for defining an inspection area for inspecting a target inspection element in a 3D model provided by the present invention, such as Fig.11 As shown, demarcating an inspection area for inspecting the target inspection element in the 3D model according to the predicted position includes:
[0158] In the 3D model, a circle is drawn with a preset diameter, taking the real coordinates of the predicted position in the detection image as the center of the circle;
[0159] A cylinder is generated by performing a sweep operation on the drawn circle along the specific viewing direction; the upper and lower bottom surfaces of the cylinder do not protrude from all planes of the part to be measured;
[0160] The area where the cylinder is located is set as the inspection area.
[0161] As an optional embodiment, firstly, the method provided by any of the above embodiments is adopted to identify the real coordinates of the matching area related to the target inspection element in the inspection image, assuming that the coordinates are at the position of (100 mm, 50 mm).
[0162] Then, in the 3D model, draw a circle with a preset diameter D=3mm with (100mm, 50mm) as the center. Then sweep the drawn circle along a specific viewing direction to generate a cylinder. The upper and lower bottom surfaces of the cylinder cannot protrude from all planes of the part to be tested. This means that the height of the cylinder needs to be adjusted according to the specific shape of the part to be tested to ensure that the cylinder is completely inside the part to be tested, then the area where the cylinder is located is the inspection area. Assume that the part to be tested is a cuboid with a size of 100mm*50mm*20mm, and the predicted position (100mm, 50mm) is located at the center of the cuboid. According to the above steps, the inspection area is a cylinder with a diameter of 3mm, a height of 20mm, and a center at (100mm, 50mm, 10mm).
[0163] The present invention provides a method combining image recognition and primitive recognition for quickly and accurately extracting the size information of primitives in a 3D model, quickly locating the primitive position through image recognition, and then obtaining the precise size using primitive recognition technology, thereby overcoming the limitations of using image recognition or primitive recognition alone.
[0164] Based on the content of the above embodiment, as an optional embodiment, the method of determining the feature parameters of the part in the inspection area based on the primitive recognition method includes:
[0165] The 3D model parameters within the inspection area are retrieved to determine the part feature parameters of each inspection point according to the 3D model parameters.
[0166] The 3D model parameters include the model parameters of all inspection points in the part to be inspected, and the present invention only needs to extract the characteristic parameters in the determined inspection area, which can be specifically operated as follows:
[0167] In the inspection area, the measured parameters related to each part to be inspected can be determined based on the 3D model data related to the part to be inspected and combined with the actual inspection requirements, such as size, shape deviation, surface roughness, material characteristics, etc. Specifically, the measurement tools provided by the NX software, such as dimensional measurement and quality assessment tools, can be automatically called to analyze and measure the inspection area in the 3D model, and the measured part feature parameters of each part to be inspected can be determined in combination with the actual inspection requirements.
[0168] Furthermore, the part inspection items of each part to be inspected can be determined according to the manufacturing design name of each part to be inspected, and the part standard parameters corresponding to each part inspection item can be retrieved.
[0169] Finally, the inspection result of each part to be tested is determined according to the matching result between the part characteristic parameter and the part standard parameter of the part to be tested.
[0170] As an optional embodiment, the present invention also provides a specific implementation method for obtaining a detection image of the 3D model of the part to be tested at a specific viewing angle, mainly including but not limited to:
[0171] According to the inspection items and design specifications of the part to be tested, multiple viewing angles are selected to fully display the structural features and positional features of the target inspection element;
[0172] Acquire at least one of the multiple perspectives as the specific perspective for rendering, and acquire the detection picture;
[0173] Correspondingly, if it is determined that there is no matching area on the detection image that matches any template image, a new perspective is selected from the multiple perspectives as the specific perspective for rendering, and a new detection image is obtained until it is determined that there is a matching area on the new detection image that matches any template image or the multiple perspectives are traversed.
[0174] The above steps are described below in conjunction with a specific embodiment. Assuming that it is necessary to check whether the position and size of a screw hole on a part to be tested meet the design specifications, the following operations can be performed:
[0175] First, confirm the characteristic information such as the number, position and size of the screw holes that need to be checked, and then determine the assembly relationship and clearance requirements between the screw holes and surrounding parts according to the design specifications.
[0176] You can select multiple viewing angles, such as front view, side view, top view and 45° oblique view. Select a front view that can fully display all screw holes to clearly identify the position and number of screw holes, select one or more side views that can display the side profile of the screw holes to measure the diameter and depth of the screw holes, select a top view that can display the top profile of the screw holes to observe the shape and arrangement of the screw holes, and finally, select one or more oblique views as needed to more comprehensively observe the assembly relationship and clearance of the screw holes.
[0177] Use 3D modeling software to open the 3D model of the part to be tested, and then use rendering tools or plug-ins to render the part to be tested from the above multiple perspectives, generate corresponding inspection pictures, and save the inspection pictures in a suitable format, such as JPEG, PNG, etc.
[0178] The image recognition process begins below: You can first select any test image, such as the test image corresponding to the front view, and compare the features with the template image in the template library, such as using a template matching algorithm or a deep learning algorithm. If a screw hole area matching the template image is found in the test image corresponding to the front view, the location information of the screw hole is output. If no matching area is found, continue to search for a matching area from the test image corresponding to the side view.
[0179] The above steps are iterated until a matching area with satisfactory matching degree is found in at least one detection image, and then the characteristic parameters of the screw hole, such as diameter, depth, center position, etc., are extracted using the primitive recognition algorithm. Finally, the extracted characteristic parameters can be compared with the standard parameters in the design specification to determine whether the screw hole meets the requirements.
[0180] It should be noted that if no matching area that meets the requirements is found after traversing all the inspection images under multiple perspectives, it means that there is no pre-built template image related to the target inspection element in the template library. At this time, you can manually draw it or quickly create a new template image from the 3D model by taking screenshots and adding it to the template library.
[0181] The part inspection method based on image recognition provided by the present invention can more comprehensively and accurately inspect the characteristic information of the parts to be tested by selecting multiple viewing angles to obtain detection pictures and combining image recognition and primitive recognition technology, thereby improving the efficiency and accuracy of part inspection.
[0182] Based on the content of the above embodiment, as an optional embodiment, the present invention also provides a method for constructing each template image in a template library, including but not limited to:
[0183] According to the inspection items and design specifications of the part to be tested, determine the area where the template image needs to be created, and determine the feature information contained in the template image;
[0184] Use 3D modeling software or 2D design software to draw a picture corresponding to the area as the template picture, or obtain the template picture by photographing and scanning the area of the standard part;
[0185] The template images are stored in the template library, and an index of each template image is established.
[0186] In conjunction with a specific embodiment, for example, a template image is created and an index is established for a screw hole on a part to be tested, and the method of constructing each template image in a template library according to the inspection items and design specifications of the part to be tested and the specific implementation steps of creating an index are described in detail:
[0187] First, determine the area where the template image needs to be created based on the inspection items and design specifications of the screw holes. For example, you need to create a template image of the screw hole area to identify the position and size of the screw holes. Determine the feature information that the template image needs to contain, such as the outline of the screw hole, dimension annotation, and other information.
[0188] Use 3D modeling software or 2D design software (such as AutoCAD, SolidWorks, etc.) to draw a template image of the screw hole area. Make sure the template image is consistent with the 3D model or design drawing of the part to be tested, and include information such as the outline and dimensioning of the screw hole.
[0189] Alternatively, use a camera or scanner to take a picture of the screw hole area on the standard part to obtain a template image. It is best to ensure that the image you take or scan is clear, accurate, and has no reflections or shadows.
[0190] The template image can be further processed, such as grayscale, binarization, filtering, etc., to facilitate subsequent feature comparison.
[0191] The created template images are stored in the template library and indexed. The index can contain information such as the name, type, and creation time of the template image.
[0192] The creation of an index for each template image may include the following steps:
[0193] Formulate naming rules for template images, such as naming according to the inspection item name and template image type. Alternatively, use a database management system to store index information of template images, such as MySQL, Oracle, etc. Alternatively, develop a template image retrieval function, such as retrieving template images according to the inspection item name or template image type.
[0194] The part inspection method based on image recognition provided by the present invention can improve the efficiency of image recognition and primitive recognition by constructing a template library and creating an index, for example, quickly finding a template image that matches the inspection image. At the same time, the required template image can be quickly retrieved, for example, the template image can be retrieved according to the inspection item name or the template image type. When necessary, the template image can be conveniently managed, for example, adding, deleting, and modifying the template image.
[0195] Fig.12 is a schematic diagram of the structure of the parts inspection device based on image recognition provided by the present invention, such as Fig.12 As shown, it mainly includes an image recognition unit 121, a region positioning unit 122 and a primitive checking unit 123.
[0196] The image recognition unit 121 is mainly used to mark the predicted position of the target inspection element in the 3D model of the part to be tested; the target inspection element is a check point for inspecting the part to be tested;
[0197] The area positioning unit 122 is mainly used to define an inspection area for inspecting the target inspection element in the 3D model according to the predicted position;
[0198] The primitive inspection unit 123 is mainly used to determine the part feature parameters in the inspection area based on the primitive recognition method, so as to determine the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
[0199] It should be noted that the parts inspection device provided by the present invention can execute the parts inspection method based on image recognition described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0200] The parts inspection device provided by the present invention combines pixel point coordinate conversion technology to quickly locate the coordinate positions of relevant target inspection elements of the part to be tested in the 3D model to determine the inspection area that requires targeted inspection, and then uses the primitive recognition algorithm to obtain the part feature parameters of the primitives in the inspection area, thereby effectively solving the problem of slow primitive recognition speed, thereby enabling rapid and accurate part inspection.
[0201] Fig.13 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Fig.13 As shown, the electronic device may include: a processor 1310, a communication interface 1320, a memory 1330 and a communication bus 1340, wherein the processor 1310, the communication interface 1320 and the memory 1330 communicate with each other through the communication bus 1340. The processor 1310 may call the logic instructions in the memory 1330 to execute the part inspection method, which includes: marking the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested; the target inspection element is a check point for inspecting the part to be tested; according to the predicted position, delineating an inspection area for inspecting the target inspection element in the 3D model; based on the primitive recognition method, determining the part feature parameters in the inspection area, so as to determine the inspection result of the part to be tested according to the matching result of the part feature parameters and the part standard parameters.
[0202] In addition, the logic instructions in the above-mentioned memory 1330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for 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 invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0203] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the part inspection method provided by the above-mentioned embodiments, and the method includes: marking the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested; the target inspection element is an inspection point for inspecting the part to be tested; according to the predicted position, an inspection area for inspecting the target inspection element is defined in the 3D model; based on the primitive recognition method, the part feature parameters within the inspection area are determined, so as to determine the inspection result of the part to be tested based on the matching result of the part feature parameters and the part standard parameters.
[0204] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the part inspection method provided in the above-mentioned embodiments, the method comprising: marking the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested; the target inspection element is an inspection point for inspecting the part to be tested; based on the predicted position, defining an inspection area for inspecting the target inspection element in the 3D model; based on a primitive recognition method, determining part feature parameters within the inspection area, so as to determine the inspection result of the part to be tested based on the matching result of the part feature parameters with the part standard parameters.
[0205] 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.
[0206] 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, 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.
[0207] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 invention.
Claims
1. A parts inspection method based on image recognition, characterized in that: include: Marking a predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested, wherein the predicted position is determined after feature comparison between a detection image of the 3D model of the part to be tested at a specific viewing angle and each template image in the template library; According to the predicted position, demarcating an inspection area for inspecting the target inspection element in the 3D model, including: in the 3D model, taking the real coordinates of the predicted position in the detection image as the center and drawing a circle with a preset diameter; generating a cylinder by performing a sweep operation on the drawn circle along the specific viewing direction; the upper and lower bottom surfaces of the cylinder do not protrude from all planes of the part to be tested; and setting the area where the cylinder is located as the inspection area; Based on the primitive recognition method, the part feature parameters within the inspection area are determined, so as to determine the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
2. The parts inspection method based on image recognition according to claim 1, characterized in that: The step of marking the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested comprises: Obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle; Retrieving a template library of the part to be tested, wherein any template contained in the template library is pre-designed or constructed after photographing the area where the target inspection element of the standard part corresponding to the part to be tested is located; Perform feature comparison between the detection image and each template image in the template library; When it is determined that there is a matching area on the detection image that matches any template image, outputting the coordinates of the feature pixel points corresponding to the matching area; The predicted position of the target inspection element is determined according to the characteristic pixel coordinates.
3. The parts inspection method based on image recognition according to claim 2, characterized in that: The step of determining the predicted position of the target inspection element according to the coordinates of the feature pixel points includes: Determine the scale between the pixel coordinates of the detection image and the real coordinates; Based on the scale, the feature pixel coordinates are converted into the real coordinates of the predicted position of the target inspection element in the inspection image.
4. The parts inspection method based on image recognition according to claim 3 is characterized in that: The scale is determined in the following manner: Generating a cube of a preset size on the interface where the 3D model is located, wherein the cube does not overlap with the 3D model; When obtaining a detection picture of the 3D model of the part to be tested at a specific viewing angle, synchronously generating an image of the cube at the specific viewing angle in the detection picture; The scale is determined by a preset size of the cube and a pixel value of the cube in the detection image.
5. The parts inspection method based on image recognition according to claim 4 is characterized in that: When it is determined that there is a matching area on the detection image that matches any template image, outputting the coordinates of feature pixel points corresponding to the matching area includes: In the case where it is determined that there is a matching area on the detection image that matches any template image, determining a positional relationship between the matching area and the image of the cube at the specific viewing angle; The coordinates of the feature pixel points corresponding to the matching area are determined according to the positional relationship and the pixel value of the cube in the detection image.
6. The parts inspection method based on image recognition according to claim 2, characterized in that: The feature comparison between the detection image and each template image in the template library includes iteratively performing the following steps until the matching area is obtained or all template images in the template library are traversed: Retrieve any template image from the template library; Slide any one of the template images in the detection image, and determine a feature similarity score between a sliding area image of any one of the templates in the detection image and any one of the template images after each sliding; If the highest feature similarity score determined from all feature similarity scores is greater than a preset threshold, it is determined that there is a matching area on the detection image that matches any of the template images; Otherwise, reselect any other template image except the template image until all template images in the template library are traversed.
7. The parts inspection method based on image recognition according to claim 2, characterized in that: The step of obtaining a detection image of the 3D model of the part to be tested at a specific viewing angle includes: According to the inspection items and design specifications of the part to be tested, multiple viewing angles are selected to fully display the structural features and positional features of the target inspection element; Acquire at least one of the multiple perspectives as the specific perspective for rendering, and acquire the detection picture; Correspondingly, if it is determined that there is no matching area on the detection image that matches any template image, a new perspective is selected from the multiple perspectives as the specific perspective for rendering, and a new detection image is obtained until it is determined that there is a matching area on the new detection image that matches any template image or the multiple perspectives are traversed.
8. The parts inspection method based on image recognition according to claim 2, characterized in that: The template images in the template library are pre-built in the following way: According to the inspection items and design specifications of the part to be tested, determine the area where the template image needs to be created, and determine the feature information contained in the template image; Use 3D modeling software or 2D design software to draw a picture corresponding to the area as the template picture, or obtain the template picture by photographing and scanning the area of the standard part; The template images are stored in the template library, and an index of each template image is established.
9. The parts inspection method based on image recognition according to claim 2, characterized in that: The method of determining the feature parameters of the parts in the inspection area based on the primitive recognition method includes: The 3D model parameters within the inspection area are retrieved to determine the part feature parameters of each inspection point according to the 3D model parameters.
10. A parts inspection device based on image recognition, characterized in that: include: An image recognition unit, used to mark the predicted position of at least one target inspection element of the part to be tested in the 3D model of the part to be tested, wherein the predicted position is determined after feature comparison between a detection image of the 3D model of the part to be tested at a specific viewing angle and each template image in the template library; An area positioning unit is used to define an inspection area for inspecting the target inspection element in the 3D model according to the predicted position, including: in the 3D model, taking the real coordinates of the predicted position in the detection image as the center and drawing a circle with a preset diameter; generating a cylinder by performing a sweep operation on the drawn circle along the specific viewing direction; the upper and lower bottom surfaces of the cylinder do not protrude from all planes of the part to be tested; and setting the area where the cylinder is located as the inspection area; The graphic element inspection unit is used to determine the part feature parameters in the inspection area based on the graphic element recognition method, so as to determine the inspection result of the part to be tested according to the matching result between the part feature parameters and the part standard parameters.
11. An electronic 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 part inspection method based on image recognition as claimed in any one of claims 1 to 9 is implemented.
12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the part inspection method based on image recognition as claimed in any one of claims 1 to 9 is implemented.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the part inspection method based on image recognition as claimed in any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Monitoring picture power primitive automatic identification and correction method and system and storage medium
CN115116083A
Part inspection method and device, electronic equipment and storage medium
CN117634088A
Three-dimensional positioning system and method for boiler water-cooled wall abrasion area based on image recognition
CN118505644A