Method, device and electronic device for detecting harmful animals based on video monitoring
Through video surveillance technology, combined with moving object and target detection models, combined with deep learning classification, effective detection and alarm of harmful animals in the kitchen are achieved, which solves the problem of being unable to monitor harmful animals in the existing technology and improves kitchen hygiene and safety.
Patent Information
- Application Number
- CN202011140296.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-22
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-10-22
AI Technical Summary
Existing technology cannot effectively monitor harmful animals such as rats and cockroaches in the indoor environment, making it difficult to solve kitchen hygiene and safety issues.
Using a method based on video surveillance, by acquiring the video stream, using the pre-built moving object detection model and target detection model, combined with large animal inspection targets, small animal inspection targets and other animal inspection targets, the harmful animal targets in the video stream are determined. And use the deep learning classification model to classify and track, and output alarm information.
It improves the detection rate and detection accuracy of harmful animal targets, can effectively monitor and alert the presence of harmful animals in the kitchen, and improves kitchen hygiene and safety.
Smart Images

Figure CN112464714B
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent monitoring, and in particular to a method, device and electronic device for detecting harmful animals based on video monitoring. Background Art
[0002] With the rapid development of the economy and the improvement of people's consumption level, more and more people tend to go to restaurants or order takeout to solve their three meals a day. However, many restaurants with bright and beautiful appearance have become a place of filth in the kitchen. Harmful animals hidden in the kitchen will seriously pose a great threat to the hygiene and safety of the kitchen, such as rats and cockroaches. The bacteria and viruses carried by these harmful animals will have a negative impact on the health of diners.
[0003] In the related art, the kitchen hygiene and safety problem is improved by manually monitoring harmful animal targets in the kitchen. However, since harmful animal targets such as rats and cockroaches are small in size, move quickly, and often move at night, it is very difficult to manually monitor harmful animal targets in the kitchen.
[0004] Currently, no effective solution has been proposed for the problem in related technologies that harmful animal targets in indoor environments cannot be effectively monitored. Summary of the invention
[0005] The embodiments of the present application provide a method, device and electronic device for detecting harmful animals based on video surveillance, so as to at least solve the problem in the related art that harmful animal targets in indoor environments cannot be effectively monitored.
[0006] In a first aspect, an embodiment of the present application provides a method for detecting harmful animals based on video surveillance, comprising:
[0007] Acquire a video stream; the video stream includes multiple frames of video images;
[0008] According to a pre-built moving object detection model, multiple frames of the video image are detected to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets;
[0009] Detecting the plurality of frames of the video image according to a pre-built target detection model to obtain a second pre-selected target set, wherein the second pre-selected target set includes large object targets and small object targets;
[0010] Pest animal targets in the video stream are determined according to the first pre-selected target set and the second pre-selected target set.
[0011] In some embodiments, the detecting of multiple frames of the video images according to the pre-built moving object detection model to obtain the first pre-selected target set includes:
[0012] According to the moving object detection model, multiple frames of the video image are detected to obtain contour information of multiple moving objects in the video image and coordinate information of the image sub-region corresponding to each moving object;
[0013] Calculating the pixel area of each image sub-region corresponding to the moving object according to the coordinate information of each image sub-region corresponding to the moving object;
[0014] The first pre-selected target set is obtained according to a preset pixel area threshold range and the pixel area of each moving object corresponding to the image sub-region; the pixel area threshold range includes a maximum pixel area threshold and a minimum pixel area threshold; the large motion detection target represents a moving object whose pixel area of the corresponding image sub-region is greater than the maximum pixel area threshold; the small motion detection target represents a moving object whose pixel area of the corresponding image sub-region is less than the minimum pixel area threshold; the other motion detection targets represent moving objects whose pixel areas of the corresponding image sub-regions are within the pixel area threshold interval.
[0015] In some embodiments, determining the harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set includes:
[0016] Combining the first pre-selected target set and the second pre-selected target set to obtain a first summary target set;
[0017] According to the large object target and the intersection-and-union algorithm, other motion detection targets that meet the preset filtering conditions are filtered out from the first summary target set to obtain a second summary target set;
[0018] The large motion detection targets, small motion detection targets and large object targets in the second summary target set are eliminated to obtain a final summary target set, and all targets in the final summary target set are used as harmful animal targets in the video stream.
[0019] In some embodiments, filtering out other motion detection targets that meet preset filtering conditions from the first summary target set according to the large object target and the intersection-over-union algorithm includes:
[0020] For each frame of video image, calculating a first intersection-and-union ratio between the image sub-region where each of the other motion detection targets is located and the image sub-region where each of the large object targets is located;
[0021] Comparing the first intersection-and-union ratio with a first preset intersection-and-union ratio threshold;
[0022] If the first IoU ratio is greater than or equal to the first preset IoU ratio threshold, other motion detection targets corresponding to the first IoU ratio are filtered out from the first summary target set.
[0023] In some embodiments, after determining the harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set, the method further includes:
[0024] According to the trained deep learning classification model, the harmful animal targets in the video stream are classified to obtain a set of harmful animal targets after classification; the set of harmful animal targets includes multiple harmful animal targets; wherein the deep learning classification model includes at least one of rats and cockroaches.
[0025] In some embodiments, after classifying the harmful animal targets in the video stream according to the trained deep learning classification model to obtain a set of harmful animal targets after classification, the method further includes:
[0026] Performing target tracking processing on the harmful animal targets to obtain track information of the ID corresponding to each of the harmful animal targets;
[0027] Count the number of frames in which each type of harmful animal target appears;
[0028] If the number of frames in which the harmful animal target appears is greater than a preset frame number threshold, the intensive activity area of the harmful animal target is determined based on the trajectory information of the ID corresponding to the harmful animal target, and an alarm message is output, wherein the alarm message includes the intensive activity area of the harmful animal target and the trajectory information of the corresponding ID.
[0029] In some embodiments, the method further comprises:
[0030] Calculate the height and average trajectory change rate of the harmful animal target according to the trajectory information of the ID corresponding to the harmful animal target;
[0031] Obtaining a preset height threshold range and a preset average trajectory change rate threshold range corresponding to each type of harmful animal;
[0032] The type of the harmful animal target is determined according to a preset height threshold range, a preset average trajectory change rate threshold range, and the height and average trajectory change rate of the harmful animal target.
[0033] In a second aspect, an embodiment of the present application provides a harmful animal detection device based on video surveillance, comprising:
[0034] A data acquisition module, used to acquire a video stream; the video stream includes multiple frames of video images;
[0035] A dynamic detection module, used to detect multiple frames of the video image according to a pre-built moving object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets;
[0036] A target detection module, configured to detect the plurality of frames of the video image according to a pre-built target detection model to obtain a second pre-selected target set, wherein the second pre-selected target set includes large object targets and small object targets;
[0037] The target determination module is used to determine the harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set.
[0038] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for detecting harmful animals based on video surveillance as described in the first aspect above is implemented.
[0039] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for detecting harmful animals based on video surveillance as described in the first aspect above.
[0040] Compared with the related art, the harmful animal detection method, device and electronic device based on video surveillance provided in the embodiments of the present application obtain a video stream; the video stream includes multiple frames of video images; according to a pre-constructed motion object detection model, the multiple frames of video images are detected to obtain a first pre-selected target set; the first pre-selected target set includes large motion detection targets, small motion detection targets and other motion detection targets; according to a pre-constructed target detection model, the multiple frames of video images are detected to obtain a second pre-selected target set, and the second pre-selected target set includes large object targets and small object targets; according to the first pre-selected target set and the second pre-selected target set, harmful animal targets in the video stream are determined, thereby solving the problem in the related art that harmful animal targets in indoor environments cannot be effectively monitored.
[0041] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0043] Figure 1 A flowchart of a method for detecting harmful animals based on video surveillance according to an embodiment of the present application;
[0044] Figure 2 This is a flow chart of detecting multiple frames of video images according to a moving object detection model in an embodiment of the present application;
[0045] Figure 3 This is a flow chart of detecting multiple frames of video images according to the target detection model in an embodiment of the present application;
[0046] Figure 4 A flowchart of determining harmful animal targets in a video stream according to a first pre-selected target set and a second pre-selected target set in an embodiment of the present application;
[0047] Figure 5 This is a flow chart of filtering out other dynamic detection targets that meet the preset filtering conditions from the first summary target set in an embodiment of the present application;
[0048] Figure 6 A flowchart of tracking harmful animal targets in a video stream in an embodiment of the present application;
[0049] Figure 7 A flow chart of determining the type of harmful animal target in a video stream in an embodiment of the present application;
[0050] Figure 8 A flowchart of a method for detecting harmful animals based on video monitoring according to a preferred embodiment of the present application;
[0051] Fig. 9 A hardware structure block diagram of a terminal of a harmful animal detection method based on video monitoring according to an embodiment of the present application;
[0052] Fig.10 This is a structural block diagram of a harmful animal detection device based on video surveillance according to an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.
[0054] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0055] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.
[0056] The various technologies described in this application can be applied to, but are not limited to, various indoor and outdoor harmful animal monitoring systems, platforms, and equipment.
[0057] The present application embodiment is described by taking the kitchen scene as an example. Figure 1 Flow chart of the harmful animal detection method based on video monitoring according to an embodiment of the present application, as shown in FIG. Figure 1 As shown, the process includes the following steps:
[0058] Step S110, obtaining a video stream; the video stream includes multiple frames of video images.
[0059] A video stream of a kitchen scene may be acquired from a monitoring device, where the video stream includes multiple frames of video images of the kitchen.
[0060] It should be noted that, considering the habit of harmful animals such as cockroaches and mice to hide during the day and come out at night, the acquired video stream should contain multiple frames of video images of the kitchen at night.
[0061] Step S120, detecting multiple frames of video images according to a pre-built moving object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets.
[0062] Specifically, for each frame of video image, all pixels of the video image are divided into two categories: background and motion foreground through a pre-built motion object detection model, and the background pixels of the video image are deleted to obtain a set of motion foreground pixels of the video image, i.e., the first pre-selected target set.
[0063] It should be noted that large motion detection targets refer to motion detection targets that are too large, such as kitchen staff walking in the kitchen during the day. Small motion detection targets refer to motion detection targets that are too small, such as flickering light spots. Other motion detection targets refer to motion detection targets that meet the preset harmful animal size conditions, which are set based on empirical knowledge of harmful animal sizes.
[0064] Step S130, detecting multiple frames of video images according to a pre-built target detection model to obtain a second pre-selected target set, where the second pre-selected target set includes large object targets and small object targets.
[0065] The target detection model may be constructed by using a multi-scale target detection algorithm based on deep learning, or by using other target detection algorithms, which is not limited in this embodiment.
[0066] Step S140: Determine harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set.
[0067] Through the above steps S110 to S140, a video stream is obtained; the video stream includes multiple frames of video images; according to a pre-constructed motion object detection model, the multiple frames of video images are detected to obtain a first pre-selected target set; the first pre-selected target set includes large motion detection targets, small motion detection targets and other motion detection targets; according to a pre-constructed target detection model, multiple frames of video images are detected to obtain a second pre-selected target set, and the second pre-selected target set includes large object targets and small object targets; according to the first pre-selected target set and the second pre-selected target set, harmful animal targets in the video stream are determined. The present application detects harmful animal targets in a video stream by combining the two detection methods of motion object detection and target detection, thereby avoiding the situation where harmful animal targets are missed in motion detection when they are stationary, improving the detection rate of harmful animal targets, and solving the problem in the related art that harmful animal targets in indoor environments cannot be effectively monitored.
[0068] Further, the types of large object targets include indoor staff. The types of small object targets include at least one of cockroaches and mice.
[0069] In some of these embodiments, Figure 2 This is a flow chart of detecting multiple frames of video images according to a moving object detection model in an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0070] Step S210 , detecting multiple frames of video images according to a moving object detection model, obtaining contour information of multiple moving objects in the video images and coordinate information of the image sub-region corresponding to each moving object.
[0071] The image sub-region corresponding to the moving object may be the smallest rectangular frame circumscribing the outline of the moving object, or may be an image sub-region of other shapes and sizes, as long as it can include all the pixels of the moving object in the video image.
[0072] Step S220 , calculating the pixel area of each moving object corresponding to the image sub-region according to the coordinate information of each moving object corresponding to the image sub-region.
[0073] Step S230, obtain a first pre-selected target set according to a preset pixel area threshold range and the pixel area of each moving object corresponding to the image sub-region; the pixel area threshold range includes a maximum pixel area threshold and a minimum pixel area threshold; a large motion detection target represents a moving object whose pixel area of the corresponding image sub-region is greater than the maximum pixel area threshold; a small motion detection target represents a moving object whose pixel area of the corresponding image sub-region is less than the minimum pixel area threshold; other motion detection targets represent moving objects whose pixel area of the corresponding image sub-region is within the pixel area threshold interval.
[0074] The pixel area threshold interval is set based on empirical data on the size of harmful animals and is used to classify the detected moving targets.
[0075] Specifically, according to the pixel area threshold range and the pixel area of the image sub-region corresponding to each moving object, the multiple moving objects in step S210 are classified to obtain a first pre-selected target set consisting of multiple moving detection targets of different sizes.
[0076] Through the above steps S210 to S230, multiple frames of video images are detected according to the moving object detection model to obtain contour information of multiple moving objects in the video image and coordinate information of the image sub-region corresponding to each moving object; the pixel area of the image sub-region corresponding to each moving object is calculated according to the coordinate information of the image sub-region corresponding to each moving object; according to the preset pixel area threshold range and the pixel area of the image sub-region corresponding to each moving object, the multiple moving objects detected from the video image are classified to obtain a first pre-selected target set, so as to facilitate the subsequent screening of harmful animal targets from the first pre-selected target set, thereby avoiding the situation of false detection of harmful animal targets and improving the accuracy of harmful animal target detection in video images.
[0077] In some of these embodiments, Figure 3 FIG. 1 is a flow chart of detecting multiple frames of video images according to a target detection model in an embodiment of the present application. Figure 3 As shown, the process includes the following steps:
[0078] Step S310, constructing an initial target detection model.
[0079] Step S320, obtaining training sample data; the training sample data includes a plurality of training sample images.
[0080] Step S330, determining the basic ratio setting of the initial target detection model; the basic ratio setting includes the length, width and height ratio data of harmful animals and humans.
[0081] Step S340: In the initial target detection model, a first network depth feature map for small targets and a second network depth feature map for large targets are set.
[0082] The first network depth feature map represents a feature map with a shallower network depth, and the second network depth feature map represents a feature map with a deeper network depth.
[0083] It should be noted that for small targets, using a feature map with a shallower network depth can enrich the details, thereby improving the accuracy of small object detection in the video stream. For large targets, using a feature map with a deeper network depth can enhance the fitting, thereby improving the accuracy of large object detection in the video stream.
[0084] Step S350: Perform training based on the training sample data to obtain a trained target detection model.
[0085] Through the above steps S310 to S350, an initial target detection model is constructed; training sample data is obtained; the training sample data includes multiple training sample images; the basic ratio setting of the initial target detection model is determined; the basic ratio setting includes the length, width and height ratio data of harmful animals and humans; in the initial target detection model, a first network depth feature map for small targets and a second network depth feature map for large targets are set; training is performed according to the training sample data to obtain a trained target detection model. This embodiment can reduce the false detection rate of target detection and improve the accuracy of large object target detection and small object target detection by setting the first network depth feature map for small targets and the second network depth feature map for large targets, thereby improving the reliability of harmful animal target detection results in video streams.
[0086] In some of the embodiments, in a training, the initial target detection model is trained according to the training samples to obtain a training result corresponding to this training; based on the training result, the confidence corresponding to this training is calculated; the confidence is compared with a preset confidence threshold; if the confidence is greater than the preset confidence threshold, the target detection model corresponding to this training is used as the trained target detection model.
[0087] In some of these embodiments, Figure 4 FIG. 1 is a flow chart of determining harmful animal targets in a video stream according to a first pre-selected target set and a second pre-selected target set in an embodiment of the present application. Figure 4 As shown, the process includes the following steps:
[0088] Step S410: Combine the first pre-selected target set and the second pre-selected target set to obtain a first summary target set.
[0089] Among them, the first summary target set includes large motion detection targets, small motion detection targets, other motion detection targets, large object targets and small object targets.
[0090] Step S420 , based on the large object target and the intersection-over-union algorithm, other motion detection targets that meet the preset filtering conditions are filtered out from the first summary target set to obtain a second summary target set.
[0091] The preset filtering condition is: in the same frame of video image, if other motion detection targets and the large object target are in the same image sub-area, then the other motion detection targets are filtered out from the first summary target set.
[0092] It should be noted that, in the same frame of video image, if other motion detection targets and a large object target are in the same image sub-area, it can be determined that the other motion detection targets and the large object target belong to the same detection target, and thus the other motion detection targets need to be filtered out.
[0093] For example, during the moving object detection process, if the finger of a kitchen staff member is detected to be in motion, and the pixel area of the image sub-region where the finger of the kitchen staff member is located is within the pixel area threshold interval, the finger of the kitchen staff member is determined to be another moving detection target. At the same time, during the target detection process, the kitchen staff member is detected and regarded as a large object target. Therefore, it is necessary to filter out the other moving detection targets corresponding to the finger of the kitchen staff member from the first summary target set to eliminate the interference of the human moving detection results on the harmful animal target detection in the daytime scene.
[0094] Step S430, eliminating large motion detection targets, small motion detection targets and large object targets in the second summary target set to obtain a final summary target set, and taking all targets in the final summary target set as harmful animal targets in the video stream.
[0095] Among them, the final summary target set includes other dynamic detection targets and small object targets remaining after filtering.
[0096] Through the above steps S410 to S430, other motion detection targets that meet the preset filtering conditions are filtered out from the first summary target set to eliminate the interference of human motion detection results on harmful animal target detection in daytime scenes, and large motion detection targets, small motion detection targets and large object targets in the second summary target set are eliminated to eliminate the interference of kitchen staff on harmful animal target detection, thereby further improving the accuracy of harmful animal target detection.
[0097] In some of these embodiments, Figure 5 This is a flow chart of filtering out other motion detection targets that meet the preset filtering conditions from the first summary target set in an embodiment of the present application, such as Figure 5 As shown, the process includes the following steps:
[0098] Step S510 , for each frame of video image, calculate a first intersection-over-union ratio between the image sub-region where each other motion detection target is located and the image sub-region where each large object target is located.
[0099] Step S520: compare the first IoU with a first preset IoU threshold.
[0100] Step S530: If the first IoU is greater than or equal to a first preset IoU threshold, other motion detection targets corresponding to the first IoU are filtered out from the first summary target set.
[0101] Through the above steps S510 to S530, by calculating the first IoU of each image sub-region where the large object target is located, and comparing the first IoU with the first preset IoU threshold, other dynamic detection targets overlapping with the image sub-region where the large object target is located can be quickly and effectively determined and filtered out.
[0102] In some of the embodiments, the harmful animal targets in the video stream are classified according to the trained deep learning classification model to obtain a set of classified harmful animal targets; the set of harmful animal targets includes multiple harmful animal targets.
[0103] Furthermore, the first image data of multiple harmful animals acquired in advance are used as positive samples, and the second image data of the application scenario acquired in advance are used as negative samples; an initial deep learning classification model is constructed; and the initial deep learning classification model is trained according to the positive samples and the negative samples to obtain a trained deep learning classification model.
[0104] In the above embodiment, the initial deep learning classification model is trained according to positive samples of various harmful animals and negative samples of application scenarios to obtain a trained deep learning classification model; according to the trained deep learning classification model, the detected harmful animal targets are classified more finely, thereby effectively reducing the false detection rate of small targets such as rats and cockroaches, so as to improve the accuracy of subsequent alarms.
[0105] In some of these embodiments, Figure 6 FIG. 1 is a flow chart of tracking harmful animal targets in a video stream in an embodiment of the present application. Figure 6 As shown, the process includes the following steps:
[0106] Step S610: performing target tracking processing on the harmful animal targets to obtain track information of the ID corresponding to each of the harmful animal targets.
[0107] Step S620, counting the number of frames in which each type of harmful animal target appears.
[0108] Step S630, if the number of frames where the harmful animal target appears is greater than the preset frame number threshold, the intensive activity area of the harmful animal target is determined according to the trajectory information of the ID corresponding to the harmful animal target, and an alarm message is output, which includes the intensive activity area of the harmful animal target and the trajectory information of the corresponding ID.
[0109] Through the above steps S610 to S630, target tracking processing is performed on the harmful animal targets to obtain the trajectory information of the ID corresponding to each of the harmful animal targets; the number of frames in which each harmful animal target appears is counted; if the number of frames in which the harmful animal target appears is greater than a preset frame number threshold, the intensive activity area of the harmful animal target is determined based on the trajectory information of the ID corresponding to the harmful animal target, and an alarm message is output, thereby facilitating the kitchen staff to focus on the prevention and control of the intensive activity area of the harmful animal target and improve the hygiene and safety of the kitchen.
[0110] In some of the embodiments, for each harmful animal target, the depth feature information of the image sub-region where the harmful animal target is located in each frame of video image is extracted; the second intersection-and-union ratio of the image sub-region where the harmful animal target is located in two adjacent frames of video image is calculated; if the second intersection-and-union ratio is greater than or equal to a second intersection-and-union ratio threshold, and the depth feature information corresponding to the harmful animal target in the two adjacent frames of video image matches, the ID of the harmful animal target is marked in the two adjacent frames of video image to track the harmful animal target and obtain the trajectory information of the ID corresponding to the harmful animal target.
[0111] Among them, the depth feature information includes a feature matrix composed of feature information such as edge, color, and contour.
[0112] It should be noted that if the second intersection-and-union ratio is greater than or equal to the second intersection-and-union ratio threshold, and the depth feature information corresponding to the harmful animal target in two adjacent frames of video images matches, then it is determined that the harmful animal target in the two adjacent frames of video images is the same harmful animal target, and it can be determined that the harmful animal target can be tracked, thereby further marking the ID of the harmful animal target in the two adjacent frames of video images to track the harmful animal target.
[0113] The above embodiment, by extracting the depth feature information of the image sub-region where the harmful animal target is located in each frame of video image for each harmful animal target, calculates the second intersection-and-union ratio of the image sub-region where the harmful animal target is located in two adjacent frames of video image; matches the depth feature information corresponding to the harmful animal target in two adjacent frames of video image, and compares the second intersection-and-union ratio with the second intersection-and-union ratio threshold, so as to quickly and accurately determine whether the harmful animal target in two adjacent frames of video image is the same, thereby realizing effective tracking of the harmful animal target.
[0114] In some of these embodiments, Figure 7 Flow chart of determining the type of harmful animal target in the video stream in the embodiment of the present application, such as Figure 7 As shown, the process includes the following steps:
[0115] Step S710, calculating the height and average trajectory change rate of the harmful animal target according to the trajectory information of the ID corresponding to the harmful animal target.
[0116] Specifically, the height of the harmful animal target can be determined by combining the trajectory information of different IDs and the height information output by the binocular camera.
[0117] Step S720, obtaining a preset height threshold range and a preset average trajectory change rate threshold range corresponding to each type of harmful animal.
[0118] Step S730, determining the type of the harmful animal target according to the preset height threshold range, the preset average trajectory change rate threshold range, and the height and average trajectory change rate of the harmful animal target.
[0119] It should be noted that, firstly, in the kitchen scene, the range of activities of harmful animals is mostly on the ground, or climbing up and down, so their height will remain in a very low range, or there will be a steady rise, fall and then maintain a certain height. Secondly, in the kitchen scene, harmful animals such as rats and cockroaches move quickly and agilely, with a large range of activities, and their trajectory coordinates change rapidly within a certain period of time. Therefore, the type of harmful animal target can be further determined based on the height of the harmful animal target and the average trajectory change rate, and abnormal targets with excessive changes in spatial position between the previous and next frames, such as flashing light and shadow, can be excluded; and misdetected targets that remain stationary can be excluded.
[0120] In addition, the specific type of the harmful animal target can be determined based on the height and average trajectory change rate of the harmful animal target. For example, mice are larger in size and move faster than cockroaches. In a certain movement time, the average trajectory change rate of mice is faster. Therefore, the height and average trajectory change rate of the harmful animal target can be used as auxiliary information to refine the classification of harmful animals.
[0121] In the above steps S710 to S730, the height and average trajectory change rate of the harmful animal target are calculated according to the trajectory information of the ID corresponding to the harmful animal target, and according to the preset height threshold range, the preset average trajectory change rate threshold range and the height and average trajectory change rate of the harmful animal target, false detection when the harmful animal target flashes or remains stationary for a long time is eliminated, thereby further improving the accuracy of harmful animal target detection; and, the height and average trajectory change rate of the harmful animal target are used as auxiliary information for refining the classification within the harmful animal, so as to more accurately determine the type of the harmful animal target, so as to take corresponding prevention and control measures for different types of harmful animal targets, and further improve the hygiene and safety of the kitchen.
[0122] The embodiments of the present application are described and illustrated below through preferred embodiments.
[0123] Figure 8 This is a flow chart of a method for detecting harmful animals based on video surveillance according to a preferred embodiment of the present application. The method for detecting harmful animals based on video surveillance comprises the following steps:
[0124] Step S810, obtaining a video stream; the video stream includes multiple frames of video images.
[0125] Step S820, detecting multiple frames of video images according to a pre-built moving object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets.
[0126] Step S830, according to the pre-built target detection model, multiple frames of video images are detected to obtain a second pre-selected target set, the second pre-selected target set includes large object targets and small object targets; the target detection model includes a first network deep feature map for small targets and a second network deep feature map for large targets.
[0127] Step S840, combining the first pre-selected target set and the second pre-selected target set to obtain a first summary target set; filtering out other motion detection targets that meet the preset filtering conditions from the first summary target set according to the large object target and the intersection-over-union algorithm to obtain a second summary target set.
[0128] Step S850, removing large motion detection targets, small motion detection targets and large object targets in the second summary target set to obtain a final summary target set, and using all targets in the final summary target set as harmful animal targets in the video stream.
[0129] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here. Figure 1 The execution order of step S120 and step S130 can be interchanged, that is, step S120 can be executed first, and then step S130; or step S130 can be executed first, and then step S120.
[0130] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Fig. 9 FIG. 1 is a hardware structure block diagram of a terminal of a harmful animal detection method based on video surveillance according to an embodiment of the present application. Fig. 9 As shown, the terminal may include one or more ( Fig. 9Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Fig. 9 The structure shown is only for illustration and does not limit the structure of the above terminal. Fig. 9 More or fewer components as shown, or with Fig. 9 Different configurations are shown.
[0131] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the harmful animal detection method based on video surveillance in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0132] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0133] The present embodiment also provides a kind of harmful animal detection device based on video monitoring, and this device is used to realize the above-mentioned embodiment and preferred implementation mode, and what has been described is not repeated here. As used below, the term "module", "unit", "subunit" etc. can realize the combination of software and / or hardware of predetermined function. Although the device described in the following embodiment is preferably realized by software, the realization of hardware, or the combination of software and hardware is also possible and conceived.
[0134] Fig.10FIG. 1 is a structural block diagram of a harmful animal detection device based on video monitoring according to an embodiment of the present application. Fig.10 As shown, the harmful animal detection device based on video monitoring includes:
[0135] The data acquisition module 1010 is used to acquire a video stream; the video stream includes multiple frames of video images.
[0136] The dynamic detection module 1020 is used to detect multiple frames of video images according to a pre-built motion object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large motion detection targets, small motion detection targets and other motion detection targets.
[0137] The target detection module 1030 is used to detect multiple frames of video images according to a pre-built target detection model to obtain a second pre-selected target set, where the second pre-selected target set includes large object targets and small object targets.
[0138] The target determination module 1040 is used to determine harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set.
[0139] In some embodiments, the dynamic detection module 1020 includes a dynamic detection unit, an area calculation unit, a threshold acquisition unit, and a target determination unit, wherein:
[0140] The dynamic detection unit is used to detect multiple frames of video images according to the moving object detection model to obtain the contour information of multiple moving objects in the video images and the coordinate information of the image sub-area corresponding to each moving object.
[0141] The area calculation unit is used to calculate the pixel area of each moving object corresponding to the image sub-region according to the coordinate information of each moving object corresponding to the image sub-region.
[0142] A target determination unit is used to obtain the first pre-selected target set based on a preset pixel area threshold range and the pixel area of each image sub-region corresponding to the moving object; the pixel area threshold range includes a maximum pixel area threshold and a minimum pixel area threshold; the large motion detection target represents a moving object whose pixel area of the corresponding image sub-region is greater than the maximum pixel area threshold; the small motion detection target represents a moving object whose pixel area of the corresponding image sub-region is less than the minimum pixel area threshold; and the other motion detection targets represent moving objects whose pixel areas of the corresponding image sub-regions are within the pixel area threshold interval.
[0143] In some embodiments, the target determination module 1040 includes a target combining unit, a filtering processing unit and a target determination unit, wherein:
[0144] The target combining unit is used to combine the first pre-selected target set and the second pre-selected target set to obtain a first summary target set.
[0145] The filtering processing unit is used to filter out other motion detection targets that meet the preset filtering conditions from the first summary target set according to the large object target and the intersection-over-union algorithm to obtain the second summary target set.
[0146] The target determination unit is used to eliminate the large motion detection targets, small motion detection targets and large object targets in the second summary target set to obtain a final summary target set, and use all targets in the final summary target set as harmful animal targets in the video stream.
[0147] In some of the embodiments, the filtering processing unit includes a calculation subunit, a comparison subunit and a filtering subunit, wherein:
[0148] The calculation subunit is used to calculate, for each frame of video image, a first intersection-and-union ratio between the image subregion where each other motion detection target is located and the image subregion where each large object target is located.
[0149] The comparison subunit is used to compare the first intersection-and-union ratio with a first preset intersection-and-union ratio threshold.
[0150] The filtering subunit is used to filter out other motion detection targets corresponding to the first intersection-and-union ratio from the first summary target set if the first intersection-and-union ratio is greater than or equal to a first preset intersection-and-union ratio threshold.
[0151] In some of the embodiments, the harmful animal detection device based on video surveillance also includes a target classification module, which is used to classify the harmful animal targets in the video stream according to a trained deep learning classification model to obtain a set of classified harmful animal targets; the set of harmful animal targets includes multiple harmful animal targets; wherein the deep learning classification model includes at least one of rats and cockroaches.
[0152] In some of the embodiments, the harmful animal detection device based on video surveillance further includes an alarm output module, which includes a target tracking unit, a frame number counting unit and an alarm output unit, wherein:
[0153] The target tracking unit is used to perform target tracking processing on the harmful animal targets to obtain the track information of the ID corresponding to each of the harmful animal targets.
[0154] The frame number counting unit is used to count the number of frames in which each harmful animal target appears.
[0155] The alarm output unit is used to determine the intensive activity area of the harmful animal target based on the trajectory information of the ID corresponding to the harmful animal target if the number of frames in which the harmful animal target appears is greater than the preset frame number threshold, and output alarm information, the alarm information including the intensive activity area of the harmful animal target and the trajectory information of the corresponding ID.
[0156] In some embodiments, the target classification module further includes a data calculation unit, a threshold acquisition unit, and a category determination unit, wherein:
[0157] The data calculation unit is used to calculate the height and average trajectory change rate of the harmful animal target according to the trajectory information of the ID corresponding to the harmful animal target.
[0158] The threshold acquisition unit is used to acquire a preset height threshold range and a preset average trajectory change rate threshold range corresponding to each type of harmful animal.
[0159] The type determination unit is used to determine the type of the harmful animal target according to a preset height threshold range, a preset average trajectory change rate threshold range, and the height and average trajectory change rate of the harmful animal target.
[0160] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0161] This embodiment further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0162] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0163] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0164] S1, obtaining a video stream; the video stream includes multiple frames of video images.
[0165] S2, detecting multiple frames of video images according to a pre-built moving object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets.
[0166] S3, detecting multiple frames of video images according to a pre-built target detection model to obtain a second pre-selected target set, where the second pre-selected target set includes large object targets and small object targets.
[0167] S4, determining harmful animal targets in the video stream according to the first pre-selected target set and the second pre-selected target set.
[0168] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0169] In addition, in combination with the harmful animal detection method based on video surveillance in the above embodiments, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any of the harmful animal detection methods based on video surveillance in the above embodiments is implemented.
[0170] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0171] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for detecting harmful animals based on video surveillance, It is characterized in that include: Get the video stream; The video stream includes multiple frames of video images; Detecting multiple frames of the video image according to a pre-built moving object detection model to obtain a first pre-selected target set; The first pre-selected target set includes large motion detection targets, small motion detection targets, and other motion detection targets; The first pre-selected target set is a set of motion foreground pixels of the multi-frame video images; According to a pre-built target detection model, multiple frames of the video image are detected to obtain a second pre-selected target set, wherein the second pre-selected target set includes large object targets and small object targets; the target detection model includes a first network deep feature map for small targets and a second network deep feature map for large targets; Combining the first pre-selected target set and the second pre-selected target set to obtain a first summary target set; For each frame of video image, calculating a first intersection-and-union ratio between the image sub-region where each of the other motion detection targets is located and the image sub-region where each of the large object targets is located; Comparing the first intersection-and-union ratio with a first preset intersection-and-union ratio threshold; If the first intersection-over-union ratio is greater than or equal to the first preset intersection-over-union ratio threshold, filtering out other motion detection targets corresponding to the first intersection-over-union ratio from the first summary target set to obtain a second summary target set; The large motion detection targets, small motion detection targets and large object targets in the second summary target set are eliminated to obtain a final summary target set, and all targets in the final summary target set are used as harmful animal targets in the video stream.
2. The method according to claim 1, It is characterized in that The detecting of the plurality of frames of the video images according to the pre-built moving object detection model to obtain the first pre-selected target set includes: According to the moving object detection model, multiple frames of the video image are detected to obtain contour information of multiple moving objects in the video image and coordinate information of the image sub-region corresponding to each moving object; Calculating the pixel area of each image sub-region corresponding to the moving object according to the coordinate information of each image sub-region corresponding to the moving object; The first pre-selected target set is obtained according to a preset pixel area threshold range and the pixel area of each moving object corresponding to the image sub-region; the pixel area threshold range includes a maximum pixel area threshold and a minimum pixel area threshold; the large motion detection target represents a moving object whose pixel area of the corresponding image sub-region is greater than the maximum pixel area threshold; the small motion detection target represents a moving object whose pixel area of the corresponding image sub-region is less than the minimum pixel area threshold; the other motion detection targets represent moving objects whose pixel areas of the corresponding image sub-regions are within the pixel area threshold interval.
3. The method according to claim 1, It is characterized in that The method further comprises: According to the trained deep learning classification model, the harmful animal targets in the video stream are classified to obtain a set of harmful animal targets after classification; the set of harmful animal targets includes multiple harmful animal targets; wherein the deep learning classification model includes at least one of rats and cockroaches.
4. The method according to claim 3, It is characterized in that After the harmful animal targets in the video stream are classified according to the trained deep learning classification model to obtain a set of harmful animal targets after classification, the method further includes: Performing target tracking processing on the harmful animal targets to obtain track information of the ID corresponding to each of the harmful animal targets; Count the number of frames in which each type of harmful animal target appears; If the number of frames in which the harmful animal target appears is greater than a preset frame number threshold, the intensive activity area of the harmful animal target is determined based on the trajectory information of the ID corresponding to the harmful animal target, and an alarm message is output, wherein the alarm message includes the intensive activity area of the harmful animal target and the trajectory information of the corresponding ID.
5. The method according to claim 4, It is characterized in that The method further comprises: Calculate the height and average trajectory change rate of the harmful animal target according to the trajectory information of the ID corresponding to the harmful animal target; Obtaining a preset height threshold range and a preset average trajectory change rate threshold range corresponding to each type of harmful animal; The type of the harmful animal target is determined according to a preset height threshold range, a preset average trajectory change rate threshold range, and the height and average trajectory change rate of the harmful animal target.
6. A harmful animal detection device based on video surveillance, It is characterized in that include: A data acquisition module, used to acquire a video stream; the video stream includes multiple frames of video images; A dynamic detection module, used to detect multiple frames of the video image according to a pre-built moving object detection model to obtain a first pre-selected target set; the first pre-selected target set includes large moving detection targets, small moving detection targets and other moving detection targets; The first pre-selected target set is a set of motion foreground pixels of the multi-frame video images; A target detection module is used to detect multiple frames of the video image according to a pre-built target detection model to obtain a second pre-selected target set, wherein the second pre-selected target set includes large object targets and small object targets; the target detection model includes a first network deep feature map for small targets and a second network deep feature map for large targets; The target determination module includes a target combination unit, a filtering processing unit and a target determination unit, wherein the filtering processing unit includes a calculation subunit, a comparison subunit and a filtering subunit, wherein: The target combining unit is used to combine the first pre-selected target set and the second pre-selected target set to obtain a first summary target set; The calculation subunit is used to calculate, for each frame of video image, a first intersection-and-union ratio between the image subregion where each of the other motion detection targets is located and the image subregion where each of the large object targets is located; The comparison subunit is used to compare the first intersection-and-union ratio with a first preset intersection-and-union ratio threshold; The filtering subunit is configured to filter out other motion detection targets corresponding to the first intersection-and-union ratio from the first summary target set if the first intersection-and-union ratio is greater than or equal to the first preset intersection-and-union ratio threshold, so as to obtain a second summary target set; The target determination unit is used to eliminate the large motion detection targets, small motion detection targets and large object targets in the second summary target set to obtain a final summary target set, and use all targets in the final summary target set as harmful animal targets in the video stream.
7. The device according to claim 6, It is characterized in that The dynamic detection module includes a dynamic detection unit, an area calculation unit and a target determination unit, wherein: The dynamic detection unit is used to detect multiple frames of the video image according to the moving object detection model to obtain contour information of multiple moving objects in the video image and coordinate information of the image sub-region corresponding to each moving object; The area calculation unit is used to calculate the pixel area of each image sub-region corresponding to the moving object according to the coordinate information of each image sub-region corresponding to the moving object; The target determination unit is used to obtain the first pre-selected target set based on a preset pixel area threshold range and the pixel area of each image sub-region corresponding to the moving object; the pixel area threshold range includes a maximum pixel area threshold and a minimum pixel area threshold; the large motion detection target represents a moving object whose pixel area of the corresponding image sub-region is greater than the maximum pixel area threshold; the small motion detection target represents a moving object whose pixel area of the corresponding image sub-region is less than the minimum pixel area threshold; the other motion detection targets represent moving objects whose pixel areas of the corresponding image sub-regions are within the pixel area threshold interval.
8. The device according to claim 6, It is characterized in that The harmful animal detection device based on video surveillance also includes a target classification module, which is used to classify harmful animal targets in the video stream according to a trained deep learning classification model to obtain a set of harmful animal targets after classification; the harmful animal target set includes multiple harmful animal targets; wherein the deep learning classification model includes at least one of rats and cockroaches.
9. An electronic device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for detecting harmful animals based on video monitoring according to any one of claims 1 to 5.
10. A storage medium, It is characterized in that The storage medium stores a computer program, wherein the computer program is configured to execute the harmful animal detection method based on video monitoring according to any one of claims 1 to 5 when running.
