Tour type woven fabric defect on-line detector
Technical Field
The invention relates to a defect detection device for a woven fabric in an online production environment, and belongs to the technical field of defect detection of woven fabrics.
Background
China is a large textile country, and productivity of modern textile enterprises is highly developed, and improvement of product quality and reduction of production cost become the key points of survival of the enterprises, so quality control of textiles gradually becomes the focus of attention in the textile industry. In the process flow of fabric production, fabric quality inspection is an important link, defect detection is also an important content of fabric quality inspection, and fabric defects are also main factors influencing the quality of finished fabrics.
The traditional detection technology is mainly divided into a defect detection method based on spatial domain statistics, a defect detection method based on spectral analysis and a defect detection method based on model matching. The method based on the spatial domain statistics expresses the regional statistical characteristics through different algorithms, distinguishes the defects and the fabric background, and the common algorithms comprise fractal dimension, characteristic filtering, gray level statistics and the like. The method based on the spectrum analysis is characterized in that the image is transformed into a frequency domain, defects and the fabric background are distinguished by using the spectrum characteristics, and common algorithms comprise discrete Fourier transform, Gabor transform, wavelet transform and the like. A fabric model is judged firstly based on a model matching method, then model parameters are determined through a normal fabric, and whether the fabric contains defects is further detected, wherein a Gaussian Markov model, a Gaussian mixture model and the like are commonly used.
In recent years, the rise of deep learning provides a new idea for detecting the defects of the fabric. Liu Z et al detect fabric defects by using a convolutional neural network in a point-to-point based manner; wang B et al extract features of the fabric by using a convolutional network, and display the defect area by combining a low-rank model; the Jing Jun et al propose that the Faster R-CNN network is used for detecting defects of textured and colored fabrics, but at present, the research on the aspect of online detection of fabric defects in deep learning is still lacking in China.
Disclosure of Invention
The purpose of the invention is: the defect detection aiming at the online production environment of the woven fabric is realized.
In order to achieve the above object, an embodiment of the present invention provides a tour type woven fabric defect online detector for online detection of woven fabric defects and offline detection of woven fabric defects, comprising:
the image acquisition module is used for acquiring a real-time fabric image of the woven fabric to be detected when the woven fabric defects are detected on line;
the displacement module is used for driving the image acquisition module to carry out I times of full-width tour along the latitudinal direction when the woven fabric defects are detected on line, and the image acquisition module acquires fabric images in real time in the tour process; one tour is defined as: translating one end of the woven fabric breadth from the other end of the woven fabric breadth along the weft direction, and then returning the other end of the woven fabric breadth from the other end of the woven fabric breadth again, further defining a first translation process of translating one end of the woven fabric breadth to the other end of the woven fabric breadth along the weft direction in one tour, and defining a second translation process of returning one end of the woven fabric breadth from the other end of the woven fabric breadth along the weft direction, so that the image acquisition module acquires N real-time fabric images in the first translation process and the second translation process of one tour, and the N real-time fabric images acquired in the first translation process are in one-to-one correspondence with the N real-time fabric images acquired in the second translation process in the weft direction position, and then:
an overlapping area exists between an nth real-time fabric image obtained in the first translation process in the ith tour and an nth real-time fabric image obtained in the second translation process in the ith-1 tour, and the overlapping area exists between the nth real-time fabric image obtained in the second translation process in the ith tour, so that the purpose of covering the missed detection area for the second time is achieved, and the problem of missed detection of the woven fabric due to the fact that the woven fabric moves along the warp direction is solved, wherein N is 1, …, N, I is 2, …, I;
the woven fabric defect detection algorithm module is used for obtaining a target detection picture appointed by a user when the woven fabric defect is detected off line, detecting the defect of the target detection picture and outputting an off-line defect detection result; when the woven fabric defects are detected on line, real-time fabric images acquired by the image acquisition module are obtained, each real-time fabric image is subjected to traversal detection, and online defect detection results are output.
Preferably, in the first translation process and the second translation process in the ith tour, the image acquisition module is respectively stopped for M times, wherein M is greater than or equal to 1, so as to avoid the problem of motion blur caused by the fact that the image acquisition module is driven by the displacement module to move at a high speed.
Preferably, if the acquisition frequency of the image acquisition module is f, the running speed of the image acquisition module driven by the displacement module is v, and the width of the woven fabric is B, the following steps are performed: number of pauses
The pause duration is 0.1 s.
Preferably, the woven fabric defect detection algorithm module adopts a Vgg-16 network as a basic framework, and the size of a convolution kernel in a convolution layer of the Vgg-16 network is D2×D2×M2Is decomposed into a size D2×D2×M1Has a depth volume and size of 1 × 1 × M2Each depth convolution and point-by-point convolution are connected with batch standard BN and linear correction function Leaky _ Relu containing leakage, wherein D2Representing the convolution kernel size, M2Indicates the number of output channels, M1And the number of channels of the image input into the woven fabric defect detection algorithm module is represented.
Preferably, if the acquisition frequency of the image acquisition module is f, the running speed of the image acquisition module driven by the displacement module is v, the width of the woven fabric is B, the resolution of the image acquired by the image acquisition module is lxw, the running speed of the woven fabric driven by the woven fabric is u, and the scaling multiple of the image acquisition module is n, then:
thereby achieving the purpose of secondary covering the missed detection area.
Preferably, the fabric defect detecting method further comprises a data statistics module, which is used for generating a defect statistics graph or a defect statistics table according to the offline defect detection result or the online defect detection result output by the woven fabric defect detecting algorithm module.
Preferably, the displacement module includes the control unit, step motor drive unit, hold-in range slip table, detects camera, machine vision light source, wherein:
the control unit is used for outputting a pulse signal of the stepping motor;
the stepping motor driving unit receives the signal given by the control unit and then drives the detection camera through the synchronous belt sliding table to realize the full-width tour;
the detection camera is used for collecting the real-time fabric image;
the machine vision light source is used for providing a light source for the detection camera.
The invention also provides application of the tour woven fabric defect online detector, which is characterized in that the tour woven fabric defect online detector is arranged on a production line weaving machine to detect fabric defects in real time.
The invention provides a tour type online defect detector for woven fabrics, aiming at the characteristics of long running time, high omission factor and more resource occupation of the current woven fabric defect automatic detection technology. Firstly, designing an online defect detection algorithm of the woven fabric according to the surface characteristics of the woven fabric and the defect forming mechanism and image characteristics of the woven fabric, and reducing the parameter and calculated amount of a neural network by using deep separable convolution; secondly, a tour type online defect detection device is designed, a control unit outputs pulse signals to drive a stepping motor, a single camera on a synchronous belt sliding table is accurately controlled to perform latitudinal displacement, the actual meridional movement speed of the fabric during production is calculated to obtain the corresponding sliding table movement speed, a missed detection area for one-way detection is covered for the second time, and the full-width tour detection of 0.6m/s (the highest 0.8m/s) is realized. The invention can solve the defects of the prior automatic detection technology and realize defect detection on the woven fabric production line.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a neural network architecture of the present invention, the neural network infrastructure comprising three parts, an input layer, a hidden layer and an output layer, wherein the input image size is 224X 224, the hidden layer is divided into three parts, the first part is a standard convolutional layer and a depth convolutional layer plus a point-by-point convolutional layer, followed by a pooling layer; the second part is a pooling layer after repeating the point-by-point convolution layer and the depth convolution layer twice; and the third part is a pooling layer after repeating the point-by-point convolution layer and the depth convolution layer twice, and finally, a result is output by utilizing a Softmax layer.
FIGS. 3(a) and 3(b) are actual detection results of the algorithm of the present invention, wherein FIG. 3(a) is a loss curve and FIG. 3(b) is a classification accuracy curve;
FIG. 4 is a functional block diagram of the apparatus of the present invention;
FIG. 5 is a diagram of the apparatus layout of the present invention;
fig. 6 is a flowchart of the stepper motor control algorithm of the present invention.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
The tour woven fabric defect online detector provided by the invention can realize defect detection aiming at the woven fabric online production environment. The invention designs the tour type online defect detection device by using the neural network based on the depth separable convolution, arranges the tour type detection device on a production line weaving machine, and detects the fabric defects in real time.
The invention can perform off-line detection of the defects of the woven fabric, can also perform on-line detection of the defects of the woven fabric, and can perform statistics on defect data obtained by off-line detection or on-line detection. The online detection of the defects of the woven fabric is realized by traversing each fabric image acquired by an industrial camera through a data transmission directory of a monitoring camera, and the monitoring data transmission directory is manually set by a user. The offline detection of the defects of the woven fabric can designate a target detection picture, the defect detection is carried out on a single picture, and a target detection path is manually set by a user. And when the defect data statistics is carried out, generating a pie chart and line chart by counting the five types of fabric images under the target folder.
The invention provides a tour type woven fabric defect online detector which mainly comprises the following contents:
the industrial camera is used for collecting real-time fabric images of the woven fabric during online detection of defects of the woven fabric.
The raspberry pi control board is used as a control unit for outputting a stepping motor pulse signal and controlling a stepping motor driving unit.
The stepping motor driving unit drives the detection camera to realize I times of full-width tour through the synchronous belt sliding table under the control of the control unit. Wherein, because the total weight of the raspberry pi control board and the industrial camera is 600g and is lightly loaded, the synchronous belt sliding table selects a 45-section synchronous belt.
The industrial camera obtains a fabric image in real time in the tour process. One tour is defined as: and translating one end of the woven fabric breadth to the other end of the woven fabric breadth along the weft direction, and returning one end of the woven fabric breadth from the other end of the woven fabric breadth. And in the first tour, the process of translating from one end of the woven fabric breadth to the other end of the woven fabric breadth along the weft direction is defined as a first translation process, and the process of translating from the other end of the woven fabric breadth back to one end of the woven fabric breadth along the weft direction is defined as a second translation process. The industrial camera obtains N real-time fabric images in the first translation process and the second translation process of the first tour, and the N real-time fabric images obtained in the first translation process correspond to the N real-time fabric images obtained in the second translation process in the weft direction position one by one.
The control unit runs a stepping motor tour control algorithm to control the tour process of the industrial camera, and the method mainly comprises the following steps:
setting: the width of the woven fabric is Bmm, and the zoom factor of the industrial camera is
The resolution of the pictures collected by the industrial camera is L multiplied by W pixels, the running speed of the weaving machine is umm/s, the running speed of the industrial camera driven by the synchronous belt sliding table is vmm/s, and the picture collecting frequency is fHz, so that the number of the pictures collected by the industrial camera at one tour is L multiplied by W pixels
And (5) opening the paper.
If the woven fabric is static, the collected pictures can be spliced into a complete breadth, and the method comprises the following steps:
then there is
v=fLnmm/s
Time t of one tourxComprises the following steps:
acquisition time interval tsComprises the following steps:
when the woven fabric moves, the moving distance x is acquired oncesComprises the following steps:
xs=ts·umm
therefore, in order to overcome the image missing caused by the fabric movement, the invention adopts a method of overlapping the scanning area to avoid missing detection, namely in the invention, the N-th real-time fabric image obtained in the first translation process in the ith tour and the N-th real-time fabric image obtained in the second translation process in the I-1 th tour have an overlapping area, and the N-th real-time fabric image obtained in the second translation process in the ith tour have an overlapping area, thereby achieving the purpose of covering the missing detection area for the second time to overcome the image missing caused by the woven fabric moving along the warp direction, wherein N is 1, …, N, I is 2, …, I.
For this purpose, the area S of the missed inspection region is acquired in a single timesThe method comprises the following steps:
Ss=L·n·xsmm2
distance X of left-end collected image after one toursComprises the following steps:
Xs=G·xsmm
in the above formula, G is the left end number of missed calls after once tour, then has:
if the distance is just half of the collected image, the breadth of the left end of the two adjacent tours is completely collected once, namely:
the tour speed and the fabric movement speed satisfy the following formula:
the cruise speed should satisfy v ═ fLn
Then there is a relationship shown below:
the tour control algorithm of the stepping motor not only adopts the secondary covering missed detection area to realize no missed detection, but also has the problem of motion blur caused by high-speed motion of the synchronous belt sliding table. In order to match the movement speed of the fabric, the running speed of the synchronous belt sliding table is up to 0.8m/s, images acquired by an industrial camera are most likely to shake and blur at the speed, and in order to avoid the blur caused by high-speed movement, the invention separates pause in single scanning of the sliding table and divides pause acquisition areas to ensure that the camera keeps relatively static with the fabric weft direction during acquisition. The number of times of pause is as follows:
the pause duration is 0.1s and the pause distance is
After starting, displacement
The last step motor is stopped, then the step motor is started again and relatively displaced
Reciprocating until reaching the right end (stop)
And then), the stepping motor rotates reversely to reciprocate the process, and the flow of the control algorithm is shown in fig. 6.
The invention also comprises a woven fabric defect detection algorithm module, which is used for obtaining a target detection picture appointed by a user during the offline detection of the woven fabric defects, carrying out defect detection on the target detection picture and outputting an offline defect detection result. When the woven fabric defects are detected on line, real-time fabric images acquired by the image acquisition module are obtained, each real-time fabric image is subjected to traversal detection, and online defect detection results are output.
In the invention, the woven fabric defect detection algorithm module uses a deep neural network structure based on deep separable convolution, and the network can greatly reduce the parameter and the calculated amount so as to improve the operation speed of the algorithm. The essence of the depth separable convolution is to factorize the standard convolution into a depth convolution and a point-by-point convolution of 1 x 1 size, achieving separation of channels and regions. The network structure is shown in FIG. 1, a Vgg-16 network is used as a basic framework, and the size of a convolution kernel in a convolution layer of the Vgg-16 network is D2×D2×M2Is decomposed into a size D2×D2×M1Has a depth volume and size of 1 × 1 × M2Each depth convolution and point-by-point convolution are connected with batch standard BN and linear correction function Leaky _ Relu containing leakage, wherein D2Representing the convolution kernel size, M2Indicates the number of output channels, M1And the number of channels of the image input into the woven fabric defect detection algorithm module is represented.
Assume an input image size of D1×D1×M1Through D2×D2Convolution layer of convolution kernel, standard convolution kernel size in standard convolution is D2×D2×M2,M2The number of output channels, the parameter quantity of the convolutional layer is shown as the following formula:
N1=D2×D2×M1×M2
the calculated amount of convolutional layers is:
C1=D1×D1×M1×M2×D2×D2
the depth separable convolution divides the standard convolution into a depth convolution and a point-by-point convolution, and the size of a depth convolution kernel is D2×D2×M1The dot-by-dot convolution kernel size is 1 × 1 × M2Then the number of parameters of the deep convolution is
N2=D2×D2×M1
Calculated as
C2=D1×D1×M1×D2×D2
The number of parameters of the point-by-point convolution is
N3=1×1×M1×M2
Calculated as
23=M1×M2×D2×D2
It is not difficult to find the parameter N of the depth separable convolution layer2+N3<N1And the calculated quantity C2+C3C is less than the parameter and calculated amount of the standard convolution layer. As the input image edge length size, the number of input channels and the output image edge length size, the number of output channels increase, the amount of parameters and calculations for the depth separable convolution will be much smaller than for the standard convolution. Finally, the parameter quantity of the network is reduced by 120 thousands, the running time is 977 seconds, 70 defect images are detected per minute on average, the classification accuracy is 91.7 percent, and the actual detection results are shown in fig. 3(a) andFIG. 3(b) shows.