A method and system for detecting defects after coating of milling cutters based on variable magnification microscopy

By using a method based on variable magnification microscopy combined with digital image entropy calculation, efficient and accurate detection of coating defects was achieved, solving the problem of balancing measurement range and accuracy and improving detection efficiency.

CN115876803BActive Publication Date: 2026-03-06JIMEI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310129514.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-17
Publication Date
2026-03-06
Estimated Expiration
2043-02-17

AI Technical Summary

Technical Problem

Existing technologies for coating defect detection suffer from the problem of not being able to balance measurement range and measurement accuracy, and also have low detection efficiency.

Method used

By employing a variable magnification microscopy method, defect areas are identified by acquiring initial images, depth is measured by adjusting the microscope magnification, and the top and bottom of the defects are calculated using digital image entropy, thus achieving efficient detection of coating defects.

Benefits of technology

It achieves a balance between measurement range and measurement accuracy in coating defect detection, improves detection efficiency, and meets the needs of industrial automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115876803B_ABST
    Figure CN115876803B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for detecting defects in the coating of milling cutters using variable magnification microscopy, relating to the field of coating defect detection technology. An initial image of the coating is captured using a microscope at a first magnification. Defect region identification is performed on the initial image to obtain defect identification information for the coating. A second magnification is determined based on the size of the defect region to determine the required microscope magnification for measuring the defect depth. Based on the position information, the defect is moved to the center of the microscope's field of view at the second magnification, and the microscope is controlled to move in a direction perpendicular to the coating surface. During the movement, the coating is vertically scanned to obtain multiple images as a series. The digital image entropy of each series of grayscale images is calculated. The top and bottom of the defect are determined based on the digital image entropy. The depth of the defect is obtained based on the vertical positions corresponding to the top and bottom. This invention achieves a balance between measurement range and measurement accuracy in coating defect detection, improving the efficiency of coating defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of coating defect detection technology, and in particular to a method and system for detecting post-coating defects in milling cutters based on variable magnification microscopy. Background Technology

[0002] Milling cutter wear is a major factor affecting machining economy during milling. Coatings can improve the friction and wear properties of cutting tools, thereby increasing productivity, saving materials, and reducing energy consumption. Therefore, coating monitoring is crucial. Coating defect monitoring requires not only determining the presence of defects on the surface but also their depth, and further determining whether the defect depth exceeds a depth threshold, which is on the micrometer scale.

[0003] Currently, most coating defects are detected manually using traditional methods, with quality inspectors observing them through a microscope.

[0004] Manual inspection is inefficient and cannot meet the requirements of industrial automation in milling.

[0005] Traditional industrial microscopes suffer from a mismatch between measurement range and measurement accuracy. If the measurement range of the coating surface is large, the depth of field in the depth direction is large, but the measurement accuracy in the depth direction is low. Conversely, if the depth of field in the depth direction is small, the measurement accuracy in the depth direction is high, but the measurement range of the coating surface is small, resulting in low measurement efficiency.

[0006] To balance measurement range and accuracy, field-of-view stitching technology can be used to achieve large-scale, high-precision inspection. However, this method also involves large-scale, high-precision inspection of areas without defects in the coating, reducing inspection efficiency. Furthermore, field-of-view stitching requires a large amount of computing resources, resulting in high costs. Summary of the Invention

[0007] The purpose of this invention is to provide a method and system for detecting post-coating defects in milling cutters based on variable magnification microscopy, so as to achieve both measurement range and measurement accuracy in coating defect detection, while improving the efficiency of coating defect detection.

[0008] To achieve the above objectives, embodiments of the present invention provide the following solutions:

[0009] A method for detecting defects after coating on milling cutters based on variable magnification microscopy includes:

[0010] An initial image of the coating is obtained by taking a microscope at first magnification; the initial image includes the entire coating; the initial image is an RGB color image.

[0011] Defect region identification is performed on the initial image to obtain defect identification information of the coating; the defect identification information includes: first information indicating that the coating does not have defects; or, second information indicating that the coating has defects, and the size and location information of the defect region corresponding to the defect in the initial image;

[0012] After identifying defects in the coating, a second magnification of the microscope is determined based on the size of the defect area for measuring the defect depth; the second magnification is greater than the first magnification.

[0013] Based on the location information, the defect is moved to the center of the field of view of the microscope at the second magnification; when the defect is located at the center of the field of view of the microscope at the second magnification, the microscope is controlled to move in a direction perpendicular to the coating surface, and the coating is vertically scanned during the displacement process to obtain multiple images as a series of grayscale images;

[0014] Calculate the digital image entropy for each series of grayscale images;

[0015] Based on the calculated digital image entropy, the top and bottom of the defect are determined;

[0016] The depth of the defect is obtained based on the vertical positions corresponding to the top and bottom.

[0017] Optionally, after acquiring the initial image of the coating taken by the microscope at a first magnification, it is determined whether the initial image includes the entire coating;

[0018] If so, then perform the step of identifying defect regions in the initial image;

[0019] If not, adjust the value of the first magnification and return to the step of acquiring the initial image of the coating by taking a picture with a microscope at the first magnification.

[0020] Optionally,

[0021] Determining the second magnification required by the microscope for depth measurement based on the size of the defect area specifically includes:

[0022] Obtain the absolute value of the maximum difference in the horizontal coordinates of all pixels in the defective region; obtain the absolute value of the maximum difference in the vertical coordinates of all pixels in the defective region;

[0023] The absolute value of the maximum difference in the horizontal axis is the longest value of the defect region, and the absolute value of the maximum difference in the vertical axis is the widest value of the defect region.

[0024] The second magnification is obtained by matching the longest and widest values ​​with all magnification factors.

[0025] Optionally, determining the top and bottom of the defect based on the calculated digital image entropy specifically includes:

[0026] When the digital image entropy is less than the first threshold, the height position corresponding to the grayscale image is the top of the defect;

[0027] When the digital image entropy equals the second threshold, the height position corresponding to the grayscale image is the bottom of the defect.

[0028] Optionally, calculating the digital image entropy for each series of images specifically includes:

[0029]

[0030] p i(n) =m i (n) / N(n),

[0031] Where n represents the image index, E(n) represents the digital image entropy of the image with index n, and P i(n) m represents the probability of a pixel with gray level i. i N(n) represents the number of pixels with gray level i, and N(n) represents the total number of pixels in the image with index n.

[0032] To achieve the above objectives, embodiments of the present invention also provide the following solutions:

[0033] A post-coating defect detection system for milling cutters based on variable magnification microscopy, comprising:

[0034] An image acquisition module is used to acquire an initial image of the coating taken by a microscope at a first magnification; the initial image includes the entire coating; the initial image is an RGB color image.

[0035] A defect identification module is used to identify defect regions in the initial image to obtain defect identification information of the coating; the defect identification information includes: first information indicating that the coating does not have defects; or, second information indicating that the coating has defects, and the size and location information of the defect region corresponding to the defect in the initial image;

[0036] Microscope module, used for:

[0037] After identifying defects in the coating, a second magnification of the microscope is determined based on the size of the defect area for measuring the defect depth; the second magnification is greater than the first magnification.

[0038] Based on the location information, the defect is moved to the center of the field of view of the microscope at the second magnification; when the defect is located at the center of the field of view of the microscope at the second magnification, the microscope is controlled to move in a direction perpendicular to the coating surface, and the coating is vertically scanned during the displacement process to obtain multiple images as a series of grayscale images;

[0039] Depth measurement module, used for:

[0040] Calculate the digital image entropy for each series of grayscale images;

[0041] Based on the calculated digital image entropy, the top and bottom of the defect are determined;

[0042] The depth of the defect is obtained based on the vertical positions corresponding to the top and bottom.

[0043] Optionally, the image acquisition module is further configured to:

[0044] Determine whether the initial image includes the entire coating;

[0045] If so, then perform the operation of identifying defect regions in the initial image;

[0046] If not, adjust the value of the first magnification and return to the operation of acquiring the initial image of the coating by taking a picture with the microscope at the first magnification.

[0047] Optionally, determining the second magnification required by the microscope for depth measurement based on the size of the defect area specifically includes:

[0048] Obtain the absolute value of the maximum difference in the horizontal coordinates of all pixels in the defective region; obtain the absolute value of the maximum difference in the vertical coordinates of all pixels in the defective region;

[0049] The absolute value of the maximum difference in the horizontal axis is the longest value of the defect region, and the absolute value of the maximum difference in the vertical axis is the widest value of the defect region.

[0050] The second magnification is obtained by matching the longest and widest values ​​with all magnification factors.

[0051] Optionally, determining the top and bottom of the defect based on the calculated digital image entropy specifically includes:

[0052] When the digital image entropy is less than the first threshold, the height position corresponding to the grayscale image is the top of the defect;

[0053] When the digital image entropy equals the second threshold, the height position corresponding to the grayscale image is the bottom of the defect.

[0054] Optionally, calculating the digital image entropy for each series of images specifically includes:

[0055]

[0056] p i(n) =m i (n) / N(n),

[0057] Where n represents the image index, E(n) represents the digital image entropy of the image with index n, and P i(n) m represents the probability of a pixel with gray level i. i N(n) represents the number of pixels with gray level i, and N(n) represents the total number of pixels in the image with index n.

[0058] In this embodiment of the invention, an initial image of the coating is obtained by taking a picture of the coating with a microscope at a first magnification; defect identification information of the coating is obtained by identifying defect areas in the initial image; after identifying the presence of defects in the coating, the second magnification required by the microscope for depth measurement is determined based on the size of the defect area.

[0059] Based on the location information, the defect is displaced to the center of the field of view of the microscope at second magnification. When the defect is at the center of the field of view of the microscope at second magnification, the microscope is controlled to move in a direction perpendicular to the coating surface. During the displacement, the coating is vertically scanned to obtain multiple images as a series. The digital image entropy of each series of images is calculated. The top and bottom of the defect are determined based on the digital image entropy. The depth of the defect is obtained based on the vertical positions corresponding to the top and bottom. This method achieves a balance between measurement range and measurement accuracy in coating defect detection, improving the efficiency of coating defect detection. Attached Figure Description

[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0061] Figure 1 This is a flowchart illustrating the method for detecting defects after coating of milling cutters based on variable magnification microscopy provided in an embodiment of the present invention.

[0062] Figure 2 A detailed structural diagram of the milling cutter post-coating defect detection system based on variable magnification microscopy provided in an embodiment of the present invention;

[0063] Figure 3A schematic diagram illustrating the location and classification of defects provided in an embodiment of the present invention;

[0064] Figure 4 This is a schematic diagram of the defect region at the second multiple provided in an embodiment of the present invention;

[0065] Figure 5 A schematic diagram of a series of images provided for embodiments of the present invention;

[0066] Figure 6 A schematic diagram illustrating the relationship between defect depth and digital image entropy provided in an embodiment of the present invention;

[0067] Figure 7 This is a schematic diagram illustrating the specific process of training a YOLOv5 model according to an embodiment of the present invention;

[0068] Figure 8 This is a schematic diagram of the YOLOv5 model monitoring process provided in an embodiment of the present invention;

[0069] Figure 9 This is a schematic diagram of the structure of a milling cutter post-coating defect detection system based on variable magnification microscopy provided in an embodiment of the present invention.

[0070] Symbol explanation:

[0071] Image acquisition module-1, CCD camera-11, electronically controlled zoom microscope-12, column-13, two-dimensional precision displacement stage-14, defect identification module-2, microscope module-3, depth measurement module-4. Detailed Implementation

[0072] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0073] The purpose of this invention is to provide a method and system for detecting defects after coating of milling cutters based on variable magnification microscopy, so as to solve the problems of the inability to balance the measurement range and measurement accuracy of existing coating defect detection methods, and the low efficiency of coating defect detection.

[0074] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0075] Figure 1 An exemplary flowchart of the above-described method for detecting defects after coating on milling cutters based on variable magnification microscopy is shown. The steps are described in detail below.

[0076] Step 1: Obtain an initial image of the coating using a microscope at first magnification; the initial image includes the entire coating; the initial image is an RGB color image.

[0077] Step 1 can be specifically executed by image acquisition module 1. Please refer to [link / reference]. Figure 2 The image acquisition module 1 includes at least a CCD camera 11, an electronically controlled zoom microscope 12, a column 13, and a two-dimensional precision displacement stage 14. The coating to be inspected is placed on the two-dimensional precision displacement stage 14. The CCD camera 11 and the electronically controlled zoom microscope 12 can move up and down along the Z-axis, while the two-dimensional precision displacement stage 14 can move horizontally in the horizontal plane, i.e., along the X and Y axes. The electronically controlled zoom microscope 12 selects a focusing magnification range of 16-26x, i.e., the first magnification, to automatically focus on the entire coating. The CCD camera 11 then takes an image of the entire coating to obtain an initial image.

[0078] In one example, all application classes of the motion control card that control the movement of the CCD camera 11, the electronically controlled zoom microscope 12, and the two-dimensional precision displacement stage 14 are encapsulated, making secondary development of the motion control card more convenient during use. When writing the motion control card program, the entire program is divided into a model layer, a control layer, and an application layer. This program architecture improves the overall confidentiality of the program. After receiving the defect location information, the motion control card controls the two-dimensional precision displacement stage 14 to move the defect directly below the electronically controlled zoom microscope 12, controls the electronically controlled zoom microscope 12 to adjust its lens magnification, records the current stepper motor position, and controls the stepper motor to move a certain number of steps based on the magnification of the electronically controlled zoom microscope 12, thereby moving the CCD camera 11 and the electronically controlled zoom microscope 12 to achieve automatic focusing. The electronically controlled zoom microscope 12 can adaptively adjust its lens magnification to suit the size of the coating defect.

[0079] Step 2: Perform defect region identification on the initial image to obtain defect identification information of the coating; the defect identification information includes: first information indicating that the coating does not have defects; or, second information indicating that the coating has defects, and the size and location information of the defect region corresponding to the defect in the initial image.

[0080] Step 2 can be executed by defect identification module 2. Defect identification module 2 can specifically be a trained YOLOv5 model. Please refer to [link / reference]. Figure 3 The YOLOv5 model identifies defect regions in the overall initial image to obtain defect identification information for the coating. This defect identification information includes: first, information indicating the absence of defects in the coating; or second, information indicating the presence of defects in the coating, and the size and location of the defect region corresponding to the defect in the initial image.

[0081] Step 3: After identifying defects in the coating, determine the second magnification required for depth measurement using the microscope based on the size of the defect area; the second magnification is greater than the first magnification.

[0082] Step 3 can be specifically executed by microscope module 3. Microscope module 3 can specifically be an electrically controlled zoom microscope 12. Based on the size and shape of the defect area, the electrically controlled zoom microscope 12 determines the second magnification required for depth measurement; the second magnification is greater than the first magnification. The defect area after magnification at the second magnification is as follows: Figure 4 As shown, the magnification of the electronically controlled zoom microscope 12 is adjusted manually based on the size and shape of the defect.

[0083] Step 4: Based on the location information, move the defect to the center of the field of view of the microscope at second magnification; when the defect is located at the center of the field of view of the microscope at second magnification, control the microscope to move in a direction perpendicular to the coating surface, and perform vertical scanning of the coating during the displacement process to obtain multiple images as a series of grayscale images.

[0084] The defect in step 4 is located at the center of the field of view of the microscope at second magnification. This operation can be specifically performed by the two-dimensional precision displacement stage 14. The two-dimensional precision displacement stage 14 moves horizontally under the control of the motion control card to position the defect at the center of the field of view of the microscope at second magnification.

[0085] In step 4, the microscope is moved in a direction perpendicular to the coating surface. This operation can be performed by the column 13 and the stepper motor. Under the control of the motion control card, the stepper motor moves in steps, driving the electrically controlled zoom microscope 12 to move vertically. During this process, a grating is used for distance measurement to ensure that the stepper motor moves precisely, thereby improving the accuracy of defect depth measurement.

[0086] In step 4, the coating is vertically scanned during the displacement process to obtain multiple images as a series. Please refer to [link to previous text]. Figure 5 This operation can be specifically performed by a CCD camera 11 and an electrically controlled zoom microscope 12. The CCD camera 11 performs a vertical scan of the coating during the displacement process to obtain multiple images as a series of images.

[0087] In one example, the electrically controlled zoom microscope 12 can autofocus at different magnifications. After acquiring the center coordinates of the defect area, the two-dimensional precision displacement stage 14 automatically moves the defect area to the center of the field of view, while keeping the optical axis center unchanged, using the initial image center point as the reference for each magnification. The center coordinates of the defect area are the coordinates of the center pixel of the defect area. By obtaining the coordinates of the center pixel of the defect area at this zoom magnification and the coordinates of the center pixel of the initial image, the difference between the X-axis coordinates and the Y-axis coordinates is multiplied by the pixel equivalent to obtain the actual distance between the center coordinates of the defect area and the center of the optical axis. The pixel equivalents at each magnification are pre-calibrated. The pixel equivalent is the actual size represented by each pixel. The pixel equivalent is calibrated using a calibration plate, and the actual distance between the calibration circles on the calibration plate is known. The number of pixels corresponding to the distance between the calibration circles in the calibration plate image at this zoom magnification is obtained, and the actual distance is divided by the number of pixels to obtain the pixel equivalent. For example, the size of one pixel equivalent at magnification 16 is 0.1265 mm.

[0088] The specific method for calibration of the calibration plate is as follows: a circle on the standard calibration plate is used as the calibration object. The area of ​​the calibration circle is obtained at the initial magnification using a CCD camera 11 and an electronically controlled zoom microscope 12. This area is compared with the actual area of ​​the calibration circle to obtain a ratio of 16:1, that is, the initial magnification of the electronically controlled zoom microscope is 16 times. Based on this, we stipulate that each step of the stepper motor is 10 times as one magnification. By analogy, the magnification range of the electronically controlled zoom microscope after calibration is 16-26 times. The image area of ​​the calibration object is the initial image area, as shown in Table 1.

[0089] Table 1

[0090]

[0091] Step 5: Calculate the digital image entropy for each series of grayscale images.

[0092] Step 6: Determine the top and bottom of the defect based on the calculated digital image entropy.

[0093] Step 7: Determine the depth of the defect based on the vertical positions corresponding to the top and bottom.

[0094] In one example, a vertical scan acquires a sequence of images, and the defect depth is calculated using digital image entropy. A motion control card controls a stepper motor to progressively move the CCD camera 11 down along the Z-axis, for example, by a step distance of 5µm, meaning one image is captured at 5µm intervals. Multiple images are acquired as a sequence, and the digital image entropy of each image is calculated. Digital image entropy is a statistic reflecting the uncertainty of information in an image. Image entropy can quantitatively describe the regularity of the grayscale distribution in an image. Please refer to [link to relevant documentation]. Figure 6When the digital image entropy is close to 1, it indicates defocus. When focusing on the top of the defect, the image entropy decreases significantly. When the digital image entropy changes from close to 1 to less than the first threshold (0.5), the height direction grating feedback value 1 is recorded. When focusing on the bottom of the defect, the image entropy value is extremely small. When defocusing at the bottom of the defect, the image entropy changes from less than the first threshold to equal to or approximately equal to 1 (the digital image entropy equal to or approximately equal to the second threshold), and the height direction grating feedback value 2 is recorded. The distance represented by the difference between feedback value 1 and feedback value 2 is the defect depth.

[0095] In summary, the process involves: acquiring an initial image of the coating using a microscope at first magnification; identifying defect areas in the initial image to obtain defect information; determining the required second magnification for depth measurement based on the size of the defect area after identifying the defect; moving the defect to the center of the microscope's field of view at second magnification based on its location; controlling the microscope to move perpendicular to the coating surface while the defect is at the center of the field of view at second magnification, and vertically scanning the coating during this movement to obtain multiple images as a series; calculating the digital image entropy for each series of images; determining the top and bottom of the defect based on the digital image entropy; and obtaining the defect depth based on the vertical positions corresponding to the top and bottom. This method achieves a balance between measurement range and accuracy in coating defect detection, improving the efficiency of coating defect detection.

[0096] In other embodiments of the present invention, the method for detecting defects after coating of milling cutters based on variable magnification microscopy further includes:

[0097] Step 11: After acquiring the initial image of the coating taken with the microscope at the first magnification, determine whether the initial image includes the entire coating.

[0098] Step 12: If yes, then proceed to step 2, which involves identifying defect regions in the initial image.

[0099] Step 13: If not, adjust the value of the first magnification and return to step 1, which involves acquiring the initial image of the coating taken with the microscope at the first magnification.

[0100] Steps 11, 12, and 13 can be performed after manual observation and judgment of the initial image acquired by the CCD camera 11. After acquiring the initial image of the coating at first magnification, the electronically controlled zoom microscope 12 determines whether the initial image includes the entire coating. If yes, step 2, defect area identification of the initial image, is performed. If not, the value of the first magnification is adjusted, and the process returns to step 1, acquiring the initial image of the coating at first magnification.

[0101] In other embodiments of the present invention, determining the second magnification required by the microscope for depth measurement based on the size of the defect area specifically includes:

[0102] Step 31: Obtain the absolute value of the maximum difference of the horizontal coordinates of all pixels in the defect area; obtain the absolute value of the maximum difference of the vertical coordinates of all pixels in the defect area.

[0103] Step 32: The absolute value of the maximum difference in the horizontal axis is the longest value of the defect area, and the absolute value of the maximum difference in the vertical axis is the widest value of the defect area.

[0104] Step 33: Match the longest and widest values ​​with all magnification factors to obtain the second magnification factor.

[0105] Steps 31, 32, and 33 can be performed after manual observation and judgment of the initial image acquired by the CCD camera 11. In the initial defect image acquired by the CCD camera 11, the absolute value of the maximum difference in the horizontal coordinates of all pixels in the defect area is obtained; the absolute value of the maximum difference in the vertical coordinates of all pixels in the defect area is also obtained. The absolute value of the maximum difference in the horizontal coordinates is the longest value of the defect area, and the absolute value of the maximum difference in the vertical coordinates is the widest value of the defect area. The longest and widest values ​​are matched with all magnification factors to obtain the second magnification factor.

[0106] In other embodiments of the present invention, the top and bottom of the defect are determined based on the calculated digital image entropy, specifically including:

[0107] When the digital image entropy is less than the first threshold, the height position corresponding to the grayscale image is the top of the defect.

[0108] When the digital image entropy equals the second threshold, the height position corresponding to the grayscale image is the bottom of the defect.

[0109] In other embodiments of the present invention, calculating the digital image entropy of each series of images specifically includes:

[0110] Step 51:

[0111]

[0112] p i(n) =m i (n) / N(n),

[0113] Where n represents the image index, E(n) represents the digital image entropy of the image with index n, and P i(n) m represents the probability of a pixel with gray level i. i N(n) represents the number of pixels with gray level i, and N(n) represents the total number of pixels in the image with index n.

[0114] In other embodiments of the present invention, the specific process of training the YOLOv5 model is as follows:

[0115] Step S1: Create a coating defect dataset.

[0116] Step S2: Create labels using labelimg. Labelimg is used to annotate coating defect types to obtain label defect types. After labelimg annotation, the coating defect dataset will be saved in a YOLOv5-specific file format. The collected initial coating images and annotated defect labels are divided into training, validation, and test sets respectively to facilitate subsequent model training.

[0117] Step S3: Create a coating defect validation set. Use the coating defect validation set to verify the training effect of the YOLOv5 model.

[0118] Step S4: Perform hyperparameter tuning on the YOLOv5 model to obtain the tuned YOLOv5 model.

[0119] Step S5: Start training the YOLOv5 model.

[0120] Step S51: Set initial weights, select the transfer target, and set the number of training iterations. The number of training iterations is determined based on the difficulty of coating defect identification; generally, more than 200 iterations yield the best training results.

[0121] Step S52: Please refer to Figure 7 and Figure 8 To start training, open the Python console in PyCharm or directly enter "python train.py --weights weights / yolov5s.pt --cfg models / yolov5s.yaml --data data / myvoc.yaml --epoch 200 --batch-size 8 --img640 --devicecpu" in the program run box.

[0122] Step S53: Deploy the debugged YOLOv5 model in C++.

[0123] Step S54: In the PyCharm Python console, execute `python export.py --weight sbest.pt --include onnx` to convert the resulting best.pt file into onnx format.

[0124] Step S55: As shown, best.onnx is deployed in C++ using the OpenVino deep learning inference framework. After deployment, the YOLOv5 model is integrated into the automated coating inspection system and begins online inspection.

[0125] Step S6: Transfer learning configuration.

[0126] Using a YOLOv5 model for transfer training, and continuing training with existing YOLOv5 model weights, can reduce the requirement for a large amount of defect data. The YOLOv5 website provides several existing models, commonly used ones include yolov5s, yolov5m, and yolov5n. YOLOv5s was selected as the transfer model through comparison, and training on coating defects was performed based on this model. The yolov5s.yaml file is the standard file for reading the yolov5s model dataset. Before transfer learning training, the file path, number of labels, and name of the dataset should be changed to yolov5s.yaml.

[0127] To achieve the above objectives, embodiments of the present invention also provide the following solutions:

[0128] A milling cutter coating post-defect detection system based on variable magnification microscopy, please refer to [link to relevant documentation]. Figure 9 It includes: image acquisition module 1, defect recognition module 2, microscope module 3, and depth measurement module 4.

[0129] Image acquisition module 1 acquires an initial image of the coating taken by the microscope at the first magnification; the initial image includes the entire coating; the initial image is an RGB color image.

[0130] In one example, the description of image acquisition module 1 is the same as that in step 1 above, and will not be repeated here.

[0131] The defect identification module 2 identifies defect regions in the initial image to obtain defect identification information of the coating. The defect identification information includes: first information indicating that the coating does not have defects; or, second information indicating that the coating has defects; and the size and location information of the defect region corresponding to the defect in the initial image.

[0132] In one example, the description of defect identification module 2 is the same as that in step 2 above, and will not be repeated here.

[0133] Microscope module 3 is used for:

[0134] After identifying defects in the coating, a second magnification of the microscope is determined based on the size of the defect area for measuring the defect depth; the second magnification is greater than the first magnification.

[0135] Based on the location information, the defect is moved to the center of the field of view of the microscope at the second magnification. When the defect is located at the center of the field of view of the microscope at the second magnification, the microscope is controlled to move in a direction perpendicular to the coating surface. During the movement, the coating is vertically scanned to obtain multiple images as a series of images.

[0136] In one example, the description of microscope module 3 is provided in steps 3 and 4 above, and will not be repeated here.

[0137] Depth measurement module 4 is used for:

[0138] Calculate the digital image entropy for each series of grayscale images.

[0139] The top and bottom of the defect are determined based on the calculated digital image entropy.

[0140] The depth of the defect is obtained based on the vertical positions corresponding to the top and bottom.

[0141] In one example, the description of the depth measurement module 4 is provided in steps 5, 6, and 7 above, and will not be repeated here.

[0142] In other embodiments of the present invention, the image acquisition module 1 is further configured to:

[0143] Determine whether the initial image includes the entire coating.

[0144] If so, then perform the defect region identification operation on the initial image.

[0145] If not, adjust the value of the first magnification and return to the operation of acquiring the initial image of the coating taken with the microscope at the first magnification.

[0146] In one example, the description of image acquisition module 1 is provided in steps 11, 12 and 13 above, and will not be repeated here.

[0147] In other embodiments of the present invention, determining the second magnification required by the microscope for depth measurement based on the size of the defect area specifically includes:

[0148] Get the absolute value of the maximum difference in the horizontal coordinates of all pixels in the defect area; get the absolute value of the maximum difference in the vertical coordinates of all pixels in the defect area.

[0149] The absolute value of the maximum difference on the horizontal axis is the longest value of the defect area, and the absolute value of the maximum difference on the vertical axis is the widest value of the defect area.

[0150] The second magnification is obtained by matching the longest and widest values ​​with all magnification factors.

[0151] In one example, please refer to the descriptions of steps 31, 32, and 33 above for the description of this part, and it will not be repeated here.

[0152] In other embodiments of the present invention, the top and bottom of the defect are determined based on the calculated digital image entropy, specifically including:

[0153] When the digital image entropy is less than the first threshold, the height position corresponding to the grayscale image is the top of the defect.

[0154] When the digital image entropy equals the second threshold, the height position corresponding to the grayscale image is the bottom of the defect.

[0155] In other embodiments of the present invention, calculating the digital image entropy of each series of images specifically includes:

[0156]

[0157] p i(n) =m i (n) / N(n),

[0158] Where n represents the image index, E(n) represents the digital image entropy of the image with index n, and P i(n) m represents the probability of a pixel with gray level i. i N(n) represents the number of pixels with gray level i, and N(n) represents the total number of pixels in the image with index n.

[0159] In one example, please refer to step 5 above for a description of this part; it will not be repeated here.

[0160] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0161] This document uses specific examples to illustrate the principles and implementation methods of the embodiments of the present invention. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of the embodiments of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the embodiments of the present invention. In summary, the content of this specification should not be construed as a limitation on the embodiments of the present invention.

Claims

1. A method for detecting defects on a milling tool coating based on variable magnification microscopy, the method comprising: obtaining an initial image of the coating taken by a microscope at a first magnification, the initial image comprising the entire coating, the initial image being an RGB color image; identifying a defect region in the initial image to obtain defect identification information of the coating, the defect identification information comprising: first information indicating that the coating has no defect, or second information indicating that the coating has a defect, and size and position information of the defect region corresponding to the defect in the initial image; determining a second magnification required for the microscope to measure the depth of the defect according to the size of the defect region when the coating is identified as having the defect, the second magnification being greater than the first magnification; displacing the defect to the center of the field of view of the microscope at the second magnification according to the position information, and controlling the microscope to displace along a direction perpendicular to the surface of the coating while performing vertical scanning on the coating to obtain a plurality of images as a series of gray scale images when the defect is at the center of the field of view of the microscope at the second magnification; calculating a digital image entropy of each series of gray scale images; determining a top and a bottom of the defect according to the calculated digital image entropy; and obtaining the depth of the defect based on the vertical direction positions corresponding to the top and the bottom. After the initial image of the coating taken by the microscope at the first magnification is obtained, it is determined whether the initial image comprises the entire coating. If yes, the step of identifying the defect region in the initial image is performed. If no, the value of the first magnification is adjusted, and the step of obtaining the initial image of the coating taken by the microscope at the first magnification is returned. 3.The method of claim 1, wherein determining the second magnification required for the microscope to measure the depth of the defect according to the size of the defect region specifically comprises: obtaining an absolute value of a maximum value of horizontal coordinate difference of all pixel points in the defect region, and obtaining an absolute value of a maximum value of vertical coordinate difference of all pixel points in the defect region; the absolute value of the maximum value of the horizontal coordinate difference being a longest value of the defect region, and the absolute value of the maximum value of the vertical coordinate difference being a widest value of the defect region; and matching the longest value and the widest value with all magnifications to obtain the second magnification. Determining the top and the bottom of the defect according to the calculated digital image entropy specifically comprises: when the digital image entropy is less than a first threshold value, a height position corresponding to the gray scale image being the top of the defect; and when the digital image entropy is equal to a second threshold value, a height position corresponding to the gray scale image being the bottom of the defect. The calculation of the digital image entropy of each series of images specifically comprises: 6.A system for detecting defects on a milling tool coating based on variable magnification microscopy, the system comprising: ​ 2. The variable magnification microscopy based method of detecting post coating defects of a milling cutter according to claim 1, wherein, ​ ​ ​ ​ ​ ​ ​ ​ 4. The variable magnification microscopy based post-milling tool coating defect detection method of claim 1, wherein, ​ ​ ​ 5. The variable magnification microscopy based post-milling tool coating defect detection method of claim 1, wherein, ​ p i(n) = m i (n) / N(n),p i(n) ≥ 0, wherein n represents the serial number of the image, E(n) represents the digital image entropy of the image with serial number n, p i (n) represents the pixel probability with gray scale level i, m i (n) represents the pixel number with gray scale level i, and N(n) represents the total pixel number of the image with serial number n. ​ ​ An image acquisition module is configured to acquire an initial image of a coating taken by a microscope at a first magnification; the initial image includes the entire coating; the initial image is an RGB color image; A defect identification module is configured to identify a defect region in the initial image to obtain defect identification information of the coating; the defect identification information includes: first information indicating that the coating has no defect; or second information indicating that the coating has a defect, and size and position information of a defect region corresponding to the defect in the initial image; A microscope module is configured to: After identifying that the coating has a defect, determine a second magnification required for the microscope to measure the depth of the defect according to the size of the defect region; the second magnification is greater than the first magnification; displace the defect to the center of the field of view of the microscope at the second magnification according to the position information; when the defect is at the center of the field of view of the microscope at the second magnification, control the microscope to displace in a direction perpendicular to the surface of the coating, and perform vertical scanning on the coating during the displacement to obtain a plurality of images as a series of gray-scale images; A depth measurement module is configured to: calculate a digital image entropy of each series of gray-scale images; determine a top and a bottom of the defect according to the calculated digital image entropy; obtain the depth of the defect based on the vertical direction positions corresponding to the top and the bottom.

7. The variable-magnification microscopy-based post-milling cutter coating defect detection system of claim 6, wherein, The image acquisition module is further configured to: determine whether the initial image includes the entire coating; if yes, perform the operation of identifying the defect region in the initial image; if no, adjust the value of the first magnification, and return to the operation of acquiring the initial image taken by the microscope at the first magnification.

8. The variable-magnification microscopy-based post-milling cutter coating defect detection system of claim 6, wherein, Determining the second magnification required for the microscope to measure the depth according to the size of the defect region specifically includes: obtaining an absolute value of a maximum value of horizontal coordinate difference values of all pixel points in the defect region; and obtaining an absolute value of a maximum value of vertical coordinate difference values of all pixel points in the defect region; the absolute value of the maximum value of the horizontal coordinate difference values is a longest value of the defect region, and the absolute value of the maximum value of the vertical coordinate difference values is a widest value of the defect region; matching the longest value and the widest value with all magnifications to obtain the second magnification.

9. The variable-magnification microscopy-based post-milling cutter coating defect detection system of claim 6, wherein, Determining the top and the bottom of the defect according to the calculated digital image entropy specifically includes: when the digital image entropy is less than a first threshold value, a height position corresponding to the gray-scale image is the top of the defect; when the digital image entropy is equal to a second threshold value, a height position corresponding to the gray-scale image is the bottom of the defect.

10. The variable-magnification microscopy-based post-milling cutter coating defect detection system of claim 6, wherein, The calculation of the digital image entropy of each series of images specifically includes: p i(n) = m i (n) / N(n),p i(n) ≥ 0, wherein n represents the serial number of the image, E(n) represents the digital image entropy of the image with serial number n, p i (n) represents the pixel probability with gray scale level i, m i (n) represents the pixel number with gray scale level i, and N(n) represents the total pixel number of the image with serial number n.

Citation Information

Patent Citations

  • Hot-rolled strip steel surface defect detection method based on deep learning

    CN110660052A

  • Metering-level 3D super-depth-of-field microscopy system and detection method

    CN111256616A