CN114882497A - Method for realizing fruit classification and identification based on deep learning algorithm - Google Patents

Method for realizing fruit classification and identification based on deep learning algorithm Download PDF

Info

Publication number
CN114882497A
CN114882497A CN202210486150.2A CN202210486150A CN114882497A CN 114882497 A CN114882497 A CN 114882497A CN 202210486150 A CN202210486150 A CN 202210486150A CN 114882497 A CN114882497 A CN 114882497A
Authority
CN
China
Prior art keywords
model
training
classification
algorithm
data
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
CN202210486150.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.)
Northeast Petroleum University
Original Assignee
Northeast Petroleum University
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 Northeast Petroleum University filed Critical Northeast Petroleum University
Priority to CN202210486150.2A priority Critical patent/CN114882497A/en
Publication of CN114882497A publication Critical patent/CN114882497A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/68Food, e.g. fruit or vegetables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • 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/045Combinations of networks
    • 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/047Probabilistic or stochastic networks
    • 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
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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

Landscapes

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

Abstract

The invention belongs to the field of fruit picture classification, and particularly relates to a fruit picture classification algorithm of a convolution neural network of AlexNet. 1, constructing a reasonable prediction model and establishing a sample data set; 2. searching related fruit image samples through various search engines and databases, and downloading the fruit image samples to the local; 3. the convolution neural network model AlexNet is referred to, some simplification and optimization are carried out, and after a large amount of training and debugging, the optimal parameters are obtained; 4. returning to Pycharm, and performing classification test on the test set by using a TensorFlow calling model.

Description

Method for realizing fruit classification and identification based on deep learning algorithm
The technical field is as follows:
the invention belongs to the field of fruit picture classification, and particularly relates to a fruit picture classification algorithm based on AlexNet convolutional neural network.
Background art:
in recent years, with the rapid development of electronic technology and the rapid popularization of the internet, the threshold for using electronic products such as smart phones and digital cameras is becoming lower and lower. The image is used as a high-efficiency information propagation medium, and is not increased all the time no matter locally or on various social platforms. Therefore, it is very important to scan, analyze, label, and sort and file various images.
Meanwhile, the continuous development of computer science and information technology gradually guides artificial intelligence into our lives, and brings great convenience to our lives. The recognition, image identification and classification are important components in the field of artificial intelligence, and are also popular subjects in deep learning at present.
Fruits are common and universal in our lives, have various varieties, complex styles and extremely strong diversity, and have important significance in researching fruit classification and identification algorithms.
The invention content is as follows:
the invention aims to overcome the defect that the existing different classifiers in the automatic fruit identification technology have unbalanced classification effects on different fruit types, and provides a method for realizing fruit classification and identification based on a deep learning algorithm, so that the accuracy of fruit image identification is improved.
The technical scheme adopted by the invention is as follows: a method for realizing fruit classification and identification based on a deep learning algorithm comprises the following steps:
the method comprises the following steps: constructing a reasonable prediction model, and establishing a sample data set, which respectively comprises the following steps: training set, validation set and test set.
Step two: and searching relevant fruit image samples through various search engines and databases, and downloading the fruit image samples to the local.
Step three: and (3) obtaining optimal parameters by referring to a convolutional neural network model AlexNet and performing simplification and optimization, and training and debugging a large amount.
Step four: returning to Pycharm, and performing classification test on the test set by using a TensorFlow call model.
The invention has the beneficial effects that:
(1) the algorithm model is provided with 8 network layers in total, and the ReLU is used as an excitation function, so that the ReLU excitation function can play a role in the deeper layer of the network, and the phenomenon of gradient disappearance is avoided;
(2) the maximum pooling is used at the rear part of each convolutional layer, and the pooling proportion is larger, so that the size of a design network is greatly reduced while a significant part in a characteristic image is kept, and the memory occupation is reduced;
(3) the model integrally uses an Adam optimizer, and the dual advantages of Adam enable gradient reduction in back propagation to be faster, more accurate and more stable.
Description of the drawings:
FIG. 1 is a flow chart of image recognition according to the present invention;
FIG. 2 is a diagram of an algorithm model structure of the present invention
FIG. 3 is an algorithm model training diagram of the present invention;
fig. 4 is a model predictive thermodynamic diagram.
The specific implementation mode is as follows:
example one
A method for realizing fruit classification and identification based on a deep learning algorithm comprises the following steps:
the method comprises the following steps: and establishing a reasonable sample data set.
Step two: fruit image samples are collected and downloaded locally.
Step three: after a large amount of training and debugging, the optimal parameters are obtained.
Step four: and carrying out classification test on the test set.
Specifically, the intelligent identification method comprises the following steps:
the method comprises the following steps: constructing a reasonable prediction model from a large amount of data; at different stages of model creation, the sample can be divided into 3 data sets, respectively: training set, validation set and test set.
(1) Training set
A training set refers to a data set used at a learner. In a classification task for fruit recognition, a training set is used to fit parameters, such as weights, in a model. The selection of the training set needs to prepare a large-data-size and diversified training set so as to obtain a good prediction model, and certainly, all samples are not divided into the training set, so that the detected samples cannot be identified, which is called overfitting. The figure shows that the sample is divided into verification sets, so that the overfitting is prevented.
(2) Verification set
The data set used to optimize the learning model is then called the validation set. The validation set refers to a sample set used to evaluate the performance of the model after the model training is completed. It can verify whether the current model is in the best state, and adjust each parameter according to the difference, make the model in a stable and optimal state. In use, the training of the model is prevented from falling into a wrong area by a single training set.
(3) Test set
The test set is the final evaluation of the model, and intuitively shows the accuracy of the model prediction and whether the model is over-fit or under-fit. For the results of the test set, we need to retrain the model and adjust the parameters.
With respect to the partitioning of the training set validation set and the test set, a decision needs to be made by aggregating specific questions and the amount of data available. Generally, the distribution ratios that are commonly used are: 60% training set, 20% validation set, 20% test set.
Step two: the data set is divided into 5 fruit types, 5 ten thousand pictures are randomly extracted, and the pictures are classified and stored in corresponding positions.
(1) Collecting
The data set sample can be from a network and a picture of a sample object in life. The method has the characteristics of wide sample source and diversity of fruit types, and is suitable for training. A total of approximately 5000 samples were collected in this experiment.
(2) Screening
The screening is to perform manual screening once after the detection sample is collected, and the method is to remove fuzzy, blank and wrong samples and prevent the errors generated by the samples in the learning process.
(3) Classification
The screened samples are firstly classified into 5 categories according to the labels of fruits, and then the data under the labels of the fruits are randomly grouped according to the proportion of 60% of training set, 20% of verification set and 20% of testing set.
Step three: algorithm training
(1) Algorithm model design parameters
The design of the convolutional neural network model refers to AlexNet, and is simplified and optimized on the basis of the AlexNet, the parameters are the optimal parameters obtained after a large amount of training and debugging, the concept of maximum pooling is used, the more obvious characteristics can be optimally reserved, the recognition capability of a deep network is enhanced, and the classification accuracy of the algorithm can reach a higher level.
(2) Algorithm model training algorithm
After Debug, the program has no error, the training iteration number is set to 300, the training process is started, the total parameter is 2,674,845, and the trainable parameter is 2,674,845.
Before data is input into a neural network, an initialization process including resampling, normalization, layer splitting and the like is needed. Initialization is a system to facilitate feature images in post-processing
Secondly, feature extraction is the most important link, the convolution layer is required to split the features of the image, and the process of splitting the features applies the principle of local perception.
③ Down-sampling
The down sampling is completed through a pooling link, and parameters in the neural network are simplified through removing unimportant neurons in the neural network, so that the operation efficiency is improved.
Fourthly, classified calculation
Convolved and pooled image features. The probability distribution is input into a Softmax function, and the probability distribution is calculated for different types.
Loss calculation
The obtained distribution probability is input into a loss function-a cross entropy function, and compared with the existing verification set, the result of comparison is the current loss value.
Sixth, backward propagation
The current loss value is propagated forward in a reverse direction through the gradient, and the weight of the front end of the neural network is redistributed.
Seventhly, multiple iterations
After a number of iterations. The weight distribution in the network tends to be optimal, the accuracy of the classifier is improved, and the loss function tends to be stable after being reduced.
Step four: algorithm validation
(1) Model accuracy testing
Returning to Pycharm, and performing classification test on the test set by using a TensorFlow calling model. The test set contains about 1000 images, and the test program outputs the prediction results of different fruits in a form of weight values through classification tests on the images.
(2) Probability distribution visualization
The probability distribution obtained by testing is a very complex matrix, and the probability distribution and the cross entropy of different classes can be more obviously seen by drawing the matrix into a thermodynamic diagram of the probability distribution by using NumPy and Matplotlib.
(3) Optimization space of model
If the model learning space is further increased, more samples with differences need to be obtained from a wider source. The method has the advantages that a more diversified and large-scale sample library is provided, and the training efficiency and accuracy of the model are obviously improved.
The foregoing is a more detailed description of the present invention that is presented in conjunction with specific embodiments, which are not to be construed as limiting the invention to the specific embodiments described above. Numerous other simplifications or substitutions may be made without departing from the spirit of the invention as defined in the claims and the general concept thereof, which shall be construed to be within the scope of the invention.

Claims (1)

1. A method for realizing fruit classification and identification based on a deep learning algorithm comprises the following steps:
the method comprises the following steps: constructing a reasonable prediction model from a large amount of data; at different stages of model creation, the sample can be divided into 3 data sets, respectively: training set, validation set and test set.
(1) Training set
A training set refers to a data set used at a learner. In a classification task for fruit recognition, a training set is used to fit parameters, such as weights, in a model. The selection of the training set needs to prepare a large-data-size and diversified training set so as to obtain a good prediction model, and certainly, all samples are not divided into the training set, so that the detected samples cannot be identified, which is called overfitting. The figure shows that the sample is divided into verification sets, so that the overfitting is prevented.
(2) Verification set
The data set used to optimize the learning model is then called the validation set. The validation set refers to a sample set used to evaluate the performance of the model after the model training is completed. It can verify whether the current model is in the best state, and adjust each parameter according to the difference, make the model in a stable and optimal state. In use, the training of the model is prevented from falling into a false zone by a single training set.
(3) Test set
The test set is the final evaluation of the model, and intuitively shows the accuracy of the model prediction and whether the model is over-fit or under-fit. For the results of the test set, we need to retrain the model and adjust the parameters.
With respect to the partitioning of the training set validation set and the test set, a decision needs to be made by aggregating specific questions and the amount of data available. Generally, the distribution ratios that are commonly used are: 60% training set, 20% validation set, 20% test set.
Step two: the data set is divided into 5 fruit types, 5 ten thousand pictures are randomly extracted, and the pictures are classified and stored in corresponding positions.
(1) Collecting
The data set sample can be from a network and a picture of a sample object in life. The method has the characteristics of wide sample source and diversity of fruit types, and is suitable for training. A total of approximately 5000 samples were collected in this experiment.
(2) Screening
The screening is to perform manual screening once after the detection sample is collected, and the method is to remove fuzzy, blank and wrong samples and prevent the errors generated by the samples in the learning process.
(3) Classification
The screened samples are firstly classified into 5 categories according to the labels of fruits, and then the data under the labels of the fruits are randomly grouped according to the proportion of 60% of training set, 20% of verification set and 20% of testing set.
Step three: algorithm training
(1) Algorithm model design parameters
The design of the convolutional neural network model refers to AlexNet, and is simplified and optimized on the basis of the AlexNet, the parameters are the optimal parameters obtained after a large amount of training and debugging, the concept of maximum pooling is used, the more obvious characteristics can be optimally reserved, the recognition capability of a deep network is enhanced, and the classification accuracy of the algorithm can reach a higher level.
(2) Algorithm model training algorithm
After Debug, the program has no error, the training iteration number is set to 300, the training process is started, the total parameter is 2,674,845, and the trainable parameter is 2,674,845.
Before data is input into a neural network, an initialization process including resampling, normalization, layer splitting and the like is needed. Initialization is a system to facilitate feature images in post-processing
Secondly, feature extraction is the most important link, the convolution layer is required to split the features of the image, and the process of splitting the features applies the principle of local perception.
③ Down-sampling
The down sampling is completed through a pooling link, and parameters in the neural network are simplified through removing unimportant neurons in the neural network, so that the operation efficiency is improved.
Fourthly, classified calculation
Convolved and pooled image features. The probability distribution is input into a Softmax function, and the probability distribution is calculated for different types.
Loss calculation
The obtained distribution probability is input into a loss function-a cross entropy function, and compared with the existing verification set, the result of comparison is the current loss value.
Sixth, backward propagation
The current loss value is propagated forward in a reverse direction through the gradient, and the weight of the front end of the neural network is redistributed.
Seventhly, multiple iterations
After a number of iterations. The weight distribution in the network tends to be optimal, the accuracy of the classifier is improved, and the loss function tends to be stable after being reduced.
Step four: algorithm validation
(1) Model accuracy testing
Returning to Pycharm, and performing classification test on the test set by using a TensorFlow calling model. The test set contains about 1000 images, and the test program outputs the prediction results of different fruits in a form of weight values through classification tests on the images.
(2) Probability distribution visualization
The probability distribution obtained by testing is a very complex matrix, and NumPy and Matplotlib are used for drawing the matrix into a thermodynamic diagram of the probability distribution, so that the direct probability distribution and cross entropy of different classes can be more obviously seen.
(3) Optimization space of model
If the model learning space is further increased, more samples with differences need to be obtained from a wider source. The method has the advantages that a more diversified and large-scale sample library is provided, and the training efficiency and accuracy of the model are obviously improved.
CN202210486150.2A 2022-05-06 2022-05-06 Method for realizing fruit classification and identification based on deep learning algorithm Pending CN114882497A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210486150.2A CN114882497A (en) 2022-05-06 2022-05-06 Method for realizing fruit classification and identification based on deep learning algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210486150.2A CN114882497A (en) 2022-05-06 2022-05-06 Method for realizing fruit classification and identification based on deep learning algorithm

Publications (1)

Publication Number Publication Date
CN114882497A true CN114882497A (en) 2022-08-09

Family

ID=82674459

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210486150.2A Pending CN114882497A (en) 2022-05-06 2022-05-06 Method for realizing fruit classification and identification based on deep learning algorithm

Country Status (1)

Country Link
CN (1) CN114882497A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115656145A (en) * 2022-10-25 2023-01-31 吉林大学 In-situ rapid rice detection system and method based on deep learning and ultrafast laser breakdown spectroscopy
CN117611933A (en) * 2024-01-24 2024-02-27 卡奥斯工业智能研究院(青岛)有限公司 Image processing method, device, equipment and medium based on classified network model
CN118015434A (en) * 2024-04-10 2024-05-10 北京蓝耘科技股份有限公司 High-performance network optimization method and system for large model training scene

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115656145A (en) * 2022-10-25 2023-01-31 吉林大学 In-situ rapid rice detection system and method based on deep learning and ultrafast laser breakdown spectroscopy
CN117611933A (en) * 2024-01-24 2024-02-27 卡奥斯工业智能研究院(青岛)有限公司 Image processing method, device, equipment and medium based on classified network model
CN118015434A (en) * 2024-04-10 2024-05-10 北京蓝耘科技股份有限公司 High-performance network optimization method and system for large model training scene

Similar Documents

Publication Publication Date Title
CN110597735B (en) Software defect prediction method for open-source software defect feature deep learning
CN109272500B (en) Fabric classification method based on adaptive convolutional neural network
CN114882497A (en) Method for realizing fruit classification and identification based on deep learning algorithm
CN107633255A (en) A kind of rock lithology automatic recognition classification method under deep learning pattern
CN113034483B (en) Cigarette defect detection method based on deep migration learning
CN111833322B (en) Garbage multi-target detection method based on improved YOLOv3
CN109740681A (en) Fruit sorting method, device, system, terminal and storage medium
CN116151319A (en) Method and device for searching neural network integration model and electronic equipment
CN116843650A (en) SMT welding defect detection method and system integrating AOI detection and deep learning
CN114742211B (en) Convolutional neural network deployment and optimization method facing microcontroller
CN111833310A (en) Surface defect classification method based on neural network architecture search
CN111104855B (en) Workflow identification method based on time sequence behavior detection
CN115909011A (en) Astronomical image automatic classification method based on improved SE-inclusion-v 3 network model
CN115631186A (en) Industrial element surface defect detection method based on double-branch neural network
CN117349786B (en) Evidence fusion transformer fault diagnosis method based on data equalization
CN108229692B (en) Machine learning identification method based on dual contrast learning
CN112434614A (en) Sliding window action detection method based on Caffe framework
CN112085164A (en) Area recommendation network extraction method based on anchor-frame-free network
CN111860601A (en) Method and device for predicting large fungus species
CN106874927A (en) The construction method and system of a kind of random strong classifier
CN113469977B (en) Flaw detection device, method and storage medium based on distillation learning mechanism
CN113780335B (en) Small sample commodity image classification method, device, equipment and storage medium
CN115757900A (en) User demand analysis method and system applying artificial intelligence model
CN114937155A (en) Fabric image component identification method based on deep learning
CN112364904A (en) Model pruning method based on random sampling

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication