WO2020181706A1 - Plant species identification method and apparatus - Google Patents

Plant species identification method and apparatus Download PDF

Info

Publication number
WO2020181706A1
WO2020181706A1 PCT/CN2019/097891 CN2019097891W WO2020181706A1 WO 2020181706 A1 WO2020181706 A1 WO 2020181706A1 CN 2019097891 W CN2019097891 W CN 2019097891W WO 2020181706 A1 WO2020181706 A1 WO 2020181706A1
Authority
WO
WIPO (PCT)
Prior art keywords
preset
plant
resolution
image
positions
Prior art date
Application number
PCT/CN2019/097891
Other languages
French (fr)
Chinese (zh)
Inventor
任嘉祥
马进
王健宗
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020181706A1 publication Critical patent/WO2020181706A1/en

Links

Images

Classifications

    • 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
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/02Agriculture; Fishing; Forestry; Mining

Definitions

  • This application relates to the technical field of plant species identification, and in particular to a method and device for plant species identification.
  • Atractylodes which belongs to the genus Atractylodes of the Atractylaceae, and the two plants have different medicinal effects, but the appearance is very similar.
  • atractylodes japonicus affect the efficacy of atractylodes japonicus.
  • the present application provides a method and device for identifying plant species, which helps to improve the accuracy of plant species identification.
  • a method for identifying plant species including:
  • a plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets
  • the plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
  • the plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  • a plant species identification device which is characterized in that it comprises:
  • the sample resolution processing module is used to perform resolution preprocessing on the plant sample image to obtain the plant sample image of the first preset resolution
  • the sample block processing module is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the The second preset resolution is smaller than the first preset resolution, the plurality of preset positions are different from each other, and one of the plurality of preset positions is a plant sample image of the first preset resolution
  • the plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
  • the sample set establishment module is configured to use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training samples corresponding to the plurality of preset positions Set and the test sample set;
  • the model training module is used to train multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions, until each trained model corresponding to the multiple preset positions recognizes the corresponding The recognition result of the test sample set meets a preset training termination condition;
  • the image recognition module is used to receive the plant image to be recognized, and use the trained model to recognize the type of the plant image to be recognized.
  • a computer non-volatile readable storage medium on which computer readable instructions are stored, and when the program is executed by a processor, the following steps are implemented:
  • a plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets
  • the plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
  • the plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  • a computer device including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor.
  • the processor implements The following steps:
  • a plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets
  • the plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
  • the plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  • the plant species identification method and device process the resolution of the plant sample image, and after the plant sample image is divided into blocks according to the preset position, it is established with each
  • the training sample set and test sample set corresponding to the preset position are used to train the corresponding ResNet50 model with the training sample set corresponding to each preset position, so that the trained model can achieve the recognition effect of the test sample set at the corresponding position
  • the classification of the new plant image to be recognized is realized through the trained model.
  • this application only needs to take images of the plants to be identified, and the types of plants can be identified through models, which improves the efficiency of identifying plant species and saves money.
  • the labor cost is reduced, and the deep convolutional neural network model using ResNet50 structure also has high accuracy for the recognition of complex images.
  • Fig. 1 shows a schematic flowchart of a method for identifying plant species provided by an embodiment of the present application
  • Figure 2 shows a schematic flow chart of another method for identifying plant species provided by an embodiment of the present application
  • Fig. 3 shows a block diagram of a plant sample image provided by a specific embodiment of the present application
  • FIG. 4 shows a schematic structural diagram of a plant species identification device provided by an embodiment of the present application
  • Figure 5 shows a schematic structural diagram of another plant species identification device provided by an embodiment of the present application.
  • Fig. 6 shows a schematic diagram of the physical structure of a computer device provided by an embodiment of the present application.
  • a method for identifying plant species includes:
  • Step 101 Perform resolution preprocessing on a plant sample image to obtain a plant sample image with a first preset resolution.
  • the plant sample image may include atractylodes lanceolata sample image and Atractylodes lanceolata sample image.
  • Step 102 Acquire corresponding multiple plant sample sub-images of a second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the first
  • the preset resolution, multiple preset positions are different, one of the multiple preset positions is the center position of the plant sample image with the first preset resolution, and the other preset positions correspond to the second preset resolution
  • the plant sample sub-images do not overlap each other and can be combined into a complete plant sample image of the first preset resolution.
  • the image information corresponding to different positions of the sample image may be quite different.
  • the bottom of the image may contain more plants.
  • the top of the image may contain more plant leaf images, and the root characteristics of plants are quite different from the leaf characteristics of plants. Therefore, in order to obtain a more accurate classification result, this embodiment performs more detailed analysis on different parts of plants.
  • Specific modeling analysis after processing the resolution of the plant sample image to the first preset resolution, the image is divided into blocks according to the preset position, and each plant sample image is divided into blocks according to multiple preset positions Then, a complete plant sample image can be divided into multiple plant sample image blocks, where each preset position corresponds to one image block. And in order to preserve the complete image features, the image blocks obtained after the block processing can completely cover the original plant sample image with the first preset resolution.
  • Step 103 Using a plurality of plant sample sub-images of a second preset resolution corresponding to a plurality of preset positions, respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions.
  • the image block corresponding to each preset position is used to establish a training sample set and a test sample set corresponding to the preset position. For example, preset 5 positions in the sample image, which are marked as position 1, position 2, position 3, position 4, and position 5. After the plant sample image is divided into blocks, the image blocks corresponding to the 5 positions are obtained. The image blocks corresponding to positions 1, 2, 3, 4, and 5 establish the training sample set of positions 1, 2, 3, 4, and 5 and the test sample set of positions 1, 2, 3, 4, and 5. Generally speaking, training samples The number of images in the set is greater than the number of images in the test sample set.
  • the number of images in the training sample set can be preset to 2000, and the number of images in the test sample set is preset to 300.
  • the training sample Both the set and the test sample set contain samples of Atractylodes Rhizome and Atractylodes Rhizome sample image blocks corresponding to preset positions.
  • Step 104 Train multiple ResNet50 convolutional neural network models with training sample sets corresponding to multiple preset positions respectively, until each trained model corresponding to multiple preset positions recognizes the recognition result of the corresponding test sample set Meet the preset training termination conditions.
  • a ResNet50 convolutional neural network model corresponding to each preset location is established, and the training sample set corresponding to each preset location is used to train the corresponding preset location Model. For example, use the training sample set corresponding to position 1 to train the model in position 1.
  • test sample set to test the model to verify the classification effect of the model on the sample images in the test sample set. If the classification effect of the model does not reach the preset training termination condition after one training, adjust the relevant training parameters of the model and continue Use the test sample set to train the model until the preset training termination condition is met.
  • Step 105 Receive the plant image to be recognized, and use the trained model to recognize the type of plant image to be recognized.
  • the trained model can be used to classify the plant image to be recognized. Specifically, after obtaining multiple image blocks of the plant image to be recognized according to the preset position, the plant to be recognized can be obtained through the corresponding trained model Identify the plant species corresponding to the image. In the embodiment of the present application, after inputting the plant image to be recognized into the model, the probability that the image is an Atractylodes lancea image and the probability that the image is an Atractylodes macrocephala image can be obtained.
  • a training sample set and a test sample corresponding to each preset position are established
  • the training sample set corresponding to each preset position is used to train the corresponding ResNet50 model, so that the trained model can recognize the test sample set at the corresponding position after reaching the preset training termination condition.
  • the latter model classifies the new plant image to be recognized.
  • the method includes:
  • Step 201 If the resolution of the plant sample image is greater than the first preset resolution, down-sampling is performed on the plant sample image to obtain a plant sample image of the first preset resolution.
  • the ResNet50 convolutional neural network model used in the embodiments of this application requires an image with a resolution of 720 ⁇ 540 for training. Therefore, the preset resolution is 720 ⁇ 540 to ensure the clarity of the image so that the plant sample image can be processed For further processing, in this embodiment of the application, the first preset resolution is set to 1440 ⁇ 1080.
  • the image should be down-sampled to reduce it to the first preset resolution, so that the resolution of all the plant sample images is unified, and the subsequent image segmentation is convenient Processing and other operations and the establishment of training sample sets and test sample sets.
  • the ResNet50 model includes a 50-layer convolutional layer and a 1-layer fully connected layer that are sequentially connected, where the 50-layer convolutional layer is divided into 5 blocks, and the 5 blocks are respectively denoted as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7 ⁇ 7 convolution kernel, conv2_x includes a convolution layer with a 3 ⁇ 3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 layers of convolution kernels as 3 ⁇ 3 convolutional layers.
  • ResNet50 is a deep convolutional neural network structure, which uses residual connection to increase the depth of the network structure and improve the recognition accuracy. Using this network structure can achieve accurate classification of complex images. Specifically, it includes 50 layers of convolutional layer and 1 layer of fully connected layer (or called up-sampling layer).
  • conv1 consists of a single convolution kernel of 7 ⁇ 7 fully convolutional layers
  • conv2_x consists of a 3 ⁇ 3 convolution
  • the convolutional layer of the convolution kernel and 3 bottleneck building blocks are composed of a total of 10 layers (each bottleneck building block contains a convolution kernel of 1 ⁇ 1, a convolution layer with 64 channels, and a convolution kernel of 3 ⁇ 3, a convolutional layer with 64 channels, and a convolutional layer with a convolution kernel of 1 ⁇ 1 and 256 channels);
  • conv3_x is composed of 4 bottleneck building blocks and a total of 12 layers (each bottleneck building block It contains a convolution kernel of 1 ⁇ 1, a convolutional layer with 128 channels, a convolution kernel of 3 ⁇ 3, a convolutional layer with 128 channels, and a convolution kernel of 1 ⁇ 1 , A convolutional layer with 512 channels);
  • conv4_x is composed of 6 bottleneck building blocks and a total of 18 layers (each bottleneck
  • Step 202 If the resolution of the plant sample image is less than the first preset resolution, perform an up-sampling process on the plant sample image to obtain a plant sample image of the first preset resolution.
  • the resolution of the plant sample image is less than the first preset resolution
  • the resolution of the image should also be adjusted to the first preset resolution.
  • the up-sampling process can be used to perform bilinear on the original image. Interpolate and upsample to the first preset resolution.
  • Step 203 Acquire corresponding multiple plant sample sub-images of a second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the first The preset resolution, multiple preset positions are different, one of the multiple preset positions is the center position of the plant sample image of the first preset resolution, and the other plant samples of the second preset resolution The sub-images do not overlap each other.
  • the embodiment of the present application performs block processing on the plant sample image, and obtains multiple plant sample sub-images with a resolution of 720 ⁇ 540 corresponding to multiple preset positions according to each plant sample image with a first preset resolution.
  • the multiple preset positions include the center position of the plant sample image.
  • the plant sample image corresponding to the center position may overlap with plant sample images corresponding to other positions, but the plant sample images corresponding to other positions do not overlap each other and other positions
  • the corresponding plant sample sub-image should include the entire plant sample image, so that the training sample set and the test sample set can be established based on the divided plant sample image, so that each pixel in the image is used as a training sample to avoid loss of image Feature information, and because the central position of the image is usually the part where the key feature information for distinguishing plant species is relatively concentrated, extracting the image at the central position separately for training will help improve the recognition accuracy of the model.
  • Step 204 normalize the RGB value of each pixel of the plant sample sub-images with the second preset resolution ratio, and the RGB value normalization processing formula is:
  • N is the maximum component value of the RGB channel
  • x and y are the R, G, and B of any pixel corresponding to the original and normalized second preset resolution plant sample sub-image.
  • the component value of a channel is the maximum component value of the RGB channel
  • x and y are the R, G, and B of any pixel corresponding to the original and normalized second preset resolution plant sample sub-image.
  • Step 205 Use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions after the normalization of the RGB values, to respectively establish training sample sets and test samples corresponding to the plurality of preset positions set.
  • a corresponding training sample set and a test sample set are established according to the plant sample image with a resolution of 720 ⁇ 540 corresponding to each preset position.
  • 5 training sample sets corresponding to preset positions and 5 corresponding test sample sets are respectively established.
  • Each training sample set includes 2000 images of the same position of different samples, and each test sample The set includes 300 images of the same position of samples different from the training sample set.
  • Step 206 Use training sample sets corresponding to a plurality of preset positions to train corresponding models according to a preset learning rate.
  • the model is trained according to a preset learning rate using a training sample set, for example, a training sample set corresponding to position 1 is used to train a model corresponding to position 1 at a learning rate of 0.01.
  • different learning rates can be set for models corresponding to different positions, or the same learning rate can be set, which is not limited here.
  • Step 207 If the accuracy of the trained model to identify the corresponding test sample set is less than the preset accuracy and/or the recall rate is less than the preset recall rate, then the preset learning rate is reduced, and the reduced preset learning rate is continued The model is trained until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate.
  • the model After training the model according to the preset learning rate, use the trained model to test the corresponding test sample set. If the recognition accuracy and recall rate of the model are greater than or equal to the preset accuracy and recall rates, then the model After the training is completed, the model can be further used to classify the plant images to be recognized. If the recognition accuracy of the model is less than the preset accuracy and the recall rate is less than the preset recall rate, you need to continue to train the model. Use a learning rate lower than the original preset learning rate for training, thereby improving the recognition accuracy and recall rate of the model until the corresponding presets are reached.
  • the preset learning rate is 0.01
  • the preset accuracy and recall rates are both 90%.
  • the recognition accuracy and/or recall rate of the model is less than 90%, the model will be trained 1000 times with a learning rate of 0.001.
  • Each pass contains 30 plant sample images randomly selected from the training sample set, and then test the recognition of the trained model If the accuracy and recall rates still do not meet the preset conditions, you can reduce the learning rate again to continue learning.
  • the model corresponding to each preset position can use the same initial learning rate, or different initial learning rates can be set separately, and the preset accuracy and recall rate corresponding to each model can be the same or can be Different, for example, the accuracy rate and recall rate corresponding to the center position are set to 95%, and the accuracy rate and recall rate corresponding to other positions are set to 90%. Test the classification accuracy and recall of each model separately, until the classification accuracy and recall of each model after training reach the corresponding preset.
  • Step 208 Perform resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
  • Step 209 Acquire corresponding multiple plant sub-images to be recognized at multiple preset positions of the processed plant image to be recognized, wherein the resolution of any one of the multiple plant images to be recognized and the first 2.
  • the preset resolution is consistent;
  • Step 210 Perform normalization processing on the RGB value of each pixel of the plant sub-image to be identified corresponding to a plurality of preset positions according to the RGB value normalization processing formula;
  • Step 211 Input the plant sub-images to be identified corresponding to the multiple preset positions after the normalization of the RGB values into the corresponding trained model to obtain the to-be-identified plant sub-images corresponding to the multiple preset positions respectively. Multiple recognition results of plant sub-images.
  • the classification of the plant image to be recognized can be realized.
  • the processing procedure is similar to that of the plant sample image.
  • the resolution of the image is first processed to the first preset resolution, and then the image is divided into blocks according to multiple preset positions.
  • the images to be recognized corresponding to 5 preset positions are input into the corresponding models respectively, and the recognition results of the images to be recognized corresponding to the 5 preset positions are obtained respectively.
  • Step 212 Perform a weighted sum calculation on the multiple recognition results according to the preset weights corresponding to the multiple preset positions to obtain the recognition result of the image to be recognized, where the plant sub-image at the center position corresponds to the The preset weight is greater than the preset weight corresponding to the plant sub-images to be identified at other locations.
  • the recognition result is weighted and calculated according to the corresponding preset weight to obtain the final recognition result of the image to be recognized.
  • the central location may contain more key feature information, which should be used as the main reference factor to determine the final recognition result. Therefore, its corresponding weight should be higher than the corresponding weights at other locations to obtain more accurate recognition results.
  • the weight corresponding to the center position in the 5 preset positions is set to 0.4, and the weight corresponding to the remaining 4 positions is set to 0.15 respectively.
  • the recognition result at the center position is that the image corresponding to the center position is atractylodes
  • the probability is 80%
  • the probability of Atractylodes macrocephala is 10%
  • the recognition results of the remaining 4 positions are 40%, 90%, 80%, 80% of the corresponding image
  • the probability of Atractylodes macrocephala is 80%, 20%, 30%. , 20%.
  • the type of plant image to be recognized can be determined according to the 75.5% probability of atractylodes and 26.5% probability of atractylodes.
  • a rule can be set as follows: if the probability of the recognition result of the first type of plant is greater than or equal to the first preset probability and the probability of the second type of plant is less than the second preset probability, determine the plant corresponding to the plant image to be recognized
  • the species is the first kind of plant. For example, the first preset probability is 70% and the second preset probability is 30%, then it can be determined that the type corresponding to the above-mentioned plant image to be recognized is atractylodes. If the recognition result is that the probability of atractylodes is 60% and the probability of atractylodes is 40%, then manual judgment can be involved or continue to judge whether the image is another plant image.
  • the recognition result is that the probability of atractylodes is 60% and the probability of atractylodes is 40%, it is determined that the image is atractylodes image.
  • a piece of plant sample image is processed into blocks to obtain multiple plant sample images corresponding to multiple preset positions, thereby establishing training sample sets and test samples corresponding to different preset positions
  • the training sample set corresponding to each preset position is used to train the corresponding classification model, so that the recognition accuracy and recall rate of each classification model for the corresponding training sample set meet the corresponding preset conditions, and the final It can be used as a model for classifying plant images to be recognized.
  • the plant image to be recognized is received, the plant image to be recognized is divided into blocks according to the preset position and then input into the corresponding classification model, so as to determine the final plant image to be recognized according to the recognition result of each classification model The classification results.
  • the embodiments of this application help solve the problem of low efficiency caused by artificial recognition of plant species in the prior art, and separately train classification models corresponding to different preset positions, and integrate the recognition results of multiple classification models to determine the final
  • the classification result of the image to be recognized improves the accuracy and efficiency of recognition.
  • an embodiment of the present application provides a plant species identification device.
  • the device includes: a sample resolution processing module 41, a sample block processing module 42, and a sample Set building module 43, model training module 44, and image recognition module 45.
  • the sample resolution processing module 41 is configured to perform resolution preprocessing on the plant sample image to obtain a plant sample image of the first preset resolution
  • the sample block processing module 42 is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution.
  • the resolution is smaller than the first preset resolution, and the multiple preset positions are different.
  • One of the multiple preset positions is the center position of the plant sample image with the first preset resolution, and the other preset positions correspond to The plant sample sub-images of the second preset resolution do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
  • the sample set establishment module 43 is configured to use a plurality of plant sample sub-images of a second preset resolution corresponding to a plurality of preset positions to respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions;
  • the model training module 44 is used to train multiple ResNet50 convolutional neural network models using training sample sets corresponding to multiple preset positions, until each trained model corresponding to multiple preset positions recognizes a corresponding test sample The recognition result of the set meets the preset training termination condition;
  • the image recognition module 45 is used to receive the plant image to be recognized, and use the trained model to recognize the type of the plant image to be recognized.
  • the sample resolution processing module 41 specifically includes: a sample down-sampling unit 411 and a sample up-sampling unit 412.
  • the sample down-sampling unit 411 is configured to perform down-sampling processing on the plant sample image if the resolution of the plant sample image is greater than the first preset resolution to obtain a plant sample image of the first preset resolution;
  • the sample up-sampling unit 412 is configured to perform an up-sampling process on the plant sample image if the resolution of the plant sample image is less than the first preset resolution to obtain a plant sample image of the first preset resolution.
  • the device further includes: an RGB value normalization module 46.
  • the RGB value normalization module 46 is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, and then according to the RGB value
  • the normalization processing formula is to normalize the RGB value of each pixel of a plurality of plant sample sub-images with a second preset resolution.
  • the RGB value normalization processing formula is:
  • N is the maximum component value of the RGB channel
  • x and y are the R, G, and B of any pixel corresponding to the original and normalized second preset resolution plant sample sub-image.
  • the sample set establishment module 43 is specifically configured to use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions after the normalization of the RGB values to establish the respective sub-images corresponding to the plurality of preset positions Training sample set and test sample set.
  • the image recognition module 45 specifically includes: an image resolution processing unit 451, an image block unit 452, an image RGB value normalization unit 453, an image recognition unit 454, and a recognition result Calculating unit 455.
  • the image resolution processing unit 451 is configured to perform resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
  • the image segmentation unit 452 is configured to obtain corresponding multiple plant images to be recognized at multiple preset positions of the processed plant images to be recognized, where any one of the multiple plant images to be recognized The resolution is consistent with the second preset resolution;
  • the image RGB value normalization unit 453 is configured to perform normalization processing on the RGB value of each pixel of the plant sub-image to be identified corresponding to a plurality of preset positions according to the RGB value normalization processing formula;
  • the image recognition unit 454 is configured to input the sub-images of plants to be recognized corresponding to the multiple preset positions after the normalization of the RGB values into the corresponding trained model, and obtain the sub-images corresponding to the multiple preset positions. Multiple recognition results of the plant sub-images to be recognized;
  • the recognition result calculation unit 455 is configured to perform a weighted sum calculation on the multiple recognition results according to the preset weights corresponding to the multiple preset positions to obtain the recognition result of the image to be recognized.
  • the preset weights corresponding to the plant sub-images are greater than the preset weights corresponding to the plant sub-images to be identified at other locations.
  • the model training module 44 specifically includes: a first model training unit 441 and a second model training unit 442.
  • the first model training unit 441 is configured to use training sample sets corresponding to multiple preset positions to train the corresponding model according to the preset learning rate;
  • the second model training unit 442 is configured to reduce the preset learning rate if the accuracy of the trained model to identify the corresponding test sample set is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate, and according to the reduced Continue to train the model until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate.
  • the network structure of the model includes 50 layers of convolutional layers and 1 layer of fully connected layers that are sequentially connected, where the 50 layers of convolutional layers are divided into 5 blocks, and the 5 blocks are respectively denoted as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7 ⁇ 7 convolution kernel, conv2_x includes a convolutional layer with a 3 ⁇ 3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck constructions Block; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 convolutional layers with a 3 ⁇ 3 convolution kernel.
  • an embodiment of the present application also provides a computer non-volatile readable storage medium, on which computer readable instructions are stored, and the computer readable instructions are processed
  • the following steps are implemented when the device is executed: the resolution preprocessing of the plant sample image is performed to obtain the plant sample image of the first preset resolution; the corresponding plant sample images of the first preset resolution are obtained at multiple preset positions.
  • a plurality of plant sample sub-images of a second preset resolution wherein the second preset resolution is less than the first preset resolution, the plurality of preset positions are different, and one of the plurality of preset positions is the first At the center position of a plant sample image of a preset resolution, the plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution ;
  • the corresponding training sample set trains multiple ResNet50 convolutional neural network models, until the recognition result of the test sample set corresponding to the model identification corresponding to multiple preset positions meets the preset training termination condition; receive the to-be-identified Plant images, and use the trained model to recognize the
  • the technical solution of this application can be embodied in the form of a software product.
  • the software product can be stored in a non-volatile storage medium (which can be a CD-ROM, U disk, mobile hard disk, etc.), including several
  • the instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute the methods described in each implementation scenario of this application.
  • the computer device includes: a processor 51, The memory 52 and computer-readable instructions stored on the memory 52 and capable of running on the processor, wherein the memory 52 and the processor 51 are both set on the bus 53 and the processor 51 implements the following steps when the processor 51 executes the program: Resolution preprocessing to obtain a plant sample image of a first preset resolution; obtain a plurality of corresponding plant samples of a second preset resolution at a plurality of preset positions of the plant sample image of the first preset resolution A sub-image, wherein the second preset resolution is smaller than the first preset resolution, the multiple preset positions are different, and one of the multiple preset positions is the center position of the plant sample image with the first preset resolution Where, the plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined
  • the computer device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and so on.
  • the user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, and the like.
  • the network interface can optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
  • the memory may also include an operating system and a network communication module.
  • the operating system is a program that manages the hardware and software resources of computer equipment, and supports the operation of information processing programs and other software and/or programs.
  • the network communication module is used to realize the communication between the various components in the memory and the communication with other hardware and software in the physical device.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Business, Economics & Management (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Tourism & Hospitality (AREA)
  • Primary Health Care (AREA)
  • Marketing (AREA)
  • Human Resources & Organizations (AREA)
  • Economics (AREA)
  • Mining & Mineral Resources (AREA)
  • Marine Sciences & Fisheries (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Strategic Management (AREA)
  • Evolutionary Biology (AREA)
  • Animal Husbandry (AREA)
  • Agronomy & Crop Science (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed in the present application are a plant species identification method and apparatus, the method comprising: performing resolution pre-processing on plant sample images to obtain plant sample images of a first preset resolution; acquiring a corresponding plurality of plant sample sub-images of a second preset resolution at a plurality of preset positions on the plant sample images of a first preset resolution; using the plant sample sub-images of a second preset resolution corresponding to the plurality of preset positions to respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions; respectively using the training sample set corresponding to the plurality of preset positions to train a plurality of ResNet50 convolutional neural network models until the identification results of identification of the corresponding test sample set by each trained model corresponding to the plurality of preset positions satisfies a preset training finishing condition; and receiving plant images to be recognised and using the trained models to identify the species of the plant images to be identified.

Description

植物种类的识别方法及装置Method and device for identifying plant species
本申请要求与2019年3月12日提交中国专利局、申请号为201910185074.X、申请名称为“植物种类的识别方法及装置、存储介质、计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of the Chinese patent application filed with the Chinese Patent Office on March 12, 2019, the application number is 201910185074.X, and the application name is "Methods and devices for identifying plant species, storage media, and computer equipment". All of them The content is incorporated in the application by reference.
技术领域Technical field
本申请涉及植物种类的识别技术领域,尤其是涉及到一种植物种类的识别方法及装置。This application relates to the technical field of plant species identification, and in particular to a method and device for plant species identification.
背景技术Background technique
如何识别植物种类是广大种植者的需求,在种植过程中,种植者需要去除其他种类植株,只在种植区域内保留所需种类植株。比如在苍术的种植过程中,经常会混入与苍术同属菊科苍术属的白术,两种植物的药效不同,但是外形十分相似,在苍术的种植过程中,需要去除白术和其他植株,防止白术或其他植株混入苍术中影响苍术药效。How to identify plant species is the demand of the vast number of growers. During the planting process, growers need to remove other types of plants and only retain the required types of plants in the planting area. For example, in the process of planting Atractylodes, it is often mixed with Atractylodes, which belongs to the genus Atractylodes of the Atractylaceae, and the two plants have different medicinal effects, but the appearance is very similar. Or other plants mixed with atractylodes japonicus affect the efficacy of atractylodes japonicus.
在现有技术中,需要经验丰富的人仔细观察进行区分,从而保留苍术。但因为苍术是一种高需求量的药材,人工分类速度较慢并且对人员经验要求较高,经验不足的工作人员对苍术和白术的识别准确率很难保证,影响种植的苍术品质。In the prior art, an experienced person needs to observe carefully to distinguish, so as to preserve atractylodes. But because atractylodes is a high-demand medicinal material, manual classification is slow and requires high personnel experience. It is difficult for inexperienced staff to recognize the accuracy of atractylodes and atractylodes, which affects the quality of planted atractylodes.
发明内容Summary of the invention
有鉴于此,本申请提供了一种植物种类的识别方法及装置,有助于提高植物种类的识别准确率。In view of this, the present application provides a method and device for identifying plant species, which helps to improve the accuracy of plant species identification.
根据本申请的一个方面,提供了一种植物种类的识别方法,包括:According to one aspect of this application, a method for identifying plant species is provided, including:
对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
根据本申请的另一方面,提供了一种植物种类的识别装置,其特征在于,包括:According to another aspect of the present application, there is provided a plant species identification device, which is characterized in that it comprises:
样本分辨率处理模块,用于对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;The sample resolution processing module is used to perform resolution preprocessing on the plant sample image to obtain the plant sample image of the first preset resolution;
样本分块处理模块,用于在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;The sample block processing module is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the The second preset resolution is smaller than the first preset resolution, the plurality of preset positions are different from each other, and one of the plurality of preset positions is a plant sample image of the first preset resolution The plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
样本集建立模块,用于利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;The sample set establishment module is configured to use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training samples corresponding to the plurality of preset positions Set and the test sample set;
模型训练模块,用于分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;The model training module is used to train multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions, until each trained model corresponding to the multiple preset positions recognizes the corresponding The recognition result of the test sample set meets a preset training termination condition;
图像识别模块,用于接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The image recognition module is used to receive the plant image to be recognized, and use the trained model to recognize the type of the plant image to be recognized.
依据本申请又一个方面,提供了一种计算机非易失性可读存储介质,其上存储有计算机可读指令,所述程序被处理器执行时实现以下步骤:According to another aspect of the present application, a computer non-volatile readable storage medium is provided, on which computer readable instructions are stored, and when the program is executed by a processor, the following steps are implemented:
对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
依据本申请再一个方面,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现以下步骤:According to another aspect of the present application, there is provided a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. The processor implements The following steps:
对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
借由上述技术方案,本申请提供的一种植物种类的识别方法及装置,通过对植物样本图像的分辨率进行处理,并按照预设位置对植物样本图像进行分块处理后,建立与每个预设位置对应的训练样本集以及测试样本集,从而利用与每个预设位置对应的训练样本集对相应的ResNet50模型进行训练,使得训练后的模型对相应位置的测试样本集的识别效果达到预设训练终止条件后,实现了通过训练后的模型对新的待识别的植物图像的分类。本申请与现有技术中依靠有经验的技术人员对植物进行人工分类相比,只需拍摄待识别植物的图像,即可通过模型对植物的种类进行识别,提高了植物种类的识别效率,节约了人力成本,并且采用ResNet50结构的深度卷积神经网络模型对于复杂图像的识别也具有较高的准确性。With the above technical solutions, the plant species identification method and device provided in this application process the resolution of the plant sample image, and after the plant sample image is divided into blocks according to the preset position, it is established with each The training sample set and test sample set corresponding to the preset position are used to train the corresponding ResNet50 model with the training sample set corresponding to each preset position, so that the trained model can achieve the recognition effect of the test sample set at the corresponding position After the training termination condition is preset, the classification of the new plant image to be recognized is realized through the trained model. Compared with the prior art relying on experienced technicians to manually classify plants, this application only needs to take images of the plants to be identified, and the types of plants can be identified through models, which improves the efficiency of identifying plant species and saves money. The labor cost is reduced, and the deep convolutional neural network model using ResNet50 structure also has high accuracy for the recognition of complex images.
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,而可依照说明书的内容予以实施,并且为了让本申请的上述和其它目的、特征和优点能够更明显易懂,以下特举本申请的具体实施方式。The above description is only an overview of the technical solution of this application. In order to understand the technical means of this application more clearly, it can be implemented in accordance with the content of the specification, and to make the above and other purposes, features and advantages of this application more obvious and understandable. , The following specifically cite the specific implementation of this application.
附图说明Description of the drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described here are used to provide a further understanding of the application and constitute a part of the application. The exemplary embodiments and descriptions of the application are used to explain the application and do not constitute an improper limitation of the application. In the attached picture:
图1示出了本申请实施例提供的一种植物种类的识别方法的流程示意图;Fig. 1 shows a schematic flowchart of a method for identifying plant species provided by an embodiment of the present application;
图2示出了本申请实施例提供的另一种植物种类的识别方法的流程示意图;Figure 2 shows a schematic flow chart of another method for identifying plant species provided by an embodiment of the present application;
图3示出了本申请一个具体实施例提供的一种植物样本图像的分块示意图;Fig. 3 shows a block diagram of a plant sample image provided by a specific embodiment of the present application;
图4示出了本申请实施例提供的一种植物种类的识别装置的结构示意图;FIG. 4 shows a schematic structural diagram of a plant species identification device provided by an embodiment of the present application;
图5示出了本申请实施例提供的另一种植物种类的识别装置的结构示意图;Figure 5 shows a schematic structural diagram of another plant species identification device provided by an embodiment of the present application;
图6示出了本申请实施例提供的一种计算机设备的实体结构示意图。Fig. 6 shows a schematic diagram of the physical structure of a computer device provided by an embodiment of the present application.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本申请。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。Hereinafter, the application will be described in detail with reference to the drawings and in conjunction with embodiments. It should be noted that the embodiments in this application and the features in the embodiments can be combined with each other if there is no conflict.
在本实施例中提供了一种植物种类的识别方法,如图1所示,该方法包括:In this embodiment, a method for identifying plant species is provided. As shown in FIG. 1, the method includes:
步骤101,对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像。Step 101: Perform resolution preprocessing on a plant sample image to obtain a plant sample image with a first preset resolution.
本申请的实施例以区分苍术图像和白术图像为例进行解释,本申请的实施例仅作为举例说明,本领域技术人员可以将苍术图像、白术图像替换为其他的一种或多种植物图像,在此不做限定。The embodiment of this application is explained by taking the distinction between atractylodes image and atractylodes macrocephala image as an example. The embodiment of this application is only used as an example. Those skilled in the art can replace the atractylodes macrocephala image and the atractylodes macrocephala image with one or more other plant images. There is no limitation here.
在上述实施例中,植物样本图像可以包括苍术样本图像和白术样本图像,得到植物样本图像后,为了方便利用样本图像训练分类模型,提高训练效率,需要对样本图像的分辨率进行归一化,将样本图像的大小统一化,具体可以将全部的植物样本图像处理为第一预设分辨率的图像。In the above embodiment, the plant sample image may include atractylodes lanceolata sample image and Atractylodes lanceolata sample image. After the plant sample image is obtained, in order to use the sample image to train the classification model and improve the training efficiency, it is necessary to normalize the resolution of the sample image. The size of the sample images is unified, and specifically, all the plant sample images can be processed into images of the first preset resolution.
步骤102,在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,第二预设分辨率小于第一预设分辨率,多个预 设位置各不相同,多个预设位置中的一个为第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的第二预设分辨率的植物样本子图像互不重叠且可组合成完整的第一预设分辨率的植物样本图像。Step 102: Acquire corresponding multiple plant sample sub-images of a second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the first The preset resolution, multiple preset positions are different, one of the multiple preset positions is the center position of the plant sample image with the first preset resolution, and the other preset positions correspond to the second preset resolution The plant sample sub-images do not overlap each other and can be combined into a complete plant sample image of the first preset resolution.
由于拍摄植物样本图像时,通常是将拍摄焦点对准植物的中心点处进行拍摄,因而拍摄得到的样本图像的不同位置对应的图像信息可能有较大差别,比如图像的底部可能包含较多植物的根部图像,图像的顶部可能包含较多植物的叶子图像,而植物的根部特征与植物的叶子特征的差别较大,因此为了得到更准确的分类结果,本实施例对植株的不同部位进行更具体的建模分析,将植物样本图像的分辨率处理为第一预设分辨率后,按照预设位置对图像进行分块处理,每一张植物样本图像按照多个预设位置进行分块处理后,一张完整的植物样本图像可以分成多个植物样本图像块,其中,每个预设位置对应一个图像块。并且为了保留完整的图像特征,分块处理后得到的图像块能够完整覆盖原有的第一预设分辨率的植物样本图像。Because when shooting plant sample images, the focus is usually at the center of the plant. Therefore, the image information corresponding to different positions of the sample image may be quite different. For example, the bottom of the image may contain more plants. The top of the image may contain more plant leaf images, and the root characteristics of plants are quite different from the leaf characteristics of plants. Therefore, in order to obtain a more accurate classification result, this embodiment performs more detailed analysis on different parts of plants. Specific modeling analysis, after processing the resolution of the plant sample image to the first preset resolution, the image is divided into blocks according to the preset position, and each plant sample image is divided into blocks according to multiple preset positions Then, a complete plant sample image can be divided into multiple plant sample image blocks, where each preset position corresponds to one image block. And in order to preserve the complete image features, the image blocks obtained after the block processing can completely cover the original plant sample image with the first preset resolution.
步骤103,利用与多个预设位置对应的多个第二预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集。Step 103: Using a plurality of plant sample sub-images of a second preset resolution corresponding to a plurality of preset positions, respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions.
对每张植物样本图像进行分块处理后,利用与每个预设位置对应的图像块建立与该预设位置对应的训练样本集以及测试样本集。例如,在样本图像中预设5个位置,分别标为位置1、位置2、位置3、位置4、位置5,将植物样本图像分块处理后分别得到5个位置对应的图像块,分别利用位置1、2、3、4、5对应的图像块建立位置1、2、3、4、5的训练样本集和位置1、2、3、4、5的测试样本集,一般来说训练样本集中的图像数量大于测试样本集的图像数量,本实施例中可以将训练样本集中的图像数量预设为2000张,测试样本集中的图像数量预设为300张,在本实施例中,训练样本集以及测试样本集都包含有对应预设位置的苍术样本图像块和白术样本图像块。After performing block processing on each plant sample image, the image block corresponding to each preset position is used to establish a training sample set and a test sample set corresponding to the preset position. For example, preset 5 positions in the sample image, which are marked as position 1, position 2, position 3, position 4, and position 5. After the plant sample image is divided into blocks, the image blocks corresponding to the 5 positions are obtained. The image blocks corresponding to positions 1, 2, 3, 4, and 5 establish the training sample set of positions 1, 2, 3, 4, and 5 and the test sample set of positions 1, 2, 3, 4, and 5. Generally speaking, training samples The number of images in the set is greater than the number of images in the test sample set. In this embodiment, the number of images in the training sample set can be preset to 2000, and the number of images in the test sample set is preset to 300. In this embodiment, the training sample Both the set and the test sample set contain samples of Atractylodes Rhizome and Atractylodes Rhizome sample image blocks corresponding to preset positions.
步骤104,分别利用与多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与多个预设位置对应的模型识别对应的测试样本集的识别结果满足预设训练终止条件。Step 104: Train multiple ResNet50 convolutional neural network models with training sample sets corresponding to multiple preset positions respectively, until each trained model corresponding to multiple preset positions recognizes the recognition result of the corresponding test sample set Meet the preset training termination conditions.
为了对每个特定的预设位置的图像进行准确识别,分别建立与每个预设位置对应的ResNet50卷积神经网络模型,并利用与每个预设位置对应的训练样本集训练对应预设位置的模型。例如,利用与位置1对应的训练样本集对位置1的模型进行训练。In order to accurately identify the image of each specific preset location, a ResNet50 convolutional neural network model corresponding to each preset location is established, and the training sample set corresponding to each preset location is used to train the corresponding preset location Model. For example, use the training sample set corresponding to position 1 to train the model in position 1.
利用测试样本集对模型进行测试,以验证模型对测试样本集中的样本图像的分类效果,如果经过一次训练后模型的分类效果没有达到预设训练终止条件,则调整模型的相关训练参数后,继续利用测试样本集对模型进行训练,直至满足预设训练终止条件为止。Use the test sample set to test the model to verify the classification effect of the model on the sample images in the test sample set. If the classification effect of the model does not reach the preset training termination condition after one training, adjust the relevant training parameters of the model and continue Use the test sample set to train the model until the preset training termination condition is met.
步骤105,接收待识别的植物图像,并利用训练好的模型对待识别的植物图像的种类进行识别。Step 105: Receive the plant image to be recognized, and use the trained model to recognize the type of plant image to be recognized.
模型训练成功后,就可以利用训练好的模型对待识别的植物图像进行分类,具体可以按照预设位置获取待识别的植物图像的多个图像块后,通过相应的训练好的模型对待识别的植物图像对应的植物种类进行识别。本申请的实施例中,向模型输入待识别的植物图像后,可以得出该图像为苍术图像的概率和该图像为白术图像的概率。After the model is successfully trained, the trained model can be used to classify the plant image to be recognized. Specifically, after obtaining multiple image blocks of the plant image to be recognized according to the preset position, the plant to be recognized can be obtained through the corresponding trained model Identify the plant species corresponding to the image. In the embodiment of the present application, after inputting the plant image to be recognized into the model, the probability that the image is an Atractylodes lancea image and the probability that the image is an Atractylodes macrocephala image can be obtained.
通过应用本实施例的技术方案,通过对植物样本图像的分辨率进行处理,并按照预设位置对植物样本图像进行分块处理后,建立与每个预设位置对应的训练样本集以及测试样本集,从而利用与每个预设位置对应的训练样本集对相应的ResNet50模型进行训练,使得训练后的模型对相应位置的测试样本集的识别效果达到预设训练终止条件后,实现了通过训练后的模型对新的待识别的植物图像的分类。本申请与现有技术中依靠有经验的技术人 员对植物进行人工分类相比,只需拍摄待识别植物的图像,即可通过模型对植物的种类进行识别,提高了植物种类的识别效率,节约了人力成本。By applying the technical solution of this embodiment, by processing the resolution of the plant sample image, and performing block processing on the plant sample image according to the preset position, a training sample set and a test sample corresponding to each preset position are established The training sample set corresponding to each preset position is used to train the corresponding ResNet50 model, so that the trained model can recognize the test sample set at the corresponding position after reaching the preset training termination condition. The latter model classifies the new plant image to be recognized. Compared with the prior art relying on experienced technicians to manually classify plants, this application only needs to take images of the plants to be identified, and the types of plants can be identified through models, which improves the efficiency of identifying plant species and saves money. The labor cost.
进一步的,作为上述实施例具体实施方式的细化和扩展,为了完整说明本实施例的具体实施过程,提供了另一种植物种类的识别方法,如图2所示,该方法包括:Further, as a refinement and extension of the specific implementation of the foregoing embodiment, in order to fully explain the specific implementation process of this embodiment, another method for identifying plant species is provided. As shown in FIG. 2, the method includes:
步骤201,若植物样本图像的分辨率大于第一预设分辨率,则对植物样本图像进行降采样处理,得到第一预设分辨率的植物样本图像。Step 201: If the resolution of the plant sample image is greater than the first preset resolution, down-sampling is performed on the plant sample image to obtain a plant sample image of the first preset resolution.
本申请实施例采用的ResNet50卷积神经网络模型需要输入分辨率为720×540的图像进行训练,因此对于的预设分辨率为720×540,保证图像的清晰度,以便可以对植物样本图像进行进一步的处理,本申请实施例中,将第一预设分辨率设置为1440×1080。The ResNet50 convolutional neural network model used in the embodiments of this application requires an image with a resolution of 720×540 for training. Therefore, the preset resolution is 720×540 to ensure the clarity of the image so that the plant sample image can be processed For further processing, in this embodiment of the application, the first preset resolution is set to 1440×1080.
若植物样本图像的分辨率大于第一预设分辨率,应对图像进行降采样处理使其下降到第一预设分辨率,使全部的植物样本图像的分辨率得到统一,方便后续的图像分块处理等操作以及建立训练样本集和测试样本集。If the resolution of the plant sample image is greater than the first preset resolution, the image should be down-sampled to reduce it to the first preset resolution, so that the resolution of all the plant sample images is unified, and the subsequent image segmentation is convenient Processing and other operations and the establishment of training sample sets and test sample sets.
在本实施例中,具体地,ResNet50模型包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。In this embodiment, specifically, the ResNet50 model includes a 50-layer convolutional layer and a 1-layer fully connected layer that are sequentially connected, where the 50-layer convolutional layer is divided into 5 blocks, and the 5 blocks are respectively denoted as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7×7 convolution kernel, conv2_x includes a convolution layer with a 3×3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 layers of convolution kernels as 3×3 convolutional layers.
ResNet50是一种深度卷积神经网络结构,该网络结构采用残差连接的方式,增加网络结构的深度的同时提高了识别准确性。采用该网络结构可以实现对复杂图像的准确分类。具体包括50层卷积层和1层全连接层(或叫做上采样层),具体地,conv1由一个单一的卷积核为7×7的全卷积层组成;conv2_x由一个3×3卷积核的卷积层和3个瓶颈构建块共计10层组成(每个瓶颈构建块分别包含一层卷积核为1×1、通道数为64的卷积层、一层卷积核为3×3、通道数为64的卷积层、以及一层卷积核为1×1、通道数为256的卷积层);conv3_x由4个瓶颈构建块共计12层组成(每个瓶颈构建块分别包含一层卷积核为1×1、通道数为128的卷积层、一层卷积核为3×3、通道数为128的卷积层、以及一层卷积核为1×1、通道数为512的卷积层);conv4_x由6个瓶颈构建块共计18层组成(每个瓶颈构建块分别包含一层卷积核为1×1、通道数为256的卷积层、一层卷积核为3×3、通道数为256的卷积层、以及一层卷积核为1×1、通道数为1024的卷积层);conv5_x由3个瓶颈构建块共计9层组成(每个瓶颈构建块分别包含一层卷积核为1×1、通道数为512的卷积层、一层卷积核为3×3、通道数为512的卷积层、以及一层卷积核为1×1、通道数为2048的卷积层);本申请实施例中最后经过一个2维的全连接层得到对于2种分类类别(苍术和白术)的预测结果。当然,本领域技术人员可以根据实际需要根据植物样本图像中包含的植物类别的数量调整类别数量,在此仅作为举例说明。ResNet50 is a deep convolutional neural network structure, which uses residual connection to increase the depth of the network structure and improve the recognition accuracy. Using this network structure can achieve accurate classification of complex images. Specifically, it includes 50 layers of convolutional layer and 1 layer of fully connected layer (or called up-sampling layer). Specifically, conv1 consists of a single convolution kernel of 7×7 fully convolutional layers; conv2_x consists of a 3×3 convolution The convolutional layer of the convolution kernel and 3 bottleneck building blocks are composed of a total of 10 layers (each bottleneck building block contains a convolution kernel of 1×1, a convolution layer with 64 channels, and a convolution kernel of 3 ×3, a convolutional layer with 64 channels, and a convolutional layer with a convolution kernel of 1×1 and 256 channels); conv3_x is composed of 4 bottleneck building blocks and a total of 12 layers (each bottleneck building block It contains a convolution kernel of 1×1, a convolutional layer with 128 channels, a convolution kernel of 3×3, a convolutional layer with 128 channels, and a convolution kernel of 1×1 , A convolutional layer with 512 channels); conv4_x is composed of 6 bottleneck building blocks and a total of 18 layers (each bottleneck building block includes a convolution kernel of 1×1, a convolutional layer with 256 channels, a The layer convolution kernel is 3×3, the number of channels is 256 convolutional layers, and the convolution kernel is 1×1, the number of channels is 1024 convolution layers); conv5_x consists of 3 bottleneck building blocks, a total of 9 layers (Each bottleneck building block includes a convolution kernel of 1×1, a convolutional layer with 512 channels, a convolution kernel of 3×3, a convolutional layer with 512 channels, and a layer of convolution The product kernel is a 1×1 convolutional layer with a channel number of 2048); in the embodiment of the present application, a 2-dimensional fully connected layer is finally passed to obtain prediction results for two classification categories (Atractylodes and Atractylodes). Of course, those skilled in the art can adjust the number of categories according to the number of plant categories contained in the plant sample image according to actual needs, and this is just an example for illustration.
步骤202,若植物样本图像的分辨率小于第一预设分辨率,则对植物样本图像进行升采样处理,得到第一预设分辨率的植物样本图像。Step 202: If the resolution of the plant sample image is less than the first preset resolution, perform an up-sampling process on the plant sample image to obtain a plant sample image of the first preset resolution.
如果植物样本图像的分辨率小于第一预设分辨率,也应将该图像的分辨率调整为第一预设分辨率大小,具体可以采用升采样处理方式,对原有的图像进行双线性插值上采样至第一预设分辨率。If the resolution of the plant sample image is less than the first preset resolution, the resolution of the image should also be adjusted to the first preset resolution. Specifically, the up-sampling process can be used to perform bilinear on the original image. Interpolate and upsample to the first preset resolution.
需要说明的是,对图像进行升采样处理可能会对图像的性能造成一定程度的损失,因此,优选分辨率大于或等于的第一预设分辨率的图像作为样本图像。It should be noted that performing up-sampling processing on an image may cause a certain loss of image performance. Therefore, an image with a resolution greater than or equal to the first preset resolution is preferred as the sample image.
步骤203,在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,第二预设分辨率小于第一预设分辨率,多个预 设位置各不相同,多个预设位置中的一个为第一预设分辨率的植物样本图像的的中心位置处,其他的第二预设分辨率的植物样本子图像互不重叠。Step 203: Acquire corresponding multiple plant sample sub-images of a second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the first The preset resolution, multiple preset positions are different, one of the multiple preset positions is the center position of the plant sample image of the first preset resolution, and the other plant samples of the second preset resolution The sub-images do not overlap each other.
本申请的实施例将植物样本图像进行分块处理,根据每张第一预设分辨率的植物样本图像得到与多个预设位置对应的多张分辨率为720×540的植物样本子图像,其中,多个预设位置包括植物样本图像的中心位置,中心位置对应的植物样本图像可以与其他位置对应的植物样本图像有重叠的部分,但是其他位置对应的植物样本图像互相不重叠而且其他位置对应的植物样本子图像应包括整个植物样本图像,以便根据分块后的植物样本图像建立训练样本集和测试样本集,以便将图像中的每个像素点都作为训练的样本,以免损失图像的特征信息,并且由于图像的中心位置处通常是区分植物种类的关键特征信息较为集中的部分,将中心位置处的图像单独提取出来从而进行训练,有助于提升模型的识别准确性。The embodiment of the present application performs block processing on the plant sample image, and obtains multiple plant sample sub-images with a resolution of 720×540 corresponding to multiple preset positions according to each plant sample image with a first preset resolution. Among them, the multiple preset positions include the center position of the plant sample image. The plant sample image corresponding to the center position may overlap with plant sample images corresponding to other positions, but the plant sample images corresponding to other positions do not overlap each other and other positions The corresponding plant sample sub-image should include the entire plant sample image, so that the training sample set and the test sample set can be established based on the divided plant sample image, so that each pixel in the image is used as a training sample to avoid loss of image Feature information, and because the central position of the image is usually the part where the key feature information for distinguishing plant species is relatively concentrated, extracting the image at the central position separately for training will help improve the recognition accuracy of the model.
例如,根据1440×1080分辨率的植物样本图像得到5个720×540分辨率的植物样本图像块。具体分块方式如图3所示,其中分块1的中心与1440×1080分辨率的植物样本图像的中心重合,分块2的左上角的像素点与1440×1080分辨率的植物样本图像的最上角的像素点重合,相似的得到分块3、4、5。For example, according to the 1440×1080 resolution plant sample image, five 720×540 resolution plant sample image blocks are obtained. The specific block method is shown in Figure 3, where the center of block 1 coincides with the center of the 1440×1080 resolution plant sample image, and the pixels in the upper left corner of block 2 correspond to the 1440×1080 resolution plant sample image. The pixels at the top corner coincide, and blocks 3, 4, and 5 are similarly obtained.
步骤204,按照RGB值归一化处理公式,将多个第二预设分别率的植物样本子图像的每个像素点的RGB值进行归一化处理,RGB值归一化处理公式为:Step 204, according to the RGB value normalization processing formula, normalize the RGB value of each pixel of the plant sample sub-images with the second preset resolution ratio, and the RGB value normalization processing formula is:
Figure PCTCN2019097891-appb-000001
Figure PCTCN2019097891-appb-000001
其中,N为RGB通道的最大分量值,x和y分别为原有的和归一化处理后的第二预设分辨率的植物样本子图像对应的任一像素点的R、G、B任一通道的分量值。Among them, N is the maximum component value of the RGB channel, and x and y are the R, G, and B of any pixel corresponding to the original and normalized second preset resolution plant sample sub-image. The component value of a channel.
在建立训练样本集和测试样本集之前,还需要利用上述RGB值归一化处理公式对分块后得到的植物样本图像进行RGB值归一化处理,使样本图像的每个像素点在R、G、B三通道上的分量值由原来的[0,255]变换到[-1,1]之间,使数据分布更加均匀,从而有助于加速模型的训练过程。其中,N取255。Before establishing the training sample set and the test sample set, it is also necessary to use the above RGB value normalization processing formula to normalize the RGB value of the plant sample image obtained after block, so that each pixel of the sample image is in R, The component values on the G and B three channels are transformed from the original [0,255] to [-1,1], which makes the data distribution more uniform, which helps to speed up the training process of the model. Among them, N takes 255.
步骤205,利用RGB值归一化处理后的与多个预设位置对应的多个第二预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集。Step 205: Use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions after the normalization of the RGB values, to respectively establish training sample sets and test samples corresponding to the plurality of preset positions set.
植物样本图像经过RGB值归一化处理处理后,根据与每个预设位置对应的720×540分辨率的植物样本图像建立相应的训练样本集以及测试样本集。在本申请的实施例中,分别建立5个与预设位置对应的训练样本集和5个对应的测试样本集,每个训练样本集中包括2000张不同样本的相同位置的图像,每个测试样本集中包括300张与训练样本集不同的样本的相同位置的图像。After the plant sample image is normalized by RGB values, a corresponding training sample set and a test sample set are established according to the plant sample image with a resolution of 720×540 corresponding to each preset position. In the embodiment of the present application, 5 training sample sets corresponding to preset positions and 5 corresponding test sample sets are respectively established. Each training sample set includes 2000 images of the same position of different samples, and each test sample The set includes 300 images of the same position of samples different from the training sample set.
步骤206,分别利用与多个预设位置对应的训练样本集,按照预设学习率训练对应的模型。Step 206: Use training sample sets corresponding to a plurality of preset positions to train corresponding models according to a preset learning rate.
按照预先设定的学习率对模型利用训练样本集对模型进行训练,例如按照0.01的学习率利用位置1对应的训练样本集训练位置1对应的模型。其中,对于不同位置对应的模型可以设置不同的学习率也可以设置相同的学习率,在此不做限定。The model is trained according to a preset learning rate using a training sample set, for example, a training sample set corresponding to position 1 is used to train a model corresponding to position 1 at a learning rate of 0.01. Among them, different learning rates can be set for models corresponding to different positions, or the same learning rate can be set, which is not limited here.
步骤207,若训练后的模型识别对应的测试样本集的准确率小于预设准确率和/或召回率小于预设召回率,则降低预设学习率,并按照降低后的预设学习率继续训练模型直至训练后的模型识别对应的测试样本集的准确率大于或等于预设准确率且召回率大于或等于预设召回率为止。Step 207: If the accuracy of the trained model to identify the corresponding test sample set is less than the preset accuracy and/or the recall rate is less than the preset recall rate, then the preset learning rate is reduced, and the reduced preset learning rate is continued The model is trained until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate.
按照预设学习率对模型进行训练后,利用训练好的模型对相应的测试样本集进行测试,如果模型的识别准确率和召回率分别大于或等于预设的准确率和召回率,则该模型完 成训练,可以进一步利用该模型对待识别的植物图像进行分类,而如果模型的识别准确率小于预设准确率以及召回率小于预设召回率中满足任何一个,则需要继续对模型进行训练,具体应用比原来的预设学习率更低的学习率进行训练,从而提高模型的识别准确率和召回率直至分别达到对应的预设为止。After training the model according to the preset learning rate, use the trained model to test the corresponding test sample set. If the recognition accuracy and recall rate of the model are greater than or equal to the preset accuracy and recall rates, then the model After the training is completed, the model can be further used to classify the plant images to be recognized. If the recognition accuracy of the model is less than the preset accuracy and the recall rate is less than the preset recall rate, you need to continue to train the model. Use a learning rate lower than the original preset learning rate for training, thereby improving the recognition accuracy and recall rate of the model until the corresponding presets are reached.
例如,假设预设学习率为0.01,预设准确率和召回率都为90%,先使用0.01的学习率训练模型3000遍,每遍包含训练样本集中随机抽取的30张植物样本图像,如果训练后的模型识别准确率和/或召回率小于90%,则再使用0.001的学习率训练模型1000遍,每遍包含训练样本集中随机抽取的30张植物样本图像,再测试训练后的模型的识别准确率和召回率,如果仍然不满足预设条件,可以再次降低学习率继续学习。For example, suppose that the preset learning rate is 0.01, and the preset accuracy and recall rates are both 90%. First use the learning rate of 0.01 to train the model 3000 times, and each pass contains 30 plant sample images randomly selected from the training sample set. After the recognition accuracy and/or recall rate of the model is less than 90%, the model will be trained 1000 times with a learning rate of 0.001. Each pass contains 30 plant sample images randomly selected from the training sample set, and then test the recognition of the trained model If the accuracy and recall rates still do not meet the preset conditions, you can reduce the learning rate again to continue learning.
另外,需要说明的是,与每个预设位置对应的模型可以采用相同的初始学习率,也可以分别设置不同的初始学习率,每个模型对应的预设准确率和召回率可以相同也可以不同,例如中心位置对应的准确率和召回率设置为95%,其他位置对应的准确率和召回率设置为90%。分别测试每个模型的分类准确率和召回率,直到训练后的每个模型的分类准确率和召回率都达到对应的预设为止。In addition, it should be noted that the model corresponding to each preset position can use the same initial learning rate, or different initial learning rates can be set separately, and the preset accuracy and recall rate corresponding to each model can be the same or can be Different, for example, the accuracy rate and recall rate corresponding to the center position are set to 95%, and the accuracy rate and recall rate corresponding to other positions are set to 90%. Test the classification accuracy and recall of each model separately, until the classification accuracy and recall of each model after training reach the corresponding preset.
步骤208,对接收到的待识别的植物图像进行分辨率预处理,以使待识别的植物图像的分辨率与第一预设分辨率一致;Step 208: Perform resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
步骤209,在处理后的待识别的植物图像的多个预设位置处分别获取对应的多个待识别的植物子图像,其中,多个待识别的植物图像中的任一个的分辨率与第二预设分辨率一致;Step 209: Acquire corresponding multiple plant sub-images to be recognized at multiple preset positions of the processed plant image to be recognized, wherein the resolution of any one of the multiple plant images to be recognized and the first 2. The preset resolution is consistent;
步骤210,按照RGB值归一化处理公式,分别对与多个预设位置对应的待识别的植物子图像的每个像素点的RGB值进行归一化处理;Step 210: Perform normalization processing on the RGB value of each pixel of the plant sub-image to be identified corresponding to a plurality of preset positions according to the RGB value normalization processing formula;
步骤211,分别将RGB值归一化处理后的与多个预设位置对应的待识别的植物子图像输入至对应的训练好的模型中,得到分别与多个预设位置对应的待识别的植物子图像的多个识别结果。Step 211: Input the plant sub-images to be identified corresponding to the multiple preset positions after the normalization of the RGB values into the corresponding trained model to obtain the to-be-identified plant sub-images corresponding to the multiple preset positions respectively. Multiple recognition results of plant sub-images.
在上述步骤208至步骤211中,模型训练完成后,可以实现对待识别的植物图像的分类。具体地,接收到待识别的植物图像后,与植物样本图像的处理过程相似,先将图像的分辨率处理为第一预设分辨率,然后按照多个预设位置对图像进行分块处理,得到与每个预设位置对应的待识别植物图像,再对每张待识别的植物图像的每个像素点的RGB值进行归一化处理,最后分别将每个预设位置对应的待识别图像输入至对应的模型中得到与每个预设位置对应的识别结果。In the above steps 208 to 211, after the model training is completed, the classification of the plant image to be recognized can be realized. Specifically, after receiving the plant image to be identified, the processing procedure is similar to that of the plant sample image. The resolution of the image is first processed to the first preset resolution, and then the image is divided into blocks according to multiple preset positions. Obtain the plant image to be identified corresponding to each preset position, and then normalize the RGB value of each pixel of each plant image to be identified, and finally, respectively, the image to be identified corresponding to each preset position Input into the corresponding model to obtain the recognition result corresponding to each preset position.
例如,将与5个预设位置的对应的待识别图像分别输入至对应的模型中,分别得到与5个预设位置对应的待识别图像的识别结果。For example, the images to be recognized corresponding to 5 preset positions are input into the corresponding models respectively, and the recognition results of the images to be recognized corresponding to the 5 preset positions are obtained respectively.
步骤212,按照与多个预设位置对应的预设权重,对多个识别结果进行加权求和计算,得到待识别的图像的识别结果,其中,中心位置处的待识别的植物子图像对应的预设权重大于其他位置处的待识别的植物子图像对应的预设权重。Step 212: Perform a weighted sum calculation on the multiple recognition results according to the preset weights corresponding to the multiple preset positions to obtain the recognition result of the image to be recognized, where the plant sub-image at the center position corresponds to the The preset weight is greater than the preset weight corresponding to the plant sub-images to be identified at other locations.
分别得到与每个预设位置对应的识别结果后,按照相应的预设权重将识别结果进行加权求和计算得到待识别的图像的最终识别结果。其中,中心位置处可能包含的关键特征信息较多,应作为确定最终识别结果的主要参考因素,因此其对应的权重应高于其他位置处对应的权重,从而得到更准确的识别结果。After obtaining the recognition result corresponding to each preset position, the recognition result is weighted and calculated according to the corresponding preset weight to obtain the final recognition result of the image to be recognized. Among them, the central location may contain more key feature information, which should be used as the main reference factor to determine the final recognition result. Therefore, its corresponding weight should be higher than the corresponding weights at other locations to obtain more accurate recognition results.
例如,5个预设位置中中心位置处对应的权重设为0.4,其余4个位置对应的权重分别设为0.15,假设中心位置处的识别结果为中心位置对应的图像为苍术的概率是80%,白术概率是10%,其余4个位置的识别结果为对应的图像为苍术的概率分别为40%、90%、80%、 80%;为白术的概率分别为80%、20%、30%、20%。那么该待识别的植物图像为苍术的概率为80%*0.4+40%*0.15+90%*0.15+80%*0.15+80%*0.15=75.5%,该图像为白术的概率为10%*0.4+80%*0.15+20%*0.15+30%*0.15+20%*0.15=26.5%。那么可以根据苍术概率75.5%和白术概率26.5%确定待识别的植物图像的种类。For example, the weight corresponding to the center position in the 5 preset positions is set to 0.4, and the weight corresponding to the remaining 4 positions is set to 0.15 respectively. Assuming that the recognition result at the center position is that the image corresponding to the center position is atractylodes, the probability is 80% , The probability of Atractylodes macrocephala is 10%, and the recognition results of the remaining 4 positions are 40%, 90%, 80%, 80% of the corresponding image; the probability of Atractylodes macrocephala is 80%, 20%, 30%. , 20%. Then the probability that the plant image to be identified is Atractylodes is 80%*0.4+40%*0.15+90%*0.15+80%*0.15+80%*0.15=75.5%, and the probability that the image is Atractylodes is 10%* 0.4+80%*0.15+20%*0.15+30%*0.15+20%*0.15=26.5%. Then, the type of plant image to be recognized can be determined according to the 75.5% probability of atractylodes and 26.5% probability of atractylodes.
具体地,可以设置规定为:若识别结果为第一种类植物的概率大于或等于第一预设概率且第二种类植物的概率小于第二预设概率,则确定待识别的植物图像对应的植物种类为第一种类植物。例如第一预设概率为70%,第二预设概率为30%,那么可以判定上述的待识别的植物图像对应的种类为苍术。而如果识别结果为苍术概率60%,白术概率40%,则可以介入人工判断或继续判断该图像是否为其他植物图像。Specifically, a rule can be set as follows: if the probability of the recognition result of the first type of plant is greater than or equal to the first preset probability and the probability of the second type of plant is less than the second preset probability, determine the plant corresponding to the plant image to be recognized The species is the first kind of plant. For example, the first preset probability is 70% and the second preset probability is 30%, then it can be determined that the type corresponding to the above-mentioned plant image to be recognized is atractylodes. If the recognition result is that the probability of atractylodes is 60% and the probability of atractylodes is 40%, then manual judgment can be involved or continue to judge whether the image is another plant image.
另外,也可以比较两种植物识别结果的植物种类对应的概率大小,将概率大的植物种类确定为待识别的植物图像的种类。例如识别结果为苍术概率60%,白术概率40%,则判定该图像为苍术图像。In addition, it is also possible to compare the probabilities corresponding to the plant species of the two plant identification results, and determine the plant species with a higher probability as the species of the plant image to be recognized. For example, if the recognition result is that the probability of atractylodes is 60% and the probability of atractylodes is 40%, it is determined that the image is atractylodes image.
通过应用本实施例的技术方案,将一张植物样本图像进行分块处理得到与多个预设位置对应的多块植物样本图像,从而建立与不同的预设位置对应的训练样本集和测试样本集,进而分别利用与每个预设位置对应的训练样本集训练相应的分类模型,使每个分类模型对相应的训练样本集的识别准确率和召回率都满足对应的预设条件,得到最终可以用于对待识别的植物图像进行分类的模型。当接收到待识别的植物图像时,将待识别的植物图像按照预设位置分块处理后,分别输入至对应的分类模型中,从而根据每个分类模型的识别结果确定最终的待识别植物图像的分类结果。本申请的实施例有助于解决现有技术中依靠人工进行植物种类识别导致的效率低下的问题,并且分别训练与不同预设位置对应的分类模型,综合多个分类模型的识别结果确定最终的待识别图像的分类结果,提高了识别的准确性和识别效率。By applying the technical solution of this embodiment, a piece of plant sample image is processed into blocks to obtain multiple plant sample images corresponding to multiple preset positions, thereby establishing training sample sets and test samples corresponding to different preset positions The training sample set corresponding to each preset position is used to train the corresponding classification model, so that the recognition accuracy and recall rate of each classification model for the corresponding training sample set meet the corresponding preset conditions, and the final It can be used as a model for classifying plant images to be recognized. When the plant image to be recognized is received, the plant image to be recognized is divided into blocks according to the preset position and then input into the corresponding classification model, so as to determine the final plant image to be recognized according to the recognition result of each classification model The classification results. The embodiments of this application help solve the problem of low efficiency caused by artificial recognition of plant species in the prior art, and separately train classification models corresponding to different preset positions, and integrate the recognition results of multiple classification models to determine the final The classification result of the image to be recognized improves the accuracy and efficiency of recognition.
进一步的,作为图1方法的具体实现,本申请实施例提供了一种植物种类的识别装置,如图4所示,该装置包括:样本分辨率处理模块41、样本分块处理模块42、样本集建立模块43、模型训练模块44、图像识别模块45。Further, as a specific implementation of the method in FIG. 1, an embodiment of the present application provides a plant species identification device. As shown in FIG. 4, the device includes: a sample resolution processing module 41, a sample block processing module 42, and a sample Set building module 43, model training module 44, and image recognition module 45.
样本分辨率处理模块41,用于对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;The sample resolution processing module 41 is configured to perform resolution preprocessing on the plant sample image to obtain a plant sample image of the first preset resolution;
样本分块处理模块42,用于在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,第二预设分辨率小于第一预设分辨率,多个预设位置各不相同,多个预设位置中的一个为第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的第二预设分辨率的植物样本子图像互不重叠且可组合成完整的第一预设分辨率的植物样本图像;The sample block processing module 42 is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution. Suppose the resolution is smaller than the first preset resolution, and the multiple preset positions are different. One of the multiple preset positions is the center position of the plant sample image with the first preset resolution, and the other preset positions correspond to The plant sample sub-images of the second preset resolution do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
样本集建立模块43,用于利用与多个预设位置对应的多个第二预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集;The sample set establishment module 43 is configured to use a plurality of plant sample sub-images of a second preset resolution corresponding to a plurality of preset positions to respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions;
模型训练模块44,用于分别利用与多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与多个预设位置对应的模型识别对应的测试样本集的识别结果满足预设训练终止条件;The model training module 44 is used to train multiple ResNet50 convolutional neural network models using training sample sets corresponding to multiple preset positions, until each trained model corresponding to multiple preset positions recognizes a corresponding test sample The recognition result of the set meets the preset training termination condition;
图像识别模块45,用于接收待识别的植物图像,并利用训练好的模型对待识别的植物图像的种类进行识别。The image recognition module 45 is used to receive the plant image to be recognized, and use the trained model to recognize the type of the plant image to be recognized.
在具体的应用场景中,如图5所示,样本分辨率处理模块41,具体包括:样本降采样单元411、样本升采样单元412。In a specific application scenario, as shown in FIG. 5, the sample resolution processing module 41 specifically includes: a sample down-sampling unit 411 and a sample up-sampling unit 412.
样本降采样单元411,用于若植物样本图像的分辨率大于第一预设分辨率,则对植物样本图像进行降采样处理,得到第一预设分辨率的植物样本图像;The sample down-sampling unit 411 is configured to perform down-sampling processing on the plant sample image if the resolution of the plant sample image is greater than the first preset resolution to obtain a plant sample image of the first preset resolution;
样本升采样单元412,用于若植物样本图像的分辨率小于第一预设分辨率,则对植物样本图像进行升采样处理,得到第一预设分辨率的植物样本图像。The sample up-sampling unit 412 is configured to perform an up-sampling process on the plant sample image if the resolution of the plant sample image is less than the first preset resolution to obtain a plant sample image of the first preset resolution.
在具体的应用场景中,如图5所示,该装置还包括:RGB值归一化模块46。In a specific application scenario, as shown in FIG. 5, the device further includes: an RGB value normalization module 46.
RGB值归一化模块46,用于在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像之后,按照RGB值归一化处理公式,将多个第二预设分别率的植物样本子图像的每个像素点的RGB值进行归一化处理,RGB值归一化处理公式为:The RGB value normalization module 46 is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, and then according to the RGB value The normalization processing formula is to normalize the RGB value of each pixel of a plurality of plant sample sub-images with a second preset resolution. The RGB value normalization processing formula is:
Figure PCTCN2019097891-appb-000002
Figure PCTCN2019097891-appb-000002
其中,N为RGB通道的最大分量值,x和y分别为原有的和归一化处理后的第二预设分辨率的植物样本子图像对应的任一像素点的R、G、B任一通道的分量值;Among them, N is the maximum component value of the RGB channel, and x and y are the R, G, and B of any pixel corresponding to the original and normalized second preset resolution plant sample sub-image. The component value of a channel;
样本集建立模块43,具体用于利用RGB值归一化处理后的与多个预设位置对应的多个第二预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集。The sample set establishment module 43 is specifically configured to use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions after the normalization of the RGB values to establish the respective sub-images corresponding to the plurality of preset positions Training sample set and test sample set.
在具体的应用场景中,如图5所示,图像识别模块45,具体包括:图像分辨率处理单元451、图像分块单元452、图像RGB值归一化单元453、图像识别单元454、识别结果计算单元455。In a specific application scenario, as shown in FIG. 5, the image recognition module 45 specifically includes: an image resolution processing unit 451, an image block unit 452, an image RGB value normalization unit 453, an image recognition unit 454, and a recognition result Calculating unit 455.
图像分辨率处理单元451,用于对接收到的待识别的植物图像进行分辨率预处理,以使待识别的植物图像的分辨率与第一预设分辨率一致;The image resolution processing unit 451 is configured to perform resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
图像分块单元452,用于在处理后的待识别的植物图像的多个预设位置处分别获取对应的多个待识别的植物图像,其中,多个待识别的植物图像中的任一个的分辨率与第二预设分辨率一致;The image segmentation unit 452 is configured to obtain corresponding multiple plant images to be recognized at multiple preset positions of the processed plant images to be recognized, where any one of the multiple plant images to be recognized The resolution is consistent with the second preset resolution;
图像RGB值归一化单元453,用于按照RGB值归一化处理公式,分别对与多个预设位置对应的待识别的植物子图像的每个像素点的RGB值进行归一化处理;The image RGB value normalization unit 453 is configured to perform normalization processing on the RGB value of each pixel of the plant sub-image to be identified corresponding to a plurality of preset positions according to the RGB value normalization processing formula;
图像识别单元454,用于分别将RGB值归一化处理后的与多个预设位置对应的待识别的植物子图像输入至对应的训练好的模型中,得到分别与多个预设位置对应的待识别的植物子图像的多个识别结果;The image recognition unit 454 is configured to input the sub-images of plants to be recognized corresponding to the multiple preset positions after the normalization of the RGB values into the corresponding trained model, and obtain the sub-images corresponding to the multiple preset positions. Multiple recognition results of the plant sub-images to be recognized;
识别结果计算单元455,用于按照与多个预设位置对应的预设权重,对多个识别结果进行加权求和计算,得到待识别的图像的识别结果,其中,中心位置处的待识别的植物子图像对应的预设权重大于其他位置处的待识别的植物子图像对应的预设权重。The recognition result calculation unit 455 is configured to perform a weighted sum calculation on the multiple recognition results according to the preset weights corresponding to the multiple preset positions to obtain the recognition result of the image to be recognized. The preset weights corresponding to the plant sub-images are greater than the preset weights corresponding to the plant sub-images to be identified at other locations.
在具体的应用场景中,如图5所示,模型训练模块44,具体包括:第一模型训练单元441、第二模型训练单元442。In a specific application scenario, as shown in FIG. 5, the model training module 44 specifically includes: a first model training unit 441 and a second model training unit 442.
第一模型训练单元441,用于分别利用与多个预设位置对应的训练样本集,按照预设学习率训练对应的模型;The first model training unit 441 is configured to use training sample sets corresponding to multiple preset positions to train the corresponding model according to the preset learning rate;
第二模型训练单元442,用于若训练后的模型识别对应的测试样本集的准确率小于预设准确率和/或召回率小于预设召回率,则降低预设学习率,并按照降低后的预设学习率继续训练模型直至训练后的模型识别对应的测试样本集的准确率大于或等于预设准确率且召回率大于或等于预设召回率为止。The second model training unit 442 is configured to reduce the preset learning rate if the accuracy of the trained model to identify the corresponding test sample set is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate, and according to the reduced Continue to train the model until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate.
在上述实施例中,具体地,模型的网络结构包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。In the above embodiment, specifically, the network structure of the model includes 50 layers of convolutional layers and 1 layer of fully connected layers that are sequentially connected, where the 50 layers of convolutional layers are divided into 5 blocks, and the 5 blocks are respectively denoted as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7×7 convolution kernel, conv2_x includes a convolutional layer with a 3×3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck constructions Block; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 convolutional layers with a 3×3 convolution kernel.
需要说明的是,本申请实施例提供的一种植物种类的识别装置所涉及各功能单元的其他相应描述,可以参考图1和图2中的对应描述,在此不再赘述。It should be noted that, for other corresponding descriptions of the functional units involved in the device for identifying plant species provided in the embodiments of the present application, reference may be made to the corresponding descriptions in FIG. 1 and FIG. 2, and details are not repeated here.
基于上述如图1和图2所示方法,相应的,本申请实施例还提供了一种计算机非易失性可读存储介质,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现以下步骤:对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,第二预设分辨率小于第一预设分辨率,多个预设位置各不相同,多个预设位置中的一个为第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的第二预设分辨率的植物样本子图像互不重叠且可组合成完整的第一预设分辨率的植物样本图像;利用与多个预设位置对应的多个第二预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集;分别利用与多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与多个预设位置对应的模型识别对应的测试样本集的识别结果满足预设训练终止条件;接收待识别的植物图像,并利用训练好的模型对待识别的植物图像的种类进行识别。Based on the above-mentioned method shown in Figure 1 and Figure 2, correspondingly, an embodiment of the present application also provides a computer non-volatile readable storage medium, on which computer readable instructions are stored, and the computer readable instructions are processed The following steps are implemented when the device is executed: the resolution preprocessing of the plant sample image is performed to obtain the plant sample image of the first preset resolution; the corresponding plant sample images of the first preset resolution are obtained at multiple preset positions. A plurality of plant sample sub-images of a second preset resolution, wherein the second preset resolution is less than the first preset resolution, the plurality of preset positions are different, and one of the plurality of preset positions is the first At the center position of a plant sample image of a preset resolution, the plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution ; Using a plurality of sub-images of plant samples of a second preset resolution corresponding to a plurality of preset positions to respectively establish a training sample set and a test sample set corresponding to the plurality of preset positions; respectively using a plurality of preset positions The corresponding training sample set trains multiple ResNet50 convolutional neural network models, until the recognition result of the test sample set corresponding to the model identification corresponding to multiple preset positions meets the preset training termination condition; receive the to-be-identified Plant images, and use the trained model to recognize the types of plant images to be recognized.
基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施场景所述的方法。Based on this understanding, the technical solution of this application can be embodied in the form of a software product. The software product can be stored in a non-volatile storage medium (which can be a CD-ROM, U disk, mobile hard disk, etc.), including several The instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute the methods described in each implementation scenario of this application.
基于上述如图1所示方法和如图4所示装置的实施例,本申请实施例还提供了一种计算机设备的实体结构图,如图6所示,该计算机设备包括:处理器51、存储器52、及存储在存储器52上并可在处理器上运行的计算机可读指令,其中存储器52和处理器51均设置在总线53上处理器51执行程序时实现以下步骤:对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;在第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,第二预设分辨率小于第一预设分辨率,多个预设位置各不相同,多个预设位置中的一个为第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的第二预设分辨率的植物样本子图像互不重叠且可组合成完整的第一预设分辨率的植物样本图像;利用与多个预设位置对应的多个第二 预设分辨率的植物样本子图像,分别建立与多个预设位置对应的训练样本集和测试样本集;分别利用与多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与多个预设位置对应的模型识别对应的测试样本集的识别结果满足预设训练终止条件;接收待识别的植物图像,并利用训练好的模型对待识别的植物图像的种类进行识别。该计算机设备还包括:总线53,被配置为耦接处理器51及存储器52。Based on the above-mentioned method shown in FIG. 1 and the embodiment of the apparatus shown in FIG. 4, an embodiment of the present application also provides a physical structure diagram of a computer device. As shown in FIG. 6, the computer device includes: a processor 51, The memory 52 and computer-readable instructions stored on the memory 52 and capable of running on the processor, wherein the memory 52 and the processor 51 are both set on the bus 53 and the processor 51 implements the following steps when the processor 51 executes the program: Resolution preprocessing to obtain a plant sample image of a first preset resolution; obtain a plurality of corresponding plant samples of a second preset resolution at a plurality of preset positions of the plant sample image of the first preset resolution A sub-image, wherein the second preset resolution is smaller than the first preset resolution, the multiple preset positions are different, and one of the multiple preset positions is the center position of the plant sample image with the first preset resolution Where, the plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution; multiple The plant sample sub-images of the second preset resolution are respectively established for training sample sets and test sample sets corresponding to multiple preset positions; training multiple ResNet50 convolutional nerves are respectively used with the training sample sets corresponding to multiple preset positions Network model, until the recognition result of the test sample set corresponding to each trained model corresponding to multiple preset positions meets the preset training termination condition; receive the plant image to be recognized, and use the trained model to recognize the target The type of plant image is recognized. The computer device also includes a bus 53 configured to couple the processor 51 and the memory 52.
可选地,该计算机设备还可以包括用户接口、网络接口、摄像头、射频(Radio Frequency,RF)电路,传感器、音频电路、WI-FI模块等等。用户接口可以包括显示屏(Display)、输入单元比如键盘(Keyboard)等,可选用户接口还可以包括USB接口、读卡器接口等。网络接口可选的可以包括标准的有线接口、无线接口(如蓝牙接口、WI-FI接口)等。Optionally, the computer device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and so on. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, and the like. The network interface can optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.
存储器中还可以包括操作系统、网络通信模块。操作系统是管理计算机设备硬件和软件资源的程序,支持信息处理程序以及其它软件和/或程序的运行。网络通信模块用于实现存储器内部各组件之间的通信,以及与该实体设备中其它硬件和软件之间通信。The memory may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of computer equipment, and supports the operation of information processing programs and other software and/or programs. The network communication module is used to realize the communication between the various components in the memory and the communication with other hardware and software in the physical device.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本申请可以借助软件加必要的通用硬件平台的方式来实现,也可以通过硬件实现通过应用本实施例的技术方案。Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus a necessary general hardware platform, or can be implemented by hardware by applying the technical solutions of this embodiment.

Claims (20)

  1. 一种植物种类的识别方法,其特征在于,包括:A method for identifying plant species, characterized in that it includes:
    对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
    在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
    利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
    分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
    接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  2. 根据权利要求1所述的方法,其特征在于,所述分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件,具体包括:The method according to claim 1, wherein the training sample sets corresponding to the plurality of preset positions are used to train a plurality of ResNet50 convolutional neural network models, until each trained and the plurality of The recognition result of the model recognition corresponding to the test sample set corresponding to the preset positions meets the preset training termination condition, which specifically includes:
    分别利用与所述多个预设位置对应的训练样本集,按照预设学习率训练对应的所述模型;Training the corresponding model according to the preset learning rate by respectively using the training sample sets corresponding to the multiple preset positions;
    若训练后的所述模型识别对应的所述测试样本集的准确率小于所述预设准确率和/或召回率小于所述预设召回率,则降低所述预设学习率,并按照降低后的预设学习率继续训练所述模型直至训练后的所述模型识别对应的所述测试样本集的准确率大于或等于所述预设准确率且召回率大于或等于所述预设召回率为止。If the accuracy rate of the model identification corresponding to the test sample set after training is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate, then the preset learning rate is reduced, and according to the decrease After the preset learning rate, continue to train the model until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate until.
  3. 根据权利要求1所述的方法,其特征在于,所述模型的网络结构包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。The method according to claim 1, wherein the network structure of the model includes 50 layers of convolutional layers and 1 layer of fully connected layers that are sequentially connected, wherein the 50 layers of convolutional layers are divided into 5 blocks, and 5 The blocks are represented as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7×7 convolution kernel, and conv2_x includes a convolutional layer with a 3×3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 layers of convolution kernels with 3×3 convolutional layers.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像,具体包括:The method according to any one of claims 1 to 3, wherein the performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution specifically comprises:
    若所述植物样本图像的分辨率大于所述第一预设分辨率,则对所述植物样本图像进行降采样处理,得到所述第一预设分辨率的植物样本图像;If the resolution of the plant sample image is greater than the first preset resolution, performing down-sampling processing on the plant sample image to obtain a plant sample image of the first preset resolution;
    若所述植物样本图像的分辨率小于所述第一预设分辨率,则对所述植物样本图像进行升采样处理,得到所述第一预设分辨率的植物样本图像。If the resolution of the plant sample image is less than the first preset resolution, performing upsampling processing on the plant sample image to obtain a plant sample image of the first preset resolution.
  5. 根据权利要求4所述的方法,其特征在于,所述在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本图像之后,所述 方法还包括:The method according to claim 4, wherein the corresponding multiple plant samples of the second preset resolution are respectively obtained at multiple preset positions of the plant sample image of the first preset resolution After the image, the method further includes:
    按照RGB值归一化处理公式,将多个所述第二预设分别率的植物样本子图像的每个像素点的RGB值进行归一化处理,所述RGB值归一化处理公式为:According to the RGB value normalization processing formula, the RGB value of each pixel of the plurality of plant sample sub-images with the second preset resolution ratio is normalized, and the RGB value normalization processing formula is:
    Figure PCTCN2019097891-appb-100001
    Figure PCTCN2019097891-appb-100001
    其中,N为RGB通道的最大分量值,x和y分别为原有的和归一化处理后的所述第二预设分辨率的植物样本子图像对应的任一像素点的R、G、B任一通道的分量值;Where, N is the maximum component value of the RGB channel, and x and y are the original and normalized R, G, and G of any pixel corresponding to the plant sample sub-image of the second preset resolution, respectively. The component value of any channel of B;
    利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集,具体包括:Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions , Specifically including:
    利用RGB值归一化处理后的与所述多个预设位置对应的多个所述第二预设分辨率的植物样本图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集。The plurality of plant sample images of the second preset resolution corresponding to the plurality of preset positions after RGB value normalization processing are used to respectively establish the training samples corresponding to the plurality of preset positions Set and the test sample set.
  6. 根据权利要求5所述的方法,其特征在于,所述接收待识别的植物图像,并利用所述训练好的模型对所述待识别的植物图像的种类进行识别,具体包括:The method according to claim 5, wherein the receiving the plant image to be recognized and using the trained model to recognize the type of the plant image to be recognized specifically comprises:
    对接收到的所述待识别的植物图像进行分辨率预处理,以使所述待识别的植物图像的分辨率与所述第一预设分辨率一致;Performing resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
    在处理后的所述待识别的植物图像的所述多个预设位置处分别获取对应的多个待识别的植物子图像,其中,所述多个待识别的植物子图像中的任一个的分辨率与所述第二预设分辨率一致;Acquire corresponding multiple plant sub-images to be recognized at the multiple preset positions of the processed plant image to be recognized, wherein any one of the multiple plant sub-images to be recognized is The resolution is consistent with the second preset resolution;
    按照所述RGB值归一化处理公式,分别对与所述多个预设位置对应的待识别的植物子图像的每个像素点的RGB值进行归一化处理;According to the RGB value normalization processing formula, the RGB value of each pixel of the plant sub-image to be recognized corresponding to the plurality of preset positions is respectively normalized;
    分别将RGB值归一化处理后的与所述多个预设位置对应的待识别的植物子图像输入至对应的所述训练好的模型中,得到分别与所述多个预设位置对应的待识别的植物子图像的多个识别结果;The sub-images of plants to be recognized corresponding to the plurality of preset positions after the normalization of the RGB values are input into the corresponding trained model to obtain the sub-images respectively corresponding to the plurality of preset positions Multiple recognition results of plant sub-images to be recognized;
    按照与所述多个预设位置对应的预设权重,对所述多个识别结果进行加权求和计算,得到所述待识别的图像的识别结果,其中,所述中心位置处的所述待识别的植物子图像对应的预设权重大于其他位置处的所述待识别的植物子图像对应的预设权重。According to the preset weights corresponding to the multiple preset positions, the multiple recognition results are weighted and calculated to obtain the recognition result of the image to be recognized, wherein the to-be-recognized image at the center position The preset weight corresponding to the recognized plant sub-image is greater than the preset weight corresponding to the plant sub-image to be recognized at other locations.
  7. 一种植物种类的识别装置,其特征在于,包括:A plant species identification device, characterized in that it comprises:
    样本分辨率处理模块,用于对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;The sample resolution processing module is used to perform resolution preprocessing on the plant sample image to obtain the plant sample image of the first preset resolution;
    样本分块处理模块,用于在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;The sample block processing module is configured to obtain corresponding multiple plant sample sub-images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, wherein the The second preset resolution is smaller than the first preset resolution, the plurality of preset positions are different from each other, and one of the plurality of preset positions is a plant sample image of the first preset resolution The plant sample sub-images of the second preset resolution corresponding to other preset positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
    样本集建立模块,用于利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;The sample set establishment module is configured to use the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training samples corresponding to the plurality of preset positions Set and the test sample set;
    模型训练模块,用于分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;The model training module is used to train multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions, until each trained model corresponding to the multiple preset positions recognizes the corresponding The recognition result of the test sample set meets a preset training termination condition;
    图像识别模块,用于接收待识别的植物图像,并利用训练好的所述模型对所述待识别 的植物图像的种类进行识别。The image recognition module is used to receive the plant image to be recognized, and use the trained model to recognize the type of the plant image to be recognized.
  8. 根据权利要求7所述的装置,其特征在于,所述模型训练模块具体包括:The device according to claim 7, wherein the model training module specifically comprises:
    第一模型训练单元,用于分别利用与所述多个预设位置对应的训练样本集,按照预设学习率训练对应的所述模型;The first model training unit is configured to use training sample sets corresponding to the multiple preset positions to train the corresponding model according to the preset learning rate;
    第二模型训练单元,用于若训练后的所述模型识别对应的所述测试样本集的准确率小于所述预设准确率和/或召回率小于所述预设召回率,则降低所述预设学习率,并按照降低后的预设学习率继续训练所述模型直至训练后的所述模型识别对应的所述测试样本集的准确率大于或等于所述预设准确率且召回率大于或等于所述预设召回率为止。The second model training unit is configured to reduce the accuracy rate of the test sample set corresponding to the model recognition after training is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate Preset learning rate, and continue training the model according to the reduced preset learning rate until the accuracy of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy and the recall rate is greater than Or equal to the preset recall rate.
  9. 根据权利要求7所述的装置,其特征在于,所述模型的网络结构包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。The device according to claim 7, wherein the network structure of the model includes 50 layers of convolutional layers and 1 layer of fully connected layers that are sequentially connected, wherein the 50 layers of convolutional layers are divided into 5 blocks, and 5 The blocks are represented as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a 7×7 convolution kernel, and conv2_x includes a convolutional layer with a 3×3 convolution kernel and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, and each bottleneck building block includes 3 layers of convolution kernels with 3×3 convolutional layers.
  10. 根据权利要求7至9中任一项所述的装置,其特征在于,所述样本分辨率处理模块,具体包括:The device according to any one of claims 7 to 9, wherein the sample resolution processing module specifically comprises:
    样本降采样单元,用于若所述植物样本图像的分辨率大于所述第一预设分辨率,则对所述植物样本图像进行降采样处理,得到所述第一预设分辨率的植物样本图像;A sample down-sampling unit, configured to perform down-sampling processing on the plant sample image if the resolution of the plant sample image is greater than the first preset resolution to obtain a plant sample of the first preset resolution image;
    样本升采样单元,用于若所述植物样本图像的分辨率小于所述第一预设分辨率,则对所述植物样本图像进行升采样处理,得到所述第一预设分辨率的植物样本图像。A sample up-sampling unit, configured to perform up-sampling processing on the plant sample image if the resolution of the plant sample image is less than the first preset resolution to obtain a plant sample of the first preset resolution image.
  11. 根据权利要求10所述的装置,其特征在于,还包括:The device according to claim 10, further comprising:
    RGB值归一化模块,用于在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本图像之后,按照RGB值归一化处理公式,将多个所述第二预设分别率的植物样本子图像的每个像素点的RGB值进行归一化处理,所述RGB值归一化处理公式为:The RGB value normalization module is used to obtain corresponding multiple plant sample images of the second preset resolution at multiple preset positions of the plant sample image of the first preset resolution, and then according to the RGB value The normalization processing formula is to perform normalization processing on the RGB value of each pixel of the plant sample sub-images of the plurality of the second preset resolution ratios, and the RGB value normalization processing formula is:
    Figure PCTCN2019097891-appb-100002
    Figure PCTCN2019097891-appb-100002
    其中,N为RGB通道的最大分量值,x和y分别为原有的和归一化处理后的所述第二预设分辨率的植物样本子图像对应的任一像素点的R、G、B任一通道的分量值;Where, N is the maximum component value of the RGB channel, and x and y are the original and normalized R, G, and G of any pixel corresponding to the plant sample sub-image of the second preset resolution, respectively. The component value of any channel of B;
    所述样本集建立模块43,具体用于利用RGB值归一化处理后的与所述多个预设位置对应的多个所述第二预设分辨率的植物样本图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集。The sample set establishment module 43 is specifically configured to use the RGB value normalized processing and the plurality of plant sample images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the The training sample set and the test sample set corresponding to a plurality of preset positions.
  12. 根据权利要求11所述的装置,其特征在于,所述图像识别模块,具体包括:The device according to claim 11, wherein the image recognition module specifically comprises:
    图像分辨率处理单元,用于对接收到的所述待识别的植物图像进行分辨率预处理,以使所述待识别的植物图像的分辨率与所述第一预设分辨率一致;An image resolution processing unit, configured to perform resolution preprocessing on the received plant image to be recognized, so that the resolution of the plant image to be recognized is consistent with the first preset resolution;
    图像分块单元,用于在处理后的所述待识别的植物图像的所述多个预设位置处分别获取对应的多个待识别的植物子图像,其中,所述多个待识别的植物子图像中的任一个的分辨率与所述第二预设分辨率一致;The image segmentation unit is configured to obtain corresponding multiple plant sub-images to be recognized at the multiple preset positions of the processed plant image to be recognized, wherein the multiple plants to be recognized The resolution of any one of the sub-images is consistent with the second preset resolution;
    图像RGB值归一化单元,用于按照所述RGB值归一化处理公式,分别对与所述多个预设位置对应的待识别的植物子图像的每个像素点的RGB值进行归一化处理;The image RGB value normalization unit is used to normalize the RGB value of each pixel of the plant sub-image to be identified corresponding to the multiple preset positions according to the RGB value normalization processing formula Chemical treatment
    图像识别单元,用于分别将RGB值归一化处理后的与所述多个预设位置对应的待识别的植物子图像输入至对应的所述训练好的模型中,得到分别与所述多个预设位置对应的待识别的植物子图像的多个识别结果;The image recognition unit is configured to input the sub-images of plants to be recognized corresponding to the plurality of preset positions after the normalization of the RGB values into the corresponding trained models to obtain the Multiple recognition results of plant sub-images to be recognized corresponding to each preset position;
    识别结果计算单元,用于按照与所述多个预设位置对应的预设权重,对所述多个识别结果进行加权求和计算,得到所述待识别的图像的识别结果,其中,所述中心位置处的所述待识别的植物子图像对应的预设权重大于其他位置处的所述待识别的植物子图像对应的预设权重。The recognition result calculation unit is configured to perform a weighted sum calculation on the multiple recognition results according to the preset weights corresponding to the multiple preset positions to obtain the recognition result of the image to be recognized, wherein the The preset weight corresponding to the plant sub-image to be recognized at the center position is greater than the preset weight corresponding to the plant sub-image to be recognized at other positions.
  13. 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现植物种类的识别方法,包括:A computer non-volatile readable storage medium, on which computer readable instructions are stored, characterized in that, when the computer readable instructions are executed by a processor, a method for identifying plant species includes:
    对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
    在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
    利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
    分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
    接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  14. 根据权利要求13所述的计算机非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现所述分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件,具体包括:The computer non-volatile readable storage medium according to claim 13, wherein when the computer readable instructions are executed by a processor, the respective training sample sets corresponding to the plurality of preset positions are used Training multiple ResNet50 convolutional neural network models until the recognition result of the test sample set corresponding to each trained model corresponding to the multiple preset positions meets the preset training termination condition, which specifically includes:
    分别利用与所述多个预设位置对应的训练样本集,按照预设学习率训练对应的所述模型;Training the corresponding model according to the preset learning rate by respectively using the training sample sets corresponding to the multiple preset positions;
    若训练后的所述模型识别对应的所述测试样本集的准确率小于所述预设准确率和/或召回率小于所述预设召回率,则降低所述预设学习率,并按照降低后的预设学习率继续训练所述模型直至训练后的所述模型识别对应的所述测试样本集的准确率大于或等于所述预设准确率且召回率大于或等于所述预设召回率为止。If the accuracy rate of the model identification corresponding to the test sample set after training is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate, then the preset learning rate is reduced, and according to the decrease After the preset learning rate, continue to train the model until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate until.
  15. 根据权利要求13所述的计算机非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现所述执行所述模型的网络结构包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。The computer non-volatile readable storage medium according to claim 13, wherein when the computer readable instructions are executed by a processor, the network structure for executing the model comprises 50 layers of convolutions connected in sequence. Layer and 1 layer fully connected layer, of which, the 50 layer convolutional layer is divided into 5 blocks, and the 5 blocks are represented as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 including a convolution kernel of 7×7 Layer, conv2_x includes a convolutional layer with a convolution kernel of 3×3 and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, each bottleneck The building block includes 3 convolutional layers with a 3×3 convolution kernel.
  16. 根据权利要求13至15中任一项所述的计算机非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现所述对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像,具体包括:The computer non-volatile readable storage medium according to any one of claims 13 to 15, wherein the computer readable instruction is executed by a processor to realize the resolution preprocessing of the plant sample image To obtain a plant sample image of the first preset resolution, which specifically includes:
    若所述植物样本图像的分辨率大于所述第一预设分辨率,则对所述植物样本图像进行降采样处理,得到所述第一预设分辨率的植物样本图像;If the resolution of the plant sample image is greater than the first preset resolution, performing down-sampling processing on the plant sample image to obtain a plant sample image of the first preset resolution;
    若所述植物样本图像的分辨率小于所述第一预设分辨率,则对所述植物样本图像进行升采样处理,得到所述第一预设分辨率的植物样本图像。If the resolution of the plant sample image is less than the first preset resolution, performing upsampling processing on the plant sample image to obtain a plant sample image of the first preset resolution.
  17. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现植物种类的识别方法,包括:A computer device, including a memory, a processor, and computer readable instructions stored on the memory and running on the processor, wherein the processor executes the computer readable instructions to realize a plant species identification method ,include:
    对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像;Performing resolution preprocessing on the plant sample image to obtain a plant sample image with a first preset resolution;
    在所述第一预设分辨率的植物样本图像的多个预设位置处分别获取对应的多个第二预设分辨率的植物样本子图像,其中,所述第二预设分辨率小于所述第一预设分辨率,所述多个预设位置各不相同,所述多个预设位置中的一个为所述第一预设分辨率的植物样本图像的中心位置处,其他预设位置对应的所述第二预设分辨率的植物样本子图像互不重叠且可组合成完整的所述第一预设分辨率的植物样本图像;A plurality of corresponding plant sample sub-images of a second preset resolution are respectively acquired at a plurality of preset positions of the plant sample image of the first preset resolution, wherein the second preset resolution is smaller than the The first preset resolution, the plurality of preset positions are different, one of the plurality of preset positions is the center position of the plant sample image of the first preset resolution, and the other presets The plant sample sub-images of the second preset resolution corresponding to the positions do not overlap each other and can be combined into a complete plant sample image of the first preset resolution;
    利用与所述多个预设位置对应的多个所述第二预设分辨率的植物样本子图像,分别建立与所述多个预设位置对应的所述训练样本集和所述测试样本集;Using the plurality of plant sample sub-images of the second preset resolution corresponding to the plurality of preset positions to respectively establish the training sample set and the test sample set corresponding to the plurality of preset positions ;
    分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件;Training multiple ResNet50 convolutional neural network models using the training sample sets corresponding to the multiple preset positions respectively, until each trained model corresponding to the multiple preset positions identifies the corresponding test sample set The recognition result meets the preset training termination condition;
    接收待识别的植物图像,并利用训练好的所述模型对所述待识别的植物图像的种类进行识别。The plant image to be recognized is received, and the type of the plant image to be recognized is recognized by using the trained model.
  18. 根据权利要求17所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述分别利用与所述多个预设位置对应的训练样本集训练多个ResNet50卷积神经网络模型,直至每个训练好的与所述多个预设位置对应的模型识别对应的所述测试样本集的识别结果满足预设训练终止条件,具体包括:The computer device according to claim 17, wherein when the processor executes the computer-readable instructions, the processor implements the training of multiple ResNet50 convolutions using training sample sets corresponding to the multiple preset positions. The neural network model until the recognition result of the test sample set corresponding to each trained model corresponding to the multiple preset positions meets the preset training termination condition, which specifically includes:
    分别利用与所述多个预设位置对应的训练样本集,按照预设学习率训练对应的所述模型;Training the corresponding model according to the preset learning rate by respectively using the training sample sets corresponding to the multiple preset positions;
    若训练后的所述模型识别对应的所述测试样本集的准确率小于所述预设准确率和/或召回率小于所述预设召回率,则降低所述预设学习率,并按照降低后的预设学习率继续训练所述模型直至训练后的所述模型识别对应的所述测试样本集的准确率大于或等于所述预设准确率且召回率大于或等于所述预设召回率为止。If the accuracy rate of the model identification corresponding to the test sample set after training is less than the preset accuracy rate and/or the recall rate is less than the preset recall rate, then the preset learning rate is reduced, and according to the decrease After the preset learning rate, continue to train the model until the accuracy rate of the trained model identifying the corresponding test sample set is greater than or equal to the preset accuracy rate and the recall rate is greater than or equal to the preset recall rate until.
  19. 根据权利要求17所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述执行所述模型的网络结构包括依次连接的50层卷积层和1层全连接层,其中,50层卷积层分为5个块,5个块分别表示为conv1,conv2_x,conv3_x,conv4_x,conv5_x,conv1包括一个卷积核为7×7的卷积层,conv2_x包括一个卷积核为3×3的卷积层和3个瓶颈构建块;conv3_x包括4个瓶颈构建块;conv4_x包括6个瓶颈构建块;conv5_x包括3个瓶颈构建块,每个瓶颈构建快包括3层卷积核为3×3的卷积层。The computer device according to claim 17, wherein the network structure for implementing the model when the processor executes the computer-readable instructions includes 50 layers of convolutional layers and 1 layer of fully connected in sequence. The 50 layers of convolutional layers are divided into 5 blocks, and the 5 blocks are represented as conv1, conv2_x, conv3_x, conv4_x, conv5_x, conv1 includes a convolutional layer with a convolution kernel of 7×7, and conv2_x includes a convolution The product core is a 3×3 convolutional layer and 3 bottleneck building blocks; conv3_x includes 4 bottleneck building blocks; conv4_x includes 6 bottleneck building blocks; conv5_x includes 3 bottleneck building blocks, each bottleneck building block includes 3 layers of volume The product kernel is a 3×3 convolutional layer.
  20. 根据权利要求17至19中任一项所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述对植物样本图像进行分辨率预处理,得到第一预设分辨率的植物样本图像,具体包括:The computer device according to any one of claims 17 to 19, wherein when the processor executes the computer-readable instruction, the resolution preprocessing is performed on the plant sample image to obtain the first preset Resolution plant sample images, including:
    若所述植物样本图像的分辨率大于所述第一预设分辨率,则对所述植物样本图像进行降采样处理,得到所述第一预设分辨率的植物样本图像;If the resolution of the plant sample image is greater than the first preset resolution, performing down-sampling processing on the plant sample image to obtain a plant sample image of the first preset resolution;
    若所述植物样本图像的分辨率小于所述第一预设分辨率,则对所述植物样本图像进行升采样处理,得到所述第一预设分辨率的植物样本图像。If the resolution of the plant sample image is less than the first preset resolution, performing upsampling processing on the plant sample image to obtain a plant sample image of the first preset resolution.
PCT/CN2019/097891 2019-03-12 2019-07-26 Plant species identification method and apparatus WO2020181706A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910185074.XA CN110059715A (en) 2019-03-12 2019-03-12 Floristic recognition methods and device, storage medium, computer equipment
CN201910185074.X 2019-03-12

Publications (1)

Publication Number Publication Date
WO2020181706A1 true WO2020181706A1 (en) 2020-09-17

Family

ID=67316775

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/097891 WO2020181706A1 (en) 2019-03-12 2019-07-26 Plant species identification method and apparatus

Country Status (2)

Country Link
CN (1) CN110059715A (en)
WO (1) WO2020181706A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807449A (en) * 2021-09-23 2021-12-17 合肥工业大学 Sedimentary rock category identification method and device, electronic equipment and storage medium
WO2024131589A1 (en) * 2022-12-22 2024-06-27 杭州睿胜软件有限公司 Plant species determining method and device and computer readable storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110852341A (en) * 2019-09-23 2020-02-28 平安科技(深圳)有限公司 Atractylodes macrocephala detection method based on deep learning and related equipment thereof
CN111488939A (en) * 2020-04-15 2020-08-04 天津美腾科技股份有限公司 Model training method, classification method, device and equipment
CN111523457B (en) * 2020-04-22 2023-09-12 七海行(深圳)科技有限公司 Weed identification method and weed treatment equipment
CN111783667A (en) * 2020-07-02 2020-10-16 南阳理工学院 Traditional Chinese medicine identification system and use method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101916382A (en) * 2010-07-30 2010-12-15 广州中医药大学 Method for recognizing image of plant leaf
US20130136312A1 (en) * 2011-11-24 2013-05-30 Shih-Mu TSENG Method and system for recognizing plant diseases and recording medium
CN107145879A (en) * 2017-06-23 2017-09-08 依通(北京)科技有限公司 A kind of floristics automatic identifying method and system
CN107527069A (en) * 2017-08-22 2017-12-29 京东方科技集团股份有限公司 Image processing method, device, electronic equipment and computer-readable medium
CN108520247A (en) * 2018-04-16 2018-09-11 腾讯科技(深圳)有限公司 To the recognition methods of the Object node in image, device, terminal and readable medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106156775B (en) * 2015-03-31 2020-04-03 日本电气株式会社 Video-based human body feature extraction method, human body identification method and device
CN107832807B (en) * 2017-12-07 2020-08-07 上海联影医疗科技有限公司 Image processing method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101916382A (en) * 2010-07-30 2010-12-15 广州中医药大学 Method for recognizing image of plant leaf
US20130136312A1 (en) * 2011-11-24 2013-05-30 Shih-Mu TSENG Method and system for recognizing plant diseases and recording medium
CN107145879A (en) * 2017-06-23 2017-09-08 依通(北京)科技有限公司 A kind of floristics automatic identifying method and system
CN107527069A (en) * 2017-08-22 2017-12-29 京东方科技集团股份有限公司 Image processing method, device, electronic equipment and computer-readable medium
CN108520247A (en) * 2018-04-16 2018-09-11 腾讯科技(深圳)有限公司 To the recognition methods of the Object node in image, device, terminal and readable medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
KIM, EAL ET AL.: "Deep Convolution and Up-Convolution Network for Plant Segmentation", 2018 INTERNATIONAL CONFERENCE ON ELECTRONICS, INFORMATION, AND COMMUNICATION (ICEIC), 27 January 2018 (2018-01-27), XP033343170, DOI: 20191113165400Y *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807449A (en) * 2021-09-23 2021-12-17 合肥工业大学 Sedimentary rock category identification method and device, electronic equipment and storage medium
WO2024131589A1 (en) * 2022-12-22 2024-06-27 杭州睿胜软件有限公司 Plant species determining method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN110059715A (en) 2019-07-26

Similar Documents

Publication Publication Date Title
WO2020181706A1 (en) Plant species identification method and apparatus
WO2020181817A1 (en) Plant image recognition method and apparatus based on neural network model
WO2020006961A1 (en) Image extraction method and device
CN103914676B (en) A kind of method and apparatus used in recognition of face
WO2020258667A1 (en) Image recognition method and apparatus, and non-volatile readable storage medium and computer device
CN111160533A (en) Neural network acceleration method based on cross-resolution knowledge distillation
JP2022528128A (en) Skin quality measurement method, skin quality classification method, skin quality measurement device, electronic device and storage medium
CN107679466B (en) Information output method and device
CN107392110A (en) Beautifying faces system based on internet
CN108460649A (en) A kind of image-recognizing method and device
CN108090511B (en) Image classification method and device, electronic equipment and readable storage medium
CN110059728B (en) RGB-D image visual saliency detection method based on attention model
CN109815960A (en) Reproduction image-recognizing method, device, equipment and medium based on deep learning
US20230154142A1 (en) Fundus color photo image grading method and apparatus, computer device, and storage medium
CN103841410B (en) Based on half reference video QoE objective evaluation method of image feature information
CN108764176A (en) A kind of action sequence recognition methods, system and equipment and storage medium
JP2021531571A (en) Certificate image extraction method and terminal equipment
EP4354343A1 (en) Data processing method and device
CN110619334B (en) Portrait segmentation method based on deep learning, architecture and related device
CN110008961A (en) Text real-time identification method, device, computer equipment and storage medium
CN108509833A (en) A kind of face identification method, device and equipment based on structured analysis dictionary
CN110457677A (en) Entity-relationship recognition method and device, storage medium, computer equipment
CN110489659A (en) Data matching method and device
WO2021114818A1 (en) Method, system, and device for oct image quality evaluation based on fourier transform
CN105979283A (en) Video transcoding method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19918652

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19918652

Country of ref document: EP

Kind code of ref document: A1