CN108256476A - For identifying the method and apparatus of fruits and vegetables - Google Patents
For identifying the method and apparatus of fruits and vegetables Download PDFInfo
- Publication number
- CN108256476A CN108256476A CN201810044989.4A CN201810044989A CN108256476A CN 108256476 A CN108256476 A CN 108256476A CN 201810044989 A CN201810044989 A CN 201810044989A CN 108256476 A CN108256476 A CN 108256476A
- Authority
- CN
- China
- Prior art keywords
- vegetables
- fruits
- probability
- fruit
- images
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/68—Food, e.g. fruit or vegetables
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the present application discloses the method and apparatus for identifying fruits and vegetables.One specific embodiment of this method includes:Obtain images to be recognized;By images to be recognized input fruit and vegetable recognition model trained in advance, obtain the first recognition result, wherein, the probability and the probability there is no fruits and vegetables that first recognition result includes existing in images to be recognized the fruit or vegetables under the fruits and vegetables classification in the fruits and vegetables category set specified, fruit and vegetable recognition model are used to characterize the correspondence between image and the first recognition result;The first recognition result based on gained generates the second recognition result, and exports the second recognition result.The embodiment realizes the identification to fruits and vegetables.
Description
Technical field
The invention relates to field of computer technology, and in particular to Internet technical field is more particularly, to known
The method and apparatus of other fruits and vegetables.
Background technology
Fruits and vegetables are the abbreviations to fruits and vegetables.With being on the increase for fruit and vegetable varieties, people are by being visually typically only capable to
Identify the fruits and vegetables of a small number of kinds.Therefore, user is helped, which to carry out fruit and vegetable recognition, becomes a kind of demand.Moreover, fruit and vegetable recognition is also
It can be applied to a variety of different application scenarios, such as the check-out flow in fruits and vegetables shop, fruits and vegetables growth conditions monitoring etc..
Invention content
The embodiment of the present application proposes the method and apparatus for identifying fruits and vegetables.
In a first aspect, the embodiment of the present application provides a kind of method for identifying fruits and vegetables, this method includes:It obtains and waits to know
Other image;By above-mentioned images to be recognized input fruit and vegetable recognition model trained in advance, the first recognition result is obtained, wherein, it is above-mentioned
First recognition result include existing in above-mentioned images to be recognized fruit under the fruits and vegetables classification in the fruits and vegetables category set specified or
The probability of vegetables and the probability there is no fruits and vegetables, above-mentioned fruit and vegetable recognition model are used to characterize between image and the first recognition result
Correspondence;The first recognition result based on gained generates the second recognition result, and exports above-mentioned second recognition result.
In some embodiments, above-mentioned fruit and vegetable recognition model is by being trained to obtain to preset convolutional neural networks
, wherein, above-mentioned convolutional neural networks include convolutional layer, pond layer, full articulamentum and loss layer, and convolutional layer is used to be grouped
Convolution.
In some embodiments, above-mentioned fruit and vegetable recognition model trains to obtain by following training step:It obtains preset
Sample image set and label corresponding with each sample image in above-mentioned sample image set, wherein, above-mentioned sample graph
Image set exists in closing shows fruit or the sample image of vegetables;Using machine learning method, based on above-mentioned sample image set,
The label corresponding to each sample image, preset Classification Loss function and back-propagation algorithm in above-mentioned sample image set
Above-mentioned convolutional neural networks are trained, obtain fruit and vegetable recognition model.
In some embodiments, above-mentioned the first recognition result based on gained generates the second recognition result, including:On determining
State in images to be recognized there is no fruits and vegetables probability whether be gained the first recognition result in maximum probability;It is if not maximum
Probability, then according to numerical values recited, there are the water under the fruits and vegetables classification in above-mentioned fruits and vegetables category set from above-mentioned images to be recognized
Choose probability in the probability of fruit or vegetables, and by the other title generation of fruits and vegetables class corresponding to the probability selected and the probability the
Two recognition results.
In some embodiments, above-mentioned according to numerical values recited, there are above-mentioned fruits and vegetables classification collection from above-mentioned images to be recognized
Fruit under fruits and vegetables classification in conjunction chooses probability in the probability of vegetables, including:According to the sequence that numerical value is descending, to upper
It states in images to be recognized that there are the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the probability of vegetables to be ranked up, obtains
To probability sequence;Preset number probability is chosen since the stem of above-mentioned probability sequence.
In some embodiments, above-mentioned according to numerical values recited, there are above-mentioned fruits and vegetables classification collection from above-mentioned images to be recognized
Fruit under fruits and vegetables classification in conjunction chooses probability in the probability of vegetables, further includes:There are upper from above-mentioned images to be recognized
State the probability chosen in the probability of the fruit or vegetables under the fruits and vegetables classification in fruits and vegetables category set not less than probability threshold value.
In some embodiments, above-mentioned the first recognition result based on gained generates the second recognition result, further includes:If
Maximum probability, then generation are used to indicate the text message that fruits and vegetables are not present in above-mentioned images to be recognized, by above-mentioned text message and
There is no the probability of fruits and vegetables in above-mentioned images to be recognized to generate the second recognition result.
In some embodiments, the above method further includes:It is deposited above-mentioned images to be recognized as new sample image
Storage.
Second aspect, the embodiment of the present application provide a kind of device for being used to identify fruits and vegetables, which includes:It obtains single
Member is configured to obtain images to be recognized;Recognition unit is configured to above-mentioned images to be recognized input fruits and vegetables trained in advance
Identification model obtains the first recognition result, wherein, above-mentioned first recognition result includes having what is specified in above-mentioned images to be recognized
The probability and the probability there is no fruits and vegetables of fruit under fruits and vegetables classification or vegetables in fruits and vegetables category set, above-mentioned fruit and vegetable recognition mould
Type is used to characterize the correspondence between image and the first recognition result;Output unit is configured to first based on gained and knows
Other result generates the second recognition result, and exports above-mentioned second recognition result.
In some embodiments, above-mentioned fruit and vegetable recognition model is by being trained to obtain to preset convolutional neural networks
, wherein, above-mentioned convolutional neural networks include convolutional layer, pond layer, full articulamentum and loss layer, and convolutional layer is used to be grouped
Convolution.
In some embodiments, above-mentioned fruit and vegetable recognition model trains to obtain by following training step:It obtains preset
Sample image set and label corresponding with each sample image in above-mentioned sample image set, wherein, above-mentioned sample graph
Image set exists in closing shows fruit or the sample image of vegetables;Using machine learning method, based on above-mentioned sample image set,
The label corresponding to each sample image, preset Classification Loss function and back-propagation algorithm in above-mentioned sample image set
Above-mentioned convolutional neural networks are trained, obtain fruit and vegetable recognition model.
In some embodiments, above-mentioned output unit includes:Determination subelement is configured to determine above-mentioned images to be recognized
In there is no fruits and vegetables probability whether be gained the first recognition result in maximum probability;First generation subelement, configuration are used
In if not maximum probability, then according to numerical values recited, there are the fruits in above-mentioned fruits and vegetables category set from above-mentioned images to be recognized
Fruit under vegetable classification chooses probability in the probability of vegetables, and the fruits and vegetables classification corresponding to by the probability selected and the probability
Title generate the second recognition result.
In some embodiments, above-mentioned first generation subelement is further configured to:According to descending suitable of numerical value
Sequence to be carried out to there are the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the probability of vegetables in above-mentioned images to be recognized
Sequence, obtains probability sequence;Preset number probability is chosen since the stem of above-mentioned probability sequence.
In some embodiments, above-mentioned first generation subelement is further configured to:From above-mentioned images to be recognized
It is general not less than probability threshold value there are being chosen in the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the probability of vegetables
Rate.
In some embodiments, above-mentioned output unit further includes:Second generation subelement, if being configured to most probably
Rate, then generation are used to indicate the text message that fruits and vegetables are not present in above-mentioned images to be recognized, by above-mentioned text message and above-mentioned treat
Identify that there is no the probability of fruits and vegetables the second recognition results of generation in image.
In some embodiments, above device further includes:Storage unit is configured to using above-mentioned images to be recognized as new
Sample image stored.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, which includes:One or more processing
Device;Storage device, for storing one or more programs;When said one or multiple programs are by said one or multiple processors
It performs so that said one or multiple processors are realized such as the method for realization method reflection any in first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, are stored thereon with computer journey
Sequence is realized when above procedure is executed by processor such as the method for realization method reflection any in first aspect.
Method and apparatus provided by the embodiments of the present application for identifying fruits and vegetables, by the way that acquired images to be recognized is defeated
Enter fruit and vegetable recognition model trained in advance, to obtain the first recognition result, wherein, which can treat including this
There is the probability of fruit under the fruits and vegetables classification in the fruits and vegetables category set specified or vegetables in identification image and there is no fruits and vegetables
Probability.Then the first recognition result based on gained generates the second recognition result, and defeated second recognition result.So as to effectively
Fruit and vegetable recognition model is utilized to obtain the first recognition result and obtain the second recognition result based on the first recognition result,
Realize the identification to fruits and vegetables.
Description of the drawings
By reading the detailed reflection made to non-limiting example made with reference to the following drawings, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architecture figures therein;
Fig. 2 is the flow chart for being used to identify one embodiment of the method for fruits and vegetables according to the application;
Fig. 3 is the schematic diagram for being used to identify an application scenarios of the method for fruits and vegetables according to the application;
Fig. 4 is the structure diagram for being used to identify one embodiment of the device of fruits and vegetables according to the application;
Fig. 5 is adapted for the structure diagram of the computer system of the electronic equipment for realizing the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is anti-
The specific embodiment reflected is used only for explaining related invention rather than the restriction to the invention.It also should be noted that in order to
Convenient for reflection, illustrated only in attached drawing and invent relevant part with related.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the method for being used to identify fruits and vegetables that can apply the application or the implementation for identifying the device of fruits and vegetables
The exemplary system architecture 100 of example.
As shown in Figure 1, system architecture 100 can include terminal device 101,102,103, network 104 and server 105.
Network 104 between terminal device 101,102,103 and server 105 provide communication link medium.Network 104 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted with using terminal equipment 101,102,103 by network 104 with server 105, to receive or send out
Send message etc..Various telecommunication customer end applications can be installed, such as web browser should on terminal device 101,102,103
It is applied with, searching class, image identification class application etc..
Terminal device 101,102,103 can be various electronic equipments, including but not limited to smart mobile phone, tablet computer,
Pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services.For example, server 105 can from terminal device 101,
102nd, 103 images to be recognized is obtained, and to the images to be recognized analyze etc. processing, and by handling result (such as generation
Second recognition result) feed back to terminal device.
It should be noted that generally being held for the method that identifies fruits and vegetables by server 105 of being provided of the embodiment of the present application
Row, correspondingly, the device for identifying fruits and vegetables is generally positioned in server 105.
It should be pointed out that if images to be recognized is server 105 from locally obtaining, then can in system architecture 100
Not include terminal device 101,102,103.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realization need
Will, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the flow for being used to identify one embodiment of the method for fruits and vegetables according to the application is shown
200.This is used for the flow 200 for identifying the method for fruits and vegetables, includes the following steps:
Step 201, images to be recognized is obtained.
In the present embodiment, for identifying electronic equipment (such as the service shown in FIG. 1 of the method for fruits and vegetables operation thereon
Device 105) images to be recognized can be obtained from the terminal device (such as terminal device shown in FIG. 1 101,102,103) connected.
Above-mentioned electronic equipment can also receive URL (the Uniform Resource of the images to be recognized of terminal device transmission
Locator, uniform resource locator), images to be recognized is obtained according to the URL.Certainly, above-mentioned electronic equipment can also be from local
Obtain images to be recognized.Wherein, which can show the image of fruit or vegetables or do not show
The image of fruits and vegetables.
Step 202, by images to be recognized input fruit and vegetable recognition model trained in advance, the first recognition result is obtained.
In the present embodiment, acquired images to be recognized can be inputted fruits and vegetables trained in advance and known by above-mentioned electronic equipment
Other model, obtains the first recognition result.Wherein, which can include the presence of the fruit specified in the images to be recognized
The probability and the probability there is no fruits and vegetables of fruit under fruits and vegetables classification or vegetables in vegetable category set.The fruit and vegetable recognition model can
For the correspondence between characterization image and the first recognition result.
It should be noted that the summation of each probability in first recognition result can be equal to 1.In addition, fruits and vegetables classification
Can be the classification divided based on fruits and vegetables title, fruits and vegetables classification can for example include apple, banana, orange, dragon fruit, west
Melon, Chinese cabbage, cucumber, balsam pear, celery, potato etc..Certainly, fruits and vegetables classification can also be the kind based on various fruits and vegetables to divide
Classification, fruits and vegetables classification can for example include Fuji apple, Ji Naguo, Qiao Najin, Sang Sa, snake fruit, crisp pears, pyrus nivalis, tribute pears, green trailing plants
Fore-telling, ternip, purple sweet potato, sweet potato etc..
It should be pointed out that fruit and vegetable recognition model can be technical staff based on to great amount of images and the first recognition result
It counts and pre-establishes, be stored with multiple images and the mapping table of the correspondence of the first recognition result.
In some optional realization methods of the present embodiment, fruit and vegetable recognition model can also be by preset convolution
Neural network (Convolutional Neural Network, CNN) is trained.Wherein, the convolutional neural networks
It can be indiscipline or not train the multilayer convolutional neural networks completed.The convolutional neural networks can for example include convolution
Layer, pond layer, full articulamentum and loss layer.It should be pointed out that the convolutional layer can be used for being grouped convolution.It such as will be special
Sign figure gives multiple GPU (Graphics Processing Unit, image processor) and carries out convolution operation respectively.It in this way can be with
Calculation amount is saved, and whole convolution speed can be improved.
It should be noted that above-mentioned fruit and vegetable recognition model can be above-mentioned electronic equipment or remotely lead to above-mentioned electronic equipment
What the server of letter connection was trained by performing following training step:
First, preset sample image set and mark corresponding with each sample image in the sample image set are obtained
Label.Wherein, there may be the sample image for showing fruit or vegetables in sample image set, there may also be do not show fruit
The sample image of vegetable.For showing the sample image of fruit or vegetables, the label corresponding to the sample image can be used for referring to
Show the fruit that the sample image shows or the fruits and vegetables classification that vegetables are belonged to.For not showing the sample image of fruits and vegetables, the sample
Label corresponding to this image, which can serve to indicate that, is not present fruits and vegetables in the sample image.In addition, sample image set and the sample
The label corresponding to sample image in this image collection can be stored in advance in actuating station (such as the above-mentioned electricity of the training step
Sub- equipment or the server being connect with above-mentioned electronic equipment telecommunication) it is local, naturally it is also possible to it is stored in advance in the actuating station
In the server connected, the present embodiment does not do any restriction to content in this respect.
Then, using machine learning method, based on each sample image institute in sample image set, sample image set
Corresponding label, preset Classification Loss function and back-propagation algorithm are trained above-mentioned convolutional neural networks, obtain fruit
Vegetable identification model.Here, in the training process, sample image can be inputted above-mentioned convolutional neural networks by above-mentioned actuating station, be obtained
To the first recognition result corresponding with the sample image, above-mentioned actuating station can determine to be somebody's turn to do using preset Classification Loss function
The difference between label corresponding to first recognition result and the sample image, above-mentioned electronic equipment can be adopted according to the difference
The parameter in above-mentioned convolutional neural networks is adjusted with preset back-propagation algorithm.
It should be noted that above-mentioned Classification Loss function can be various loss function (such as the Hinge for classification
Loss functions or Softmax Loss functions etc.).In the training process, Classification Loss function can constrain the side of convolution kernel modification
Formula and direction, trained target are to make the value of Classification Loss function minimum.Thus, the ginseng of convolutional neural networks obtained after training
The value of number as Classification Loss function parameter corresponding when being minimum value.
In addition, above-mentioned back-propagation algorithm is alternatively referred to as error backpropagation algorithm or Back Propagation Algorithm.Reversely pass
The learning process for broadcasting algorithm is made of forward-propagating process and back-propagation process.In feedforward network, input signal is through input
Layer input, is calculated by hidden layer, is exported by output layer.By output valve compared with mark value, if there is error, by error reversely by
Output layer in this process, can utilize gradient descent algorithm (such as stochastic gradient descent algorithm) right to input Es-region propagations
Neuron weights (such as parameter of convolution kernel etc. in convolutional layer) are adjusted.
Step 203, the first recognition result based on gained generates the second recognition result, and exports the second recognition result.
In the present embodiment, after above-mentioned electronic equipment obtains the first recognition result by performing step 202, above-mentioned electronics is set
Standby first recognition result that can be based on generates the second recognition result, and export second recognition result.It is if for example, acquired
Images to be recognized derives from above-mentioned terminal device, then above-mentioned electronic equipment can export second recognition result to above-mentioned terminal
Equipment.If the images to be recognized is locally obtained from above-mentioned electronic equipment, above-mentioned electronic equipment can tie second identification
Fruit is exported to the display screen of above-mentioned electronic equipment or the specified file stored, naturally it is also possible to output to above-mentioned electronic equipment
The server of telecommunication connection.
Here, above-mentioned electronic equipment can first determine in acquired images to be recognized there is no the probability of fruits and vegetables whether be
Maximum probability in first recognition result, if not maximum probability, then above-mentioned electronic equipment can will be in the images to be recognized
There are the fruits and vegetables corresponding to the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the maximum probability in the probability of vegetables
The title of classification generates the second recognition result.Assuming that the other entitled apple of fruits and vegetables class corresponding to the maximum probability, then should
Second recognition result can include " apple ".
Optionally, above-mentioned electronic equipment can also be by the other name of fruits and vegetables class corresponding to the maximum probability and the maximum probability
Claim generation the second recognition result.Assuming that the maximum probability is 0.912, the other entitled apple of fruits and vegetables class corresponding to the maximum probability
Fruit, then second recognition result can include " apple -0.912 ".
In some optional realization methods of the present embodiment, if the probability in the images to be recognized there is no fruits and vegetables is not
Maximum probability in first recognition result, then above-mentioned electronic equipment can be deposited from the images to be recognized according to numerical values recited
Fruit under fruits and vegetables classification in above-mentioned fruits and vegetables category set chooses probability, and the probability that will be selected in the probability of vegetables
The second recognition result is generated with the other title of fruits and vegetables class corresponding to the probability.It should be pointed out that when second recognition result
During including more than two probability, the fruits and vegetables item name in second recognition result can be according to corresponding probability by greatly to
Small is tactic.
For example, above-mentioned electronic equipment can be according to the descending sequence of numerical value, to there are above-mentioned in the images to be recognized
The probability of fruit under fruits and vegetables classification or vegetables in fruits and vegetables category set is ranked up, and obtains probability sequence.Above-mentioned electronics is set
It is standby that preset number (such as 3 or 5 etc.) a probability can be chosen since the stem of the probability sequence.It should be understood that the preset number
Mesh can be adjusted according to actual needs, and the present embodiment does not do any restriction to content in this respect.
For another example above-mentioned electronic equipment can there are the fruits and vegetables class in above-mentioned fruits and vegetables category set from the images to be recognized
Fruit under not chooses probability not less than probability threshold value (such as 0.5 etc.) in the probability of vegetables.It should be understood that the probability threshold
Value can be adjusted according to actual needs, and the present embodiment does not do any restriction to content in this respect.
In some optional realization methods of the present embodiment, if in the images to be recognized there are the probability of fruits and vegetables be gained
The first recognition result in maximum probability, then above-mentioned electronic equipment can generate to be used to indicate in the images to be recognized and be not present
The text message of fruits and vegetables, by there is no the probability of fruits and vegetables the second recognition results of generation in text information and the images to be recognized.
For example, text information can include " non-fruits and vegetables ".Assuming that the probability is 0.998, which can include " non-fruit
Vegetable -0.998 ".
In some optional realization methods of the present embodiment, above-mentioned electronic equipment can be using the images to be recognized as new
Sample image stored.In this way, can continuous enlarged sample image quantity, and the new sample image can be used
In the follow-up training flow of above-mentioned fruit and vegetable recognition model, above-mentioned fruit and vegetable recognition model can be made to pass through iteration and more newly arrive raising in advance
Survey accuracy.
With continued reference to Fig. 3, Fig. 3 is the signal for being used to identify the application scenarios of the method for fruits and vegetables according to the present embodiment
Figure.In the application scenarios of Fig. 3, first, user can show fruits and vegetables by the terminal device held to server upload
Images to be recognized 301;Then, images to be recognized 301 can be inputted fruit and vegetable recognition model trained in advance by server, be obtained
First recognition result;Then, server can be by preceding 5 probability of the numerical value maximum in the first recognition result and corresponding fruit
The title of vegetable classification generates the second recognition result 302, and the second recognition result 302 is exported to terminal device.Wherein, terminal is set
It is standby that 301 and second recognition result 302 of images to be recognized can above be presented.
The method that above-described embodiment of the application provides, is effectively utilized fruit and vegetable recognition model to obtain the first identification knot
Fruit and the second recognition result is obtained based on the first recognition result, realize the identification to fruits and vegetables.
With further reference to Fig. 4, as the realization to method shown in above-mentioned each figure, this application provides one kind for identifying fruit
One embodiment of the device of vegetable, the device embodiment is corresponding with embodiment of the method shown in Fig. 2, which can specifically answer
For in various electronic equipments.
As shown in figure 4, it is used to identify that the device 400 of fruits and vegetables to include shown in the present embodiment:Acquiring unit 401, identification are single
Member 402 and output unit 403.Wherein, acquiring unit 401 is configured to obtain images to be recognized;Recognition unit 402 is configured to
By above-mentioned images to be recognized input fruit and vegetable recognition model trained in advance, the first recognition result is obtained, wherein, above-mentioned first identification
As a result it can include the presence of the fruit under the fruits and vegetables classification in the fruits and vegetables category set specified or vegetables in above-mentioned images to be recognized
Probability and the probability there is no fruits and vegetables, above-mentioned fruit and vegetable recognition model can be used for characterizing between image and the first recognition result
Correspondence;Output unit 403 is configured to the first recognition result based on gained and generates the second recognition result, and exports above-mentioned
Second recognition result.
In the present embodiment, for identifying in the device 400 of fruits and vegetables:Acquiring unit 401, recognition unit 402 and output are single
The specific processing of member 403 and its caused technique effect can be respectively with reference to step 201, the steps 202 in 2 corresponding embodiment of figure
With the related description of step 203, details are not described herein.
In some optional realization methods of the present embodiment, above-mentioned fruit and vegetable recognition model can be by preset volume
Product neural network is trained, wherein, the convolutional neural networks can include convolutional layer, pond layer, full articulamentum and
Loss layer, the convolutional layer are used to be grouped convolution.
In some optional realization methods of the present embodiment, above-mentioned fruit and vegetable recognition model can be walked by following training
What rapid training obtained:Obtain preset sample image set and corresponding with each sample image in above-mentioned sample image set
Label, wherein, there may be the sample image for showing fruit or vegetables in above-mentioned sample image set;Utilize machine learning side
Method, based on corresponding to each sample image in above-mentioned sample image set, above-mentioned sample image set label, preset point
Class loss function and back-propagation algorithm are trained above-mentioned convolutional neural networks, obtain fruit and vegetable recognition model.
In some optional realization methods of the present embodiment, above-mentioned output unit 403 can include:Determination subelement
(not shown), be configured to determine above-mentioned images to be recognized in there is no fruits and vegetables probability whether be gained first identification
As a result the maximum probability in;First generation subelement (not shown), is configured to if not maximum probability, then according to numerical value
Size, there are in the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the probability of vegetables from above-mentioned images to be recognized
Probability is chosen, and the other title of fruits and vegetables class corresponding to the probability selected and the probability is generated into the second recognition result.
In some optional realization methods of the present embodiment, use can be further configured in above-mentioned first generation subelement
In:According to the sequence that numerical value is descending, to there are the fruits and vegetables classifications in above-mentioned fruits and vegetables category set in above-mentioned images to be recognized
Under fruit or the probability of vegetables be ranked up, obtain probability sequence;Preset number is chosen since the stem of above-mentioned probability sequence
Mesh probability.
In some optional realization methods of the present embodiment, use can also be further configured in above-mentioned first generation subelement
In:There are selected in the fruit under the fruits and vegetables classification in above-mentioned fruits and vegetables category set or the probability of vegetables from above-mentioned images to be recognized
Take the probability not less than probability threshold value.
In some optional realization methods of the present embodiment, above-mentioned output unit 403 can also include:Second generation
Unit (not shown), if being configured to maximum probability, then generation, which is used to indicate in above-mentioned images to be recognized, is not present fruit
The text message of vegetable ties the second identification of probability generation that fruits and vegetables are not present in above-mentioned text message and above-mentioned images to be recognized
Fruit.
In some optional realization methods of the present embodiment, above device 400 can also include:Storage unit is (in figure
It is not shown), it is configured to store above-mentioned images to be recognized as new sample image.
The device that above-described embodiment of the application provides, is effectively utilized fruit and vegetable recognition model to obtain the first identification knot
Fruit and the second recognition result is obtained based on the first recognition result, realize the identification to fruits and vegetables.
Below with reference to Fig. 5, it illustrates suitable for being used for realizing the computer system 500 of the electronic equipment of the embodiment of the present application
Structure diagram.Electronic equipment shown in Fig. 5 is only an example, to the function of the embodiment of the present application and should not use model
Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into program in random access storage device (RAM) 503 from storage section 508 and
Perform various appropriate actions and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.
CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always
Line 504.
I/O interfaces 505 are connected to lower component:Importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loud speaker etc.;Storage section 508 including hard disk etc.;
And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because
The network of spy's net performs communication process.Driver 510 is also according to needing to be connected to I/O interfaces 505.Detachable media 511, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on driver 510, as needed in order to be read from thereon
Computer program be mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart reflection
Software program.For example, embodiment of the disclosure includes a kind of computer program product, including being carried on computer-readable medium
On computer program, which includes for the program code of the method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 509 and/or from detachable media
511 are mounted.When the computer program is performed by central processing unit (CPU) 501, perform what is limited in the system of the application
Above-mentioned function.
It should be noted that the computer-readable medium shown in the application can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two arbitrarily combines.Computer readable storage medium for example can be --- but not
It is limited to --- electricity, magnetic, optical, electromagnetic, system, device or the device of infrared ray or semiconductor or arbitrary above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to:Electrical connection with one or more conducting wires, just
It takes formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type and may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In this application, computer readable storage medium can any include or store journey
The tangible medium of sequence, the program can be commanded the either device use or in connection of execution system, device.And at this
In application, computer-readable signal media can include in a base band or as a carrier wave part propagation data-signal,
Wherein carry computer-readable program code.Diversified forms may be used in the data-signal of this propagation, including but it is unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By instruction execution system, device either device use or program in connection.It is included on computer-readable medium
Program code can be transmitted with any appropriate medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc. or above-mentioned
Any appropriate combination.
Flow chart and block diagram in attached drawing, it is illustrated that according to the system of the various embodiments of the application, method and computer journey
Architectural framework in the cards, function and the operation of sequence product.In this regard, each box in flow chart or block diagram can generation
The part of one module of table, program segment or code, a part for above-mentioned module, program segment or code include one or more
The executable instruction of logic function as defined in being used to implement.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also be occurred with being different from the sequence marked in attached drawing.For example, two boxes succeedingly represented are practical
On can perform substantially in parallel, they can also be performed in the opposite order sometimes, this is depended on the functions involved.Also
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and perform rule
The group of specialized hardware and computer instruction is realized or can be used to the dedicated hardware based system of fixed functions or operations
It closes to realize.
Being reflected in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.The unit reflected can also be set in the processor, for example, can be reflected as:A kind of processor packet
Include acquiring unit, recognition unit and output unit.Wherein, the title of these units is not formed under certain conditions to the unit
The restriction of itself, for example, acquiring unit can also be reflected as " unit for obtaining images to be recognized ".
As on the other hand, present invention also provides a kind of computer-readable medium, which can be
Included in the electronic equipment reflected in above-described embodiment;Can also be individualism, and without be incorporated the electronic equipment in.
Above computer readable medium carries one or more program, and when said one or multiple programs, by one, the electronics is set
During standby execution so that the electronic equipment includes:Obtain images to be recognized;Images to be recognized input fruits and vegetables trained in advance are known
Other model, obtains the first recognition result, wherein, which can include the presence of the fruit specified in the images to be recognized
The probability and the probability there is no fruits and vegetables of fruit under fruits and vegetables classification or vegetables in vegetable category set, which can
For the correspondence between characterization image and the first recognition result;The second identification of the first recognition result generation based on gained
As a result, and export second recognition result.
The preferred embodiment and the explanation to institute's application technology principle that above reflection is only the application.People in the art
Member should be appreciated that invention scope involved in the application, however it is not limited to the technology that the specific combination of above-mentioned technical characteristic forms
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
The other technical solutions for arbitrarily combining and being formed.Such as features described above has similar work(with (but not limited to) disclosed herein
The technical solution that the technical characteristic of energy is replaced mutually and formed.
Claims (18)
1. a kind of method for identifying fruits and vegetables, including:
Obtain images to be recognized;
By images to be recognized input fruit and vegetable recognition model trained in advance, the first recognition result is obtained, wherein, described first
Recognition result includes the presence of the fruit under the fruits and vegetables classification in the fruits and vegetables category set specified or vegetables in the images to be recognized
Probability and the probability there is no fruits and vegetables, the fruit and vegetable recognition model for characterize it is corresponding between image and the first recognition result
Relationship;
The first recognition result based on gained generates the second recognition result, and exports second recognition result.
2. according to the method described in claim 1, wherein, the fruit and vegetable recognition model is by preset convolutional neural networks
It is trained, wherein, the convolutional neural networks include convolutional layer, pond layer, full articulamentum and loss layer, the volume
Lamination is used to be grouped convolution.
3. according to the method described in claim 2, wherein, the fruit and vegetable recognition model is to train to obtain by following training step
's:
Preset sample image set and label corresponding with each sample image in the sample image set are obtained,
In, exist in the sample image set and show fruit or the sample image of vegetables;
Using machine learning method, based on each sample image institute in the sample image set, the sample image set
Corresponding label, preset Classification Loss function and back-propagation algorithm are trained the convolutional neural networks, obtain fruit
Vegetable identification model.
4. according to the method described in claim 1, wherein, second identification of the first recognition result generation based on gained is tied
Fruit, including:
Determine in the images to be recognized there is no fruits and vegetables probability whether be gained the first recognition result in maximum probability;
If not maximum probability, then according to numerical values recited, there are in the fruits and vegetables category set from the images to be recognized
Fruit under fruits and vegetables classification chooses probability in the probability of vegetables, and the fruits and vegetables class corresponding to by the probability selected and the probability
Other title generates the second recognition result.
5. according to the method described in claim 4, wherein, described according to numerical values recited, there are institutes from the images to be recognized
It states in the probability of the fruit or vegetables under the fruits and vegetables classification in fruits and vegetables category set and chooses probability, including:
According to the sequence that numerical value is descending, to there are the fruits and vegetables classifications in the fruits and vegetables category set in the images to be recognized
Under fruit or the probability of vegetables be ranked up, obtain probability sequence;
Preset number probability is chosen since the stem of the probability sequence.
6. according to the method described in claim 4, wherein, described according to numerical values recited, there are institutes from the images to be recognized
It states in the probability of the fruit or vegetables under the fruits and vegetables classification in fruits and vegetables category set and chooses probability, further include:
There are in the fruit under the fruits and vegetables classification in the fruits and vegetables category set or the probability of vegetables from the images to be recognized
Choose the probability not less than probability threshold value.
7. according to the method described in claim 4, wherein, second identification of the first recognition result generation based on gained is tied
Fruit further includes:
If maximum probability, then generation is used to indicate the text message that fruits and vegetables are not present in the images to be recognized, by the text
There is no the probability of fruits and vegetables in this information and the images to be recognized to generate the second recognition result.
8. according to the method described in claim 1, wherein, the method further includes:
It is stored the images to be recognized as new sample image.
9. it is a kind of for identifying the device of fruits and vegetables, including:
Acquiring unit is configured to obtain images to be recognized;
Recognition unit is configured to, by images to be recognized input fruit and vegetable recognition model trained in advance, obtain the first identification
As a result, wherein, first recognition result includes the fruits and vegetables for having in the fruits and vegetables category set specified in the images to be recognized
The probability and the probability there is no fruits and vegetables of fruit or vegetables under classification, the fruit and vegetable recognition model are used to characterize image and first
Correspondence between recognition result;
Output unit is configured to the first recognition result based on gained and generates the second recognition result, and exports described second and know
Other result.
10. device according to claim 9, wherein, the fruit and vegetable recognition model is by preset convolutional Neural net
What network was trained, wherein, the convolutional neural networks include convolutional layer, pond layer, full articulamentum and loss layer, described
Convolutional layer is used to be grouped convolution.
11. device according to claim 10, wherein, the fruit and vegetable recognition model is trained by following training step
It arrives:
Preset sample image set and label corresponding with each sample image in the sample image set are obtained,
In, exist in the sample image set and show fruit or the sample image of vegetables;
Using machine learning method, based on each sample image institute in the sample image set, the sample image set
Corresponding label, preset Classification Loss function and back-propagation algorithm are trained the convolutional neural networks, obtain fruit
Vegetable identification model.
12. device according to claim 9, wherein, the output unit includes:
Determination subelement, be configured to determine the images to be recognized in there is no fruits and vegetables probability whether be gained first know
Maximum probability in other result;
First generation subelement, is configured to if not maximum probability, then according to numerical values recited, deposit from the images to be recognized
Fruit under fruits and vegetables classification in the fruits and vegetables category set chooses probability, and the probability that will be selected in the probability of vegetables
The second recognition result is generated with the other title of fruits and vegetables class corresponding to the probability.
13. device according to claim 12, wherein, the first generation subelement is further configured to:
According to the sequence that numerical value is descending, to there are the fruits and vegetables classifications in the fruits and vegetables category set in the images to be recognized
Under fruit or the probability of vegetables be ranked up, obtain probability sequence;
Preset number probability is chosen since the stem of the probability sequence.
14. device according to claim 12, wherein, the first generation subelement is further configured to:
There are in the fruit under the fruits and vegetables classification in the fruits and vegetables category set or the probability of vegetables from the images to be recognized
Choose the probability not less than probability threshold value.
15. device according to claim 12, wherein, the output unit further includes:
Second generation subelement, if being configured to maximum probability, then generation, which is used to indicate in the images to be recognized, is not present
The text message of fruits and vegetables ties the second identification of probability generation that fruits and vegetables are not present in the text message and the images to be recognized
Fruit.
16. device according to claim 9, wherein, described device further includes:
Storage unit is configured to store the images to be recognized as new sample image.
17. a kind of electronic equipment, including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are performed by one or more of processors so that one or more of processors are real
Now such as method according to any one of claims 1-8.
18. a kind of computer readable storage medium, is stored thereon with computer program, wherein, described program is executed by processor
Shi Shixian methods for example according to any one of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810044989.4A CN108256476A (en) | 2018-01-17 | 2018-01-17 | For identifying the method and apparatus of fruits and vegetables |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810044989.4A CN108256476A (en) | 2018-01-17 | 2018-01-17 | For identifying the method and apparatus of fruits and vegetables |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108256476A true CN108256476A (en) | 2018-07-06 |
Family
ID=62740850
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810044989.4A Pending CN108256476A (en) | 2018-01-17 | 2018-01-17 | For identifying the method and apparatus of fruits and vegetables |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108256476A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558791A (en) * | 2018-10-11 | 2019-04-02 | 浙江大学宁波理工学院 | It is a kind of that bamboo shoot device and method is sought based on image recognition |
CN109800795A (en) * | 2018-12-29 | 2019-05-24 | 广州市贺氏办公设备有限公司 | A kind of fruit and vegetable recognition method and system |
CN109863874A (en) * | 2019-01-30 | 2019-06-11 | 深圳大学 | A kind of fruit and vegetable picking method, picker and storage medium based on machine vision |
CN110349161A (en) * | 2019-07-10 | 2019-10-18 | 北京字节跳动网络技术有限公司 | Image partition method, device, electronic equipment and storage medium |
CN110728300A (en) * | 2019-09-09 | 2020-01-24 | 交控科技股份有限公司 | Method and system for identifying fault type based on turnout action current curve |
CN111666961A (en) * | 2019-03-07 | 2020-09-15 | 佛山市顺德区美的电热电器制造有限公司 | Intelligent household appliance, method and device for identifying food material type of intelligent household appliance and electronic equipment |
CN111709480A (en) * | 2020-06-17 | 2020-09-25 | 北京百度网讯科技有限公司 | Method and device for identifying image category |
CN111814862A (en) * | 2020-06-30 | 2020-10-23 | 平安国际智慧城市科技股份有限公司 | Fruit and vegetable identification method and device |
CN111955757A (en) * | 2020-07-24 | 2020-11-20 | 上海云喷餐饮管理有限公司 | Method and equipment for peeling fruits and vegetables |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120087547A1 (en) * | 2010-10-12 | 2012-04-12 | Ncr Corporation | Produce recognition method |
CN105824886A (en) * | 2016-03-10 | 2016-08-03 | 西安电子科技大学 | Rapid food recognition method based on Markov random field |
CN106845527A (en) * | 2016-12-29 | 2017-06-13 | 南京江南博睿高新技术研究院有限公司 | A kind of vegetable recognition methods |
CN107291737A (en) * | 2016-04-01 | 2017-10-24 | 腾讯科技(深圳)有限公司 | Nude picture detection method and device |
CN107451602A (en) * | 2017-07-06 | 2017-12-08 | 浙江工业大学 | A kind of fruits and vegetables detection method based on deep learning |
-
2018
- 2018-01-17 CN CN201810044989.4A patent/CN108256476A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120087547A1 (en) * | 2010-10-12 | 2012-04-12 | Ncr Corporation | Produce recognition method |
CN105824886A (en) * | 2016-03-10 | 2016-08-03 | 西安电子科技大学 | Rapid food recognition method based on Markov random field |
CN107291737A (en) * | 2016-04-01 | 2017-10-24 | 腾讯科技(深圳)有限公司 | Nude picture detection method and device |
CN106845527A (en) * | 2016-12-29 | 2017-06-13 | 南京江南博睿高新技术研究院有限公司 | A kind of vegetable recognition methods |
CN107451602A (en) * | 2017-07-06 | 2017-12-08 | 浙江工业大学 | A kind of fruits and vegetables detection method based on deep learning |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558791A (en) * | 2018-10-11 | 2019-04-02 | 浙江大学宁波理工学院 | It is a kind of that bamboo shoot device and method is sought based on image recognition |
CN109800795A (en) * | 2018-12-29 | 2019-05-24 | 广州市贺氏办公设备有限公司 | A kind of fruit and vegetable recognition method and system |
CN109863874A (en) * | 2019-01-30 | 2019-06-11 | 深圳大学 | A kind of fruit and vegetable picking method, picker and storage medium based on machine vision |
CN109863874B (en) * | 2019-01-30 | 2021-12-14 | 深圳大学 | Fruit and vegetable picking method, picking device and storage medium based on machine vision |
CN111666961A (en) * | 2019-03-07 | 2020-09-15 | 佛山市顺德区美的电热电器制造有限公司 | Intelligent household appliance, method and device for identifying food material type of intelligent household appliance and electronic equipment |
CN111666961B (en) * | 2019-03-07 | 2023-02-17 | 佛山市顺德区美的电热电器制造有限公司 | Intelligent household appliance, method and device for identifying food material type of intelligent household appliance and electronic equipment |
CN110349161A (en) * | 2019-07-10 | 2019-10-18 | 北京字节跳动网络技术有限公司 | Image partition method, device, electronic equipment and storage medium |
CN110728300A (en) * | 2019-09-09 | 2020-01-24 | 交控科技股份有限公司 | Method and system for identifying fault type based on turnout action current curve |
CN111709480A (en) * | 2020-06-17 | 2020-09-25 | 北京百度网讯科技有限公司 | Method and device for identifying image category |
CN111709480B (en) * | 2020-06-17 | 2023-06-23 | 北京百度网讯科技有限公司 | Method and device for identifying image category |
CN111814862A (en) * | 2020-06-30 | 2020-10-23 | 平安国际智慧城市科技股份有限公司 | Fruit and vegetable identification method and device |
CN111955757A (en) * | 2020-07-24 | 2020-11-20 | 上海云喷餐饮管理有限公司 | Method and equipment for peeling fruits and vegetables |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108256476A (en) | For identifying the method and apparatus of fruits and vegetables | |
CN108256474A (en) | For identifying the method and apparatus of vegetable | |
CN107168952A (en) | Information generating method and device based on artificial intelligence | |
CN108171275A (en) | For identifying the method and apparatus of flowers | |
CN109325541A (en) | Method and apparatus for training pattern | |
CN107230035A (en) | Information-pushing method and device | |
CN109582982A (en) | Method and apparatus for translated speech | |
CN108090162A (en) | Information-pushing method and device based on artificial intelligence | |
CN108038880A (en) | Method and apparatus for handling image | |
CN108171276A (en) | For generating the method and apparatus of information | |
CN108960316A (en) | Method and apparatus for generating model | |
CN108171191B (en) | Method and apparatus for detecting face | |
CN109492160A (en) | Method and apparatus for pushed information | |
CN110457476A (en) | Method and apparatus for generating disaggregated model | |
CN109190646B (en) | A kind of data predication method neural network based, device and nerve network system | |
CN108388563A (en) | Information output method and device | |
CN109976997A (en) | Test method and device | |
CN108256591A (en) | For the method and apparatus of output information | |
CN108960110A (en) | Method and apparatus for generating information | |
CN108734296A (en) | Optimize method, apparatus, electronic equipment and the medium of the training data of supervised learning | |
CN108197592A (en) | Information acquisition method and device | |
CN109934242A (en) | Image identification method and device | |
CN110119445A (en) | The method and apparatus for generating feature vector and text classification being carried out based on feature vector | |
CN109858482A (en) | A kind of image key area detection method and its system, terminal device | |
CN110084317A (en) | The method and apparatus of image for identification |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180706 |