CN114677597B - Gear defect visual inspection method and system based on improved YOLOv5 network - Google Patents

Gear defect visual inspection method and system based on improved YOLOv5 network Download PDF

Info

Publication number
CN114677597B
CN114677597B CN202210580509.2A CN202210580509A CN114677597B CN 114677597 B CN114677597 B CN 114677597B CN 202210580509 A CN202210580509 A CN 202210580509A CN 114677597 B CN114677597 B CN 114677597B
Authority
CN
China
Prior art keywords
gear
module
defect
image
yolov5 network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210580509.2A
Other languages
Chinese (zh)
Other versions
CN114677597A (en
Inventor
朱大虎
贺敏琦
张曙文
华林
梁耀
赵凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hubei Zhongzhi Future Intelligent Equipment Manufacturing Co ltd
Wuhan University of Technology WUT
Original Assignee
Hubei Zhongzhi Future Intelligent Equipment Manufacturing Co ltd
Wuhan University of Technology WUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hubei Zhongzhi Future Intelligent Equipment Manufacturing Co ltd, Wuhan University of Technology WUT filed Critical Hubei Zhongzhi Future Intelligent Equipment Manufacturing Co ltd
Priority to CN202210580509.2A priority Critical patent/CN114677597B/en
Publication of CN114677597A publication Critical patent/CN114677597A/en
Application granted granted Critical
Publication of CN114677597B publication Critical patent/CN114677597B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B07SEPARATING SOLIDS FROM SOLIDS; SORTING
    • B07CPOSTAL SORTING; SORTING INDIVIDUAL ARTICLES, OR BULK MATERIAL FIT TO BE SORTED PIECE-MEAL, e.g. BY PICKING
    • B07C5/00Sorting according to a characteristic or feature of the articles or material being sorted, e.g. by control effected by devices which detect or measure such characteristic or feature; Sorting by manually actuated devices, e.g. switches
    • B07C5/34Sorting according to other particular properties
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B07SEPARATING SOLIDS FROM SOLIDS; SORTING
    • B07CPOSTAL SORTING; SORTING INDIVIDUAL ARTICLES, OR BULK MATERIAL FIT TO BE SORTED PIECE-MEAL, e.g. BY PICKING
    • B07C5/00Sorting according to a characteristic or feature of the articles or material being sorted, e.g. by control effected by devices which detect or measure such characteristic or feature; Sorting by manually actuated devices, e.g. switches
    • B07C5/36Sorting apparatus characterised by the means used for distribution
    • B07C5/361Processing or control devices therefor, e.g. escort memory
    • B07C5/362Separating or distributor mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The invention discloses a gear defect visual detection method and system based on an improved YOLOv5 network, wherein the system comprises a controller with an internal improved YOLOv5 network model, a conveying system consisting of a first conveying belt and a second conveying belt, an image acquisition module and a rejection mechanism, wherein the image acquisition module and the rejection mechanism are built on the conveying system; the improvement method comprises the steps of training an unmodified YOLOv5 network through a sample data set to obtain weight parameters, adding a convolution attention mechanism module and a repeated weighting bidirectional feature pyramid network into the YOLOv5 network model, and migrating the weight parameters to the improved YOLOv5 network model; the YOLOv5 network model is improved through the data set training, the gear defect detection model is built, images are collected through the image collection module and input into the gear defect detection model for recognition, and corresponding defective gears are removed according to recognition results.

Description

Gear defect visual detection method and system based on improved YOLOv5 network
Technical Field
The invention belongs to the field of product defect detection, relates to a product defect visual detection technology, and particularly relates to a gear defect visual detection method and system based on an improved YOLOv5 network.
Background
The gear is widely applied to various mechanical products, but the gear is easy to generate defects such as abrasion, corner collapse, cracking and the like in the using process, and the service life, the motion precision and the like of a moving part mechanism are influenced, so the defects of the gear need to be detected. Due to the geometrical shape characteristics of the gear, defects such as a broken angle are mainly distributed on the tooth surface, and defects such as cracks are mainly distributed on the end surface, so that multiple surfaces of the gear need to be detected. The traditional manual detection has large workload, easily causes visual fatigue of detection personnel, and has missed detection and wrong detection.
In recent years, machine vision technology has been developed rapidly, and machine vision-based detection technology is more and more widely applied to production and living. The detection of the gear comprises the steps of accurately and quickly identifying a gear outline image, identifying tiny cracks and other oil stains on the gear and the like. Most of the existing gear defect detection technologies adopt a digital image processing technology, but the traditional digital image processing technology has a single processing mode and algorithm, and the essence is to process an input image to achieve the purpose of detection. The method mainly comprises a stage of processing through low-level features of an image, and the processed image cannot effectively identify and segment burrs, fine cracks, stains and the like existing in the gear.
In addition, with the continuous improvement of computer performance, the detection method based on the deep learning framework is gradually popularized, and the industrial detection is promoted to be transformed towards the direction of automation and intellectualization. By adopting the deep learning technology, the gear defects can be accurately subjected to semantic recognition and segmentation, and the interference of background areas or other target pixels is reduced, so that the detection accuracy is improved.
Therefore, a suitable method and system are needed to accurately identify and position the surface defects of the tooth surface by applying deep learning and machine vision technologies, so as to realize automation of detection and sorting of multi-surface defects of the gear.
The invention patent with the application number of CN 202010121242.1 discloses a defect detection method for an automobile gear finished product based on machine vision, which utilizes a digital image processing technology to extract the outline and edge parts of parts such as a gear and the like, and then uses the extracted gear boundary image as prior information to be merged into an improved U-Net network structure to artificially supplement bottom layer characteristic information as a reference for network training.
The invention patent with the application number of CN 202010118873.8 discloses a fan gear defect detection method based on deep learning, which is characterized in that acquired gear discrete data is converted into a time-frequency diagram, and the time-frequency diagram is input into a feature extraction layer formed by ResNet-50 and FPN for training.
The invention patent application with the application number of CN202110000785.2 discloses a straight toothed spur gear defect detecting and sorting device, wherein a gear is adsorbed by an electromagnetic bar and is driven to rotate by an electric rotating seat, an eddy current sensor and the gear are on the same horizontal line at the moment, and related parameters of the gear can be measured by the eddy current sensor.
Disclosure of Invention
In order to solve the above problems, the present invention provides a gear multi-face defect visual inspection method and system based on an improved YOLOv5 network for a gear defect inspection process, so as to realize detection and automatic sorting of gear multi-face defects and provide an identification rate.
In order to realize the purpose, the technical scheme adopted by the invention is as follows:
the invention provides a gear defect visual inspection method based on an improved YOLOv5 network, which is characterized by comprising the following steps of:
s1, collecting image data: acquiring a surface image of a defective gear, and preprocessing the image to obtain a defective gear image;
s2, constructing a sample data set: marking the defect type in the defect gear image and using the defect type as a label, and constructing a sample data set of the defect gear by using the defect gear image and the corresponding label;
s3, obtaining a pre-training model: training a YOLOv5 network model by using the sample data set obtained in the step S2, and obtaining a weight parameter of the YOLOv5 network model;
s4, detection model improvement: improving a YOLOv5 network model, adding a convolution attention mechanism module and a repeated weighted bidirectional feature pyramid network to obtain an improved YOLOv5 network model;
s5, building a model, namely migrating the weight parameters obtained in the step S3 into an improved YOLOv5 network model, then training the improved YOLOv5 network model by using the sample data set obtained in the step S2 to obtain weight parameters suitable for gear defect detection, and completing the construction of the gear defect detection model;
s6, detecting defects, namely acquiring a gear image to be detected, preprocessing the gear image to be detected according to the preprocessing mode in the step S1 to obtain the gear image to be detected, and inputting the gear image to be detected into a gear defect detection model to perform defect detection and identification.
According to the invention, the accuracy of the gear defect is improved by improving the YOLOv5 network model and adding the convolution attention mechanism module and the repeated weighting bidirectional characteristic pyramid network.
The invention also provides a gear defect visual inspection system based on the improved YOLOv5 network, which is characterized by comprising the following components:
the conveying belt mechanism comprises a first conveying belt and a second conveying belt which are sequentially arranged according to a conveying sequence, wherein the height of the first conveying belt is higher than that of the second conveying belt;
the image acquisition module comprises a first detection module and a second detection module, wherein the first detection module is arranged above the first conveyor belt and is used for shooting and detecting the front side and the side surface of the workpiece;
the electromagnetic turnover mechanism is arranged between the first conveyor belt and the second conveyor belt and used for dropping the reverse side of the gear conveyed by the first conveyor belt onto the second conveyor belt;
the identification control module comprises a controller internally provided with the gear defect detection model;
the rejecting mechanism comprises a first rejecting module arranged at the tail end of the first conveyor belt and a second rejecting module arranged at the tail end of the second conveyor belt, and the rejecting mechanism is arranged on the conveyor belt mechanism and behind the image acquisition module;
the controller is used for receiving gear image data acquired by the image acquisition module, and controlling the rejecting mechanism to act to reject corresponding defective gears after the gear defect detection model identifies the gear image data.
The controller of the gear defect visual inspection system is internally provided with a gear defect inspection model, gear image data are collected through a hardware system of the gear defect visual inspection system, whether a gear has defects is identified through the gear defect inspection model, then the gear is removed through a removing module, automatic detection, identification and removal of the gear defects are completed, and manual quality inspection is completely replaced.
The beneficial effects of the invention are as follows:
1) The method is based on the YOLOv5 network, a convolution attention mechanism module is added, a feature fusion method is improved, and the gear defect image can be accurately detected and identified;
2) According to the gear multi-surface defect detection device provided by the invention, the gear end face is turned over through the electromagnetic turning mechanism, and finally, the automatic detection and sorting of the gear multi-surface defects are realized.
Drawings
FIG. 1 is a flow chart of a gear defect visual inspection method based on an improved YOLOv5 network in an embodiment of the invention;
FIG. 2 is a diagram of an original YOLOv5 network model;
FIG. 3 is a diagram of an improved gear defect detection model in an embodiment of the present invention;
FIG. 4 is a diagram of the original C3 block of the YOLOv5 network model;
FIG. 5 is a diagram of an improved CBAMC3 module according to an embodiment of the present invention;
FIG. 6 is a diagram of a CBAM module according to an embodiment of the present invention;
FIG. 7 is a diagram of a repeated BiFPN structure according to an embodiment of the present invention;
FIG. 8 is a comparison of algorithm performance indicators before and after improvement of a gear defect detection model in an embodiment of the present invention;
FIG. 9 is a schematic view of a gear defect vision inspection system according to an embodiment of the present invention;
FIG. 10 is a flowchart illustrating operation of the visual inspection system for gear defects according to an embodiment of the present invention;
fig. 11 is a table showing the operation cycle of the electromagnetic turnover mechanism according to the embodiment of the present invention.
Reference numerals: 1-a first conveyor belt, 2-a first limiting mechanism, 3-a first photoelectric switch, 4-a first industrial camera, 5-a first flat light source, 6-a second industrial camera, 7-a third industrial camera, 8-a camera support, 9-a fourth industrial camera, 10-a fifth industrial camera, 11-a first rejection module, 12-a slide carriage, 13-an electromagnet, 14-a bearing support, 15-a rotating mechanism, 16-an electromagnetic adsorption surface, 17-a second limiting mechanism, 18-a second photoelectric switch, 19-a camera support, 20-a sixth industrial camera, 21-a second flat light source, 22-a second rejection module and 23-a second conveyor belt.
Detailed Description
The invention will be further described by the following detailed description in conjunction with the drawings in which:
as shown in FIG. 1, the invention provides a gear defect visual inspection method based on an improved YOLOv5 network, which comprises the following steps:
s1, collecting image data: acquiring a surface image of a defective gear, and preprocessing the image to obtain a defective gear image;
s2, constructing a sample data set: marking the defect type in the defect gear image and using the defect type as a label, and constructing a sample data set of the defect gear by using the defect gear image and the corresponding label;
s3, obtaining a pre-training model: training a YOLOv5 network model (YOLOv 5S network model) by using the sample data set obtained in the step S2, and acquiring a weight parameter of the YOLOv5 network model;
s4, detection model improvement: improving the YOLOv5 network model, adding a convolution attention mechanism module and a repeated weighted bidirectional feature pyramid network to obtain an improved YOLOv5 network model;
s5, building a model, namely migrating the weight parameters obtained in the step S3 to an improved YOLOv5 network model, then training the improved YOLOv5 network model by using the sample data set obtained in the step S2 to obtain weight parameters suitable for gear defect detection, and completing the construction of the gear defect detection model;
s6, detecting the defects, namely collecting the gear image to be detected, preprocessing the gear image according to the preprocessing mode in the step S1 to obtain the gear image to be detected, and inputting the gear image to be detected into a gear defect detection model to detect and identify the defects.
In the operation process of step S5, in order to evaluate the detection result of the gear defect detection model, an experiment is performed on the test set, and three target detection evaluation indexes are selected, which are respectively Recall (Recall, R), accuracy (Precision, P), and mean Average Precision (mapp).
The accuracy and recall formulas are as follows:
Figure DEST_PATH_IMAGE001
Figure 772534DEST_PATH_IMAGE002
wherein, P is the average precision mean value, R is the recall ratio, TP is the prediction of the positive class as the positive class number, FP is the prediction of the negative class as the positive class number, and FN is the prediction of the positive class as the negative class number.
And in order to objectively evaluate the detection effect of the improved network, evaluating the model result by using the evaluation index.
As shown in fig. 8: compared with other algorithms, the improved gear defect detection model has higher mAP @0.5, the performance is obviously improved, and the detection and identification of the gear defects are effectively realized.
As a preferred embodiment, the image preprocessing in step S1 includes: median filtering denoising and contrast enhancement are performed, noise is eliminated through image preprocessing, and the recognition degree is improved.
As a preferred embodiment, in step S2, the sample data set construction method is as follows:
s2.1, forming a data set by all the defective gear images obtained in the step S1, carrying out random operation on all the images in the data set to obtain a new image, and expanding the data set; the random operation type comprises any one or more of combination of turning, rotating, translating, adding noise and zooming;
and S2.2, marking the defect types of the images in the enlarged data set to form a label, and constructing a sample data set.
S2.3, dividing the sample data set into a training set and a test set;
in the embodiment, the number of samples is greatly increased through a sample expansion technology, so that more accurate model weight parameters are obtained under the condition of limited defect gear images or more accurate training effect.
As a preferred embodiment, in step S2.3, the specific operations are: the gear defect images are marked by using a LabelImg tool, and xml files corresponding to the image samples one by one are obtained as samples.
As a preferred embodiment, in step S4, an original YOLOv5 network model architecture is shown in fig. 2, an improved YOLOv5 network model is shown in fig. 3, and a specific way of improving the YOLOv5 network model is as follows:
(1) Adding a convolution attention mechanism module means that the last standard convolution module Conv in the C3 module of the YOLOv5 network model is converted into a CBAM module to form a CBAMC3 module, the C3 module of the YOLOv5 network model is shown in FIG. 4, and the improved CBAMC3 module is shown in FIG. 5;
(2) Adding the repeated weighted bidirectional feature pyramid network refers to adding a repeated BiFPN structure into the YOLOv5 network model, and combining with a Concat method to form a Concat _ BiFPN module.
As a preferred embodiment, in step S4, as shown in fig. 6, the CBAM Module includes two independent sub-modules, namely a Channel Attention Module CAM (Channel Attention Module) and a Spatial Attention Module SAM (Spatial Attention Module), wherein the CAM Module performs Channel processing on the input feature map, and the SAM Module performs Spatial processing on the input feature map.
The CAM module mainly compresses an input feature map on a channel dimension to obtain a one-dimensional vector, and then operates the one-dimensional vector to obtain the input features of the SAM.
The SAM module aims to improve the feature expression of the key region, essentially transforms the spatial information in the original picture into another space through the spatial transformation module, retains the key information, generates a weight mask for each position and weights the output.
The CBAMC3 module takes the feature map after Concat operation in the C3 module as the input of the CBAM module, firstly, the input feature is processed into channel-based through the CAM moduleM c Drawing, then willM c Multiplying the input features to obtain SAM input features, and modifying the input features to be space-based via SAM module operationM S Is characterized in thatM S And multiplying the input characteristics to obtain output characteristics.
As a preferred embodiment, as shown in fig. 7, in step S4, the repeating BiFPN structure refers to that a BiFPN module is regarded as a basic unit, stacked repeatedly, a pair of paths are regarded as a feature layer, and then repeated multiple times to obtain more high-layer feature fusions.
As a preferred embodiment, the BiFPN module can realize efficient bidirectional cross-scale connection and weighted feature map fusion. The BiFPN module is based on a PAN structure, a node with only one input is removed, the node with only one input is assumed to contribute little to feature fusion, then in order to fuse more feature information, a skip connection is added in the same level layer, a top-down and a bottom-up connection method is used as a basic layer, and the BiFPN feature fusion module is formed by continuously repeating the module.
As shown in fig. 9, the present invention further provides a gear defect visual inspection system based on the improved YOLOv5 network, including:
the conveying belt mechanism comprises a first conveying belt 1 and a second conveying belt 23 which are arranged in sequence according to a conveying sequence, wherein the height of the first conveying belt 1 is higher than that of the second conveying belt 23;
the image acquisition module comprises a first detection module and a second detection module, wherein the first detection module is arranged above the first conveyor belt 1 and used for shooting and detecting the front side and the side surface of the workpiece, and the second detection module is arranged above the second conveyor belt 23 and used for shooting and detecting the back side of the workpiece;
the electromagnetic turnover mechanism is arranged between the first conveyor belt 1 and is used for dropping the reverse side of the gear conveyed by the first conveyor belt 1 onto the second conveyor belt 23;
the identification control module comprises a controller (a computer or a PLC controller) with the built-in gear defect detection model;
the rejecting mechanism comprises a first rejecting module 11 arranged at the tail end of the first conveyor belt 1 and a second rejecting module 22 arranged at the tail end of the second conveyor belt 23, and is arranged on the conveyor belt mechanism and behind the image acquisition module;
the controller is used for receiving gear image data acquired by the image acquisition module, and controlling the rejecting mechanism to act to reject corresponding defective gears after the gear defect detection model is identified.
As a preferred embodiment, the electromagnetic turnover mechanism comprises a rotating body and a rotating mechanism 15 for driving the rotating body to rotate, the rotating body is provided with at least one electromagnetic adsorption surface 16, and each electromagnetic adsorption surface 16 is provided with an electromagnet 13 for adsorbing a gear; the height difference between the first conveyor belt 1 and the second conveyor belt 23 is larger than the required rotating space of the rotating body, when the electromagnetic adsorption surface 16 rotates to the top to be in butt joint with the first conveyor belt 1, the electromagnet on the surface is electrified to generate adsorption force to adsorb the gear; when the electromagnetic adsorption surface 16 rotates to the bottom along with the rotating body and is in butt joint with the second conveyor belt 23, the gear finishes the reverse surface, the corresponding electromagnet 13 loses power, and the gear on the reverse surface falls on the second conveyor belt 23.
As a preferred embodiment, the rotating body is a regular polyhedron, in this embodiment, the rotating body is a regular tetrahedron, each surface is an electromagnetic absorption surface 16, one electromagnet 13 is provided, and when the rotating body rotates 90 degrees each time, each electromagnetic absorption surface 16 can just realize that each electromagnetic absorption surface 16 is in butt joint with the first conveyor belt 1 and the second conveyor belt 23 in sequence.
As a preferred embodiment, the specific form of the rotating mechanism 15 is not limited, and the rotating mechanism 15 may drive the rotating body to rotate, for example, the rotating mechanism 15 may include a rotating shaft and a power mechanism, the rotating body is fixed on the rotating shaft, the rotating shaft is installed on the ground or the conveyor belt bracket through the bearing bracket 14, and the power mechanism may be a motor, or the like, or may be a swing cylinder, a swing oil cylinder, or the like.
In a preferred embodiment, the rotating body is installed above the head of the second conveyor belt 23, a slide carriage 12 (inclined flat plate) for facilitating the gear to slide down is arranged between the tail of the first conveyor belt 1 and the electromagnetic adsorption surface 16 at the top of the rotating body, and the gear is conveyed by the first conveyor belt 1 and then slides onto the electromagnetic adsorption surface 16 through the slide carriage 12 under the action of gravity.
As a preferred embodiment, the slope of the slide carriage 12 is 20 to 30 degrees, and is used for connecting the end of the first conveyor belt 1 with the electromagnetic turnover mechanism.
The working principle of the electromagnetic turnover mechanism is as follows:
the working position of the electromagnetic adsorption surface 16 is represented by the rotation angle of the rotating mechanism 15; the rotation of the rotating mechanism 15 for every 360 degrees is a working cycle, wherein the starting position is that the rotating mechanism 15 rotates for 0 degree, namely the electromagnetic adsorption surface 16 is parallel to the plane of the conveyor belt and is at the highest position;
as shown in fig. 11, the working cycle steps of the electromagnetic turnover mechanism are as follows:
1) When the electromagnetic adsorption surface 16 is at the initial position, the electromagnet 13 is electrified to generate magnetism, and the gear is conveyed to the electromagnetic adsorption surface 16 and is adsorbed by the electromagnet 13;
2) The rotating body is driven to rotate continuously through the rotating mechanism 15, when the electromagnetic adsorption surface 16 is between 0-180 degrees, the electromagnet 13 is electrified, and the gear is adsorbed on the surface of the electromagnetic adsorption surface 16 continuously by the electromagnet 13;
3) When the electromagnetic adsorption surface 16 is at 180 degrees, namely the electromagnetic adsorption surface 16 is parallel to the plane of the conveyor belt and is at the lowest position, the electromagnet 13 is powered off and loses magnetism, and the gear falls on the surface of the second conveyor belt 23;
4) When the electromagnetic adsorption surface 16 is between 180 degrees and 360 degrees, the electromagnet 13 is kept powered off;
the electromagnetic turnover mechanism comprises N electromagnetic adsorption surfaces 16, each electromagnetic adsorption surface 16 is electrified once in the completion of one working cycle, and the electrifying interval angle of the adjacent electromagnetic adsorption surfaces 16 is 360 degrees/N.
As a preferred embodiment, first detection module includes positive detection module and side detection module, positive detection module is including locating detection station top, includes from last to installing first industry camera 4 and the first flat light source 5 on camera support 8 down in proper order, is equipped with in the middle of the first flat light source 5 and shoots the hole, and first industry camera 4 shoots the gear through shooting the hole and overlooks the image, and camera support 8 installs in the frame of first conveyer belt 1 side. The side detection module is including locating the industrial camera of four equipartitions around the detection station for to gear side shooting all around, four industrial cameras are second industrial camera 6, third industrial camera 7, fourth industrial camera 9 and fifth industrial camera 10 respectively, all install in the frame of first conveyer belt 1 both sides.
As a preferred embodiment, a first limiting mechanism 2 is arranged on the first conveyor belt 1 in front of the first detection module, and is used for limiting and centering the gear, so that the positioning accuracy is improved. The first limiting mechanism 2 is two blocking arms arranged on the first conveying belt 1, the two blocking arms form a V-shaped opening gradually reduced, the opening direction faces the gear, and the gear is centered under the action of the two blocking arms and is concentrated on the central axis of the first conveying belt 1.
As a preferred embodiment, the second detection module is arranged above the detection station of the second conveyor belt 23, and includes a sixth industrial camera 20 and a second flat plate light source 21 which are sequentially installed on the camera support 19 from top to bottom, a shooting hole is arranged in the middle of the second flat plate light source 21, the sixth industrial camera 20 shoots a reverse rear gear overhead image through the shooting hole, and the camera support 19 is installed on a rack on the side of the second conveyor belt 23.
As a preferred embodiment, a second limiting mechanism 17 for re-centering the gear is arranged on the second conveyor belt 23 upstream of the second detection module, and the structure of the second limiting mechanism 17 is identical to that of the first limiting mechanism 2.
It should be noted that, in order to realize automation, the invention further comprises a computer and a PLC controller, wherein the PLC controller is connected with the industrial camera, the position sensor, the rejection mechanism and the electromagnetic turnover mechanism, and then connected with the computer through a data line to receive computer instructions. The computer, the PLC and each position sensor are all the prior art, are not the invention point of the invention, and therefore, the prior art is adopted.
It should be noted that the rejecting mechanism can be the prior art, and specifically can also include telescopic machanism, push pedal, mounting bracket, and telescopic machanism's flexible front end is fixed to the push pedal, and telescopic machanism itself passes through the mounting bracket installation, and when image acquisition module detected unqualified product, telescopic machanism drove the push pedal and stretches out, rejected unqualified product.
The position sensor is a correlation photoelectric switch and comprises a first photoelectric switch 3 arranged at a detection station on the first conveyor belt 1 and a second photoelectric switch 18 arranged at a detection station on the second conveyor belt 23, and the position sensor transmits a sensing signal to the PLC.
The input signal pin of the industrial camera is connected with the PLC controller, the PLC controller triggers photographing, the output ports of all the industrial cameras are connected with the computer, and images are transmitted to the computer for image processing and detection.
An input signal pin of the rejecting mechanism is connected with a PLC controller, and the PLC controller triggers the telescopic rod to move so as to reject the workpiece.
And an input signal pin of the electromagnetic turnover mechanism is connected with a PLC (programmable logic controller).
The PLC controller controls the power-on and power-off time of the electromagnet 13 in the electromagnetic turnover mechanism.
The rotating speed of the electromagnetic turnover mechanism is adjusted by the PLC according to the actual production rhythm requirement.
Rotation speed of electromagnetic turnover mechanismnThe calculation method is as follows:
n=60/(N*d v
wherein the content of the first and second substances,nindicates the rotational speed (r/min) of the mechanism,Nthe number (number) of the electromagnetic adsorption surfaces 16 in the electromagnetic turnover mechanism is shown,d v the feed rate (in/sec) is indicated.
The invention also provides a detection method of the gear defect visual detection system, which comprises the following specific steps as shown in fig. 10:
1) The gear is conveyed to a first detection module through a first conveyor belt 1, an industrial camera is triggered to acquire images, and image preprocessing is carried out;
2) Inputting the preprocessed image into an improved gear defect detection model to finish the defect detection of the end face A and the tooth surface (gear side surface);
3) The first rejecting module 11 rejects the defective gear;
4) The end face of the gear is turned over by the electromagnetic turning mechanism and is conveyed to the second conveyor belt 23;
5) The gear is conveyed to a second detection module through a second conveyor belt 23, an industrial camera is triggered to acquire an image, and image preprocessing is performed;
6) Inputting the preprocessed image into an improved gear defect detection model to finish the detection of the end face B defect;
7) The second reject module 22 rejects defective gears.
The using method of the invention is as follows:
taking the detection gear as an example, the working flow of the whole device is described as follows: the gears are arranged on the transmission belt at equal intervals and are transmitted at a constant speed, when the gears are transmitted to the first detection module, the first photoelectric switch 3 senses that an object passes through the transmission belt and triggers the first industrial camera 4 of the station to acquire an image of the end face (assumed to be positive) of the gear, the second industrial camera 6, the third industrial camera 7, the fourth industrial camera 9 and the fifth industrial camera 10 acquire images of the side face of the gear, the images are detected by an image processing module of a computer, if a flaw is detected, a signal is sent to a PLC (programmable logic controller), the PLC starts timing, when the gear reaches the first rejection module 11 at the tail end of the transmission belt, namely, a telescopic push rod is used for accurately rejecting the gear after the timing is finished; if no flaw is detected on the top surface and the side surface, the gear is continuously conveyed, when the gear reaches the electromagnetic turnover mechanism, the gear slides down to the electromagnetic adsorption surface 16 through the slide carriage 12, at the moment, the electromagnet 13 is electrified to adsorb the gear, the electromagnetic adsorption surface 16 is driven through the rotating mechanism 15, the end surface turnover of the gear is completed, and the gear is conveyed to the second conveyor belt 23; when the gear is transmitted to the second detection module, the second photoelectric switch 18 senses that an object passes through and triggers a sixth industrial camera 20 of the station to acquire an end face (reverse) image of the gear, if a flaw is detected, a signal is sent to a PLC (programmable logic controller), the PLC starts timing, and when the gear reaches a second rejecting module 22 at the tail end of the conveyor belt, the gear is accurately rejected by using a telescopic push rod; if the top surface is detected to have no defect, the qualified gear is continuously transmitted to the tail end of the conveyor belt.
The above embodiments are only for illustrating the present invention and are not to be construed as limiting the present invention. Although the present invention has been described in detail with reference to the embodiments, it should be understood by those skilled in the art that various combinations, modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention, and the technical solution of the present invention is covered by the claims of the present invention.

Claims (9)

1. A gear defect visual inspection method based on an improved YOLOv5 network is characterized by comprising the following steps:
s1, collecting image data: acquiring a surface image of a defective gear, and preprocessing the image to obtain a defective gear image;
s2, constructing a sample data set: marking the defect type in the defect gear image and using the defect type as a label, and constructing a sample data set of the defect gear by using the defect gear image and the corresponding label;
s3, obtaining a pre-training model: training a YOLOv5 network model by using the sample data set obtained in the step S2, and obtaining a weight parameter of the YOLOv5 network model;
s4, detection model improvement: improving a YOLOv5 network model, adding a convolution attention mechanism module and a repeated weighted bidirectional feature pyramid network to obtain an improved YOLOv5 network model;
s5, building a model, namely migrating the weight parameters obtained in the step S3 into an improved YOLOv5 network model, then training the improved YOLOv5 network model by using the sample data set obtained in the step S2 to obtain weight parameters suitable for gear defect detection, and completing the construction of the gear defect detection model;
s6, detecting defects, namely acquiring a gear image to be detected, preprocessing the gear image according to the preprocessing mode in the step S1 to obtain the gear image to be detected, and inputting the gear image to be detected into a gear defect detection model to perform defect detection and identification;
in step S4, the specific manner of improving the YOLOv5 network model is as follows:
(1) Converting the last standard convolution module Conv in the C3 module of the YOLOv5 network model into a CBAM module to form a CBAMC3 module;
(2) The repeated BiFPN structure is added to the YOLOv5 network model, and combined with the Concat method to form a Concat _ BiFPN module.
2. The improved YOLOv5 network-based gear defect visual inspection method according to claim 1, characterized in that: in step S2, the sample data set construction method is as follows:
s2.1, forming a data set by all the defective gear images obtained in the step S1, carrying out random operation on all the images in the data set to obtain new images, and expanding the data set; the random operation type comprises any one or more of turning, rotating, translating, adding noise and zooming;
s2.2, marking the defect types of the images in the enlarged data set to form a label, and constructing a sample data set;
and S2.3, dividing the sample data set into a training set and a testing set.
3. The gear defect visual inspection method based on the improved YOLOv5 network as claimed in claim 2, wherein: in step S2.3, the gear defect image is marked using the LabelImg tool, and an xml file corresponding to the image sample one to one is obtained as a sample.
4. The improved YOLOv5 network-based gear defect visual inspection method according to claim 1, characterized in that: in the step S2, the defect types of the gear comprise corner breakage, bruise and scratch.
5. The improved YOLOv5 network-based gear defect visual inspection method according to claim 1, characterized in that: in step S4, the CBAM module includes two independent sub-modules, which are a channel attention module CAM and a spatial attention module SAM, respectively, where the CAM module performs channel processing on the input feature map, and the SAM module performs spatial processing on the input feature map.
6. The improved YOLOv5 network-based gear defect visual inspection method according to claim 1, characterized in that: in step S4, the repeating BiFPN structure refers to that the BiFPN module is regarded as a basic unit, stacking is repeated, a pair of paths is regarded as a feature layer, and then repeating the steps for multiple times to obtain more high-level feature fusions.
7. A gear defect visual inspection system based on an improved YOLOv5 network is characterized by comprising:
the conveying belt mechanism comprises a first conveying belt and a second conveying belt which are sequentially arranged according to a conveying sequence, wherein the height of the first conveying belt is higher than that of the second conveying belt;
the image acquisition module comprises a first detection module and a second detection module, wherein the first detection module is arranged above the first conveyor belt and used for shooting and detecting the front side and the side surface of the workpiece, and the second detection module is arranged above the second conveyor belt and used for shooting and detecting the back side of the workpiece;
the electromagnetic turnover mechanism is arranged between the first conveyor belt and the second conveyor belt and used for dropping the reverse side of the gear conveyed by the first conveyor belt onto the second conveyor belt;
an identification control module comprising a controller with a built-in gear defect detection model in the gear defect visual detection method of any one of claims 1 to 6;
the rejecting mechanism comprises a first rejecting module arranged at the tail end of the first conveying belt and a second rejecting module arranged at the tail end of the second conveying belt, and the rejecting mechanism is arranged on the conveying belt mechanism and behind the image acquisition module;
the controller is used for receiving gear image data acquired by the image acquisition module, and controlling the rejecting mechanism to act to reject corresponding defective gears after the gear defect detection model is identified.
8. The gear defect visual inspection system of claim 7, wherein: the electromagnetic turnover mechanism comprises a rotating body and a rotating mechanism for driving the rotating body to rotate, wherein at least one electromagnetic adsorption surface is arranged on the rotating body, and each electromagnetic adsorption surface is provided with an electromagnet for adsorbing a gear; the height difference between the first conveyor belt and the second conveyor belt is larger than the required rotating space of the rotating body, and when the electromagnetic adsorption surface rotates to the top to be in butt joint with the first conveyor belt, the electromagnet on the electromagnetic adsorption surface is electrified to generate adsorption force to adsorb the gear; when the electromagnetic adsorption surface rotates to the bottom along with the rotating body and is in butt joint with the second conveying belt, the gear finishes the reverse surface, the corresponding electromagnet is powered off, and the gear behind the reverse surface falls on the second conveying belt.
9. The gear defect visual inspection system of claim 8, wherein: the rotator is a regular polyhedron.
CN202210580509.2A 2022-05-26 2022-05-26 Gear defect visual inspection method and system based on improved YOLOv5 network Active CN114677597B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210580509.2A CN114677597B (en) 2022-05-26 2022-05-26 Gear defect visual inspection method and system based on improved YOLOv5 network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210580509.2A CN114677597B (en) 2022-05-26 2022-05-26 Gear defect visual inspection method and system based on improved YOLOv5 network

Publications (2)

Publication Number Publication Date
CN114677597A CN114677597A (en) 2022-06-28
CN114677597B true CN114677597B (en) 2022-10-11

Family

ID=82080037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210580509.2A Active CN114677597B (en) 2022-05-26 2022-05-26 Gear defect visual inspection method and system based on improved YOLOv5 network

Country Status (1)

Country Link
CN (1) CN114677597B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115578365B (en) * 2022-10-26 2023-06-20 西南交通大学 Method and equipment for detecting tooth pitch of adjacent racks of rack rail

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113034483A (en) * 2021-04-07 2021-06-25 昆明理工大学 Cigarette defect detection method based on deep migration learning
WO2021151336A1 (en) * 2020-09-08 2021-08-05 平安科技(深圳)有限公司 Road image target detection method based on attentional mechanism and related device
CN113781435A (en) * 2021-09-10 2021-12-10 常州机电职业技术学院 Cigarette packet appearance defect detection method based on YOLOV5 network
CN113887588A (en) * 2021-09-17 2022-01-04 北京科技大学 Vehicle detection method and device based on attention mechanism and feature weighting fusion
CN114332697A (en) * 2021-12-19 2022-04-12 西安科技大学 Method, system, equipment and medium for detecting faults of multiple types of targets in power transmission line
CN114529799A (en) * 2022-01-06 2022-05-24 浙江工业大学 Aircraft multi-target tracking method based on improved YOLOV5 algorithm

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021151336A1 (en) * 2020-09-08 2021-08-05 平安科技(深圳)有限公司 Road image target detection method based on attentional mechanism and related device
CN113034483A (en) * 2021-04-07 2021-06-25 昆明理工大学 Cigarette defect detection method based on deep migration learning
CN113781435A (en) * 2021-09-10 2021-12-10 常州机电职业技术学院 Cigarette packet appearance defect detection method based on YOLOV5 network
CN113887588A (en) * 2021-09-17 2022-01-04 北京科技大学 Vehicle detection method and device based on attention mechanism and feature weighting fusion
CN114332697A (en) * 2021-12-19 2022-04-12 西安科技大学 Method, system, equipment and medium for detecting faults of multiple types of targets in power transmission line
CN114529799A (en) * 2022-01-06 2022-05-24 浙江工业大学 Aircraft multi-target tracking method based on improved YOLOV5 algorithm

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Power Grid Field Violation Recognition Algorithm Based on Enhanced YOLOv5;Wenwen Zhu等;《Journal of Physics: Conference Series》;20220222;第1-10页 *
基于改进YOLOvSs的齿轮表面缺陷检测;仇娇慧 等;《现代制造工程》;20220331;第104-113页 *

Also Published As

Publication number Publication date
CN114677597A (en) 2022-06-28

Similar Documents

Publication Publication Date Title
CN109724984B (en) Defect detection and identification device and method based on deep learning algorithm
CN111325713B (en) Neural network-based wood defect detection method, system and storage medium
CN109239102B (en) CNN-based flexible circuit board appearance defect detection method
CN110314854B (en) Workpiece detecting and sorting device and method based on visual robot
CN111014079B (en) Bearing defect detection device and bearing defect detection method
CN102621156B (en) Image-processing-based automatic micro part sorting system
CN102226739B (en) Apparatus and method for detecting tapered roller bearing rolling element upside-down mounting and missing mounting
CN113030108A (en) Coating defect detection system and method based on machine vision
CN104063873A (en) Shaft sleeve part surface defect on-line detection method based on compressed sensing
CN109840900A (en) A kind of line detection system for failure and detection method applied to intelligence manufacture workshop
CN114677597B (en) Gear defect visual inspection method and system based on improved YOLOv5 network
CN104483320A (en) Digitized defect detection device and detection method of industrial denitration catalyst
CN212301356U (en) Wheel hub welding seam visual detection device
CN109142509B (en) Round steel magnetic powder flaw detection method and device
CN109724994A (en) FPC golden finger surface defects detection system and method based on AOI technology
Neethu et al. Role of computer vision in automatic inspection systems
CN204440490U (en) A kind of Model For The Bush-axle Type Parts surface imperfection on-line measuring device based on compressed sensing
CN110728269B (en) High-speed rail contact net support pole number plate identification method based on C2 detection data
CN105844282A (en) Method for detecting defects of fuel injection nozzle O-Ring through line scanning camera
CN113245222B (en) Visual real-time detection and sorting system and sorting method for foreign matters in panax notoginseng
CN113916127A (en) Visual inspection system and method for appearance of valve guide pipe finished product
CN111486790A (en) Full-size detection method and device for battery
CN111505013A (en) Warm edge spacer machine vision detection device and method based on deep learning
CN112598720A (en) Method and system for detecting abrasion state of conveying belt based on binocular shooting
CN111028250A (en) Real-time intelligent cloth inspecting method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant