Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a method and a system for detecting the appearance defects of a cast part based on machine vision.
The purpose of the invention is realized by the following technical scheme:
a cast member appearance defect detection method based on machine vision comprises the following steps:
s1: selecting a plurality of casting parts as data samples of an appearance defect detection system, wherein the data samples comprise defect-free casting parts and defective casting parts which are respectively used as positive and negative samples, the defect types in the defective casting parts are required to cover all defect types needing to be detected, and the data samples meet the principle of data balance;
s2: respectively placing the selected castings under a vision system for phase extraction, wherein each casting is collected under the vision system to obtain a group of casting sample data containing a plurality of pieces of camera data information, and the sample data contains three-dimensional information, contour dimension information and color information;
s3: marking the collected sample data information of the casting, marking the casting without defects, and simultaneously marking the casting with defects according to different defect types;
s4: carrying out statistical learning analysis on the marked sample data of the casting part to obtain statistical learning analysis results about various types of defects; wherein, the characterization form of part defect type is form deviation, and the characterization form of the other defect types is form and color deviation;
s5: combining the statistical learning analysis result of the sample data, dividing the sample data with defects into two parts according to the defect characterization as morphological deviation or morphological and color deviation, and respectively using the two parts as first defect sample data and second defect sample data; inputting first defect sample data and normal sample data into a first algorithm model, inputting second defect sample data and normal sample data into a second algorithm model, and enabling different algorithm models to undertake different types of defect detection tasks;
s6: according to the result of the model training, supplementing the training sample again, and carrying out optimization training on the model until the performance index meets the requirement;
s7: placing the casting to be detected under the vision system for phase taking to obtain structured data information, and inputting the obtained structured data information into a first algorithm model and a second algorithm model after optimization training in parallel for carrying out different types of defect detection; the algorithm model design adopts a semi-supervised learning mode, has autonomous learning capability, and can further improve the detection precision of the system along with the continuous use of the system;
s8: the appearance defect detection system judges whether the casting part with the defects belongs to a repairable part or a scrapped part according to different types of the defects, sizes of the defects and distribution positions of the defects through preset conditions, and sends an analysis result to an execution mechanism to execute corresponding sorting action.
The method further comprises a step of calculating the size of the casting, and the actual product size of the casting is calculated according to the information of the contour size of the casting to be measured. So that the system can output the dimensional data information of the casting to be measured.
The defect types comprise sand holes, air holes, meat deficiency, fleshiness, surface sand adhesion, cracks, unclear marks, wrong boxes, box expansion, large air scars, small air scars, shallow air scars, cold partitions and tiny holes; wherein the defect characterization forms of the sand holes, the air holes, the meat deficiency, the meat excess, the surface sand sticking, the cracks, the unclear marks, the wrong boxes, the box expansion and the atmospheric scar are morphological deviation; the defect characterization forms of the small air scars, the shallow air scars, the cold barriers and the tiny holes are form and color deviation;
form deviation: deviations in profile, size and height occur;
morphology and color deviation: in addition to the morphological deviation, a difference from the normal area is shown in the color information.
In step S5, extracting characteristic scale information of each defect type for setting threshold parameters in the model, and inputting data into the algorithm model for training; the characteristic scale information comprises high and low scales, texture features, edge features, gray scale and RGB scale.
A machine vision-based casting part appearance defect detection system comprises a detection host, a vision system, an execution mechanism, a repair product hopper and a waste product hopper;
the detection host comprises a processor and a memory, wherein the memory is used for storing a computer program which can run on the processor and storing the first algorithm model and the second algorithm model after optimization training; the processor executes the computer program to realize the method;
the vision system is used for taking a phase of a data sample at the early stage and is used for training and optimizing an algorithm model; the later stage is used for carrying out comprehensive phase taking on the casting part to be detected and sending the obtained structured data information to the detection host;
the detection host machine judges whether the casting part with the defects belongs to a repairable part or a scrapped part according to the different types of the defects, the sizes of the defects and the distribution positions of the defects, sends an analysis result to the executing mechanism to execute sorting action, puts the repairable part into a repair product hopper, and puts the scrapped part into a waste product hopper.
The casting part is a cast brake disc.
The visual system comprises a first visual system and a second visual system, wherein the first visual system comprises a rotatable detection table for placing a brake disc to be detected and a first camera assembly for completing phase taking of a W surface, an X surface and a side surface of the brake disc to be detected in the rotation process of the brake disc to be detected;
the second vision system comprises a multi-axis manipulator used for taking down the brake disc to be detected from the detection platform and completing rotation, and a second camera assembly used for completing phase taking of the U surface, the V surface and the Y surface of the brake disc to be detected in the rotation process of the brake disc to be detected.
The first camera assembly and the second camera assembly are formed by distributing laser cameras and linear array cameras in an L-shaped array; or the first camera assembly and the second camera assembly are formed by distributing the laser cameras and the industrial cameras in an L-shaped array.
The first camera assembly and the second camera assembly are both binocular structured light cameras.
The system also comprises a feeding roller way, a detection channel, a through channel and a gantry manipulator, wherein the detection channel and the through channel are arranged between the feeding roller way and an original roller way side by side, the first vision system and the second vision system are sequentially arranged in the detection channel, and the through roller way is arranged in the through channel; the gantry manipulator is arranged above the detection table and used for transferring a brake disc to be detected on the feeding roller way to the detection table.
The invention has the beneficial effects that:
1. the invention provides a brand-new method for detecting the appearance and measuring the size of a casting part of a brake disc, which integrates detection and measurement and improves the dimension of ensuring the product quality. The linear camera (linear array camera) or the combination of the high-precision industrial camera and the laser camera is adopted to scan and take the phase of the brake disc, the laser camera is sensitive to three-dimensional space information and high-low scale information, the linear camera is sensitive to chromatic aberration information, and the high-precision detection of various common appearance defects of the casting parts can be realized at low cost by combined use.
2. The detection software algorithm is based on a data processing and statistical analysis technology, a neural network technology, a machine learning and deep learning technology, an artificial intelligence technology and the like, is applied to appearance detection and size measurement of the brake disc, and has certain universality on casting products.
3. When the appearance defects of the brake disc are detected, the defect types can be distinguished, and the subsequent process flow treatment is facilitated. The size and the defect position of the defect can be detected, whether the defect of the defective detection piece can be repaired or not can be automatically judged, automatic online detection is realized, the detection process is stable and reliable, the influence of artificial subjective factors and environmental factors is avoided, the efficiency is high, the detection precision is high, the quality control standard is uniform, and the requirement of actual production can be fully met.
4. The system classifies and positions the defect types, visually and visually presents the defect types, so that the defective parts can be repaired conveniently in the follow-up process of a factory, and the production efficiency is further improved.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, and it should be understood that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive effort based on the embodiments of the present invention, are within the scope of the present invention.
The detection software algorithm is based on a data processing and statistical analysis technology, a neural network technology, a machine learning and deep learning technology, an artificial intelligence technology and the like, is applied to appearance detection and size measurement of the brake disc, and has certain universality on casting products.
As shown in FIG. 1, the method for detecting the appearance defects of the cast parts based on machine vision comprises the following steps:
s1: selecting a certain number (more than or equal to 20000) of castings as data samples of an appearance defect detection system, wherein the castings contain defect-free castings and defective castings, the castings are respectively used as positive and negative samples, the defect types in the defective castings are required to cover all defect types to be detected (specifically, the defects of sand holes, air holes, meat deficiency, fleshiness, surface sand sticking, cracks, unclear marks, staggered boxes, box expansion, large air scars, small air scars, shallow air scars, cold shut, tiny holes and the like are covered), and the data samples meet the principle of data balance; wherein a cast part may contain a variety of defects;
s2: respectively placing the selected casting parts under a first visual system and a second visual system to carry out phase extraction of each surface (the meaning of the phase extraction in the application is that image information is extracted), wherein each casting part acquires a group of casting part sample data containing a plurality of pieces of camera data information under the visual system, and the sample data contains three-dimensional information, contour dimension information and color information;
because the first visual system and the second visual system are both camera arrays consisting of a plurality of cameras (a line laser scanning camera, a line camera and a high-precision industrial camera) according to a certain angle and arrangement mode, a group of casting sample data containing a plurality of camera data information can be obtained for each casting under the respective action of the first visual system and the second visual system, and structured association is carried out;
s3: marking the collected sample data information of the casting parts, marking the casting parts without defects as OK, and simultaneously marking the casting parts with defects according to different defect types;
s4: carrying out statistical learning analysis on the marked sample data of the casting part to obtain statistical learning analysis results about various types of defects; wherein, the characterization forms of part of defect types are morphological deviation (mainly the deviation appears in the outline, the size, the height and the like, such as sand holes, air holes, meat deficiency, meat excess, surface sand sticking, cracks, unclear marks, wrong boxes, expanded boxes, atmospheric air marks and the like), and the characterization forms of the other defect types are morphological and color deviation (except the morphological characteristic deviation, the color information shows the difference from the normal area, such as small air marks, shallow air marks, cold shut, tiny holes and the like). Normal areas refer to areas of normal color, i.e. the corresponding areas of the casting marked OK that are defect free.
The superficial air scar refers to an air scar which is flat in surface and located in the surface layer, the superficial air scar cannot be recognized only by a laser camera, but the superficial air scar can cause weak light and shade color difference on the surface, and the superficial air scar can be recognized by a linear camera.
For the fleshiness and the burr at the R angle, the fleshiness and the burr cannot be effectively identified through a laser camera, and the R angle influences the laser reflection direction and cannot effectively receive a laser signal; although the linear camera is not sensitive to 3D height difference information, the whole light intensity of the brake disc can be collected, and slight changes of local colors can be identified, so that the defects of fleshiness, burrs and the like at the R corner can be detected.
For small air scars, the detection precision of a laser camera can be exceeded, so that the laser camera cannot effectively recognize the small air scars, but small color differences can be generated by the small air scars, and recognition can be achieved through a linear camera.
For most defects, the combination of a laser camera and a linear camera can enable more accurate defect detection.
Description on statistical learning analysis: the statistical learning analysis means analyzing the sample data by using statistical and machine learning methods (e.g., linear regression, SVM, cluster analysis, etc.) to obtain a statistical learning analysis result about the data. The objects of statistical learning analysis in this patent are: and characteristic indexes such as size, texture, outline, edge, color and the like of various types of defects in the sample data.
S5: combining the statistical learning analysis result of the sample data, dividing the sample data with defects into two parts according to the defect characterization as morphological deviation or morphological and color deviation, and respectively using the two parts as first defect sample data and second defect sample data; inputting first defect sample data and normal sample data into a first algorithm model, inputting second defect sample data and normal sample data into a second algorithm model, wherein different algorithm models undertake different types of defect detection tasks, and the first algorithm model is mainly responsible for: the second algorithm model is mainly responsible for the detection and positioning of the defects of sand holes/air holes, meat deficiency/meat excess, sand sticking on the surface, unclear identification, wrong boxes/box expansion and the like: and detecting and positioning defects such as cold shut, small air-scars, micro holes and the like.
In step S5, extracting characteristic scale information of each defect type for setting threshold parameters in the model, and inputting data into the algorithm model for training; the characteristic scale information comprises high and low scales, texture features, edge features, gray scale and RGB scale.
The 'setting of the threshold parameter in the model' refers to setting of an initial weight value of a network layer in the deep neural network model, and the setting of the threshold parameter is guided according to the characteristic indexes of the sample data obtained through the statistical learning analysis, so that the algorithm model can be converged more quickly and has better performance.
The threshold parameter also refers to target parameter setting of model training, for example, a target threshold is set for precision rate, recall rate and the like in the training process of the algorithm model, the model training is not finished until the algorithm model training meets the threshold set by the index, otherwise, the model training is continued by supplementing sample data, adjusting the weight of the deep neural network layer and the like.
S6: supplementing the training sample again according to the training result of the model, and carrying out optimization training on the model until performance indexes in all aspects meet requirements, specifically, the performance indexes such as accuracy (precision), recall rate, missed detection rate and running rate of the algorithm model meet the requirements;
for all data samples, one part of the data samples is used as a training set and input to the appearance defect detection algorithm model for model training, the other part of the data is used for testing the performance index of the trained model for model optimization, and the data and the model are repeatedly adjusted until the performance index meets the application requirement, namely the design requirement of the system for use.
The algorithm model is a multi-layer neural network structure, in the model training process, classification labeling of data is mainly carried out, statistical learning analysis is carried out on the labeled data, scale information of each defect type is extracted and used for setting threshold parameters in the model, and then the data are input into the model for training. The network model used in the application is a model based on the VGG19 network and the ResNet network structure modification, and is similar to all deep learning models, wherein the model comprises a pooling layer, a convolutional layer and a full-link layer.
S7: placing the casting to be detected under the vision system for phase taking to obtain structured data information, and inputting the obtained structured data information into a first algorithm model and a second algorithm model after optimization training in parallel for carrying out different types of defect detection; the algorithm model design adopts a semi-supervised learning mode, has autonomous learning capability, does not need repeated training in subsequent use of the optimally trained algorithm model, and further improves the detection precision of the system along with the continuous use of the system;
s8: transplanting the trained appearance defect detection algorithm model into a detection host, positioning the position of the defect by the detection host according to different types of the defect, the size of the defect and the distribution position of the defect for visual display, judging whether the casting part with the defect belongs to a repairable part or a scrapped part according to preset conditions, and sending an analysis result to an execution mechanism to execute corresponding sorting action.
The system can calculate the actual product size of the casting according to the contour dimension information of the casting to be measured and visually display the actual product size. The system can accurately output the dimension measurement information of the product, and the dimension measurement information serves as one of quality assurance indexes and also provides data indexes for the subsequent machining of the cast part in a factory.
The system can be orderly operated on a production site by matching with other peripheral software (execution mechanism control software) and hardware (a detection table, a mechanical arm and the like), and real-time online detection is carried out on the cast blank in the production process.
The system has fine classified storage of the whole process data of detection and measurement, has the function of outputting statistical analysis reports, and simultaneously provides various interfaces to be compatible with various management systems of a factory.
As shown in fig. 2 and 3, the machine vision-based casting part appearance defect detection system comprises a detection host, a vision system, an actuating mechanism, a repair product hopper 7 and awaste product hopper 8;
the detection host comprises a processor and a memory, wherein the memory is used for storing a computer program which can run on the processor and storing the first algorithm model and the second algorithm model after optimization training; the processor executes the computer program to realize the method of the previous step S7 and step S8;
the vision system is used for taking a phase of a data sample at the early stage and is used for training and optimizing an algorithm model; the later stage is used for carrying out comprehensive phase taking on the casting part to be detected and sending the obtained structured data information to the detection host;
the detection host machine judges whether the casting part with the defects belongs to a repairable part or a scrapped part according to the different types of the defects, the sizes of the defects and the distribution positions of the defects, sends an analysis result to the executing mechanism to execute sorting action, puts the repairable part into a reworked product hopper 7, and puts the scrapped part into awaste product hopper 8.
The preset conditions for judging whether the brake disc with the defects belongs to repairable parts or scrapped parts are as follows:
one is that the type of defect affects whether the product is rejected, such as cracks and blisters. Secondly, if the defect distribution position and the defect distribution size are larger than 2mm or the defect distribution position and the defect distribution size are larger than 2mm, the defect must be scrapped at the joint of the roof fall and the plate surface; the sticky sand and the fleshiness are also discarded if the size is larger than 2 x 2mm or the sticky sand and the fleshiness are distributed at the joint of the roof fall and the plate surface. Therefore, the invention uses the laser camera, can calculate the size of the defect besides the size of the brake disc through scanning, and positions the distribution position of the defect on the brake disc through an algorithm, and finally the system comprehensively evaluates whether the brake disc is scrapped.
The following specific examples illustrate the technical solution of the present application in combination with appearance detection and size measurement of a brake disc:
a common brake disc structure is shown in fig. 4, in this embodiment, the vision system includes a first vision system and a second vision system, the first vision system includes a rotatable detection table 1 for placing a brake disc to be detected, and afirst camera assembly 2 for completing phase taking of a W surface, an X surface and a side surface of the brake disc to be detected in a rotation process of the brake disc to be detected;
the second vision system comprises amulti-axis manipulator 3 used for taking down the brake disc to be detected from the detection table 1 and completing rotation, and asecond camera assembly 4 used for completing phase taking of the U surface, the V surface and the Y surface of the brake disc to be detected in the rotation process of the brake disc to be detected.
The detection system further comprises a feeding roller way 9, a detection channel, a through channel and agantry manipulator 11, wherein the detection channel and the through channel are arranged between the feeding roller way 9 and an original roller way 12 side by side, the first visual system (arranged at the detection station 1) and the second visual system (arranged at the detection station 2) are sequentially arranged in the detection channel, and the through channel is internally provided with the throughroller way 10; thegantry manipulator 11 is arranged above the detection table 1 and used for transferring a brake disc to be detected on the feeding roller way 9 to the detection table 1.
The detection channel and the through channel can be switched, when the detection system needs to be overhauled and maintained, the detection system can be switched to the through channel to transport workpieces, and normal production is not affected.
Appearance detection and dimension measurement process of the brake disc: arrange the brake disc that awaits measuring in first vision system throughportal manipulator 11 under, when driving the brake disc rotation through examining test table 1,first camera subassembly 2 gets the looks to the brake disc, and data transfer thatfirst camera subassembly 2 will gather detects the host computer, and the system is accomplished the detection and the classification to brake disc W face, X face and brake disc side this moment, calculates the external dimension information such as diameter (radius), each face thickness that measures and obtain the brake disc simultaneously.
Then, the brake disc is lifted (or overturned) by themulti-axis manipulator 3 and is rotated, the rotation phase taking is carried out under the action of thesecond camera assembly 4, the acquired data are transmitted to the detection host, the detection and classification of the U surface, the V surface, the Y surface and the like of the brake disc are completed by the system at the moment, and the size information such as the inner diameter of the brake disc is obtained by calculation and measurement.
And finally, comprehensively analyzing the obtained detection information and measurement information, transmitting an analysis result to a corresponding motion control unit, sorting the brake discs by the motion control unit through the motion of themulti-axis manipulator 3, if the brake discs are not defective, placing the brake discs on an original roller table 12 to be transmitted to the next process, if the brake discs are defective and the defect types belong to types which cannot be repaired, placing the brake discs in awaste product hopper 8 by themulti-axis manipulator 3, and if the defect types of the brake discs belong to types which can be repaired, placing themulti-axis manipulator 3 in a repair product hopper 7.
As shown in fig. 5 and 6, thefirst camera assembly 2 and thesecond camera assembly 4 are both formed by distributing thelaser cameras 5 and theline cameras 6 in an L-shaped array, and the L-shaped distribution is used for clearly and completely shooting each surface of the brake disc and the connection position of each surface. Theline camera 6 may also be implemented by a high-precision industrial camera instead.
If necessary, thefirst camera assembly 2 and thesecond camera assembly 4 may be used with a light source system for the purpose of improving the definition of taking the phase.
In addition, thefirst camera component 2 and thesecond camera component 4 may also adopt a high-precision binocular structured light camera, but the cost is relatively high, and the scanning imaging rate cannot meet the requirement of field production, because the binocular structured light is formed by arranging and converting structured light (such as stripe light) and then imaging by splicing, the process of scanning, photographing and imaging is time-consuming.
The foregoing is illustrative of the preferred embodiments of this invention, and it is to be understood that the invention is not limited to the precise form disclosed herein and that various other combinations, modifications, and environments may be resorted to, falling within the scope of the concept as disclosed herein, either as described above or as apparent to those skilled in the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.