CN116503370A - Tobacco shred width determining method and device, electronic equipment and storage medium - Google Patents

Tobacco shred width determining method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116503370A
CN116503370A CN202310513555.5A CN202310513555A CN116503370A CN 116503370 A CN116503370 A CN 116503370A CN 202310513555 A CN202310513555 A CN 202310513555A CN 116503370 A CN116503370 A CN 116503370A
Authority
CN
China
Prior art keywords
sample set
determining
target
processed
image
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
CN202310513555.5A
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.)
China Tobacco Jiangsu Industrial Co Ltd
Original Assignee
China Tobacco Jiangsu Industrial Co Ltd
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 China Tobacco Jiangsu Industrial Co Ltd filed Critical China Tobacco Jiangsu Industrial Co Ltd
Priority to CN202310513555.5A priority Critical patent/CN116503370A/en
Publication of CN116503370A publication Critical patent/CN116503370A/en
Pending legal-status Critical Current

Links

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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • 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/20024Filtering details
    • G06T2207/20032Median filtering
    • 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]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

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

Abstract

The invention discloses a method and a device for determining tobacco shred width, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring an original image, and performing filtering treatment on the original image to determine an image to be processed; graying the image to be processed to obtain a target image, and determining tobacco shred width information corresponding to the original image based on the target image and a target detection model; the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. The method and the device realize that the target image is obtained based on the obtained original image and after the original image is processed, and further determine tobacco width information corresponding to the original image based on the target image and the target detection model, so that the tobacco width determination efficiency is improved.

Description

Tobacco shred width determining method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for determining tobacco shred width, an electronic device, and a storage medium.
Background
In the processing process of tobacco leaves, the width of tobacco leaf cut tobacco finished products has very important influence on the taste of cigarette finished products, and the tobacco shred width range of the tobacco shred cutting procedure in the tobacco industry at present is 0.7mm-1.3mm.
However, the existing tobacco shred width detection scheme is to detect tobacco shreds after amplifying the tobacco shreds by using a tobacco optical projector, select a tobacco shred sample with a relatively large specification, and calibrate the tobacco shred by using a projection method.
Disclosure of Invention
The invention provides a method, a device, electronic equipment and a storage medium for determining tobacco shred width, which realize that a target image is obtained based on an obtained original image and after the original image is processed, further determine tobacco shred width information corresponding to the original image based on the target image and a target detection model, and improve the determining efficiency of the tobacco shred width.
According to an aspect of the present invention, there is provided a method of determining a tobacco shred width, the method comprising:
acquiring an original image, and performing filtering treatment on the original image to determine an image to be processed;
graying the image to be processed to obtain a target image, and determining tobacco shred width information corresponding to the original image based on the target image and a target detection model;
The target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer.
According to another aspect of the present invention, there is provided a tobacco shred width determining apparatus, the apparatus comprising:
the image processing module is used for acquiring an original image, and performing filtering processing on the original image to determine an image to be processed;
the tobacco width determining module is used for carrying out graying treatment on the image to be processed to obtain a target image, and determining tobacco width information corresponding to the original image based on the target image and a target detection model;
the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of determining tobacco shred width according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a method for determining tobacco shred width according to any embodiment of the present invention.
According to the technical scheme, an original image is obtained, filtering processing is conducted on the original image to determine an image to be processed, graying processing is conducted on the image to be processed to obtain a target image, tobacco width information corresponding to the original image is determined based on the target image and a target detection model, and the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. Based on the technical scheme, the method and the device achieve that the original image is obtained based on the acquisition, the target image is obtained after the original image is processed, and further tobacco width information corresponding to the original image is determined based on the target image and the target detection model, so that the tobacco width determination efficiency is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for determining tobacco shred width according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for determining tobacco shred width according to an embodiment of the present invention;
FIG. 3 is a block diagram of a tobacco shred width determining apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flow chart of a method for determining a tobacco width according to an embodiment of the present invention, where the method may be implemented by a device for determining a tobacco width, where the device for determining a tobacco width may be implemented in hardware and/or software, and the device for determining a tobacco width may be configured in an electronic device, where the electronic device may be a PC side or a server side, etc., by acquiring an original image and processing the original image to determine a target image, and further determining tobacco width information based on the target image and a target detection model.
As shown in fig. 1, the method includes:
s110, acquiring an original image, and performing filtering processing on the original image to determine an image to be processed.
The original image can be based on image information of cut tobacco acquired by a preset image acquisition device. The filtering process can be understood as filtering out a specific signal in the original image. The image to be processed may be an image obtained by filtering the original image.
Specifically, an original image is obtained, filtering processing is performed on the original image to determine an image to be processed, for example, the original image can be obtained according to a preset tobacco shred sampling and detecting platform, the tobacco shred sampling and detecting platform mainly comprises an industrial monocular camera, a linear LED light source, a computer and a sample clamping device, and the linear LED light source mainly provides stable and strong illumination to ensure that background noise cannot occur. The cut tobacco to be detected is placed on the sample clamping transparent glass sheet, and a light source is placed at the bottom of the calibration plate and is adjustable. In the detection process, a single shooting method is adopted, shooting pictures are circularly read, and then an original image is obtained.
S120, carrying out graying treatment on the image to be treated to obtain a target image, and determining tobacco width information corresponding to the original image based on the target image and a target detection model.
The target detection model is a convolutional neural network obtained by training a preset detection model, and the convolutional neural network can be a ResNet50 neural network; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. The target image may be an image obtained by graying an image to be processed. The tobacco width information may be width data corresponding to the original image.
Specifically, after the image to be processed is obtained, the image to be processed can be subjected to graying treatment to obtain a target image, and then tobacco width information corresponding to the original image is determined based on the target image and the target detection model. It should be noted that the target detection model is a neural network model obtained by training in advance, and the convolutional neural network comprises a convolutional layer and a fully-connected layer, and a residual layer is arranged between the convolutional layer and the fully-connected layer, so as to solve the problem of overfitting of the model.
On the basis of the above technical solution, before the obtaining the original image and performing filtering processing on the original image to determine the image to be processed, the method includes: acquiring an original sample set, and determining a target sample set based on the original sample set; training a preset detection model based on the target sample set, and determining the target detection model.
The original sample set may be an original sample for training the model, for example, may be an already-labeled tobacco width image. The target sample set may be understood as a sample set obtained by processing an original sample. The preset detection model may be a preset untrained detection model.
Specifically, before the original image is obtained and the image to be processed is determined by filtering the original image, a target detection model is required to be determined, then an original sample set is required to be obtained, a target sample set is determined based on the original sample set, and further a preset detection model is trained based on the target sample set, so that the target detection model is determined. It should be noted that, the original sample set may be obtained by obtaining a historical tobacco width image, for example, a historical image with width information manually marked may be obtained and used as the original sample set, that is, the original sample includes an image and a corresponding tobacco width label, where the value range of the label is 0.7mm-1.3mm, and the precision is 0.1mm.
On the basis of the above technical solution, the determining a target sample set based on the original sample set includes: processing the original sample set based on a median filtering algorithm, and determining a first sample set to be processed; graying treatment is carried out on the first sample set to be treated, and a second sample set to be treated is determined; and determining a target sample set based on the second sample set to be processed.
The median filtering algorithm may be an algorithm for filtering the original sample set. The first set of samples to be processed may be understood as a set of samples resulting from filtering the original set of samples. Correspondingly, the second sample set to be processed can be understood as a sample set obtained by graying the first sample set to be processed,
specifically, the original sample set is processed based on a median filtering algorithm, a first sample set to be processed is determined, then the first sample set to be processed is subjected to graying processing, a second sample set to be processed is determined, finally a target sample set can be determined based on the second sample set to be processed, for example, a 3x3 median filter is adopted to filter the original sample set, it is required to say that the median filter has very ideal noise reduction capability for some types of random noise, and for linear smoothing filtering, when noise points are included in a processed pixel neighborhood, the existence of noise always affects the calculation of pixel values of the points more or less, but the noise points are often directly ignored in the median filtering; and the median filtering causes a lower blurring effect while reducing noise than the linear smoothing filter. After the filtering processing is performed, the first sample set to be processed is subjected to graying processing, so that a second sample set to be processed is obtained, wherein the brightness of a point is represented by a component of Y in a color space according to YUV, the brightness level is reflected by the value, and the correspondence between the brightness Y and the three color components of R, G, B can be established according to the change relation between RGB and YUV color spaces, namely, y=0.3 r+0.59g+0.11b.
On the basis of the above technical solution, the determining the target sample set based on the second sample set to be processed includes: determining sample type information of the second sample set to be processed, processing the second sample set to be processed based on the sample type information, and determining the sample set to be applied; and determining the target sample set based on the sample set to be applied.
The sample type information may be the type of the second sample set to be processed, for example, when the sample data and the single sample data. The sample set to be applied may be understood as a sample set obtained after data enhancement of the second sample set to be processed.
Specifically, after the second sample set to be processed is determined, data enhancement processing is required to be performed on sample data, then sample type information of the second sample set to be processed is determined, the second sample set to be processed is processed based on the sample type information, a sample set to be applied is determined, then the target sample set is determined based on the sample set to be applied, for example, the type information of the second sample set to be processed can be determined according to a preset sample number threshold, if the sample number meets the preset sample number threshold, the sample data is single sample data, and if the sample number does not meet the preset sample number threshold, enhancement processing is required to be performed on the sample data, and then the sample number is expanded. It should be noted that, single sample data enhancement is implemented on a single sample, and multiple sample data enhancement is implemented by sampling multiple samples in a data set, and obtaining a new sample through a synthesis method.
On the basis of the above technical solution, the processing the second sample set to be processed based on the sample type information, and determining the sample set to be applied includes: and if the second sample set to be processed is a single sample data set, processing the second sample set to be processed based on a preset transformation method, and determining the sample set to be applied.
The preset transformation method may be a preset sample data enhancement method, for example, geometric transformation includes operations of turning, rotating, clipping, deforming, scaling, and the like.
Specifically, if the second sample set to be processed is a single sample data set, the second sample set to be processed is processed based on a preset transformation method, and the sample set to be applied is determined. It should be noted that, if the number of samples in the second sample set to be processed meets the preset number threshold, the second sample set to be processed is processed according to the preset transformation method, and the sample set to be applied is determined.
On the basis of the above technical solution, the processing the second sample set to be processed based on the sample type information, and determining the sample set to be applied includes: if the second sample set to be processed is a multi-sample data set, determining sampling rate information corresponding to the second sample set to be processed; and determining the sample set to be applied based on the sampling rate information and the second sample set to be processed.
The sampling rate information may be a sampling rate set in advance.
Specifically, if the second sample set to be processed is a multiple sample data set, determining sampling rate information corresponding to the second sample set to be processed, and further determining the sample set to be applied based on the sampling rate information and the second sample set to be processed. It should be noted that the SMOTE method may be used to synthesize small samples into new samples, i.e. by defining a feature space,each sample is corresponding to a certain point in the feature space, a sampling multiplying power N is determined according to the unbalanced proportion of the samples, K nearest neighbor samples are found according to Euclidean distance for each small sample class sample (x, y), one sample point is randomly selected from the K nearest neighbor samples, and the selected nearest neighbor point is assumed to be (x) n ,y n ). Randomly selecting a point on a line segment between a sample point and a nearest neighbor sample point in the feature space as a new sample point, satisfying the following formula (x) new ,y new )=(x,y)+range(0-1)*((x n -x),(y n -y)); the above process is repeated until the number of samples is balanced.
On the basis of the above technical solution, the determining the target sample set based on the sample set to be applied includes: processing the sample set to be applied based on K-fold cross validation, and determining each target training sample set and each target validation sample set; training the preset detection model based on the target sample set, and determining the target detection model, including: training the preset detection model based on each target training sample set and each target verification sample set, and determining the target detection model.
Wherein the K-fold cross-validation may be a validation algorithm for determining the target validation model. The target training sample set may be understood as a training sample set determined based on a preset k value, and the target verification sample set may be understood as a verification sample set determined based on a preset k value.
Specifically, the sample set to be applied is processed based on K-fold cross validation, each target training sample set and each target validation sample set are determined, and then the preset detection model is trained based on each target training sample set and each target validation sample set, so as to determine the target detection model, for example, a data set containing N samples may be divided into K parts, each part containingSamples. One of the sets is selected as a verification set, and the other k-1 sets are selected as training sets, wherein the verification set has k conditions, and each timeIn the case of training the model with a training set, testing the model with a verification set, calculating the generalization error of the model, repeating the cross verification K times, and averaging the K times results as the final generalization error of the model, wherein the value of K is [2,10 ]]The advantage of the K-fold cross-validation is that the training and validation is repeated using randomly generated subsamples simultaneously.
According to the technical scheme, an original image is obtained, filtering processing is conducted on the original image to determine an image to be processed, graying processing is conducted on the image to be processed to obtain a target image, tobacco width information corresponding to the original image is determined based on the target image and a target detection model, and the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. Based on the technical scheme, the method and the device achieve that the original image is obtained based on the acquisition, the target image is obtained after the original image is processed, and further tobacco width information corresponding to the original image is determined based on the target image and the target detection model, so that the tobacco width determination efficiency is improved.
Example two
Fig. 2 is a flowchart of a method for determining a tobacco shred width according to an embodiment of the present invention, where the method for determining a target detection model is further optimized in the method for determining a tobacco shred width according to the embodiment of the present invention. The specific implementation manner can be seen in the technical scheme of the embodiment. Wherein, the technical terms identical to or corresponding to the above embodiments are not repeated herein.
As shown in fig. 2, the method includes:
acquiring an original sample set: specifically, the original data volume is obtained through a preset tobacco shred sampling platform, the tobacco shred sampling platform mainly comprises an industrial monocular camera, a linear LED light source, a computer and a sample clamping device, and the linear LED light source mainly provides stable and strong illumination to ensure that background noise cannot occur. The cut tobacco to be detected is placed on the sample clamping transparent glass sheet, and a light source is placed at the bottom of the calibration plate and is adjustable. In the detection process, a single shooting method is adopted, shooting pictures are circularly read and converted into an original data set, and after a label is added manually, an original sample set is formed.
Preprocessing an original sample set: specifically, the data preprocessing operation mainly includes median filtering and graying. The median filter is a statistical ordering filter, and for a certain point (i, j) in the original image, the median filter uses the statistical ordering median value of all pixels in the neighborhood centered on the point as the response of the (i, j), and a 3x3 median filter is adopted. Median filtering has a very ideal noise reduction capability for certain types of random noise, and for linear smoothing filtering, when noise points are contained in the processed pixel neighborhood, the existence of noise always affects the calculation of the pixel value of the point more or less, but the noise points are often directly ignored in median filtering; and the median filtering causes a lower blurring effect while reducing noise than the linear smoothing filter. Graying the sample after the median filtering, wherein the color of each pixel in the color image is determined by R, G, B components, while each component has a median value of 255, such a pixel may have a color variation range of 1600 tens of thousands (255 x 255). The gray image is a special color image with the same components of R, G, B, and the variation range of one pixel point is 255. The description of the gray scale image, like the color image, still reflects the distribution and characteristics of the chromaticity and luminance levels throughout and locally of the image. The gray level method adopted in the method is that the brightness of a point is represented by a component of Y in a color space of YUV, the brightness level is reflected by the value, and the correspondence of three color components of brightness Y and R, G, B can be established according to the change relation of RGB and YUV color spaces: y=0.3 r+0.59g+0.11b.
Sample data enhancement: specifically, the data enhancement operation mainly includes single sample data enhancement and multiple sample data enhancement. Single sample data enhancement is achieved on a single sample, multiple sample data enhancement is sampling multiple samples in a data set, and a new sample is obtained by a synthesis method, the specific synthesis method being described below.And data enhancement, namely adopting a preset data transformation rule to amplify the data on the basis of the existing data. Single sample data enhancement mainly includes geometry manipulation and color transformation. The geometric transformation comprises operations of turning, rotating, clipping, deforming, scaling and the like, the data enhancement method for multi-sample data is SMOTE, the SMOTE method is an interpolation-based method, new samples can be synthesized for small sample classes, the main flow is that each sample is corresponding to a certain point in the feature space by defining the feature space, a sampling multiplying power N is determined according to the unbalanced proportion of the samples, K nearest neighbor samples are found according to Euclidean distance for each small sample class sample (x, y), one sample point is randomly selected from the K nearest neighbor samples, and the selected nearest neighbor point is assumed to be (x n ,y n ). Randomly selecting a point on a line segment between a sample point and a nearest neighbor sample point in the feature space as a new sample point, satisfying the following formula (x) new ,y new )=(x,y)+range(0-1)*((x n -x),(y n -y)); the above process is repeated until the number of samples is balanced.
Determining a target detection model: specifically, in the process of detecting whether all tobacco shred samples are qualified samples by using a network, because the feature distribution of the qualified sample data and the negative sample data is extremely unbalanced, the model can generate a plurality of negative feedback influence effects in the convergence process. To solve the problem, a mechanism of K-fold cross validation is added in the process of data loading, and since training is based on generalization errors to determine whether training is terminated and the performance of the final model, the final model can be directly determined after the K-fold cross validation, namely, a data set containing N samples is divided into K parts, each part containsSamples. Selecting one of the K-1 cases as a verification set and the K-1 cases as a training set, further in each case, training a model with the training set, testing the model with the verification set, calculating the generalization error of the model, repeating the cross verification K times, and taking the average K times result as the final generalization error of the model, wherein the K cases are the same as the final generalization error of the model, and the method comprises the steps ofThe value of K is described as [2,10 ]]The advantage of the K-fold cross-validation is that the training and validation is repeated using randomly generated subsamples simultaneously.
It should be noted that, in the embodiment of the present invention, the target detection model is a ResNet50 neural network. ResNet50 has two basic blocks, namely Conv Block and Identity Block, wherein the input and output dimensions of Conv Block are different and cannot be serially connected, and the effect is to change the dimension of the network; the Identity Block has the same input dimension and output dimension, and can be connected in series for deepening the network. Whereas a so-called residual network is an input part that introduces a layer data output of a preceding number of layers directly skipping multiple layers into a following data layer. Meaning that the content of the following feature layer will be partly contributed linearly by some layer in front of it. The mathematical expression is as follows: x is x l+1 =x l +F(x i ,W l ) The method comprises the steps of carrying out a first treatment on the surface of the Wherein x is l+1 Representing the input at time l+1, x l Representing the input at time I, F (x i ,W l ) Representing the result of the input at time l after linear computation and nonlinear activation function. In addition, in the training process of the model, in order to achieve the global optimal solution, the model can only be limited when the loss function is a convex function, however, in the actual model verification, the fact that the optimized non-convex function can not achieve the global optimal solution is found, and the finally obtained result is influenced by the initial value of the parameter to a great extent; secondly, the calculation time is too long, and the calculation of the loss function of all training data is very time-consuming. To solve this problem, a random gradient descent method is used, and the loss function on all training data is not optimized, and the loss function on one or more training data is selected randomly in each iteration to perform gradient descent optimization. Furthermore, if global learning rates are used, for some parameters, algorithms have been optimized around minima, but some parameters still have a large gradient. If the learning rate is too small, the parameters with large gradients will have a slow convergence rate; if the learning rate is too high, unstable conditions may occur for parameters that have been optimized to a much greater extent. Thus, different parameters are set for each parameter participating in training Learning rate, which is automatically adapted to the learning rate of these parameters by some algorithms throughout the learning process. The adaptive learning rate used in the embodiments of the present invention is AdaGrad. The learning rate of all model parameters can be independently adapted, and when the parameter loss bias guide value is larger, the learning rate is larger; when the loss bias value of the parameter is smaller, a smaller learning rate exists. I.e. by presetting the global learning rate sigma, the initialized parameter omega, a small constant delta created for numerical stabilization, and a gradient accumulation variable r, by taking out small batches of data { x } 1 ,x 2 ,…,x m Target y corresponding to the data i Representing the gradient calculated on the basis of the small batch data according to the following formula: further accumulating the square gradient and refreshing r, r<-r+g ☉ g; finally, the parameter update quantity, namely +.>Updating parameters according to the parameter updating amount, w<It should be noted that the update of the parameters does not stop until the above generalization error is no longer decreasing.
In order to solve the problem of over fitting of the model, a Dropout layer is added between a convolution layer and a full connection layer of the detection model, and mainly to solve the problem of over fitting in the later period of model training, a network added with Dropout needs to learn each node of the network, and a network layer added with Dropout only needs to train the nodes which are not dropped by a Mask in the layer. Minimizing the loss of a network containing Dropout is equivalent to minimizing a normal network with regularization terms, expressed as follows: The loss rate was chosen to be 0.5 in the model, where Dropout would have the strongest regularization effect.
According to the technical scheme, an original image is obtained, filtering processing is conducted on the original image to determine an image to be processed, graying processing is conducted on the image to be processed to obtain a target image, tobacco width information corresponding to the original image is determined based on the target image and a target detection model, and the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. Based on the technical scheme, the method and the device achieve that the original image is obtained based on the acquisition, the target image is obtained after the original image is processed, and further tobacco width information corresponding to the original image is determined based on the target image and the target detection model, so that the tobacco width determination efficiency is improved.
Example III
Fig. 3 is a block diagram of a device for determining tobacco width according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes: an image processing module 310 and a tobacco width determination module 320.
The image processing module 310 is configured to acquire an original image, and perform filtering processing on the original image to determine an image to be processed;
the tobacco width determining module 320 is configured to perform graying processing on the image to be processed to obtain a target image, and determine tobacco width information corresponding to the original image based on the target image and a target detection model;
the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer.
On the basis of the technical scheme, the device further comprises: the target model determining module is used for acquiring an original sample set before the original image is acquired and is subjected to filtering processing to determine an image to be processed, and determining a target sample set based on the original sample set; training the preset detection model based on the target sample set, and determining the target detection model.
On the basis of the technical scheme, the target model determining module comprises a target sample determining unit, a first processing module and a second processing module, wherein the target sample determining unit is used for processing the original sample set based on a median filtering algorithm and determining a first sample set to be processed; graying treatment is carried out on the first sample set to be treated, and a second sample set to be treated is determined; and determining a target sample set based on the second sample set to be processed.
On the basis of the technical scheme, the target sample determining unit is used for determining sample type information of the second sample set to be processed, processing the second sample set to be processed based on the sample type information, and determining the sample set to be applied; and determining the target sample set based on the sample set to be applied.
On the basis of the above technical solution, the target sample determining unit is configured to process the second sample set to be processed based on a preset transformation method if the second sample set to be processed is a single sample data set, and determine the sample set to be applied.
On the basis of the above technical solution, the target sample determining unit is configured to determine sampling rate information corresponding to the second sample set to be processed if the second sample set to be processed is a multiple sample data set; and determining the sample set to be applied based on the sampling rate information and the second sample set to be processed.
On the basis of the technical scheme, the target model determining module comprises a target detection model determining unit, a target detection model determining unit and a target verification model determining unit, wherein the target detection model determining unit is used for processing the sample set to be applied based on K-fold cross verification and determining each target training sample set and each target verification sample set; training the preset detection model based on the target sample set, and determining the target detection model, including: training the preset detection model based on each target training sample set and each target verification sample set, and determining the target detection model.
According to the technical scheme, an original image is obtained, filtering processing is conducted on the original image to determine an image to be processed, graying processing is conducted on the image to be processed to obtain a target image, tobacco width information corresponding to the original image is determined based on the target image and a target detection model, and the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer. Based on the technical scheme, the method and the device achieve that the original image is obtained based on the acquisition, the target image is obtained after the original image is processed, and further tobacco width information corresponding to the original image is determined based on the target image and the target detection model, so that the tobacco width determination efficiency is improved.
The tobacco shred width determining device provided by the embodiment of the invention can execute the tobacco shred width determining method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Example IV
Fig. 4 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the method of determining the tobacco width.
In some embodiments, the method of determining tobacco shred width may be implemented as a computer program, which is tangibly embodied on a computer readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the above-described method of determining tobacco shred width may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the tobacco width determination method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for determining tobacco width, comprising:
acquiring an original image, and performing filtering treatment on the original image to determine an image to be processed;
graying the image to be processed to obtain a target image, and determining tobacco shred width information corresponding to the original image based on the target image and a target detection model;
the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer.
2. The method of claim 1, wherein prior to the acquiring the original image, filtering the original image to determine an image to be processed, comprising:
acquiring an original sample set, and determining a target sample set based on the original sample set;
training the preset detection model based on the target sample set, and determining the target detection model.
3. The method of claim 2, wherein the determining a target sample set based on the original sample set comprises:
processing the original sample set based on a median filtering algorithm, and determining a first sample set to be processed;
graying treatment is carried out on the first sample set to be treated, and a second sample set to be treated is determined;
and determining a target sample set based on the second sample set to be processed.
4. A method according to claim 3, wherein said determining said target sample set based on said second set of samples to be processed comprises:
determining sample type information of the second sample set to be processed, processing the second sample set to be processed based on the sample type information, and determining the sample set to be applied;
And determining the target sample set based on the sample set to be applied.
5. The method of claim 4, wherein processing the second set of samples to be processed based on the sample type information, determining the set of samples to be applied, comprises:
and if the second sample set to be processed is a single sample data set, processing the second sample set to be processed based on a preset transformation method, and determining the sample set to be applied.
6. The method of claim 4, wherein processing the second set of samples to be processed based on the sample type information, determining the set of samples to be applied, comprises:
if the second sample set to be processed is a multi-sample data set, determining sampling rate information corresponding to the second sample set to be processed;
and determining the sample set to be applied based on the sampling rate information and the second sample set to be processed.
7. The method of claim 4, wherein the determining the target sample set based on the sample set to be applied comprises:
processing the sample set to be applied based on K-fold cross validation, and determining each target training sample set and each target validation sample set;
Training the preset detection model based on the target sample set, and determining the target detection model, including:
training the preset detection model based on each target training sample set and each target verification sample set, and determining the target detection model.
8. A tobacco width determining apparatus, comprising:
the image processing module is used for acquiring an original image, and performing filtering processing on the original image to determine an image to be processed;
the tobacco width determining module is used for carrying out graying treatment on the image to be processed to obtain a target image, and determining tobacco width information corresponding to the original image based on the target image and a target detection model;
the target detection model is a convolutional neural network obtained by training a preset detection model; the convolutional neural network comprises a convolutional layer and a full-connection layer; and a residual error layer is arranged between the convolution layer and the full connection layer.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of determining tobacco shred width as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions for causing a processor to implement the method of determining tobacco shred width as claimed in any one of claims 1 to 7 when executed.
CN202310513555.5A 2023-05-09 2023-05-09 Tobacco shred width determining method and device, electronic equipment and storage medium Pending CN116503370A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310513555.5A CN116503370A (en) 2023-05-09 2023-05-09 Tobacco shred width determining method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310513555.5A CN116503370A (en) 2023-05-09 2023-05-09 Tobacco shred width determining method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116503370A true CN116503370A (en) 2023-07-28

Family

ID=87328193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310513555.5A Pending CN116503370A (en) 2023-05-09 2023-05-09 Tobacco shred width determining method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116503370A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117372390A (en) * 2023-10-26 2024-01-09 句容市家天下网络科技有限公司 Cable standard management system based on random selection

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117372390A (en) * 2023-10-26 2024-01-09 句容市家天下网络科技有限公司 Cable standard management system based on random selection

Similar Documents

Publication Publication Date Title
CN112801164A (en) Training method, device and equipment of target detection model and storage medium
CN109726195B (en) Data enhancement method and device
CN113033537A (en) Method, apparatus, device, medium and program product for training a model
CN115131566A (en) Automatic image segmentation method based on super-pixels and improved fuzzy C-means clustering
CN116503370A (en) Tobacco shred width determining method and device, electronic equipment and storage medium
CN112836820B (en) Deep convolution network training method, device and system for image classification task
CN112884721B (en) Abnormality detection method, abnormality detection system and computer-readable storage medium
CN111179276A (en) Image processing method and device
CN114821063A (en) Semantic segmentation model generation method and device and image processing method
CN116580223A (en) Data processing and model fine tuning method and device, electronic equipment and storage medium
CN109993026A (en) The training method and device of relatives&#39; identification network model
CN112070682A (en) Method and device for compensating image brightness
CN111340139B (en) Method and device for judging complexity of image content
CN116188917B (en) Defect data generation model training method, defect data generation method and device
CN115205163B (en) Method, device and equipment for processing identification image and storage medium
CN115760578A (en) Image processing method and device, electronic equipment and storage medium
CN115294405A (en) Method, device, equipment and medium for constructing crop disease classification model
CN112562039B (en) Method and device for determining extreme value of vertical axis in trend chart
CN113657482A (en) Model training method, target detection method, device, equipment and storage medium
CN117495742B (en) Method, device, equipment and medium for transferring image dyeing
CN113052173B (en) Sample data characteristic enhancement method and device
CN111754056B (en) Model evaluation method and related device
CN114844889B (en) Video processing model updating method and device, electronic equipment and storage medium
CN115829872A (en) Method, device and equipment for enhancing image contrast and storage medium
CN115171225A (en) Image detection method and training method of image detection model

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