Fruit and vegetable identification method and device

A technology of fruit and vegetable identification, fruit and vegetable, applied in the field of artificial intelligence, can solve the problem of low efficiency of multi-category fruit and vegetable identification

Pending Publication Date: 2020-10-23
深圳赛安特技术服务有限公司
0 Cites 1 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0003] In view of this, embodiments of the present invention provide a method and device for identifying fruits and v...
View more

Method used

[0085] The fruit and vegetable recognition model provided by the present application can quickly identify various types of fruits and vegetables in the same picture, and can improve recognition efficiency.
[0125] ...
View more

Abstract

The embodiment of the invention provides a fruit and vegetable identification method and device, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining a sample image which at least comprises one type of fruits and vegetables; obtaining position information and category labels of various categories of fruits and vegetables in the sample image;training the initial deep learning model according to the sample image, the position information of various types of fruits and vegetables in the sample image and the type label to generate a fruit and vegetable recognition model; and inputting a to-be-identified image into the trained fruit and vegetable identification model, and outputting an identification result, the identification result comprising category labels and position information of fruits and vegetables. According to the technical scheme provided by the embodiment of the invention, the problem of low identification efficiency ofmultiple types of fruits and vegetables in the prior art can be solved, in addition, the scheme also relates to a block chain technology, and the type labels and the position information of the fruits and vegetables are stored in the block chain.

Application Domain

Image enhancementImage analysis +3

Technology Topic

HorticultureSample image +5

Image

  • Fruit and vegetable identification method and device
  • Fruit and vegetable identification method and device
  • Fruit and vegetable identification method and device

Examples

  • Experimental program(1)

Example Embodiment

[0034] In order to better understand the technical solutions of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0035] It should be clear that the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0036] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms of "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0037] It should be understood that the term "and/or" used herein is only an association relationship describing associated objects, which means that there can be three types of relationships, for example, A and/or B can mean that there is A alone, and both A and B, there are three cases of B alone. In addition, the character "/" in this text generally indicates that the associated objects before and after are in an "or" relationship.
[0038] It should be understood that although the terms first, second, third, etc. may be used to describe terminals in the embodiments of the present invention, these terminals should not be limited to these terms. These terms are only used to distinguish terminals from each other. For example, without departing from the scope of the embodiments of the present invention, the first terminal may also be referred to as the second terminal, and similarly, the second terminal may also be referred to as the first terminal.
[0039] Depending on the context, the word "if" as used herein can be interpreted as "when" or "when" or "in response to determination" or "in response to detection". Similarly, depending on the context, the phrase "if determined" or "if detected (statement or event)" can be interpreted as "when determined" or "in response to determination" or "when detected (statement or event) )" or "in response to detection (statement or event)".
[0040] figure 1 Is a flowchart of a method for identifying fruits and vegetables according to an embodiment of the present invention, such as figure 1 As shown, the method includes:
[0041] Step S01, acquiring a sample image, the sample image includes at least one type of fruits and vegetables;
[0042] Step S02, acquiring location information and category labels of various types of fruits and vegetables in the sample image;
[0043] Step S03, training the initial deep learning model according to the sample image, the position information of the various categories of fruits and vegetables in the sample image, and the category labels to generate a fruit and vegetable recognition model;
[0044] Step S04: Input the image to be recognized into the trained fruit and vegetable recognition model, and output the recognition result, where the recognition result includes the category label and location information of the fruit and vegetable.
[0045] In this solution, the fruit and vegetable recognition model can recognize multiple types of fruits and vegetables at once, such as coriander, peas, and radishes in one picture, which overcomes the disadvantage of not being able to recognize multiple types of fruits and vegetables at one time. When it is applied to give relevant nutritional suggestions by photographing ingredients, the ingredients can be photographed in the same photo to identify a variety of fruits and vegetables inside, which speeds up the identification efficiency. It should be emphasized that, in order to further ensure the privacy and security of the category tags and location information of the fruits and vegetables, the category tags and location information of the fruits and vegetables can also be stored in a blockchain node.
[0046] The following is a detailed introduction based on the fruit and vegetable identification method.
[0047] Step S01: Obtain a sample image, the sample image includes at least one category of fruits and vegetables.
[0048] Specifically, sample images at various angles taken by the camera are acquired. The camera can be, for example, a mobile phone camera, a fisheye camera, a SLR camera, a surveillance camera, etc. In order to increase the diversity of samples, in this embodiment, we use the 89 types of photos of fruits and vegetables taken by the above-mentioned various cameras. A total of 16,535 sheets.
[0049] The category and location of fruits and vegetables in each sample image are marked. The types of fruits and the number of each kind of fruits and vegetables are shown in Table 1:
[0050] Table 1. Types of fruits and vegetables and the number of labels
[0051]
[0052]
[0053]
[0054] After step S01, the above method further includes:
[0055] The sample image is preprocessed, and the preprocessing includes zooming in and/or reducing and/or brightness enhancement and/or brightness reduction and/or inversion and/or noise increase on the sample image.
[0056] Exemplarily, the sample image is adjusted to a uniform size by enlargement and/or reduction, such as 512*512; brightness enhancement and/or brightness reduction, for example, the saturation and brightness of all pixels in each patch in the HSV color space can be adjusted Raise it to the power of 0.25-4, multiply by a factor between 0.7 and 1.4, and add a value between -0.1 and 0.1. You can also add a value between -0.1 to 0.1 in the hue channel (H) for all pixels of each picture or patch. The flip can be, for example, a horizontal flip (that is, a mirror image) or a vertical flip to increase noise, such as salt and pepper noise, Gaussian noise, etc.
[0057] The above methods can effectively increase the sample size to obtain more sample images to be used in the later training process. Of course, processing methods such as cropping, sharpening, and rotation can also be used, which are not limited here.
[0058] Further, in step S02, position information and category labels of various types of fruits and vegetables in the sample image are obtained. Specifically:
[0059] Label the fruits and vegetables in each sample image with a marking tool to generate location information of the fruits and vegetables;
[0060] Set the category labels of the marked fruits and vegetables, and associate the category labels with the location information of the fruits and vegetables;
[0061] A model-readable file is generated based on the associated category tags and the location information of the fruits and vegetables.
[0062] In one embodiment, a rectangular frame is used to label various fruits and vegetables in the sample image, and the position information of the rectangular frame is determined as the position information of the various fruits and vegetables. Wherein, the position information includes the coordinates of the origin of the rectangular frame and the length and width of the rectangular frame, so as to obtain the position information of the fruits and vegetables in the sample image.
[0063] It should be noted that the positions of various fruits and vegetables in the sample image can be marked by manual labeling; and the positions of various fruits and vegetables in the sample image can also be marked by a labeling tool.
[0064] Exemplarily, labelImg or yolomark labeling tools can be used to label the positions of various fruits and vegetables in the sample image. Select the sample image to be labeled, and then use the start to draw a rectangular frame, click to end the frame, and select the category label of the labeled fruits and vegetables (as shown in Table 1). Label rectangular boxes for various fruits and vegetables in the sample image. When the positions of the various fruits and vegetables in the sample image are marked, a corresponding XML file is generated. The file records the category label and location information of each fruit and vegetable. The location information can be passed ( x, y, w, h) identification, where x and y represent the coordinates of the top-left vertex of the rectangular box, w represents the width of the rectangular box, and h represents the height of the rectangular box. Finally, the XML file is converted into a txt file in YOLO format.
[0065] Optionally, the method further includes:
[0066] The associated position information of the category label and the fruit and vegetable is stored in a blockchain.
[0067] Thereby ensuring the privacy and security of data.
[0068] In step S03, the initial deep learning model is trained according to the sample image, the position information of various categories of fruits and vegetables in the sample image, and the category labels, to generate a fruit and vegetable recognition model.
[0069] In specific implementation, the initial deep learning model can extract fruit and vegetable images from sample images based on the position information of various fruits and vegetables, learn the characteristics of the fruit and vegetable from the fruit and vegetable images, and then obtain the relationship between the fruit and vegetable characteristics and the category label of the fruit and vegetable, so as to generate The fruit and vegetable recognition model can recognize various types of fruits and vegetables in the input data.
[0070] Among them, the initial deep learning model YOLO (You Only Look Once, target detection) model, which has the advantages of fast running speed and less memory, improves the real-time performance of image recognition. The YOLO target detection network is based on the features learned by the deep convolutional network to detect target objects. In this embodiment, the YOLO model is the third version of YOLO, that is, the YOLOv3 model.
[0071] Step S03 specifically includes:
[0072] Step S031: Separate the sample images into the training set and the validation set according to a preset ratio;
[0073] Step S032, input the training set into the YOLOv3 model for training, and stop training until the preset number of iterations is reached;
[0074] Step S033: Record the loss function value of each iteration of the training set, draw a training loss function graph based on the number of iterations and the loss function value in the training set, and determine the qualified range of the number of iterations corresponding to the convergence of the loss function;
[0075] Step S034, input each sample image of the verification set into each YOLOv3 model whose iteration number is within the qualified range;
[0076] In step S035, the YOLOv3 network model corresponding to the number of iterations with the best recognition effect is selected as the trained fruit and vegetable recognition model.
[0077] In this embodiment, the ratio of the number of samples in the training set to the verification set is 7:3. In other embodiments, the ratio of the number of samples in the training set to the verification set can also be 8:2 or 6:4. It should be noted that when dividing the training set and the verification set, in this embodiment, the above-mentioned large number of sample images are randomly shuffled in the standard order to ensure that the data is more credible, random and scattered, and to reduce the risk of human factors. deviation.
[0078] The training process is divided into two stages. The first is the adaptive training stage, which is set to two batches of training sets and the learning rate is set to 0.00001. This process only trains layers other than the last part of the fully connected layer of YOLOv3; through adaptive training The YOLOv3 model already has the ability to extract the local features of the sample image. Using the YOLOv3 model as the starting point for training can save us the process of training our own model to extract features, thus speeding up our training process.
[0079] Second: the formal training stage. At this stage, the entire network will be trained, and the learning rate will also be adjusted to 0.000001. After 33 batches, the training process stops after the 35th batch, and the training batch batch When it is set to 8, the loss we tested hovered around 5.700. The loss is the best value obtained by adjusting the batch and learning rate of the training batch. After testing, the training result obtained on the test set has a mAP of 75.6% .
[0080] The training parameters of the YOLOv3 model are set as follows: the maximum learning rate is 0.00001, the minimum learning rate is 0.000001, and the training batch is batch 8. Finally, the YOLOv3 network model corresponding to the number of iterations with the best recognition effect is selected as the trained fruit and vegetable recognition model.
[0081] Step S04: Input the image to be recognized into the trained fruit and vegetable recognition model, and output the recognition result, where the recognition result includes the category label and location information of the fruit and vegetable.
[0082] Specifically, the output recognition results include two types, namely:
[0083] When the recognition result is that the image to be recognized does not contain fruits and vegetables, the output image does not contain fruits and vegetables;
[0084] When the recognition result is that the image to be recognized contains fruits and vegetables, a conclusion including the category label, location information, and quantity of the fruits and vegetables is output.
[0085] The fruit and vegetable recognition model provided in this application can quickly recognize multiple types of fruits and vegetables in the same picture, and can improve the recognition efficiency.
[0086] After step S04, the method further includes:
[0087] When the accuracy rate of the category labels of various fruits and vegetables and the location information of various fruits and vegetables in the image to be tested outputted by the fruit and vegetable recognition model is less than the preset threshold, the actual location information of various fruits and vegetables in the image to be tested and the information of various commodities are obtained. Actual category label;
[0088] Train the fruit and vegetable recognition model according to the image to be tested, the actual location information of various fruits and vegetables in the image to be tested, and the actual category labels of various fruits and vegetables, until the classification results and positions of various fruits and vegetables in the image to be tested output by the fruit and vegetable recognition model The accuracy of the information is greater than or equal to the preset threshold.
[0089] In this solution, the fruit and vegetable recognition model can recognize multiple types of fruits and vegetables at once, such as coriander, peas, and radishes in one picture, which overcomes the disadvantage of not being able to recognize multiple types of fruits and vegetables at one time. When it is applied to give relevant nutritional suggestions by photographing ingredients, the ingredients can be photographed in the same photo to identify a variety of fruits and vegetables inside, which speeds up the identification efficiency.
[0090] figure 2 Is a schematic diagram of a fruit and vegetable identification device according to an embodiment of the present invention, such as figure 2 As shown, the device includes a first acquiring unit 10, a second acquiring unit 20, a generating unit 30, and an output unit 40.
[0091] The first acquiring unit 10 is configured to acquire a sample image, the sample image includes at least one type of fruits and vegetables;
[0092] The second acquiring unit 20 is configured to acquire location information and category labels of various types of fruits and vegetables in the sample image;
[0093] The generating unit 30 is configured to train the initial deep learning model according to the sample image, the position information of various types of fruits and vegetables in the sample image, and the category labels to generate a fruit and vegetable recognition model;
[0094] The output unit 40 is configured to input the image to be recognized into the trained fruit and vegetable recognition model and output the recognition result, where the recognition result includes the category label and location information of the fruit and vegetable.
[0095] In this solution, first use multi-category sample images of fruits and vegetables to train the deep learning model to obtain a fruit and vegetable recognition model. The fruit and vegetable recognition model can identify multiple categories of fruits and vegetables at once, such as coriander, peas and Radish overcomes the shortcomings of not being able to identify multiple types of fruits and vegetables at one time. When it is applied to give relevant nutritional suggestions by photographing ingredients, the ingredients can be photographed in the same photo to identify a variety of fruits and vegetables inside, which speeds up the identification efficiency.
[0096] The first acquisition unit 10 is used for acquiring sample images at various angles through camera shooting. The camera can be, for example, a mobile phone camera, a fisheye camera, a SLR camera, a surveillance camera, etc. In order to increase the diversity of the samples, in this embodiment, we use the photos of 89 types of fruits and vegetables taken by the above various cameras. A total of 16,535 sheets.
[0097] The category and location of fruits and vegetables in each sample image are marked. Among them, the types of fruits and the quantity of each kind of fruits and vegetables are shown in Table 1.
[0098] Further, the device also includes a preprocessing unit 50 for preprocessing the sample image, the preprocessing includes zooming in and/or reducing and/or brightness enhancement and/or brightness reduction and/or inversion and/or increase on the sample image noise.
[0099] Exemplarily, the sample image is adjusted to a uniform size by enlargement and/or reduction, such as 512*512; brightness enhancement and/or brightness reduction, for example, the saturation and brightness of all pixels in each patch in the HSV color space can be adjusted Raise it to the power of 0.25 to 4, multiply by a factor between 0.7 and 1.4, and add a value between -0.1 and 0.1. You can also add a value between -0.1 to 0.1 in the hue channel (H) for all pixels of each picture or patch. The flip can be, for example, a horizontal flip (that is, a mirror image) or a vertical flip to increase noise, such as salt and pepper noise, Gaussian noise, and so on.
[0100] The above methods can effectively increase the sample size to obtain more sample images to be used in the later training process. Of course, processing methods such as cropping, sharpening, and rotation can also be used, which are not limited here.
[0101] Further, the second acquiring unit 20 includes a labeling subunit, an associated subunit, and a generating subunit.
[0102] The labeling sub-unit is used to label the fruits and vegetables in each sample image with a labeling tool to generate position information of the fruits and vegetables;
[0103] The association subunit is used to set the category labels of the marked fruits and vegetables, and associate the category labels with the location information of the fruits and vegetables;
[0104] The generating subunit is used to generate a model-readable file according to the associated category tags and the location information of the fruits and vegetables.
[0105] Further, the device also includes a storage unit,
[0106] The storage unit is configured to store the associated location information of the category label and the fruit and vegetable in a blockchain. Thereby ensuring the privacy and security of data.
[0107] In an embodiment, a rectangular frame is used to label various fruits and vegetables in the sample image, and the position information of the rectangular frame is determined as the position information of the various fruits and vegetables. Wherein, the position information includes the coordinates of the origin of the rectangular frame and the length and width of the rectangular frame, so as to obtain the position information of the fruits and vegetables in the sample image.
[0108] It should be noted that the positions of various fruits and vegetables in the sample image can be marked by manual labeling; and the positions of various fruits and vegetables in the sample image can also be marked by a labeling tool.
[0109] Exemplarily, labelImg or yolomark labeling tools can be used to label the positions of various fruits and vegetables in the sample image. Select the sample image to be labeled, and then use the start to draw a rectangular frame, click to end the frame, and select the category label of the labeled fruits and vegetables (as shown in Table 1). Label rectangular boxes for various fruits and vegetables in the sample image. When the positions of the various fruits and vegetables in the sample image are marked, a corresponding XML file is generated. The file records the category label and location information of each fruit and vegetable. The location information can be passed ( x, y, w, h) identification, where x and y represent the coordinates of the top-left vertex of the rectangular box, w represents the width of the rectangular box, and h represents the height of the rectangular box. Finally, the XML file is converted into a txt file in YOLO format.
[0110] In the training process of the generating unit 30, the initial deep learning model can extract fruit and vegetable images from the sample images according to the position information of various fruits and vegetables, learn the characteristics of the fruit and vegetable from the fruit and vegetable images, and then obtain the relationship between the fruit and vegetable characteristics and the category label of the fruit and vegetable. So that the generated fruit and vegetable recognition model can recognize the categories of various fruits and vegetables in the input data.
[0111] Among them, the initial deep learning model YOLO (You Only Look Once, target detection) model, which has the advantages of fast running speed and less memory, improves the real-time performance of image recognition. The YOLO target detection network is based on the features learned by the deep convolutional network to detect target objects. In this embodiment, the YOLO model is the third version of YOLO, that is, the YOLOv3 model.
[0112] Specifically, the generating unit 30 includes a division subunit, a training subunit, a recording subunit, an input subunit, and a selection subunit:
[0113] Divide sub-units to separate the sample images into the training set and the validation set according to a preset ratio;
[0114] The training subunit is used to input the training set into the YOLOv3 model for training, and stop training until the preset number of iterations is reached;
[0115] The recording subunit is used to record the loss function value of each iteration of the training set, and draw the training loss function graph based on the number of iterations and the loss function value in the training set, and determine the qualified range of the number of iterations when the loss function converges;
[0116] The input subunit is used to input each sample image of the verification set into each YOLOv3 model whose iteration number is within the qualified range;
[0117] The selection subunit is used to select the YOLOv3 network model corresponding to the number of iterations with the best recognition effect as the trained fruit and vegetable recognition model.
[0118] In this embodiment, the ratio of the number of samples in the training set to the verification set is 7:3. In other embodiments, the ratio of the number of samples in the training set to the verification set can also be 8:2 or 6:4. It should be noted that when dividing the training set and the verification set, in this embodiment, the above-mentioned large number of sample images are randomly shuffled in the standard order to ensure that the data is more credible, random and scattered, and to reduce the risk of human factors. deviation.
[0119] The training process is divided into two stages. The first is the adaptive training stage, which is set to two batches of training sets and the learning rate is set to 0.00001. This process only trains layers other than the last part of the fully connected layer of YOLOv3; through adaptive training The YOLOv3 model already has the ability to extract the local features of the sample image. Using the YOLOv3 model as the starting point for training can save us the process of training our own model to extract features, thus speeding up our training process.
[0120] Second: the formal training stage. At this stage, the entire network will be trained, and the learning rate will also be adjusted to 0.000001. After 33 batches, the training process stops after the 35th batch, and the training batch batch When it is set to 8, the loss we tested hovered around 5.700. The loss is the best value obtained by adjusting the batch and learning rate of the training batch. After testing, the training result obtained on the test set has a mAP of 75.6% .
[0121] The training parameters of the YOLOv3 model are set as follows: the maximum learning rate is 0.00001, the minimum learning rate is 0.000001, and the training batch is batch 8. Finally, the YOLOv3 network model corresponding to the number of iterations with the best recognition effect is selected as the trained fruit and vegetable recognition model.
[0122] Further, the output unit 40 includes a first output subunit and a second output subunit;
[0123] The first output subunit is used to output a conclusion that the image does not contain fruits and vegetables when the recognition result is that the image to be identified does not contain fruits and vegetables;
[0124] The second output subunit is used to output a conclusion including the category label, location information and quantity of the fruit and vegetable when the recognition result is that the image to be recognized contains fruits and vegetables.
[0125] The fruit and vegetable recognition model provided in this application can quickly recognize fruits and vegetables of multiple categories in the same picture, and can improve the recognition efficiency.
[0126] Further, the above device further includes a third acquiring unit and a regeneration unit.
[0127] The third acquiring unit is used to acquire the actual results of various fruits and vegetables in the image to be tested when the accuracy of the category labels of the various fruits and vegetables in the image to be tested and the position information of the various fruits and vegetables in the image to be tested output by the fruit and vegetable recognition model Location information and actual category labels for various products.
[0128] The regeneration unit is used to train the fruit and vegetable recognition model according to the image to be tested, the actual position information of various fruits and vegetables in the image to be tested, and the actual category labels of various fruits and vegetables, until various types of images in the image to be tested outputted by the fruit and vegetable recognition model The accuracy of the classification results of the fruits and vegetables and the location information is greater than or equal to the preset threshold.
[0129] In this solution, the fruit and vegetable recognition model can recognize multiple categories of fruits and vegetables at one time, such as coriander, peas, and radishes in one picture, which overcomes the disadvantage of not being able to recognize multiple categories of fruits and vegetables at one time. When it is applied to give relevant nutritional suggestions by photographing the ingredients, the ingredients can be photographed in the same photo to identify a variety of fruits and vegetables inside, speeding up the identification efficiency.
[0130] The embodiment of the present invention provides a computer non-volatile storage medium, the storage medium includes a stored program, wherein, when the program is running, the device where the storage medium is located is controlled to perform the following steps:
[0131] Acquire sample images, the sample images include at least one type of fruits and vegetables;
[0132] Acquire location information and category labels of various types of fruits and vegetables in the sample image;
[0133] Train the initial deep learning model according to the sample image, the position information of various types of fruits and vegetables in the sample image, and the category labels to generate a fruit and vegetable recognition model;
[0134] The image to be recognized is input into the trained fruit and vegetable recognition model, and the recognition result is output. The recognition result includes the category label and location information of the fruit and vegetable.
[0135] Optionally, when the program is running, controlling the device where the storage medium is located to execute the step of acquiring location information and category labels of various types of fruits and vegetables in the sample image includes:
[0136] Label the fruits and vegetables in each sample image with a marking tool to generate location information of the fruits and vegetables;
[0137] Set the category labels of the marked fruits and vegetables, and associate the category labels with the location information of the fruits and vegetables;
[0138] A model-readable file is generated based on the associated category tags and the location information of the fruits and vegetables.
[0139] Optionally, when the program is running, controlling the device where the storage medium is located also performs the following steps:
[0140] When the accuracy rate of the category labels of various fruits and vegetables and the location information of various fruits and vegetables in the image to be tested outputted by the fruit and vegetable recognition model is less than the preset threshold, the actual location information of various fruits and vegetables in the image to be tested and the information of various commodities are obtained. Actual category label;
[0141] Train the fruit and vegetable recognition model according to the image to be tested, the actual location information of various fruits and vegetables in the image to be tested, and the actual category labels of various fruits and vegetables, until the classification results and positions of various fruits and vegetables in the image to be tested output by the fruit and vegetable recognition model The accuracy of the information is greater than or equal to the preset threshold.
[0142] Optionally, when the program is running, controlling the device where the storage medium is located to input the image to be recognized into the trained fruit and vegetable recognition model and output the recognition result includes:
[0143] When the recognition result is that the image to be recognized does not contain fruits and vegetables, the output image does not contain fruits and vegetables;
[0144] When the recognition result is that the image to be recognized contains fruits and vegetables, a conclusion including the category label, location information, and quantity of the fruits and vegetables is output.
[0145] Optionally, when the program is running, the device where the storage medium is located is controlled to perform the following steps before acquiring the location information and category labels of various types of fruits and vegetables in the sample image:
[0146] The sample image is preprocessed, and the preprocessing includes zooming in and/or reducing and/or brightness enhancement and/or brightness reduction and/or inversion and/or noise increase on the sample image.
[0147] Optionally, the fruit and vegetable recognition model is the YOLOv3 model. When the program is running, the device where the storage medium is located is controlled to execute the training of the initial deep learning model based on the sample image, the position information of the various types of fruits and vegetables in the sample image, and the category labels to generate fruit and vegetable recognition Models, including:
[0148] Separate the sample images into the training set and the validation set according to the preset ratio;
[0149] Input the training set into the YOLOv3 model for training, and stop training until the preset number of iterations is reached;
[0150] Record the loss function value of each iteration of the training set, and draw the training loss function curve based on the number of iterations and loss function value in the training set, and determine the qualified range of the number of iterations when the loss function converges;
[0151] Input each sample image of the verification set to each YOLOv3 model whose iteration number is within the qualified range;
[0152] The YOLOv3 network model corresponding to the number of iterations with the best recognition effect is selected as the trained fruit and vegetable recognition model.
[0153] image 3 It is a schematic diagram of a computer device provided by an embodiment of the present invention. Such as image 3 As shown, the computer device 100 of this embodiment includes: a processor 101, a memory 102, and a computer program 103 stored in the memory 102 and running on the processor 101. The processor 101 executes the computer program 103 when the computer program 103 is executed. To avoid repetition, the method of identifying fruits and vegetables will not be repeated here. Alternatively, when the computer program is executed by the processor 101, the function of each model/unit in the fruit and vegetable identification device in the embodiment is realized. In order to avoid repetition, it will not be repeated here.
[0154] The computer device 100 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The computer device may include, but is not limited to, a processor 101 and a memory 102. Those skilled in the art can understand, image 3 It is only an example of the computer device 100, and does not constitute a limitation on the computer device 100. It may include more or less components than shown, or some components may be combined, or different components. For example, the computer device may also include input and output. Equipment, network access equipment, bus, etc.
[0155] The so-called processor 101 may be a central processing unit (Central Processing Unit, CPU), other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
[0156] The memory 102 may be an internal storage unit of the computer device 100, such as a hard disk or memory of the computer device 100. The memory 102 may also be an external storage device of the computer device 100, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a Secure Digital (SD) card, a flash memory card (Flash Card) and so on. Further, the memory 102 may also include both an internal storage unit of the computer device 100 and an external storage device. The memory 102 is used to store computer programs and other programs and data required by the computer equipment. The memory 102 can also be used to temporarily store data that has been output or will be output.
[0157] Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
[0158] In the several embodiments provided by the present invention, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
[0159] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
[0160] In addition, various functional units in various embodiments of the present invention may be integrated into one processing unit, or various units may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.
[0161] The blockchain referred to in the present invention is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database. It is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0162] The above-mentioned integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (Processor) execute parts of the methods in various embodiments of the present invention step. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes.
[0163] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection of the present invention. Within range.

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products