Risk detection method and device for intelligent event triggering based on hybrid strategy
By adopting a hybrid strategy-based intelligent event triggering method at the oil and gas field production site, combined with the use of Hanming distance judgment and historical reasoning results, the resource waste and storage occupation problems caused by time cycle triggering in the existing technology are solved, and more efficient Object detection model scheduling and resource utilization.
Patent Information
- Application Number
- CN202311070106.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-23
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, event triggering of the object detection model usually adopts a time period mechanism, resulting in wasted computing resources and excessive storage space, especially when the detection image has not changed for a long time.
Using a hybrid strategy-based intelligent event triggering method, the risk level of the target detection model is determined by intercepting the image and determining the risk level of the target detection model. If it is lower than the preset level, the Hanming distance between the current intercepting image and the previous moment intercepting image is calculated, if it is less than Similarity threshold is used to use the historical reasoning results of the previous moment, otherwise object detection is performed.
It effectively solves the problems of wasted computing resources and excessive storage space caused by time period triggering, balances detection performance and cost, improves the scheduling efficiency of target detection model, and reaches a 30% improvement.
Smart Images

Figure CN119516350A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a risk detection method and device triggered by intelligent events based on a hybrid strategy. Background Art
[0002] There are many safety hazards at the production sites of oil and gas field enterprises. Once safety hazards appear but are not discovered and dealt with in time, safety accidents are very likely to occur, which not only affects the normal production and operation of the enterprise, but also threatens the surrounding residents and the ecological environment. At present, oil and gas field enterprises are gradually using intelligent video analysis to assist or replace manual inspections. Based on open source data sets and data sets collected by oil fields, all-weather monitoring of all personnel and vehicles in the production site monitoring video is achieved.
[0003] The event triggering of the target detection model is a key link in the intelligent analysis system. Usually, a time trigger mechanism is used to periodically call the target detection model. For example, the trigger event set for the Fushan Oilfield video analysis system is triggered once a minute. During the triggering process, the reasoning of the target model depends on the background AI server, acquisition server, data cache server and management server to return the detected results to the video analysis platform. Summary of the invention
[0004] In order to better achieve this, the embodiments of the present invention provide a method, an apparatus, a device and a medium.
[0005] In a first aspect, an embodiment of the present invention provides a risk detection method triggered by intelligent events based on a hybrid strategy, the method comprising:
[0006] Capture images at preset time intervals;
[0007] Obtaining a pre-built target detection model corresponding to the current screenshot image, and determining whether the risk level of the target detection model is lower than a preset risk level;
[0008] If yes, calculate the similarity between the current screenshot image and the screenshot image at the previous moment in the pre-built image storage library to obtain the Hamming distance;
[0009] Determining whether the Hamming distance is less than a predetermined similarity threshold;
[0010] If yes, obtain the historical reasoning result corresponding to the screenshot image at the previous moment, and use the historical reasoning result as the reasoning result of the current screenshot image;
[0011] If not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
[0012] One or some optional implementations of the embodiments of the present invention further include:
[0013] If the risk level of the target detection model is equal to or higher than the preset risk level, the target detection model is used to perform target detection on the current screenshot image to obtain an inference result.
[0014] In one or some optional implementations of the embodiments of the present invention, the calculating of the similarity between the current captured image and the captured image at the previous moment in the pre-built image repository to obtain the Hamming distance includes:
[0015] Convert the current screenshot image and the previous screenshot image into grayscale images, and obtain the grayscale value and average grayscale value of each pixel in all grayscale images;
[0016] For each pixel, the pixel whose grayscale value is greater than the average grayscale value is recorded as 1, and the pixel whose grayscale value is less than the average grayscale value is recorded as 0, so as to obtain a binary array;
[0017] The Hamming distance between the current captured frame image and the captured frame image at the previous moment is calculated according to the binary array.
[0018] In one or some optional implementations of the embodiment of the present invention, the similarity threshold is determined in the following manner:
[0019] For each preset scene, a similarity threshold between all pre-obtained historical scene images is calculated.
[0020] In one or some optional implementations of the embodiment of the present invention, after calculating the similarity threshold between all pre-obtained historical scene images for each preset scene, the method further includes:
[0021] For each preset scene, after a preset period of time, historical scene images are added and the similarity threshold is updated;
[0022] New preset scenes and historical scene images are added, and a similarity threshold is determined for each new preset scene.
[0023] In one or some optional implementations of the embodiment of the present invention, if the risk level of the target detection model is lower than the preset risk level, the method further includes:
[0024] Determining whether the number of historical frame images stored in the image storage library is less than a preset number;
[0025] If yes, then storing the current frame image into the image storage library;
[0026] If not, the historical snapshot image at the earliest time in the image storage library is deleted from the image storage library, and the current snapshot image is stored in the image storage library.
[0027] One or some optional implementations of the embodiments of the present invention further include:
[0028] The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level and the number of detections performed using a target detection model with a risk level lower than the preset risk level within a preset time period are counted, and the efficiency index is determined based on the following formula 1:
[0029]
[0030] Wherein, η is the efficiency index; S AI The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level within a preset time period; S T It is the number of detections performed within a preset time period using a target detection model with a risk level lower than the preset risk level.
[0031] In a second aspect, an embodiment of the present invention provides a risk detection device triggered by an intelligent event based on a hybrid strategy, the device comprising:
[0032] A frame capture module, used to capture images at preset time intervals;
[0033] A first judgment module is used to obtain a pre-built target detection model corresponding to the current frame image, and judge whether the risk level of the target detection model is lower than a preset risk level;
[0034] A similarity calculation module is used to calculate the similarity between the current frame image and the frame image at the previous moment in the pre-built image storage library to obtain the Hamming distance;
[0035] A second judgment module, used to judge whether the Hamming distance is less than a predetermined similarity threshold;
[0036] A first determining module is used for, if yes, obtaining a historical reasoning result corresponding to the screenshot image at the previous moment, and using the historical reasoning result as the reasoning result of the current screenshot image;
[0037] The second determination module is used to, if not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
[0038] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the risk detection method triggered by intelligent events based on a hybrid strategy as described above.
[0039] In a fourth aspect, an embodiment of the present invention provides a computer 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 risk detection method triggered by intelligent events based on a hybrid strategy as described above is implemented.
[0040] In a fifth aspect, an embodiment of the present invention provides a computer program product comprising instructions, which, when executed on a computer device, enables the computer device to execute the risk detection method triggered by intelligent events based on a hybrid strategy as described above.
[0041] In a sixth aspect, an embodiment of the present invention provides a chip, the chip comprising a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instruction to implement the risk detection method triggered by intelligent events based on a hybrid strategy as described above.
[0042] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:
[0043] The risk detection method based on intelligent event triggering of hybrid strategy provided by the embodiment of the present invention continuously obtains the target detection model corresponding to the screenshot image of the production site, and judges whether the Hamming distance between the current screenshot image and the screenshot image at the previous moment is less than the similarity threshold based on the risk level of the target detection model. Only when the Hamming distance is greater than the similarity threshold, the target detection model is used to perform target detection on the current screenshot image to obtain the inference result. This method solves the problem of waste of computing resources and excessive storage space occupation caused by event triggering based on time period, balances detection performance and detection cost, and can improve the scheduling efficiency of target detection models in the oil and gas field production field by 30%.
[0044] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0045] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0047] Figure 1 A schematic diagram of the steps of a risk detection method triggered by an intelligent event based on a hybrid strategy provided by an embodiment of the present invention;
[0048] Figure 2 A flow chart of risk detection using an intelligent event triggering method provided by an embodiment of the present invention;
[0049] Figure 3 A flow chart of risk detection triggered by periodic events and triggered by intelligent events provided by an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of the structure of a risk detection device triggered by intelligent events based on a hybrid strategy provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0052] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0053] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0054] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0055] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0056] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0057] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0058] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.
[0059] The inventors found that in the prior art, the event triggering of the target detection model usually adopts a time triggering mechanism to periodically call the target detection model, but this frequent triggering method will cause the GPU server computing power resources to be occupied, and also put forward higher requirements on the storage space of the data cache server. Especially when the detected image has no obvious changes for a long time and the detection results are consistent, this time period calling method wastes resources. Therefore, a more intelligent triggering method is needed to balance the detection performance and cost of the model, and solve the current problem of wasting computing resources caused by event triggering based on time periods and occupying too much storage device space. Based on this, the inventors have made the present invention after further research and development, providing a risk detection method and device based on intelligent event triggering of a hybrid strategy.
[0060] Embodiment 1
[0061] The embodiment of the present invention provides a risk detection method based on intelligent event triggering based on a hybrid strategy, referring to Figure 1 As shown, the method includes:
[0062] S101: capturing frames of images at preset time intervals.
[0063] In the embodiment of the present invention, cameras are set in different scenes at the production site of the oil and gas field enterprise to monitor the production site, and the cameras capture images at preset time intervals for risk detection. The preset time interval is set according to actual conditions, for example, one minute.
[0064] S102: Obtain a pre-built target detection model corresponding to the current screenshot image, and determine whether the risk level of the target detection model is lower than a preset risk level. If so, execute S103; if not, execute S106.
[0065] In an embodiment of the present invention, a target detection model can be established by a deep learning model (YOLO). The risk level of the target detection model can be divided from high to low into D / 1 (major risk), C / 2 (relatively high risk), B / 3 (general risk) and A / 4 (low risk) according to the risk assessment criteria commonly used in the field, such as a work hat detection model (B), a vehicle recognition model (A), a fireworks detection model (D) and an oil leak detection model (C). After the target detection model is established, a target detection model library is established and the model information is configured. Among them, the model information includes the model name, the model risk level classification, and the time expression for periodic execution (i.e., the timing expression (Cron Expression)), etc. Each new target detection model added to the server will be automatically entered into the target detection model library.
[0066] In an embodiment of the present invention, after obtaining the current screenshot image, it is necessary to determine the target detection model corresponding to the current screenshot image in the target detection model library, and determine whether the risk level of the target detection model is lower than the preset risk level. If so, step S103 is executed; if not, step S107 is executed. The preset risk level can be set according to actual conditions. For example, if the preset risk level is set to level D / level 1, if the target detection model is a work hat detection model (level B), it is determined that the risk level of the work hat detection model is lower than the preset risk level.
[0067] Depending on the risk level of the target detection model, there are two ways to choose from for event triggering: periodic execution or intelligent triggering. Periodic execution is suitable for situations where tasks need to be executed at a certain frequency or time interval, such as regular target detection of the entire data set, timed inspection of equipment or areas, and regular data analysis. Periodic execution can provide stable and controllable task execution and is suitable for scenarios with high risk levels such as fireworks detection. The intelligent triggering method is more suitable for situations where task execution needs to be triggered based on specific events or conditions, such as vehicle identification, which has a lower threshold. For example, when the target detection model detects abnormal behavior, violations, or falls below the preset threshold, corresponding processing is performed. The intelligent triggering method can optimize GPU computing resources and allocate computing power to high-risk tasks.
[0068] S103: If yes, a similarity calculation is performed between the current screenshot image and a screenshot image at a previous moment in a pre-built image storage library to obtain a Hamming distance.
[0069] In the embodiment of the present invention, if the risk level of the target detection model is equal to or higher than the preset risk level, the target detection model is used to perform target detection on the current screenshot image to obtain an inference result.
[0070] In the embodiment of the present invention, if the risk level of the target detection model is lower than the preset risk level, the method further includes:
[0071] Determining whether the number of historical frame images stored in the image storage library is less than a preset number;
[0072] If yes, then storing the current frame image into the image storage library;
[0073] If not, the historical snapshot image at the earliest time in the image storage library is deleted from the image storage library, and the current snapshot image is stored in the image storage library.
[0074] In an embodiment of the present invention, when it is determined that the risk level of the target detection model corresponding to the current screenshot image is lower than the preset risk level, the current screenshot image is added to the image repository and similarity is calculated with the screenshot image at the previous moment in the pre-constructed image repository.
[0075] When adding the current screenshot image to the picture repository, first determine whether the number of historical screenshot images stored in the picture repository is less than the preset number. If so, directly store the current screenshot image in the picture repository. If not, it means that after storing the current screenshot image, the number of screenshot images stored in the picture repository will exceed the preset number. In this case, the historical screenshot image at the earliest moment in the picture repository can be deleted from the picture repository before storing the current screenshot image.
[0076] In the embodiment of the present invention, the similarity calculation between the current captured image and the captured image at the previous moment in the pre-built image storage library to obtain the Hamming distance specifically includes:
[0077] Convert the current screenshot image and the previous screenshot image into grayscale images, and obtain the grayscale value and average grayscale value of each pixel in all grayscale images;
[0078] For each pixel, the pixel whose grayscale value is greater than the average grayscale value is recorded as 1, and the pixel whose grayscale value is less than the average grayscale value is recorded as 0, so as to obtain a binary array;
[0079] The Hamming distance between the current captured frame image and the captured frame image at the previous moment is calculated according to the binary array.
[0080] After the current screenshot is stored in the image repository, the similarity calculation is performed with the screenshot of the previous moment. The Hash algorithm can be used to calculate the similarity of the images. The essence of the Hash algorithm for image similarity recognition is to perform a Hash conversion on the image, generate a set of binary numbers, and then find similar images by comparing the Hash value distances of different images. The specific steps for using the Hash algorithm to calculate the similarity of images are as follows:
[0081] 1. Reduce the image size. It can remove the details of the image and only retain basic information such as structure and brightness. The purpose is to unify the image size and ensure that each subsequent image has the same length of hash value to facilitate distance calculation. The degree of image size reduction is set according to the actual situation. For example, the image size is reduced to 8*8, 64 pixels. If too much information is lost, the size can be appropriately increased, and the pixels will increase accordingly, but the subsequent calculation process will be slightly slower.
[0082] 2. Grayscale processing: Convert all images into a uniform grayscale image.
[0083] 3. Calculate the pixel mean. That is, calculate the grayscale average value of the pixels in each image, which can be calculated using the following formula 2:
[0084] Average=Σ(Pixel_Value) / N Formula 2;
[0085] In the formula, Average is the grayscale average; Pixel_Value is the grayscale value of each pixel; N is the number of pixels.
[0086] 4. Hash value calculation: Compare the grayscale value of each pixel with the grayscale average value. If it is greater than or equal to the grayscale average value, the pixel is recorded as 1; if it is less than the grayscale average value, the pixel is recorded as 0, thus generating a binary array.
[0087] 5. Picture pairing. Calculate the Hamming distance between two pictures, which can be calculated using the following formula 3:
[0088] HammingDistance(A,B)=ΣΣ(A[i,j]XOR B[i,j]) Formula 3;
[0089] Where HammingDistance(A,B) is the Hamming distance between A and B; A[i,j] is an element in the i-th row and j-th column of the binary array A; and B[i,j] is an element in the i-th row and j-th column of the binary array B.
[0090] S104: Determine whether the Hamming distance is less than a predetermined similarity threshold, if so, execute S105, if not, execute S106.
[0091] In the embodiment of the present invention, the closer the Hamming distance is, the more similar the two images are. When the image size is reduced to 8*8, in general, two images with a Hamming distance less than a similarity threshold (usually 10) are similar images, but in the oil field scenario, the similarity threshold is required to be more precise, so a more accurate similarity threshold needs to be calculated.
[0092] In the embodiment of the present invention, the similarity threshold is determined in the following manner:
[0093] For each preset scene, a similarity threshold between all pre-obtained historical scene images is calculated.
[0094] In the embodiment of the present invention, after calculating the similarity threshold between all pre-obtained historical scene images for each preset scene, the method further includes:
[0095] For each preset scene, after a preset period of time, historical scene images are added and the similarity threshold is updated;
[0096] New preset scenes and historical scene images are added, and a similarity threshold is determined for each new preset scene.
[0097] In the embodiment of the present invention, historical scene pictures are collected in advance at the production site and stored in the picture storage library, and several typical scenes are preset, such as static scenes, dynamic scenes of objects entering, and fireworks scenes. For each preset scene, the similarity of all historical scene pictures in the preset scene is calculated. For example, the similarity can be calculated using a Hash algorithm to obtain the similarity of all historical scene pictures in each preset scene, and the similarity threshold of all historical scene pictures in each preset scene is determined by statistics. Among them, the similarity threshold can also be set according to actual conditions.
[0098] After determining the similarity threshold, as more and more pictures are collected, the accuracy can be improved by continuously updating the similarity threshold. For each existing preset scene, historical scene pictures are added every preset period to update the similarity threshold; for newly added preset scenes and historical scene pictures, the similarity threshold for each new preset scene is determined, and after every preset period, historical scene pictures are added to update the similarity threshold.
[0099] In the embodiment of the present invention, it is determined whether the Hamming distance between the current screenshot image and the screenshot image at the previous moment is less than a predetermined similarity threshold. If so, the historical reasoning result can be used as the current reasoning result, and S105 is executed; if not, the historical reasoning result cannot be used as the current reasoning result, and S106 is executed.
[0100] S105: If yes, obtain the historical reasoning result corresponding to the screenshot image at the previous moment, and use the historical reasoning result as the reasoning result of the current screenshot image.
[0101] In an embodiment of the present invention, when the Hamming distance between the current screenshot image and the screenshot image at the previous moment is less than the similarity threshold, the inference result of the screenshot image at the previous moment is obtained, and the historical inference result of the screenshot image at the previous moment can be used as the inference result of the current screenshot image.
[0102] S106: If not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
[0103] In an embodiment of the present invention, when the Hamming distance between the current screenshot image and the screenshot image at the previous moment is not less than the similarity threshold, the target detection model corresponding to the current screenshot image is called in the GPU for inference, that is, the target detection model is used to perform target detection on the current screenshot image to obtain an inference result.
[0104] In the embodiment of the present invention, it also includes:
[0105] The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level and the number of detections performed using a target detection model with a risk level lower than the preset risk level within a preset time period are counted, and the efficiency index is determined based on the following formula 1:
[0106]
[0107] Wherein, η is the efficiency index; S AI The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level within a preset time period; S T It is the number of detections performed within a preset time period using a target detection model with a risk level lower than the preset risk level.
[0108] In an embodiment of the present invention, the number of target detection model calls can be calculated in the GPU, and the number of GPU calls when periodic events are triggered and intelligent events are triggered are calculated respectively, that is, the number of times a target detection model with a risk level equal to or higher than the preset risk level is used for detection, and the number of times a target detection model with a risk level lower than the preset risk level is used for detection, and an efficiency index is determined. The efficiency index can optimize the design and implementation of the target detection model according to specific application scenarios and requirements, so as to improve the efficiency and performance of the target detection model call.
[0109] In the embodiment of the present invention, Figure 2As shown in the figure, it is a flow chart of risk detection by intelligent event triggering. When the acquisition device acquires the current screenshot image, the target detection model corresponding to the current screenshot image is obtained from the model library. When the risk level of the target detection model is lower than the preset risk level, the intelligent event triggering is realized. The current screenshot image is stored in the image storage library and enters the intelligent triggering algorithm module to calculate the Hamming distance between the current screenshot image and the screenshot image at the previous moment. According to the size of the Hamming distance, it is determined whether to directly obtain the screenshot image at the previous moment as the detection result, that is, the inference result, or to call the target detection model in the GPU to obtain the detection result.
[0110] In the embodiment of the present invention, Figure 3 As shown, it is a flow chart of risk detection triggered by periodic events and intelligent events. After the current screenshot image is obtained, the corresponding target detection model is obtained to determine whether the safety level, i.e., the risk level, of the target detection model is level D. If so, it is a periodic event trigger, and the periodic call is performed at a preset time interval, and the target detection model is called in the GPU to obtain the corresponding calculation result, i.e., the inference result, and save it; if not, it is an intelligent event trigger, and the similarity between the current screenshot image and the screenshot image at the previous moment is calculated and whether it is greater than the calculation threshold, i.e., the Hamming distance is calculated and whether it is less than the similarity threshold. If so, the calculation result of the last CPU is obtained as the calculation result of this time, i.e., the historical inference result corresponding to the screenshot image at the previous moment is obtained, and the historical inference result is used as the inference result of the current screenshot image; if not, the target detection model is called in the GPU to obtain the corresponding calculation result, i.e., the inference result, and save it.
[0111] Embodiment 2
[0112] Based on the same inventive concept, the embodiment of the present invention also provides a risk detection device triggered by intelligent events based on a hybrid strategy, referring to Figure 4 As shown, the device comprises:
[0113] The frame capture module 101 is used to capture the frame image at a preset time interval;
[0114] The first judgment module 102 is used to obtain a pre-built target detection model corresponding to the current frame image, and judge whether the risk level of the target detection model is lower than a preset risk level;
[0115] A similarity calculation module 103 is used to calculate the similarity between the current frame image and the frame image at the previous moment in the pre-built image storage library to obtain a Hamming distance;
[0116] A second judgment module 104 is used to judge whether the Hamming distance is less than a predetermined similarity threshold;
[0117] The first determining module 105 is configured to, if yes, obtain the historical reasoning result corresponding to the screenshot image at the previous moment, and use the historical reasoning result as the reasoning result of the current screenshot image;
[0118] The second determination module 106 is configured to, if not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
[0119] Embodiment 3
[0120] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the risk detection method based on intelligent event triggering based on a hybrid strategy as described in the above embodiment 1 is implemented.
[0121] Embodiment 4
[0122] Based on the same inventive concept, an embodiment of the present invention also provides a computer device, including 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 risk detection method based on intelligent event triggering based on a hybrid strategy as described in the above-mentioned embodiment 1 is implemented.
[0123] Embodiment 5
[0124] Based on the same inventive concept, an embodiment of the present invention also provides a computer program product comprising instructions. When the computer program product is executed on a computer device, the computer device executes the risk detection method based on intelligent event triggering based on a hybrid strategy as described in the above embodiment 1.
[0125] Embodiment 6
[0126] Based on the same inventive concept, an embodiment of the present invention also provides a chip, the chip includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instruction to implement the risk detection method based on intelligent event triggering based on a hybrid strategy as described in the above embodiment one.
[0127] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0128] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0129] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0131] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A risk detection method based on intelligent event triggering based on hybrid strategy, characterized in that: include: Capture images at preset time intervals; Obtaining a pre-built target detection model corresponding to the current screenshot image, and determining whether the risk level of the target detection model is lower than a preset risk level; If yes, calculate the similarity between the current screenshot image and the screenshot image at the previous moment in the pre-built image storage library to obtain the Hamming distance; Determining whether the Hamming distance is less than a predetermined similarity threshold; If yes, obtain the historical reasoning result corresponding to the screenshot image at the previous moment, and use the historical reasoning result as the reasoning result of the current screenshot image; If not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
2. The method according to claim 1, characterized in that Also includes: If the risk level of the target detection model is equal to or higher than the preset risk level, the target detection model is used to perform target detection on the current screenshot image to obtain an inference result.
3. The method according to claim 1, characterized in that The calculating the similarity between the current frame image and the frame image at the previous moment in the pre-built picture storage library to obtain the Hamming distance includes: Convert the current screenshot image and the previous screenshot image into grayscale images, and obtain the grayscale value and average grayscale value of each pixel in all grayscale images; For each pixel, the pixel whose grayscale value is greater than the average grayscale value is recorded as 1, and the pixel whose grayscale value is less than the average grayscale value is recorded as 0, so as to obtain a binary array; The Hamming distance between the current captured frame image and the captured frame image at the previous moment is calculated according to the binary array.
4. The method according to claim 1, characterized in that The similarity threshold is determined by: For each preset scene, a similarity threshold between all pre-obtained historical scene images is calculated.
5. The method according to claim 4, characterized in that After calculating the similarity threshold between all pre-obtained historical scene images for each preset scene, the method further includes: For each preset scene, after a preset period of time, historical scene images are added and the similarity threshold is updated; New preset scenes and historical scene images are added, and a similarity threshold is determined for each new preset scene.
6. The method according to claim 1, characterized in that If the risk level of the target detection model is lower than the preset risk level, the method further includes: Determining whether the number of historical frame images stored in the image storage library is less than a preset number; If yes, then storing the current frame image into the image storage library; If not, the historical snapshot image at the earliest time in the image storage library is deleted from the image storage library, and the current snapshot image is stored in the image storage library.
7. The method according to claim 1, characterized in that Also includes: The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level and the number of detections performed using a target detection model with a risk level lower than the preset risk level within a preset time period are counted, and the efficiency index is determined based on the following formula 1: Wherein, η is the efficiency index; S AI The number of detections performed using a target detection model with a risk level equal to or higher than the preset risk level within a preset time period; S T It is the number of detections performed within a preset time period using a target detection model with a risk level lower than the preset risk level.
8. A risk detection device based on intelligent event triggering based on hybrid strategy, characterized in that: include: A frame capture module, used to capture images at preset time intervals; A first judgment module is used to obtain a pre-built target detection model corresponding to the current frame image, and judge whether the risk level of the target detection model is lower than a preset risk level; A similarity calculation module is used to calculate the similarity between the current frame image and the frame image at the previous moment in the pre-built image storage library to obtain the Hamming distance; A second judgment module, used to judge whether the Hamming distance is less than a predetermined similarity threshold; A first determining module is used for, if yes, obtaining a historical reasoning result corresponding to the screenshot image at the previous moment, and using the historical reasoning result as the reasoning result of the current screenshot image; The second determination module is used to, if not, use the target detection model to perform target detection on the current frame image to obtain an inference result.
9. A computer-readable storage medium storing instructions, which, when executed on a terminal, enables the terminal to execute the risk detection method based on intelligent event triggering based on a hybrid strategy as described in any one of claims 1 to 7.
10. A computer device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the risk detection method based on intelligent event triggering based on a hybrid strategy as described in any one of claims 1 to 7 is implemented.
11. A computer program product comprising instructions, which, when executed on a computer device, enables the computer device to execute the risk detection method based on intelligent event triggering based on a hybrid strategy as claimed in any one of claims 1 to 7.
12. A chip, comprising a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run a computer program or instruction to implement the risk detection method triggered by intelligent events based on a hybrid strategy as described in any one of claims 1 to 7.