Content of the invention
The present invention passes through to provide a kind of Pet feeding method and system based on Internet of Things, to solve existing Pet feeding mistake
Due to a lack of nursing experience it is impossible to controlling optimum feeding scheme and leading to house pet hungry or unsound problem in journey.
For solving the above problems, the present invention employs the following technical solutions and is achieved:
On the one hand, the Pet feeding method based on Internet of Things that the present invention provides, including:
Step S1:The species of collection house pet, sex, age, palmic rate, respiratory frequency, body temperature, activity, feeding class
Type, feeding amount, present image, Current body mass constitute influence factor matrix X, and upload onto the server;Wherein, feeding type and feed
Appetite constitutes decision variable;
Step S2:Utilize between Elman neural network influence factor matrix X and pet health index in server
Complex nonlinear relation, obtain Pet feeding model;
Step S3:Using MOPSO algorithm, Pet feeding model is optimized, obtains one group of optimal solution of decision variable;
Step S4:Using this group optimal solution of decision variable as house pet recommendation decision-making X*User is issued to by server
Terminal unit shown;
Step S5:The recommendation decision-making X that user shows according to terminal unit*Feeding house pet.
On the other hand, the Pet feeding system based on Internet of Things that the present invention provides, including:
Data acquisition unit, for gather the species of house pet, sex, the age, palmic rate, blood pressure, body temperature, activity,
Feeding type, feeding amount, present image, Current body mass constitute influence factor matrix X, and upload onto the server;Wherein, feeding class
Type and feeding amount constitute decision variable;
Unit set up by Pet feeding model, for utilizing Elman neural network influence factor matrix X in server
Complex nonlinear relation and pet health index between, obtains Pet feeding model;
Decision variable optimal solution acquiring unit, for being optimized to Pet feeding model using MOPSO algorithm, acquisition is determined
One group of optimal solution of plan variable, and the recommendation decision-making X as house pet*;
Recommend decision-making issuance unit, for by server by the recommendation decision-making X of house pet*It is issued to the terminal unit of user
Shown.
Compared with prior art, the advantage of the Pet feeding method and system based on Internet of Things that the present invention provides is:Profit
With Elman neural network Pet feeding model, recycle MOPSO algorithm optimization Pet feeding model it is determined that house pet feeds
Appetite, the optimal value of food type, and the optimal value of feeding pet amount, food type is constituted feeding pet scheme immediate feedback
To user, allow user can understand the present situation of house pet whenever and wherever possible, be that house pet has built more preferable living environment.
Specific embodiment
Fig. 1 shows the flow process of the Pet feeding method based on Internet of Things according to embodiments of the present invention.
As shown in figure 1, the Pet feeding method based on Internet of Things of the present invention, including:
Step S1:The species of collection house pet, sex, age, palmic rate, respiratory frequency, body temperature, activity, feeding class
Type, feeding amount, present image, Current body mass constitute influence factor matrix X, and upload onto the server;Wherein, feeding type and feed
Appetite constitutes decision variable.
Health degree y to house pet is obtained by statistics1Affecting maximum variable is:Pet breeds x1, age x2, heart beating
Frequency x3, respiratory frequency x4, activity x5, body temperature x6, present image x7, sex x8, Current body mass x9, feeding amount x10, food
Type x11, totally 11 variables;Wherein, palmic rate x3, respiratory frequency x4, activity x5, body temperature x6Number is measured by corresponding sensor
According to;Present image x7Gathered by photographic head, pet breeds x1, age x2, sex x8, Current body mass x9For build-in attribute, by user
Input;Feeding amount x10, food type x11Constitute decision variable.
The body temperature x of house pet6Gathered by temperature sensor and obtain;Palmic rate x of house pet3Gathered by heart rate sensor
Obtain;Respiratory frequency x of house pet4Gathered by respiratory frequen and obtain;The activity x of house pet5Obtained by pedometer collection
?;It is attached with temperature sensor, heart rate sensor, respiratory frequen, pedometer respectively using sample circuit, and will
The body temperature of the house pet that temperature sensor, heart rate sensor, respiratory frequen, pedometer collect respectively, palmic rate, exhale
Inhale frequency, activity is converted into digital signal.
House pet gathers acquisition in the facial characteristics of current time by photographic head, and photographic head converts image information into numeral
Signal.
In the present invention, server is preferably Cloud Server.
Step S2:Utilize between Elman neural network influence factor matrix X and pet health index in server
Complex nonlinear relation, obtain Pet feeding model.
Setting Xk=[xk1,xk2,L,xkM] (k=1,2, L, S) be input vector, N be training sample number,
For during the g time iteration between input layer M and hidden layer I
Weighted vector, WJPG () is weighted vector during the g time iteration between hidden layer J and output layer P, WJCWhen () is the g time iteration g
Weighted vector Y between hidden layer J and undertaking layer Ck(g)=[yk1(g),yk2(g),L,ykP(g)] (k=1,2, L, S) be the g time
The reality output of network, d during iterationk=[dk1,dk2,L,dkP] (k=1,2, L, S) be desired output, iterationses g be 500.
The complexity between Elman neural network influence factor matrix X and pet health index is utilized in server
Non-linear relation, obtains the process of Pet feeding model, including:
Step S21:Initialization, if iterationses g initial value is 0, is assigned to W respectivelyMI(0)、WJP(0)、WJC(0) one (0,1)
Interval random value;
Step S22:Stochastic inputs sample Xk;
Step S23:To input sample Xk, reality output Y of forward calculation Elman every layer of neuron of neutral netk(g);
Step S24:According to desired output dkWith reality output Yk(g), calculation error E (g);
Step S25:Whether error in judgement E (g) is less than default error amount, if greater than or be equal to, enter step S26,
If it is less, entering step S29;
Step S26:Judge whether iterationses g+1 is more than maximum iteration time, if it does, entering step S29, no
Then, enter step S27;
Step S27:To input sample XkThe partial gradient δ of backwards calculation Elman every layer of neuron of neutral net;
Step S28:Calculate modified weight amount Δ W, and revise weights;Make g=g+1, jump to step S23;
Wherein, Δ Wij=η δij, η is the learning efficiency;Wij(g+1)=Wij(g)+ΔWij(g);
Step S29:Judge whether to complete the training of all samples;If it is, completing to model;If not, jumping to step
S22.
Elman neutral net design in, the number of hidden nodes number be determine Elman neural network model quality pass
Key, is also the difficult point in the design of Elman neutral net, to be determined the nodes of hidden layer here using trial and error procedure.
In formula, p is hidden neuron nodes, and n is input layer number, and m is output layer neuron number, and k is 1-10
Between constant.The arrange parameter of Elman neutral net is as shown in table 2 below.
Table 2 Elman neutral net arrange parameter
By said process, can get Elman neural network prediction effect as Figure 2-3.The base that intelligent pet is fed
Plinth is the foundation of model, and model accuracy directly affects output result.By analyzing to Fig. 2-3, the pre- maximum survey of health index
Error is 2.0%, and model prediction accuracy is high, meets modeling demand.
Step S3:Using MOPSO algorithm, (Modified Bacteria Foraging Optimization improves antibacterial
Look for food optimized algorithm) Pet feeding model is optimized, obtain one group of optimal solution of decision variable.
Obtain one group of optimal solution of decision variable, that is, obtain the irrigation amount of house pet, dose, one group of Fertilizer Type
Optimal value.
Included using the step that MOPSO algorithm is optimized to Pet feeding model:
Step S31:Initialization Pet feeding model parameter, this parameter includes population scale R, maximum iteration time T, random
Generate n particle x1,x2, L, xn, accelerated factor c1And c2;Wherein, c1For acceleration weight from particle to individual extreme value movement, c2For
To the acceleration weight of global optimum movement, it is sky that order achieves collection Q to particle.
Step S32:Calculate the fitness p of each particle in populationiWith individual adaptive optimal control degreeWeigh particle current
The degree of optimization of position.
The fitness value of particle is less, and its degree of optimization is higher.
Step S33:Fitness p by each particleiWith individual adaptive optimal control degreeIt is compared, if fitness pi?
Join individual adaptive optimal control degreeBy fitness piReplace individual adaptive optimal control degreeOtherwise, retain original individual optimum suitable
Response
Step S34:The particle of non-dominant all in population is added and achieves collection Q, and delete the particle arranged in population.
Step S35:Select a particle by the use of press mechanism and Tabu search algorithm as global optimum in archive collection Q.
Step S36:The speed of more new particle itself and position;
Wherein, the speed of particle more new formula is:
The location updating formula of particle is:
Step S37:Judge whether iterationses reach maximum iteration time T, if it is, exporting current global optimum
Solution, otherwise, circulation step S32- step S36, till iterationses reach maximum iteration time T.
Each position of particle is a variable, all corresponding solution of each variable.
Step S4:Using this group optimal solution of decision variable as house pet recommendation decision-making X*User is issued to by server
Terminal unit shown.
Every 2 hours collection one secondary data of various kinds of sensors upload onto the server, and server connects data and passes through Pet feeding
Model provides the current feeding amount recommended of house pet and food type.
Step S5:The recommendation decision-making feeding of pets that user shows according to terminal unit.
User can open intelligent pet on the terminal device and feed interface (as shown in Figure 4), this house pet of interface display
Brief information, the brief information of house pet includes the image of house pet, current health index, and user can arrange the ideal of house pet at interface
Health index, is issued feeding type and the feeding amount of recommendation by server.
The current health index of house pet is obtained by being optimized to Pet feeding model based on MOPSO algorithm, the working as of house pet
Front health index is corresponding with one group of optimal solution of decision variable.
The Pet feeding method based on Internet of Things that the present invention provides, first, is adopted using sensor, the first-class hardware of shooting
The physical signs parameter of collection house pet, house pet image, feeding amount, food type;Then, the data collecting is uploaded onto the server
Stored, utilized the complexity between Elman neural network influence factor matrix X and pet health index in server
Non-linear relation, is obtained Pet feeding model, using MOPSO algorithm, Pet feeding model is optimized, and obtains each decision-making and becomes
One group of optimal solution of amount, and using this group optimal solution as PC the or APP terminal recommending decision-making to be issued to user, finally, Yong Huke
According to feeding amount and the food type of recommending decision-making to determine house pet.The method can determine the Pet feeding scheme of optimum, for doting on
Thing has built more preferable living environment.
Corresponding with said method, the present invention also provides a kind of Pet feeding system based on Internet of Things.
The Pet feeding system based on Internet of Things for the present invention, including:
Data acquisition unit, for gather the species of house pet, sex, the age, palmic rate, blood pressure, body temperature, activity,
Feeding type, feeding amount, present image, Current body mass constitute influence factor matrix X, and upload onto the server;Wherein, feeding class
Type and feeding amount constitute decision variable.The detailed process of data acquisition unit gathered data is with reference to above-mentioned steps S1.
Unit set up by Pet feeding model, for utilizing Elman neural network influence factor matrix X in server
Complex nonlinear relation and pet health index between, obtains Pet feeding model.Pet feeding model is set up unit and is set up
The detailed process of Pet feeding model is with reference to above-mentioned steps S2.
Decision variable optimal solution acquiring unit, for being optimized to Pet feeding model using MOPSO algorithm, acquisition is determined
One group of optimal solution of plan variable, and the recommendation decision-making X as house pet*.Decision variable optimal solution acquiring unit obtains decision variable
Optimal solution detailed process with reference to above-mentioned steps S3.
Recommend decision-making issuance unit, for by server by the recommendation decision-making X of house pet*It is issued to the terminal unit of user
Shown.
The recommendation decision-making X that user shows according to terminal unit*Feeding is carried out to house pet.
It should be pointed out that described above is not limitation of the present invention, the present invention is also not limited to the example above,
Change, modification, interpolation or replacement that those skilled in the art are made in the essential scope of the present invention, also should
Belong to protection scope of the present invention.