Tool wear degree detection method, device, computer equipment and storage medium
Through the optimization of the loss function of manifold structure and color matching, the color consistency between the target image and the source image in the tool wear degree detection method is achieved, and the problem of large time-consuming and low accuracy of color mapping in the prior art is solved, which improves wear Accuracy and efficiency of detection.
Patent Information
- Application Number
- CN202310758664.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2043-06-25
AI Technical Summary
The existing tool wear degree detection methods have problems such as large time consumption and image information loss during the color mapping process, resulting in low detection accuracy.
By obtaining the matching points after registration of the target image and the source image, a manifold structure is constructed, and color mapping is used to optimize the loss function to determine the optimal solution and achieve the color consistency between the target image and the source image , and the structural similarity is calculated for the segmented images to measure the degree of wear.
It reduces calculation time, reduces image information loss, improves the accuracy of wear degree detection, and ensures that the image structure remains undistorted.
Smart Images

Figure CN116862848B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a tool detection method, and more specifically to a tool wear degree detection method, device, computer equipment and storage medium. Background Art
[0002] The tool wear degree detection method can automatically identify the wear condition of returned tools, avoid the problem of tools being returned when they are relatively new, and improve the utilization rate of tools. Specifically, the tool wear degree detection method is to compare the image of the old tool with the image of the new tool. The greater the difference between the two, the more serious the wear condition. Before performing image comparison, due to different imaging environments and slight color differences between different tools, it is first necessary to color calibrate the images of the old and new tools so that the color distribution of the two images is consistent.
[0003] Existing methods for mapping the colors of photos include manifold alignment methods. The steps of color mapping in the manifold alignment method are: first, mapping the source image and the target image to a common color space, and then comparing the colors of the source image and the target image in the color space. This method requires manifold structure modeling and color mapping of the source image and the target image respectively, which is time-consuming. In addition, the two color mappings will result in a large loss of image information, resulting in low subsequent detection accuracy.
[0004] Therefore, it is necessary to design a new method to map the color of the worn tool to be consistent with the new tool image, and to keep the image structure unchanged during the color mapping process, so as to more accurately measure the tool wear. Summary of the invention
[0005] The purpose of the present invention is to overcome the defects of the prior art and provide a tool wear degree detection method, device, computer equipment and storage medium.
[0006] To achieve the above object, the present invention adopts the following technical solution: a method for detecting tool wear degree, comprising:
[0007] Acquire a target image of a tool to be tested for wear;
[0008] Acquire a tool source image corresponding to the target image;
[0009] Determining a plurality of groups of matching points after registration of the target image and the tool source image;
[0010] Construct the manifold structure of the target image;
[0011] Performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result;
[0012] Segmenting the conversion result and the tool source image to obtain two segmented images;
[0013] The structural similarity of the two segmented images is calculated to obtain the degree of tool wear.
[0014] A further technical solution is: before obtaining the target image of the tool to be tested for wear, the method further comprises:
[0015] A corresponding standard image is made for each type of tool to obtain a tool source image.
[0016] A further technical solution is: the determining of a plurality of groups of matching points after registration of the target image and the tool source image comprises:
[0017] Determining matching feature points between the target image and the tool source image, and registering the target image and the tool source image based on the matching feature points to obtain a registered target image and tool source image;
[0018] Select several groups of matching points in the registered target image and the tool source image.
[0019] Its further technical solution is: the manifold structure of the target image is: Among them, x i and x j Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image. Pixels i and j are k-nearest neighbors, which means that pixel i is one of the k pixels closest to pixel j in similarity or pixel j is one of the k pixels closest to pixel i in similarity, and k is an integer.
[0020] A further technical solution is: performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result comprises:
[0021] Constructing a color matching loss function according to the manifold structure and a plurality of groups of matching points;
[0022] Optimizing the loss function to determine an optimal solution to the loss function;
[0023] The target image is subjected to color conversion according to the optimal solution to obtain a conversion result.
[0024] Its further technical solution is: the loss function of the color matching is Where F is the 3*3 color transformation matrix to be solved; W x is the manifold structure of the target image after registration; F T x iIndicates that the color value of pixel i is transformed by F; x m and n are two pixel points of the registered target image and tool source image; λ represents the weight of the pixel value consistency loss.
[0025] A further technical solution is: segmenting the conversion result and the tool source image to obtain two segmented images, including:
[0026] Using an image segmentation network to perform foreground tool segmentation on the conversion result and the tool source image respectively, so as to segment the location of the tool;
[0027] The minimum bounding box containing the tool in the conversion result and the tool source image is intercepted to obtain two segmented images.
[0028] The present invention also provides a tool wear degree detection device, comprising:
[0029] A target image acquisition unit, used to acquire a target image of a tool to be tested for wear;
[0030] A source image acquisition unit, used for acquiring a tool source image corresponding to the target image;
[0031] A matching point determination unit, used to determine a plurality of groups of matching points after registration of the target image and the tool source image;
[0032] A manifold structure construction unit, used to construct a manifold structure of a target image;
[0033] A color mapping unit, used for performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result;
[0034] A segmentation unit, used for segmenting the conversion result and the tool source image to obtain two segmented images;
[0035] The structural similarity calculation unit is used to calculate the structural similarity of the two segmented images to obtain the degree of tool wear.
[0036] The present invention further provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor implements the above method when executing the computer program.
[0037] The present invention also provides a storage medium, wherein the storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0038] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention determines a target image and a tool source image, aligns the target image and the tool source image, determines a plurality of groups of matching points, constructs a manifold structure of the target image, performs color mapping on the target image, segments the mapped result and the tool source image, and determines the structural similarity of the two segmented images, thereby determining the degree of tool wear, mapping the color of the worn tool to be consistent with the new tool image, and in the process of color mapping, the image structure can be kept undistorted, thereby more accurately measuring the tool wear.
[0039] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0041] Figure 1 A schematic diagram of an application scenario of the tool wear degree detection method provided by an embodiment of the present invention;
[0042] Figure 2 A schematic diagram of a process flow of a tool wear degree detection method provided by an embodiment of the present invention;
[0043] Figure 3 A schematic diagram of a sub-process of a tool wear degree detection method provided by an embodiment of the present invention;
[0044] Figure 4 A schematic diagram of a sub-process of a tool wear degree detection method provided by an embodiment of the present invention;
[0045] Figure 5 A schematic diagram of a sub-process of a tool wear degree detection method provided by an embodiment of the present invention;
[0046] Figure 6 A schematic flow chart of a method for detecting tool wear degree provided by another embodiment of the present invention;
[0047] Figure 7 A schematic block diagram of a tool wear degree detection device provided by an embodiment of the present invention;
[0048] Figure 8 A schematic block diagram of a matching point determination unit of a tool wear degree detection device provided by an embodiment of the present invention;
[0049] Fig. 9A schematic block diagram of a color mapping unit of a tool wear degree detection device provided by an embodiment of the present invention;
[0050] Fig.10 A schematic block diagram of a segmentation unit of a tool wear degree detection device provided by an embodiment of the present invention;
[0051] Fig.11 A schematic block diagram of a tool wear degree detection device provided by another embodiment of the present invention; and
[0052] Fig.12 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0055] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0056] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0057] See also Figure 1 and Figure 2 , Figure 1 A schematic diagram of an application scenario of the tool wear degree detection method provided in an embodiment of the present invention. Figure 2A schematic flow chart of a tool wear degree detection method provided in an embodiment of the present invention. The tool wear degree detection method is applied in a server. The server exchanges data with a terminal and a camera, captures a target image of a tool whose wear degree is to be detected through the camera, performs manifold structure modeling and color mapping on the target image, performs image segmentation on the mapped image and the tool source image, and calculates the structural similarity of the two segmented images, which is used as the tool wear degree. There is no need to model and color map the source image, which can reduce the calculation time by at least half, and the color mapping is performed only once, which reduces the loss of image information.
[0058] Figure 2 FIG. 1 is a flow chart of a method for detecting tool wear provided by an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110 to S170.
[0059] S110, acquiring a target image of a tool whose wear degree is to be tested.
[0060] In this embodiment, the target image refers to a real-time photograph of the tool that needs to be tested for wear.
[0061] In this embodiment, the target image is marked as I x .
[0062] S120: Acquire a tool source image corresponding to the target image.
[0063] In this embodiment, the tool source image refers to an image captured when the tool whose wear degree is to be tested is in a brand new state.
[0064] Specifically, the tool source image is marked as I y .
[0065] S130, determining a plurality of groups of matching points after registration of the target image and the tool source image.
[0066] In this embodiment, the registered groups of matching points refer to groups of matching pixel points after feature point registration.
[0067] In one embodiment, see Figure 3 , the above-mentioned step S130 may include steps S131 to S132.
[0068] S131 , determining matching feature points between the target image and the tool source image, and registering the target image and the tool source image according to the matching feature points to obtain a registered target image and tool source image.
[0069] In this embodiment, the target image I is found xand tool source image I y A set of matching feature points is used to register the two images. SIFT (Scale-invariant feature transform) features are used for matching and RANSAC (Random Sample Consensus) method is used to eliminate incorrect matching points, that is, abnormal pixels that cannot be matched, and the tool source image and target image are registered. After registration, the two images have the same size, and the position and size of the tool are consistent.
[0070] S132, selecting several groups of matching points in the registered target image and the tool source image.
[0071] Specifically, n groups of matching points are selected from the two registered images, where n is preferably an integer between 500 and 1000. Specifically, if x Select a point with coordinates (i, j) in the tool source image I. y The coordinates (i, j) in the image are (i, j). The coordinates (i, j) can be randomly generated or sampled at a certain interval in the target image and the tool source image. The sampling method should make the matching point set contain as many color types as possible. xy The matrix represents the matching relationship between two images. If the target image I x The mth pixel point and the tool source image I y The nth pixel points of are selected as matching points, then W xy (m, n) = 1, target image I x The mth pixel point and the tool source image I y The nth pixel of is the pixel at the same position in the two images; if the target image I x The mth pixel point and the tool source image I y If not all n-th pixels are selected as matching points, then W xy (m,n)=0.
[0072] S140, constructing a manifold structure of the target image.
[0073] In this embodiment, the manifold structure of the target image is: Among them, x i and x j Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image. Pixels i and j are k-nearest neighbors, which means that pixel i is one of the k pixels closest to pixel j in similarity or pixel j is one of the k pixels closest to pixel i in similarity, and k is an integer.
[0074] In this embodiment, k=10. Of course, in other embodiments, the above k can be other integers.
[0075] S150, performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result.
[0076] In this embodiment, the conversion result refers to an image obtained by converting the target image into an image having the same color as the new tool image, ie, the tool source image.
[0077] In one embodiment, see Figure 4 , the above-mentioned step S140 may include steps S141 to S143.
[0078] S141. Constructing a color matching loss function according to the manifold structure and a plurality of groups of matching points.
[0079] In this embodiment, the loss function refers to a function used to calculate the loss value of the target image after color conversion.
[0080] Specifically, the color matching loss function is: Where F is the 3*3 color transformation matrix to be solved, which is used to map the color of the target image to be consistent with the source image. x is the manifold structure of the target image after registration; F T x i Indicates that the color value of pixel i is transformed by F; This is to ensure that the local manifold structure of the target image can be maintained during the color transformation, that is, similar pixels remain similar after color transformation. m,n ||F T x m -y n || 2 W xy (m, n) constrains that after color transformation, the pixel values of the matching points of the target image and the tool source image can remain consistent. m and n are two pixel points of the registered target image and tool source image; λ represents the weight of the pixel value consistency loss.
[0081] S142: Optimize the loss function to determine the optimal solution of the loss function.
[0082] In this embodiment, the optimal solution refers to the value of F for which the result of the loss function is the smallest.
[0083] Specifically, optimize the loss function and find the optimal F value to minimize E(F). By taking the derivative of the loss function and setting the derivative to 0, we can get the optimal solution of E(F): Among them, X represents the target image I after registration x The matrix composed of all pixels of the image is 3*n in size, where n is the total number of pixels in the image. x The corresponding Laplace matrix, L = DW x , D is a diagonal matrix, D(i, i) = ∑ j W x (i, j). Y represents the tool source image I after registration y The matrix composed of all pixels.
[0084] S143. Perform color conversion on the target image according to the optimal solution to obtain a conversion result.
[0085] In this embodiment, the target image I is transformed into x Perform color conversion and obtain the conversion result, that is, the new image
[0086] S160: Segment the conversion result and the tool source image to obtain two segmented images.
[0087] In this embodiment, the two segmented images refer to the conversion result and an image formed by the minimum bounding box containing the tool in the tool source image.
[0088] In one embodiment, see Figure 5 , the above-mentioned step S160 may include steps S161 to S162.
[0089] S161, using an image segmentation network to perform foreground tool segmentation on the conversion result and the tool source image respectively, so as to segment the location of the tool;
[0090] S162, intercepting the conversion result and the minimum bounding box containing the tool in the tool source image to obtain two segmented images.
[0091] First, determine the location of the tool, and then draw the minimum external frame of the tool to determine the segmented image, that is, two new images and
[0092] S170, calculating the structural similarity of the two segmented images to obtain the degree of tool wear.
[0093] In this embodiment, two new images are compared and SSIM (Structural Similarity) uses structural similarity to represent the wear degree p of the image.
[0094] In this embodiment, the higher the value of p, the more serious the tool wear.
[0095] The above-mentioned tool wear detection method determines the target image and the tool source image, aligns the target image and the tool source image, determines several groups of matching points, constructs the manifold structure of the target image, and performs color mapping on the target image. The mapped result is segmented from the tool source image, and the structural similarity of the two segmented images is determined to determine the degree of tool wear, so as to map the color of the worn tool to be consistent with the new tool image, and in the process of color mapping, the image structure can be kept undistorted, thereby more accurately measuring the tool wear.
[0096] Figure 6 FIG. 2 is a flow chart of a method for detecting tool wear provided by another embodiment of the present invention. Figure 6 As shown, the tool wear degree detection method of this embodiment includes steps S210-S280. Steps S220-S280 are similar to steps S110-S170 in the above embodiment, and will not be repeated here. The added step S210 in this embodiment is described in detail below.
[0097] S210 , creating a corresponding standard image for each type of tool to obtain a tool source image.
[0098] Take an image of each type of brand new cutting tool as the standard image of each category, that is, the tool source image of each type of Quanxing cutting tool.
[0099] Figure 7 is a schematic block diagram of a tool wear degree detection device 300 provided in an embodiment of the present invention. Figure 7 As shown, corresponding to the above tool wear degree detection method, the present invention also provides a tool wear degree detection device 300. The tool wear degree detection device 300 includes a unit for executing the above tool wear degree detection method, and the device can be configured in a server. Figure 7 The tool wear degree detection device 300 includes a target image acquisition unit 302, a source image acquisition unit 303, a matching point determination unit 304, a manifold structure construction unit 305, a color mapping unit 306, a segmentation unit 307 and a structure similarity calculation unit 308.
[0100] A target image acquisition unit 302 is used to acquire a target image of a tool to be tested for wear; a source image acquisition unit 303 is used to acquire a tool source image corresponding to the target image; a matching point determination unit 304 is used to determine a plurality of matching points of the target image and the tool source image after registration; a manifold structure construction unit 305 is used to construct a manifold structure of the target image; a color mapping unit 306 is used to perform color mapping on the target image according to the manifold structure and a plurality of matching points to obtain a conversion result; a segmentation unit 307 is used to segment the conversion result and the tool source image to obtain two segmented images; a structural similarity calculation unit 308 is used to calculate the structural similarity of the two segmented images to obtain the tool wear degree.
[0101] In one embodiment, if Figure 8 As shown, the matching point determination unit 304 includes a registration subunit 3041 and a selection subunit 3042 .
[0102] The registration subunit 3041 is used to determine the matching feature points between the target image and the tool source image, and to register the target image and the tool source image based on the matching feature points to obtain the registered target image and tool source image; the selection subunit 3042 is used to select several groups of matching points in the registered target image and the tool source image.
[0103] In one embodiment, if Fig. 9 As shown, the color mapping unit 306 includes a loss function construction subunit 3061, an optimization subunit 3062 and a conversion subunit 3063.
[0104] The loss function construction subunit 3061 is used to construct a color matching loss function based on the manifold structure and several groups of matching points; the optimization subunit 3062 is used to optimize the loss function to determine the optimal solution of the loss function; the conversion subunit 3063 is used to perform color conversion on the target image according to the optimal solution to obtain a conversion result.
[0105] In one embodiment, if Fig.10 As shown, the segmentation unit 307 includes a foreground segmentation subunit 3071 and a clipping subunit 3072 .
[0106] The foreground segmentation subunit 3071 is used to use the image segmentation network to perform foreground tool segmentation on the conversion result and the tool source image respectively, so as to segment the location of the tool; the interception subunit 3072 is used to intercept the minimum external frame containing the tool in the conversion result and the tool source image, so as to obtain two images after segmentation.
[0107] Fig.11FIG. 3 is a schematic block diagram of a tool wear degree detection device 300 provided in another embodiment of the present invention. Fig.11 As shown, the tool wear degree detection device 300 of this embodiment is based on the above embodiment and adds a source image generation unit 301.
[0108] The source image generating unit 301 is used to generate a corresponding standard image for each type of tool to obtain a tool source image.
[0109] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned tool wear degree detection device 300 and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0110] The tool wear degree detection device 300 can be implemented in the form of a computer program. The computer program can be implemented in Fig.12 Runs on the computer device shown.
[0111] See also Fig.12 , Fig.12 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 is a server, wherein the server may be an independent server or a server cluster composed of multiple servers.
[0112] See also Fig.12 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0113] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a tool wear degree detection method.
[0114] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0115] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a tool wear degree detection method.
[0116] The network interface 505 is used to communicate with other devices over the network. Fig.12The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] The processor 502 is used to run the computer program 5032 stored in the memory to implement the following steps:
[0118] Acquire a target image of a tool to be tested for wear; acquire a tool source image corresponding to the target image; determine a plurality of groups of matching points after registration of the target image and the tool source image; construct a manifold structure of the target image; perform color mapping on the target image according to the manifold structure and the plurality of groups of matching points to obtain a conversion result; segment the conversion result and the tool source image to obtain two segmented images; calculate the structural similarity of the two segmented images to obtain the degree of tool wear.
[0119] Among them, the manifold structure of the target image is: Among them, x i and x j Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image. Pixels i and j are k-nearest neighbors, which means that pixel i is one of the k pixels closest to pixel j in similarity or pixel j is one of the k pixels closest to pixel i in similarity, and k is an integer.
[0120] In one embodiment, before implementing the step of acquiring the target image of the tool to be tested for wear degree, the processor 502 further implements the following steps:
[0121] A corresponding standard image is made for each type of tool to obtain a tool source image.
[0122] In one embodiment, when the processor 502 implements the step of determining a plurality of groups of matching points after the registration of the target image and the tool source image, the processor 502 specifically implements the following steps:
[0123] Determine the matching feature points of the target image and the tool source image, and register the target image and the tool source image based on the matching feature points to obtain a registered target image and a tool source image; select a plurality of groups of matching points in the registered target image and the tool source image.
[0124] In one embodiment, when the processor 502 implements the step of performing color mapping on the target image according to the manifold structure and the plurality of groups of matching points to obtain a conversion result, the processor 502 specifically implements the following steps:
[0125] A color matching loss function is constructed according to the manifold structure and a plurality of groups of matching points; the loss function is optimized to determine an optimal solution of the loss function; and the target image is subjected to color conversion according to the optimal solution to obtain a conversion result.
[0126] Among them, the loss function of color matching is Where F is the 3*3 color transformation matrix to be solved; W x is the manifold structure of the target image after registration; F T x i Indicates that the color value of pixel i is transformed by F; x m and n are two pixel points of the registered target image and tool source image; λ represents the weight of the pixel value consistency loss.
[0127] In one embodiment, when the processor 502 implements the step of segmenting the conversion result and the tool source image to obtain two segmented images, the processor 502 specifically implements the following steps:
[0128] The image segmentation network is used to perform foreground tool segmentation on the conversion result and the tool source image respectively to segment the location of the tool; the minimum external frame containing the tool in the conversion result and the tool source image is intercepted to obtain two segmented images.
[0129] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0130] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0131] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes the following steps:
[0132] Acquire a target image of a tool to be tested for wear; acquire a tool source image corresponding to the target image; determine a plurality of groups of matching points after registration of the target image and the tool source image; construct a manifold structure of the target image; perform color mapping on the target image according to the manifold structure and the plurality of groups of matching points to obtain a conversion result; segment the conversion result and the tool source image to obtain two segmented images; calculate the structural similarity of the two segmented images to obtain the degree of tool wear.
[0133] Among them, the manifold structure of the target image is: Among them, x i and x j Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image. Pixels i and j are k-nearest neighbors, which means that pixel i is one of the k pixels closest to pixel j in similarity or pixel j is one of the k pixels closest to pixel i in similarity, and k is an integer.
[0134] In one embodiment, before executing the computer program to implement the step of acquiring the target image of the tool to be tested for wear, the processor further implements the following steps:
[0135] A corresponding standard image is made for each type of tool to obtain a tool source image.
[0136] In one embodiment, when the processor executes the computer program to implement the step of determining a plurality of groups of matching points after registration of the target image and the tool source image, the processor specifically implements the following steps:
[0137] Determine the matching feature points of the target image and the tool source image, and register the target image and the tool source image based on the matching feature points to obtain a registered target image and a tool source image; select a plurality of groups of matching points in the registered target image and the tool source image.
[0138] In one embodiment, when the processor executes the computer program to implement the step of performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result, the processor specifically implements the following steps:
[0139] A color matching loss function is constructed according to the manifold structure and a plurality of groups of matching points; the loss function is optimized to determine an optimal solution of the loss function; and the target image is subjected to color conversion according to the optimal solution to obtain a conversion result.
[0140] Among them, the loss function of color matching is Where F is the 3*3 color transformation matrix to be solved; W x is the manifold structure of the target image after registration; F T x i Indicates that the color value of pixel i is transformed by F; x m and n are two pixel points of the registered target image and tool source image; λ represents the weight of the pixel value consistency loss.
[0141] In one embodiment, when the processor executes the computer program to implement the step of segmenting the conversion result and the tool source image to obtain two segmented images, the processor specifically implements the following steps:
[0142] The image segmentation network is used to perform foreground tool segmentation on the conversion result and the tool source image respectively to segment the location of the tool; the minimum external frame containing the tool in the conversion result and the tool source image is intercepted to obtain two segmented images.
[0143] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0144] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0145] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0146] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0147] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for detecting tool wear, characterized in that: include: Acquire a target image of a tool to be tested for wear; Acquire a tool source image corresponding to the target image; Determining a plurality of groups of matching points after registration of the target image and the tool source image; Construct the manifold structure of the target image; Performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result; Segmenting the conversion result and the tool source image to obtain two segmented images; Calculate the structural similarity of the two segmented images to obtain the degree of tool wear; The manifold structure of the target image is: ;in, and Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image, Indicates that pixel i is one of the k pixels with the closest similarity to pixel j or pixel j is one of the k pixels with the closest similarity to pixel i, where k is an integer; The color mapping of the target image according to the manifold structure and the plurality of groups of matching points to obtain a conversion result includes: Constructing a color matching loss function according to the manifold structure and a plurality of groups of matching points; Optimizing the loss function to determine an optimal solution to the loss function; The target image is subjected to color conversion according to the optimal solution to obtain a conversion result.
2. The tool wear degree detection method according to claim 1, characterized in that: Before acquiring the target image of the tool to be tested for wear, the method further includes: A corresponding standard image is made for each type of tool to obtain a tool source image.
3. The tool wear degree detection method according to claim 1, characterized in that: The determining of a plurality of groups of matching points after registration of the target image and the tool source image comprises: Determining matching feature points between the target image and the tool source image, and registering the target image and the tool source image based on the matching feature points to obtain a registered target image and tool source image; Select several groups of matching points in the registered target image and the tool source image.
4. The tool wear degree detection method according to claim 1, characterized in that: The loss function of the color matching is , where F is the 3*3 color transformation matrix to be solved; is the manifold structure of the target image after registration; Indicates that the color value of pixel i is transformed by F; and are two pixel points of the registered target image and tool source image; The weight representing the pixel value consistency loss.
5. The tool wear degree detection method according to claim 1, characterized in that: The step of segmenting the conversion result and the tool source image to obtain two segmented images includes: Using an image segmentation network to perform foreground tool segmentation on the conversion result and the tool source image respectively, so as to segment the location of the tool; The minimum bounding box containing the tool in the conversion result and the tool source image is intercepted to obtain two segmented images.
6. A tool wear degree detection device, characterized in that: include: A target image acquisition unit, used to acquire a target image of a tool to be tested for wear; A source image acquisition unit, used for acquiring a tool source image corresponding to the target image; A matching point determination unit, used to determine a plurality of groups of matching points after registration of the target image and the tool source image; A manifold structure construction unit, used to construct a manifold structure of a target image; A color mapping unit, used for performing color mapping on the target image according to the manifold structure and a plurality of groups of matching points to obtain a conversion result; A segmentation unit, used for segmenting the conversion result and the tool source image to obtain two segmented images; A structural similarity calculation unit is used to calculate the structural similarity of the two segmented images to obtain the degree of tool wear; The manifold structure of the target image is: ;in, and Respectively represent the color vectors of the i-th pixel and the j-th pixel of the target image, Indicates that pixel i is one of the k pixels with the closest similarity to pixel j or pixel j is one of the k pixels with the closest similarity to pixel i, where k is an integer; The color mapping unit includes a loss function construction subunit, an optimization subunit and a conversion subunit; A loss function construction subunit is used to construct a color matching loss function based on the manifold structure and a plurality of groups of matching points; an optimization subunit is used to optimize the loss function to determine the optimal solution of the loss function; and a conversion subunit is used to perform color conversion on the target image according to the optimal solution to obtain a conversion result.
7. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
