A kind of multiple dimensioned tire X-ray defect detection method
Technical field
The invention belongs to computer vision and industrial detection technical field, specifically a kind of multiple dimensioned tire X-ray disease
Defect detection method.
Background technique
With the fast development of economy and society, tire industry plays more and more important role in life, from
Start within 2004, the tire yield in China ranks first in the world always.The wide variety of tire, is generally divided into oblique and meridian
Tire, radial are divided into half steel and all-steel radial tyre again, and all-steel radial tyre has complicated internal structure, right
Production process requires extremely harsh.It is unreasonable once to occur misoperation, molding, calendering and vulcanization size in production process, again
Ageing equipment in other words can all influence the remaining mass of tire.And the quality of tire the safety of automobile is played it is vital
Effect, so the control to tire quality is very crucial.
The important monitoring link of detection tire quality is exactly to shoot x-ray image to tire, is then differentiated according to X light image
Whether present tire has certain defect, be most initially by artificial cognition, proposed now using deep neural network model into
Row automatic discrimination can detecte position and the class of defect by the tire X-ray defect detection method based on neural network model
Type.
But not all deep neural network model all has good effect to the detection of tire X-ray defect,
Faster R-CNN (the real-time target detection based on region candidate network) network can position simultaneously defect and sort out disease
Defect type, but Faster R-CNN is to carry out feature extraction on obtained the last layer characteristic pattern, to carry out target knowledge
It is other.It is done so that there are the drawbacks of be, some information of wisp are had ignored in top-level feature, therefore only according to top layer
Feature carries out target identification, cannot completely reflect the information of Small object object.If can be in conjunction with the feature of multi-layer, so that it may
To greatly improve the accuracy of target detection.So needing a kind of fusion multilayer feature, multiple dimensioned tire X-ray defect detection
Method.
Summary of the invention
In view of above-mentioned, the present invention provides a kind of multiple dimensioned tire X-ray defect detection methods, can greatly improve defect
The accuracy of detection.
A kind of multiple dimensioned tire X-ray defect detection method is provided, is comprised the following steps that
S1, data mark: the tire X-ray check picture being collected into is labeled with LabelImg tool, marks out disease
Defect position, defect type, the defect position mark when marked with box, the defect type can there are many, mark file
Type be xml document;
S2, image preprocessing: the tire X-ray check picture is sharpened processing and obtains pretreated big picture;
S3, image cropping: by the pretreated big picture that size is 20000 × 1900 be divided into 11 1900 ×
1900 small figure, corresponding coordinate position is converted, and rewrites the xml document for recording the defect type and coordinate;
S4, FPN (feature pyramid network) fusion Faster R-CNN network model is built:;
S5, initialization model: setting parameter, the parameter include size unified after inputting picture, model in Search
The periodicity of the size of Selective (selective search) stage box and number, model training;
S6, image data set is divided into training set, verifying collection and test set: division principle is that the training set accounts for 70%,
The verifying collection and the test set respectively account for 15%;
S7, repeat the above steps S5, S6, can train to obtain multiple models, carries out test analysis to the multiple model,
It is tested based on the test set, obtains test result.
Further, Faster R-CNN network master mould mainly includes four parts in step S4:
1) Conv layers (convolutional layer) extracts characteristic pattern, uses the conv+relu+pooling (convolution on one group of basis
+ amendment linear unit+pond) layer extraction input picture feature maps (characteristic pattern), which is used in
Subsequent RPN layers and full articulamentum;
2) RPN (Region Proposal Networks, regional choice network), for generating region proposals
(candidate region) firstly generates a pile Anchor box (anchor box), (is normalized after cutting filtering is carried out to it by softmax
Exponential function) judge that anchors (anchor) belongs to prospect (foreground) or background (background);Meanwhile Ling Yifen
Branch bounding box regression (frame recurrence) corrects anchor box, forms more accurate proposal (candidate
Frame);
3) Roi Pooling (candidate pool area) layer, using RPN generate the proposals (candidate frame) and
The feature map that VGG16 (visual graphics generator 16) the last layer obtains, obtains the proposal of fixed size
Feature map (candidate frame characteristic pattern), target identification and positioning can be carried out using full attended operation below by entering;
4) Classifier (classifier) forms described Roi Pooling layers the feature map of fixed size
Full attended operation is carried out, the classification of specific category is carried out using Softmax, meanwhile, it is complete using L1 Loss (L1 loss function)
The exact position that operation obtains object is returned at bounding box regression (frame recurrence).
Further, FPN (feature pyramid network) concrete operation method in step S4 are as follows:
1) bottom-up path is made of multiple convolution modules, and each convolution module includes multiple convolutional layers, the bottom of from
In upward process, Spatial Dimension halves by module, and the output of each convolution module will make in top-down path
With;
2) top-down path, FPN use the Convolution Filter of a 1x1 by the channel depth of uppermost convolution module
256 dimensions are down to, image M5 is obtained, then obtain image P5 using the convolution of a 3x3, described image P5 is for target prediction
First Feature Mapping;Down along top-down path, FPN up-samples layer application arest neighbors before, meanwhile, FPN
1x1 convolution is applied to the individual features mapping in bottom-up access, then application point element is added, and obtains mesh using 3x3 convolution
Mark the Feature Mapping of detection.
Further, include: the training for carrying out model based on the training set in step S6, parameter is carried out based on verifying collection
Adjustment, the training carries out successive ignition, and the adjustment of parameter configuration is carried out using K cross validation method, and the training arrives
Certain period needs to check whether the current parameter configuration is correct, the specific steps are as follows:
1) in the training process of the model, the damage of the model above in the training set and the verifying collection is obtained
Lose the functional value of function;
2) after the training to certain period, the training is temporarily ceased, and current model is preserved, side
Just continue the training after;
3) the loss function value of the training set and the verifying collection is drawn, horizontal axis is periodicity, and the longitudinal axis is the loss
Functional value, whether the loss function value observed on the training set and the verifying collection is a correct downward trend;
If 4) be in step 3) in correct downward trend, need not adjustment parameter, at this moment import and saved in step 2)
The model continue training until reach model convergence;Otherwise it enters step 5);
5) if the functional value of loss function is not in correct downward trend, reason is just found, and adjusts the parameter,
The parameter returns in step S5 after determining.
The beneficial effects of the present invention are:
(1) present invention uses multiple dimensioned tire X-ray defect detection method, by extracting the feature of image multilayer, carries out
The accuracy of detection tire X-ray defect can be improved in multiple dimensioned fusion;
(2) using the network model of FPN fusion Faster R-CNN, Faster R-CNN provides Target detection and identification
Frame, but it is to carry out feature extraction on obtained the last layer characteristic pattern, to carry out target identification.But in this way
Do there are the drawbacks of be, some information of wisp are had ignored in top-level feature, thus only according to top-level feature carry out target
Identification, cannot completely reflect the information of Small object object.If can be in conjunction with the feature of multi-layer, so that it may greatly improve more
The accuracy of size measurement, FPN realize this point, so the network model of FPN fusion Faster R-CNN is highly suitable for X
The detection of light defect;
(3) for tire as the important spare part on automobile, the quality of production is related to the life security of people, tire X-ray disease
Defect differentiates last one of the critical point detected as tire quality, and the domestic quality inspection personnel that generallys use at present carries out quality surveillance, this
Kind mode has low efficiency, and at high cost, reliability is low and has the shortcomings that damage to quality inspection personnel eyes.The present invention passes through more rulers
The tire X-ray defect detection method of degree detects automatically differentiates tire defect, to accurately be supervised to tire quality, it is non-often with
It is of practical meaning.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present application, constitutes part of this application, this Shen
Illustrative embodiments and their description please are not constituted an undue limitation on the present application for explaining the application.In the accompanying drawings:
Fig. 1 is the multiple dimensioned tire X-ray defect testing process schematic diagram of one kind of the invention.
Fig. 2 is FPN fusion Faster R-CNN model structure of the invention.
Fig. 3 is FPN data flow architecture figure of the invention.
Fig. 4 is FPN concrete operations flow diagram of the invention.
Specific embodiment
Presently filed embodiment is described in detail below in conjunction with accompanying drawings and embodiments, how the application is applied whereby
Technological means solves technical problem and reaches the realization process of technical effect to fully understand and implement.
This example is intended to implement to obtain by this method a multiple dimensioned tire X-ray defect detection system.The realization process
Including collect tire X-ray check picture, picture is labeled, pre-process picture, FPN merge Faster R-CNN model take
Build with training, model loading, the specific implementation process is as follows:
(1) data mark, and mark x-ray image with LabelImg tool, mark out position, the type of defect, mark file
Type is xml document, and when marking defect, position is marked with box, and the labeling form of type is A, B, C, D......, K, specifically
Type is shown in Table 1:
1 defect type declaration of table
(2) image preprocessing.Original image is sharpened processing, original image has unsharp place, uses tool
Processing is sharpened to these parts, makes that picture lines is clearer, defect part is more prominent;
(3) image cropping.The original image that size is 20000 × 1900 is divided into 11 1900 × 1900 small figures, it will
Corresponding coordinate position is converted, and the xml document of record defect type and coordinate is rewritten;
(4) FPN fusion Faster R-CNN network model is built, Faster R-CNN network master mould mainly includes four
Point:
1) Conv layers (convolutional layer) extracts characteristic pattern: as a kind of CNN network objectives detection method, Faster R-
CNN uses conv+relu+pooling (convolution+amendment linear unit+pond) layer on one group of basis to extract input picture first
Feature maps (characteristic pattern), which is used in subsequent RPN layers and full articulamentum;
2) RPN (Region Proposal Networks, regional choice network): RPN network is mainly used for generating
Region proposals (candidate region) firstly generates a pile Anchor box (anchor box), leads to after cutting filtering is carried out to it
It crosses softmax (normalization exponential function) and judges that anchors (anchor) belongs to prospect (foreground) or background
It (background), be object or is not object, so this is one two classification;Meanwhile another branch bounding box
Regression (frame recurrence) corrects anchor box, forms more accurate proposal (candidate frame) (note: here more smart
Really for the regression of box again of full articulamentum below);
3) Roi Pooling (candidate pool area) layer: this layer using RPN generate proposals (candidate frame) and
The feature map that VGG16 (visual graphics generator 16) the last layer obtains, obtains the proposal of fixed size
Feature map (candidate frame characteristic pattern), target identification and positioning can be carried out using full attended operation below by entering;
4) Classifier (classifier): the feature map that Pooling layers of Roi form fixed size can be carried out
Full attended operation carries out the classification of specific category using Softmax, meanwhile, it is completed using L1 Loss (L1 loss function)
Bounding box regression (frame recurrence) returns the exact position that operation obtains object.
It is based on ResNet that above-mentioned FPN, which is merged the Conv layers partial replacement in Faster R-CNN network model,
The FPN network of (depth residual error network), replaced model structure are as shown in Fig. 2.
FPN is made of bottom-up and top-down two paths.Bottom-up path is common extraction feature
Convolutional network (uses ResNet network) herein.Bottom-up, spatial resolution is successively decreased, and detects more Multistory-tall building, network layer
Semantic values are increase accordingly.Top-down path, based on the semantic more rich higher layer of layer building resolution ratio.Although rebuilding
Layer is semantic abundant enough, but passes through these down-samplings and upper sampling process, and the position of target is no longer accurate.Therefore FPN is in weight
Lateral connection is increased between build-up layers and corresponding Feature Mapping, to help detector that position is better anticipated.These lateral connections
Play the role of jump connection (skip connection) (way of similar residual error network) simultaneously.FPN data flow architecture
As shown in Fig. 3.
FPN network concrete operations are as shown in Fig. 4, comprising: 1) bottom-up path is made of, often many convolution modules
A module includes many convolutional layers.In bottom-up process, Spatial Dimension halves (step-length is double) by module.Each convolution mould
The output of block will use in top-down path.2) top-down path, in attached drawing 4, FPN uses the convolution of a 1x1
The channel depth of C5 (uppermost convolution module) is down to 256 dimensions by filter, obtains M5.Then the convolution of a 3x3 is applied
P5 is obtained, P5 is exactly first Feature Mapping for being used for target prediction.Down along top-down path, FPN is to before
Layer is using arest neighbors up-sampling (x2).Meanwhile FPN applies 1x1 convolution to the individual features mapping in bottom-up access.Then
It is added using a point element.It is last equally to obtain the Feature Mapping of target detection using 3x3 convolution.This filter alleviates up-sampling
Aliasing effect.This process stops after P2, because the Spatial Dimension of C1 is too high.If do not stopped, follow an example to do to obtain P1
If, slow-motion journey can be dragged significantly.
(5) initialization model sets parameter, including size (in the present embodiment, picture unified after input picture
Long side can be arbitrary dimension, but short is 600pix on one side), model is at Search Selective (selective search)
The periodicity of the size of stage box and number, model training;
(6) image data set is divided into training set, verifying collection and test set.Division principle is training set 70%, verifying collection
15% is respectively accounted for test set.The distribution that the distribution of defect keeps every kind of defect original in training set, test set and verifying are concentrated
Meet the distribution of original defect type and grade.The training that model is carried out based on training set is collected based on verifying and carries out parameter
Adjustment, training carry out successive ignition, and the adjustment of model parameter is carried out using K cross validation method.Certain period is arrived in training,
Need to check whether current parameter configuration is correct, the specific steps are as follows:
1) in the training process of model, the functional value of the loss function of model above in training set and verifying collection is obtained.
2) after training to certain period, training is temporarily ceased, and current model is preserved, it is convenient with subsequent
Continuous training.
3) functional value of training set and verifying collection loss function is drawn, horizontal axis is periodicity, and the longitudinal axis is the letter of loss function
Numerical value;Loss function value may not decline, it is possible to decline it is slow, it is possible to begin to decline and rose instead later, need
Whether the loss function value observed on training set and verifying collection is a correct downward trend.
If 4) be in step 3) in correct downward trend, need not adjustment parameter, at this moment import and saved in step 2)
Model continue training until reach model convergence;Otherwise it enters step 5).
5) if the functional value of loss function is not in the downward trend of health, possible reason is just found, and adjust ginseng
Number, parameter return to above-mentioned steps (5) after determining.
(7) repeat the above steps (5), (6), can train to obtain multiple models, carries out test analysis, base to multiple models
It is tested in test set, test result cannot be used as with MAP (Mean Average Precision, bat) and commented
Valence index, because we do not need, and defect position is especially accurate, and emphasis is not in this practical problem of tire X-ray check
Defect can be missed.
The center of gravity of evaluation result is put both ways, and first aspect is the accuracy of normal picture and the judgement of defect picture,
It is defect picture which can be sorted out by, which first having to,;Second Problem is the tire X-ray in the case where picture is defect picture
Picture belongs to any specific defect type.Therefore we use measurement index be mainly normal picture recall ratio with look into
The precision ratio and recall ratio of the specific defect type and grade discrimination of quasi- rate and defect picture.
The recall rate, precision rate for comparing all models is selected in recall ratio and precision ratio all higher (recall ratio and Cha Zhun
Rate is both greater than model 85%) as last model, and such model is the relatively good model of generalization ability;If without this
The model of sample then illustrates that model is unavailable, needs to return to step (5) initialization model, and re -training model.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Include, so that commodity or system including a series of elements not only include those elements, but also including not clear
The other element listed, or further include for this commodity or the intrinsic element of system.In the feelings not limited more
Under condition, the element that is limited by sentence "including a ...", it is not excluded that in the commodity or system for including the element also
There are other identical elements.
Several preferred embodiments of the invention have shown and described in above description, but as previously described, it should be understood that the present invention
Be not limited to forms disclosed herein, should not be regarded as an exclusion of other examples, and can be used for various other combinations,
Modification and environment, and the above teachings or related fields of technology or knowledge can be passed through within that scope of the inventive concept describe herein
It is modified.And changes and modifications made by those skilled in the art do not depart from the spirit and scope of the present invention, then it all should be in this hair
In the protection scope of bright appended claims.