CN115410039A - Coal foreign matter detection system and method based on improved YOLOv5 algorithm - Google Patents

Coal foreign matter detection system and method based on improved YOLOv5 algorithm Download PDF

Info

Publication number
CN115410039A
CN115410039A CN202211032554.0A CN202211032554A CN115410039A CN 115410039 A CN115410039 A CN 115410039A CN 202211032554 A CN202211032554 A CN 202211032554A CN 115410039 A CN115410039 A CN 115410039A
Authority
CN
China
Prior art keywords
foreign matter
module
coal
network structure
loss
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.)
Pending
Application number
CN202211032554.0A
Other languages
Chinese (zh)
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.)
Anhui University of Science and Technology
Original Assignee
Anhui University of Science and Technology
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 Anhui University of Science and Technology filed Critical Anhui University of Science and Technology
Priority to CN202211032554.0A priority Critical patent/CN115410039A/en
Publication of CN115410039A publication Critical patent/CN115410039A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/762Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
    • G06V10/763Non-hierarchical techniques, e.g. based on statistics of modelling distributions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Multimedia (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a coal foreign matter detection system and method based on an improved YOLOv5 algorithm, wherein the system comprises: replacing the original backbone network structure with a MobileNet V3 network structure; replacing the SiLU () activation function in the convolutional layer with a Mish () activation function; replacing the SE attention mechanism in the MobileNet V3 network structure with the ECA attention mechanism; replacing the original standard convolution of the neck network structure module by using heterogeneous convolution; and inputting the image to be detected into the trained model to obtain the position information and the category information of the target. The invention solves the technical problems of low detection precision and poor detection effect.

Description

Coal foreign matter detection system and method based on improved YOLOv5 algorithm
Technical Field
The invention relates to the field of coal mine industrial control, in particular to the field of coal foreign matter detection.
Background
Coal is the main energy in China and is a foundation stone for guaranteeing the energy safety in China. The coal is limited by mining conditions, a small amount of foreign matters can be mixed in the mining process, the influence on the properties of the coal is great, the production efficiency of coal processing is seriously influenced, and the improvement of the quality of the coal is restricted. Therefore, the coal foreign matter detection is realized by utilizing the target detection algorithm based on deep learning, and the method has important social significance and economic value in the aspects of reducing atmospheric pollution, improving the comprehensive utilization rate of coal resources, ensuring normal production operation of the coal mine industry, guaranteeing the life safety of staff and the like.
Currently, object detection has been extensively studied over the past decades as one of four basic tasks (classification, detection, segmentation and localization) of computer vision. In general, object detection and identification involves two steps: first, the potential location of each target object is located, and then the objects are classified into different categories. Before the advent of deep learning algorithms, object detection methods relied on artificially designed features and designed classifiers according to the way humans understand objects. In recent years, with the development of deep learning, particularly the success of deep Convolutional Neural Networks (CNNs), object detection has been widely applied in the fields of automatic driving, visual search, virtual Reality (VR), augmented Reality (AR), and the like. Although accurate detection of large and medium size targets in images has been achieved in many applications, the detection of small targets in coal stream images still presents some problematic issues. Small objects are difficult to detect due to difficult feature discrimination, low resolution, complex background, etc. The patent document CN113658135A of the present invention discloses a method and system for detecting foreign matters in a self-adaptive illumination belt based on fuzzy PID, "LED three-color illumination module, fuzzy PID illumination adjustment module, image gray processing module, image acquisition module, foreign matter detection hardware module, foreign matter deep learning detection module, and segmentation and sorting processing module. Considering the influence of a light source on the image definition when an image is collected and a complex underground environment, the illumination of the light source is adjusted through fuzzy PID, the image definition is adjusted, the high-definition image is ensured to be input, the collected image is input into a yolo-based deep learning detection model, and the recognized foreign object image is segmented and recognized. According to the specific embodiment in the prior art, the yolov3 target detection model is adopted to detect foreign matters on a belt, and the PID is adopted to adjust the image quality, but the prior scheme only uses threshold values such as foreign matter region threshold values to judge and logically process a foreign matter detection image, and does not optimize the characteristics such as the convolution process of the head, the neck and the backbone network structure of the target detection model, and after the foreign matter detection information is obtained by processing the target detection model, the image quality needs to be improved by algorithms such as PID, the parameter quantity and the overall complexity related to the algorithms are increased, the robustness of the prior art is restricted, and meanwhile, the prior art only optimizes the illumination and the definition after generating a detection result, is easy to cause distortion, and cannot thoroughly solve the detection precision problems caused by difficult feature distinguishing, low resolution and complex background. The existing patent application document CN113306991A, namely, a stereoscopic vision-based coal conveyor monitoring and management system, comprises a coal conveyor and one or more line laser binocular stereo cameras arranged above the coal conveyor; the vision processor of the line laser binocular stereo camera comprises: the stereoscopic vision processing module is used for processing the laser line images by using a binocular vision processing algorithm to obtain the front three-dimensional information of the conveying belt and the three-dimensional information of the coal flow on the conveying belt; the coal flow monitoring module is used for acquiring coal flow monitoring information according to the three-dimensional information of the coal flow on the conveying belt and the three-dimensional information of the reference surface; and the foreign matter detection module is used for detecting the large objects according to the three-dimensional information of the coal flow on the conveying belt and the set area threshold value. This prior art adopts three-dimensional visual detection, obtains the bulk object in the coal stream through foreign matter detection module. The prior art is limited by the types of the collected signals, and equipment such as a multi-view camera and the like needs to be arranged, so that the technical use cost is increased. The specific implementation content of the existing scheme is known, the scheme needs to perform three-dimensional segmentation on point cloud data, perform binarization processing to obtain a mask image, and then segment the mask image to obtain a potential foreign object area.
In conclusion, the prior art has the technical problems of low detection precision and poor detection effect.
Disclosure of Invention
The invention aims to solve the technical problems of low detection precision and poor detection effect in the prior art.
The invention adopts the following technical scheme to solve the technical problems: the coal foreign matter detection system based on the improved YOLOv5 algorithm comprises:
the coal foreign matter data set module is used for acquiring and manufacturing a coal foreign matter type image data set;
the data set expansion module is used for expanding the coal foreign matter type data set through image enhancement operation and is connected with the coal foreign matter data set module;
the network training module is used for extracting foreign matter multi-scale characteristics from the coal foreign matter type data set by using a YOLOv5 network model and training a convolutional neural network in the YOLOv5 network model, and the network training module is connected with the data set expansion module;
the applicable anchor frame calculation module is used for calculating a data set applicable anchor frame applicable to the coal foreign matter type image data set by using a K-means clustering algorithm, and the applicable anchor frame calculation module is connected with the network training module;
an improved YOLOv5 network model connected to the network training module, the improved YOLOv5 network model comprising:
the system comprises an input end, a backbone network structure module and a video processing module, wherein the input end is used for carrying out mosaic data enhancement and random perspective transformation on an original image to obtain an enhanced image, the original image is processed by adopting a K-means clustering algorithm to obtain an applicable anchor frame, and the enhanced image is subjected to scaling processing with a preset size to obtain and input a foreign matter characteristic diagram to the backbone network structure module;
the backbone network structure module is used for carrying out deep separable convolution, residual inversion and lightweight attention data processing operation on the foreign body feature map by adopting a MobileNet V3 network structure, acquiring lightweight attention map image features with preset precision by utilizing a Mish () activation function, and acquiring a backbone network structure feature map by utilizing the preset activation function for processing, and is connected with the input end;
the neck network structure module is used for fusing with the backbone network structure characteristic diagram in a top-down mode so as to obtain a neck network structure characteristic diagram by utilizing the transfer strong positioning characteristic, and the neck network structure module is connected with the backbone network structure module;
the output end is used for eliminating redundant bounding boxes according to the neck network characteristic diagram so as to obtain an applicable target bounding box, and acquiring and weighting the confidence coefficient loss, the rectangular frame loss and the classification loss by using preset loss logic so as to obtain the total loss, and the output end is connected with the neck network structure module;
and the network retraining module is used for retraining the convolutional neural network in the improved YOLOv5 network model according to the total loss so as to obtain a coal foreign matter recognition result through detection, and is connected with the improved YOLOv5 network model.
The invention is improved on the basis of the existing YOLO v5 algorithm, and the model has small volume, so that the model is suitable for coal foreign matter detection. The model is trained aiming at the small-target coal foreign matter type image, and has relatively accurate positioning and identification on the foreign matter in the coal foreign matter type image, the lightweight framework mobileneetV 3 is used for replacing the original backbone, so that the network precision can be improved by matching with an ECA channel attention mechanism, and the detection accuracy of the coal foreign matter is improved. According to the method, ECAlayer is adopted to replace the original SElayer of the mobilenetV3, so that the loss is reduced, the model is lighter, and the robustness of a system algorithm is improved. The invention has the advantages of strong practicability, scientific design, high model detection speed, high precision and small volume.
In a more specific technical solution, the input terminal includes:
the data enhancement unit is used for performing mosaic data enhancement and random perspective transformation on the original image;
the manual anchor frame calculating unit is used for calculating an anchor frame suitable for the coal foreign matter type image data set by using a K-means clustering algorithm according to the size of the target to be detected of the input image;
and the self-adaptive picture zooming unit is used for zooming the image enhanced by the mosaic data in a preset fixed size and acquiring a foreign matter characteristic map, and is connected with the data enhancing unit and the manual calculation anchor frame unit.
In a more specific technical solution, the backbone network structure module includes: lightweight network MobileNet V3.
In a more specific technical solution, the lightweight network MobileNet V3 includes:
the depth separable convolution module is used for carrying out depth separable convolution operation on the foreign matter feature map so as to obtain a depth convolution feature map;
the reverse residual error structure module is used for carrying out residual error reverse and lightweight attention data processing operation on the depth convolution characteristic graph and is connected with the depth separable convolution module;
and the light weight attention module is used for optimizing the network precision based on an ECA channel attention mechanism and a new activation function h-Swish, and is connected with the depth separable convolution module and the inversion residual error structure module.
In a more specific technical solution, the new activation function h-Swish is defined by the following logic:
Figure BDA0003818032830000041
according to the invention, the activation function of the convolutional layer is replaced by Mish from SiLU (), and as Mish has better stability, the calculation speed of detecting foreign matters by the system is increased, and the efficiency of detecting foreign matters in coal is improved.
In a more specific aspect, the neck network structure module includes:
the heterogeneous convolution module is used for fusing the heterogeneous convolution module with the backbone network structure characteristic graph in a top-down mode so as to realize semantic characteristic transmission;
the feature pyramid network FPN structure and the perception confrontation network PAN structure are used for realizing strong positioning feature transmission in a bottom-up mode, and are connected with the heterogeneous convolution module.
According to the invention, two standard convolutions of the head layer front neck network structure module are replaced by heterogeneous convolutions, better precision is obtained by using less calculation amount, the method belongs to light convolution, model complexity is not increased, and system algorithm robustness is optimized.
In a more specific technical solution, the output terminal includes:
NMS non-maximum value restrain module to find the suitable target boundary box and eliminate the redundant boundary box;
and the loss function calculation module is used for weighting the confidence coefficient loss, the rectangular frame loss and the classification loss so as to obtain the total loss.
In a more specific embodiment, the confidence loss (L) is obtained in the loss function calculation module by the following logic process obj ) Rectangular frame loss (L) box ) And classification loss (L) cls ):
Figure BDA0003818032830000042
Figure BDA0003818032830000043
Figure BDA0003818032830000051
Wherein s represents gridsize; s × s denotes 13 × 13, 26 × 26, 52 × 52;
Figure BDA0003818032830000052
indicating that box at i, j has a target with a value of 1, otherwise 0;
Figure BDA0003818032830000053
indicating that the box at i, j has no object and has a value of 1, otherwise0; x and y respectively represent the horizontal coordinate and the vertical coordinate of the prediction box; w, h represent the width and height of the prediction box, respectively, c represents the predicted value of the confidence level,
Figure BDA0003818032830000054
a label value representing a confidence.
In a more specific technical scheme, in a Loss function calculation module, the total Loss is obtained by using the following logic weighting processing:
Loss=a*L obj +b*L box +c*L cls
in a more specific technical scheme, the method for detecting the coal foreign matters based on the improved YOLOv5 algorithm comprises the following steps of:
s1, a coal foreign matter type image data set is acquired and manufactured by a coal foreign matter data set module;
s2, expanding a coal foreign matter type data set through image enhancement operation;
s3, extracting foreign matter multi-scale features from the coal foreign matter type data set by using a YOLOv5 network model, and training a convolutional neural network in the YOLOv5 network model;
s4, calculating a data set applicable anchor frame applicable to the coal foreign matter type image data set by using a K-means clustering algorithm;
s5, improving a YOLOv5 network model, wherein the step S5 further comprises the following steps:
s51, performing mosaic data enhancement and random perspective transformation on the original image by using an input end to obtain an enhanced image, processing the original image by adopting a K-means clustering algorithm to obtain an applicable anchor frame, and performing scaling processing on the enhanced image by a preset size to obtain and input a foreign matter characteristic diagram to a backbone network structure module;
s52, carrying out deep separable convolution, residual inversion and lightweight attention data processing operation on the foreign matter feature map by using a backbone network structure module and adopting a MobileNet V3 network structure, acquiring lightweight attention image features with preset precision by using a Mish () activation function, and processing by using the preset activation function to obtain a backbone network structure feature map;
s53, fusing the neck network structure module with the backbone network structure characteristic diagram in a top-down mode to obtain the neck network structure characteristic diagram by utilizing the transfer strong positioning characteristic;
s54, eliminating redundant bounding boxes by utilizing an output end according to the neck network characteristic diagram to obtain an applicable target bounding box, and obtaining and weighting confidence coefficient loss, rectangular box loss and classification loss by using preset loss logic to obtain total loss;
and S6, according to the total loss, training a convolutional neural network in the improved YOLOv5 network model again, and accordingly detecting to obtain a coal foreign matter recognition result.
Compared with the prior art, the invention has the following advantages: the invention is improved on the basis of the existing YOLO v5 algorithm, and the model has small volume, so that the model is suitable for coal foreign matter detection. The model provided by the invention is trained aiming at the small target coal foreign matter type image, and has relatively accurate positioning and identification on the foreign matter in the coal foreign matter type image, so that the model has the advantages of strong practicability, scientific design, high model detection speed, high precision and small size.
The invention uses the lightweight skeleton mobilenetV3 to replace the original backbone, and can be matched with an ECA channel attention mechanism to improve the network precision and improve the detection accuracy of coal foreign matters.
The ECAlayer is adopted to replace the original SElayer of the mobilenetV3, so that the loss is reduced, the model is lighter, and the robustness of the system algorithm is improved.
According to the invention, the activation function of the convolutional layer is replaced by Mish from SiLU (), and as Mish has better stability, the calculation speed of detecting foreign matters by the system is increased, and the efficiency of detecting foreign matters in coal is improved.
According to the invention, two standard convolutions of the head layer front neck network structure module are replaced by heterogeneous convolutions, better precision is obtained by using less calculation amount, the method belongs to light convolution, model complexity is not increased, and system algorithm robustness is optimized.
The invention solves the technical problems of low detection precision and poor detection effect in the prior art.
Drawings
Fig. 1 is a schematic diagram of an improved YOLO v5 network model in a coal foreign matter detection system based on an improved YOLO v5 algorithm in embodiment 1 of the present invention;
FIG. 2 is a schematic diagram of basic modules of an improved YOLO v5 network model in embodiment 1 of the present invention;
FIG. 3 is a schematic diagram of the input unit in this embodiment 1;
fig. 4 is a schematic view of the internal components of the neck network structure module according to embodiment 1 of the present invention;
FIG. 5 is a schematic diagram showing the internal composition of an output terminal in embodiment 1 of the present invention;
FIG. 6 is a schematic diagram showing the basic steps of a coal foreign matter detection method based on an improved YOLO v5 algorithm in embodiment 2 of the present invention;
fig. 7 is a schematic diagram of specific steps of model improvement in embodiment 2 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
As shown in fig. 1 and fig. 2, the method for detecting coal foreign matter based on the improved YOLO v5 algorithm includes an improved YOLO v5 network model, where the improved YOLO v5 network model includes an input end 1, a backbone network structure module 2, a neck network structure module 3, and an output end 4.
As shown in fig. 3, in the present embodiment, the input end 1 includes a data enhancement unit 11, a manual computation anchor frame unit 12 and an adaptive picture scaling unit 13; wherein the data enhancement unit 11 comprises mosaic data enhancement and random perspective transformation; the manual calculation anchor frame unit 12: calculating an anchor frame suitable for a coal foreign matter type image data set by using a K-means clustering algorithm according to the size of a target to be detected in an input image; the adaptive picture scaling unit 13: and carrying out fixed-size scaling processing on the image enhanced by the mosaic data, acquiring a characteristic diagram of the image and inputting the characteristic diagram into a backbone network structure module.
In this embodiment, the backbone network structure module 2 is composed of a lightweight network MobileNet V3, and the modules used therein include: the depth separable convolution module, the reverse residual error structure module and the lightweight attention module based on the ECA channel attention mechanism use a novel activation function h-Swish to improve the network precision, and the expression of the h-Swish function is as follows:
Figure BDA0003818032830000071
as shown in fig. 4, in this embodiment, the neck Network structure module 3 includes a heterogeneous convolution module 31, an fpn (Feature convolutional Networks) and a PAN (personal adaptive Network) structure 32, and is mainly used for implementing Feature extraction and Feature fusion, and the process thereof is as follows: the method is firstly fused with a backbone network structure feature map from top to bottom to realize semantic feature transfer, and then strong positioning feature transfer is realized from bottom to top.
As shown in fig. 5, in the present embodiment, the output terminal 4 is used for connecting with a detection head of the neck network structure module 3, and includes: an NMS non-maximum suppression module 41 and a loss function calculation module 42; the NMS non-maximum value suppression module 41 is used for searching the optimal target boundary box and eliminating redundant boundary boxes; the loss function mainly comprises three aspects: confidence penalty (Lobj), rectangular box penalty (Lbox), and classification penalty (Llcs), the total penalty is defined as a weighted sum of three penalties, expressed as:
Loss=a*L obj +b*L box +c*L cls
Figure BDA0003818032830000072
Figure BDA0003818032830000081
Figure BDA0003818032830000082
in the present embodiment, s represents grid size; sxs denotes 13 × 13, 26 × 26, 52 × 52;
Figure BDA0003818032830000083
indicating that box at i, j has a target with a value of 1, otherwise 0;
Figure BDA0003818032830000084
indicating that box at i, j has no target and has a value of 1, otherwise it is 0; x and y respectively represent the horizontal and vertical coordinates of the prediction frame; w, h represent the width and height of the prediction box, respectively, c represents the predicted value of the confidence level,
Figure BDA0003818032830000085
a label value representing a confidence.
Example 2
As shown in fig. 6, in the embodiment, the coal foreign matter detection method based on the improved YOLO v5 algorithm includes the following steps:
s1, making a coal foreign matter type image data set;
s2, expanding the existing coal foreign matter type image data set by using a data enhancement technology;
s3, extracting multi-scale features of the coal foreign matters in the data set based on a YOLO v5 network model, and training the capability of a convolutional neural network in recognizing the type images of the coal foreign matters;
s4, calculating an anchor frame suitable for the coal foreign matter type image data set by using a K-means clustering algorithm, and replacing the existing anchor frame aiming at the coco data set;
s5, improving the YOLO v5 network model, and retraining the capability of the convolutional neural network for recognizing the coal foreign matter type image.
As shown in fig. 7, in the present embodiment, step S5 includes the following steps:
s51, replacing the original backbone network structure with a MobileNet V3 network structure;
s52, replacing the sulu () activation function in the convolutional layer with a mesh () activation function, which can be defined as:
f(x)=x·tanh(ln(1+e x ))
s53, replacing the SE attention mechanism in the MobileNet V3 network structure by the ECA attention mechanism.
And S54, replacing the original standard convolution of the neck network structure module by using heterogeneous convolution.
In this embodiment, the image to be detected is input to the trained model to obtain the position information and the category information of the target.
According to the coal foreign matter detection method based on the improved YOLO v5 algorithm, the average accuracy (mAP) and accuracy (P) recall rate (R) results of the coal foreign matters are shown in table 1, the accuracy and the recall rate reach 100%, and the coal foreign matter detection method based on the improved YOLO v5 algorithm is high in robustness.
TABLE 1 average accuracy, precision and recall of coal impurities
Figure BDA0003818032830000091
In conclusion, the invention is improved on the basis of the existing YOLO v5 algorithm, and the model has small volume, so that the model is suitable for coal foreign matter detection. The model provided by the invention is trained aiming at the small target coal foreign matter type image, and has relatively accurate positioning and identification on the foreign matter in the coal foreign matter type image, so that the model has the advantages of strong practicability, scientific design, high model detection speed, high precision and small size.
The invention uses the lightweight skeleton mobilenetV3 to replace the original backbone, and can be matched with an ECA channel attention mechanism to improve the network precision and improve the detection accuracy of coal foreign matters.
The ECAlayer is adopted to replace the original SElayer of the mobilenetV3, so that the loss is reduced, the model is lighter, and the robustness of the system algorithm is improved.
According to the invention, the activation function of the convolutional layer is replaced by Mish from SiLU (), and as Mish has better stability, the calculation speed of detecting foreign matters by the system is increased, and the efficiency of detecting foreign matters in coal is improved.
According to the method, two standard convolutions of the head layer front neck network structure module are replaced by heterogeneous convolutions, better precision is obtained by using less calculation amount, the method belongs to light convolution, model complexity cannot be increased, and system algorithm robustness is optimized.
The invention solves the technical problems of low detection precision and poor detection effect in the prior art.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A coal foreign matter detection system based on a modified YOLOv5 algorithm, characterized in that the system comprises:
the coal foreign matter data set module is used for acquiring and manufacturing a coal foreign matter type image data set;
the data set expansion module is used for expanding the coal foreign matter type data set through image enhancement operation and is connected with the coal foreign matter data set module;
the network training module is used for extracting foreign matter multi-scale features from the coal foreign matter type data set by using a YOLOv5 network model and training a convolutional neural network in the YOLOv5 network model, and the network training module is connected with the data set expansion module;
the applicable anchor frame calculation module is used for calculating a data set applicable anchor frame applicable to the coal foreign matter type image data set by using a K-means clustering algorithm, and is connected with the network training module;
an improved YOLOv5 network model connected to the network training module, the improved YOLOv5 network model comprising:
the system comprises an input end, a backbone network structure module and a video processing module, wherein the input end is used for performing mosaic data enhancement and random perspective transformation on an original image to obtain an enhanced image, processing the original image by adopting a K-means clustering algorithm to obtain an applicable anchor frame, and performing scaling processing of a preset size on the enhanced image to obtain and input a foreign matter characteristic diagram to the backbone network structure module;
the backbone network structure module is used for carrying out deep separable convolution, residual inversion and lightweight attention data processing operation on the foreign body feature map by adopting a MobileNet V3 network structure, acquiring lightweight attention map image features with preset precision by utilizing a Mish () activation function, and acquiring a backbone network structure feature map by utilizing the preset activation function processing, wherein the backbone network structure module is connected with the input end;
the neck network structure module is used for fusing the neck network structure characteristic diagram with the backbone network structure characteristic diagram in a top-down mode so as to obtain a neck network structure characteristic diagram by utilizing transfer strong positioning characteristics, and the neck network structure module is connected with the backbone network structure module;
the output end is used for eliminating redundant bounding boxes according to the neck network characteristic diagram to obtain an applicable target bounding box, and acquiring and weighting confidence coefficient loss, rectangular box loss and classification loss by using preset loss logic to obtain total loss, and the output end is connected with the neck network structure module;
and the network retraining module is used for retraining the convolutional neural network in the improved YOLOv5 network model according to the overall loss so as to obtain a coal foreign matter recognition result through detection, and is connected with the improved YOLOv5 network model.
2. The system for detecting the coal foreign matter based on the improved YOLOv5 algorithm according to claim 1, wherein the input end comprises:
a data enhancement unit for performing a process including mosaic data enhancement and random perspective transformation on the original;
the manual anchor frame calculating unit is used for calculating an anchor frame suitable for the coal foreign matter type image data set by using the K-means clustering algorithm according to the size of the target to be detected of the input image;
and the self-adaptive picture scaling unit is used for carrying out scaling processing with a preset fixed size on the image enhanced by the mosaic data and acquiring the foreign matter characteristic diagram, and is connected with the data enhancement unit and the manual calculation anchor frame unit.
3. The system for detecting the coal foreign matter based on the improved YOLOv5 algorithm of claim 1, wherein the backbone network structure module comprises: lightweight network MobileNet V3.
4. The coal foreign matter detection system based on the improved YOLOv5 algorithm is characterized in that the lightweight network MobileNet V3 comprises:
the depth separable convolution module is used for carrying out depth separable convolution operation on the foreign matter feature map so as to obtain a depth convolution feature map;
the reverse residual error structure module is used for carrying out residual error reverse and lightweight attention data processing operation on the depth convolution characteristic graph and is connected with the depth separable convolution module;
a lightweight attention module to optimize network accuracy based on an ECA channel attention mechanism and a new activation function h-Swish, the lightweight attention module connected with the depth separable convolution module and the inverted residual structure module.
5. The system for detecting the coal foreign matter based on the improved YOLOv5 algorithm in claim 4 is characterized in that the new activation function h-Swish is defined by the following logic:
Figure FDA0003818032820000021
6. the system for detecting the coal foreign matter based on the improved YOLOv5 algorithm in claim 1, wherein the neck network structure module comprises:
the heterogeneous convolution module is fused with the backbone network structure feature graph in a top-down mode so as to realize semantic feature transmission;
the feature pyramid network FPN structure and the perception confrontation network PAN structure are used for realizing strong positioning feature transmission in a bottom-up mode, and are connected with the heterogeneous convolution module.
7. The coal foreign matter detection system based on the improved YOLOv5 algorithm is characterized in that the output end comprises:
NMS non-maximum value suppression module to find the said suitable target boundary box and eliminate the said redundant boundary box;
and the loss function calculation module is used for weighting the confidence coefficient loss, the rectangular frame loss and the classification loss to obtain the total loss.
8. The system of claim 1, wherein the loss function calculation module obtains the confidence level loss (L) by the following logic processing obj ) Said rectangular frame loss (L) box ) And said classification loss (L) cls ):
Figure FDA0003818032820000031
Figure FDA0003818032820000032
Figure FDA0003818032820000033
Wherein s represents gridsize; sxs denotes 13 × 13, 26 × 26, 52 × 52;
Figure FDA0003818032820000034
indicating that box at i, j has a target with a value of 1, otherwise 0;
Figure FDA0003818032820000035
indicating that box at i, j has no target and has a value of 1, otherwise it is 0; x and y respectively represent the horizontal coordinate and the vertical coordinate of the prediction box; w, h represent the width and height of the prediction box, respectively, c represents the predicted value of the confidence level,
Figure FDA0003818032820000036
a label value representing a confidence.
9. The system for detecting the coal foreign matter based on the improved YOLOv5 algorithm as claimed in claim 1, wherein the Loss function calculation module obtains the total Loss by using the following logic weighting processing: loss = a L obj +b*L box +c*L cls
10. A coal foreign matter detection method based on an improved YOLOv5 algorithm is characterized by comprising the following steps:
s1, a coal foreign matter type image data set is acquired and manufactured by a coal foreign matter data set module;
s2, expanding the coal foreign matter type data set through image enhancement operation;
s3, extracting foreign matter multi-scale features from the coal foreign matter type data set by using a YOLOv5 network model, and training a convolutional neural network in the YOLOv5 network model;
s4, calculating a data set applicable anchor frame applicable to the coal foreign matter type image data set by using a K-means clustering algorithm;
s5, improving a YOLOv5 network model, wherein the step S5 further comprises the following steps:
s51, performing mosaic data enhancement and random perspective transformation on an original image by using an input end to obtain an enhanced image, processing the original image by adopting a K-means clustering algorithm to obtain an applicable anchor frame, and performing scaling processing on the enhanced image by a preset size to obtain and input a foreign matter feature map to a backbone network structure module;
s52, carrying out deep separable convolution, residual inversion and lightweight attention data processing operation on the foreign matter feature map by using the backbone network structure module and adopting a MobileNet V3 network structure, obtaining lightweight attention map image features with preset precision by using a Mish () activation function, and obtaining a backbone network structure feature map by using preset activation function processing;
s53, fusing the neck network structure module with the backbone network structure characteristic diagram in a top-down mode to obtain a neck network structure characteristic diagram by utilizing a transfer strong positioning characteristic;
s54, eliminating redundant bounding boxes by utilizing an output end according to the neck network characteristic diagram to obtain an applicable target bounding box, and obtaining and weighting confidence coefficient loss, rectangular box loss and classification loss by using preset loss logic to obtain total loss;
and S6, according to the total loss, retraining the convolutional neural network in the improved YOLOv5 network model, and accordingly detecting to obtain a coal foreign matter recognition result.
CN202211032554.0A 2022-08-26 2022-08-26 Coal foreign matter detection system and method based on improved YOLOv5 algorithm Pending CN115410039A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211032554.0A CN115410039A (en) 2022-08-26 2022-08-26 Coal foreign matter detection system and method based on improved YOLOv5 algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211032554.0A CN115410039A (en) 2022-08-26 2022-08-26 Coal foreign matter detection system and method based on improved YOLOv5 algorithm

Publications (1)

Publication Number Publication Date
CN115410039A true CN115410039A (en) 2022-11-29

Family

ID=84162587

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211032554.0A Pending CN115410039A (en) 2022-08-26 2022-08-26 Coal foreign matter detection system and method based on improved YOLOv5 algorithm

Country Status (1)

Country Link
CN (1) CN115410039A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115937991A (en) * 2023-03-03 2023-04-07 深圳华付技术股份有限公司 Human body tumbling identification method and device, computer equipment and storage medium
CN116563800A (en) * 2023-04-26 2023-08-08 北京交通大学 Method and system for detecting vehicles in tunnel based on lightweight YOLOv3

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115937991A (en) * 2023-03-03 2023-04-07 深圳华付技术股份有限公司 Human body tumbling identification method and device, computer equipment and storage medium
CN116563800A (en) * 2023-04-26 2023-08-08 北京交通大学 Method and system for detecting vehicles in tunnel based on lightweight YOLOv3

Similar Documents

Publication Publication Date Title
CN112884064B (en) Target detection and identification method based on neural network
CN110728200B (en) Real-time pedestrian detection method and system based on deep learning
CN115410039A (en) Coal foreign matter detection system and method based on improved YOLOv5 algorithm
CN108304798B (en) Street level order event video detection method based on deep learning and motion consistency
CN111723748A (en) Infrared remote sensing image ship detection method
CN108334881B (en) License plate recognition method based on deep learning
CN109886159B (en) Face detection method under non-limited condition
CN113205063A (en) Visual identification and positioning method for defects of power transmission conductor
CN109801297B (en) Image panorama segmentation prediction optimization method based on convolution
CN110598698B (en) Natural scene text detection method and system based on adaptive regional suggestion network
CN113963032A (en) Twin network structure target tracking method fusing target re-identification
CN110309765B (en) High-efficiency detection method for video moving target
CN112149533A (en) Target detection method based on improved SSD model
CN114120093A (en) Coal gangue target detection method based on improved YOLOv5 algorithm
CN111008994A (en) Moving target real-time detection and tracking system and method based on MPSoC
CN116052222A (en) Cattle face recognition method for naturally collecting cattle face image
CN112396655A (en) Point cloud data-based ship target 6D pose estimation method
CN110598708B (en) Streetscape text target identification and detection method
CN111667465A (en) Metal hand basin defect detection method based on far infrared image
CN111507353A (en) Chinese field detection method and system based on character recognition
CN113240668B (en) Image digital feature distribution-based generated molten pool image quality evaluation method
CN114529821A (en) Offshore wind power safety monitoring and early warning method based on machine vision
CN116740572A (en) Marine vessel target detection method and system based on improved YOLOX
CN116363535A (en) Ship detection method in unmanned aerial vehicle aerial image based on convolutional neural network
Sun et al. Flame Image Detection Algorithm Based onComputer Vision.

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