Living cutter defect detection method based on machine vision and automatic sorting device
By combining a flexible flow guiding mechanism and multi-view imaging technology with an improved YOLOv8 model, the problem of identifying high reflectivity and low contrast defects in the inspection of everyday knives has been solved, realizing fully automated inspection and improving inspection efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHAOQING UNIV
- Filing Date
- 2026-01-15
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies for detecting defects in everyday knives suffer from several drawbacks. First, overexposure spots on highly reflective metal surfaces obscure sub-millimeter-level defect texture details. Second, the effective area resolution of long, strip-shaped knives is insufficient. Third, traditional deep learning models have limited ability to extract low-contrast, weak edge features, resulting in a high false negative rate. Fourth, these technologies fail to meet the requirements of high sensitivity and low false positive rate. Finally, there is a lack of imaging mechanisms and model optimizations adapted to the irregular geometric shapes of knives.
A flexible flow guiding mechanism is used to initially correct the tool orientation. Combined with photometric stereo method and multi-view synchronous imaging, an improved YOLOv8 lightweight high-precision defect detection model is used. Through multi-scale feature enhancement and dynamic channel optimization, full-surface image acquisition and defect identification are achieved.
It has achieved fully automated operation of the defect detection process for household knives, improving detection efficiency and accuracy, ensuring non-contact and non-damaging operation, and effectively overcoming the limitations of low efficiency and inconsistent standards in traditional manual inspection.
Smart Images

Figure CN121962069A_ABST
Abstract
Description
Machine Vision-Based Method for Defect Detection of Household Knives and Automated Sorting Device Technical Field
[0001] This invention relates to the field of image data processing technology, and in particular to a machine vision-based method for detecting defects in everyday knives and an automated sorting device. Background Technology
[0002] With the continuous advancement of intelligent manufacturing and machine vision technologies, industrial automated inspection is increasingly widely used in the quality control of metal products. As frequently used daily consumer goods, the integrity of the cutting edge, surface finish, and structural consistency of household knives directly affect user safety and experience. Currently, defect detection for knife products still largely relies on manual visual inspection, which is not only inefficient and inconsistent in standards, but also struggles to meet the stringent real-time and accuracy requirements of high-speed production lines. Therefore, there is an urgent need to introduce high-precision, highly robust automated vision inspection systems to reliably identify and sort minute defects such as scratches, chips, and corrosion.
[0003] Machine vision-based defect detection for everyday knives faces multiple technical challenges. Existing general imaging solutions are prone to overexposure due to specular reflection on highly reflective metal surfaces, severely obscuring the texture details of sub-millimeter defects. Simultaneously, for long, narrow knives, a large number of pixels are occupied by invalid background in a single global imaging session, resulting in insufficient resolution of the effective area and limiting the identifiability of minute defects. Furthermore, while traditional deep learning detection models perform well in macroscopic target recognition, their default architecture has limited ability to extract subtle defect features with low contrast and weak edges, making it difficult to meet the high sensitivity and low false alarm rate requirements for knife quality inspection.
[0004] While existing technologies such as photometric stereo methods and multi-view image fusion have been used in specific industrial scenarios to improve reflection and coverage issues, a comprehensive solution covering the entire surface and process of everyday cutting tools has yet to be developed. On one hand, the lack of dedicated gripping and imaging mechanisms adapted to the irregular geometry of cutting tools makes stable and non-destructive multi-angle image acquisition difficult. On the other hand, existing algorithms have not optimized their model structures to account for the dimensional characteristics and distribution patterns of tool defects, resulting in a persistently high false negative rate in practical deployments. Especially in high-speed production line environments, these problems are intertwined, making the construction of an integrated automatic inspection system that balances imaging quality, detection accuracy, and system efficiency a critical technological bottleneck that the industry urgently needs to overcome. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a machine vision-based method for detecting defects in everyday knives and an automated sorting device. This method enables fully automated operation of the entire process, from grasping and positioning, multi-angle imaging to defect identification and automatic sorting. While ensuring contactless and non-destructive detection, it significantly improves detection efficiency and effectively overcomes the limitations of traditional manual detection, such as low efficiency and inconsistent standards.
[0006] In a first aspect, the present invention provides a machine vision-based method for detecting defects in everyday knives, comprising: S100, performing preliminary correction of the knife's orientation by using adjustable guide baffles installed on both sides of a conveyor belt; S200, acquiring and precisely locating an image set of the knife's upper surface to generate image set one and grasping pose information; S300, executing a robotic arm to grasp and acquire image set two, for achieving full-surface, blind-angle-free image acquisition of the knife; S400, simultaneously reading image set one and image set two, and calling a lightweight, high-precision defect detection model based on YOLOv8 to perform defect detection on the knife; S500, controlling the robotic arm to perform sorting actions based on the model output results, placing qualified products back on the conveyor belt and placing unqualified products into an unqualified storage box.
[0007] Preferably, S100 includes: an adjustable guide baffle with an adjustment angle range of ±15°; a polyurethane buffer layer with a thickness of 2mm covering the surface of the adjustable guide baffle; an adjustable distance between the adjustable guide baffle and the edge of the conveyor belt that can be adjusted within the range of 50mm to 150mm; the adjustable guide baffle is driven by a stepper motor and a ball screw structure; when the cutting tool moves into the correction area with the conveyor belt, the baffles on both sides form a convergence channel according to preset parameters, and the flexible buffer layer gently guides the cutting tool to align along the conveying direction.
[0008] Preferably, step S200 includes: triggering a photoelectric switch when the tool moves to a preset position; an image acquisition device automatically acquiring a group of images of the tool's upper surface; the image acquisition device includes a high-definition industrial camera and an 8-point ring light source; illuminating the 8-point ring light source and simultaneously capturing 8 images of the tool's upper surface under illumination at different angles by the high-definition industrial camera; establishing a system of equations based on the 8 images of the tool's upper surface at different angles using pre-calibrated light source position information; solving for the normal vector and albedo of each pixel; generating an albedo map, gradient map, normal vector map, and curvature map using a photometric stereo method; wherein, the albedo map is generated by solving a system of linear equations based on the Lambertian reflection model, and the normal vector of each pixel is calculated using the least squares method; the gradient map is generated by convolution using the Sobel operator; the curvature map is calculated based on Gaussian curvature; and the number of local imaging operations required is calculated based on the conveyor belt speed and the tool length, and repeated imaging is performed. The process involves several steps: First, processing is performed to ensure coverage of the tool's upper surface. Multiple albedo images are used as input, and the SURF algorithm is used for feature point matching. Lowe's algorithm is used to initially eliminate incorrect matches, and the RANSAC algorithm is used for depth filtering based on geometric constraints to obtain matching feature point pairs. An image stitching algorithm combining homography matrix transformation is used to stitch multiple local albedo images into image group one. The smallest bounding rectangle of the tool is extracted from image group one as the ROI region. The conveyor belt background is removed by grayscale thresholding, and the handle and blade are segmented based on their grayscale difference to generate grasping pose information. Centroid calculation uses the first-order moment method, and coordinate system transformation uses a perspective transformation matrix based on 4-point calibration. The coordinates of the handle centroid and blade centroid are calculated separately and transformed to the robot arm's world coordinate system. The two centroid centers are used as the target position of the robot arm's end effector, and the included vector angle is used as the tool's orientation angle to generate grasping pose information.
[0009] Preferably, S300 includes: the robotic arm is a four-axis SCARA robot, and the communication interface supports transmission control protocol, Internet protocol and fieldbus protocol; the end of the robotic arm is equipped with a specially designed dual-suction cup gripping tool, the two suction cups of the dual suction cup gripping tool have different heights to adapt to the thickness difference of the handle and the blade, and both suction cups are made of soft material; the robotic arm moves the tool to the area of the image acquisition device two according to the gripping posture information, and simultaneously captures images of the tail end of the handle, both sides of the handle, the lower surface of the handle and the lower surface of the blade, generating image group two covering the non-upper surface area of the tool; wherein, the image acquisition device two includes multiple sets of high-definition industrial cameras, and the high-definition industrial cameras are the same as those in the image acquisition device one; each high-definition industrial camera is equipped with an independent light source system.
[0010] Preferably, step S400 includes: after simultaneously reading image group one and image group two, performing image preprocessing on the read images; the image preprocessing includes eliminating uneven lighting and noise, sharpening image contours, superimposing the concave and convex features of the curvature map, and cross-validating with the defect region of the normal vector, to improve the contrast of image group one and image group two, enhance defect features, and generate a full-surface tool image group; the full-surface tool image group is input into a lightweight high-precision defect detection model based on YOLOv8 for tool defect detection; if the tool has edge chipping, surface scratches, or corrosion defects, the output is "detection unqualified"; if the tool surface is smooth and without scratches, the output is "detection qualified".
[0011] Preferably, the lightweight, high-precision defect detection model based on YOLOv8 improvement includes: in the backbone part, replacing the standard Bottleneck block with a FasterBlock block, and achieving efficient feature extraction through a cascaded structure of partial convolution and pointwise convolution; wherein, the partial convolutional layer performs regular convolution on 1 / 4 of the input channels, and directly retains the remaining channels; the partial convolutional layer is followed by a pointwise convolutional layer, which fuses the features after partial convolution with the features of the retained channels to enhance the feature representation at the center position; a scale prediction head is added at the end of the backbone to construct a target scale-channel number mapping function, and when detecting small targets, the channel ratio of the shallow network is increased to retain the detailed texture and edge information in the high-resolution feature map; the scale distribution of defects in the full-surface tool image group is predicted by predicting the scale response map / attention map of H×W through convolution, and the scale weight / attention weight is multiplied with the feature map channel by channel to suppress the activation of deep channels corresponding to large targets, while enhancing the response of shallow channels related to small targets. The network employs a channel attention layer after the output of each stage of the backbone. This layer uses a compression-excitation structure to perform global average pooling on the full-surface tool image group, generating a 1×1×C channel descriptor. Two fully connected layers are used to learn the nonlinear relationship between channels, multiplying the weight vector with the matching feature points channel by channel to enhance the weights of channels related to small targets by 0.5 times, thus highlighting small targets. A lightweight structure is used in the Neck part of the network to further optimize the network structure. The input feature channels are divided into four groups, each undergoing independent 3×3 convolution. Inter-group information interaction is achieved through pointwise convolution and channel rearrangement. Furthermore, when the prediction is dominated by small targets, the weight of shallow high-resolution features in multi-scale fusion is increased; when the prediction is dominated by large targets, the fusion weight of deep semantic features is increased. During model inference, the 1×1 convolution kernel identity mapping is converted to a 3×3 convolution kernel in identity matrix form, achieving an equivalent transformation from multi-branch to single-path. The BN layer parameters of each branch during training are merged into the convolution kernel weights and biases.
[0012] Preferably, S500 includes: controlling a robotic arm to perform sorting actions based on the model output results, returning qualified products to the conveyor belt, and placing unqualified products into an unqualified storage box; wherein the robotic arm is controlled by a PLC / motion controller, and the robotic arm's motion trajectory adopts fifth-order polynomial interpolation programming; the unqualified storage box has a capacity of 100 pieces.
[0013] Secondly, the present invention also provides an automated sorting device based on machine vision, applying the aforementioned machine vision-based method for detecting defects in everyday knives. The device includes a conveyor belt, a coarse correction module, an image acquisition device one, a robotic arm picking module, an image acquisition device two, and a central controller. The conveyor belt is used to transport knives. The coarse correction module is used to coarsely correct the orientation of the knives to ensure the stability of subsequent image acquisition. The image acquisition device one is used to acquire local images of the upper surface of the knives and generate image group one, while providing positioning information for the robotic arm. The robotic arm picking module is used to stably grasp the knives and move them to the area of image acquisition device two; simultaneously, qualified knives are returned to the conveyor belt, and unqualified knives are placed in an unqualified storage box. The image acquisition device two is used to acquire images of the knife surface from multiple angles and generate image group two, achieving full-coverage image acquisition of the knife surface. The central controller is used to accurately detect defects on the knife surface based on image group one and image group two, and to screen out unqualified knives.
[0014] Compared with existing technologies, this invention has the following advantages and beneficial effects: The invention achieves initial orientation correction of the tool through a flexible flow guiding mechanism, providing a stable attitude foundation for subsequent visual positioning; it employs a strategy combining photometric stereo method and multi-view synchronous imaging to effectively suppress interference from high reflectivity on the metal surface, achieving high-quality image acquisition across the entire tool surface without blind spots. Regarding defect recognition, the lightweight, high-precision defect detection model based on improved YOLOv8, through the introduction of a dynamic channel optimization mechanism and multi-scale feature enhancement structure, significantly improves the recognition accuracy and robustness for low-contrast defects such as micro-scratches and edge chipping.
[0015] In summary, this invention achieves fully automated operation from grasping and positioning, multi-angle imaging to defect identification and automatic sorting. Under the premise of ensuring non-contact and non-destructive testing, it significantly improves testing efficiency and consistency, effectively overcoming the limitations of traditional manual testing, such as low efficiency and inconsistent standards. It provides a reliable technical solution for intelligent quality control of metal cutting tools. Attached Figure Description
[0016] Figure 1 is a flowchart illustrating a machine vision-based method for detecting defects in everyday cutting tools.
[0017] Figure 2 is a 3D scene layout diagram of a machine vision-based method for detecting defects in everyday cutting tools.
[0018] Figure 3 is a top view of a scene layout for a machine vision-based method for detecting defects in everyday cutting tools.
[0019] Figure 4 is a schematic diagram of a dual-suction cup gripping tool in a machine vision-based method for detecting defects in everyday knives.
[0020] Figure 5 is a schematic diagram of image acquisition device one in a machine vision-based method for detecting defects in everyday cutting tools.
[0021] Figure 6 is a schematic diagram of the optical path imaging of an image acquisition device in a machine vision-based method for detecting defects in everyday cutting tools.
[0022] Figure 7 is a schematic diagram of an automated sorting device based on machine vision. Detailed Implementation
[0023] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. 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 of ordinary skill in the art without creative effort are within the scope of protection of the present invention. It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0024] Example 1 (Refer to Figures 1-6) This example provides a machine vision-based method for detecting defects in household knives, including: S100, performing a rough orientation correction on the household knives on the conveyor belt. The orientation of the knives is initially corrected by adjusting the baffles installed on both sides of the conveyor belt to reduce interference from subsequent imaging and positioning algorithms.
[0025] Specifically, the adjustable guide baffle has an adjustment angle range of ±15 degrees, a 2mm thick polyurethane buffer layer covering its surface, and the distance between the baffle and the conveyor belt edge can be adjusted from 50mm to 150mm. The baffle is driven by a stepper motor and ball screw, achieving a positioning accuracy of ±0.1mm. When the cutting tool enters the calibration area with the conveyor belt, the baffles on both sides form a convergence channel according to preset parameters. The flexible buffer layer gently guides the tool along the conveyor direction, effectively suppressing posture confusion caused by random tipping or cross-stacking, laying the foundation for subsequent high-precision visual positioning.
[0026] S200: Acquire the image group of the upper surface of the tool and perform precise positioning to generate image group one and the tool's gripping pose information.
[0027] Specifically, when the tool moves to a preset position, a photoelectric switch is triggered, and an image acquisition device automatically acquires an image group of the tool's upper surface. This image acquisition device includes a high-definition industrial camera and an 8-point ring light source. The high-definition industrial camera is a global shutter color camera with a resolution of 5 megapixels, a pixel size of 3.45μm x 3.45μm, a frame rate of at least 30 frames per second, a telecentric lens with a focal length of 35mm, a working distance of 300mm, and a depth of field of 10mm. The 8-point ring light source uses red light-emitting diodes with a wavelength of 625nm, a power of 1W per diode, a light emission angle of 30 degrees, an inner diameter of 80mm, an outer diameter of 120mm, and eight diodes evenly distributed on a ring support with a 45-degree interval between adjacent diodes. Each diode's illumination time is 10ms, and the camera's exposure time is synchronously set to 10ms.
[0028] Eight ring-shaped light sources are illuminated, and eight images of the tool's upper surface under different lighting angles are simultaneously captured by a high-definition industrial camera. Based on the pre-calibrated light source positions and these eight images, a system of equations is established to solve for the normal vector and albedo of each pixel. In the photometric stereo processing, the albedo map is generated using a linear equation solution method based on the Lambertian reflection model. The normal vector of each pixel is calculated using the least squares method. The gradient map is generated through convolution using the Sobel operator, and the curvature map is obtained based on the Gaussian curvature calculation formula. These are used to generate high-quality albedo, gradient, normal, and curvature maps.
[0029] The number of local imaging operations required is calculated based on the conveyor belt speed and tool length. Repeated imaging ensures coverage of the tool's upper surface and generates a complete image set. For example, for a tool with a length of 200mm, a conveyor belt speed of 0.5m / s, and a camera field of view of 50mm, four consecutive imaging operations are required. Using multiple albedo maps from image set one as input, feature point matching is performed using the SURF algorithm. Lowe's algorithm is used to initially eliminate incorrect matches, and the RANSAC algorithm is used for depth filtering based on geometric constraints to obtain matching feature point pairs. Finally, an image stitching algorithm combining homography matrix transformation is used to stitch the multiple local albedo maps into a complete image set one.
[0030] In the first image set, the smallest bounding rectangle of the tool is extracted as the Region of Interest (ROI). The conveyor belt background is removed by grayscale thresholding, and the handle and blade are segmented based on their grayscale differences to generate complete grasping pose information. The handle and blade segmentation is based on a region growing algorithm, the centroid calculation uses a first-order moment method, and the coordinate system transformation uses a perspective transformation matrix based on 4-point calibration. The accuracy of the robotic arm end-effector target position calculation reaches ±0.5mm, and the tool orientation angle calculation accuracy reaches ±0.5 degrees. The coordinates of the handle centroid and blade centroid in the camera coordinate system are calculated and transformed to the robotic arm world coordinate system. The two centroid centers are used as the robotic arm end-effector target position, and the included vector angle is used as the tool orientation angle to generate complete grasping pose information.
[0031] S300: The robotic arm grasps and acquires image group two, used to achieve full-surface, blind-angle-free image acquisition of the tool. Specifically, the robotic arm is a four-axis SCARA robot with a maximum load of 5kg, a movement radius of 800mm, a maximum movement speed of 2m / s, and a communication interface supporting transmission control protocols, Internet Protocol, and fieldbus protocols. The end effector of the robotic arm is equipped with a specially designed dual-suction cup gripping tool. The suction cups on both sides have different heights to accommodate the thickness differences of the tool handle and blade, and soft materials are used to avoid scratching the blade and ensure stable gripping.
[0032] The robotic arm grips the tool based on its grasping posture information and moves it to a preset multi-faceted imaging station. This triggers image acquisition device two, which simultaneously captures images of the tool handle's tail end, both sides of the handle, the lower surface of the handle, and the lower surface of the blade from different angles. This forms image group two, covering the non-top surface area of the tool, achieving full-surface imaging without blind spots. Image acquisition device two includes multiple sets of high-definition industrial cameras, identical to those in image acquisition device one. Each high-definition industrial camera is equipped with an independent light source system. This multi-view synchronous imaging strategy effectively solves the imaging blind spot problem caused by structural obstruction on the sides and bottom of the tool.
[0033] S400 synchronously reads image group one and image group two, and calls the lightweight high-precision defect detection model based on YOLOv8 to perform defect detection on the tool.
[0034] Specifically, after synchronously reading image group one from S200 and image group two from S300, image preprocessing is performed on the read images. The image preprocessing includes eliminating uneven lighting and noise, sharpening image contours, superimposing the concave and convex features of the curvature map, and cross-validating with the defect region of the normal vector. This is used to improve the contrast of image group one and image group two, enhance defect features, and generate a full-surface tool image group.
[0035] The full-surface tool image group is input into the lightweight high-precision defect detection model based on YOLOv8 for tool defect detection. If the tool has obvious defects such as edge chipping, surface scratches, or corrosion, the output is "unqualified"; if the tool surface is smooth and without scratches, the output is "qualified".
[0036] Based on the foregoing, the lightweight, high-precision defect detection model based on YOLOv8 improvement includes: in the backbone part, the standard Bottleneck block is replaced with a FasterBlock block, and efficient feature extraction is achieved through a cascaded structure of partial convolution and pointwise convolution; wherein, the partial convolutional layer only performs regular convolution (3×3 kernel) on 1 / 4 of the input channels, and the remaining channels are directly retained; the partial convolutional layer is followed by a pointwise convolutional layer (1×1 kernel), which fuses the features after partial convolution with the features of the retained channels to enhance the feature representation of the center position.
[0037] A scale prediction head is added to the end of the backbone to construct a target scale-channel number mapping function. When detecting small targets, the channel ratio of the shallow network is automatically increased to preserve the detailed texture and edge information in the high-resolution feature map. The scale distribution of defects in the full-surface tool image group is predicted by convolution to predict the H×W scale response map / attention map. The scale weights / attention weights are multiplied with the feature map channel by channel to dynamically suppress the activation of deep channels corresponding to large targets, while enhancing the shallow channel response related to small targets.
[0038] A channel attention layer is added after the output of each stage of the backbone. This channel attention layer adopts a compression-activation structure with a compression ratio of 16. Global average pooling is performed on the full-surface tool image group (H×W×C) to generate a 1×1×C channel descriptor, where each element represents the global spatial information of the corresponding channel. Two fully connected layers (containing ReLU activation) are used to learn the nonlinear relationship between channels. The weight vector is multiplied with the matching feature points channel by channel to set a 0.5x weight enhancement for channels related to small targets, thus highlighting small targets.
[0039] A lightweight structure is adopted in the Neck part of the network, and the network structure is further optimized by dividing the input feature channels into 4 groups, with each group undergoing independent 3×3 convolution. Inter-group information exchange is achieved through pointwise convolution and channel rearrangement, avoiding feature isolation problems caused by grouping. Furthermore, when the prediction is mainly of small targets, the weight of shallow high-resolution features in multi-scale fusion is increased; when the prediction is mainly of large targets, the fusion weight of deep semantic features is increased.
[0040] During model inference, the 1×1 convolutional kernel is expanded to 3×3 (with zero padding at the edges), and the identity mapping is converted into a 3×3 convolutional kernel in the form of an identity matrix, achieving an equivalent transformation from multi-branch to single-path. The BN layer parameters of each branch during training are merged into the convolutional kernel weights and biases, eliminating extra computation during inference and further improving inference speed.
[0041] S500: Based on the model output results, the robotic arm is controlled to perform sorting actions, returning qualified products to the conveyor belt and placing unqualified products into the unqualified storage box; wherein, the robotic arm is controlled by a PLC / motion controller, and the robotic arm's motion trajectory adopts fifth-order polynomial interpolation planning; the unqualified storage box has a capacity of 100 pieces.
[0042] Example 2 (Referring to Figures 2-7) provides an automated sorting device for household knives based on machine vision. It applies a machine vision-based defect detection method for household knives as described above. The device includes a conveyor belt, a coarse correction module, an image acquisition device one, a robotic arm picking module, an image acquisition device two, and a central controller. The conveyor belt transports the knives. The coarse correction module roughly corrects the orientation of the knives to ensure the stability of subsequent image acquisition. The image acquisition device one acquires a local image of the upper surface of the knives and generates image group one, providing positioning information for the robotic arm. The robotic arm picking module stably grasps the knives and moves them to the area of image acquisition device two. Simultaneously, qualified knives are returned to the conveyor belt, and unqualified knives are placed in an unqualified storage box. Image acquisition device two acquires images of the knife surface from multiple angles and generates image group two, achieving full-coverage image acquisition of the knife surface. The central controller accurately detects defects on the knife surface based on image group one and image group two, screening out unqualified knives.
[0043] All content not described in detail in this specification is prior art known to those skilled in the art, and the model parameters of each electrical appliance are not specifically limited; conventional equipment can be used. Electrical control components not mentioned in this technical solution are not shown in the figures because they are prior art, and will not be described further here.
[0044] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting defects in everyday knives based on machine vision, characterized in that: include: S100: The orientation of the cutter is initially corrected by adjusting the baffles installed on both sides of the conveyor belt; S200: Image group of the upper surface of the cutter is acquired and precisely positioned to generate image group one and grasping pose information; S300: The robotic arm grasps and acquires image group two to achieve full-surface image acquisition of the cutter without blind spots; S400: Image group one and image group two are read simultaneously, and the lightweight high-precision defect detection model based on YOLOv8 is called to perform defect detection on the cutter; S500: Based on the model output results, the robotic arm is controlled to perform sorting actions, putting qualified products back on the conveyor belt and placing unqualified products into the unqualified storage box.
2. The method for detecting defects in everyday knives based on machine vision according to claim 1, characterized in that: The S100 includes: an adjustable guide baffle with an adjustment angle range of ±15°; a polyurethane buffer layer with a thickness of 2mm covering the surface of the adjustable guide baffle; an adjustable guide baffle and conveyor belt edge distance that can be adjusted within the range of 50mm to 150mm; and an adjustable guide baffle drive using a stepper motor and ball screw structure.
3. The method for detecting defects in everyday knives based on machine vision according to claim 2, characterized in that: The S200 includes: triggering a photoelectric switch when the tool moves to a preset position; an image acquisition device automatically acquiring a group of images of the tool's upper surface; the image acquisition device includes a high-definition industrial camera and an 8-point ring light source; illuminating the 8-point ring light source, the high-definition industrial camera simultaneously captures 8 images of the tool's upper surface under illumination at different angles; establishing a system of equations based on the 8 images of the tool's upper surface at different angles using pre-calibrated light source position information, and solving for the normal vector and albedo of each pixel; generating an albedo map, gradient map, normal vector map, and curvature map using a photometric stereo method; wherein, the albedo map is generated by solving a system of linear equations based on the Lambertian reflection model, and the normal vector of each pixel is calculated using the least squares method; the gradient map is generated by convolution using the Sobel operator; the curvature map is calculated based on Gaussian curvature; the number of local imaging operations required is calculated based on the conveyor belt speed and the tool length, and repeated imaging is performed at the locations... The process involves several steps: First, ensuring coverage of the tool's upper surface. Using the albedo map as input, feature point matching is performed using the SURF algorithm. Lowe's algorithm is used to initially eliminate incorrect matches, and the RANSAC algorithm is used for depth filtering based on geometric constraints to obtain matching feature point pairs. An image stitching algorithm combining homography matrix transformation is used to stitch multiple local albedo maps into an image group. The smallest bounding rectangle of the tool is extracted from this image group as the Region of Interest (ROI). Gray-scale thresholding is used to remove the conveyor belt background, and the handle and blade are segmented based on their gray-scale difference to generate grasping pose information. Centroid calculation uses the first-order moment method, and coordinate system transformation uses a perspective transformation matrix based on 4-point calibration. The coordinates of the handle and blade centroids are calculated separately and transformed to the robot arm's world coordinate system. The two centroid centers are used as the target position at the robot arm's end, and the included vector angle is used as the tool's orientation angle to generate grasping pose information.
4. The method for detecting defects in everyday knives based on machine vision according to claim 3, characterized in that: The S300 includes: a specially designed dual-suction cup gripping tool at the end of the robotic arm, wherein the suction cups on both sides of the dual-suction cup gripping tool are at different heights to accommodate the thickness difference between the handle and the blade; the robotic arm moves the blade to the area of the image acquisition device two according to the gripping posture information, and simultaneously captures images of the tail end of the handle, both sides of the handle, the lower surface of the handle, and the lower surface of the blade, generating image group two covering the non-upper surface area of the blade.
5. The method for detecting defects in everyday knives based on machine vision according to claim 4, characterized in that: S400 includes: after synchronously reading image group one and image group two, performing image preprocessing on the read images; the image preprocessing includes eliminating uneven lighting and noise, sharpening image contours, superimposing the concave and convex features of the curvature map and cross-validating with the defect region of the normal vector, to improve the contrast of image group one and image group two, generating a full-surface tool image group; inputting the full-surface tool image group into a lightweight high-precision defect detection model based on YOLOv8 for tool defect detection; if the tool has edge chipping, surface scratches, or corrosion defects, the output is "detection unqualified"; if the tool surface is smooth and without scratches, the output is "detection qualified".
6. The method for detecting defects in everyday knives based on machine vision according to claim 5, characterized in that: The lightweight, high-precision defect detection model based on improved YOLOv8 includes: In the backbone, the standard Bottleneck block is replaced with a FasterBlock block, and efficient feature extraction is achieved through a cascaded structure of partial convolution and pointwise convolution; wherein, the partial convolutional layer performs regular convolution on 1 / 4 of the input channels, and the remaining channels are directly preserved; the partial convolutional layer is followed by a pointwise convolutional layer, which fuses the features after partial convolution with the features of the preserved channels across channels; a scale prediction head is added at the end of the backbone to construct a target scale-channel number mapping function. When detecting small targets, the channel ratio of the shallow network is increased to preserve the detailed texture and edge information in the high-resolution feature map; the scale distribution of defects in the full-surface tool image group is predicted by convolution to predict the scale response map / attention map of H×W, and the scale weight / attention weight is multiplied with the feature map channel by channel to suppress the activation of deep channels corresponding to large targets, while enhancing the correlation of small targets. The system employs a shallow channel response; after the output of each stage of the backbone, a channel attention layer is added. This channel attention layer uses a compression-excitation structure to perform global average pooling on the full-surface tool image group, generating a 1×1×C channel descriptor; two fully connected layers are used to learn the nonlinear relationship of the channels, and the weight vector is multiplied with the matching feature points channel by channel; a lightweight structure is adopted in the Neck part of the network to further optimize the network structure, dividing the input feature channels into 4 groups, each group undergoing independent 3×3 convolution; inter-group information interaction is achieved through pointwise convolution and channel rearrangement; in addition, when the prediction is mainly small targets, the weight of shallow high-resolution features in multi-scale fusion is increased; when the prediction is mainly large targets, the fusion weight of deep semantic features is increased; during model inference, the 1×1 convolution kernel identity mapping is converted into a 3×3 convolution kernel in the form of an identity matrix, realizing the equivalent transformation from multi-branch to single-path; the BN layer parameters of each branch during training are merged into the convolution kernel weights and biases.
7. The method for detecting defects in everyday knives based on machine vision according to claim 1, characterized in that: The S500 includes: the robotic arm is controlled by a PLC / motion controller, and the robotic arm's motion trajectory is planned using a fifth-order polynomial interpolation.
8. An automated sorting device for household knives based on machine vision, characterized in that: The method for detecting defects in everyday knives based on machine vision, as described in any one of claims 1-7, comprises a conveyor belt, a coarse correction module, an image acquisition device one, a robotic arm picking module, an image acquisition device two, and a central controller. The conveyor belt transports the knives. The coarse correction module roughly corrects the orientation of the knives to ensure the stability of subsequent image acquisition. The image acquisition device one acquires a local image of the upper surface of the knife and generates an image group one, providing positioning information for the robotic arm. The robotic arm picking module stably grasps the knife and moves it to the area of the image acquisition device two; simultaneously, qualified knives are returned to the conveyor belt, and unqualified knives are placed in an unqualified storage box. The image acquisition device two acquires images of the knife surface from multiple angles and generates an image group two, achieving full-coverage image acquisition of the knife surface. The central controller accurately detects defects on the knife surface based on image group one and image group two, screening out unqualified knives.