Part matching method and device based on basic model, equipment and medium
Through the basic model-based method, the contour dimensions and global features of the parts are obtained and divided into local features for matching, which solves the problem of inaccurate part matching in the prior art and achieves efficient and accurate part recognition and matching.
Patent Information
- Application Number
- CN202411439272.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-01-17
AI Technical Summary
The lack of attention to detail profiles and local features in the prior art in part matching leads to inaccurate matching, especially when there are nuances in parts, which cannot be effectively distinguished.
The basic model-based method is adopted to obtain the contour dimension information and global features of the part, and divide it into local features for matching. The similarity of the parts is judged using preset conditions and thresholds to ensure the accuracy of the matching process.
It improves the accuracy and efficiency of part matching, can effectively deal with multi-dimensional features, avoid details being missed, and significantly improves the efficiency and accuracy of part matching in industrial automation.
Smart Images

Figure CN119323683A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of parts similarity matching, and in particular to a parts matching method, device, equipment and medium based on a basic model. Background Art
[0002] At present, the number of parts in industrial parts matching tasks has reached thousands. If matching is done manually, it will take a lot of manpower and time. Based on this, the usual practice is to directly extract features from the original image based on a deep neural network, and judge the similarity between the two images by directly comparing the distance between the features. Specifically, the input of this method is the entire RGB image, and the neural network is used to extract features and find the image with the closest feature distance in the database.
[0003] Since this method extracts global features of the image and lacks attention to details, although this method can extract rich semantic information, the extracted features are used as global features for similarity calculation and cannot pay attention to the contours and structures of details. When two parts are roughly similar but have different contours and there are some structural differences in the parts, a tensor similar to the target tensor will be generated. In addition, when a slight difference in the features is also averaged in the distance calculation, the slight difference cannot be highlighted. When there are only some local differences between the two parts, such as whether the head material of the part is wood or plastic, the local label of the part is different, and the engraved model of the part is different. Although the local features of the part and the local features of the target part are included in the global features, these local features cannot produce ideal similarity values after the feature distance calculation, resulting in inaccurate matching of the parts. Summary of the invention
[0004] Based on this, the present invention provides a method, device, equipment and medium for part matching based on a basic model to solve the technical problem of inaccurate similarity matching of parts in the prior art.
[0005] According to a first aspect of the present application, a method for matching parts based on a basic model is provided, the method comprising:
[0006] Acquire the outline size information of the part to be matched and the outline size information of the target part; wherein the outline size information of the part to be matched is obtained according to the image of the part to be matched, and the outline size information of the target part is obtained according to the image of the target part;
[0007] When the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition, the global features of the image of the part to be matched and the global features of the image of the target part are obtained; otherwise, it is determined that the part to be matched does not match the target part;
[0008] In the case where the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, the global features of the to-be-matched part image are segmented into a plurality of to-be-matched part local features, and the global features of the target part image are segmented into a plurality of target part local features; otherwise, it is determined that the to-be-matched part does not match the target part;
[0009] When the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions, it is determined that the part to be matched matches the target part; otherwise, it is determined that the part to be matched does not match the target part.
[0010] Further, the outline size information of the to-be-matched part includes outline information of the to-be-matched part and size information of the to-be-matched part; and the obtaining of the outline size information of the to-be-matched part includes:
[0011] Determine the bounding box of the part to be matched according to the image of the part to be matched, and perform preset processing on the bounding box of the part to be matched to obtain a prompt corresponding to the bounding box of the part to be matched;
[0012] Encoding the matching part image to obtain the image features to be matched corresponding to the image to be matched;
[0013] Inputting the hints corresponding to the image features to be matched and the bounding boxes of the parts to be matched into a preset segmentation basic model to obtain a mask corresponding to the parts to be matched;
[0014] The sum of the pixel areas corresponding to the target values in the mask corresponding to the part to be matched is determined as the size information of the part to be matched.
[0015] Furthermore, the step of obtaining the outline dimension information of the part to be matched also includes:
[0016] Obtaining the contour of the part to be matched in the image of the part to be matched; wherein the contour of the part to be matched includes a number of contour pixel points, and each round of contour pixel points corresponds to a pixel value;
[0017] According to the position coordinates and pixel values corresponding to each contour pixel point, several different types of geometric moments corresponding to the contour of the part to be matched are determined;
[0018] According to the several different types of geometric moments, a contour feature vector corresponding to the part to be matched is constructed, and the contour feature vector is determined as the contour information of the part to be matched.
[0019] Furthermore, the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition including:
[0020] Determine a first size corresponding to the part to be matched according to the size information of the part to be matched, and determine a second size corresponding to the target part according to the outline size information of the target part;
[0021] determining the largest size of the first size and the second size as a target size;
[0022] Determine the ratio of the difference between the first size and the second size to the target size as the size similarity between the part to be matched and the target part;
[0023] When the size similarity is greater than a preset size similarity threshold, it is determined that the sizes of the to-be-matched part and the target part match; otherwise, it is determined that the to-be-matched part and the target part do not match.
[0024] Furthermore, the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition and further include:
[0025] Obtaining a first specified moment corresponding to the part to be matched and a second specified moment corresponding to the target part; wherein the first specified moment is used to characterize the symmetry of the part to be matched, and the second specified moment is used to characterize the symmetry of the target part;
[0026] Obtaining the product of the first specified moment and the second specified moment;
[0027] When the product of the first specified moment and the second specified moment is positive, obtaining the contour similarity between the contour feature vector corresponding to the part to be matched and the contour feature vector corresponding to the target part;
[0028] When the contour similarity is greater than a preset contour similarity threshold, determining that the contours of the to-be-matched part and the target part match;
[0029] When the sizes of the part to be matched and the target part match and the contours of the part to be matched and the target part match, it is determined that the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition.
[0030] Furthermore, the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, including:
[0031] Obtaining the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part;
[0032] When the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part is greater than a preset cosine similarity threshold, it is determined that the global features of the part image to be matched and the global features of the target part image meet the preset global feature matching conditions.
[0033] Furthermore, the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions, including:
[0034] Obtaining the maximum similarity and the minimum similarity between the local features of each to-be-matched part and the local features of each target part;
[0035] When the minimum similarity is greater than a preset local feature similarity threshold, determining that the local feature of the part to be matched and the local feature of the target part meet the preset local feature matching conditions;
[0036] When the maximum similarity is less than a preset local feature similarity threshold, it is determined that the local feature of the part to be matched and the local feature of the target part do not meet the preset local feature matching condition.
[0037] According to another aspect of the present application, a part matching device based on a basic model is also provided, the device comprising:
[0038] A contour size information acquisition module, used to acquire contour size information of the to-be-matched part and contour size information of the target part; wherein the contour size information of the to-be-matched part is obtained according to the to-be-matched part image, and the contour size information of the target part is obtained according to the target part image;
[0039] A global feature acquisition module, used to acquire the global features of the image of the part to be matched and the global features of the target part image when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition; otherwise, determine that the part to be matched does not match the target part;
[0040] A local feature acquisition module, used for dividing the global features of the to-be-matched part image into a plurality of to-be-matched part local features, and dividing the global features of the target part image into a plurality of target part local features, when the global features of the to-be-matched part image and the global features of the target part image meet a preset global feature matching condition; otherwise, determining that the to-be-matched part does not match the target part;
[0041] The part matching judgment module is used to determine that the part to be matched matches the target part when the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions; otherwise, determine that the part to be matched does not match the target part.
[0042] According to another aspect of the present application, a non-transitory computer-readable storage medium is also provided, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the above-mentioned basic model-based parts matching method.
[0043] According to another aspect of the present application, an electronic device is provided, including a processor and the above-mentioned non-transitory computer-readable storage medium.
[0044] The present invention has at least the following beneficial effects:
[0045] The basic model-based part matching method of the present invention obtains the global features of the image of the part to be matched and the global features of the target part image only when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions; otherwise, it can be directly determined that the part to be matched does not match the target part, so there is no need to perform a subsequent judgment process, and most of the unmatched target parts can be filtered out through this step; more refined local feature matching is performed only when the global features of the image of the part to be matched and the global features of the target part image meet the preset global feature matching conditions; otherwise, it is directly determined that the part to be matched and the target part do not match, so that the matching efficiency of the parts is higher; at the same time, local feature matching can match the local details of the parts to avoid the details of the parts being missed, thereby improving the accuracy of part matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 A product side flow chart provided for an embodiment of the present invention;
[0048] Figure 2 A technical side flow chart provided for an embodiment of the present invention;
[0049] Figure 3 A flowchart of a parts matching method based on a basic model provided by an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of the Vision Transformer structure provided by an embodiment of the present invention;
[0051] Figure 5 A schematic diagram of the global and local feature extraction process of an image provided by an embodiment of the present invention;
[0052] Figure 6 A schematic diagram of a local feature similarity comparison process provided by an embodiment of the present invention;
[0053] Figure 7 An application scenario diagram of the basic model-based parts matching method provided in an embodiment of the present invention;
[0054] Figure 8 A structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0056] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0057] In the prior art, one of the existing technical solutions for matching parts is a method based on binary mask images. This method uses the moments of mask images and deep neural networks to extract features. It is mainly used to describe and match the shapes of industrial parts. Specifically, the input of this method is a binary image, and the features of the binary image are extracted and matched using the moments of the image and the deep network to find the most similar parts in the two tasks.
[0058] Another method is to directly extract features from the original image based on a deep neural network, and judge the similarity of two images by directly comparing the distance of the features. This method is not specifically designed for industrial parts, but has wide applicability. Specifically, the input of this method is the entire RGB image, and the neural network is used to extract features and find the image with the closest feature distance in the database.
[0059] The above binary mask image method has the following disadvantages:
[0060] Missing semantic information: The input image of this method is a binary image by default, which only contains the shape and size information of the parts but no semantic information. For example, if two parts are divided into red and black models, this method cannot distinguish between the two parts.
[0061] Generalization is not verified: This method shows a small amount of data, so when the number and types of parts reach another order of magnitude, the applicability of this method needs to be verified. In the current industrial parts matching tasks, the number of parts has reached thousands, which will cause a great deal of training time for this method, and there is also a great deal of uncertainty as to whether the network can fit.
[0062] Omitting preprocessing: Because this method omits the process of generating binary images, when facing the generation of binary images in a large number of samples, a series of preprocessing of traditional foreground extraction methods such as Gaussian blur, edge extraction, morphological operations, threshold adjustment, etc. need to be adjusted accordingly to meet the applicability of the method in the data set, which adds additional difficulty and cost.
[0063] The above method of directly extracting features from original images based on deep neural networks has the following disadvantages:
[0064] The geometric features are not obvious: Because the algorithm is designed to extract global features of the image, the method lacks attention to details. Although this method can extract rich semantic information, the extracted features are used as global features for similarity calculation, and cannot pay attention to the contours and structures of the details. When two parts that are roughly similar but have different contours and there are some structural differences in the parts, a tensor similar to the target tensor will be generated.
[0065] Local features are not obvious: When a slight difference in a feature is also averaged in the distance calculation, the slight difference cannot be highlighted. When there are only some local differences between two parts, such as the head material of the part is wood or plastic, the local label of the part is different, and the part lettering model is different. Although the local features of the part and the local features of the target part are included in the global features, these local features cannot produce ideal similarity values after the feature distance calculation.
[0066] In one embodiment, a part matching method based on a basic model is provided to solve the above technical problems; from the product side, the application scenarios include part sorting, inventory management, and warehouse logistics. Our algorithm can automatically sort and assemble parts according to the similarity between the parts and the template samples. Automatically identify and match the incoming parts to achieve inventory tracking and management. Highly locate and retrieve parts according to part descriptions or similarities to optimize warehouse operations. By adopting this technical solution, the industrial automation system can significantly improve accuracy, efficiency and robustness, thereby significantly improving production efficiency and effectively reducing costs. The traditional manual processing process has the following problems and is inefficient: workers need to manually compare the parts on the table with the parts in the database, which takes a lot of time and experience; the error rate is high: manual comparison is easily affected by subjective factors, resulting in misjudgment and missed judgment, affecting production quality; the labor intensity is high: workers need to concentrate for a long time, are prone to fatigue, and reduce work efficiency. The advantages of this technical solution on the product side are reflected in the high degree of automation: the entire process is fully automated, without manual participation, effectively reducing labor costs; high matching accuracy: based on the powerful feature extraction capability of the basic model, high-precision parts matching is achieved.
[0067] like Figure 1 As shown, the camera is used to capture the image of the workbench panel, locate the form and the image of the part to be matched, use OCR to extract the order number text information in the form, find the target part image from the database according to the order number, and finally match the workpiece image on the workbench with the target part image for part similarity and output the result.
[0068] The solution of this application is described from the technical side, such as Figure 2 As shown in the figure, first, the part image and the target template image are segmented simultaneously, the foreground part is extracted from the background, and the binary mask image of the part is obtained. Then, the contour and size information of the part are obtained through post-processing steps. The image moment and area are used to describe the contour and size, and a preliminary match is performed. If the preliminary match fails, the algorithm terminates and it is determined that the part does not match the template image.
[0069] If the initial match is successful, the model is then used to extract global features from both images and match the extracted features. If this step fails, the algorithm terminates and determines that the part does not match the template image.
[0070] If the previous step matches successfully, the global features are divided into local features and each local feature is matched. If the local feature matching fails, the algorithm terminates and determines that the part does not match the template image. If the local feature matching succeeds, the algorithm terminates and determines that the part matches the template image.
[0071] Through the above steps, this method can effectively process multi-dimensional part features, ensure high-precision part similarity matching, and improve the efficiency and accuracy of part matching in industrial automation.
[0072] Specifically, Figure 3 As shown, the part matching method based on the basic model may include the following steps:
[0073] S100, obtaining outline size information of the part to be matched and outline size information of the target part; wherein the outline size information of the part to be matched is obtained according to the image of the part to be matched, and the outline size information of the target part is obtained according to the image of the target part.
[0074] In this embodiment, the target part image is a preset image obtained by photographing a standard part; an image of the part to be matched and the target part image in the database are obtained to determine whether the two images match. Due to the wide variety of parts and different models, solving the problem of part similarity matching requires processing a large number of parts with different shapes, colors, and sizes. Therefore, it is necessary to obtain the multi-dimensional features of each part and use a variety of technologies to extract and analyze this information.
[0075] Furthermore, the contour size information of the to-be-matched parts includes contour information of the to-be-matched parts and size information of the to-be-matched parts; and the obtaining of the contour size information of the to-be-matched parts may include the following steps:
[0076] S110, determining a bounding box of the part to be matched according to the image of the part to be matched, and performing a preset process on the bounding box of the part to be matched to obtain a prompt corresponding to the bounding box of the part to be matched.
[0077] In this embodiment, the part to be matched is photographed by a camera to obtain an image of the part to be matched, and the part to be matched occupies a partial area in the image of the part to be matched, namely, the foreground. At the same time, there is also a background in the image of the part to be matched. In this embodiment, traditional edge extraction and large visual segmentation models can be used to perform part foreground segmentation.
[0078] First, the gradient of the image of the part to be matched is calculated by using the traditional visual operator S x and S y To fit the partial derivatives of the image of the part to be matched in the horizontal and vertical directions, and then calculate the gradient amplitude G of the image of the part to be matched; the specific calculation formula is as follows:
[0079]
[0080] Wherein, I is the average gradient of the image to be matched, x is the x-axis coordinate of the corresponding pixel, and y is the y-axis coordinate of the corresponding pixel.
[0081] Through the above formula, we can get the gradient G(x, y) corresponding to the pixel with coordinates (x, y); if G(x, y)>T, then the target gradient G corresponding to G(x, y) is b (x, y) is set to 1; otherwise, G b (x, y) is set to 0. At the same time, all pixels corresponding to the target gradient with a value of 1 are retained to obtain the coordinates P of the bounding box corresponding to the part to be matched. min -δ,y min -δ,x max -δ,y max -δ); where x min is the minimum x-axis coordinate of the bounding box corresponding to the part to be matched, x max is the maximum x-axis coordinate of the bounding box corresponding to the part to be matched, and y min is the minimum y-axis coordinate of the bounding box corresponding to the part to be matched, y max is the maximum y-axis coordinate of the bounding box corresponding to the part to be matched; δ is the preset bounding box threshold. By setting δ, the inclusiveness and elasticity of the bounding box can be increased so that the bounding box completely surrounds the image area corresponding to the part to be matched.
[0082] S111, encoding the matching part image to obtain the to-be-matched image features corresponding to the to-be-matched image.
[0083] S112, inputting the prompts corresponding to the image features to be matched and the bounding boxes of the parts to be matched into a preset segmentation basic model to obtain a mask corresponding to the parts to be matched.
[0084] In this embodiment, the role of traditional industrial vision methods in part image foreground segmentation is to provide coarse-grained positioning information. In the absence of this additional information, the basic model we apply may not be able to effectively focus on the corresponding area, resulting in poor masking effect. However, relying solely on traditional algorithms for part segmentation will bring a lot of debugging work. When there are fewer categories of part samples, traditional methods can provide more efficient and higher throughput solutions. However, as the number of part sample categories increases, for example: reaching thousands; the use of large models can significantly reduce the parameter adjustment time and improve the overall segmentation effect and accuracy.
[0085] In this embodiment, a basic model of a segmentation task is used to perform fine-grained segmentation of parts to generate accurate part masks. The model includes: an image encoder Φe, a prompt encoder Φp, and a mask decoder Φd. First, the image of the part to be matched is encoded by the image encoder Φe to generate a high-dimensional feature representation. The image encoder Φe uses deep learning technology to convert the input image of the part to be matched into a high-dimensional feature representation, that is, the image features to be matched corresponding to the image to be matched. At the same time, the bounding box p is processed to generate a prompt corresponding to the bounding box, and is input into the prompt encoder to generate an embedding of the prompt. Subsequently, the feature embedding generated by the image encoder Φe and the prompt encoder Φp is jointly input into the mask decoder Φd.
[0086] Among them, the mask generation is expressed as shown in the following formula:
[0087] M(I')=Φd(Φe(I'),Φp(p));
[0088] Where I' represents the image of the part to be matched. The mask decoder uses the decoding capability of the large model to map the features back to the image space and generates a mask image M(I') of the same size as the image of the part to be matched.
[0089] The image encoder Φe is based on the Vision Transformer model, which is fine-tuned on billions of images. The image encoder Φe divides the image into fixed-size patches, such as Figure 4 As shown in the figure, the global context and long-range dependencies of the image are effectively captured through the multi-head attention mechanism, thereby enhancing the understanding of the image. Finally, the image embedding is generated through convolutional dimensionality reduction. Vision Transformer encodes the original image into a feature map with rich features, providing high-quality feature representation for subsequent tasks.
[0090] The main role of the hint encoder is to encode the region of interest and generate embeddings, which are then decoded together with the image encoding. By using existing techniques, the bounding box p is normalized to p embeddings As input, the Gaussian random matrix and sine-cosine periodic encoding are used to generate the embedded representation of the bounding box, as shown in the following formula:
[0091] Φp(B)=concat[sin(2πp embeddings *N(0,1) 2x64 ][sin(2πp embedings *N(0,1) 2x64 ]; concat means concatenation, and N() means normal distribution.
[0092] This hint embedding expresses the position information of the bounding box in the image space and weights the starting and ending points of the bounding box to highlight its position information in the image space.
[0093] The function of the mask decoder Φd is to decode the image embedding and the hint embedding to generate the final mask. In this embodiment, the advanced mutual attention mechanism of the decoder is used to extract the semantic association between the image features and the hint position information by fusing the image embedding and the hint embedding.
[0094] Image embeddings and prompt embeddings are input into the Transformer to infer the dependencies between these two types of embeddings and fuse the semantic features of the two-way information.
[0095] The workflow of the mask decoder Φd is mainly divided into four steps: first, self-attention is applied to the hint embedding; second, the hint embedding is used as a query and cross-attention is performed with the image embedding; then, each embedding is updated through a multi-layer perceptron operation; finally, the image embedding is used as a query and cross-attention is performed again with the hint embedding. The decoding layer will repeat these two rounds and iteratively update the embedding. Finally, the fused features are further processed to predict the mask and its corresponding IoU score.
[0096] In this embodiment, it should be noted that the predicted IoU score can be used to measure the quality of mask generation. When the quality of mask generation is poor, the subsequent descriptor method will lose its meaning. In specific application tests, a low IoU score will not occur when a large-size encoder is used, while a low IoU score may occur when a small-size encoder is used; the mask M(I') generated above will be used as input in the next step of the shape feature descriptor.
[0097] S113, determining the sum of the pixel areas corresponding to the target values in the mask corresponding to the part to be matched as the size information of the part to be matched.
[0098] In this embodiment, the target value is 1; the mask M(I') corresponding to the part to be matched is obtained, and the mask M(I') is in binary form, wherein M(I') includes 0 and 1, the value corresponding to the pixel point corresponding to the part to be matched is 1, and the value corresponding to the background pixel point is 0; therefore, the size information of the part to be matched is the sum of 1s in the mask M(I').
[0099] Furthermore, the step of obtaining the outline dimension information of the part to be matched may also include:
[0100] S120, obtaining the contour of the part to be matched in the part to be matched image; wherein the contour of the part to be matched includes a number of contour pixel points, and each round of contour pixel points corresponds to a pixel value.
[0101] S121, determining several different types of geometric moments corresponding to the contour of the part to be matched according to the position coordinates and pixel values corresponding to each contour pixel point.
[0102] S122: constructing a contour feature vector corresponding to the to-be-matched part according to the several different types of geometric moments, and determining the contour feature vector as contour information of the to-be-matched part.
[0103] In this embodiment, in order to describe the contour features of the parts, the Hu moment is used to describe the contour of the matching parts. The foreground part mask is first processed by contour extraction. Due to the characteristics of the parts, the mask of each part is an independent connected area, and the outermost contour of each connected area can be simply extracted and represented as C; the contour C represents the shape relationship of the parts and can more accurately describe its shape features. By extracting the contour, internal noise and irrelevant pixels can be excluded, and only the boundary shape of the part can be focused on; not only the accuracy of the shape description is improved, but also the calculation process is simplified.
[0104] In this embodiment, the moment of the contour of the part to be matched is defined as follows:
[0105] m pq =∑ x ∑ y x p y q C(x,y);
[0106] Where m pq is the moment of the contour corresponding to the combination of p and q values, p and q are non-negative integers p and q are both between 0 and 3; C(x, y) is the pixel value of the pixel with coordinates (x, y).
[0107] In this embodiment, the Hu moment is calculated based on the normalized central moment; the central moment is expressed as follows:
[0108] μ pq =∑ x ∑ y (x- x ) p (y- y ) q C(x,y);
[0109] Among them, μ pq is the central moment corresponding to the combination of p and q values; x and y is the centroid of the parts to be matched;
[0110] Then we get the normalized central moment corresponding to the combination of p and q values:
[0111] According to η pq , determine the 7 Hu invariant moments corresponding to the parts to be matched:
[0112] First Hu invariant moment: Hu 1 =η 20 +η 02 ;
[0113] Second Hu invariant moment: Hu 2 =(η 20 -η 02 ) 2 +4η 11 2 ;
[0114] The third Hu invariant moment: Hu 3 =(η 30 -3η 12 ) 2 +(3η 21 -η 03 ) 2 ;
[0115] Fourth Hu invariant moment: Hu 4 =(η 30 +η 12 ) 2 +(η 21 +η 03 ) 2 ;
[0116] Fifth Hu invariant moment: Hu 5 =(η 30 -3η 12 )(η 30 +η 12 )[(η 30 +η 12 ) 2 -3(η 21 +η 03 ) 2 ]+(3η 21 -η 03 )(η 21 +η 03 )[3(η 30 +η 12 ) 2 -(η 21 +η 03 ) 2 ];
[0117] The sixth Hu invariant moment: Hu 6 =(η 20 -η 02 )[(η 30 +η12 ) 2 -(η 21 +η 03 ) 2 ]+4η 11 (η 30 +η 12 )(η 21 +η 03 );
[0118] The seventh Hu invariant moment: Hu 7 =(3η 21 -η 03 )(η 30 +η 12 )[(η 30 +η 12 ) 2 -3(η 21 +η 03 ) 2 ]-(η 30 -3η 12 )(η 21 +η 03 ).
[0119] In this embodiment, the Hu moment is composed of 7 invariant moments. The Hu moment can describe the features that are invariant to rotation, scaling and translation, so there is no need to perform the process of calculating the main axis direction angle and aligning the image rotation in the previous binary part image method. These Hu moments can be directly used to calculate the distance to analyze the similarity of the shapes of two parts. 1 , Hu 2 , Hu 3 , Hu 4 , Hu 5 and Hu 6 The overall density, shape symmetry, directionality, shape complexity, edges and contours of the parts to be matched, and the changes in shape in different directions are respectively represented. The difference between the shapes of the two can be represented by calculating the distance.
[0120] And Hu 7 It shows the complexity and asymmetry of the image of the part to be matched. 7 , and observed that the two mirror-symmetrical parts have opposite Hu 7 Results. In part similarity matching, we often encounter mirror-symmetrical parts, such as the left and right rearview mirrors of a car. 1 , Hu 2 , Hu 3 , Hu 4 , Hu 5 , Hu 6have very similar values, because their structures are similar in these shape descriptors. 7 This phenomenon can be well reflected, specifically in Hu 7 The opposite sign of the result.
[0121] It should be noted that the target part image can use the same processing method as the part to be matched to obtain the corresponding size information and contour information, which will not be elaborated here.
[0122] S200, when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions, obtain the global features of the image of the part to be matched and the global features of the image of the target part; otherwise, determine that the part to be matched does not match the target part.
[0123] Furthermore, the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition, which may include the following steps:
[0124] S210, determining a first size corresponding to the part to be matched according to the size information of the part to be matched, and determining a second size corresponding to the target part according to the outline size information of the target part.
[0125] In this embodiment, the image of the part to be matched is represented as I', and the image of the target part is represented as H. The image of the part to be matched and the image of the target part can be obtained by the above method to obtain the mask M(I') of the part to be matched and the mask M(H) of the target part, and then the size A corresponding to the part to be matched is obtained. I And the corresponding dimension A of the target part H .
[0126] S211: Determine the largest size between the first size and the second size as a target size.
[0127] S212: Determine a ratio of a difference between the first size and the second size to the target size as a size similarity between the part to be matched and the target part.
[0128] In this embodiment, the size similarity between the part to be matched and the target part Among them, max() is the preset maximum value function.
[0129] S213, when the size similarity is greater than a preset size similarity threshold, determining that the sizes of the to-be-matched part and the target part match; otherwise, determining that the to-be-matched part and the target part do not match.
[0130] When the size similarity is greater than or equal to σA When , it is determined that the size of the part to be matched matches the target part, and shape similarity matching is performed. A When , the matching fails, the part to be matched does not match the image in the database, and the algorithm ends; where σ A is the preset size similarity threshold.
[0131] In this embodiment, since the absolute size of the industrial parts is completely fixed, the size of the image captured by the camera and the segmented mask in the pixel coordinate system varies slightly due to the position of the workbench, but the change is not large. This variance can be determined as σ A .
[0132] Furthermore, the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition and may further include the following steps:
[0133] S220, obtaining a first specified moment corresponding to the part to be matched and a second specified moment corresponding to the target part; wherein the first specified moment is used to characterize the symmetry of the part to be matched, and the second specified moment is used to characterize the symmetry of the target part.
[0134] In this embodiment, the first designated moment is the seventh invariant moment corresponding to the part to be matched in the above embodiment, and the second designated moment is the seventh invariant moment corresponding to the target part in the above embodiment.
[0135] S221, obtaining the product of the first specified moment and the second specified moment.
[0136] S222: When the product of the first designated moment and the second designated moment is positive, obtain the contour similarity between the contour feature vector corresponding to the part to be matched and the contour feature vector corresponding to the target part.
[0137] In this embodiment, the product of the first specified moment and the second specified moment is positive, indicating that the part to be matched and the target part are not symmetrical parts, and the contour similarity between the contour feature vector corresponding to the part to be matched and the contour feature vector corresponding to the target part is obtained.
[0138] In this embodiment, the contour feature vector corresponding to the part to be matched is:
[0139] H I =[Hu1(C I ),Hu2(C I ),Hu3(C I ),Hu4(C I ),Hu5(C I ),Hu6(C I )];
[0140] Among them, Hu1(C I ),Hu2(C I ),Hu3(C I ),Hu4(C I ),Hu5(C I ),Hu6(C I ) are the first Hu invariant moment, the second Hu invariant moment, the third Hu invariant moment, the fourth Hu invariant moment, the fifth Hu invariant moment and the sixth Hu invariant moment corresponding to the parts to be matched.
[0141] The contour feature vector corresponding to the target part:
[0142] H T =[Hu1(C T ),Hu2(C T ),Hu3(C T ),Hu4(C T ),Hu5(C T ),Hu6(C T )];
[0143] Among them, Hu1(C T ),Hu2(C T ),Hu3(C T ),Hu4(C T ),Hu5(C T ),Hu6(C T ) are the first Hu invariant moment, the second Hu invariant moment, the third Hu invariant moment, the fourth Hu invariant moment, the fifth Hu invariant moment and the sixth Hu invariant moment corresponding to the target part respectively.
[0144] S223: When the contour similarity is greater than a preset contour similarity threshold, determine that the contours of the to-be-matched part match the contours of the target part.
[0145] In this embodiment, when H I With H T When the difference is small, the shape features of the two contours are considered to be similar. In contour similarity comparison, we can calculate H I With H T The L1 distance between I , H T ), the contour similarity is 1 / L1(H I , H T ); if 1 / L1(H I , H T ) is greater than the preset contour similarity threshold σ H , it is determined that the contours of the part to be matched match the contours of the target part. Otherwise, it is determined that the part to be matched does not match the contours of the target part.
[0146] S224, when the sizes of the part to be matched and the target part match and the contours of the part to be matched and the target part match, determine whether the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition.
[0147] In this embodiment, only when the size of the part to be matched matches that of the target part and the contour of the part to be matched matches that of the target part, will it be determined that the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions; the size and contour information are used simultaneously for matching judgment, thereby improving the accuracy of the matching judgment.
[0148] In this embodiment, a pre-trained visual base model is used as a global feature extractor. Due to its excellent performance in general computer vision tasks, it is considered to be one of the most advanced visual representation extractors. The architecture of this base model is based on the Vision Transformer (ViT) structure. In order to maintain the stability and consistency of the model, we freeze the base model skeleton network and mark its feature extractor as Φe.
[0149] The basic model adopts a self-supervised learning strategy and is trained on an unlabeled dataset through contrastive learning. By mapping data with the same distribution to the same feature space, the visual basic model can learn a robust image feature representation. Therefore, even if the to-be-matched part and the target part are placed at different angles, their image feature representations are still very similar.
[0150] Specifically, Figure 5 As shown in the figure, the image is first divided into fixed-size patches with patch dimensions of h (image length / patch size) and w (image width / patch size). These patches are fed into the ViT skeleton network to extract features, and the resulting tensor dimensions are (h,w,d), where d represents the feature dimension, which is related to the size of the Vision Transformer. Subsequently, the tensor of the patch embedding is compressed and averaged to be converted into a d-dimensional feature vector, denoted as GF (global Feature). This feature vector will participate in the similarity matching of global features.
[0151] In practical applications, local feature comparison can be performed for certain specific categories of parts. Thanks to the self-supervised learning strategy, the features of each patch can be directly compared with the features of the target patch without complicated preprocessing steps. These specific categories of parts are parts of specific categories that have passed or are extremely similar in size, shape, mirror flip, and global features. For example: parts with only slight differences in header materials, labels, text, etc.
[0152] These local features are segmented from the patch embedding. Each patch is split into a single feature vector of length d, represented as LF (Local Feature). Each feature vector is aligned with the original patch position and represents the features corresponding to each patch. All local features of the image are concatenated to restore the original patch embedding expression. In this regard, the global feature vector and local feature vector of the image to be matched can be extracted.
[0153] S300, when the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, the global features of the to-be-matched part image are segmented into a number of to-be-matched part local features, and the global features of the target part image are segmented into a number of target part local features; otherwise, it is determined that the to-be-matched part does not match the target part.
[0154] Furthermore, the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, including:
[0155] S310, obtaining the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part.
[0156] In this embodiment, for the global feature similarity comparison, we only need to compare the differences between the extracted global feature vectors.
[0157] The part global feature vector GF can be expressed using the cosine distance I and the global feature vector GF of the target part T The similarity GF sim , the formula is as follows:
[0158]
[0159] S320, when the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part is greater than a preset cosine similarity threshold, determine that the global features of the image of the part to be matched and the global features of the target part image meet the preset global feature matching conditions.
[0160] When GF sim Greater than the cosine similarity threshold σ GF When GF is equal to GF, it is determined that the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, and local feature similarity comparison is performed. sim Less than the cosine similarity threshold σ GF , the matching fails, the image of the part to be matched does not match the target part image in the database, and the algorithm ends.
[0161] S400, when the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions, determine that the part to be matched and the target part match; otherwise, determine that the part to be matched and the target part do not match.
[0162] Furthermore, the local features of the part to be matched and the local features of the target part meeting the preset local feature matching conditions may include the following steps:
[0163] S410, obtaining the maximum similarity and the minimum similarity among the similarities between each local feature of the to-be-matched part and each local feature of the target part.
[0164] In this embodiment, for a certain type of to-be-matched part, a simple global feature similarity matching cannot tell whether the to-be-matched part matches the target part successfully, so a local feature similarity comparison is required. The process is as follows: Figure 6 As shown, the local features extracted from ViT of the image of the part to be matched are compared with the local features extracted from ViT of the image of the target part. Each local feature vector of the part to be matched is compared with each local feature vector of the target part.
[0165] In this embodiment, since the number of feature vectors of the local patch is large and the dimension is high, this embodiment selects L2 distance instead of cosine similarity when comparing local feature similarities, because for high-dimensional vectors, the calculation speed of L2 distance is faster, thereby further improving the matching efficiency; it should be noted that those skilled in the art can use the existing L2 distance calculation method to calculate the maximum similarity and minimum similarity in the similarity between each local feature of the part to be matched and each local feature of the target part, which will not be elaborated here.
[0166] S411, when the minimum similarity is greater than a preset local feature similarity threshold, determining whether the local feature of the part to be matched and the local feature of the target part meet the preset local feature matching conditions.
[0167] In this embodiment, the minimum similarity is greater than the preset local feature similarity threshold, indicating that the minimum similarity of each local feature corresponding to the part to be matched is greater than the preset local feature similarity threshold, and it can be determined that the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions.
[0168] S412: When the maximum similarity is less than a preset local feature similarity threshold, it is determined that the local feature of the part to be matched and the local feature of the target part do not meet the preset local feature matching condition.
[0169] In this embodiment, the maximum similarity is less than the preset local feature similarity threshold, indicating that the maximum similarity of each local feature corresponding to the part to be matched is less than the preset local feature similarity threshold. It can be determined that the local features of the part to be matched and the local features of the target part do not meet the preset local feature matching conditions.
[0170] In the specific implementation, the variance σ of the distribution of each dimensional feature descriptor can be counted A , σ H , σ GF , σ LF These variances are directly used as thresholds to determine whether the feature description of each dimension matches the predetermined template feature distribution.
[0171] The method of this embodiment is significantly different from the existing method in multiple dimensions. Since the traditional visual algorithm is combined with the technology of the large visual base model, feature information of more dimensions can be obtained, including size, shape and semantic information. Therefore, a wider range of sample categories can be processed, thereby effectively solving the existing part matching problem.
[0172] Secondly, local feature vector matching is used to convert image units into finer patch units. This accuracy can accurately locate whether the features of each patch match the target features. Therefore, this method has better interpretability. For unmatched parts, it can clearly identify which part did not match successfully. Compared with previous algorithms, this method is not completely black box.
[0173] In addition, relying on the strong adaptability of large models, no additional model training is required, only feature engineering processing is required. This greatly saves time and resources. After experimental verification, the above method can be run on a single local graphics card.
[0174] The basic model-based part matching method of this embodiment will only obtain the global features of the image of the part to be matched and the global features of the target part image when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions; otherwise, it can be directly determined that the part to be matched and the target part do not match, so there is no need to perform a subsequent judgment process, and most of the unmatched target parts can be filtered out through this step; more refined local feature matching will be performed only when the global features of the image of the part to be matched and the global features of the target part image meet the preset global feature matching conditions; otherwise, it is directly determined that the part to be matched and the target part do not match, so that the part matching efficiency is higher; at the same time, local feature matching can match the local details of the parts to avoid missing the details of the parts, thereby improving the accuracy of part matching.
[0175] In an exemplary embodiment, a part matching device based on a basic model is provided, the device comprising:
[0176] The outline size information acquisition module is used to acquire the outline size information of the part to be matched and the outline size information of the target part; wherein the outline size information of the part to be matched is obtained based on the image of the part to be matched, and the outline size information of the target part is obtained based on the image of the target part.
[0177] A global feature acquisition module is used to acquire the global features of the image of the part to be matched and the global features of the target part image when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions; otherwise, it is determined that the part to be matched does not match the target part.
[0178] A local feature acquisition module is used to divide the global features of the part image to be matched into a number of local features of the part to be matched, and to divide the global features of the target part image into a number of local features of the target part, when the global features of the part image to be matched and the global features of the target part image meet the preset global feature matching conditions; otherwise, it is determined that the part to be matched does not match the target part.
[0179] The part matching judgment module is used to determine that the part to be matched matches the target part when the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions; otherwise, determine that the part to be matched does not match the target part.
[0180] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0181] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store at least one instruction or at least one program related to implementing a method in a method embodiment. The at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiment.
[0182] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0183] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0184] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0185] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. Figure 4The program code may execute entirely on the user's computing device, partially on the user's computing device, as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0186] See also Figure 5 An embodiment of the present invention further provides an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0187] The electronic device of this embodiment of the present application is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0188] The electronic device is presented in the form of a general-purpose computing device; components of the electronic device may include but are not limited to: at least one processor mentioned above, at least one storage device mentioned above, and a bus connecting different system components (including storage devices and processors).
[0189] The storage stores program codes, which can be executed by the processor, so that the processor executes the steps described in the above “exemplary method” section of this specification according to various exemplary embodiments of the present application.
[0190] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read only memory (ROM).
[0191] The storage may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0192] The bus may represent one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.
[0193] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device that enables the electronic device to communicate with one or more other computing devices (e.g., routers, modems, etc.). This communication may be performed through an input / output (I / O) interface. In addition, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RA identification systems, tape drives, and data backup storage systems, etc.
[0194] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0195] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.
[0196] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A parts matching method based on a basic model, characterized in that: The method comprises: Acquire the outline size information of the part to be matched and the outline size information of the target part; wherein the outline size information of the part to be matched is obtained according to the image of the part to be matched, and the outline size information of the target part is obtained according to the image of the target part; When the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition, the global features of the image of the part to be matched and the global features of the image of the target part are obtained; otherwise, it is determined that the part to be matched does not match the target part; In the case where the global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, the global features of the to-be-matched part image are segmented into a plurality of to-be-matched part local features, and the global features of the target part image are segmented into a plurality of target part local features; otherwise, it is determined that the to-be-matched part does not match the target part; When the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions, it is determined that the part to be matched matches the target part; otherwise, it is determined that the part to be matched does not match the target part.
2. The method for matching parts based on a basic model according to claim 1, characterized in that: The outline size information of the to-be-matched parts includes outline information of the to-be-matched parts and size information of the to-be-matched parts; The step of obtaining the outline dimension information of the parts to be matched includes: Determine the bounding box of the part to be matched according to the image of the part to be matched, and perform preset processing on the bounding box of the part to be matched to obtain a prompt corresponding to the bounding box of the part to be matched; Encoding the matching part image to obtain the image features to be matched corresponding to the image to be matched; Inputting the hints corresponding to the image features to be matched and the bounding boxes of the parts to be matched into a preset segmentation basic model to obtain a mask corresponding to the parts to be matched; The sum of the pixel areas corresponding to the target values in the mask corresponding to the part to be matched is determined as the size information of the part to be matched.
3. The method for matching parts based on a basic model according to claim 2, characterized in that: The step of obtaining the outline dimension information of the parts to be matched further includes: Obtaining the contour of the part to be matched in the image of the part to be matched; wherein the contour of the part to be matched includes a number of contour pixel points, and each round of contour pixel points corresponds to a pixel value; According to the position coordinates and pixel values corresponding to each contour pixel point, several different types of geometric moments corresponding to the contour of the part to be matched are determined; According to the several different types of geometric moments, a contour feature vector corresponding to the part to be matched is constructed, and the contour feature vector is determined as the contour information of the part to be matched.
4. The method for matching parts based on a basic model according to claim 3, characterized in that: The contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching conditions, including: Determine a first size corresponding to the part to be matched according to the size information of the part to be matched, and determine a second size corresponding to the target part according to the outline size information of the target part; determining the largest size of the first size and the second size as a target size; Determine the ratio of the difference between the first size and the second size to the target size as the size similarity between the part to be matched and the target part; When the size similarity is greater than a preset size similarity threshold, it is determined that the sizes of the to-be-matched part and the target part match; otherwise, it is determined that the to-be-matched part and the target part do not match.
5. The method for matching parts based on a basic model according to claim 4, characterized in that: The outline size information of the part to be matched and the outline size information of the target part meet the preset outline size matching condition and further include: Obtaining a first specified moment corresponding to the part to be matched and a second specified moment corresponding to the target part; wherein the first specified moment is used to characterize the symmetry of the part to be matched, and the second specified moment is used to characterize the symmetry of the target part; Obtaining the product of the first specified moment and the second specified moment; When the product of the first specified moment and the second specified moment is positive, obtaining the contour similarity between the contour feature vector corresponding to the part to be matched and the contour feature vector corresponding to the target part; When the contour similarity is greater than a preset contour similarity threshold, determining that the contours of the to-be-matched part and the target part match; When the sizes of the part to be matched and the target part match and the contours of the part to be matched and the target part match, it is determined that the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition.
6. The method for matching parts based on a basic model according to claim 1, characterized in that: The global features of the to-be-matched part image and the global features of the target part image meet the preset global feature matching conditions, including: Obtaining the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part; When the cosine similarity between the global feature vector of the part to be matched and the global feature vector of the target part is greater than a preset cosine similarity threshold, it is determined that the global features of the part image to be matched and the global features of the target part image meet the preset global feature matching conditions.
7. The method for matching parts based on a basic model according to claim 1, characterized in that: The local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions, including: Obtaining the maximum similarity and the minimum similarity between the local features of each to-be-matched part and the local features of each target part; When the minimum similarity is greater than a preset local feature similarity threshold, determining that the local feature of the part to be matched and the local feature of the target part meet the preset local feature matching conditions; When the maximum similarity is less than a preset local feature similarity threshold, it is determined that the local feature of the part to be matched and the local feature of the target part do not meet the preset local feature matching condition.
8. A parts matching device based on a basic model, characterized in that: The device comprises: A contour size information acquisition module, used to acquire contour size information of the to-be-matched part and contour size information of the target part; wherein the contour size information of the to-be-matched part is obtained according to the to-be-matched part image, and the contour size information of the target part is obtained according to the target part image; A global feature acquisition module, used to acquire the global features of the image of the part to be matched and the global features of the target part image when the contour size information of the part to be matched and the contour size information of the target part meet the preset contour size matching condition; otherwise, determine that the part to be matched does not match the target part; A local feature acquisition module, used for dividing the global features of the to-be-matched part image into a plurality of to-be-matched part local features, and dividing the global features of the target part image into a plurality of target part local features, when the global features of the to-be-matched part image and the global features of the target part image meet a preset global feature matching condition; otherwise, determining that the to-be-matched part does not match the target part; The part matching judgment module is used to determine that the part to be matched matches the target part when the local features of the part to be matched and the local features of the target part meet the preset local feature matching conditions; otherwise, determine that the part to be matched does not match the target part.
9. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the basic model-based parts matching method as described in any one of claims 1-7.
10. An electronic device, characterized in that: The method comprises a processor and the non-transitory computer-readable storage medium of claim 9.
Citation Information
Cited By
Three-dimensional part retrieval method based on self-supervised graph representation learning
CN122019822A
Similar CAD part searching method, system and equipment, medium and product
CN122489788A