An automatic cloth defect detection method based on area array industrial camera
Through surface array industrial cameras and deep learning technology, combined with twin neural networks and object detection models, the problems of low human eye accuracy in cloth defect detection and high price of linear array cameras and sensitive jitter are solved, and efficient and accurate cloth defects are achieved Automatic detection.
Patent Information
- Application Number
- CN202111309276.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-06
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-06
AI Technical Summary
The existing cloth defect detection methods rely on human eye examination and have low accuracy. The linear array industrial cameras are expensive and sensitive to jitter, resulting in a decline in image acquisition quality and cannot effectively replace human eye detection.
Using automatic detection method of cloth defects based on surface array industrial cameras, through image acquisition, segmentation, preprocessing, object detection and similarity detection, combined with twin neural networks and object detection models, the number of defects is calculated using virtual lines to avoid repeated counting and increase Detection accuracy.
It realizes low-cost and anti-jitter defect detection, avoids repeated counting of defects, and improves detection accuracy and robustness.
Smart Images

Figure CN114235810B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloth detection, and in particular to an automatic cloth defect detection method based on an area array industrial camera. Background Art
[0002] Whether in cloth manufacturers or clothing processing manufacturers, cloth defect detection is one of the essential links. At present, cloth defect detection is usually completed by human eye inspection. The accuracy of human eye inspection depends on the experience and responsibility of the inspector. In addition, the cloth defect detection task is a boring and heavy physical labor for the inspector. Not only does it not have a high accuracy rate, but it also damages the inspector's eyesight, which is not conducive to sustainable development. Therefore, using machine vision detection solutions to replace human eye detection has become an inevitable trend.
[0003] Although there are some vision-based cloth defect methods, such as the "A cloth defect detection method and device based on machine learning" disclosed in the Chinese patent application number: 201710267670.3 and the "cloth defect detection method based on neural network deep learning" disclosed in the Chinese patent application number: 201710182718.0, most of these methods use linear array industrial cameras as cloth image acquisition sensors. Linear array industrial cameras are suitable for shooting regularly moving objects due to their characteristics. Linear array industrial cameras are very sensitive to the relative position and distance between the object being photographed and the camera. When combined with traditional cloth inspection equipment, the linear array industrial camera will reduce the quality of image acquisition due to the jitter generated during the operation of the cloth inspection equipment, and this jitter is extremely common in traditional cloth inspection machines. In addition, the price of linear array industrial cameras is relatively high and the price of linear array industrial cameras is higher than that of area array industrial cameras under the same resolution parameters. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a cloth defect detection method based on a high-frequency area array industrial camera, which can replace the cloth defect detection scheme based on the human eye and line scan industrial camera with a lower-cost cloth defect detection scheme based on an area array industrial camera, and realize automatic detection in combination with machine vision.
[0005] In order to achieve the above-mentioned object of the invention, the specific scheme adopted by the present invention is:
[0006] A method for automatically detecting cloth defects based on an area array industrial camera comprises the following steps:
[0007] Step 1: Collect images;
[0008] Step 2: Segment the image into sub-images of size 416*416;
[0009] Step 3: Image preprocessing;
[0010] Step 4: Detect cloth defect targets;
[0011] Step 5: Detect the similarity between cloth defects;
[0012] Step 6: Set the virtual line to calculate the number of fabric defects.
[0013] Furthermore, the image preprocessing is divided into image denoising and image enhancement. The image denoising uses a Gaussian filter to remove image noise points, and the image enhancement uses a Retinex algorithm to equalize image brightness.
[0014] Furthermore, the detection of cloth defect targets is divided into an offline cloth defect target detection learning stage and an online cloth defect detection reasoning stage. In the offline cloth defect target detection learning stage, the defect points of the cloth image with defect points taken by the area array industrial camera are annotated according to the target detection VOC data format, and the annotated data are input into the target detection model in the form of a training set, and the model parameters are trained by the back propagation algorithm; in the online cloth defect detection reasoning stage, the output after image preprocessing is used as an input signal, and a target detection network is used to perform defect detection on it, and the type and size information of the defect points, as well as the position information relative to the image are output through a set threshold.
[0015] Furthermore, the target detection model in the offline cloth defect target detection learning stage includes YOLO v4, SSD or Faster RCNN.
[0016] Furthermore, the detection of similarity between cloth defects includes an offline cloth defect similarity learning stage and an online cloth defect similarity detection reasoning stage. The offline cloth defect similarity learning stage uses a deep learning algorithm based on a twin neural network to predict the similarity between cloth defects.
[0017] Furthermore, the offline cloth defect similarity learning stage specifically includes two steps. Specifically, the cloth defect data set collected in the offline cloth defect target detection learning stage is cropped and saved according to the position information and category information marked in the VOC data format, and the cropped images are classified and sorted in a way that the images of the same cloth defect collected in different time periods are identified as the same category; then, the data set is classified and trained using the twin neural network model with the backbone network of VGG16, and the model parameter training is performed using the back propagation algorithm.
[0018] Furthermore, the online cloth defect similarity detection and reasoning stage specifically includes three steps, specifically, cropping the defect points of the cloth image according to the position information in the output result of the cloth defect detection model in the online cloth defect detection and reasoning stage, and saving the cropped sub-image into the memory, recorded as img1; then inputting the cloth image collected in the next frame into the cloth defect detection model in the online cloth defect detection and reasoning stage, cropping the defect points according to the detection results, and saving the cropped sub-image into the memory, recorded as img2; finally, inputting img1 and img2 into the trained twin neural network for similarity detection. If the similarity value is greater than the set threshold, it indicates that img1 and img2 are the same defect in adjacent time periods.
[0019] Furthermore, the specific method of setting a virtual line to calculate the number of cloth defects includes first setting a horizontal virtual line in the lower half of the cloth image area; then, if the same cloth defect point detected in the step of detecting the similarity between cloth defects passes through the virtual line, the number of defects is increased by 1, and the type, size information and image information of the defect are recorded.
[0020] The beneficial effects of the present invention are:
[0021] (1) Use area array industrial cameras to replace linear array industrial cameras that are inexpensive and sensitive to jitter;
[0022] (2) The similarity detection between the defects in the previous and next frames is used to avoid the problem of repeated counting of defect points caused by the overlap of the previous and next frame images when the area array industrial camera is shooting the movement of the cloth;
[0023] (3) The same cloth defect point will appear at different relative positions in the cloth image, which increases the probability of detecting the defect point. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0025] The present invention is further described below by specific examples, but the present invention is not limited to the following examples. Within the scope of the present invention or without departing from the content, spirit and scope of the present invention, the changes, combinations or substitutions made to the present invention are obvious to those skilled in the art and are included in the scope of the present invention.
[0026] Example 1
[0027] A method for automatic detection of cloth defects based on an area array industrial camera, characterized in that:
[0028] Step 1: Image acquisition;
[0029] Step 2: Image segmentation: In order to adapt to the subsequent algorithm, the collected image is segmented into sub-images of size 416*416;
[0030] Step 3: Image preprocessing;
[0031] Step 4: cloth defect target detection; the specific details of step 4 are as follows:
[0032] Step 41: In the offline cloth defect target detection learning phase, the defect points of the cloth images taken by the area array industrial camera are annotated according to the target detection VOC data format, and the annotated data is input into the target detection model in the form of a training set, such as YOLO v4, SSD, Faster RCNN, etc., and the model parameters are trained using the back propagation algorithm;
[0033] Step 42: In the inference stage of online cloth defect detection, the output of step 3 is used as an input signal, and defect detection is performed on it using the object detection network. The type and size information of the defect point, as well as the position information relative to the image are output through the set threshold;
[0034] Step 5: similarity detection between cloth defects; the specific details of step 5 are as follows:
[0035] Step 51: In the offline cloth defect similarity learning phase, a deep learning algorithm based on a twin neural network is used to predict the similarity between cloth defects, which specifically includes two steps:
[0036] Step 511: cropping and saving the cloth defect dataset acquired in step 41 according to the position information and category information marked in the VOC format, and classifying and arranging the cropped images in a manner that the images of the same cloth defect acquired in different time periods are identified as the same category;
[0037] Step 512: using a twin neural network model with a backbone network of VGG16 to perform classification training on the data set, and using a back propagation algorithm to perform model parameter training;
[0038] Step 52: Online cloth defect similarity detection reasoning stage, specifically including 3 steps:
[0039] Step 521: cropping defect points of the cloth image according to the position information in the output result of the cloth defect detection model in step 42, and saving the cropped sub-image to the memory, recorded as img1;
[0040] Step 522: input the cloth image acquired in the next frame into the cloth defect detection model in step 42, crop the defect points according to the detection results, and save the cropped sub-image into the memory, which is recorded as img2;
[0041] Step 523: input img1 and img2 into the trained twin neural network for similarity detection. If the similarity value is greater than the set threshold, it means that img1 and img2 are the same defect in adjacent time periods;
[0042] Step 6: Set a virtual line to calculate the number of cloth defects; the specific details of step 6 are as follows:
[0043] Step 61: setting a horizontal virtual line in the lower half of the captured cloth image area;
[0044] Step 62: If the same cloth defect point detected in step 5 passes through the virtual line, the number of defects is increased by 1, and the type, size information and image information of the defect are recorded.
[0045] The present invention adopts an area array industrial camera as a cloth defect image acquisition sensor for a cloth inspection machine, and utilizes similarity detection between cloth defects to avoid the problem of repeated counting of defect points caused by the overlapping of regions between previous and next frame images when the area array industrial camera is shooting cloth movement. The area marked as defects in the result image output by the cloth defect target detection model is input into the twin neural network for training and inference, thereby improving the robustness of the similarity detection between cloth defects.
[0046] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for automatic detection of cloth defects based on an area array industrial camera, characterized in that: The following steps are involved: Step 1: Collect images; Step 2: Segment the image into sub-images of size 416*416; Step 3: Image preprocessing; Step 4: Detect cloth defect targets; Step 5: Detect the similarity between cloth defects. The detection of cloth defect similarity includes an offline cloth defect similarity learning stage and an online cloth defect similarity detection reasoning stage. The offline cloth defect similarity learning stage adopts a deep learning algorithm based on a twin neural network to predict the similarity between cloth defects. The offline cloth defect similarity learning stage specifically includes two steps. Specifically, the cloth defect dataset collected in the offline cloth defect target detection learning stage is cropped and saved according to the position information and category information marked in the VOC data format, and the cropped images are classified and sorted in a way that the images collected in different time periods of the same cloth defect are identified as the same category, and then the data is processed using a twin neural network model with a backbone network of VGG16. The set is classified and trained, and the back propagation algorithm is used to train the model parameters. The online cloth defect similarity detection reasoning stage specifically includes three steps, specifically, the cloth image is cropped according to the position information in the output result of the cloth defect detection model in the online cloth defect detection reasoning stage, and the cropped sub-image is saved in the memory, recorded as img1, and then the cloth image collected in the next frame is input into the cloth defect detection model in the online cloth defect detection reasoning stage, the defect point is cropped according to the detection result, and the cropped sub-image is saved in the memory, recorded as img2, and finally img1 and img2 are input into the trained twin neural network for similarity detection. If the similarity value is greater than the set threshold, it means that img1 and img2 are the same defect in adjacent time periods; Step 6: Set the virtual line to calculate the number of fabric defects.
2. The method for automatic cloth defect detection based on an area array industrial camera according to claim 1, characterized in that: The image preprocessing is divided into image denoising and image enhancement. The image denoising uses a Gaussian filter to remove image noise points, and the image enhancement uses a Retinex algorithm to equalize image brightness.
3. The method for automatic cloth defect detection based on an area array industrial camera according to claim 1, characterized in that: The detection of cloth defect targets is divided into an offline cloth defect target detection learning stage and an online cloth defect detection reasoning stage. In the offline cloth defect target detection learning stage, the defect points of the cloth image with defect points taken by the area array industrial camera are annotated according to the target detection VOC data format, and the annotated data are input into the target detection model in the form of a training set, and the model parameters are trained by the back propagation algorithm; in the online cloth defect detection reasoning stage, the output after image preprocessing is used as an input signal, and the target detection network is used to perform defect detection on it, and the type and size information of the defect points and the position information relative to the image are output through the set threshold.
4. The method for automatic cloth defect detection based on an area array industrial camera according to claim 3 is characterized in that: The target detection model in the offline cloth defect target detection learning stage includes YOLO v4, SSD or FasterRCNN.
5. The method for automatic cloth defect detection based on an area array industrial camera according to claim 1, characterized in that: The specific method of setting a virtual line to calculate the number of cloth defects includes first setting a horizontal virtual line in the lower half of the cloth image area; then, if the same cloth defect point detected in the step of detecting the similarity between cloth defects passes through the virtual line, the number of defects is increased by 1, and the type, size information and image information of the defect are recorded.
