CN111860601B - Method and device for predicting type of large fungi - Google Patents

Method and device for predicting type of large fungi Download PDF

Info

Publication number
CN111860601B
CN111860601B CN202010574891.7A CN202010574891A CN111860601B CN 111860601 B CN111860601 B CN 111860601B CN 202010574891 A CN202010574891 A CN 202010574891A CN 111860601 B CN111860601 B CN 111860601B
Authority
CN
China
Prior art keywords
cnn
fungus
training
submodel
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.)
Active
Application number
CN202010574891.7A
Other languages
Chinese (zh)
Other versions
CN111860601A (en
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.)
Beijing Forestry University
Original Assignee
Beijing Forestry 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 Beijing Forestry University filed Critical Beijing Forestry University
Priority to CN202010574891.7A priority Critical patent/CN111860601B/en
Publication of CN111860601A publication Critical patent/CN111860601A/en
Application granted granted Critical
Publication of CN111860601B publication Critical patent/CN111860601B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • 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
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A40/00Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
    • Y02A40/10Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in agriculture

Landscapes

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

Abstract

The invention discloses a method and a device for predicting the type of large fungi, and belongs to the technical field of image recognition. The method comprises the following steps: acquiring an image to be processed of the macro fungi; performing image preprocessing operation on the image to be processed to obtain an image to be identified; based on the image to be identified and a pre-trained macro fungus classification identification model, predicting the category corresponding to the macro fungus of the image to be identified. By adopting the invention, the accuracy of identifying the type of the large fungi can be improved.

Description

Method and device for predicting type of large fungi
Technical Field
The invention relates to the technical field of image recognition, in particular to a method and a device for predicting the type of large fungi.
Background
The large fungi commonly called mushrooms are important eukaryotes except animals and plants. The statistics of (State of the World's Fungi 2018) are reported that more than 14 ten thousand large Fungi are reported in the world, 1020 edible Fungi are reported in China, 692 medicinal Fungi are reported in China, and 480 toxic Fungi are reported in China. Thus, the classification of large fungi is a huge and complex task. Traditional taxonomies rely on taxonomies to identify characteristics of large fungi, and thus predict large fungal species.
With the development of computer science, the field of biological recognition has become a hotspot. The field of classification and identification of the large fungi based on image processing works relatively weak. At present, algorithms for classifying and identifying the large fungi, such as an algorithm for realizing the classification and identification of the large fungi through a gradient neural network, and the like exist. However, there are problems that the neural network has weak advantage in classifying images with insignificant edge morphology differences such as large fungi, and the algorithm requires a preprocessing method for removing the background of the images, which results in lower accuracy in classifying the traditional large fungi in solving the complex environment because the background cannot be completely removed when the algorithm is applied in the actual environment and in the complex background.
Disclosure of Invention
The embodiment of the invention provides a method and a device for predicting the type of large fungi, which can reduce the computational complexity and increase the accuracy of classification of the large fungi. The technical scheme is as follows:
in one aspect, a method of predicting a type of macro fungus is provided, the method being applied to an electronic device, the method comprising:
acquiring an image to be processed of the macro fungi;
performing image preprocessing operation on the image to be processed to obtain an image to be identified;
Based on the image to be identified and a pre-trained macro fungus classification identification model, predicting the category corresponding to the macro fungus of the image to be identified.
Optionally, the macro fungus classification recognition model comprises a plurality of convolutional neural network CNN sub-models and a single-layer perceptron sub-model, preferably, the plurality of CNN sub-models can comprise a shufflenet v2, a mobilenet v2 and a classical CNN structure alexent;
the training process of the large fungus classification and identification model is as follows:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories;
performing image preprocessing operation on sample images in the plurality of first training samples;
respectively carrying out iterative training on a plurality of CNN submodels based on the plurality of first training samples;
determining the accuracy of a plurality of trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
Optionally, the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
Optionally, the constructing a macro fungus classification recognition model based on the multiple weighted CNN sub-models and the single layer perceptron sub-model includes:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model;
and training the to-be-trained large fungus classification and identification model through a plurality of second training samples to obtain the large fungus classification and identification model.
Optionally, the CNN submodel comprises a plurality of fully connected layers;
training the to-be-trained large fungus classification and identification model through a plurality of second training samples to obtain a large fungus classification and identification model, wherein the training comprises the following steps:
performing iterative training on a plurality of fully connected layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the large-scale fungus classification and identification model to be trained through a plurality of second training samples until the output accuracy of the large-scale fungus classification and identification model to be trained is not changed any more, determining the weight values of the plurality of fully connected layers and each neuron weight value of the single-layer perceptron submodel obtained in the last iteration as a final training result, and obtaining the trained large-scale fungus classification and identification model
Optionally, the performing, through a plurality of second training samples, iterative training on a plurality of fully connected layers of a CNN sub-model and each neuron weight value of a single-layer perceptron sub-model in the to-be-trained macro fungus classification recognition model includes:
obtaining a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample reference categories;
and sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images input each time, comparing the prediction result with the sample reference class, and adjusting the neuron weight values of the plurality of full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
In one aspect, there is provided an apparatus for predicting a type of macro fungus, the apparatus being applied to an electronic device, the apparatus comprising:
the acquisition unit is used for acquiring an image to be processed of the macro fungi;
the processing unit is used for carrying out image preprocessing operation on the image to be processed to obtain an image to be identified;
And the prediction unit is used for predicting the category corresponding to the macro fungus of the image to be recognized based on the image to be recognized and the pre-trained macro fungus classification recognition model.
Optionally, the macro fungus classification recognition model comprises a plurality of convolutional neural network CNN sub-models and a single-layer perceptron sub-model;
the device further comprises a training unit for:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories;
performing image preprocessing operation on sample images in the plurality of first training samples;
respectively carrying out iterative training on a plurality of CNN submodels based on the plurality of first training samples;
determining the accuracy of a plurality of trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
Optionally, the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
Optionally, the training unit is configured to:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model;
and training the to-be-trained large fungus classification and identification model through a plurality of second training samples to obtain the large fungus classification and identification model.
Optionally, the CNN submodel comprises a plurality of fully connected layers;
the training unit is used for:
and carrying out iterative training on a plurality of full-connection layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the to-be-trained large-scale fungus classification and identification model through a plurality of second training samples until the output accuracy of the to-be-trained large-scale fungus classification and identification model is not changed, and determining the weights of the plurality of full-connection layers and each neuron weight value of the single-layer perceptron submodel obtained in the last iteration as a final training result to obtain a trained large-scale fungus classification and identification model.
Optionally, the training unit is configured to:
obtaining a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample reference categories;
And sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images input each time, comparing the prediction result with the sample reference class, and adjusting the neuron weight values of the plurality of full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
Optionally, the plurality of CNN submodels includes a shufflenet v2 submodel, a MobileNet submodel, and an alexent submodel.
In one aspect, an electronic device is provided that includes a processor and a memory having at least one instruction stored therein that is loaded and executed by the processor to implement the above-described method of predicting a macrofungus class.
In one aspect, a computer-readable storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement the above-described method of predicting a macrofungus class is provided.
The technical scheme provided by the embodiment of the invention has the beneficial effects that at least:
In the embodiment of the invention, the advantages of various CNNs are integrated, and compared with the traditional CNNs or independent SheffeNet V2, mobileNet and AlexNet, the CNNs have stronger recognition performance; compared with the traditional integrated learning, the method can reach the same performance by using fewer neural network parameters, and has faster training and recognition speeds; the integrated CNN adopts the SheffleNet V2, the MobileNet and the AlexNet, comprises the former two lightweight CNNs and the latter classical CNN, has excellent performance, can cope with various scenes, has stronger robustness and is easy to be arranged on mobile terminal equipment. In addition, the invention integrates CNN to select a sorting weighted average classifier, the weight is determined according to the accuracy sorting of the original CNN verification set, and the weight uses n 2 The CNN with high accuracy has higher weight, so that the original CNN can play a larger role in the overall model as a submodel.
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 diagram of an implementation environment provided by an embodiment of the present invention;
FIG. 2 is a diagram of an implementation environment provided by an embodiment of the present invention;
FIG. 3 is a flow chart of a method for predicting a type of macro fungus provided by an embodiment of the present invention;
FIG. 4 is a flow chart of a method for predicting a type of macro fungus provided by an embodiment of the present invention;
FIG. 4a is a schematic diagram of a framework for predicting a type of macro fungus provided by an embodiment of the present invention;
FIG. 5 is a schematic diagram of an apparatus for predicting the type of macro fungi according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
Embodiments of the present invention provide a method of predicting a type of macro fungus, which may include at least one terminal 101, and a server 102 for serving the plurality of terminals 101. At least one terminal 101 is connected to the server 102 through a wireless or wired network, and the plurality of terminals 101 may be computer devices or intelligent terminals or the like capable of accessing the server 102.
For the image recognition process, as shown in fig. 1, a macro fungus image acquisition program, an application program related to an image preprocessing operation, and a trained macro fungus classification recognition model may be installed in the terminal 101. When a user wants to predict the type corresponding to a certain macro fungus, the user can acquire the image of the macro fungus through the terminal or acquire the image corresponding to the macro fungus through other modes, and can also receive the image of the macro fungus to be identified sent by the server through the terminal, and then input the image of the macro fungus into a trained macro fungus classification and identification model. The server 102 may also provide the application with an image of the macro fungus to be identified. The terminal 101 may also transmit an image of the macro fungus to the server 102 as a demand side, and request the server 102 to predict the type corresponding to the image of the macro fungus. In this case, the server 102 may further have at least one database for storing an image preprocessing algorithm, an image of the macro fungus transmitted from the terminal 101, a trained macro fungus classification recognition model, and the like. The server 102 may be a single terminal or a group of terminals, and when the server 102 is a group of terminals, result data such as the type corresponding to the identified macro fungus may be shared between each terminal.
For the model training process, as shown in fig. 2, a plurality of CNN sub-models to be trained, a single-layer sensor sub-model and the like may be stored in the terminal 101, when a user trains the plurality of CNN sub-models to be trained through a plurality of sample data, the pre-stored sample data may be obtained through the terminal, and the server 102 may also provide the sample data for the terminal 101. In addition, the server may also be used as a device for training a model, in which case the server 102 may have at least one database for storing a plurality of CNN sub-models, single-layer sensor sub-models, and the like, in which case the sample data for training may be stored in advance in the database of the server 102, or may be obtained by sending the terminal 101 to the server 102 in this way, which is not limited by the present invention.
The embodiment of the invention provides a method for predicting the type of large fungi, which can be realized by electronic equipment, wherein the electronic equipment can be a terminal or a server. A flow chart of a method of predicting a macrofungus class as shown in fig. 3, the process flow of the method may comprise the steps of:
step 301, the electronic device acquires an image to be processed of the macro fungus.
Step 302, the electronic device performs image preprocessing operation on the image to be processed to obtain the image to be identified.
Step 303, based on the image to be identified and the pre-trained macro fungus classification and identification model, the electronic device predicts the category corresponding to the macro fungus of the image to be identified.
Optionally, the macro fungus classification recognition model comprises a plurality of convolutional neural network CNN sub-models and a single-layer perceptron sub-model;
the training process of the large fungus classification and identification model is as follows:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories;
performing image preprocessing operation on sample images in a plurality of first training samples;
respectively carrying out iterative training on the CNN submodels based on the first training samples;
determining the accuracy of the trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
Optionally, the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
Optionally, constructing a macro fungus classification recognition model based on the weighted CNN sub-models and the single layer perceptron sub-model, comprising:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting a plurality of CNN submodels, a single-layer perceptron submodel and a weighted average classifier to construct an initial large fungus classification and identification model;
and training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model.
Optionally, the CNN submodel comprises a plurality of fully connected layers; training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model, wherein the training samples comprise:
and performing iterative training on a plurality of full-connection layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the large-scale fungus classification and identification model to be trained through a plurality of second training samples until the output precision of the large-scale fungus classification and identification model to be trained is not changed, and determining the neuron weight values of the plurality of full-connection layers and the single-layer perceptron submodel obtained in the last iteration as a final training result to obtain the trained large-scale fungus classification and identification model.
Optionally, performing iterative training on each neuron weight value of the single-layer perceptron sub-model in the to-be-trained large fungus classification recognition model through a plurality of second training samples, including:
acquiring a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample reference categories;
and sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images, comparing the prediction result with a sample reference class, and adjusting the neuron weight values of the multiple full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
Optionally, the plurality of CNN submodels includes a shufflenet v2 submodel, a MobileNet submodel, and an alexent submodel.
In the embodiment of the invention, the image of the large fungi under the complex background is processed, and the HSV channels of the color image are used for sampling aiming at the problem of the complex background of the image, so that the large fungi classification and identification model is more sensitive to the complex background, the identification rate is enhanced, the large fungi classification problem under various conditions such as the field can be solved, an instrument is not required to be carried or a physical specimen is required to be acquired, only the large fungi image is required to be acquired, or the large fungi image is directly processed, the classification result can be obtained through the invention, and the identification accuracy is greatly improved.
The embodiment of the invention provides a method for predicting the type of large fungi, which can be realized by electronic equipment, wherein the electronic equipment can be a terminal or a server. The embodiment of the invention specifically describes a process of identifying the image of the macro fungus, such as a flow chart of a method for predicting the kind of the macro fungus shown in fig. 3, and the processing flow of the method may include the following steps:
step 301, the electronic device acquires an image to be processed of the macro fungus.
In a possible embodiment, the electronic device may acquire the image to be processed of the macro fungus in various ways, for example, the electronic device is provided with an image acquisition device, and a plurality of images of the macro fungus are acquired by the image acquisition device as the image to be processed. Or the electronic equipment directly acquires the image to be processed of the macro fungi in a network mode and the like, and the method for acquiring the image to be processed of the macro fungi is not limited.
It should be noted that the best obtained image to be processed preferably has one or more obvious morphological characteristics of the macro fungi, i.e. the image to be processed is as complete and clear as possible and is photographed from the top of the positive side; the image to be processed is preferably an RGB three-channel color image, and the resolution is preferably slightly more than 300×300. In this way, the interference of bad factors in the image to be processed can be eliminated to the greatest extent, so that the final recognition result is as accurate as possible.
Step 302, the electronic device performs image preprocessing operation on the image to be processed to obtain the image to be identified.
Wherein the image preprocessing operation may include image data enhancement and image processing of the image to be processed, the image data enhancement may include, but is not limited to: horizontal flip, vertical flip, random angle rotation, random scaling, color enhancement, etc. Wherein, since the form of the macro fungi is generally rare and regular, the image to be processed has sensitivity to symmetric, rotation and scaling operations; the image used in the embodiment of the invention is a color three-channel image, so that the image to be processed has sensitivity to the color enhancement operation, and therefore, the operations are suitable for data enhancement.
Image processing may include, but is not limited to, RGB2HSV, normalization, and the like. The step of converting the RGB channel into the HSV channel aims at learning the large fungus features under the complex background, three channels of color images are reserved, the conventional RGB image is suitable for human eyes to observe, but is not suitable for extracting the large fungus image features, and the HSV to-be-processed image is more suitable for being processed by CNN. The normalization aims to reduce the value range of the image to be processed from 0 to 255 to 0 to 1, thereby facilitating CNN processing.
Step 303, based on the image to be identified and the pre-trained macro fungus classification and identification model, the electronic device predicts the category corresponding to the macro fungus of the image to be identified.
In a possible implementation manner, the image to be identified obtained after the image preprocessing operation in the step 302 is input into a pre-trained large fungus classification and identification model, and the large fungus classification and identification model can directly output the type corresponding to the image to be identified.
In the embodiment of the invention, the image of the large fungi under the complex background is processed, and the HSV channels of the color image are used for sampling aiming at the problem of the complex background of the image, so that the large fungi classification and identification model is more sensitive to the complex background, the identification rate is enhanced, the large fungi classification problem under various conditions such as the field can be solved, an instrument is not required to be carried or a physical specimen is required to be acquired, only the large fungi image is required to be acquired, or the large fungi image is directly processed, the classification result can be obtained through the invention, and the identification accuracy is greatly improved.
The embodiment of the invention provides a method for predicting the type of large fungi, which can be realized by electronic equipment, wherein the electronic equipment can be a terminal or a server. The embodiment of the invention specifically describes a process of training a large fungus classification and identification model to be trained, such as a method flow chart for training the large fungus classification and identification model to be trained shown in fig. 4, and the processing flow of the method can comprise the following steps:
Step 401, the electronic device obtains a plurality of first training samples.
The first training sample comprises a first sample image and a corresponding sample category.
In order to make the training effect better and the training more comprehensive, it is preferable to collect as many macro fungus pictures with differences as possible, which can reflect different complex backgrounds and different features of macro fungi, as the first sample image, and the same kind of image is preferably from different individuals with obvious morphological features, wherein, preferably, the macro fungus morphological features that can be extracted by image processing include: the shape and the color of the fungus cover, the fungus handle, the fungus pleat, the fungus ring and the fungus tray. Wherein the first sample image is an RGB three-channel color image, preferably with a resolution slightly greater than 300 x 300.
Step 402, performing image preprocessing operation on sample images in a plurality of first training samples.
Wherein the image preprocessing operation may include image data enhancement and image processing of the image to be processed, the image data enhancement may include, but is not limited to: horizontal flip, vertical flip, random angle rotation, random scaling, color enhancement, etc. Wherein, since the form of the macro fungi is generally rare and regular, the image to be processed has sensitivity to symmetric, rotation and scaling operations; the image used in the embodiment of the invention is a color three-channel image, so that the image to be processed has sensitivity to the color enhancement operation, and therefore, the operations are suitable for data enhancement.
Image processing may include, but is not limited to, RGB2HSV, normalization, and the like. The step of converting the RGB channel into the HSV channel aims at learning the large fungus features under the complex background, three channels of color images are reserved, the conventional RGB image is suitable for human eyes to observe, but is not suitable for extracting the large fungus image features, and the HSV to-be-processed image is more suitable for being processed by CNN. The normalization aims to reduce the value range of the image to be processed from 0 to 255 to 0 to 1, thereby facilitating CNN processing.
Step 403, performing iterative training on the plurality of CNN submodels based on the plurality of first training samples.
The CNN submodel is an independent CNN, the CNN can automatically extract the characteristics of the image, and compared with manual selection, marking and image characteristic identification, the CNN has the characteristics of high efficiency, convenience, quantification and self-adaption. In this embodiment, CNN is used to extract the morphological features of the macro fungi, and gives the probability of image classification by the extracted features, and adaptively adjusts the parameters themselves. The CNN extracts the characteristics of the large fungus image in a convolution mode, and outputs a characteristic image through a convolution layer, wherein the characteristic image extracted by a lower convolution layer of a higher convolution layer is abstract.
The training procedure for any CNN submodel may be as follows:
step 4031, constructing a CNN submodel, wherein the general CNN submodel structure comprises an input layer, an intermediate layer and an output layer, wherein: the input layer, i.e. the CNN submodel first layer, is used to receive the image and is also typically a convolutional layer; an intermediate layer, typically composed of one or more convolution layers, or a combination of convolution layers and pooling layers, or fully connected layers; the output layer, which sends the output value to the classifier, is generally composed of a full connection layer.
Further, the convolution layer extracts a feature map of the image through a convolution kernel; the pooling layer compresses the input feature images, so that the feature images are reduced on one hand, and the network calculation complexity is simplified; on one hand, carrying out feature compression and extracting main features; a full connection layer connecting all features; a classifier classifies the full-link layer output value, typically softmax.
Further, preferably, the present embodiment selects a lightweight CNN structure to construct a CNN submodel, including ShuffleNetV2, mobileNetV2, and classical CNN structure alexent, wherein:
1) The MobileNet is a lightweight CNN structure used in a mobile terminal or an embedded device, and has the greatest characteristic that the application of a separable convolution (Depthwise separable convolution) method is that the depth separable convolution separates two steps of the traditional convolution, namely depth (Depthwise) convolution and point-by-point (Pointwise) convolution, and the calculated amount is 8 to 9 times less than that of the traditional convolution. The entire model structure of MobileNetv1 has 28 layers, including five separable convolution processes, and a step (Stride) substitution Pooling (Pooling) layer is used for downsampling. V2 introduces a reverse residual block (Inverted Residuals) and a linear bottleneck (Linear Bottlenecks) on the basis of V1.
Wherein, the back-off residual error module is: the input is first channel expanded by a 1 x 1 convolution, then a 3 x 3 depth convolution is used, and finally a 1 x 1 point-by-point convolution is used to compress the number of channels. Wherein the spreading factor is 6.
The linear bottleneck is: the ReLU of the last layer is replaced with a linear activation function, while the activation functions of the other layers remain ReLU6.
Further, the CNN submodel structure constructed based on MobileNetV2 in this embodiment is shown in table 1.
TABLE 1
Layer Output Size T Stride n c
Image 224 2 ×3 - - - -
Conv1 112 2 ×32 - 2 1 32
Block1 112 2 ×16 1 1 1 16
Block2 56 2 ×24 6 2 2 24
Block3 28 2 ×32 6 2 3 32
Block4 14 2 ×64 6 2 4 64
Block5 14 2 ×96 6 1 3 97
Block6 7 2 ×160 6 2 3 160
Block7 7 2 ×320 6 1 1 320
Conv2 7 2 ×1280 - 1 1 1280
AveragePool 1×1×1280 - - 1 -
FC k - - - k
2) ShuffleNet is a class of lightweight CNN structures featuring a packet convolution of Channel blends (Channel shuffles). The SheffeNetV 2 is a lightweight CNN structure optimized on the basis of the SheffeNetV 1.
The basic structure of ShuffleNet consists essentially of blocks (blocks), including:
first a 1 x 1 set of convolutions is used (Group convolution), followed by a channel mixing operation, then a 3 x 3 depth convolution is used, where the step size stride = 2, followed by a 1 x 1 convolution, and then the resulting feature map is connected to the output.
Wherein, the channel mixes as: the input layer is divided into b groups, the total channel number is b×n, the channel dimension is split into (b, n) two dimensions, then the two dimensions are transposed into (n, b), and finally the two dimensions are reconverted into a dimension b×n. The objective is to "reorganize" the feature map after the packet convolution.
V2 adds a Channel split operation to the beginning on the basis of V1, which splits the Channel of the input feature into c-c ' and c ', where c ' is c/2. The grouping operation in the 1 x 1 convolutional layer is canceled. Second, the operation of channel mixing moves to after connection. Finally, the operation of adding (Element-wise add) by Element is replaced by connection.
Further, the CNN submodel structure constructed based on ShuffleNetV2 in this example is shown in table 2.
TABLE 2
3) AlexNet is a structure that deepens the network on the basis of LeNet, and learns more abundant and higher-dimensional image features. The method is characterized in that: deeper network structures, features of images are extracted using stacked convolutional layers, i.e., convolutional layer + pooling layer, overfitting is suppressed using random inactivation (Dropout), overfitting is suppressed using data enhancement (Data Augmentation), sigmoid before Relu substitution is used as an activation function, and multiple GPU training may be used.
AlexNet contains 8 weighted network layers, with the first 5 layers being convolutional layers and the remaining 3 layers being fully connected layers. The output of the last fully-connected layer is the input of k-dimensional softmax, which produces a distribution of k-class tags.
Further, the CNN submodel structure constructed based on AlexNet in this embodiment is shown in table 3.
TABLE 3 Table 3
Layer Input KSize
Image 224×224×3 -
Conv1 56×56×96 11×11/4×4
Pool 16×16×96 3×3/2×2
DropOut 28×28×96 -
Conv2 28×28×256 5×5
Pool 14×14×256 3×3/2×2
DropOut 14×14×256 -
Conv3 14×14×384 3×3
Conv4 14×14×384 3×3
Conv5 14×14×256 3×3
Pool 14×14×256 3×3/2×2
DropOut 7×7×256 -
FC k -
Step 4032, training the CNN submodel, after constructing the CNN submodel structure, training the plurality of CNN submodels through a first sample image of a first training sample and a corresponding sample class, wherein each neuron weight value is iterated by using an Adam optimizer, a plurality of pictures are in one batch (batch), and the number of the batch pictures is represented by batch size.
And 4033, iterating parameters of the CNN submodel, and iterating the neuron weight values of all the full-connection layers by using a back propagation algorithm until the output precision of the neural network is not improved any more, and simultaneously ensuring that the precision of the verification set is not reduced, thus obtaining the CNN submodel after training.
Step 4034, verifying the CNN submodel, verifying the generalization capability of the CNN submodel through a first training sample, and outputting the Top1 accuracy Acc conv1 ,Acc conv2 ,……Acc conv_n The method comprises the steps of carrying out a first treatment on the surface of the Ordering from small to large as Acc 1 ,Acc 2 ,……,Acc n . The Top1 accuracy is the percentage of correct labels classified by the largest probability given by the CNN submodel in the training results trained by the first training sample, namely the ratio of correct results given by the CNN submodel.
Step 404, the electronic device determines the accuracy of the trained CNN sub-models, and weights each CNN sub-model according to the accuracy of the CNN sub-models.
In a possible embodiment, each CNN, sub-model may be weighted by the following formula (1).
Wherein W is conv(i) Acc for the ith CNN weight con(i) The i-th CNN accuracy, where i is 1,2,3, … …, n.
And 405, constructing a weighted average classifier based on weights given by the CNN submodels.
In a possible embodiment, the weighted average classifier can be constructed by the following formula (2).
Wherein, classifier represents Classifier, tensor (conv(i)) The tensor output by the last full connection layer of the ith CNN is k multiplied by b, wherein k is the category number, b is the batch number, W (conv(i)) Is the weight of the ith CNN, where i is 1,2,3, … …, n.
Step 406, the electronic device connects the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model.
Preferably, the single-layer sensor submodel may be a fully connected layer, functioning as a fully connected layer.
In a possible embodiment, as shown in fig. 4a, the electronic device adds a single-layer sensor sub-model to the CNN sub-model, which can be regarded as a fully connected layer, which can be called a fully connected layer fc_w n The activation function is softmax. And changing an activation function to relu for a plurality of full connection layers in the CNN submodel and the previous full connection layer fc_w of the single-layer perceptron submodel. Fc_w connecting CNN submodels n And forming a large fungus classification and identification model to be trained in the weighted average classifier. The embodiment of the invention integrates three CNN submodels, including a CNN submodel and a weighted average classifier which are constructed by a SheffeNetV 2 structure, a MobileNetV2 structure and an AlexNet structure.
Step 407, training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model.
In a possible implementation manner, after integrating the plurality of CNN submodels and the single-layer perceptron submodel into the to-be-trained large fungus classification and identification model, the to-be-trained large fungus classification and identification model needs to be trained. The weights of the neurons in the multiple fully connected layers and the single-layer perceptron submodel in the CNN submodel in the large fungus classification and identification model to be trained can be trained simultaneously, and the training step can comprise the following steps 4071-4072.
Step 4071, performing iterative training on the neuron weight values of the multiple fully connected layers and the single-layer perceptron submodel in the CNN submodel in the to-be-trained large fungus classification and identification model through multiple second training samples.
Specifically, a plurality of second training samples are obtained, wherein the second training samples comprise second sample images and corresponding sample reference categories. It should be noted that the second training samples may be the same batch of samples as the first training samples, or may be different samples, which is not limited in the embodiment of the present invention.
And (3) sequentially inputting second sample images into the to-be-trained large fungus classification and identification model by opening parameters of a plurality of full-connection layers and a single-layer perceptron sub-model in the CNN sub-model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images input each time, comparing the prediction result with a sample reference class, determining the output accuracy of the iteration, and adjusting the weight values of each neuron of the plurality of full-connection layers and the single-layer perceptron sub-model in the CNN sub-model through a back propagation algorithm. Preferably, each neuron weight value may be iterated using an Adam optimizer.
Step 4072, determining the weights of the multiple fully connected layers and the neurons of the single-layer perceptron sub-model in the CNN sub-model obtained in the last iteration as a final training result until the output precision of the to-be-trained large fungus classification and identification model is no longer changed, and obtaining the trained large fungus classification and identification model.
Specifically, when the output precision is obtained according to step 4071, the output precision of the previous iteration is compared with the output precision of the previous iteration, if the output precision of the previous iteration is the same as the output precision of the previous iteration, and the output precision of the iteration is not changed for a continuous preset number of times, which indicates that the to-be-trained large fungus classification and identification model has reached the precision top value, and then the iteration is performed, the output precision is not improved, so that the neuron weight values of a plurality of fully connected layers and a single-layer perceptron sub-model in the CNN sub-model obtained by the last iteration can be determined as the final training result, and the trained large fungus classification and identification model is obtained.
Preferably, after training is completed, the generalization capability of the large fungus classification and identification model can be verified, and the Top1 accuracy Acctop1 and the Top5 accuracy Acctop5 are output. The Top5 accuracy is defined by inputting second sample images of a plurality of second training samples into a large fungus classification and identification model, wherein the first five categories with the highest probability given by the large fungus classification and identification model are the percentages of correct labels.
In the embodiment of the invention, a technician acquires a total of 3580 images of 18 large fungi, packages the same pictures into the same folder according to the types, and uses the same folders as an original data set. And obtaining the labels of the pictures through traversing the pictures in the folder. Preferably, the ratio of the original data set to the training set, the verification set and the test set is 6:2:2. And carrying out data enhancement and preprocessing on the large fungus image, wherein a training set is used for training the model, a verification set is used for verifying whether the output of the model is accurate, and a test set is used for testing the accuracy of the model. The comparison of the accuracy of the model for classifying and identifying the large fungi obtained through the training process with the accuracy of the model currently existing can be shown in the following table 4.
TABLE 4 Table 4
It should be noted that, the above method for predicting the type of the macro fungus and the method for training the model are implemented by an electronic device, which may be a terminal or a server, and the electronic device needs to provide a corresponding implementation environment. Preferably, the present embodiment method is implemented based on a flying paddle (PaddlePaddle) environment. The flying oar integrates a deep learning core frame, a basic model library, an end-to-end development kit, a tool assembly and a service platform, and is a 2016-year formal open source, and is an industrial deep learning platform with comprehensive open source, advanced technology and complete functions. The flyer selects Python as the main front-end language for model development and execution calls and provides a rich programming interface API. Meanwhile, in order to ensure the execution efficiency of the frame, the bottom layer of the flying oar adopts C++. For predictive reasoning, for ease of deployment applications, both C++ and Java APIs are provided.
In the embodiment of the invention, the advantages of various CNNs are integrated, and compared with the traditional CNNs or independent SheffeNet V2, mobileNet and AlexNet, the CNNs have stronger recognition performance; compared with the traditional integrated learning, the invention can reach the same performance with fewer parameters, and has faster training and recognition speed; the integrated CNN adopts the SheffleNet V2, the MobileNet and the AlexNet, comprises the former two lightweight CNNs and the latter classical CNN, has excellent performance, can cope with various scenes, has stronger robustness and is easy to be arranged on mobile terminal equipment. In addition, the invention integrates CNN to select a sorting weighted average classifier, the weight is determined according to the accuracy sorting of the original CNN verification set, and the weight uses n 2 The CNN with high accuracy has higher weight, so that the original CNN can play a larger role in the overall model as a submodel.
FIG. 5 is a block diagram illustrating a method of predicting a type of macro fungus according to an exemplary embodiment. Referring to fig. 5, the apparatus includes an acquisition unit 510, a processing unit 520, and a prediction unit 530.
An acquisition unit 510 for acquiring an image to be processed of a macro fungus;
the processing unit 520 is configured to perform an image preprocessing operation on the image to be processed to obtain an image to be identified;
and a prediction unit 530, configured to predict a category corresponding to the macro fungus of the image to be identified based on the image to be identified and a pre-trained macro fungus classification recognition model.
Optionally, the macro fungus classification recognition model comprises a plurality of convolutional neural network CNN sub-models and a single-layer perceptron sub-model;
the apparatus further comprises a training unit 540, the training unit 540 being configured to:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories;
performing image preprocessing operation on sample images in the plurality of first training samples;
respectively carrying out iterative training on a plurality of CNN submodels based on the plurality of first training samples;
Determining the accuracy of a plurality of trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
Optionally, the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
Optionally, the training unit 540 is configured to:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model;
and training the to-be-trained large fungus classification and identification model through a plurality of second training samples to obtain the large fungus classification and identification model.
Optionally, the CNN submodel comprises a plurality of fully connected layers;
the training unit 540 is configured to:
and carrying out iterative training on a plurality of full-connection layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the to-be-trained large-scale fungus classification and identification model through a plurality of second training samples until the output accuracy of the to-be-trained large-scale fungus classification and identification model is not changed, and determining the weights of the plurality of full-connection layers and each neuron weight value of the single-layer perceptron submodel obtained in the last iteration as a final training result to obtain a trained large-scale fungus classification and identification model.
Optionally, the training unit 540 is configured to:
obtaining a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample reference categories;
and sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images input each time, comparing the prediction result with the sample reference class, and adjusting the neuron weight values of the plurality of full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
Optionally, the plurality of CNN submodels includes a shufflenet v2 submodel, a MobileNet submodel, and an alexent submodel.
In the embodiment of the invention, the advantages of various CNNs are integrated, and compared with the traditional CNNs, DCNNs and residual error networks, the method has stronger recognition performance; compared with the traditional integrated learning, the invention can reach the same performance with fewer parameters, and has faster training and recognition speed; the integrated CNN adopts the SheffleNet V2, the MobileNet and the AlexNet, comprises the former two lightweight CNNs and the latter classical CNN, has excellent performance, can cope with various scenes, has stronger robustness and is easy to be arranged on mobile terminal equipment. In addition, the invention integrates CNN to select a sorting weighted average classifier, the weight is determined according to the accuracy sorting of the original CNN verification set, and the weight uses n 2 The CNN with high accuracy has higher weight, so that the original CNN can play a larger role in the overall model as a submodel.
Fig. 6 is a schematic structural diagram of an electronic device 600 according to an embodiment of the present invention, where the electronic device 600 may have a relatively large difference due to different configurations or performances, and may include one or more processors (central processing units, CPU) 601 and one or more memories 602, where the memories 602 store at least one instruction, and the at least one instruction is loaded and executed by the processors 601 to implement the following steps of a method for predicting a large fungus class:
and obtaining an image to be processed of the large fungi.
And performing image preprocessing operation on the image to be processed to obtain the image to be identified.
Based on the image to be identified and the pre-trained macro fungus classification identification model, predicting the category corresponding to the macro fungus of the image to be identified.
Optionally, the macro fungus classification recognition model comprises a plurality of convolutional neural network CNN sub-models and a single-layer perceptron sub-model;
the training process of the large fungus classification and identification model is as follows:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories;
Performing image preprocessing operation on sample images in a plurality of first training samples;
respectively carrying out iterative training on the CNN submodels based on the first training samples;
determining the accuracy of the trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
Optionally, the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
Optionally, constructing a macro fungus classification recognition model based on the weighted CNN sub-models and the single layer perceptron sub-model, comprising:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting a plurality of CNN submodels, a single-layer perceptron submodel and a weighted average classifier to construct an initial large fungus classification and identification model;
and training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model.
Optionally, the CNN submodel comprises a plurality of fully connected layers;
Training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model, wherein the training samples comprise:
and performing iterative training on a plurality of full-connection layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the large-scale fungus classification and identification model to be trained through a plurality of second training samples until the output precision of the large-scale fungus classification and identification model to be trained is not changed, and determining the neuron weight values of the plurality of full-connection layers and the single-layer perceptron submodel obtained in the last iteration as a final training result to obtain the trained large-scale fungus classification and identification model.
Optionally, performing iterative training on the neuron weight values of the multiple fully connected layers and the single-layer perceptron sub-model of the CNN sub-model in the large fungus classification recognition model to be trained through multiple second training samples, including:
acquiring a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample reference categories;
and sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images, comparing the prediction result with a sample reference class, and adjusting the neuron weight values of the multiple full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
Optionally, the plurality of CNN submodels includes a shufflenet v2 submodel, a MobileNet submodel, and an alexent submodel.
In the embodiment of the invention, the advantages of various CNNs are integrated, compared with the traditional CNNs or the independent SheffeNetV 2, mobileNet and AlexNetThe method has stronger recognition performance; compared with the traditional integrated learning, the invention can reach the same performance with fewer parameters, and has faster training and recognition speed; the integrated CNN adopts the SheffleNet V2, the MobileNet and the AlexNet, comprises the former two lightweight CNNs and the latter classical CNN, has excellent performance, can cope with various scenes, has stronger robustness and is easy to be arranged on mobile terminal equipment. In addition, the invention integrates CNN to select a sorting weighted average classifier, the weight is determined according to the accuracy sorting of the original CNN verification set, and the weight uses n 2 The CNN with high accuracy has higher weight, so that the original CNN can play a larger role in the overall model as a submodel.
In an exemplary embodiment, a computer readable storage medium, e.g. a memory comprising instructions executable by a processor in a terminal to perform the above-described method of predicting a macro fungus class is also provided. For example, the computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (8)

1. A method of predicting a type of a macro fungus, the method comprising:
acquiring an image to be processed of the macro fungi;
performing image preprocessing operation on the image to be processed to obtain an image to be identified;
predicting the type corresponding to the macro fungi of the image to be identified based on the image to be identified and a pre-trained macro fungi classification and identification model;
the large fungus classification and identification model comprises a plurality of convolutional neural network CNN submodels and a single-layer perceptron submodel;
the training process of the large fungus classification and identification model is as follows:
Acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories; the image feature morphology of the first training sample comprises: the shape and the color of the fungus cover, the fungus handle, the fungus pleat, the fungus ring and the fungus tray;
performing image preprocessing operation on sample images in the plurality of first training samples;
respectively carrying out iterative training on a plurality of CNN submodels based on the plurality of first training samples;
determining the accuracy of a plurality of trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
the determining the accuracy of the trained CNN sub-models, assigning weights to each CNN sub-model according to the accuracy of the CNN sub-models, includes:
CNN submodel verification, namely verifying the generalization capability of the CNN submodel through a first training sample, and outputting Top1 accuracy Acc conv1 ,Acc conv2 ,……Acc conv_n The method comprises the steps of carrying out a first treatment on the surface of the Ordering from small to large as Acc 1 ,Acc 2 ,……,Acc n The method comprises the steps of carrying out a first treatment on the surface of the The Top1 accuracy is the percentage of correct labels classified by the largest probability given by the CNN submodel in the training results trained by the first training sample, namely the ratio of correct results given by the CNN submodel;
Each CNN, sub-model is weighted by the following formula (1):
wherein W is conv(i) Acc for the ith CNN weight con(i) The i-th CNN accuracy, where i is 1,2,3, … …, n;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
2. The method of claim 1, wherein the image preprocessing operations include, but are not limited to, horizontal flipping, vertical flipping, random angular rotation, random scaling, color enhancement, RGB2HSV, normalization operations.
3. The method of claim 1, wherein constructing a macro-fungus classification recognition model based on the weighted plurality of CNN sub-models and the single-layer perceptron sub-model comprises:
constructing a weighted average classifier based on weights given by the CNN submodels;
connecting the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model;
obtaining a plurality of second training samples, wherein the second training samples comprise second sample images and corresponding sample categories;
and training the large fungus classification recognition model to be trained through the plurality of second training samples to obtain the large fungus classification recognition model.
4. The method of claim 3, wherein the CNN submodel comprises a plurality of fully connected layers;
training the to-be-trained large fungus classification and identification model through a plurality of second training samples to obtain a large fungus classification and identification model, wherein the training comprises the following steps:
and carrying out iterative training on a plurality of full-connection layers of the CNN submodel and each neuron weight value of the single-layer perceptron submodel in the to-be-trained large fungus classification and identification model through the plurality of second training samples until the output accuracy of the to-be-trained large fungus classification and identification model is not changed, and determining the neuron weight values of the plurality of full-connection layers and the single-layer perceptron submodel obtained in the last iteration as a final training result to obtain a trained large fungus classification and identification model.
5. The method of claim 4, wherein iteratively training, via the plurality of second training samples, the neuron weight values of the plurality of fully connected layers and the single-layer perceptron sub-model of the CNN sub-model in the large fungus class identification model to be trained, comprises:
and sequentially inputting the second sample images into the to-be-trained large fungus classification and identification model, acquiring a prediction result corresponding to the second sample images output by the to-be-trained large fungus classification and identification model for the second sample images input each time, comparing the prediction result with the sample reference class, and adjusting the neuron weight values of the plurality of full-connection layers and the single-layer perceptron sub-model through a back propagation algorithm.
6. The method of any one of claims 1 or 3-5, wherein the plurality of CNN submodels comprises a shufflenet v2 submodel, a MobileNet submodel, and an alexent submodel.
7. An apparatus for predicting a type of macrofungus, the apparatus comprising:
the acquisition unit is used for acquiring an image to be processed of the macro fungi;
the processing unit is used for carrying out image preprocessing operation on the image to be processed to obtain an image to be identified;
the prediction unit is used for predicting the category corresponding to the macro fungus of the image to be recognized based on the image to be recognized and a pre-trained macro fungus classification recognition model;
the large fungus classification and identification model comprises a plurality of convolutional neural network CNN submodels and a single-layer perceptron submodel;
the device further comprises a training unit for:
acquiring a plurality of first training samples, wherein the first training samples comprise first sample images and corresponding sample categories; the image feature morphology of the first training sample comprises: the shape and the color of the fungus cover, the fungus handle, the fungus pleat, the fungus ring and the fungus tray;
performing image preprocessing operation on sample images in the plurality of first training samples;
Respectively carrying out iterative training on a plurality of CNN submodels based on the plurality of first training samples;
determining the accuracy of a plurality of trained CNN submodels, and giving weight to each CNN submodel according to the accuracy of the CNN submodels;
the determining the accuracy of the trained CNN sub-models, assigning weights to each CNN sub-model according to the accuracy of the CNN sub-models, includes:
CNN submodel verification, namely verifying the generalization capability of the CNN submodel through a first training sample, and outputting Top1 accuracy Acc conv1 ,Acc conv2 ,……Acc conv_n The method comprises the steps of carrying out a first treatment on the surface of the Ordering from small to large as Acc 1 ,Acc 2 ,……,Acc n The method comprises the steps of carrying out a first treatment on the surface of the The Top1 accuracy is the percentage of correct labels classified by the largest probability given by the CNN submodel in the training results trained by the first training sample, namely the ratio of correct results given by the CNN submodel;
each CNN, sub-model is weighted by the following formula (1):
wherein W is conv(i) Acc for the ith CNN weight con(i) The i-th CNN accuracy, where i is 1,2,3, … …, n;
based on the multiple CNN submodels given with the weights and the single-layer perceptron submodel, a large fungus classification and identification model is constructed.
8. The apparatus of claim 7, wherein the training unit is configured to:
Constructing a weighted average classifier based on weights given by the CNN submodels;
connecting the CNN submodels, the single-layer perceptron submodel and the weighted average classifier to construct an initial large fungus classification and identification model;
and training the large fungus classification recognition model to be trained through a plurality of second training samples to obtain the large fungus classification recognition model.
CN202010574891.7A 2020-06-22 2020-06-22 Method and device for predicting type of large fungi Active CN111860601B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010574891.7A CN111860601B (en) 2020-06-22 2020-06-22 Method and device for predicting type of large fungi

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010574891.7A CN111860601B (en) 2020-06-22 2020-06-22 Method and device for predicting type of large fungi

Publications (2)

Publication Number Publication Date
CN111860601A CN111860601A (en) 2020-10-30
CN111860601B true CN111860601B (en) 2023-10-17

Family

ID=72987964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010574891.7A Active CN111860601B (en) 2020-06-22 2020-06-22 Method and device for predicting type of large fungi

Country Status (1)

Country Link
CN (1) CN111860601B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112966789A (en) * 2021-04-22 2021-06-15 广东中烟工业有限责任公司 Tobacco maturity identification method, device and equipment
CN113205055A (en) * 2021-05-11 2021-08-03 北京知见生命科技有限公司 Fungus microscopic image classification method and system based on multi-scale attention mechanism

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107358193A (en) * 2017-07-07 2017-11-17 南京天数信息科技有限公司 Dermatophyte recognition detection method based on InceptionV3+ fully-connected networks
CN109447045A (en) * 2018-12-26 2019-03-08 安徽大学 A kind of edible mushroom system for rapidly identifying and method based on deep learning convolutional neural networks
CN109960800A (en) * 2019-03-13 2019-07-02 安徽省泰岳祥升软件有限公司 Weakly supervised file classification method and device based on Active Learning
CN110263863A (en) * 2019-06-24 2019-09-20 南京农业大学 Fine granularity mushroom phenotype recognition methods based on transfer learning Yu bilinearity InceptionResNetV2
CN111008670A (en) * 2019-12-20 2020-04-14 云南大学 Fungus image identification method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107358193A (en) * 2017-07-07 2017-11-17 南京天数信息科技有限公司 Dermatophyte recognition detection method based on InceptionV3+ fully-connected networks
CN109447045A (en) * 2018-12-26 2019-03-08 安徽大学 A kind of edible mushroom system for rapidly identifying and method based on deep learning convolutional neural networks
CN109960800A (en) * 2019-03-13 2019-07-02 安徽省泰岳祥升软件有限公司 Weakly supervised file classification method and device based on Active Learning
CN110263863A (en) * 2019-06-24 2019-09-20 南京农业大学 Fine granularity mushroom phenotype recognition methods based on transfer learning Yu bilinearity InceptionResNetV2
CN111008670A (en) * 2019-12-20 2020-04-14 云南大学 Fungus image identification method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111860601A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
WO2021042828A1 (en) Neural network model compression method and apparatus, and storage medium and chip
US10628705B2 (en) Combining convolution and deconvolution for object detection
WO2021238366A1 (en) Neural network construction method and apparatus
CN111582225B (en) Remote sensing image scene classification method and device
WO2021022521A1 (en) Method for processing data, and method and device for training neural network model
CN111126258A (en) Image recognition method and related device
CN112418392A (en) Neural network construction method and device
CN110222718B (en) Image processing method and device
CN113705769A (en) Neural network training method and device
AU2020100052A4 (en) Unattended video classifying system based on transfer learning
CN112348036A (en) Self-adaptive target detection method based on lightweight residual learning and deconvolution cascade
CN108960260B (en) Classification model generation method, medical image classification method and medical image classification device
WO2021051987A1 (en) Method and apparatus for training neural network model
CN113570029A (en) Method for obtaining neural network model, image processing method and device
CN110717554A (en) Image recognition method, electronic device, and storage medium
CN111860601B (en) Method and device for predicting type of large fungi
CN113592060A (en) Neural network optimization method and device
CN113011253B (en) Facial expression recognition method, device, equipment and storage medium based on ResNeXt network
CN114091554A (en) Training set processing method and device
CN112668486A (en) Method, device and carrier for identifying facial expressions of pre-activated residual depth separable convolutional network
CN111797705A (en) Action recognition method based on character relation modeling
CN113449548A (en) Method and apparatus for updating object recognition model
CN112991281A (en) Visual detection method, system, electronic device and medium
CN112818774A (en) Living body detection method and device
CN114387524B (en) Image identification method and system for small sample learning based on multilevel second-order representation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant