CN110766041A - Deep learning-based pest detection method - Google Patents
Deep learning-based pest detection method Download PDFInfo
- Publication number
- CN110766041A CN110766041A CN201910830378.7A CN201910830378A CN110766041A CN 110766041 A CN110766041 A CN 110766041A CN 201910830378 A CN201910830378 A CN 201910830378A CN 110766041 A CN110766041 A CN 110766041A
- Authority
- CN
- China
- Prior art keywords
- convolution
- target
- pest
- frame
- pests
- 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.)
- Granted
Links
- 241000607479 Yersinia pestis Species 0.000 title claims abstract description 101
- 238000001514 detection method Methods 0.000 title claims abstract description 70
- 238000013135 deep learning Methods 0.000 title claims abstract description 14
- 238000011176 pooling Methods 0.000 claims abstract description 40
- 230000006870 function Effects 0.000 claims abstract description 22
- 238000012549 training Methods 0.000 claims abstract description 16
- 238000000034 method Methods 0.000 claims description 29
- 230000008569 process Effects 0.000 claims description 13
- 238000000605 extraction Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000002372 labelling Methods 0.000 claims description 6
- 230000036544 posture Effects 0.000 claims description 4
- 238000003379 elimination reaction Methods 0.000 claims description 3
- 230000005764 inhibitory process Effects 0.000 claims description 3
- 238000012163 sequencing technique Methods 0.000 claims description 3
- 230000001629 suppression Effects 0.000 claims description 3
- 230000008859 change Effects 0.000 claims description 2
- 238000005303 weighing Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000004913 activation Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 241000238631 Hexapoda Species 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 230000000856 effect on pests Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000004497 NIR spectroscopy Methods 0.000 description 1
- 238000004164 analytical calibration Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000002265 prevention Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/02—Agriculture; Fishing; Forestry; Mining
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Animal Husbandry (AREA)
- Economics (AREA)
- Mining & Mineral Resources (AREA)
- Marine Sciences & Fisheries (AREA)
- Tourism & Hospitality (AREA)
- Strategic Management (AREA)
- Primary Health Care (AREA)
- Marketing (AREA)
- Human Resources & Organizations (AREA)
- Agronomy & Crop Science (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
- Catching Or Destruction (AREA)
Abstract
The invention relates to a pest detection method based on deep learning, which is mainly applied to the detection of pests in a granary. Through the VGG16 model in the lightweight SSD, and reduce the dimension that corresponds convolution kernel, pooling kernel and characteristic map, modify the characteristic layer, add the weighting target who is used for classification and regression task in addition in the loss function, use the granary pest picture of mark to train, detect the pest with the model that the training is accomplished. The invention can learn multilevel characteristics from low to high, optimizes the convergence rate of model training, balances the number of positive and negative samples, improves the training efficiency and quickly realizes high-precision granary pest detection.
Description
Technical Field
The invention relates to the technical field of computer vision, in particular to a pest detection method based on deep learning.
Background
In the process of grain storage, insect pests are one of the important causes of grain loss, and the premise of prevention and control is to detect the occurrence of the insect pests in time. At present, the pest detection of the granary is mainly carried out or is manually detected, and the detection method is poor in timeliness and low in accuracy. And the method can be completed only by the experts of the pests in the granary or the managers of the granary with abundant experience.
With the development of optical technology, granary pest detection technology based on the support of optical principle appears. Such as soft X-ray detection and near infrared spectroscopy, etc. However, these methods have the problems of high equipment cost, complicated instrument calibration, limited detection range, etc.
SSD is a One-Stage (One-time) method of detection. The method combines the regression idea of YOLO and the Anchor boxes mechanism in fast-RCNN, adds the detection mode of the characteristic pyramid of the RPN network, detects multi-scale targets by executing sliding window scanning on the characteristic images of different convolutional layers, can detect small targets in the characteristic images output by the convolutional layers, obtains characteristic images with certain translation and scale invariance, applies the characteristics to the detection of granary pests, and can effectively improve the detection precision.
Disclosure of Invention
The invention aims to solve the problems of long detection time, low detection accuracy and the like in the traditional granary pest detection method, further improve the training speed and the detection accuracy of an SSD (solid State disk) model, provide a deep learning-based pest detection method and provide necessary technical support for an intelligent granary pest early warning system.
The invention is realized by the following technical scheme, which comprises the following steps:
step 1: the method comprises the steps that a photographing device is used for collecting pest pictures, pests in each picture are marked, and a database for detecting pests in a granary is constructed;
step 2: a VGG16 network structure of a lightweight SSD model;
and step 3: adding a weighted target for classification and regression tasks into the SSD loss function;
and 4, step 4: and training the pests with various postures and different sizes in the collected pest picture, and detecting the pests by using the trained SSD model.
Further, the step 2 includes the steps of:
step 2.1: modifying the VGG16 network structure to change the multiple convolution and maximum pooling operations of the SSD backbone network VGG16 model to convolution 1_1, convolution 1_2, maximum pooling 1, convolution 2_2, maximum pooling 2, convolution 3_1, convolution 3_3, maximum pooling 3, convolution 4_1, convolution 4_3, maximum pooling 4, convolution 5_1, convolution 5_3, maximum pooling 5;
step 2.2: changing the dimensionality of the convolution kernel and the pooling kernel of the VGG16 to 3 × 3, 2 × 2, 3 × 3, 2 × 2, 3 × 3;
step 2.3: changing the dimension of the VGG16 feature map to 300 × 300, 150 × 150, 75 × 75, 38 × 38, 19 × 19;
step 2.4: and selecting all feature maps corresponding to all convolution layers from the extracted feature maps to be convolved with convolution kernels of 3 multiplied by 3, and then presetting a default frame in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to the labeling frame.
Further, the step 3 includes the steps of:
step 3.1: in the training stage of the SSD convolutional network, matching a default frame with pests, wherein if the default frame is matched with the pests, the default frame is a positive sample, and if the default frame is not matched with the pests, the default frame is a negative sample; then, sequencing the negative samples according to the loss value of the confidence coefficient, wherein the loss value is obtained by a target loss function;
step 3.2: adding a weighted target for classification and regression tasks into the loss function, wherein the target calculation process comprises the following steps: assuming that k default boxes are provided, the number of positive samples is n, the number of negative samples is m, k equals m + n, a Label for classification is set, and when n > 0, the weighted Pos _ target for positive sample classification is: pos _ target is Labeel/n; when m > 0 and the positive and negative sample ratio is set to 1: p, then the weighted Neg _ target for the negative sample classification is: neg _ target ═ {1-Label }/m × p; the weighted Tol _ target of the whole classification task is: tol _ target ═ Pos _ target + Neg _ target; the weight coefficient added into the regression task is theta, and the weighted Reg _ target of the regression task is as follows: reg _ target is Pos _ target × θ.
Further, the loss function in step 3.1 above consists of two parts, classification and regression:wherein N is the number of matching to pest default boxes; l islocRepresenting confidence loss, realized by regression positioning error; l isconfThe confidence coefficient loss is expressed and realized by a Softmax multi-classification function, z is position information of an actual pest, c is confidence coefficient of a prediction target, l is position information of a prediction object frame, g is position information of the pest, α is a weighing parameter of the confidence coefficient loss and the position loss, and the default is set to be 1.
Further, the step 4 includes the following steps:
step 4.1: the output of VGG16 in the improved SSD method is used for preliminary feature extraction of pests, and a basic feature map of a pest image is obtained;
step 4.2: carrying out multi-scale feature extraction on the feature map obtained in the step 4.1 through a plurality of convolution operations and maximum pooling operations of a multi-scale feature detection network in sequence, extracting multi-level feature maps and selecting candidate pest areas with different sizes and different aspect ratios from the feature maps;
step 4.3: selecting all feature maps corresponding to all convolution layers from the feature maps extracted in the step 4.2 to be convolved with convolution kernels of 3 x 3, and then presetting default frames in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to the labeling frame; wherein the default boxes are a series of fixed-size boxes on each grid of the feature map;
step 4.4: and 4.3, combining the convolution calculation results of the layers according to the step 4.3, transmitting the combined results to the detection layers, and fusing the detection results of all the layers by using a non-maximum inhibition method to obtain the granary pest image detection result.
Further, the multi-scale feature detection network in the above step 4.2 includes convolution 4_1, convolution 4_3, max pooling 4, convolution 5_1, convolution 5_3, max pooling 5, convolution 6_1, convolution 6_2, convolution 7_1, convolution 7_2, convolution 8_1, convolution 8_2, convolution 9_1 and convolution 9_2, wherein the dimensions of the convolution kernel and the pooling kernel are 3 × 3, 2 × 2, 3 × 3, 1 × 1, 3 × 3, respectively; the dimensions of the obtained feature maps were 38 × 38, 19 × 19, 19 × 10, 10 × 10, 5 × 5, 3 × 3, and 1 × 1, respectively.
Further, the non-maximum suppression method in step 4.4 is an iterative-traversal-elimination process, which includes the following steps:
4.4.1: sorting the scores of all the frames, and selecting the highest score and the corresponding frame;
4.4.2: traversing the rest frames, and deleting the frame if the overlapping area of the frame and the current highest frame is larger than a threshold value;
4.4.3: the above process is repeated with the highest score selected from the unprocessed boxes.
The invention provides a pest detection method based on deep learning, which comprises the steps of firstly carrying out primary feature extraction on a pest image by using a lightweight VGG16 convolutional network, then carrying out multi-scale feature extraction, evaluating pest detection frames with different length-width ratios at each position in a plurality of feature maps output by different convolutional layers, and detecting pests with different postures and sizes in the image. The SSD target detection model is composed of a VGG16 convolutional neural network subjected to lightweight processing and a multi-scale feature detection network, and detection is carried out through feature maps of 6 different convolutional layers. The invention effectively discretizes the shape of the output frame by applying a default frame mechanism on the feature maps of different layers, thereby greatly reducing the number of pest detection frames, accelerating the detection speed, and detecting pests from the feature maps of the different layers, thereby being capable of carrying out multi-scale detection on the input pest image.
The invention carries out lightweight processing on the original SSD model and accelerates the convergence speed of the model. In addition, the loss function is improved, so that the number of positive and negative samples is balanced, and the training efficiency is improved. The SSD convolutional network encapsulates image processing operation in a single network, so that the training and detection time is greatly shortened, the granary pest detection can be better realized, certain robustness is increased, and the SSD convolutional network can be integrated into an early warning system of granary pests.
Drawings
Fig. 1 is a schematic diagram of an original SSD convolutional network.
Fig. 2 is a schematic diagram of an SSD convolutional network employed in the present invention.
Fig. 3 is a flow chart of the comprehensive detection of granary pests in the SSD convolutional network of the present invention.
Fig. 4 is an image of the effect of barn pests detected by the SSD model of the present invention.
Detailed Description
In order to make the object and technical solution of the present invention more clear, the following describes the implementation steps of the present invention in detail with reference to fig. 1-4.
As shown in fig. 1, which is a schematic diagram of an original SSD convolution network, and fig. 2 which is a schematic diagram of an SSD convolution network used in the present invention, it can be seen from comparison of the two diagrams that the feature diagrams of 6 different convolution layers are sequentially changed, the original convolution 7(FC7) is removed, and the convolution 5_3 is used instead.
The invention provides a deep learning-based pest detection method, which comprises the following steps:
step 1: the method comprises the steps that a photographing device is used for collecting pest pictures, pests in each picture are marked, and a database for detecting pests in a granary is constructed;
step 2: a VGG16 network structure of a lightweight SSD model;
and step 3: adding weighted tar get used for classification and regression tasks into the SSD loss function;
and 4, step 4: and training the pests with various postures and different sizes in the collected pest picture, and detecting the pests by using the trained SSD model.
The step 1 specifically comprises the following steps: the method comprises the steps of shooting pictures of high-outbreak granary pests, preprocessing the pictures, removing redundant backgrounds, marking the positions of the pests in each picture by adopting LabelImg, setting English acronyms labeled as the pests, storing the English acronyms in an xml format, and constructing a database of the pictures and marking files.
The step 2 comprises the following steps:
step 2.1: modifying the VGG16 network structure, the multiple volume and maximum pooling operations of the original SSD backbone network VGG16 model comprise: convolution 1_1, convolution 1_2, max pooling 1, convolution 2_2, max pooling 2, convolution 3_1, convolution 3_2, convolution 3_3, max pooling 3, convolution 4_1, convolution 4_2, convolution 4_3, max pooling 4, convolution 5_1, convolution 5_2, convolution 5_3, max pooling 5, convolution 6, convolution 7. Changing it to convolution 1_1, convolution 1_2, max pooling 1, convolution 2_2, max pooling 2, convolution 3_1, convolution 3_3, max pooling 3, convolution 4_1, convolution 4_3, max pooling 4, convolution 5_1, convolution 5_3, max pooling 5;
step 2.2: modifying the dimensions of the convolution kernel and pooling kernel of the original VGG16 from 3 × 3, 2 × 2, 3 × 3, 1 × 1 to 3 × 3, 2 × 2, 3 × 3, 3 × 2, 3 × 3, 2 × 2, 3 × 3, 3 × 2, 3 × 3 and 3 × 3;
step 2.3: the dimension of the original VGG16 feature map is modified from the original 300 × 300, 150 × 150, 75 × 75, 38 × 38, 19 × 19, and 19 × 19 to 300 × 300, 150 × 150, 75 × 75, 38 × 38, 19 × 19, and 19 × 19.
Step 2.4: selecting all feature maps corresponding to all convolutional layers from the extracted feature maps to perform convolution with convolution kernels of 3 x 3, then presetting a default frame in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to a labeling frame, wherein the convolutional layers selected by the original SSD model are shown in FIG. 1-1: convolution 4_3, convolution 7, convolution 6_2, convolution 7_2, convolution 8_2 and convolution 9_2 are changed to convolution 4_3, convolution 5_3, convolution 6_2, convolution 7_2, convolution 8_2 and convolution 9_2, as shown in FIGS. 1-2.
The 6 convolutional layers in step 2.4 are shown in FIG. 1 and include 4_3, convolution 5_3, convolution 6_2, convolution 7_2, convolution 8_2 and convolution 9_ 2. The deviation of the target frame and the prediction of different classification scores are carried out on the characteristic layers of the pyramid structure, and as can be seen from fig. 3, the characteristic graphs output by different convolution layers can detect pests with different scales in the image, wherein the characteristic graph output by convolution 4_3 can detect the pests with small scale in the image, but has poor detection effect on the pests with large size; the feature map output by convolution 9_2 can detect pests with larger sizes in the image, but has poor detection effect on pests with small sizes. By utilizing the characteristic diagrams output by the plurality of convolutional layers for detection, the problem of multi-scale pest detection in the image can be solved, the pest detection resolution of the algorithm is increased, and the detection effect on pests with relatively small sizes in the image is improved.
The step 3 comprises the following steps:
step 3.1: in the training stage of the SSD convolutional network, matching a default frame with pests, wherein if the default frame is matched with the pests, the default frame is a positive sample, and if the default frame is not matched with the pests, the default frame is a negative sample; then, sequencing the negative samples according to the loss value of the confidence coefficient, wherein the loss value is obtained by a target loss function;
the setting process of the default frame in the step 3.1 is as follows: 4 default frames are preset in each feature map grid on the 6 feature maps in step 2.4, the feature maps of different output layers are provided with default frames of multiple scales, and the same feature map is provided with default frames of different aspect ratios, so that pest detection of various shapes and sizes in the image is realized. The width-to-height ratio of the default frame of the pest is set to 1:1, 2:1, 3:1, 1: 2.
The loss function in step 3.1 consists of two parts, classification and regression:wherein N is the number of matching to pest default boxes; l islocRepresenting confidence loss, realized by regression positioning error; l isconfRepresenting confidence loss, implemented by a Softmax multi-classification function; z is the location information of the actual pest; c is the confidence of the predicted target; l is the position information of the predicted object frame; g represents positional information of pests;α is a trade-off parameter for confidence loss and location loss, set to 1 by default.
Step 3.2: adding a weighted target for classification and regression tasks into the loss function, wherein the target calculation process comprises the following steps: assuming that k default boxes are provided, the number of positive samples is n, the number of negative samples is m, k equals m + n, a Label for classification is set, and when n > 0, the weighted Pos _ target for positive sample classification is: pos _ target is Label/n; when m is greater than 0, setting the proportion of positive samples to negative samples to be 1: p, then the weighted Neg _ target for the negative sample classification is: neg _ target ═ {1-Label }/m × p; the weighted Tol _ target of the whole classification task is: tol _ target ═ Pos _ target + Neg _ target; the weight coefficient added into the regression task is theta, and the weighted Reg _ target of the regression task is as follows: reg _ target is Pos _ target × θ.
Pest detection process referring to fig. 3, step 4 includes the steps of:
step 4.1: the output of VGG16 in the improved SSD method is used for preliminary feature extraction of pests, and a basic feature map of a pest image is obtained;
step 4.2: carrying out multi-scale feature extraction on the feature map obtained in the step 4.1 through a plurality of convolution operations and maximum pooling operations of a multi-scale feature detection network in sequence, extracting multi-level feature maps and selecting candidate pest areas with different sizes and different aspect ratios at each position in the feature maps;
the multi-scale feature detection network in the step 4.2 comprises convolution 4_1, convolution 4_3, maximal pooling 4, convolution 5_1, convolution 5_3, maximal pooling 5, convolution 6_1, convolution 6_2, convolution 7_1, convolution 7_2, convolution 8_1, convolution 8_2, convolution 9_1 and convolution 9_2, wherein the dimensions of a convolution kernel and a pooling kernel are 3 × 3, 2 × 2, 3 × 3, 1 × 1, 3 × 3, 3 × 1 and 3 × 3, respectively; the dimensions of the obtained feature maps were 38 × 38, 19 × 19, 19 × 10, 10 × 10, 5 × 5, 3 × 3, and 1 × 1, respectively.
The convolution operation process in the step 4.2 is as follows: the output of the convolution operation in the ith hidden layer is denoted xi=f(wixi-1+bi),Wherein xi-1Is the output of the i-1 th hidden layer, xiFor the output of the convolutional layer in the ith hidden layer, x0For an input image of an input layer, wiWeight feature matrix representing the ith hidden layer, biFor the bias of the ith hidden layer, f () is the Relu activation function, whose expression is f (x) max (0, x).
The maximum pooling operation in the step 4.2 is as follows: and sequentially taking the maximum values in the 2 multiplied by 2 area on the feature map after activation by the activation function f () with the step length of 2 to obtain the feature map with the length and the width reduced by half.
Step 4.3: selecting all feature maps corresponding to all convolution layers from the feature maps extracted in the step 4.2 to be convolved with convolution kernels of 3 x 3, and then presetting default frames in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to the labeling frame; wherein the default boxes are a series of fixed-size boxes on each grid of the feature map;
step 4.4: and 4.3, merging the convolution calculation results of the layers according to the step 4.3, transmitting the merged results to the detection layers, and fusing the detection results of all the layers by using non-maximum value inhibition to obtain a pest image detection result.
The detection process of the detection layer in the step 4.4 is as follows: assuming there are k default boxes per grid, each default box predicts a score of 2 target classes and 4 offsets; if the size of the feature map is m × n, that is, if there are m × n feature map grids, the feature map has 6m × n × k outputs in total.
The non-maximum suppression method in step 4.4 is an iterative-traversal-elimination process:
(1) sorting the scores of all the frames, and selecting the highest score and the corresponding frame;
(2) traversing the rest of frames, and deleting the frame if the overlapping area of the frame and the current highest frame is larger than a threshold (initially set to be 0.005);
(3) the above process is repeated with the highest score selected from the unprocessed boxes.
The lightweight SSD network needs to improve the detection effect through repeated iterative training: in the training process, the loss function value is reduced through multiple times of result optimization, and the pest detection performance of the SSD convolutional network is continuously improved.
The training of the lightweight SSD network comprises the following steps:
(1) inputting the image to a VGG16 convolutional neural network with a modified structure to obtain the preliminary characteristics of the image;
(2) extracting multilayer characteristic graphs and selecting candidate regions with different sizes and different aspect ratios;
(3) calculating the coordinate position offset and the category score of each candidate area;
(4) determining a final area according to the candidate area and the coordinate position offset, estimating a loss function of the candidate area according to the category score, and accumulating to obtain total loss;
(5) and correcting the weight of each layer through a back propagation process by the total loss.
The invention carries out lightweight processing on an original SSD model to accelerate the convergence speed of the model; the loss function is improved, so that the number of positive and negative samples is balanced, and the training efficiency is improved. Fig. 4 shows the pest detection effect of the barn by the present invention. The default frame mechanism is applied to the feature maps of different layers, the shape of the output frame is effectively discretized, so that the number of pest detection frames is reduced, the detection speed is increased, the granary pests are detected through the feature maps of a plurality of different layers, and the input pest image can be subjected to multi-scale detection.
Claims (7)
1. A pest detection method based on deep learning is characterized by comprising the following steps:
step 1: the method comprises the steps that a photographing device is used for collecting pest pictures, pests in each picture are marked, and a database for detecting pests in a granary is constructed;
step 2: a VGG16 network structure of a lightweight SSD model;
and step 3: adding a weighted target for classification and regression tasks into the SSD loss function;
and 4, step 4: and training the pests with various postures and different sizes in the collected pest picture, and detecting the pests by using the trained SSD model.
2. The deep learning-based pest detection method according to claim 1, wherein said step 2 comprises the steps of:
step 2.1: modifying the VGG16 network structure to change the multiple convolution and maximum pooling operations of the SSD backbone network VGG16 model to convolution 1_1, convolution 1_2, maximum pooling 1, convolution 2_2, maximum pooling 2, convolution 3_1, convolution 3_3, maximum pooling 3, convolution 4_1, convolution 4_3, maximum pooling 4, convolution 5_1, convolution 5_3, maximum pooling 5;
step 2.2: changing the dimensionality of the convolution kernel and the pooling kernel of the VGG16 to 3 × 3, 2 × 2, 3 × 3, 2 × 2, 3 × 3;
step 2.3: changing the dimension of the VGG16 feature map to 300 × 300, 150 × 150, 75 × 75, 38 × 38, 19 × 19;
step 2.4: and selecting all feature maps corresponding to all convolution layers from the extracted feature maps to be convolved with convolution kernels of 3 multiplied by 3, and then presetting a default frame in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to the labeling frame.
3. The deep learning-based pest detection method according to claim 1, wherein the step 3 comprises the steps of:
step 3.1: in the training stage of the SSD convolutional network, matching a default frame with pests, wherein if the default frame is matched with the pests, the default frame is a positive sample, and if the default frame is not matched with the pests, the default frame is a negative sample; then, sequencing the negative samples according to the loss value of the confidence coefficient, wherein the loss value is obtained by a target loss function;
step 3.2: adding a weighted target for classification and regression tasks into the loss function, wherein the target calculation process comprises the following steps: assuming that k default boxes are provided, the number of positive samples is n, the number of negative samples is m, k equals m + n, a Label for classification is set, and when n > 0, the weighted Pos _ target for positive sample classification is: pos _ target is Label/n; when m > 0 and the positive and negative sample ratio is set to 1: p, then the weighted Neg _ target for the negative sample classification is: neg _ target ═ {1-Label }/m × p; the weighted Tol _ target of the whole classification task is: tol _ target ═ Pos _ target + Neg _ target; the weight coefficient added into the regression task is theta, and the weighted Reg _ target of the regression task is as follows: reg _ target is Pos _ target × θ.
4. A deep learning based pest detection method as claimed in claim 3, wherein the loss function in step 3.1 consists of two parts of classification and regression:wherein N is the number of matching to pest default boxes; l islocRepresenting confidence loss, realized by regression positioning error; l isconfThe confidence coefficient loss is expressed and realized by a Softmax multi-classification function, z is position information of an actual pest, c is confidence coefficient of a prediction target, l is position information of a prediction object frame, g is position information of the pest, α is a weighing parameter of the confidence coefficient loss and the position loss, and the default is set to be 1.
5. The deep learning-based pest detection method according to claim 1, wherein the step 4 comprises the steps of:
step 4.1: the output of VGG16 in the improved SSD method is used for preliminary feature extraction of pests, and a basic feature map of a pest image is obtained;
step 4.2: carrying out multi-scale feature extraction on the feature map obtained in the step 4.1 through a plurality of convolution operations and maximum pooling operations of a multi-scale feature detection network in sequence, extracting multi-level feature maps and selecting candidate pest areas with different sizes and different aspect ratios from the feature maps;
step 4.3: selecting all feature maps corresponding to all convolution layers from the feature maps extracted in the step 4.2 to be convolved with convolution kernels of 3 x 3, and then presetting default frames in each feature map grid on each layer of output feature map to obtain the offset and confidence of each frame relative to the labeling frame; wherein the default boxes are a series of fixed-size boxes on each grid of the feature map;
step 4.4: and 4.3, combining the convolution calculation results of the layers according to the step 4.3, transmitting the combined results to the detection layers, and fusing the detection results of all the layers by using a non-maximum inhibition method to obtain the granary pest image detection result.
6. A deep learning based pest detection method as claimed in claim 5, wherein the multi-scale feature detection network in step 4.2 comprises convolution 4_1, convolution 4_3, max pooling 4, convolution 5_1, convolution 5_3, max pooling 5, convolution 6_1, convolution 6_2, convolution 7_1, convolution 7_2, convolution 8_1, convolution 8_2, convolution 9_1 and convolution 9_2, wherein dimensions of convolution kernel and pooling kernel are 3 x 3, 2 x 2, 3 x 3, 1 x 1, 3 x 3, 1 x 1, 3 x 3; the dimensions of the obtained feature maps were 38 × 38, 19 × 19, 19 × 10, 10 × 10, 5 × 5, 3 × 3, and 1 × 1, respectively.
7. A deep learning based pest detection method as claimed in claim 5 wherein the non-maxima suppression method in step 4.4 is an iterative-traversal-elimination process comprising the steps of:
4.4.1: sorting the scores of all the frames, and selecting the highest score and the corresponding frame;
4.4.2: traversing the rest frames, and deleting the frame if the overlapping area of the frame and the current highest frame is larger than a threshold value;
4.4.3: the above process is repeated with the highest score selected from the unprocessed boxes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910830378.7A CN110766041B (en) | 2019-09-04 | 2019-09-04 | Deep learning-based pest detection method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910830378.7A CN110766041B (en) | 2019-09-04 | 2019-09-04 | Deep learning-based pest detection method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110766041A true CN110766041A (en) | 2020-02-07 |
CN110766041B CN110766041B (en) | 2023-04-07 |
Family
ID=69329231
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910830378.7A Active CN110766041B (en) | 2019-09-04 | 2019-09-04 | Deep learning-based pest detection method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110766041B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111476238A (en) * | 2020-04-29 | 2020-07-31 | 中国科学院合肥物质科学研究院 | Pest image detection method based on regional scale perception technology |
CN111597941A (en) * | 2020-05-08 | 2020-08-28 | 河海大学 | Target detection method for dam defect image |
CN111832642A (en) * | 2020-07-07 | 2020-10-27 | 杭州电子科技大学 | Image identification method based on VGG16 in insect taxonomy |
CN111881970A (en) * | 2020-07-23 | 2020-11-03 | 国网天津市电力公司 | Intelligent outer broken image identification method based on deep learning |
CN112288022A (en) * | 2020-11-02 | 2021-01-29 | 河南工业大学 | SSD algorithm-based characteristic fusion-based grain insect identification method and identification system |
CN112528726A (en) * | 2020-10-14 | 2021-03-19 | 石河子大学 | Aphis gossypii insect pest monitoring method and system based on spectral imaging and deep learning |
CN112598663A (en) * | 2020-12-30 | 2021-04-02 | 河南工业大学 | Grain pest detection method and device based on visual saliency |
WO2021203505A1 (en) * | 2020-04-09 | 2021-10-14 | 丰疆智能软件科技(南京)有限公司 | Method for constructing pest detection model |
CN113516647A (en) * | 2021-07-27 | 2021-10-19 | 山东浪潮科学研究院有限公司 | Method for detecting disease of micro-fungus crops |
CN113762081A (en) * | 2021-08-09 | 2021-12-07 | 江苏大学 | Granary pest detection method based on YOLOv5s |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109191455A (en) * | 2018-09-18 | 2019-01-11 | 西京学院 | A kind of field crop pest and disease disasters detection method based on SSD convolutional network |
-
2019
- 2019-09-04 CN CN201910830378.7A patent/CN110766041B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109191455A (en) * | 2018-09-18 | 2019-01-11 | 西京学院 | A kind of field crop pest and disease disasters detection method based on SSD convolutional network |
Non-Patent Citations (2)
Title |
---|
周云成等: "基于深度卷积神经网络的番茄主要器官分类识别方法", 《农业工程学报》 * |
彭红星等: "自然环境下多类水果采摘目标识别的通用改进SSD模型", 《农业工程学报》 * |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021203505A1 (en) * | 2020-04-09 | 2021-10-14 | 丰疆智能软件科技(南京)有限公司 | Method for constructing pest detection model |
CN111476238A (en) * | 2020-04-29 | 2020-07-31 | 中国科学院合肥物质科学研究院 | Pest image detection method based on regional scale perception technology |
CN111476238B (en) * | 2020-04-29 | 2023-04-07 | 中国科学院合肥物质科学研究院 | Pest image detection method based on regional scale perception technology |
CN111597941A (en) * | 2020-05-08 | 2020-08-28 | 河海大学 | Target detection method for dam defect image |
CN111597941B (en) * | 2020-05-08 | 2021-02-09 | 河海大学 | Target detection method for dam defect image |
CN111832642A (en) * | 2020-07-07 | 2020-10-27 | 杭州电子科技大学 | Image identification method based on VGG16 in insect taxonomy |
CN111881970A (en) * | 2020-07-23 | 2020-11-03 | 国网天津市电力公司 | Intelligent outer broken image identification method based on deep learning |
CN112528726B (en) * | 2020-10-14 | 2022-05-13 | 石河子大学 | Cotton aphid pest monitoring method and system based on spectral imaging and deep learning |
CN112528726A (en) * | 2020-10-14 | 2021-03-19 | 石河子大学 | Aphis gossypii insect pest monitoring method and system based on spectral imaging and deep learning |
CN112288022A (en) * | 2020-11-02 | 2021-01-29 | 河南工业大学 | SSD algorithm-based characteristic fusion-based grain insect identification method and identification system |
CN112288022B (en) * | 2020-11-02 | 2022-09-20 | 河南工业大学 | SSD algorithm-based characteristic fusion-based grain insect identification method and identification system |
CN112598663B (en) * | 2020-12-30 | 2022-10-04 | 河南工业大学 | Grain pest detection method and device based on visual saliency |
CN112598663A (en) * | 2020-12-30 | 2021-04-02 | 河南工业大学 | Grain pest detection method and device based on visual saliency |
CN113516647A (en) * | 2021-07-27 | 2021-10-19 | 山东浪潮科学研究院有限公司 | Method for detecting disease of micro-fungus crops |
CN113516647B (en) * | 2021-07-27 | 2023-06-13 | 山东浪潮科学研究院有限公司 | Method for detecting diseases of miniature fungus crops |
CN113762081A (en) * | 2021-08-09 | 2021-12-07 | 江苏大学 | Granary pest detection method based on YOLOv5s |
Also Published As
Publication number | Publication date |
---|---|
CN110766041B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110766041B (en) | Deep learning-based pest detection method | |
US11429818B2 (en) | Method, system and device for multi-label object detection based on an object detection network | |
CN108564097B (en) | Multi-scale target detection method based on deep convolutional neural network | |
CN108108764B (en) | Visual SLAM loop detection method based on random forest | |
CN111259930A (en) | General target detection method of self-adaptive attention guidance mechanism | |
CN110770752A (en) | Automatic pest counting method combining multi-scale feature fusion network with positioning model | |
CN110033473B (en) | Moving target tracking method based on template matching and depth classification network | |
CN110135522B (en) | Intelligent method for detecting and marking small target integration of remote sensing image | |
CN112364931B (en) | Few-sample target detection method and network system based on meta-feature and weight adjustment | |
CN111507271A (en) | Airborne photoelectric video target intelligent detection and identification method | |
CN111553200A (en) | Image detection and identification method and device | |
CN110765865B (en) | Underwater target detection method based on improved YOLO algorithm | |
CN112232371B (en) | American license plate recognition method based on YOLOv3 and text recognition | |
CN110610210B (en) | Multi-target detection method | |
US20230047131A1 (en) | Contour shape recognition method | |
CN110443279B (en) | Unmanned aerial vehicle image vehicle detection method based on lightweight neural network | |
CN108133235A (en) | A kind of pedestrian detection method based on neural network Analysis On Multi-scale Features figure | |
CN111753682A (en) | Hoisting area dynamic monitoring method based on target detection algorithm | |
CN112364974B (en) | YOLOv3 algorithm based on activation function improvement | |
CN114821102A (en) | Intensive citrus quantity detection method, equipment, storage medium and device | |
CN115147418B (en) | Compression training method and device for defect detection model | |
CN115019103A (en) | Small sample target detection method based on coordinate attention group optimization | |
CN116310718A (en) | Method, system and equipment for detecting pest target based on YOLOv5 model | |
Zhu et al. | Human detection under UAV: an improved faster R-CNN approach | |
CN108960005B (en) | Method and system for establishing and displaying object visual label in intelligent visual Internet of things |
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 | ||
TR01 | Transfer of patent right |
Effective date of registration: 20240220 Address after: 1003, Building A, Zhiyun Industrial Park, No. 13 Huaxing Road, Henglang Community, Dalang Street, Longhua District, Shenzhen City, Guangdong Province, 518000 Patentee after: Shenzhen Wanzhida Technology Transfer Center Co.,Ltd. Country or region after: China Address before: 212013 No. 301, Xuefu Road, Zhenjiang, Jiangsu Patentee before: JIANGSU University Country or region before: China |
|
TR01 | Transfer of patent right |