CN117475480A - Multi-pet feeding method and device based on image recognition - Google Patents
Multi-pet feeding method and device based on image recognition Download PDFInfo
- Publication number
- CN117475480A CN117475480A CN202311666354.5A CN202311666354A CN117475480A CN 117475480 A CN117475480 A CN 117475480A CN 202311666354 A CN202311666354 A CN 202311666354A CN 117475480 A CN117475480 A CN 117475480A
- Authority
- CN
- China
- Prior art keywords
- pet
- feeding
- loss
- identity
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000001514 detection method Methods 0.000 claims abstract description 59
- 235000013305 food Nutrition 0.000 claims abstract description 24
- 239000013598 vector Substances 0.000 claims description 25
- 238000001914 filtration Methods 0.000 claims description 7
- 238000002372 labelling Methods 0.000 claims description 7
- 238000005286 illumination Methods 0.000 claims description 5
- 230000036544 posture Effects 0.000 claims description 5
- 238000004590 computer program Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 241000282326 Felis catus Species 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 241000894007 species Species 0.000 description 2
- 241000282472 Canis lupus familiaris Species 0.000 description 1
- 241001465754 Metazoa Species 0.000 description 1
- 238000009395 breeding Methods 0.000 description 1
- 230000001488 breeding effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000001627 detrimental effect Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 244000144992 flock Species 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 244000144980 herd Species 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 235000012054 meals Nutrition 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000001737 promoting effect Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
-
- A—HUMAN NECESSITIES
- A01—AGRICULTURE; FORESTRY; ANIMAL HUSBANDRY; HUNTING; TRAPPING; FISHING
- A01K—ANIMAL HUSBANDRY; AVICULTURE; APICULTURE; PISCICULTURE; FISHING; REARING OR BREEDING ANIMALS, NOT OTHERWISE PROVIDED FOR; NEW BREEDS OF ANIMALS
- A01K5/00—Feeding devices for stock or game ; Feeding wagons; Feeding stacks
- A01K5/02—Automatic devices
- A01K5/0275—Automatic devices with mechanisms for delivery of measured doses
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Life Sciences & Earth Sciences (AREA)
- Multimedia (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Artificial Intelligence (AREA)
- Environmental Sciences (AREA)
- Human Computer Interaction (AREA)
- Birds (AREA)
- Animal Husbandry (AREA)
- Biodiversity & Conservation Biology (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
The application provides a multi-pet feeding method and device based on image recognition, and belongs to the technical field of data processing. S1, continuously acquiring images of a pet feeding area; step S2, detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image area containing pets; step S3, carrying out pet identity recognition on the pet image area based on a pre-trained pet identity recognition model to acquire the individual identity of the pet; and S4, determining feeding parameters matched with the individual identities of the pets, and delivering food according to the feeding parameters. The timing and quantitative feeding of a plurality of pets in families is realized, and the feeding burden of the pet owners is reduced.
Description
Technical Field
The application belongs to the technical field of data processing, and particularly relates to a method and a device for feeding multiple pets based on image recognition.
Background
In order to meet the needs and convenience of pet owners, pet feeders have emerged as an innovative device. The pet food dispensing device is intended to provide an automatic feeding solution to the owner and helps to ease the workload of daily feeding. However, conventional pet feeders often suffer from drawbacks such as lack of timing, quantitative feeding functions, and the work and lifestyle of the pet owners may lead to irregular feeding schedules and food volumes, which are detrimental to the health of the pet; on the other hand, when a plurality of pets are kept in a home, it is difficult to achieve quantitative feeding for different pets, which may cause problems such as unbalanced feeding, overfeeding or the pet competing for food. These drawbacks limit the popularity and use of pet feeders in the home.
Disclosure of Invention
In order to solve the technical problems, the application provides a multi-pet feeding method and device based on image recognition, which solve the feeding problem of multi-pet families.
In a first aspect of the present application, a multi-pet feeding method based on image recognition mainly includes:
step S1, continuously acquiring images of a pet feeding area;
step S2, detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image area containing pets;
step S3, carrying out pet identity recognition on the pet image area based on a pre-trained pet identity recognition model to acquire the individual identity of the pet;
and S4, determining feeding parameters matched with the individual identities of the pets, and delivering food according to the feeding parameters.
Preferably, step S1 further comprises:
step S11, determining the latest feeding time of each pet to be fed;
and step S12, setting time before the latest feeding time, starting an image acquisition module, and continuously acquiring images of the feeding area of the pet.
Preferably, step S2 further comprises:
step S21, outputting detection frame coordinates, confidence coefficient and pet prediction category containing pets based on the pet detection model;
step S22, filtering the detection frame with the confidence coefficient lower than the preset value, and reserving a pet image area containing the pet.
Preferably, before step S21, further comprising training the pet detection model by:
step S211, images with different pet types, different backgrounds, different postures and different illumination conditions are obtained to serve as training data, and labeling of pet target frames and categories is carried out on the training data;
step S212, processing the training data based on a pet detection model to be trained to obtain output containing the detection frame coordinates, confidence level and pet prediction type of the pet;
step S213, determining total loss L of the pet detection model based on the following formula det :
L det = λ coord * L coord + λ conf * L conf + λ cls * L cls ;
Wherein L is coord 、L conf 、L cls Respectively coordinate regression loss, confidence loss and classification loss, lambda coord 、λ conf 、λ cls Weights of coordinate regression loss, confidence loss and classification loss respectively;
step S214, based on total loss L det Updating the weight parameters to be optimized of the pet detection model until the weight parameters to be optimized are converged, and obtaining the final pet detection model.
Preferably, step S3 further includes:
step S31, obtaining a feature vector of a pet based on a pet identity recognition model;
and S32, calculating the distance between the feature vector and each sample feature vector in the database, and determining the sample feature vector with the minimum distance, thereby determining the individual identity of the pet.
Preferably, in step S31, a pet with an individual ID is usedModel training is carried out on the image data set, and the pet identity recognition model is jointly optimized by using cross entropy loss and triplet loss, wherein the total loss L of the pet identity recognition model id The method comprises the following steps:
L id = λ CE * L CE + λ Triplet * L Triplet ;
wherein L is CE 、L Triplet Respectively, cross entropy loss and triplet loss, lambda CE 、λ Triplet The weight coefficients for cross entropy loss and triplet loss, respectively.
Preferably, step S4 further comprises:
delivering the food matched with the individual identity of the pet at a set rate, and stopping delivering the food when the individual identity of the pet is not detected.
In a second aspect of the present application, a multiple pet feeding device based on image recognition, mainly comprises:
the pet feeding area image acquisition module is used for continuously acquiring images of the pet feeding area;
the pet image region acquisition module is used for detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image region containing a pet;
the pet identification module is used for identifying the identity of the pet in the pet image area based on a pre-trained pet identity identification model, and obtaining the individual identity of the pet;
and the feeding module is used for determining feeding parameters matched with the individual identities of the pets and delivering foods according to the feeding parameters.
Preferably, the pet feeding region image acquisition module comprises:
the feeding time timing unit is used for determining the latest feeding time of each pet to be fed;
the image acquisition starting unit is used for setting time before the latest feeding time, starting the image acquisition module and continuously acquiring images of the pet feeding area.
Preferably, the pet image region acquisition module further includes:
the model output unit is used for outputting detection frame coordinates, confidence and pet prediction categories containing pets based on the pet detection model;
the filtering unit is used for filtering the detection frame with the confidence coefficient lower than a preset value and reserving the pet image area containing the pet.
Preferably, further comprising training the pet detection model by:
the training data labeling unit is used for acquiring images with different pet types, different backgrounds, different postures and different illumination conditions as training data, and labeling target frames and categories of the pets for the training data;
the model actual output unit is used for processing the training data based on a pet detection model to be trained to obtain output containing the detection frame coordinates, the confidence coefficient and the pet prediction category of the pet;
a loss determination unit for determining a total loss L of the pet detection model based on the following formula det :
L det = λ coord * L coord + λ conf * L conf + λ cls * L cls ;
Wherein L is coord 、L conf 、L cls Respectively coordinate regression loss, confidence loss and classification loss, lambda coord 、λ conf 、λ cls Weights of coordinate regression loss, confidence loss and classification loss respectively;
a loop optimization unit for based on total loss L det Updating the weight parameters to be optimized of the pet detection model until the weight parameters to be optimized are converged, and obtaining the final pet detection model.
Preferably, the pet identification module includes:
the feature vector output unit is used for acquiring the feature vector of the pet based on the pet identity recognition model;
and the distance calculation unit is used for calculating the distance between the feature vector and each sample feature vector in the database, and determining the sample feature vector with the minimum distance, thereby determining the individual identity of the pet.
Preferably, model training is performed using a pet image dataset labeled with individual identity IDs, and a pet identification model is jointly optimized using cross entropy loss and triplet loss, the total loss L of the pet identification model id The method comprises the following steps:
L id = λ CE * L CE + λ Triplet * L Triplet ;
wherein L is CE 、L Triplet Respectively, cross entropy loss and triplet loss, lambda CE 、λ Triplet The weight coefficients for cross entropy loss and triplet loss, respectively.
Preferably, the feeding module comprises:
and the feeding control unit is used for delivering food matched with the individual identity of the pet at a set rate and stopping feeding the food when the pet with the individual identity is not detected.
In a third aspect of the present application, a computer device comprises a processor, a memory, and a computer program stored on the memory and executable on the processor, the processor executing the computer program for implementing the image recognition-based multi-pet feeding method as set forth in any one of the above.
In a fourth aspect of the present application, a readable storage medium stores a computer program for implementing the image recognition-based multi-pet feeding method as described above when executed by a processor.
The timing and quantitative feeding of a plurality of pets in families is realized, and the feeding burden of the pet owners is reduced.
Drawings
Fig. 1 is a flow chart of a preferred embodiment of the image recognition-based multi-pet feeding method of the present application.
Fig. 2 is a schematic structural diagram of a computer device suitable for use in implementing the terminal or server of the embodiments of the present application.
Detailed Description
For the purposes, technical solutions and advantages of the present application, the following describes the technical solutions in the embodiments of the present application in more detail with reference to the drawings in the embodiments of the present application. In the drawings, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The described embodiments are some, but not all, of the embodiments of the present application. The embodiments described below by referring to the drawings are exemplary and intended for the purpose of explaining the present application and are not to be construed as limiting the present application. All other embodiments, based on the embodiments herein, which would be apparent to one of ordinary skill in the art without undue burden are within the scope of the present application. Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
According to a first aspect of the present application, as shown in fig. 1, a multi-pet feeding method based on image recognition mainly includes:
step S1, continuously acquiring images of the feeding area of the pet.
In this step, the image of the pet feeding region, such as a camera, is continuously acquired by the image acquisition device, and the image or video of the pet feeding region can be captured for subsequent analysis. The pet feeding region may include a plurality of overlaid image acquisitions by one or more cameras.
In some alternative embodiments, step S1 further comprises:
step S11, determining the latest feeding time of each pet to be fed;
and step S12, setting time before the latest feeding time, starting an image acquisition module, and continuously acquiring images of the feeding area of the pet.
It can be appreciated that the main purpose of this embodiment is to save resources, continuously collect images of pet feeding areas through the camera, and process the collected data in the subsequent steps, which wastes larger computing resources, for this purpose, this embodiment is configured to perform image collection only when needed, that is, when the pet reaches the preset feeding time, control the camera to perform image collection, the preset feeding time can be designed according to different pets at regular time, and also determine the next feeding time according to the last feeding time and feeding interval of each pet, because this application relates to a plurality of pets, in step S11, the last feeding time of all pets needs to be obtained, then the last feeding time (a future time point) of each pet can be obtained by superimposing the feeding intervals of each pet, and then in step S12, before the last feeding time, the image collection device is started to perform continuous collection of images.
And S2, detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image area containing the pet.
In step S2, the main functions of the pet detection model are: and extracting the pet image from the continuously obtained image, and after the pet image is extracted, carrying out subsequent individual pet identification, so that food can be put in according to the need.
In some alternative embodiments, step S2 further comprises:
step S21, outputting detection frame coordinates, confidence coefficient and pet prediction category containing pets based on the pet detection model;
step S22, filtering the detection frame with the confidence coefficient lower than the preset value, and reserving a pet image area containing the pet.
In this embodiment, the confidence level is used to ensure that the pet image area including the pet is output, so that the subsequent step can identify the image therein, and the step S2 is to continuously process the image, and the processing step may be further set, that is, the image of the pet feeding area acquired in the step S1 is processed every set time period.
In some alternative embodiments, prior to step S21, further comprising training the pet detection model by:
step S211, images with different pet types, different backgrounds, different postures and different illumination conditions are obtained to serve as training data, and labeling of pet target frames and categories is carried out on the training data;
step S212, processing the training data based on a pet detection model to be trained to obtain output containing the detection frame coordinates, confidence level and pet prediction type of the pet;
step S213, determining total loss L of the pet detection model based on the following formula det :
L det = λ coord * L coord + λ conf * L conf + λ cls * L cls ;
Wherein L is coord 、L conf 、L cls Respectively coordinate regression loss, confidence loss and classification loss, lambda coord 、λ conf 、λ cls Weights of coordinate regression loss, confidence loss and classification loss respectively;
step S214, based on total loss L det Updating the weight parameters to be optimized of the pet detection model until the weight parameters to be optimized are converged, and obtaining the final pet detection model.
The pet detection model may adopt a YOLOv5 target detection algorithm, or may adopt other training models, such as models like fast R-CNN, YOLOv8, DETR, etc., unlike the existing model, in step S213, three types of loss models are introduced in the present application to calculate total loss, including coordinate regression loss formed between the pet target frame marked in the training data and the detection frame output by the model, classification loss formed between the pet category marked in the training data and the pet category output by the model, and confidence loss for indicating the presence or absence of the detection target and the accuracy of the detection frame. Training the iteration for multiple times and updating the weight of the model to reduce the loss function and ensure the convergence of the model
And S3, carrying out pet identity recognition on the pet image area based on a pre-trained pet identity recognition model, and obtaining the individual identity of the pet.
After obtaining the pet image area, the step is used for carrying out pet identification on the target area so as to distinguish different pets. And performing model training by using the pet image data set marked with the individual identity ID, and determining the most consistent individual identity of the pet according to the output feature vector after training.
It should be noted that, the pet classification introduced in step S2, such as pet dogs, pet cats, and pet birds, is aimed at promoting the accuracy of the pet image region segmentation of the pet detection model in step S2, the pet identification introduced in step S3 is specific to a specific pet, such as two pet cats, and step S3 is used for further differentiating the same.
In some alternative embodiments, step S3 further comprises:
step S31, obtaining a feature vector of a pet based on a pet identity recognition model;
and S32, calculating the distance between the feature vector and each sample feature vector in the database, and determining the sample feature vector with the minimum distance, thereby determining the individual identity of the pet.
In this embodiment, the distance is, for example, a cosine distance.
In some alternative embodiments, in step S31, model training is performed using the pet image dataset labeled with the individual identity ID, and the pet identity model is jointly optimized using cross entropy loss and triplet loss, the total loss L of the pet identity model id The method comprises the following steps:
L id = λ CE * L CE + λ Triplet * L Triplet ;
wherein L is CE 、L Triplet Respectively, cross entropy loss and triplet loss, lambda CE 、λ Triplet The weight coefficients for cross entropy loss and triplet loss, respectively.
In this embodiment, the pet identification model may be a res net50 model, or may be a model with other backbone networks, such as VGG, inception, efficientNet, mobileNet, shuffleNet, where Cross-Entropy Loss (Cross-entry Loss) and Triplet Loss (Triplet Loss) are used to jointly optimize model parameters, so that feature vectors of the same identity are as close as possible, and feature vectors of different identities are as dispersed as possible. The training is iterated for a plurality of times and the weight of the model is updated so as to reduce the loss function and ensure the convergence of the model.
And S4, determining feeding parameters matched with the individual identities of the pets, and delivering food according to the feeding parameters.
In the step, the feeding parameters comprise feeding types, meal amounts and the like, the system queries a database to obtain quantitative feeding parameters of the pets according to the identification result of the identity IDs of the pets, and the quantitative feeding of the foods is realized according to the feeding parameters.
In some alternative embodiments, step S4 further comprises:
delivering the food matched with the individual identity of the pet at a set rate, and stopping delivering the food when the individual identity of the pet is not detected.
It will be appreciated that, due to the large number of pet species, even multiple pets of the same species may be present, in order to prevent feeding crosstalk between pets, the individual pets in the pet feeding area may be continuously detected based on steps S1 to S3, and during feeding of the individual pets, other pets may be prevented from being robbed by the continuous feeding at intervals.
According to the multi-pet feeding system, timing and quantitative feeding of a plurality of pets in families can be achieved, and feeding burden of pet owners is reduced. This improvement helps promote the popularity and use of pet feeders in the home. The method can also be applied to animal husbandry breeding, such as timing and directional feeding of flocks and herds, and improves feeding efficiency.
In a second aspect of the present application, there is provided an image recognition-based multi-pet feeding device corresponding to the above method, mainly comprising:
the pet feeding area image acquisition module is used for continuously acquiring images of the pet feeding area;
the pet image region acquisition module is used for detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image region containing a pet;
the pet identification module is used for identifying the identity of the pet in the pet image area based on a pre-trained pet identity identification model, and obtaining the individual identity of the pet;
and the feeding module is used for determining feeding parameters matched with the individual identities of the pets and delivering foods according to the feeding parameters.
In some alternative embodiments, the pet feeding region image acquisition module comprises:
the feeding time timing unit is used for determining the latest feeding time of each pet to be fed;
the image acquisition starting unit is used for setting time before the latest feeding time, starting the image acquisition module and continuously acquiring images of the pet feeding area.
In some alternative embodiments, the pet image region acquisition module further comprises:
the model output unit is used for outputting detection frame coordinates, confidence and pet prediction categories containing pets based on the pet detection model;
the filtering unit is used for filtering the detection frame with the confidence coefficient lower than a preset value and reserving the pet image area containing the pet.
In some alternative embodiments, further comprising training the pet detection model by:
the training data labeling unit is used for acquiring images with different pet types, different backgrounds, different postures and different illumination conditions as training data, and labeling target frames and categories of the pets for the training data;
the model actual output unit is used for processing the training data based on a pet detection model to be trained to obtain output containing the detection frame coordinates, the confidence coefficient and the pet prediction category of the pet;
a loss determination unit for determining a total loss L of the pet detection model based on the following formula det :
L det = λ coord * L coord + λ conf * L conf + λ cls * L cls ;
Wherein L is coord 、L conf 、L cls Respectively coordinate regression loss, confidence loss and classification lossLoss of lambda coord 、λ conf 、λ cls Weights of coordinate regression loss, confidence loss and classification loss respectively;
a loop optimization unit for based on total loss L det Updating the weight parameters to be optimized of the pet detection model until the weight parameters to be optimized are converged, and obtaining the final pet detection model.
In some alternative embodiments, the pet identification module comprises:
the feature vector output unit is used for acquiring the feature vector of the pet based on the pet identity recognition model;
and the distance calculation unit is used for calculating the distance between the feature vector and each sample feature vector in the database, and determining the sample feature vector with the minimum distance, thereby determining the individual identity of the pet.
In some alternative embodiments, model training is performed using a pet image dataset labeled with individual identity IDs, and a pet identification model is co-optimized using cross entropy loss and triplet loss, the total loss L of the pet identification model id The method comprises the following steps:
L id = λ CE * L CE + λ Triplet * L Triplet ;
wherein L is CE 、L Triplet Respectively, cross entropy loss and triplet loss, lambda CE 、λ Triplet The weight coefficients for cross entropy loss and triplet loss, respectively.
In some alternative embodiments, the feeding module comprises:
and the feeding control unit is used for delivering food matched with the individual identity of the pet at a set rate and stopping feeding the food when the pet with the individual identity is not detected.
In a third aspect of the present application, a computer device includes a processor, a memory, and a computer program stored on the memory and executable on the processor, the processor executing the computer program for implementing a multiple pet feeding method based on image recognition.
In a fourth aspect of the present application, a readable storage medium stores a computer program for implementing the image recognition-based multi-pet feeding method as described above when executed by a processor. The computer-readable storage medium may be contained in the apparatus described in the above embodiment; or may be present alone without being fitted into the device. The computer readable storage medium carries one or more programs which, when executed by the apparatus, process data as described above.
Referring now to FIG. 2, a schematic diagram of a computer device 400 suitable for use in implementing embodiments of the present application is shown. The computer device shown in fig. 2 is only an example, and should not impose any limitation on the functionality and scope of use of embodiments of the present application.
As shown in fig. 2, the computer device 400 includes a Central Processing Unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data required for the operation of the device 400 are also stored. The CPU401, ROM402, and RAM403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output portion 407 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage section 408 including a hard disk or the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. The drive 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 409 and/or installed from the removable medium 411. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 401. It should be noted that, the computer storage medium of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware. The modules or units described may also be provided in a processor, the names of which do not in some cases constitute a limitation of the module or unit itself.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions easily conceivable by those skilled in the art within the technical scope of the present application should be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A multiple pet feeding method based on image recognition, comprising:
step S1, continuously acquiring images of a pet feeding area;
step S2, detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image area containing pets;
step S3, carrying out pet identity recognition on the pet image area based on a pre-trained pet identity recognition model to acquire the individual identity of the pet;
and S4, determining feeding parameters matched with the individual identities of the pets, and delivering food according to the feeding parameters.
2. The image recognition-based multi-pet feeding method of claim 1, wherein step S1 further comprises:
step S11, determining the latest feeding time of each pet to be fed;
and step S12, setting time before the latest feeding time, starting an image acquisition module, and continuously acquiring images of the feeding area of the pet.
3. The image recognition-based multi-pet feeding method of claim 1, wherein step S2 further comprises:
step S21, outputting detection frame coordinates, confidence coefficient and pet prediction category containing pets based on the pet detection model;
step S22, filtering the detection frame with the confidence coefficient lower than the preset value, and reserving a pet image area containing the pet.
4. The image recognition-based multi-pet feeding method of claim 3, further comprising training the pet detection model prior to step S21 by:
step S211, images with different pet types, different backgrounds, different postures and different illumination conditions are obtained to serve as training data, and labeling of pet target frames and categories is carried out on the training data;
step S212, processing the training data based on a pet detection model to be trained to obtain output containing the detection frame coordinates, confidence level and pet prediction type of the pet;
step S213, determining total loss L of the pet detection model based on the following formula det :
L det = λ coord * L coord + λ conf * L conf + λ cls * L cls ;
Wherein L is coord 、L conf 、L cls Respectively coordinate regression loss, confidence loss and classification loss, lambda coord 、λ conf 、λ cls Weights of coordinate regression loss, confidence loss and classification loss respectively;
step S214, based on total loss L det Updating the weight parameters to be optimized of the pet detection model until the weight parameters to be optimized are converged, and obtaining the final pet detection model.
5. The image recognition-based multi-pet feeding method of claim 1, wherein step S3 further comprises:
step S31, obtaining a feature vector of a pet based on a pet identity recognition model;
and S32, calculating the distance between the feature vector and each sample feature vector in the database, and determining the sample feature vector with the minimum distance, thereby determining the individual identity of the pet.
6. The image recognition-based multiple pet feeding method of claim 5, wherein in step S31, model training is performed using a pet image dataset labeled with individual identity IDs, and a pet identity model is jointly optimized using cross entropy loss and triplet loss, the total loss L of the pet identity model id The method comprises the following steps:
L id = λ CE * L CE + λ Triplet * L Triplet ;
wherein L is CE 、L Triplet Respectively, cross entropy loss and triplet loss, lambda CE 、λ Triplet The weight coefficients for cross entropy loss and triplet loss, respectively.
7. The image recognition-based multi-pet feeding method of claim 1, wherein step S4 further comprises:
delivering the food matched with the individual identity of the pet at a set rate, and stopping delivering the food when the individual identity of the pet is not detected.
8. A multiple pet feeding device based on image recognition, comprising:
the pet feeding area image acquisition module is used for continuously acquiring images of the pet feeding area;
the pet image region acquisition module is used for detecting a plurality of continuously input images based on a pre-trained pet detection model to obtain a pet image region containing a pet;
the pet identification module is used for identifying the identity of the pet in the pet image area based on a pre-trained pet identity identification model, and obtaining the individual identity of the pet;
and the feeding module is used for determining feeding parameters matched with the individual identities of the pets and delivering foods according to the feeding parameters.
9. The image recognition based multi-pet feeding method of claim 8, wherein the pet feeding region image acquisition module comprises:
the feeding time timing unit is used for determining the latest feeding time of each pet to be fed;
the image acquisition starting unit is used for setting time before the latest feeding time, starting the image acquisition module and continuously acquiring images of the pet feeding area.
10. The image recognition-based multi-pet feeding method of claim 8, wherein the feeding module comprises:
and the feeding control unit is used for delivering food matched with the individual identity of the pet at a set rate and stopping feeding the food when the pet with the individual identity is not detected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311666354.5A CN117475480A (en) | 2023-12-07 | 2023-12-07 | Multi-pet feeding method and device based on image recognition |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311666354.5A CN117475480A (en) | 2023-12-07 | 2023-12-07 | Multi-pet feeding method and device based on image recognition |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117475480A true CN117475480A (en) | 2024-01-30 |
Family
ID=89629516
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311666354.5A Pending CN117475480A (en) | 2023-12-07 | 2023-12-07 | Multi-pet feeding method and device based on image recognition |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117475480A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN211832336U (en) * | 2019-12-17 | 2020-11-03 | 广东顺德雷舜信息科技有限公司 | Pet feeding device and pet feeding system |
CN113420708A (en) * | 2021-07-06 | 2021-09-21 | 深圳市商汤科技有限公司 | Pet nursing method and device, electronic equipment and storage medium |
CN114793929A (en) * | 2022-04-27 | 2022-07-29 | 东南大学 | Multi-species pet feeding system based on visual identification and feeding method thereof |
CN116012414A (en) * | 2022-12-31 | 2023-04-25 | 湖南大学 | Video processing method, device, computer equipment and storage medium |
CN116224876A (en) * | 2023-03-13 | 2023-06-06 | 广东工业大学 | Multifunctional pet feeding machine and control method and device thereof |
CN116798066A (en) * | 2023-02-15 | 2023-09-22 | 西北农林科技大学 | Sheep individual identity recognition method and system based on deep measurement learning |
-
2023
- 2023-12-07 CN CN202311666354.5A patent/CN117475480A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN211832336U (en) * | 2019-12-17 | 2020-11-03 | 广东顺德雷舜信息科技有限公司 | Pet feeding device and pet feeding system |
CN113420708A (en) * | 2021-07-06 | 2021-09-21 | 深圳市商汤科技有限公司 | Pet nursing method and device, electronic equipment and storage medium |
CN114793929A (en) * | 2022-04-27 | 2022-07-29 | 东南大学 | Multi-species pet feeding system based on visual identification and feeding method thereof |
CN116012414A (en) * | 2022-12-31 | 2023-04-25 | 湖南大学 | Video processing method, device, computer equipment and storage medium |
CN116798066A (en) * | 2023-02-15 | 2023-09-22 | 西北农林科技大学 | Sheep individual identity recognition method and system based on deep measurement learning |
CN116224876A (en) * | 2023-03-13 | 2023-06-06 | 广东工业大学 | Multifunctional pet feeding machine and control method and device thereof |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Fernandes et al. | A novel automated system to acquire biometric and morphological measurements and predict body weight of pigs via 3D computer vision | |
Nir et al. | 3D Computer-vision system for automatically estimating heifer height and body mass | |
Zhang et al. | Real-time sow behavior detection based on deep learning | |
Wang et al. | ASAS-NANP SYMPOSIUM: Applications of machine learning for livestock body weight prediction from digital images | |
Lee et al. | Practical monitoring of undergrown pigs for IoT-based large-scale smart farm | |
CN107680080B (en) | Sample library establishing method and checking method for livestock, storage medium and electronic equipment | |
CN111467074B (en) | Method and device for detecting livestock status | |
CN110826371A (en) | Animal identification method, device, medium and electronic equipment | |
Noe et al. | Automatic detection and tracking of mounting behavior in cattle using a deep learning-based instance segmentation model | |
Guo et al. | Detecting broiler chickens on litter floor with the YOLOv5-CBAM deep learning model | |
CN107392119A (en) | A kind of cattle farm monitor video method for real time filtering and system based on Spark Streaming | |
Yang et al. | A defencing algorithm based on deep learning improves the detection accuracy of caged chickens | |
Dao et al. | Automatic cattle location tracking using image processing | |
CN117475480A (en) | Multi-pet feeding method and device based on image recognition | |
CN109886721A (en) | A kind of pork price forecasting system algorithm | |
KR102528286B1 (en) | Automatic feeding system and method for fish farms based on AI | |
CN113971227B (en) | Big data based livestock monitoring method, system and readable storage medium | |
Nasiri et al. | An automated video action recognition-based system for drinking time estimation of individual broilers | |
Warhade et al. | Attention module incorporated transfer learning empowered deep learning-based models for classification of phenotypically similar tropical cattle breeds (Bos indicus) | |
CN115619823A (en) | Object putting method, device, terminal and computer readable storage medium | |
CN115482419A (en) | Data acquisition and analysis method and system for marine fishery products | |
Li et al. | Recognition of fine-grained sow nursing behavior based on the SlowFast and hidden Markov models | |
Bastiaansen et al. | Continuous real-time cow identification by reading ear tags from live-stream video | |
CN115760904A (en) | Livestock and poultry statistical method, device, electronic equipment and medium | |
CN113532616A (en) | Weight estimation method, device and system based on computer vision |
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 |