Processing method, device and equipment based on visual positioning and storage medium
By performing image segmentation and feature point extraction on the reference image, the problem of low efficiency of manual positioning in traditional technology is solved, automatic and precise positioning is achieved, processing efficiency and adaptability are improved, and it is suitable for processing a variety of structural elements in complex scenes.
Patent Information
- Application Number
- CN202410728830.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Traditional processing and manufacturing technology relies on manual positioning, which results in low processing efficiency and cannot effectively improve processing efficiency.
Using a processing method based on visual positioning, the distribution area of structural elements is determined by image segmentation of the reference image, and feature points are extracted according to the preset positioning strategy to accurately indicate the location of the structural elements to be processed.
It achieves automatic identification and precise positioning, improves the efficiency and adaptability of processing, can accurately process a variety of structural elements in complex scenes, and significantly improves processing efficiency.
Smart Images

Figure CN118691674A
Abstract
Description
Technical Field
[0001] The present application relates to the field of processing and manufacturing technology, and in particular to a processing method, device, equipment and storage medium based on visual positioning. Background Art
[0002] With the advancement of processing and manufacturing technology, the replication of structures on processed objects has become feasible. The structure on a processed object can be copied to another object to be processed without building the structure from scratch, thereby significantly reducing the cost of processing and manufacturing.
[0003] In traditional technology, it is usually necessary to manually locate the structure on the processed object, and then use the processing equipment to replicate the structure. However, this method is too dependent on manual labor and cannot avoid the problem of low processing efficiency. Summary of the invention
[0004] The purpose of this application is to provide a processing method, device, equipment and storage medium based on visual positioning that can improve processing efficiency in response to the above-mentioned technical problems.
[0005] In a first aspect, the present application provides a processing method based on visual positioning, comprising:
[0006] Performing image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; an area in the reference image where there is a structural element of at least one category;
[0007] For each predicted category, determining a preset positioning strategy associated with a processing method of a structural element under the predicted category;
[0008] According to the preset positioning strategy, feature points are extracted from the distribution area corresponding to the predicted category; the feature points are used to indicate the position of the structural element to be processed.
[0009] In a second aspect, the present application also provides a processing device based on visual positioning, comprising:
[0010] A segmentation module, used to perform image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; an area in the reference image where there is a structural element of at least one category;
[0011] A determination module, for determining, for each prediction category, a preset positioning strategy associated with a processing method of a structural element under the prediction category;
[0012] A positioning module extracts feature points from a distribution area corresponding to the predicted category according to the preset positioning strategy; the feature points are used to indicate the position of the structural element to be processed.
[0013] In a third aspect, the present application further provides a processing device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method when executing the computer program.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when the computer program is executed by a processor.
[0015] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps in the above method when executed by a processor.
[0016] The above-mentioned processing method, device, equipment, medium and product based on visual positioning obtain the distribution area corresponding to each prediction category by performing image segmentation on the reference image; the area where there is a structural element under at least one category in the reference image can automatically identify the structural elements of different categories in the reference image, which is more efficient. In addition, since it is a targeted identification of each structural element, it can also adapt well to complex scenes with multiple structural elements, thereby improving adaptability. Then, for each prediction category, a preset positioning strategy related to the processing method of the structural element under the prediction category is determined; according to the preset positioning strategy, feature points are extracted from the distribution area corresponding to the prediction category, and the feature points of each structural element can be extracted in a targeted manner in combination with the processing method of each structural element. Therefore, the feature points can accurately indicate the position of the structural element to be processed, thereby accurately processing the structural element and improving the efficiency of processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic flow chart of a processing method based on visual positioning provided in this application.
[0018] Figure 2 A schematic diagram of three reference images provided for this application.
[0019] Figure 3 The present application provides a distribution area corresponding to each prediction category in three reference images.
[0020] Figure 4 A schematic diagram of a process for exposure fusion of three original images provided in this application.
[0021] Figure 5 A structural diagram of an image segmentation model provided in this application.
[0022] Figure 6 A simplified flowchart of a processing method based on visual positioning provided in this application.
[0023] Figure 7 A schematic diagram of a process for extracting feature points from a corresponding distribution area according to a preset positioning strategy corresponding to each prediction category provided in the present application.
[0024] Figure 8 A schematic diagram of the change in average intersection-over-union ratio during model training provided in this application.
[0025] Fig. 9 This is a structural block diagram of a processing device based on visual positioning provided in this application.
[0026] Fig.10 An internal structure diagram of a computer device provided for this application. DETAILED DESCRIPTION
[0027] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] It should be noted that all directional indications in the embodiments of the present application (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. The connection can be a direct connection or an indirect connection.
[0030] In addition, in this application, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0031] In some embodiments, Figure 1 As shown, it is a flowchart of a processing method based on visual positioning, which is described by taking the application of the method to a computer device as an example, and includes the following steps 102 to 106.
[0032] Step 102, performing image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; an area where a structural element of at least one category exists in the reference image.
[0033] Among them, categories are categories pre-divided for various structural elements. Structural elements refer to at least one of the basic components or features that constitute the shape, size, function or characteristics of the reference object. It can be understood that these structural elements jointly define the overall form and performance of the object according to a specific design and combination method. For example, the structural elements on the key jointly define the form and unlocking function of the key. The structural elements on the key may include at least one of inner milling grooves, flat teeth, outer grooves, holes, mother-and-child holes or annular grooves. The predicted category refers to the category predicted from each category for the area in the reference image. For example, in pixel-level segmentation tasks such as semantic segmentation or instance segmentation, the predicted category is the category predicted from each category for each pixel in the reference image. The distribution area corresponding to the predicted category refers to the area where each structural element under the predicted category is distributed.
[0034] Exemplarily, the computer device may perform pixel-level segmentation on the reference image to obtain distribution areas corresponding to each prediction category.
[0035] In some embodiments, the reference image is obtained based on an image captured from a reference object. The reference object refers to an object whose structural elements are to be copied. The reference object has structural elements under at least one category. It is understood that the structural elements under at least one category on the reference object are to be copied to the target object.
[0036] In some embodiments, the reference image may be a design drawing of the structural element.
[0037] In some embodiments, the computer device may perform semantic segmentation on the reference image to obtain distribution areas corresponding to each prediction category.
[0038] In some embodiments, the computer device may perform target detection on the reference image to obtain a target detection result. Pixel-level segmentation is performed based on the target detection result to obtain distribution areas corresponding to each predicted category. The pixel-level segmentation may be, but is not limited to, instance segmentation or semantic segmentation.
[0039] In some embodiments, the categories may be, but are not limited to, divided according to at least one of the form or function of the structural element. For example, for the reference object of a key, the categories such as inner milling groove, flat tooth, outer groove or hole may be divided.
[0040] In some embodiments, the categories may be, but are not limited to, divided according to the processing methods of the structural elements.
[0041] In some embodiments, the reference object may be, but is not limited to, a key, a mold, a badge, a medal, a craft, an industrial part or component, etc. There are different structural elements on the surface of the reference object, and by performing image segmentation on the reference image of the reference object, structural elements of different categories can be identified.
[0042] In some embodiments, the computer device may include at least one of a processing device, a terminal, or a server. The processing device may include at least one of a forging device, a welding device, a metal cutting machine tool, or a CNC machine. The CNC machine may include at least one of a CNC key machine, a CNC drilling machine, a CNC cutting machine, or a CNC milling machine. The terminal may include at least one of various personal computers, laptops, smart phones, tablet computers, Internet of Things devices, or portable wearable devices. The server may be implemented as an independent server or a server cluster consisting of multiple servers.
[0043] In some embodiments, the computer device may use an original image acquired for a reference object as a reference image.
[0044] In some embodiments, the computer device may acquire at least two original images captured for a reference object. The at least two original images are fused to obtain a reference image. The at least two original images may be images captured for the reference object under different image acquisition conditions. The different image acquisition conditions may be at least one of different image acquisition parameters or different environmental parameters.
[0045] In some embodiments, the computer device may encode the reference image to obtain the encoded features, and decode the encoded features to obtain the distribution areas corresponding to the prediction categories.
[0046] In some embodiments, the coding features may include shallow features and deep features. Shallow features pay more attention to local details of the reference image, such as at least one of edges or textures, compared to deep features, and these local details can be captured at the shallow level. Shallow features are actually shallow detail features. Deep features pay more attention to the abstract and global information of the reference image than shallow features. Deep features are actually deep semantic features. The computer device can perform fusion processing based on the deep features and shallow features to obtain fused features. Pixel-level segmentation is performed based on the fused features to obtain the distribution areas corresponding to each predicted category.
[0047] In some embodiments, the computer device may further extract the deep features to obtain semantic features, and fuse the shallow features and the semantic features to obtain fused features.
[0048] In some embodiments, the computer device may perform feature extraction at different scales on the deep features to obtain semantic features at each scale.
[0049] In some embodiments, the computer device may extract features at different scales from the shallow features to obtain detail features at each scale. The detail features and semantic features at the same scale are preliminarily fused to obtain preliminary fused features at each scale. The preliminary fused features at each scale are further fused to obtain fused features.
[0050] In some embodiments, the computer device may perform target detection on the reference image to obtain a target detection result, and perform pixel-level segmentation according to the target detection result to obtain distribution areas corresponding to each prediction category.
[0051] In some embodiments, the computer device may perform instance segmentation on the target detection result to obtain the distribution area corresponding to each predicted category. It can be understood that instance segmentation is pixel-level segmentation.
[0052] In some embodiments, the computer device may use the reference image as the input of the image segmentation model to obtain the image segmentation result output by the image segmentation model. The image segmentation model may be, but is not limited to, a semantic segmentation model or a target detection model. The image segmentation result is used to characterize the distribution area corresponding to each prediction category. For example, the image segmentation result may be, but is not limited to, an image mask corresponding to each prediction category, and the position of the non-zero pixel in the image mask is the distribution area corresponding to the prediction category.
[0053] In some embodiments, the target detection model may include a target detection network for implementing a target detection task and a segmentation network for implementing a pixel-level segmentation task. The segmentation network may be, but is not limited to, an instance segmentation network.
[0054] In some embodiments, the target detection model may be, but is not limited to, a You Only Look Once (YOLO) detection model. The segmentation function in the YOLO detection model may be used to implement pixel-level segmentation to obtain distribution areas corresponding to each predicted category.
[0055] In some embodiments, the semantic segmentation model may be, but is not limited to, a segmentation network model such as U-Net, SegNet, or Pyramid Scene Parsing Network (PSPNet).
[0056] In some embodiments, Figure 2 As shown in Figure 2, a schematic diagram of three reference images is provided. Figure 3 As shown, the distribution areas corresponding to each prediction category in three reference images are provided.
[0057] The reference image 202 is segmented to obtain distribution areas 302 corresponding to the prediction categories. The key body presented in the reference image 202 includes one structural element under the inner milling groove category and five structural elements under the hole category. The distribution areas 302 corresponding to the prediction categories indicate the area where one structural element under the inner milling groove category and five structural elements under the hole category are distributed in the reference image 202.
[0058] The reference image 204 is segmented to obtain distribution areas 304 corresponding to the prediction categories. The key body presented in the reference image 204 includes three structural elements under the inner milling groove category. The distribution areas 304 corresponding to the prediction categories indicate the areas where the three structural elements under the inner milling groove category in the reference image 204 are distributed.
[0059] The reference image 206 is segmented to obtain distribution areas 306 corresponding to the prediction categories. The key body presented in the reference image 206 includes three structural elements under the inner milling groove category. The distribution areas 306 corresponding to the prediction categories indicate the areas where the three structural elements under the inner milling groove category in the reference image 206 are distributed.
[0060] Step 104 : for each predicted category, determine a preset positioning strategy related to a processing method of a structural element under the predicted category.
[0061] Exemplarily, different preset positioning strategies are pre-set for different categories. That is, each category has a corresponding preset positioning strategy. It can be understood that the preset positioning strategy corresponding to the prediction category is the preset positioning strategy related to the processing method of the structural element under the prediction category. The computer device can determine the preset positioning strategy corresponding to each prediction category from the preset positioning strategies.
[0062] Step 106 , extracting feature points from the distribution area corresponding to the predicted category according to a preset positioning strategy; the feature points are used to indicate the position of the structural element to be processed.
[0063] Exemplarily, the computer device may extract feature points from the distribution area corresponding to each prediction category according to the preset positioning strategy corresponding to the prediction category. It can be understood that the feature points are actually the feature points of each structural element under the prediction category.
[0064] In some embodiments, the characteristic point of the structural element is used to indicate the position of the cutting on the target object by the processing equipment when processing the structural element. The characteristic point of the structural element may include the cutting point on the target object when the processing equipment processes the structural element. The cutting point may be the starting point of the cutting. It can be understood that for structural elements of different categories, the processing methods are different, and the cutting points of the processing equipment are also different when processing structural elements of different categories.
[0065] In some embodiments, the preset positioning strategy corresponding to the category can be used to indicate the relative position relationship between the feature point corresponding to the structural element under the category and the distribution area of the structural element. For example, for the object of a key, the category may include holes. The feature point of the hole may be, but is not limited to, the center of the hole. That is, the feature point corresponding to the structural element under the category of holes may be, but is not limited to, the center of the distribution area of the structural element. The category may also include inner milling grooves, and the feature point of the inner milling groove may be, but is not limited to, located at one end of the inner milling groove. For example, the feature point of the inner milling groove is the center point of the bottom of the inner milling groove. The bottom of the inner milling groove refers to the end of the inner milling groove closer to the end of the key. The end of the key is the end inserted into the lock core. For example, for the object of a mortise and tenon structure workpiece, the category may include tenons. The feature point of the tenon may be, but is not limited to, the center of the tenon. That is, the feature point corresponding to the structural element under the category of tenons may be, but is not limited to, the center of the distribution area of the structural element.
[0066] In some embodiments, the preset positioning strategy corresponding to the category is used to indicate the determination of the feature points and quantity of each structural element. The computer device can determine the number of structural elements under each prediction category according to the preset positioning strategy corresponding to the prediction category, and extract the feature points from the corresponding distribution area.
[0067] In some embodiments, the computer device may determine, for each structural element under each prediction category, a feature point from within a distribution area of the structural element according to a relative position relationship corresponding to the prediction category. The relative position relationship corresponding to the prediction category refers to a relative position relationship between a feature point corresponding to the structural element under the prediction category and the distribution area of the structural element.
[0068] In some embodiments, the computer device can extract the image coordinates of the feature points from the corresponding distribution area according to the preset positioning strategy corresponding to each prediction category. The image coordinates of the feature points are used to indicate the position of the feature points in the reference image. Specifically, the coordinates of the pixel points projected by the feature points in the image can be used as the image coordinates of the feature points. The computer device can perform coordinate conversion on the image coordinates of the feature points according to the calibration data to obtain the target coordinates of the feature points in the target coordinate system. The target coordinate system can be a coordinate system constructed based on the processing equipment. The target coordinates are used to indicate the position of the feature points relative to the processing equipment. In the case of processing the target object, the target object is placed on the processing equipment, and then the target coordinates of the feature points are used to indicate the structural elements under the prediction category to be processed on the target object. It should be noted that the calibration method for obtaining the calibration data is not limited in this embodiment.
[0069] In some embodiments, the target coordinate system may be constructed based on a device on a processing device for fixing an object to be processed. Specifically, the target coordinate system may be, but is not limited to, constructed based on a fixture. It is understood that by converting the image coordinates of each structural element feature point into the target coordinates on the fixture, the structural element can be intuitively and accurately indicated to the processing device.
[0070] In some embodiments, the computer device may mark the distribution area and feature points of the structural element on the reference image to obtain the target image.
[0071] In the above-mentioned processing method based on visual positioning, the reference image is segmented to obtain the distribution areas corresponding to each prediction category; the area where there is a structural element under at least one category in the reference image can automatically identify the structural elements of different categories in the reference image, which is more efficient. Moreover, since it is a targeted identification of each structural element, it can also adapt well to complex scenes with multiple structural elements, thereby improving adaptability. Then, for each prediction category, a preset positioning strategy related to the processing method of the structural elements under the prediction category is determined; according to the preset positioning strategy, feature points are extracted from the distribution area corresponding to the prediction category, and the feature points of each structural element can be extracted in a targeted manner in combination with the processing method of each structural element. Therefore, the feature points can accurately indicate the position of the structural element to be processed, thereby accurately processing the structural element and improving the efficiency of processing.
[0072] In some embodiments, the method further includes: acquiring at least two original images with different exposure conditions collected for the reference object; and performing exposure fusion on the at least two original images to obtain a reference image.
[0073] In some embodiments, the reference object may have reflective properties. When capturing an image of the reference object, the reflective properties of the reference object may cause overexposure in the image, which in turn may cause loss of details of the reference object in the image. For example, metal keys or glass workpieces have strong reflective properties, which often result in overexposure of the image. In order to avoid loss of details in the image, the original image captured for the reference object is not used directly, but a reference image obtained by fusion of the original images is used. The exposure level of the reference image is lower than that of the original image.
[0074] In some embodiments, the computer device may acquire at least two original images taken of a reference object under different lighting conditions.
[0075] In some embodiments, the computer device may obtain at least two original images taken for the reference image under different exposure parameters. The exposure parameter is a parameter used to adjust the exposure of the image acquisition device. The image acquisition device may be, but is not limited to, a camera.
[0076] In some embodiments, the details of the reference object in the reference image are greater than the details of the reference object in the original image.
[0077] In some embodiments, the computer device may acquire at least three original images acquired with different exposure conditions for the reference object.
[0078] In some embodiments, the computer device may perform weighted fusion on at least two original images to obtain a reference image.
[0079] In some embodiments, the sizes of the original images are the same, and the pixel positions in the original images correspond one to one. The computer device can determine the contrast weight, saturation weight, and brightness weight corresponding to each pixel position in the original image for each original image. The weight corresponding to each pixel position in each original image is normalized to obtain the normalized contrast weight, saturation weight, and brightness weight corresponding to each pixel position. Using the normalized contrast weight, saturation weight, and brightness weight corresponding to each pixel position, the pixel values at the pixel position in each original image are weighted fused to obtain a reference image.
[0080] In some embodiments, the computer device can use Laplace filtering to calculate the contrast of the original image and assign a larger contrast weight to pixels at the edge and texture. Saturation is measured by calculating the standard deviation between different color channels. The larger the standard deviation, the higher the saturation, and a larger saturation weight is assigned to the corresponding pixel. By normalizing the brightness value of the pixel, a smaller brightness weight is assigned to pixels whose normalized brightness value is closer to 0 or 1, and a larger brightness weight is assigned to pixels whose normalized brightness value is closer to 0.5.
[0081] In some embodiments, the computer device may perform multi-scale decomposition on each original image to obtain decomposition results of different scales corresponding to each original image, and fuse the decomposition results corresponding to different original images at the same scale to reconstruct a reference image.
[0082] In some embodiments, the computer device may use an exposure fusion algorithm to perform exposure fusion on at least two original images to obtain a reference image.
[0083] In some embodiments, Figure 4 As shown, a flow chart of exposure fusion of three original images is provided. The reference object may be a reference key. At least part of the key is presented in both the original image and the reference image. The three original images have different exposure levels, and the key details in the reference image obtained after exposure fusion are more and clearer.
[0084] In this embodiment, at least two original images with different exposure conditions collected for a reference object are obtained; exposure fusion is performed on the at least two original images to obtain a reference image. Through exposure fusion, the problem of loss of details due to overexposure of the image can be avoided, the accuracy of the image is guaranteed, and the accuracy of the processing is further improved.
[0085] In some embodiments, image segmentation is performed on the reference image to obtain distribution areas corresponding to each prediction category, including: encoding the reference image to obtain shallow features and deep features; performing feature extraction at different scales on the deep features to obtain semantic features at each scale; fusing the shallow features with the semantic features at each scale to obtain fused features; and performing image segmentation based on the fused features to obtain distribution areas corresponding to each prediction category.
[0086] In some embodiments, the computer device can use the reference image as an input to the encoder to obtain shallow features and deep features output by the encoder. The encoder can be, but is not limited to, a residual network (Residual Network, ResNet), a lightweight convolutional neural network (MobileNet) focused on mobile terminals or embedded devices, or a deep convolutional neural network (Deep Convolutional Networks, DCNN), etc.
[0087] In some embodiments, the computer device may perform hole convolution and parallel sampling of different resolutions on the deep network to obtain semantic features at various scales. The semantic features at various scales may be initially fused to obtain initial fused features. The shallow features may be advancedly fused with the initial fused features to obtain fused features.
[0088] In some embodiments, the computer device may connect or merge the semantic features at each scale along the channel dimension to obtain a merged semantic feature. The merged semantic feature is convolved to allow features of different channels to be fused to obtain a primary fused feature.
[0089] In some embodiments, the computer device may perform a convolution operation on the shallow features so that the number of channels of the shallow features matches the number of channels of the primary fusion features for easy fusion. Since the resolution of the shallow features is higher than that of the primary fusion features, the computer device may upsample the primary fusion features so that the resolution of the upsampled primary fusion features matches the resolution of the shallow features. Afterwards, the primary fusion features and the shallow features are concatenated along the channel dimension to obtain fusion features.
[0090] In some embodiments, a convolution operation is performed on the fused features to further achieve feature fusion in the spatial dimension and the channel dimension to obtain a target feature. The target feature is upsampled to obtain distribution areas corresponding to each prediction category.
[0091] In some embodiments, the computer device may upsample the target feature to obtain a category probability distribution for each pixel in the reference image. The category probability distribution of the pixel includes the predicted probability corresponding to the pixel in each category. The predicted category of each pixel is determined according to the category probability distribution of each pixel to obtain the distribution area corresponding to each predicted category.
[0092] In some embodiments, the predicted category of a pixel only needs to have the highest corresponding predicted probability in the category probability distribution of the pixel.
[0093] In some embodiments, the predicted category of the pixel has the highest predicted probability in the category probability distribution of the pixel, and the predicted probability corresponding to the predicted category of the pixel satisfies the prediction accuracy condition. The prediction accuracy condition may be, but is not limited to, that the predicted probability is not less than a preset probability threshold or that the predicted probability is within a preset probability interval.
[0094] In some implementations, the image segmentation model may include an encoder, an Atrous Spatial Pyramid pooling (ASPP) unit, and a decoder. The computer device may input a reference image into the image segmentation model, obtain shallow features and deep features output by the encoder, and input the deep features into the Atrous Spatial Pyramid pooling unit to obtain preliminary fusion features. The preliminary fusion features and shallow features are input into the decoder to obtain the category probability distribution of each pixel in the reference image.
[0095] In some embodiments, the encoder may be, but is not limited to, a lightweight convolutional neural network version 2 (MobileNetV2) focused on mobile or embedded devices.
[0096] In some embodiments, the decoder may be, but is not limited to, a Deep Semantic Segmentation Network Version 3+ (DeepLabv3+).
[0097] In some embodiments, Figure 5 As shown, a structural schematic diagram of an image segmentation model is provided. At least part of the reference key is presented in the reference image. The reference image is input into the image segmentation model, and firstly, it is encoded by the encoder to obtain shallow features and deep features. The deep features are input into the dilated space pyramid pooling unit, and after multiple parallel dilated convolution branches with different sampling rates in the dilated space pyramid unit, namely, 1*1 convolution, 3*3 convolution, 3*3 convolution, 3*3 convolution, and global average pooling branches, the semantic features at each scale output by each branch are obtained. These semantic features at each scale are initially fused by 1*1 convolution to obtain initial fused features. The initial fused features and the shallow features are input into the decoder, and the shallow features are subjected to 1*1 convolution. After the initial fused features are upsampled, the two are merged and connected to achieve advanced fusion and obtain fused features. The fused features are subjected to 3*3 convolution to achieve feature fusion in the spatial dimension and channel dimension to obtain the target features. After upsampling, the target features can obtain the distribution areas corresponding to each prediction category.
[0098] In some embodiments, Figure 6 As shown, a simple flow chart of a processing method based on visual positioning is provided. The three original images are subjected to exposure fusion and image preprocessing to obtain a reference image. The reference image is segmented by image segmentation model prediction to obtain the distribution areas corresponding to each prediction category. The image coordinates and target coordinates of the feature points are calculated based on the distribution areas corresponding to each prediction category. The structural elements are marked in the reference image according to the distribution areas corresponding to each prediction category, and the feature points of the structural elements are marked in the reference image according to the image coordinates of the feature points to obtain the target image. The target coordinates are sent to the processing equipment to indicate the position of the feature points relative to the processing equipment.
[0099] In this embodiment, the reference image is encoded to obtain shallow features and deep features, wherein the shallow features focus more on details and the deep features focus more on semantics; feature extraction at different scales is performed on the deep features to obtain semantic features at each scale to capture comprehensive image semantics; the shallow features are then fused with the semantic features at each scale to achieve fusion of image details and image semantics to obtain richer fused features; image segmentation is then performed based on the fused features to obtain accurate distribution areas corresponding to each prediction category.
[0100] In some embodiments, the computer device may divide the distribution area corresponding to each predicted category into sub-areas where each structural element is distributed according to the morphological features of the structural element under the predicted category.
[0101] In some embodiments, the distribution area corresponding to the predicted category includes a sub-area where each structural element under the predicted category is distributed; feature points are extracted from the distribution area corresponding to the predicted category according to a preset positioning strategy, including: for each structural element under the predicted category, feature points of the structural element are extracted from the sub-area where each structural element is distributed according to a preset positioning strategy.
[0102] In some embodiments, feature points are extracted from the distribution area corresponding to the prediction category according to a preset positioning strategy, including: performing contour detection on the distribution area corresponding to the prediction category to obtain a contour detection result; the contour detection result is used to characterize the sub-area in which each structural element under the prediction category is distributed; for each structural element under the prediction category, extracting feature points of the structural element from the sub-area in which the structural element is distributed according to the preset positioning strategy.
[0103] Exemplarily, the computer device may perform contour detection on the distribution area corresponding to each prediction category to obtain the contour of each structural element under the prediction category, that is, the contour detection result. For each structural element under each prediction category, a feature point is determined from the sub-area where the structural element is distributed according to the relative position relationship corresponding to the prediction category.
[0104] In some embodiments, the computer device may preprocess the distribution area corresponding to each prediction category, and perform contour detection on the preprocessing result. The preprocessing may include expansion and corrosion, etc. Further, the computer device may filter each contour in the contour detection result to obtain contours that meet the morphological characteristics of the structural elements under the prediction category, and these filtered contours are the contours of each structural element under the prediction category.
[0105] In some embodiments, the computer device may count the number of structural elements under the predicted category from the contour detection result.
[0106] In some embodiments, the computer device may use a contour extraction algorithm to extract contours of each structural element under each prediction category from the distribution areas corresponding to each prediction category. It should be noted that the contour extraction algorithm is not limited in this embodiment.
[0107] In this embodiment, contour detection is performed based on the distribution area corresponding to the predicted category to obtain a contour detection result; the contour detection result is used to characterize the sub-area in which each structural element under the predicted category is distributed; for each structural element under the predicted category, the characteristic points of the structural element are extracted from the sub-area in which the structural element is distributed according to a preset positioning strategy, and the sub-area in which each structural element under the predicted category is distributed can be further distinguished through contour detection, thereby accurately extracting the characteristic points of each structural element, thereby improving the processing efficiency.
[0108] In some embodiments, the computer device may send the feature points of each structural element to the processing device to instruct the processing device to process the target object according to the feature points to obtain the processed target object.
[0109] In some embodiments, Figure 7 As shown, a flow chart of extracting feature points from the corresponding distribution area according to the preset positioning strategy corresponding to each prediction category is provided. Contour detection is performed on the distribution area corresponding to each prediction category to obtain the contour detection result. Among them, the distribution area corresponding to each prediction category is the area where one structural element under the inner milling groove category and five structural elements under the hole category are distributed, that is, the distribution area corresponding to each prediction category includes an inner milling groove and an area where five holes are distributed. The contour detection result is used to characterize the sub-area where each structural element is distributed under the prediction category. Through contour detection, the distribution area corresponding to each prediction category can be further divided into a sub-area where one structural element under the inner milling groove category is distributed, and a sub-area where five structural elements under the hole category are distributed. The contour detection result actually indicates a sub-area where an inner milling groove is distributed, and a sub-area where five holes are distributed. The image coordinates of the feature points are extracted from the sub-area where the structural elements are distributed according to the preset positioning strategy corresponding to the prediction category. The image coordinates are converted into target coordinates according to the calibration data and sent to the CNC key machine. The image coordinates of the feature points of each structural element are marked in the reference image to obtain the target image. Among them, the characteristic points of a structural element under the inner milling groove category are marked with a “+” with a lower grayscale in the target image, and the characteristic points of five structural elements under the hole category are marked with a “+” with a higher grayscale in the target image.
[0110] In some embodiments, a processing method based on visual positioning is applied to a processing device; the method also includes: determining a target object fixed on the processing device; locating a structural element to be processed on the target object according to a feature point; processing the target object based on a processing method of the structural element to be processed to obtain a processed target object. Exemplarily, there is a device for fixing the target object on the processing device, and this fixing device can be but is not limited to a fixture. The processing device can determine the target object fixed on the local device. The cutting point is determined according to the target coordinates of the feature point of the structural element to locate the structural element to be processed on the target object. It can be understood that the position of the feature point of the structural element is the position of the cutting point. Then, the processing device can cut the target object based on the cutting method of the structural element to be processed, starting from the target coordinates of the feature point, so as to process the structural element on the target object.
[0111] In some embodiments, the processing equipment may be deployed with an image segmentation model.
[0112] In some embodiments, the processing equipment may be, but is not limited to, a CNC key machine.
[0113] In this embodiment, a processing method based on visual positioning is applied to a processing equipment, and the processing equipment can automatically extract feature points to determine a target object fixed on the processing equipment; locate the structural elements to be processed on the target object according to the feature points; and process the target object based on a processing method of the structural elements to be processed to obtain a processed target object. The processed target object has structural elements under each predicted category, thereby realizing automatic processing of structural elements under each category in the reference image onto the target object. Without manual operation, the structural elements in the reference image can be processed onto the target object, thereby improving the processing efficiency.
[0114] In some embodiments, image segmentation is performed on the reference image to obtain distribution areas corresponding to each prediction category, including: image segmentation is performed on the reference image based on an image segmentation model to obtain distribution areas corresponding to each prediction category; wherein the image segmentation model is obtained by lightweighting the initial model; the initial model is obtained based on sample image training; and the sample image includes a marked area corresponding to the category.
[0115] Exemplarily, the image segmentation model is obtained by training the training end based on the sample image. The training end may include at least one of a terminal or a server. It is understandable that the training end may also be a processing device, and the image segmentation model is directly trained in the processing device. The sample image is obtained by collecting initial images with different exposure conditions for each sample object, performing exposure fusion and normalization on the initial images with different exposure conditions, and then performing pixel-level annotation. The sample object may be, but is not limited to, a sample key.
[0116] The training end may perform data enhancement on the sample image. The data enhancement may include at least one of flipping the sample image, modifying contrast and brightness, Gaussian blurring, rotating, or color gamut conversion.
[0117] The training end can use the sample images after data enhancement to train the training model to obtain the initial model. The training method is a combination of freezing and unfreezing training. Figure 8 As shown in Figure 1, a schematic diagram of the change in the average intersection over union ratio during model training is provided. The model can achieve the best training effect with an average intersection over union ratio (MIOU) exceeding 82 after only 100 epochs of training.
[0118] The training end can perform at least one of pruning or quantization on the initial model to obtain a lightweight image segmentation model. For example, the training end can use model pruning technology to prune the initial model. The pruned model can reduce the number of model parameters and computational complexity by half when the segmentation accuracy meets the stability condition. The segmentation accuracy that meets the stability condition means that the segmentation accuracy remains almost unchanged. The stability condition may be, but is not limited to, that the change in segmentation accuracy is not greater than a preset change, or is within a preset change range. Use model quantization technology to convert the pruned floating-point model into an integer model to obtain an image segmentation model. The integer model may be, but is not limited to, an 8-bit integer (INT8) model. The image segmentation model is deployed on the processing equipment, and the central processing unit on the processing equipment is used for inference.
[0119] In some embodiments, the training end may adjust the size of the sample image to match the input dimension of the model to be trained before performing data augmentation.
[0120] In some embodiments, the reference object and the sample object in the sample image are objects of the same type, for example, the sample object may be a sample key, the reference object may be a reference key, and the target object may be a target key.
[0121] In this embodiment, the reference image is segmented based on the image segmentation model to obtain the distribution areas corresponding to the prediction categories; wherein the image segmentation model is obtained by lightweighting the initial model; the initial model is obtained by training based on the sample image; the sample image includes the marked area corresponding to the category, and the image segmentation model can be used for accurate reasoning to obtain the distribution areas corresponding to the prediction categories, thereby improving the efficiency of processing.
[0122] In some embodiments, the reference image includes at least a portion of the reference key; the category refers to the structural category on the key body, including at least one of an inner milling groove, a flat tooth, an outer groove, a hole, a mother-and-child hole, or an annular groove. The key body includes structural elements necessary to realize the key function, and these structural elements work together to enable the key to interact with the lock to realize the unlocking function.
[0123] In some embodiments, a CNC key machine is deployed with a semantic segmentation model. The CNC key machine can collect three original images for a reference key under different exposure conditions. The different exposure conditions can be different lighting conditions or different camera exposure parameter conditions. The same key body area of the same reference key is presented in the three original images. The three original images are subjected to exposure fusion and normalization to obtain a reference image. The reference image is semantically segmented based on the semantic segmentation model to obtain a category probability distribution of each pixel. The category probability distribution of the pixel includes the predicted probability corresponding to each category of the pixel. The predicted category of each pixel is determined according to the category probability distribution of each pixel to obtain the distribution area corresponding to each predicted category. Contour detection is performed on the distribution area corresponding to each predicted category to further segment the structural elements under each predicted category to obtain a contour detection result. The contour detection result indicates the sub-area of each structural element distribution under each predicted category. The preset positioning strategy related to the processing method of the structural element under each predicted category is determined to obtain the preset positioning strategy corresponding to the predicted category. The preset positioning strategy is used to indicate the relative position relationship between the feature point and the structural element of the structural element under the predicted category. The CNC key machine can extract the image coordinates of the feature points that meet the above relative position relationship from the sub-area where the structural element is distributed for each structural element under each prediction category. The image coordinates are converted into target coordinates according to the calibration data. The coordinate system of the target coordinates can be, but is not limited to, a coordinate system established for the fixture on the CNC key machine. The fixture is used to fix the key. The CNC key machine can determine the target key fixed on the fixture, locate the structural element to be processed on the target key according to the target coordinates of the feature points of the structural element, and then process the target key based on the processing method of the structural element to be processed to obtain the processed target key. The processed target key has the structural elements under each prediction category.
[0124] It should be understood that, although the various steps in the flowcharts in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, the various steps in the flowcharts are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts in the above-mentioned embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0125] Based on the same inventive concept, the embodiment of the present application also provides a processing device based on visual positioning for implementing the processing method based on visual positioning. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more processing device embodiments based on visual positioning provided below can refer to the limitations of the processing method based on visual positioning above, and will not be repeated here.
[0126] In some embodiments, Fig. 9 As shown, a processing device 900 based on visual positioning is provided, including: a segmentation module 902, a determination module 904 and a positioning module 906.
[0127] The segmentation module 902 is used to perform image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; the reference image has an area where a structural element of at least one category exists.
[0128] The determination module 904 is used to determine, for each prediction category, a preset positioning strategy related to a processing method of a structural element under the prediction category.
[0129] The positioning module 906 is used to extract feature points from the distribution area corresponding to the predicted category according to a preset positioning strategy; the feature points are used to indicate the position of the structural element to be processed.
[0130] In some embodiments, the segmentation module 902 is used to obtain at least two original images with different exposure conditions collected for a reference object; and perform exposure fusion on the at least two original images to obtain a reference image.
[0131] In some embodiments, the segmentation module 902 is used to encode the reference image to obtain shallow features and deep features; extract features of different scales on the deep features to obtain semantic features at each scale; fuse the shallow features with the semantic features at each scale to obtain fused features; and perform image segmentation based on the fused features to obtain distribution areas corresponding to each prediction category.
[0132] In some embodiments, the positioning module 906 is used to perform contour detection based on the distribution area corresponding to the predicted category to obtain a contour detection result; the contour detection result is used to characterize the sub-area in which each structural element under the predicted category is distributed; for each structural element under the predicted category, the characteristic points of the structural element are extracted from the sub-area in which the structural element is distributed according to a preset positioning strategy.
[0133] In some embodiments, the positioning module 906 is used to determine a target object fixed on a processing device; locate a structural element to be processed on the target object according to feature points; and process the target object based on a processing method of the structural element to be processed to obtain a processed target object.
[0134] In some embodiments, the segmentation module 902 is used to perform image segmentation on the reference image based on an image segmentation model to obtain distribution areas corresponding to each predicted category; wherein the image segmentation model is obtained by lightweighting the initial model; the initial model is obtained based on sample image training; and the sample image includes a marked area corresponding to the category.
[0135] For the specific definition of the processing device based on visual positioning, please refer to the definition of the processing method based on visual positioning above, which will not be repeated here. Each module in the above-mentioned processing device based on visual positioning can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0136] In one embodiment, a computer device is provided. The computer device may be a processing device, and its internal structure diagram may be as shown in FIG. Fig.10As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a processing method based on visual positioning is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0137] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0138] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.
[0139] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments are implemented.
[0140] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.
[0141] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes in the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0142] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A processing method based on visual positioning, characterized in that: The method comprises: Performing image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; an area in the reference image where there is a structural element of at least one category; For each predicted category, determining a preset positioning strategy associated with a processing method of a structural element under the predicted category; According to the preset positioning strategy, feature points are extracted from the distribution area corresponding to the predicted category; the feature points are used to indicate the position of the structural element to be processed.
2. The method according to claim 1, characterized in that The method further comprises: Acquire at least two original images acquired with different exposure conditions for a reference object; Exposure fusion is performed on the at least two original images to obtain a reference image.
3. The method according to claim 1, characterized in that: The image segmentation is performed on the reference image to obtain the distribution areas corresponding to the prediction categories, including: Encode the reference image to obtain shallow features and deep features; Extract features at different scales from deep features to obtain semantic features at each scale; Fusing the shallow features with the semantic features at each scale to obtain fused features; Image segmentation is performed according to the fusion features to obtain distribution areas corresponding to each prediction category.
4. The method according to claim 1, characterized in that: The extracting feature points from the distribution area corresponding to the predicted category according to the preset positioning strategy includes: Performing contour detection according to the distribution area corresponding to the predicted category to obtain a contour detection result; the contour detection result is used to characterize the sub-area of each structural element distribution under the predicted category; For each structural element under the prediction category, feature points of the structural element are extracted from the sub-region where the structural element is distributed according to the preset positioning strategy.
5. The method according to claim 1, characterized in that Applied to processing equipment; The method further comprises: Determining a target object fixed on the processing equipment; Positioning the structural element to be processed on the target object according to the feature point; The target object is processed based on the processing method of the structural element to be processed to obtain a processed target object.
6. The method according to claim 1, characterized in that The image segmentation is performed on the reference image to obtain the distribution areas corresponding to the prediction categories, including: The reference image is segmented based on an image segmentation model to obtain distribution areas corresponding to each prediction category; wherein the image segmentation model is obtained by lightweighting the initial model; the initial model is obtained based on sample image training; and the sample image includes a marked area corresponding to the category.
7. The method according to any one of claims 1 to 6, characterized in that: The reference image includes at least a partial area of the reference key; the category refers to the structural category on the key body, including at least one of an inner milling groove, a flat tooth, an outer groove, a hole, a mother-and-child hole, or an annular groove.
8. A processing device based on visual positioning, characterized in that: The device comprises: A segmentation module, used to perform image segmentation on the reference image to obtain distribution areas corresponding to each prediction category; an area in the reference image where there is a structural element of at least one category; A determination module, for determining, for each prediction category, a preset positioning strategy associated with a processing method of a structural element under the prediction category; A positioning module extracts feature points from a distribution area corresponding to the predicted category according to the preset positioning strategy; the feature points are used to indicate the position of the structural element to be processed.
9. A processing device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Multiple-exposure image fusion method and device
CN103247036A
Methods and systems for data collection, learning, and streaming of machine signals for analytics and maintenance using the industrial internet of things
CN112703457A
Processing method based on visual guidance and related device
CN115090960A
Gray fabric defect positioning and classifying method, system and equipment and storage medium
CN115731220A
Region identification method and device, computer equipment and computer readable storage medium
CN116051811A
