Pet food bowl remaining food detection method, system, device and readable storage medium
By cropping and grayscale processing of the pet food pot images, and using the detection model to identify the food state, the problem of inaccurate judgment of food surplus in pet food pots is solved, and fast and accurate grain detection and feeding management are achieved.
Patent Information
- Application Number
- CN202310354390.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2043-03-29
AI Technical Summary
In the prior art, it is difficult to quickly and accurately judge the surplus of pet food bowls, resulting in inaccurate feeding of pets, which may cause waste or hunger to pets.
By cutting and grayscale processing of the food pot image data set, grayscale features are extracted, and the food pot residual grain detection model is used to identify the grain location and area, and the food pot state is judged based on the comparison of the largest, minimum and average area, and a feedback control signal is generated to add grain.
It achieves rapid and accurate judgment of the food surplus in the food bowl, reduces waste, and ensures the ease and accuracy of pet feeding.
Smart Images

Figure CN116386030B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to a method, system, device and readable storage medium for detecting the remaining food in a pet food bowl. Background Art
[0002] Raising pets has become an integral part of people's lives. In the prior art, there are more and more safety stewards for pets, which will monitor pets in all aspects. In addition, it is also possible to take pictures or shoot videos of the pet food in the pet food bowl. However, according to the breeders, they can only observe the remaining situation of the pet food in the pet food bowl by observing the video or picture, and cannot quickly know whether the pet food is lacking. Either they feed the pet regularly, which will cause waste, or the feeding time is too long and the pet will be hungry. In short, they cannot accurately feed. How can we quickly and accurately know the remaining pet food? Summary of the Invention
[0003] The present invention aims at the disadvantages in the prior art and provides a method, system, device and readable storage medium for detecting the remaining food in a pet food bowl.
[0004] In order to solve the above technical problems, the present invention is solved by the following technical solutions:
[0005] A method for detecting the remaining food in a pet food bowl includes the following steps:
[0006] Cropping and marking each food bowl food picture in the food bowl image dataset to obtain a food bowl area picture to form a food bowl area dataset;
[0007] Performing grayscale processing on the food bowl area picture to obtain a food bowl area grayscale picture, and extracting the grayscale features of the food bowl area grayscale picture to form a grayscale feature dataset;
[0008] Presetting the maximum area, median area and minimum area corresponding to the grayscale features in the food bowl area grayscale picture, wherein the maximum area corresponds to the picture of the food bowl being full of food, the median area corresponds to the picture of the food bowl being in the median state of food, and the minimum area corresponds to the picture of the food bowl having no food;
[0009] Identifying the picture of the food to be detected in the food bowl based on the food bowl remaining food detection model to obtain the position and corresponding area of the remaining food in the food bowl, wherein the food bowl remaining food detection model is trained based on the grayscale feature dataset;
[0010] Comparing the corresponding area with the maximum area, median area and minimum area respectively to determine the state of the food in the food bowl. If it is close to or is the minimum area, it is determined that there is no food.
[0011] As an implementable manner, it further includes the following steps:
[0012] Obtain a food bowl image dataset, where the size of each picture in the food bowl image dataset is a fixed size.
[0013] As an implementable manner, extracting the gray-scale features of the gray-scale picture of the food bowl area includes the following steps:
[0014] Convert the gray-scale picture of the food bowl area into a gray-scale matrix and form a one-dimensional array, where each element in the one-dimensional array represents the gray-scale value of a pixel point;
[0015] Cluster the pixel points based on a clustering algorithm, classify the points with similar pixel gray-scale values into the same category and extract the gray-scale features to obtain the gray-scale features of the gray-scale image.
[0016] As an implementable manner, cropping and labeling each food bowl grain picture in the food bowl image dataset to obtain a food bowl area picture to form a food bowl area dataset includes the following steps:
[0017] Determine the cropping area based on the center point, width and height of the food bowl grain area;
[0018] Based on the pre-cropping area, use the cropping function provided by the image processing library to crop the original image to obtain an initial food bowl area picture;
[0019] Calibrate the concentrated area and / or scattered area of the initial food bowl area picture to obtain a food area image, form a food area dataset, and save the specific positions of the concentrated area and / or scattered area to form a specific position set. The specific position includes the coordinate information and the position information in each picture of the annotation box in each picture.
[0020] As an implementable manner, it further includes the following steps:
[0021] When the grain area only includes the concentrated area, determine the cropping area based on the center point, width and height of the concentrated area;
[0022] When there are also scattered areas in the food bowl grains, use the center point of the concentrated area as the center point, and use the outermost width and height of the scattered area as the width and height of the cropping area to determine the cropping area.
[0023] As an implementable manner, the food bowl remaining grain detection model is trained based on the gray-scale feature dataset, including the following steps:
[0024] Preset a remaining grain detection pre-trained model, where a cross-entropy loss function is added to the remaining grain detection pre-trained model;
[0025] Form a training sample set and a test sample set from the grayscale feature data set, train the pre-trained model for remaining grain detection based on the training sample set, and test it based on the test sample set, so as to obtain a food bowl remaining grain detection model;
[0026] Among them, the cross-entropy loss function is expressed as follows:
[0027]
[0028] Among them, S 2 represents the number of grayscale features, B represents the number of bounding boxes predicted for each grid, represents whether the j-th bounding box in the i-th grid contains an object, represents the probability that the model predicts that this bounding box contains an object.
[0029] As an implementable manner, the following steps are further included:
[0030] Before cropping, preprocess each food bowl grain picture in the food bowl image data set, and the preprocessing includes one or more of random rotation, scaling, translation, brightness adjustment, and contrast adjustment.
[0031] As an implementable manner, the following steps are further included:
[0032] When it is judged that there is no grain, generate a feedback control signal, feedback the situation of no grain and control the feeding mechanism to add grain.
[0033] A pet food bowl remaining grain detection system includes a cropping and marking module, a grayscale extraction module, a preset module, a result recognition module, and a comparison and judgment module;
[0034] The cropping and marking module is used to crop and mark each food bowl grain picture in the food bowl image data set to obtain a food bowl area picture to form a food bowl area data set;
[0035] The grayscale extraction module is used to perform grayscale processing on the food bowl area picture to obtain a food bowl area grayscale picture, extract the grayscale features of the food bowl area grayscale picture, and form a grayscale feature data set;
[0036] The preset module is used to preset the maximum area, median area, and minimum area corresponding to the grayscale features in the food bowl area grayscale picture, where the maximum area corresponds to the picture of the food bowl being full of grain, the median area corresponds to the picture of the food bowl in the median state of grain, and the minimum area corresponds to the picture of the food bowl without grain;
[0037] The result recognition module is configured to: identify the to-be-detected food bowl grain picture based on the food bowl remaining grain detection model, and obtain the position and corresponding area of the remaining grain in the food bowl, wherein the food bowl remaining grain detection model is trained based on the gray feature dataset;
[0038] The comparison and judgment module is used to compare the corresponding area with the maximum area, the median area, and the minimum area respectively to judge the state of the food bowl grain. If it is close to or is the minimum area, it is judged that there is no grain.
[0039] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the method as described above.
[0040] A video collection processing device includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the method as described above is implemented.
[0041] Due to the adoption of the above technical solutions, the present invention has significant technical effects:
[0042] Through the method of the present invention, the remaining situation of the food bowl remaining grain can be quickly understood. If it is close to or there is no grain, a feedback control signal will be generated to feedback the situation of no grain and control the feeding mechanism to add grain;
[0043] It makes pet feeding easier and more convenient, and can accurately determine the remaining degree, which can reduce waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0045] Figure 1 It is a flow schematic diagram of the method of the present invention;
[0046] Figure 2 It is a schematic diagram of the overall structure of the system of the present invention;
[0047] Figure 3 It is a flow schematic diagram of extracting the gray features of the gray picture of the food bowl area. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0048] The present invention will be further described in detail below in conjunction with embodiments. The following embodiments are explanations of the present invention, and the present invention is not limited to the following embodiments.
[0049] Embodiment 1:
[0050] A method for detecting the remaining food in a pet food bowl, as Figure 1 shown, includes the following steps:
[0051] S100. Crop and label each food bowl grain picture in the food bowl image dataset to obtain a food bowl area picture to form a food bowl area dataset;
[0052] S200. Perform grayscale processing on the food bowl area picture to obtain a food bowl area grayscale picture, extract the grayscale features of the food bowl area grayscale picture, and form a grayscale feature dataset;
[0053] S300. Preset the maximum area, median area, and minimum area corresponding to the grayscale features in the food bowl area grayscale picture, where the maximum area corresponds to the picture of the food bowl being full of grain, the median area corresponds to the picture of the food bowl in the median state of grain, and the minimum area corresponds to the picture of the food bowl having no grain;
[0054] S400. Identify the position and corresponding area of the remaining grain in the food bowl to be detected based on the food bowl remaining grain detection model, where the food bowl remaining grain detection model is trained based on the grayscale feature dataset;
[0055] S500. Compare the corresponding area with the maximum area, median area, and minimum area respectively to determine the state of the food bowl grain. If it is close to or equal to the minimum area, it is determined that there is no grain.
[0056] In the prior art, pets may be fed at regular intervals. In this case, it may cause waste or the feeding time may be too long, and the pet will be hungry. In short, the feeding cannot be accurate. However, through the method of the present invention, the remaining situation of the food in the food bowl can be quickly understood; it makes pet feeding easier and more convenient, and can accurately determine the remaining degree, which can reduce waste.
[0057] In addition, in order to more accurately identify the food in the pictures of the food bowl to be detected, or to reduce the number of subsequent comparisons, at least three pictures will be set or selected first, namely, the picture of the food bowl full of food, the picture of the food bowl with the food at the median state, and the picture of the food bowl without food. The maximum area, the median area, and the minimum area corresponding to the gray-scale features in the gray-scale picture of the food bowl area, where the maximum area corresponds to the picture of the food bowl full of food, the median area corresponds to the picture of the food bowl with the food at the median state, and the minimum area corresponds to the picture of the food bowl without food. The pictures of the food bowl with food to be detected are identified by the food bowl remaining food detection model to obtain the position and the corresponding area of the remaining food in the food bowl. By the position and the corresponding area (this area is actually the gray-scale feature obtained by the food bowl remaining food detection model for identifying the pictures of the food bowl with food to be detected), this gray-scale feature is compared with the maximum area, the median area, and the minimum area respectively, and then the state of the food in the food bowl is judged. If it is close to or is the minimum area, it is judged that there is no food.
[0058] In one embodiment, the following steps are further included: obtaining a food bowl image data set, where the size of each picture in the food bowl image data set is a fixed size. In this embodiment, since the position of the food bowl is in a specific area, when collecting the remaining food in the food bowl each time, the angle and height of the camera are fixed for the food bowl. Therefore, in order to make the subsequent algorithm execution more energy-efficient and convenient, when collecting the food bowl images, try to ensure that the size of each picture in the food bowl image data set is a fixed size, so that it is also convenient to set the cropping size when cropping.
[0059] In one embodiment, the gray-scale features of the gray-scale picture of the food bowl area are extracted, as Figure 3 shown, including the following steps:
[0060] S210: Convert the gray-scale picture of the food bowl area into a gray-scale matrix and form a one-dimensional array, where each element in the one-dimensional array represents the gray-scale value of a pixel point;
[0061] S220: Cluster the pixel points based on the clustering algorithm, classify the pixel points with similar gray-scale values into the same category and extract the gray-scale features to obtain the gray-scale features of the gray-scale image.
[0062] The purpose of clustering the pixel points through the clustering algorithm is to characterize the food in the food bowl, and then extract them together in the same category, so as to obtain the gray-scale features occupied by the food in the food bowl. This gray-scale feature represents the amount of food, that is, the quantity of food.
[0063] In addition, since the entire original image is relatively large and there are many unnecessary regions, in order to make the results of the food bowl remaining grain detection model more accurate and the recognition speed faster, each food bowl grain image in the food bowl image dataset can be cropped and marked first to obtain food bowl region images to form a food bowl region dataset, including the following steps:
[0064] Determine the cropping region based on the center point, width, and height of the food bowl grain region;
[0065] Based on the pre-cropping region, use the cropping function provided by the image processing library to crop the original image to obtain the initial food bowl region image;
[0066] Calibrate the concentrated region and / or scattered region in the initial food bowl region image to obtain the food region image, form the food region dataset, and save the specific positions of the concentrated region and / or scattered region to form a specific position set. The specific position includes the specific position of the annotation box in each image, including the coordinate information and the position information in each image.
[0067] In addition, in actual operation, the grain region is sometimes very concentrated and sometimes very scattered, that is, there will be a concentrated region, and occasionally there will also be a scattered region. When the grain region only includes the concentrated region, determine the cropping region based on the center point, width, and height of the concentrated region; when there is also a scattered region in the food bowl grain, use the center point of the concentrated region as the center point, and use the outermost width and height of the scattered region as the width and height of the cropping region to determine the cropping region. In order to make the cropping region cropped to the maximum range and the results of the gray-scale features more accurate, different boundaries will be used as the width and height of the cropping region when the grain regions are different.
[0068] In one embodiment, the food bowl remaining grain detection model is trained based on the gray-scale feature dataset, including the following steps:
[0069] Preset a remaining grain detection pre-training model, where a cross-entropy loss function is added to the remaining grain detection pre-training model;
[0070] Form a training sample set and a test sample set from the gray-scale feature dataset, train the remaining grain detection pre-training model based on the training sample set, and test it based on the test sample set to obtain the food bowl remaining grain detection model;
[0071] Among them, the cross-entropy loss function is expressed as follows:
[0072]
[0073] Among them, S 2 represents the number of gray-scale features, B represents the number of bounding boxes predicted by each grid, Indicates whether the j-th bounding box in the i-th grid contains an object. Indicates the probability that the bounding box predicted by the model contains an object.
[0074] Since the remaining food detection model in the food bowl is trained based on pictures of the remaining food in the food bowl, and the edges of the remaining food in the pictures of the remaining food in the food bowl are not as smooth as imagined, therefore, a cross-entropy loss function is added when constructing the pre-trained model for remaining food detection, making the results more accurate.
[0075] Again, use Keras-YOLOv3 to implement the YOLOv3 algorithm or other more optimized YOLOvX series algorithms. This algorithm uses a convolutional neural network to detect the gray-scale features in the image. The input of the remaining food detection model in the food bowl is an image, and the output of the remaining food detection model in the food bowl is the position and quantity of the detected remaining food. The remaining food detection model in the food bowl uses a convolutional neural network to extract the gray-scale features of the image, and then the quantity of the remaining food can be determined.
[0076] For the training of the pre-trained model for remaining food detection, during the training, the stochastic gradient descent algorithm is used to adjust the parameters of the model. Then, a cross-entropy loss function is added to measure the performance of the model. Finally, after the pre-trained model for remaining food detection is trained, to evaluate the performance of the model, the conventional operation of using the test set is adopted to evaluate the performance and accuracy of the model.
[0077] Before the training of the pre-trained model for remaining food detection, the following steps are also included:
[0078] Before cropping, each picture of the food in the food bowl in the food bowl image dataset is pre-processed. The pre-processing includes one or more of random rotation, scaling, translation, brightness adjustment, and contrast adjustment. After pre-processing, it is divided into a training sample set and a test sample set, and the pre-trained model for remaining food detection is trained and tested through the training sample set and the test sample set.
[0079] Finally, for more convenience, the following steps are also included:
[0080] When it is judged that there is no food, a feedback control signal is generated, and the situation of no food is fed back and the feeding mechanism is controlled to add food.
[0081] Through the method of the present invention, the remaining situation of the remaining food in the food bowl can be quickly understood; it makes pet feeding easier and more convenient, and can accurately determine the remaining degree, reducing waste. And if there is no food or the situation is close to running out of food, this information will be fed back to the user or directly to the intelligent housekeeper for feeding, notifying the corresponding person or the intelligent housekeeper for feeding.
[0082] Example 2:
[0083] A pet food bowl remaining food detection system, as Figure 2 shown, includes a cropping and marking module 100, a grayscale extraction module 200, a preset module 300, a result recognition module 400, and a comparison and judgment module 500;
[0084] The cropping and marking module 100 is used to crop and mark each pet food bowl picture in the pet food bowl image dataset to obtain a pet food bowl area picture to form a pet food bowl area dataset;
[0085] The grayscale extraction module 200 is used to perform grayscale processing on the pet food bowl area picture to obtain a pet food bowl area grayscale picture, extract the grayscale features of the pet food bowl area grayscale picture, and form a grayscale feature dataset;
[0086] The preset module 300 is used to preset the maximum area, median area, and minimum area corresponding to the grayscale features in the pet food bowl area grayscale picture. Among them, the maximum area corresponds to the picture of the pet food bowl being full of food, the median area corresponds to the picture of the pet food bowl being in the median state of food, and the minimum area corresponds to the picture of the pet food bowl having no food;
[0087] The result recognition module 400 is configured to: recognize the to-be-detected pet food bowl picture based on the pet food bowl remaining food detection model to obtain the position and corresponding area of the remaining food in the pet food bowl, where the pet food bowl remaining food detection model is trained based on the grayscale feature dataset;
[0088] The comparison and judgment module 500 is used to compare the corresponding area with the maximum area, median area, and minimum area respectively to judge the state of the pet food bowl. If it is close to or is the minimum area, it is judged that there is no food.
[0089] It further includes a feedback control module 600;
[0090] The feedback control module 600 is configured to: when it is judged that there is no food, generate a feedback control signal, feedback the situation of no food and control the feeding mechanism to add food. If there is no food or it is close to the situation of no food, this information will be fed back to the user or directly to the intelligent housekeeper for feeding, notifying the corresponding person or the intelligent housekeeper for feeding.
[0091] In the prior art, it may be to feed the pet regularly. In this case, in fact, it will cause waste or the feeding time is too long, and the pet will be hungry. In short, it cannot feed accurately. However, through the method of the present invention, it can quickly understand the remaining situation of the remaining food in the pet food bowl; make pet feeding easier and more convenient, and can accurately determine the remaining degree, and can reduce waste.
[0092] In addition, in order to more accurately identify the food in the detected food bowl image or reduce the number of subsequent comparisons, at least three images will be set or selected first, namely, the image of the food bowl full of food, the image of the food bowl with the food at the median level, and the image of the food bowl without food. The maximum area, median area, and minimum area corresponding to the gray-scale features in the gray-scale image of the food bowl area, where the maximum area corresponds to the image of the food bowl full of food, the median area corresponds to the image of the food bowl with the food at the median level, and the minimum area corresponds to the image of the food bowl without food. The detected food bowl image is identified by the food bowl remaining food detection model to obtain the position and corresponding area of the remaining food in the food bowl. Through the position and corresponding area (this area is actually the gray-scale feature obtained by the food bowl remaining food detection model for identifying the detected food bowl image), this gray-scale feature is compared with the maximum area, median area, and minimum area respectively, and then the state of the food bowl is judged. If it is close to or equal to the minimum area, it is judged that there is no food.
[0093] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, refer to the partial description of the method embodiment.
[0094] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, refer to each other.
[0095] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the present invention can be implemented in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0097] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device, and the instruction device implements the functions specified in one process Figure 1 or more processes and / or blocks Figure 1 or more blocks.
[0098] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one process Figure 1 or more processes and / or blocks Figure 1 or more blocks.
[0099] In addition, it should be noted that for the specific embodiments described in this specification, the shapes, names of the components, etc. can be different. Any equivalent or simple changes made according to the structure, features, and principles described in the inventive concept of this patent are included in the protection scope of this patent. Those skilled in the technical field to which this invention pertains can make various modifications, supplements, or use similar methods of substitution to the specific embodiments described, as long as they do not deviate from the structure of this invention or exceed the scope defined by this claims, they should fall within the protection scope of this invention.
Claims
1. A method for detecting the remaining food in a pet food bowl, characterized in that, It includes the following steps: Crop and label each food bowl grain picture in the food bowl image dataset to obtain food bowl area pictures to form a food bowl area dataset; Perform grayscale processing on the food bowl area pictures to obtain food bowl area grayscale pictures, extract the grayscale features of the food bowl area grayscale pictures, and form a grayscale feature dataset; Obtain the maximum area, median area, and minimum area corresponding to the grayscale features in the food bowl area grayscale pictures. Among them, the maximum area corresponds to the picture of the food bowl full of grain, the median area corresponds to the picture of the food bowl with the median amount of grain, and the minimum area corresponds to the picture of the food bowl without grain; Based on the food bowl remaining grain detection model, identify the picture of the food bowl with grain to be detected, and obtain the position and corresponding area of the remaining grain in the food bowl. Among them, the food bowl remaining grain detection model is trained based on the grayscale feature dataset; Compare the corresponding area with the maximum area, median area, and minimum area respectively to determine the state of the food bowl grain. If it is close to or equal to the minimum area, it is determined that there is no grain.
2. The method for detecting remaining food in a pet food bowl according to claim 1, wherein It also includes the following steps: Obtain the food bowl image dataset, where the size of each picture in the food bowl image dataset is a fixed size.
3. The pet food bowl remaining food detection method according to claim 1, characterized in that, The extraction of the grayscale features of the food bowl area grayscale pictures includes the following steps: Convert the food bowl area grayscale picture into a grayscale matrix and form a one-dimensional array, where each element in the one-dimensional array represents the grayscale value of a pixel point; Based on the clustering algorithm, cluster pixel point by pixel point, divide the points with similar pixel point grayscale values into the same category and extract the grayscale features to obtain the grayscale features of the grayscale image.
4. The pet food bowl remaining food detection method according to claim 1, wherein The step of cropping and labeling each food bowl grain picture in the food bowl image dataset to obtain food bowl area pictures to form a food bowl area dataset includes the following steps: Determine the cropping area based on the center point, width, and height of the food bowl grain area; Based on the pre-cropping area, use the cropping function provided by the image processing library to crop the original image to obtain the initial food bowl area picture; Calibrate the concentrated area and / or scattered area of the initial food bowl area picture to obtain the food area image, form a food area dataset, and save the specific positions of the concentrated area and / or scattered area to form a specific position set. The specific position includes the coordinate information and the position information in each picture of the annotation box.
5. The method for detecting the remaining food in a pet food bowl according to claim 4, characterized in that, It also includes the following steps: When the grain area only includes the concentrated area, determine the cropping area based on the center point, width, and height of the concentrated area; When there are still scattered areas in the food bowl grain, use the center point of the concentrated area as the center point, and use the outermost width and height of the scattered area as the width and height of the cropping area to determine the cropping area.
6. The method for detecting remaining food in a pet food bowl according to claim 1, wherein The food bowl remaining grain detection model is trained based on the grayscale feature dataset, including the following steps: Preset a remaining grain detection pre-training model, where the cross-entropy loss function is added to the remaining grain detection pre-training model; Form a training sample set and a test sample set from the grayscale feature dataset, train the remaining grain detection pre-training model based on the training sample set, and test it based on the test sample set to obtain the food bowl remaining grain detection model; Among them, the cross-entropy loss function is expressed as follows: Among them, S 2 represents the number of grayscale features, B represents the number of predicted bounding boxes for each grid, indicates whether the j-th bounding box in the i-th grid contains an object, represents the probability that the model predicts this bounding box contains an object.
7. The method for detecting the remaining food in a pet food bowl according to claim 1, characterized in that, It further includes the following steps: Before cropping, each food bowl grain picture in the food bowl image dataset is preprocessed, and the preprocessing includes one or more of random rotation, scaling, translation, brightness adjustment, and contrast adjustment.
8. The method for detecting remaining food in a pet food bowl according to claim 1, characterized in that It further includes the following steps: When it is judged that there is no grain, a feedback control signal is generated to feedback the situation of no grain and control the feeding mechanism to add grain.
9. A pet food bowl remaining food detection system, characterized in that, It includes a cropping and marking module, a grayscale extraction module, a preset module, a result recognition module, and a comparison and judgment module; The cropping and marking module is used to crop and mark each food bowl grain picture in the food bowl image dataset to obtain a food bowl area picture to form a food bowl area dataset; The grayscale extraction module is used to perform grayscale processing on the food bowl area picture to obtain a food bowl area grayscale picture, and extract the grayscale features of the food bowl area grayscale picture to form a grayscale feature dataset; The preset module is used to preset the maximum area, median area, and minimum area corresponding to the grayscale features in the food bowl area grayscale picture, where the maximum area corresponds to the picture of the food bowl being full of grain, the median area corresponds to the picture of the food bowl in the median state of grain, and the minimum area corresponds to the picture of the food bowl having no grain; The result recognition module is configured to: identify the picture of the food bowl grain to be detected based on the food bowl remaining grain detection model to obtain the position and corresponding area of the remaining grain in the food bowl, where the food bowl remaining grain detection model is trained based on the grayscale feature dataset; The comparison and judgment module is used to compare the corresponding area with the maximum area, median area, and minimum area respectively to judge the state of the food bowl grain. If it is close to or is the minimum area, it is judged that there is no grain.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1 to 8.
11. A video collection processing device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Intelligent pet feeding machine and pet feeding method
CN114176022A
SmartPet feeds ware
CN207201680U