CN114022469A - Cigarette appearance defect image classification method and system - Google Patents

Cigarette appearance defect image classification method and system Download PDF

Info

Publication number
CN114022469A
CN114022469A CN202111347126.2A CN202111347126A CN114022469A CN 114022469 A CN114022469 A CN 114022469A CN 202111347126 A CN202111347126 A CN 202111347126A CN 114022469 A CN114022469 A CN 114022469A
Authority
CN
China
Prior art keywords
appearance defect
network
resnest
cigarette appearance
generate
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
CN202111347126.2A
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.)
Yunnan University YNU
Original Assignee
Yunnan University YNU
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 Yunnan University YNU filed Critical Yunnan University YNU
Priority to CN202111347126.2A priority Critical patent/CN114022469A/en
Publication of CN114022469A publication Critical patent/CN114022469A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • 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
    • G06T5/00Image enhancement or restoration
    • 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)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to a cigarette appearance defect image classification method and a cigarette appearance defect image classification system. The method comprises the following steps: preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set; pre-training a full connection layer of the existing ResNeSt network by adopting a characteristic-based transfer learning method, modifying an activation function of the pre-trained ResNeSt network, and generating a cigarette appearance defect classification network based on improved ResNeSt; training and testing a cigarette appearance defect classification network based on improved ResNeSt by adopting a preprocessed cigarette appearance defect image data set; and classifying the cigarette appearance defect pictures to be classified by adopting a trained cigarette appearance defect classification network. The method provided by the invention provides an improved ResNeSt model, introduces a migration learning and data enhancement mode, and provides a method for replacing an activation function at the ResNeSt core, so that the accuracy of feature extraction is improved, and the classification accuracy and the recall rate are greatly improved.

Description

Cigarette appearance defect image classification method and system
Technical Field
The invention relates to the technical field of information, in particular to a cigarette appearance defect image classification method and system.
Background
China is a tobacco kingdom, and cigarettes are the most important products of tobacco. In the cigarette production and processing process, the appearance defects of cigarettes caused by various factors are inevitable, and the classification of the appearance defects of the cigarettes is an important problem in the cigarette production process.
On traditional production water line, the apparent defect of cigarette detects and relies on artifically, but present high-speed cigarette production water line reaches 200 a/s' speed, and artifical the detection has been unable to be competent at, and automatic cigarette apparent defect detects and categorised can make a cigarette quality more guaranteed, reduction in production cost.
As deep Learning progresses, many classification problems are better solved, such as AlexNet (< Krizhevsky A, Sutskey I, Hinton G E. imaging classification with deep dependent neural networks [ J ]. Advances in neural information processing systems,2012,25: 1097-1105) ], VGG16(< K. Simmonyan and A. Zisseran, "Very dependent neural networks for large-scale image registration," in International reference on Learning, May 2015>), ResNet (& K, Zhang X, Ren S, et al. deep dependent prediction for prediction, C.778. sub.2016. compression C.770. sub.2016. distribution, etc. In other researches related to similarity of cigarette appearance defects, such as bamboo strips, textiles, steel strips and the like, a great deal of classification research is already available, such as that the bamboo strip appearance defects are classified ten times by using a modified CenterNet network in Gaoqiquan and the like, and the percentage of mAP (Mean Average Precision) reaches 76.9% (< Gaoqiquan, Huangcheng, Liuwenji, Tongyun.) bamboo strip surface defect detection method [ J/OL ] based on the modified CenterNet, computer application: 1-8[2021-05-12] >; liuyangyu proposes a detection method based on improved Faster R-CNN, nearly 20 defect classifications are made to cloth, and the mAP% of the experiment reaches 63.4% (< Liuyangyu. research on a cloth defect detection method based on deep learning [ D ]. Harbin university Master academic thesis, 2020 >); the Dingguanxiong adds a hole convolution layer on an AlexNet network to increase the receptive field, and the average value of the improved network on the accuracy and recall rate of cloth defect classification reaches 85 percent (Dingguanxiong. research on cloth defect classification algorithm [ D ]. Master academic thesis of Shanghai university, 2020 >); the Kouzahpeng et al propose a steel strip defect detection model FRDNet based on Faster-RCNN, which has an average accuracy mean mAP of 67.7% on a GC10-DET steel strip defect data set and is improved by 4.9% compared with the original model (Kouzahangpeng, Liujunshuai, Mianluo. the steel strip defect detection method based on Faster-RCNN [ J ]. China metallurgy, 2021,31(04):77-83 >); in the study on the surface defects of the steel plate, the creep strength and the like are researched by using the improved YOLOv3 network, the precision of the improved network on a test set is improved by 23.3% compared with the precision of the original YOLOv3 network (i.e. < creep strength, Zhu hong jin, Van hong hui, Zhou hong Yan, afterglow. the improved YOLOv3 network is researched in the detection of the surface defects of the steel plate [ J ] computer engineering and application 2020,56(16): 265-.
However, in the classification of cigarette appearance defects, there are currently few studies in this respect at home and abroad, such as Yanyu boiler using feature extraction and threshold segmentation methods to detect defects, but the accuracy is not too high (Yanyu boiler. design and implementation of image processing-based cigarette defect detection method [ D ]. Yunnan university Master thesis, 2018 ]).
Disclosure of Invention
The invention aims to provide a cigarette appearance defect image classification method and a cigarette appearance defect image classification system, so as to improve the accuracy and recall rate of cigarette appearance defect image classification.
In order to achieve the purpose, the invention provides the following scheme:
a cigarette appearance defect image classification method comprises the following steps:
acquiring a cigarette appearance defect picture shot by an industrial camera;
preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set;
pre-training a full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate a pre-trained ResNeSt network;
modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on improved ResNeSt;
training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate a trained cigarette appearance defect classification network;
and classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network.
Optionally, the cigarette appearance defect picture is preprocessed through multi-scale testing and data enhancement, and a preprocessed cigarette appearance defect image data set is generated, specifically including:
performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data; the data enhancement processing comprises rotation, Gaussian noise, picture brightness and a mixup data enhancement mode;
and carrying out scale transformation on the picture subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
Optionally, the pre-training is performed on the full connection layer of the existing ResNeSt network by using a feature-based transfer learning method, so as to generate the pre-trained ResNeSt network, which specifically includes:
replacing the last full connection layer of the existing ResNeSt network with a new full connection layer to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and after the weight is initialized randomly, training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer, and generating a pre-trained ResNeSt network.
Optionally, the modifying the activation function of the pretrained reseest network to generate a cigarette appearance defect classification network based on the improved reseest network specifically includes:
and modifying the ReLU activation function of the pretrained ResNeSt network into an h-swish activation function to generate a cigarette appearance defect classification network based on the improved ResNeSt.
A cigarette appearance defect image classification system comprises:
the original image acquisition module is used for acquiring a cigarette appearance defect picture shot by an industrial camera;
the image preprocessing module is used for preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set;
the network pre-training module is used for pre-training the full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate the pre-trained ResNeSt network;
the activation function modification module is used for modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on the improved ResNeSt;
the network training test module is used for training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate a trained cigarette appearance defect classification network;
and the defect image classification module is used for classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network.
Optionally, the image preprocessing module specifically includes:
the data enhancement unit is used for performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data; the data enhancement processing comprises rotation, Gaussian noise, picture brightness and a mixup data enhancement mode;
and the scale transformation unit is used for carrying out scale transformation on the image subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
Optionally, the network pre-training module specifically includes:
a full connection layer replacing unit, configured to replace a last full connection layer of the existing ResNeSt network with a new full connection layer, so as to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and the weight training unit is used for training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer after the weight is randomly initialized, and generating a pre-trained ResNeSt network.
Optionally, the activation function modification module specifically includes:
and the activation function modification unit is used for modifying the ReLU activation function of the pretrained ResNeSt network into an h-swish activation function and generating the cigarette appearance defect classification network based on the improved ResNeSt.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention provides a cigarette appearance defect image classification method and a cigarette appearance defect image classification system, wherein the method comprises the following steps: acquiring a cigarette appearance defect picture shot by an industrial camera; preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set; pre-training a full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate a pre-trained ResNeSt network; modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on improved ResNeSt; training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate a trained cigarette appearance defect classification network; and classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network. The method provided by the invention provides an improved ResNeSt model, introduces a migration learning and data enhancement mode, and provides a method for replacing an activation function at the ResNeSt core, so that the accuracy of feature extraction is improved, and the classification accuracy and the recall rate are greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a flowchart of a cigarette appearance defect image classification method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating a method for classifying cigarette appearance defect images according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a process for preprocessing a cigarette appearance defect picture according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating feature-based transfer learning according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a cigarette appearance defect classification network based on improved ResNeSt according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a cigarette appearance defect image classification system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be 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.
The invention aims to provide a cigarette appearance defect image classification method and a cigarette appearance defect image classification system, and relates to an improved deep learning model and a graphic image processing method, so as to improve the accuracy and recall rate of cigarette appearance defect image classification.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
FIG. 1 is a flow chart of a cigarette appearance defect image classification method according to an embodiment of the invention, and FIG. 2 is a schematic diagram of a principle of the cigarette appearance defect image classification method according to the embodiment of the invention. Referring to fig. 1 and 2, the cigarette appearance defect image classification method of the present invention includes:
step 101: and acquiring the cigarette appearance defect picture shot by the industrial camera.
Firstly, selecting a picture of cigarette appearance defects, the picture size of which is 1200 x 146, shot by an industrial camera, and then preprocessing the image through multi-scale testing and data enhancement to enable the image to be suitable for a network.
Step 102: and preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set.
And performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data. The data enhancement processing comprises data enhancement modes such as rotation, Gaussian noise, picture brightness, mixup and the like. And then carrying out scale transformation on the image subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
FIG. 3 is a schematic diagram of preprocessing a cigarette appearance defect picture according to an embodiment of the present invention. First, data enhancement is performed on a picture, as shown in fig. 3, data enhancement modes such as Rotation of 90 degrees (Rotation), gaussian Noise (Noise), picture brightness (Color Jittering), and mixup are performed on an original picture, and finally, a data set required by training is formed through Scale transformation (Random Scale), which is specifically as follows.
In the original data set image, 80% of pictures are randomly selected for copying, and then the center of 90 degrees is rotated clockwise, and the formula is as follows:
Figure BDA0003354580850000061
wherein, Xi,YiRepresenting the original coordinate point of the image, Xi1,Yi1And the coordinate points of the rotated picture are represented, so that partial data enhancement is realized.
The method comprises the steps of mixing data enhanced pictures with original pictures, randomly selecting 80% of the pictures for copying, and then performing mixup data enhancement on the pictures, wherein the mixup is a data enhancement method based on a field risk minimization principle and provided by a Facebook artificial intelligence team and MIT (Massachusetts Institute of Technology ), and new sample data are obtained by linear interpolation. The formula is as follows:
(Xn,Yn)=λ(Xi,Yi)+(1-λ)(Xj,Yj)
wherein, Xn,YnIs a coordinate point, X, of a new picture generated by interpolationi,YiAnd (X)j,Yj) Is the coordinate point of two images randomly selected originally, and the value range of lambda is between 0 and 1.
After the two steps of rotation and mixup, the original data set (comprising a plurality of cigarette appearance defect pictures) is subjected to data enhancement in a mode of brightness change, Gaussian noise point and the like in sequence, so that the data is effectively amplified, and subsequent network learning is facilitated; and finally, forming a preprocessed cigarette appearance defect image data set required by training through scale transformation.
Step 103: and pre-training the full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate the pre-trained ResNeSt network.
The ResNeSt network is a network (Zhang H, Wu C, Zhang Z, et al, Resnest: Split-attention networks [ J ]. arXiv preprint arXiv:2004.08955,2020>) which is proposed by March et al and called as the "ResNet strongest improvement edition", and mainly introduces a modularized attention-dispersing module so as to lead attention to cross a feature-map (feature-map) group. Compared with other classification networks, the network achieves the highest top-1 precision in image classification, and the main advantage is that the network has better accuracy and delay balance.
The method classifies the cigarette appearance defect pictures based on the ResNeSt network. Firstly, training a ResNeSt network on an ImageNet data set, then applying the ResNeSt network on a cigarette appearance defect image data set, and training an optimization model by adjusting parameters and attention mechanism.
Because the effective data enhancement sample still cannot meet the network training, a feature-based transfer learning method is adopted for the network. Fig. 4 is a schematic diagram of feature-based transfer learning according to an embodiment of the present invention. In fig. 4 Softmax () represents a Softmax function, also called normalized exponential function, train represents training.
As shown in fig. 4, the last fully-connected layer of the resenestt network is first replaced with a new fully-connected layer whose classification number is consistent with the number of classes of the cigarette-based visual defect data set, and then the weights are randomly initialized and the network is trained with ImageNet samples to update the weights of the fully-connected layer. Therefore, the cigarette appearance defect data set can be converged more quickly and better classification effect can be obtained when the cigarette appearance defect data set is trained.
Therefore, the step 103 specifically includes:
replacing the last full connection layer of the existing ResNeSt network with a new full connection layer to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and after the weight is initialized randomly, training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer, and generating a pre-trained ResNeSt network.
Step 104: and modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on the improved ResNeSt.
Based on the ResNeSt network, the accuracy and recall rate of classification are improved by improving the activation function, the ReLU activation function of the pre-trained ResNeSt network is modified into an h-swish activation function, and the cigarette appearance defect classification network based on the improved ResNeSt is generated.
Specifically, in the training process, due to poor effect, the invention adjusts the ReLU activation function of the original ResNeSt network and adopts the h-swish activation function.
FIG. 5 is a schematic diagram of a cigarette appearance defect classification network based on improved ResNeSt according to an embodiment of the present invention. In FIG. 5, Input represents Input, Output represents Output, Cardinal represents the r-th base array, Conv represents convolution, and h-swish represents the activation function.
As shown in fig. 5, in the core module of the resenestt network, the h-swish function is used to replace the original ReLU activation function of the network, because the h-swish activation function can improve the detection accuracy more effectively than the ReLU activation function, the calculated amount in the h-swish activation function is relatively small, and the accuracy loss of the model during the quantitative calculation can be effectively avoided. The formula for the h-swish activation function is as follows:
Figure BDA0003354580850000081
where h (x) refers to h-swish activation function, x refers to the input image, ReLU6 refers to the activation function that suppresses its maximum value, and the formula is:
ReLU6=min(6,max(x,0))
where x refers to the input image.
The invention constructs a cigarette appearance defect classification network based on the improved ResNeSt, improves the ResNeSt and has the following advantages:
(1) firstly, pre-training a full connection layer of a ResNeSt network to distribute corresponding weight, which is beneficial to better feature extraction;
(2) secondly, aiming at the cigarette appearance defect image data set, the activation function of the network is modified, the ReLU activation function is changed into h-swish, the precision activation of the model during quantitative calculation is effectively avoided, and the network classification accuracy can be improved.
Step 105: and training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate the trained cigarette appearance defect classification network.
The invention uses the cigarette appearance image shot by an industrial camera in the factory production process as a data set, and the method comprises the following steps of: a scale of 2 divides the training set and the test set for the original image. Inputting the processed cigarette appearance defect image data set into a network and training, and adjusting related parameters during the training so as to achieve the best training effect. And inputting the test set data into a trained model so as to measure the quality of the algorithm.
Step 106: and classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network.
And finally, using the trained network for classification to obtain the classification accuracy and recall rate of the cigarette appearance defect image data set.
The invention discloses a cigarette appearance defect image classification method, which provides a data enhancement processing and transfer learning method to improve the classification accuracy aiming at the insufficient number of cigarette appearance defects, adopts multi-scale test on an input layer, replaces a ReLU activation function with an h-swish activation function on a core module of a model, and improves the expression performance of a network. The invention fully processes the size of the input image, extracts more image information, improves the detection precision, improves the network classification performance, and obviously improves the objective index accuracy (accuracy) and recall rate (recall).
To verify the effectiveness of the method of the present invention, the batch size was set to 16, the learning rate was set to 0.0003, the mainstream networks (VCC16, AlexNet, ResNet, GoogleNet, existing resnext) and the improved resnext network of the present invention (resnext + +) were trained using the same data set, and the final experimental results are shown in table 1 below.
TABLE 1 comparison of the experimental results of the process of the invention with those of the known processes
Figure BDA0003354580850000101
As shown in Table 1, by comparing the experimental results of the classification by the method of the present invention with the experimental results of other mainstream network classifications, it can be seen that the classification accuracy and recall rate of the method of the present invention are significantly higher than those of other networks, and the method of the present invention has significant advantages over other networks in the classification of cigarette appearance defect image data.
The invention relates to a cigarette appearance defect image classification method for improving ResNeSt, which comprises the following steps: firstly, based on the small number of samples, data enhancement processing is adopted, and then a transfer learning method is utilized to train a full connection layer of a network; secondly, aiming at a specific cigarette appearance defect image data set, replacing a ReLU function in a network by an h-swish activation function, so that the classification accuracy and the recall rate are further improved; finally, the parameters are adjusted and optimized through the training result, and the parameters are updated.
Experiments prove that the method of the invention is improved by 2.84% compared with the best Accuracy (Accuracy) in AlexNet, VGG16, ResNet and ResNeSt without pre-training and parameter adjustment.
The method is based on the ResNeSt network, takes the better classification accuracy and recall rate of the experiment as the starting point, provides an improved ResNeSt model, introduces a migration learning and data enhancement module, and provides a method for replacing an activation function in a ResNeSt core module, so that the accuracy of extracting features is improved, and the classification accuracy and the recall rate are greatly improved.
Based on the method provided by the invention, the invention also provides a cigarette appearance defect image classification system. Fig. 6 is a structural diagram of a cigarette appearance defect image classification system according to an embodiment of the present invention, and as shown in fig. 6, the system includes:
an original image acquisition module 601, configured to acquire a cigarette appearance defect picture taken by an industrial camera;
the image preprocessing module 602 is configured to preprocess the cigarette appearance defect picture through multi-scale testing and data enhancement, and generate a preprocessed cigarette appearance defect image data set;
a network pre-training module 603, configured to pre-train a full connection layer of an existing ResNeSt network by using a feature-based transfer learning method, and generate a pre-trained ResNeSt network;
an activation function modification module 604, configured to modify the activation function of the pretrained reseest network, so as to generate a cigarette appearance defect classification network based on the improved reseest;
a network training and testing module 605, configured to train and test the cigarette appearance defect classification network based on the improved resenestt by using the preprocessed cigarette appearance defect image data set, so as to generate a trained cigarette appearance defect classification network;
and the defect image classification module 606 is used for classifying the cigarette appearance defect images to be classified by adopting the trained cigarette appearance defect classification network.
The image preprocessing module 602 specifically includes:
the data enhancement unit is used for performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data; the data enhancement processing comprises rotation, Gaussian noise, picture brightness and a mixup data enhancement mode;
and the scale transformation unit is used for carrying out scale transformation on the image subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
The network pre-training module 603 specifically includes:
a full connection layer replacing unit, configured to replace a last full connection layer of the existing ResNeSt network with a new full connection layer, so as to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and the weight training unit is used for training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer after the weight is randomly initialized, and generating a pre-trained ResNeSt network.
The activation function modification module 604 specifically includes:
and the activation function modification unit is used for modifying the ReLU activation function of the pretrained ResNeSt network into an h-swish activation function and generating the cigarette appearance defect classification network based on the improved ResNeSt.
The invention relates to a cigarette appearance defect image classification system, which firstly provides a specific data enhancement module aiming at a small sample aiming at developing an appearance defect data set, secondly performs feature-based transfer learning on a network, is convenient for better extracting the features of a target data set, and finally improves an activation function in the network, so that the cigarette appearance defect image classification system has better accuracy and recall rate aiming at cigarette data set classification. The method is superior to the existing algorithm from the view point of the final experimental result.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

Claims (8)

1. A cigarette appearance defect image classification method is characterized by comprising the following steps:
acquiring a cigarette appearance defect picture shot by an industrial camera;
preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set;
pre-training a full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate a pre-trained ResNeSt network;
modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on improved ResNeSt;
training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate a trained cigarette appearance defect classification network;
and classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network.
2. The method according to claim 1, wherein the preprocessing of the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image dataset specifically comprises:
performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data; the data enhancement processing comprises rotation, Gaussian noise, picture brightness and a mixup data enhancement mode;
and carrying out scale transformation on the picture subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
3. The method according to claim 2, wherein the pre-training of the full connectivity layer of the existing ResNeSt network by using the feature-based migration learning method to generate the pre-trained ResNeSt network specifically comprises:
replacing the last full connection layer of the existing ResNeSt network with a new full connection layer to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and after the weight is initialized randomly, training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer, and generating a pre-trained ResNeSt network.
4. The method according to claim 3, wherein the modifying the activation function of the pretrained ResNeSt network to generate the cigarette appearance defect classification network based on the improved ResNeSt network specifically comprises:
and modifying the ReLU activation function of the pretrained ResNeSt network into an h-swish activation function to generate a cigarette appearance defect classification network based on the improved ResNeSt.
5. A cigarette appearance defect image classification system is characterized by comprising:
the original image acquisition module is used for acquiring a cigarette appearance defect picture shot by an industrial camera;
the image preprocessing module is used for preprocessing the cigarette appearance defect picture through multi-scale testing and data enhancement to generate a preprocessed cigarette appearance defect image data set;
the network pre-training module is used for pre-training the full connection layer of the existing ResNeSt network by adopting a feature-based transfer learning method to generate the pre-trained ResNeSt network;
the activation function modification module is used for modifying the activation function of the pretrained ResNeSt network to generate a cigarette appearance defect classification network based on the improved ResNeSt;
the network training test module is used for training and testing the cigarette appearance defect classification network based on the improved ResNeSt by adopting the preprocessed cigarette appearance defect image data set to generate a trained cigarette appearance defect classification network;
and the defect image classification module is used for classifying the cigarette appearance defect pictures to be classified by adopting the trained cigarette appearance defect classification network.
6. The system according to claim 5, wherein the image preprocessing module specifically comprises:
the data enhancement unit is used for performing data enhancement processing on the cigarette appearance defect picture to generate a picture with enhanced data; the data enhancement processing comprises rotation, Gaussian noise, picture brightness and a mixup data enhancement mode;
and the scale transformation unit is used for carrying out scale transformation on the image subjected to data enhancement to generate a preprocessed cigarette appearance defect image data set.
7. The system of claim 6, wherein the network pre-training module specifically comprises:
a full connection layer replacing unit, configured to replace a last full connection layer of the existing ResNeSt network with a new full connection layer, so as to generate a replaced ResNeSt network; the classification number of the new full-connection layer is consistent with that of the cigarette appearance defect image data set;
and the weight training unit is used for training the replaced ResNeSt network by adopting an ImageNet sample to update the weight of the new full connection layer after the weight is randomly initialized, and generating a pre-trained ResNeSt network.
8. The system according to claim 7, wherein the activation function modification module specifically comprises:
and the activation function modification unit is used for modifying the ReLU activation function of the pretrained ResNeSt network into an h-swish activation function and generating the cigarette appearance defect classification network based on the improved ResNeSt.
CN202111347126.2A 2021-11-15 2021-11-15 Cigarette appearance defect image classification method and system Pending CN114022469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111347126.2A CN114022469A (en) 2021-11-15 2021-11-15 Cigarette appearance defect image classification method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111347126.2A CN114022469A (en) 2021-11-15 2021-11-15 Cigarette appearance defect image classification method and system

Publications (1)

Publication Number Publication Date
CN114022469A true CN114022469A (en) 2022-02-08

Family

ID=80064152

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111347126.2A Pending CN114022469A (en) 2021-11-15 2021-11-15 Cigarette appearance defect image classification method and system

Country Status (1)

Country Link
CN (1) CN114022469A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114708584A (en) * 2022-03-31 2022-07-05 重庆中烟工业有限责任公司 Big data based cigarette product quality defect prevention and control learning system and method
CN117934819A (en) * 2024-03-20 2024-04-26 中铁第六勘察设计院集团有限公司 Robustness improving method of track defect detection system
CN118096771A (en) * 2024-04-29 2024-05-28 红云红河烟草(集团)有限责任公司 Deep learning-based cigarette appearance defect feature analysis and distribution processing method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114708584A (en) * 2022-03-31 2022-07-05 重庆中烟工业有限责任公司 Big data based cigarette product quality defect prevention and control learning system and method
CN117934819A (en) * 2024-03-20 2024-04-26 中铁第六勘察设计院集团有限公司 Robustness improving method of track defect detection system
CN118096771A (en) * 2024-04-29 2024-05-28 红云红河烟草(集团)有限责任公司 Deep learning-based cigarette appearance defect feature analysis and distribution processing method

Similar Documents

Publication Publication Date Title
CN106940816B (en) CT image pulmonary nodule detection system based on 3D full convolution neural network
CN107316307B (en) Automatic segmentation method of traditional Chinese medicine tongue image based on deep convolutional neural network
CN109241982A (en) Object detection method based on depth layer convolutional neural networks
CN108256482B (en) Face age estimation method for distributed learning based on convolutional neural network
CN110097543A (en) Surfaces of Hot Rolled Strip defect inspection method based on production confrontation network
CN110599409A (en) Convolutional neural network image denoising method based on multi-scale convolutional groups and parallel
CN110188824A (en) A kind of small sample plant disease recognition methods and system
CN111861906B (en) Pavement crack image virtual augmentation model establishment and image virtual augmentation method
CN111079784B (en) Flue-cured tobacco baking stage identification method in baking process based on convolutional neural network
CN111242063A (en) Small sample classification model construction method based on transfer learning and iris classification application
CN112052772A (en) Face shielding detection algorithm
CN109740679A (en) A kind of target identification method based on convolutional neural networks and naive Bayesian
CN109685030A (en) A kind of mug rim of a cup defects detection classification method based on convolutional neural networks
CN112464844A (en) Human behavior and action recognition method based on deep learning and moving target detection
CN112749675A (en) Potato disease identification method based on convolutional neural network
CN114648806A (en) Multi-mechanism self-adaptive fundus image segmentation method
CN110490915A (en) A kind of point cloud registration method being limited Boltzmann machine based on convolution
CN112580661A (en) Multi-scale edge detection method under deep supervision
CN112883931A (en) Real-time true and false motion judgment method based on long and short term memory network
CN114022469A (en) Cigarette appearance defect image classification method and system
CN112597979B (en) Face recognition method for updating cosine included angle loss function parameters in real time
CN114372926A (en) Traditional Chinese medicine tongue tenderness identification method based on image restoration and convolutional neural network
CN113989256A (en) Detection model optimization method, detection method and detection device for remote sensing image building
CN113538342A (en) Convolutional neural network-based quality detection method for coating of aluminum aerosol can
CN112883930A (en) Real-time true and false motion judgment method based on full-connection network

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