Abnormality detection method and device of lighting equipment, storage medium and electronic device
By adjusting the brightness level of lighting equipment according to the ambient light intensity, and combining abnormal light spot template images and pixel difference detection of water stains, the problem of low accuracy in water stain detection in outdoor monitoring is solved, and automated and efficient water stain cleaning is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2026-01-26
- Publication Date
- 2026-05-08
AI Technical Summary
In outdoor monitoring scenarios, water stains cause blurred images. Existing technologies rely on manual inspections or passive image analysis, resulting in low accuracy in water stain detection.
The target brightness level of the lighting equipment is determined based on the ambient light intensity. The lighting equipment is then turned on to obtain video images. Anomalies are detected using anomaly spot template images. The presence of water stains is determined by combining pixel differences, and the cleaning equipment is automatically activated.
It improves the accuracy of water stain detection, reduces manual intervention, and achieves automated water stain detection around the clock.
Smart Images

Figure CN121999413A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video image processing technology, specifically to a method and apparatus for detecting anomalies in lighting equipment, a storage medium, and an electronic device. Background Technology
[0002] In outdoor surveillance scenarios, rain, fog, or condensation can easily form water stains on the lens surface, causing blurred images and affecting monitoring effectiveness. Traditional water stain detection methods rely on manual inspection or passive image analysis, which suffers from slow response and high false alarm rates.
[0003] Therefore, the relevant technologies rely on manual inspection or passive image analysis for water stain detection, resulting in low detection accuracy.
[0004] There is still no effective solution to the problem that water stain detection methods in related technologies rely on manual inspection or passive image analysis, resulting in low detection accuracy. Summary of the Invention
[0005] This application provides an anomaly detection method and apparatus for lighting equipment, a storage medium, and an electronic device, to at least solve the problem of low detection accuracy of water stain detection methods in related technologies that rely on manual inspection or passive image analysis.
[0006] According to one aspect of the embodiments of this application, an anomaly detection method for lighting devices is provided, comprising: determining a target brightness level for each lighting device in a target object based on the ambient light brightness within a target area, wherein the target area includes the target object; acquiring a first video image corresponding to each lighting device being lit up sequentially based on the target brightness level; and performing anomaly detection on each lighting device based on each first video image and an abnormal light spot template image to determine whether there are stains in the target object.
[0007] In an exemplary embodiment, before determining the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, the method further includes: acquiring a target image corresponding to the target area, and determining the number of pixels of a first pixel corresponding to each grayscale value contained in the target image; and determining the ambient light brightness based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold.
[0008] In an exemplary embodiment, determining the ambient light brightness based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold includes: determining the ambient light brightness according to a first formula, wherein the first formula is: , The ambient light intensity is given by k, where k is the grayscale value and p is the preset brightness threshold. The number of pixels corresponding to the first pixel point with grayscale value i in the target image.
[0009] In one exemplary embodiment, determining the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area includes: matching the ambient light brightness with a preset brightness level table to determine a brightness level that matches the ambient light brightness in the preset brightness level table, and determining the brightness level in the preset brightness level table that matches the ambient light brightness as the target brightness level.
[0010] In an exemplary embodiment, after determining the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, the method further includes: determining a brightness parameter corresponding to the target brightness level; constructing a target instruction corresponding to each lighting device based on the brightness parameter and the device identifier corresponding to each lighting device; and sequentially sending the target instruction to the target object to sequentially illuminate each lighting device in the target object.
[0011] In one exemplary embodiment, performing anomaly detection on each lighting device based on each first video image and an abnormal light spot template image to determine whether there is a stain in the target object includes: training an anomaly detection model based on the abnormal light spot template image; inputting each first video image into the trained anomaly detection model so that the trained anomaly detection model outputs a detection result corresponding to each first video image; determining that there is no stain in the target object when each detection result is a normal detection result; and determining that there is a stain in the target object when any detection result is an abnormal detection result.
[0012] In one exemplary embodiment, after performing anomaly detection on each lighting device based on each first video image and an abnormal light spot template image to determine whether there is a stain in the target object, the method further includes: if it is determined that there is a stain in the target object, running a cleaning device in the target object to clean the target object.
[0013] In one exemplary embodiment, after operating the cleaning equipment in the target object to clean the target object, the method further includes: acquiring a second video image corresponding to each cleaned lighting device when each cleaned lighting device is sequentially illuminated at the target brightness level, wherein each cleaned lighting device is used to indicate each lighting device in the cleaned target object obtained after cleaning the target object; determining a first pixel value corresponding to each second pixel point contained in the first video image, and determining a second pixel value corresponding to each third pixel point contained in the second video image; and performing anomaly detection on each cleaned lighting device according to the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object.
[0014] In an exemplary embodiment, anomaly detection is performed on each cleaned lighting device based on the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object, including: determining the pixel difference between the first video image and the second video image; comparing the pixel difference with a preset threshold to determine the comparison result; and determining that there are no stains in the cleaned target object when the comparison result indicates that the pixel difference is less than the preset threshold.
[0015] In an exemplary embodiment, determining the pixel difference between the first video image and the second video image includes: calculating the pixel difference according to a second formula, wherein the second formula is: , The pixel difference, Let be the first pixel value of the second pixel point at the (x, y) coordinate position in the first video image. Let M be the second pixel value of the third pixel point at the (x, y) coordinate position in the second video image, M be the number of pixels of the second pixel point, and N be the number of pixels of the third pixel point; compare the pixel difference with a preset threshold; if the comparison result indicates that the pixel difference is less than the preset threshold, determine that there are no stains in the cleaned target object.
[0016] According to another aspect of the embodiments of this application, an anomaly detection device for lighting equipment is also provided, comprising: a determining module, configured to determine a target brightness level for each lighting equipment in a target object based on the ambient light brightness within a target area, wherein the target area includes the target object; an acquiring module, configured to acquire a first video image corresponding to each lighting equipment being lit up sequentially based on the target brightness level; and a detection module, configured to perform anomaly detection on each lighting equipment based on each first video image and an abnormal light spot template image to determine whether there are stains in the target object.
[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein the program, when executed, performs the above-described method for detecting anomalies in lighting devices.
[0018] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor runs the above-described method for detecting abnormalities in lighting equipment through the computer program.
[0019] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described methods for detecting abnormalities in lighting devices.
[0020] In this embodiment, the target brightness level of each lighting device in the target object within the target area is determined based on the ambient light intensity within the target area. When each lighting device is sequentially illuminated based on its target brightness level, a first video image corresponding to the illumination of each lighting device is acquired. Anomaly detection is performed on each lighting device based on each first video image and an abnormal light spot template image to determine whether stains exist in the target object. In other words, after determining the target brightness level of each lighting device in the target object, this application can acquire first video images of each lighting device sequentially illuminated based on its target brightness level, and then determine whether stains exist in the target object based on the first video images and the abnormal light spot template image. This application solves the problem of low detection accuracy in water stain detection methods that rely on manual inspection or passive image analysis in related technologies, thereby improving the detection accuracy of water stains. Attached Figure Description
[0021] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0022] Figure 1 This is a hardware structure block diagram of a computer terminal for an abnormal detection method of a lighting device according to an embodiment of this application;
[0023] Figure 2 This is a flowchart of an optional method for detecting anomalies in a lighting device according to an embodiment of this application;
[0024] Figure 3 This is a flowchart of a water stain detection method for a monitoring lens based on an active multi-light source, according to an optional embodiment of this application;
[0025] Figure 4 This is a structural block diagram of an abnormality detection device for a lighting device according to an embodiment of this application. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] The methods and embodiments provided in this application can be run on a computer terminal. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for an anomaly detection method for lighting equipment according to an embodiment of this application. Figure 1 As shown, a computer terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a processing system such as a microprocessor unit (MPU) or a programmable logic device (PLD)) and a memory 104 for storing data are also shown. In one exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned computer terminal. For example, the camera device may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.
[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the abnormal detection method for lighting equipment in this embodiment. The processor 102 runs various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage systems, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a secure network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the camera equipment's communication provider. In one example, the transmission system 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet.
[0031] This embodiment provides a method for detecting anomalies in lighting equipment, including but not limited to those applied to the aforementioned computer terminal. Figure 2 This is a flowchart of an optional anomaly detection method for a lighting device according to an embodiment of this application. The process includes the following steps:
[0032] Step S202: Determine the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, wherein the target area includes: the target object;
[0033] The target object can be a surveillance camera, the target area can be the area that the surveillance camera can capture, and the target object can be a light in the surveillance camera.
[0034] Step S204: When each lighting device is lit sequentially based on the target brightness level, a first video image corresponding to lighting each lighting device is acquired respectively;
[0035] For example, if the target object includes n lighting devices, the first lighting device can be turned on based on the target brightness level, and the first video image corresponding to the first lighting device being turned on can be obtained; the first lighting device can be turned off, and the second lighting device can be turned on based on the target brightness level, and the first video image corresponding to the second lighting device being turned on can be obtained, and so on, until the (n-1)th lighting device is turned off, and the nth lighting device is turned on based on the target brightness level, and the first video image corresponding to the nth lighting device being turned on can be obtained.
[0036] Step S206: Perform anomaly detection on each lighting device based on each first video image and the abnormal light spot template image to determine whether there are stains in the target object.
[0037] Among them, the aforementioned stains can be water stains.
[0038] Through the above steps, the target brightness level of each lighting device in the target object within the target area is determined based on the ambient light intensity within the target area. With each lighting device sequentially illuminated based on the target brightness level, a first video image corresponding to the illumination of each lighting device is acquired. Anomaly detection is performed on each lighting device based on each first video image and an abnormal light spot template image to determine whether stains exist in the target object. In other words, after determining the target brightness level of each lighting device in the target object, this application can acquire first video images of each lighting device sequentially illuminated based on the target brightness level, and then determine whether stains exist in the target object based on the first video images and the abnormal light spot template image. This application solves the problem of low detection accuracy in water stain detection methods that rely on manual inspection or passive image analysis in related technologies, thereby improving the detection accuracy of water stains.
[0039] Optionally, before determining the target brightness level of each lighting device in the target object based on the ambient light brightness in the target area in step S202 above, the method further includes: acquiring a target image corresponding to the target area, and determining the number of pixels of the first pixel corresponding to each gray value in the target image; determining the ambient light brightness based on the number of pixels of the first pixel corresponding to each gray value and a preset brightness threshold.
[0040] The determination of the ambient light brightness based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold includes: determining the ambient light brightness according to a first formula, wherein the first formula is: , The ambient light intensity is given by k, where k is the grayscale value and p is the preset brightness threshold. The number of pixels corresponding to the first pixel point with grayscale value i in the target image.
[0041] Understandably, before determining the target brightness level, the ambient light brightness needs to be determined first. Specifically, after acquiring the target image corresponding to the target area, it is necessary to calculate the number of pixels for each gray level (i.e., gray value) in the target area. For example, if the monitored image is converted to grayscale format, then the grayscale value range will be 0 to 255. Between 0 and 255, the number of pixels for each grayscale value (k) is counted, and the number of pixels for each grayscale value (k) is the frequency or number of times that grayscale level (k) occurs.
[0042] The first formula is used to estimate ambient light intensity. This formula indicates the search for a minimum grayscale value (k) such that the total number of pixels with grayscale values from the darkest grayscale value to (k) represents a proportion (p) of the total number of pixels (N) in the image. In other words, it attempts to find a brightness boundary below which the number of pixels represents at least a proportion (p) of all pixels. The grayscale value corresponding to this boundary reflects the average brightness level of the current environment. For example, if (p) is set to 0.8 and the image contains 10,000 pixels, then a minimum (k) can be found to ensure that the cumulative number of pixels from the darkest grayscale value to (k) is at least 8,000. The brightness values of these 8,000 pixels will be used as the basis for assessing ambient light intensity.
[0043] In addition to the methods for determining ambient light intensity mentioned above, there are other methods for determining ambient light intensity, such as frequency domain analysis or neural network models, all of which are within the scope of protection of this application.
[0044] Optionally, step S202 above, which determines the target brightness level of each lighting device in the target object based on the ambient light brightness in the target area, includes: matching the ambient light brightness with a preset brightness level table to determine a brightness level that matches the ambient light brightness in the preset brightness level table, and determining the brightness level that matches the ambient light brightness in the preset brightness level table as the target brightness level.
[0045] Understandably, after determining the ambient light level, a target brightness level can be assigned to each lighting device based on the ambient light level. Specifically:
[0046] Obtain a preset brightness registration form, which associates different ambient light brightness ranges with the brightness levels of light-emitting diode (LED) lights (lighting equipment includes LED lights), for example:
[0047] When the ambient light intensity is below 100 lux, the LED light brightness level is set to 4 (maximum brightness).
[0048] When the ambient light level is between 100 and 500 lux, the LED light brightness level is set to 3;
[0049] When the ambient light level is between 500 and 1000 lux, the LED light brightness level is set to 2.
[0050] When the ambient light intensity is higher than 1000 lux, the LED light brightness level is set to 1 (lowest brightness).
[0051] The measured ambient light intensity is matched with a preset brightness level table to find the LED light brightness level that matches the current ambient light intensity. For example, if the detected ambient light intensity is 750 lux, the brightness level 2 setting is automatically matched according to the brightness level table, and then the LED light is adjusted to the corresponding brightness level.
[0052] Optionally, after determining the target brightness level of each lighting device in the target object based on the ambient light intensity within the target area, the method further includes: determining the brightness parameter corresponding to the target brightness level; constructing a target instruction corresponding to each lighting device based on the brightness parameter and the device identifier corresponding to each lighting device; and sequentially sending the target instruction to the target object to sequentially illuminate each lighting device in the target object.
[0053] Understandably, after determining the target brightness level, the brightness parameters corresponding to the target brightness level can be sequentially sent to each lighting device to illuminate each device in turn. This allows for the acquisition of video images corresponding to each lighting device.
[0054] Optionally, step S206 above, which involves performing anomaly detection on each lighting device based on each first video image and the abnormal light spot template image to determine whether there is a stain in the target object, includes: training an anomaly detection model based on the abnormal light spot template image; inputting each first video image into the trained anomaly detection model so that the trained anomaly detection model outputs a detection result corresponding to each first video image; determining that there is no stain in the target object if each detection result is a normal detection result; and determining that there is a stain in the target object if any detection result is an abnormal detection result.
[0055] Understandably, each lighting device is subjected to anomaly detection. The results of these anomaly detections can determine whether stains exist on the target object. Specifically:
[0056] The anomaly detection model is trained based on the template image of the abnormal light spot;
[0057] Among them, anomalous spot template images refer to image samples that clearly contain typical characteristics of water stains. These images cover various shapes and sizes of water stains that may appear. For example, multiple images of water droplets of different sizes, shapes, and densities covering the lens surface are collected as anomalous spot template images.
[0058] Anomaly detection models are built using deep learning or other machine learning techniques. These models learn and distinguish between normal and anomalous patterns in images. In this stage, the anomaly detection model is trained using template images of anomalous light spots, allowing it to learn what types of light spots are caused by water stains. Simultaneously, the model should also be trained with a large number of normal image samples without water stains to learn the features of normal images. Once trained, the anomaly detection model can effectively distinguish between anomalous light spots and the presence of water stains.
[0059] Each first video image is input into a pre-trained anomaly detection model. The trained model analyzes each frame based on its learned knowledge and outputs a detection result indicating whether the image contains abnormal light spots. For example, on a clear day, under normal LED illumination, the trained anomaly detection model consistently outputs "normal" detection results, indicating that even with multi-angle illumination, no abnormal light spots form on the lens surface, thus concluding that the lens surface is clean. However, once the trained anomaly detection model detects an abnormal light spot in a particular frame, this immediately suggests the possible presence of water stains on the lens surface.
[0060] Optionally, after performing anomaly detection on each lighting device based on each first video image and abnormal light spot template image in step S206 above to determine whether there are stains in the target object, the method further includes: if it is determined that there are stains in the target object, running a cleaning device in the target object to clean the target object.
[0061] The aforementioned cleaning equipment can be the windshield wipers of the target object.
[0062] The method further includes, after operating the cleaning equipment in the target object to clean the target object, the method further includes: acquiring a second video image corresponding to each cleaned lighting device when each cleaned lighting device is sequentially lit at the target brightness level, wherein each cleaned lighting device is used to indicate each lighting device in the cleaned target object obtained after cleaning the target object; determining a first pixel value corresponding to each second pixel point contained in the first video image, and determining a second pixel value corresponding to each third pixel point contained in the second video image; and performing anomaly detection on each cleaned lighting device according to the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object.
[0063] Specifically, anomaly detection is performed on each cleaned lighting device based on the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object. This includes: determining the pixel difference between the first video image and the second video image; comparing the pixel difference with a preset threshold to determine the comparison result; and determining that there are no stains in the cleaned target object when the comparison result indicates that the pixel difference is less than the preset threshold.
[0064] Determining the pixel difference between the first video image and the second video image includes: calculating the pixel difference between the first video image and the second video image according to a second formula, wherein the second formula is: , The pixel difference, Let be the first pixel value of the second pixel point at the (x, y) coordinate position in the first video image. Let M be the second pixel value of the third pixel point at the (x, y) coordinate position in the second video image, M be the number of pixels of the second pixel point, and N be the number of pixels of the third pixel point; compare the pixel difference with a preset threshold; if the comparison result indicates that the pixel difference is less than the preset threshold, determine that there are no stains in the cleaned target object.
[0065] Understandably, when water stains are detected on the lens, a cleaning procedure is initiated, such as a built-in wiper system. After cleaning, each LED light source surrounding or embedded in the monitoring device is sequentially illuminated at a predetermined target brightness level. At this point, each LED light source is activated, illuminating the cleaned lens surface and capturing a series of second video images, each corresponding to a different light source angle.
[0066] The first video image (image before cleaning) and the second video image (image after cleaning) are processed to extract pixel values. Specifically, for each second pixel in the first video image, its grayscale value or color value at the corresponding coordinates is recorded (denoted as the first pixel value). Similarly, for each third pixel at the corresponding position in the second video image, its grayscale value or color value is recorded (denoted as the second pixel value).
[0067] The second formula is used to calculate the difference between pixels at the same coordinate position in the images before and after cleaning. If the difference in pixel value at the same position between the cleaned and uncleaned images is less than a preset threshold, it indicates that the water stains have been removed.
[0068] To better understand the above-mentioned method for detecting abnormalities in lighting equipment, in an optional embodiment, a solution is also provided for explaining and illustrating the above solution.
[0069] Among related technologies, some solutions use infrared light to detect water stains, but infrared light is easily interfered with by sunlight during the day and requires additional filters, increasing costs. Other solutions employ complex mechanical movement structures to change the direction of the light source, but this significantly increases costs and is difficult to deploy in monitoring equipment.
[0070] The related technology discloses Solution 1: a lens spot ghost detection device and method, comprising a detachably slidably connected light source mechanism and mounting mechanism. By adjusting the distance between the light source and the lens, and utilizing a rotating arm and fiber optic light guide, detection of the light source at different distances is achieved. Adjusting the illumination distance between the light source and the lens improves the versatility of the detection device, making it applicable to spot ghost detection at different distances, thus enhancing the flexibility and accuracy of the detection. However, it requires an additional complex rotating arm mechanical structure, making it unsuitable for monitoring equipment and resulting in high cost.
[0071] The related technology also discloses Solution 2: a system and method for simultaneously detecting camera black spots and supplementary lighting. This system utilizes a dark box, a light source module, a transparent glass assembly, and image processing algorithms to achieve automated synchronous detection of camera black spots and supplementary lighting. Combined with manual verification, it reduces the false negative rate and improves detection efficiency and accuracy. It achieves synchronized automated detection of camera black spots and supplementary lighting, reducing the false negative rate, improving detection efficiency and stability, reducing the false positive rate, and ensuring that the detection results are not affected by ambient light. However, it requires a dark box, making it unsuitable for use with surveillance equipment.
[0072] The related technology also discloses Solution 3: a method, device, medium, and equipment for water stain detection using an in-vehicle camera. This method involves capturing images using an in-vehicle camera, combining edge detection and semantic segmentation techniques to obtain a first candidate region and a second candidate region, fusing the two to determine the water stain region, and correcting the detection results to improve accuracy. This improves the accuracy of water stain detection using an in-vehicle camera, reduces false positives and false negatives, strengthens the data foundation for intelligent driving and assisted driving systems, and enhances the safety and reliability of the system. However, it suffers from the problem that it only detects water stains from images captured by the camera, making it difficult to capture small water droplets clearly in practical use.
[0073] To address the problems of low efficiency in traditional water stain detection methods, such as manual inspections, reliance on ambient light and poor performance at night, high cost of dedicated filters for infrared detection, and the tendency to miss thin water films under single-angle illumination, this application proposes an optional embodiment of a water stain detection method based on an active multi-light source monitoring lens. Specifically:
[0074] Figure 3 This is a flowchart of a water stain detection method for a surveillance lens based on an optional embodiment of this application, as shown below. Figure 3 As shown:
[0075] Step S301: Obtain ambient light intensity and set the brightness level (i.e., target brightness level) of the LED lights (i.e., each lighting device) according to the ambient light intensity.
[0076] Ambient light intensity is obtained using common methods such as grayscale histograms, frequency domain analysis, or neural network models. The power and brightness levels of the n LED arrays are then set based on the ambient light intensity.
[0077] For example: using a grayscale histogram to obtain ambient light brightness, the percentile method is used to find brightness values such that at least p% of pixels are darker than that value. The percentile method is as follows:
[0078] ,in, Where k is the ambient light level, p is the grayscale value, and k is the preset brightness threshold. H(k) represents the number of pixels corresponding to the first pixel point of gray level i in the target image; H(k) represents the number of pixels at gray level k.
[0079] Step S302: Light up the n LEDs embedded in the monitoring device (i.e. the target object) in sequence and acquire the n video frames (i.e. the first video image) at the corresponding time.
[0080] The n LEDs embedded around the lens cap of the monitoring device or embedded in the monitoring device are lit sequentially, and the corresponding n video frames are captured.
[0081] Step S303: Perform image preprocessing on n video frames and register the abnormal light spot template image of water stains as a template image.
[0082] Image preprocessing is performed on n frames of video footage, and pre-acquired common water stain and light spot template images (i.e. abnormal light spot template images) are registered into a registerable anomaly detection network (i.e. anomaly detection model).
[0083] Step S304: Input the preprocessed image into the registered anomaly detection network (i.e., the trained anomaly detection model).
[0084] Step S305: Determine whether an abnormality has been detected.
[0085] If an abnormality is detected, the lens is determined to have water stains; if no abnormality is detected, the lens is determined to have no water stains.
[0086] Step S306: If it is determined that there are water stains on the lens, activate the wipers (i.e., cleaning device).
[0087] Step S307: Determine whether the difference value (i.e. pixel difference) between the image before and after wiper cleaning is less than a preset threshold.
[0088] If the image difference value is less than a preset threshold, the lens is determined to be free of water stains; if the image difference value is greater than or equal to the preset threshold, steps S306-S307 are executed repeatedly until the lens is determined to be free of water stains or the wiper reaches the maximum number of consecutive cleaning cycles within a preset time interval.
[0089] After the wipers are activated, the image after wiping (i.e., the second video image) is captured and the difference between the image and the previous image is calculated. If the difference value is less than a preset threshold, it means that the wipers have been cleaned. Otherwise, the wipers are activated again until the maximum number of consecutive wipes within the preset time interval is reached.
[0090] The formula for determining the image difference value is: .
[0091] In summary, the optional embodiments of this application define a scheme that uses multiple ordinary adaptive power LEDs embedded around the lens or cap of a monitoring device to achieve multi-angle active light source illumination, and determines the presence of water stains on the lens by the light spots caused by the light source illuminating water stains. This primarily solves the problem of image quality degradation caused by water stain contamination on the surface of the monitoring lens. It achieves fully automatic detection without manual intervention, active light source illumination works 24 / 7, uses ordinary visible light LEDs to reduce costs, and multi-angle time-division illumination improves the detection rate (the monitoring device embeds n LED light sources).
[0092] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to run the methods of the various embodiments of this application.
[0093] This embodiment also provides an anomaly detection device for lighting equipment, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0094] Figure 4 This is a structural block diagram of an anomaly detection device for a lighting equipment according to an embodiment of this application; as shown... Figure 4 As shown, it includes:
[0095] The determining module 42 is used to determine the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, wherein the target area includes: the target object;
[0096] The acquisition module 44 is used to acquire a first video image corresponding to each lighting device that is lit up when each lighting device is lit up sequentially based on the target brightness level.
[0097] The detection module 46 is used to perform anomaly detection on each of the lighting devices based on each first video image and the abnormal light spot template image, so as to determine whether there are stains in the target object.
[0098] Through the aforementioned modules, the target brightness level of each lighting device in the target object within the target area is determined based on the ambient light intensity. When each lighting device is sequentially illuminated based on its target brightness level, a first video image corresponding to the illumination of each lighting device is acquired. Anomaly detection is performed on each lighting device based on each first video image and an abnormal light spot template image to determine whether stains exist in the target object. In other words, after determining the target brightness level of each lighting device in the target object, this application can acquire first video images of each lighting device sequentially illuminated based on its target brightness level, and then determine whether stains exist in the target object based on the first video images and the abnormal light spot template image. This application solves the problem of low detection accuracy in water stain detection methods that rely on manual inspection or passive image analysis in related technologies, thereby improving the detection accuracy of water stains.
[0099] In an exemplary embodiment, the determining module 42 is further configured to acquire a target image corresponding to the target region, and determine the number of pixels of a first pixel corresponding to each grayscale value contained in the target image; and determine the ambient light brightness based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold.
[0100] In an exemplary embodiment, the determining module 42 is further configured to determine the ambient light brightness according to a first formula, wherein the first formula is: , The ambient light intensity is given by k, where k is the grayscale value and p is the preset brightness threshold. The number of pixels corresponding to the first pixel point with grayscale value i in the target image.
[0101] In an exemplary embodiment, the determining module 42 is further configured to match the ambient light brightness with a preset brightness level table to determine a brightness level that matches the ambient light brightness in the preset brightness level table, and to determine the brightness level that matches the ambient light brightness in the preset brightness level table as the target brightness level.
[0102] In an exemplary embodiment, the determining module 42 is further configured to determine the brightness parameter corresponding to the target brightness level; construct a target instruction corresponding to each lighting device based on the brightness parameter and the device identifier corresponding to each lighting device; and send the target instruction sequentially to the target object to sequentially light up each lighting device in the target object.
[0103] In an exemplary embodiment, the detection module 46 is further configured to train an anomaly detection model based on the abnormal spot template image; input each first video image into the trained anomaly detection model so that the trained anomaly detection model outputs a detection result corresponding to each first video image; determine that there is no stain in the target object when each detection result is a normal detection result; and determine that there is a stain in the target object when any detection result is an abnormal detection result.
[0104] In one exemplary embodiment, the detection module 46 is further configured to, upon determining that stains exist in the target object, operate a cleaning device in the target object to clean the target object.
[0105] In an exemplary embodiment, the detection module 46 is further configured to: acquire a second video image corresponding to each cleaned lighting device when each cleaned lighting device is sequentially illuminated at the target brightness level, wherein each cleaned lighting device is used to indicate each lighting device in the cleaned target object obtained after cleaning the target object; determine a first pixel value corresponding to each second pixel point contained in the first video image, and determine a second pixel value corresponding to each third pixel point contained in the second video image; and perform anomaly detection on each cleaned lighting device according to the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object.
[0106] In an exemplary embodiment, the detection module 46 is further configured to determine the pixel difference between the first video image and the second video image; compare the pixel difference with a preset threshold to determine the comparison result; and determine that there are no stains in the cleaned target object when the comparison result indicates that the pixel difference is less than the preset threshold.
[0107] In an exemplary embodiment, the detection module 46 is further configured to calculate the pixel difference between the first video image and the second video image according to a second formula, wherein the second formula is: , The pixel difference, Let be the first pixel value of the second pixel point at the (x, y) coordinate position in the first video image. Let M be the second pixel value of the third pixel point at the (x, y) coordinate position in the second video image, M be the number of pixels of the second pixel point, and N be the number of pixels of the third pixel point; compare the pixel difference with a preset threshold; if the comparison result indicates that the pixel difference is less than the preset threshold, determine that there are no stains in the cleaned target object.
[0108] Embodiments of this application also provide a storage medium including a stored program, wherein the program, when executed, performs any of the methods described above.
[0109] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0110] S1, determine the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, wherein the target area includes: the target object;
[0111] S2, when each lighting device is lit up sequentially based on the target brightness level, the first video image corresponding to lighting up each lighting device is obtained respectively;
[0112] S3, each lighting device is subjected to anomaly detection based on each first video image and the abnormal light spot template image to determine whether there are stains in the target object.
[0113] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0114] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0115] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0116] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0117] S1, determine the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, wherein the target area includes: the target object;
[0118] S2, when each lighting device is lit up sequentially based on the target brightness level, the first video image corresponding to lighting up each lighting device is obtained respectively;
[0119] S3, each lighting device is subjected to anomaly detection based on each first video image and the abnormal light spot template image to determine whether there are stains in the target object.
[0120] 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.
[0121] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described embodiments of the abnormal detection method for lighting devices.
[0122] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0123] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing systems. They can be centralized on a single computing system or distributed across a network of multiple computing systems. Optionally, they can be implemented using program code executable by a computing system, thereby storing them in a storage system for execution by the computing system. In some cases, the steps shown or described can be executed in a different order than presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0124] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for detecting anomalies in lighting equipment, characterized in that, include: The target brightness level of each lighting device in the target object is determined based on the ambient light intensity within the target area, wherein the target area includes: the target object; When each lighting device is lit sequentially based on the target brightness level, a first video image corresponding to the lighting device being lit is acquired respectively; Each lighting device is subjected to anomaly detection based on each first video image and an abnormal light spot template image to determine whether there are stains in the target object.
2. The method for detecting abnormalities in lighting equipment according to claim 1, characterized in that, Before determining the target brightness level of each lighting device in the target object based on the ambient light intensity within the target area, the method further includes: Obtain the target image corresponding to the target region, and determine the number of pixels of the first pixel corresponding to each gray value contained in the target image; The ambient light brightness is determined based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold.
3. The method for detecting abnormalities in lighting equipment according to claim 2, characterized in that, The ambient light brightness is determined based on the number of pixels of the first pixel corresponding to each grayscale value and a preset brightness threshold, including: The ambient light intensity is determined according to a first formula, wherein the first formula is: , The ambient light intensity is given by k, where k is the grayscale value and p is the preset brightness threshold. The number of pixels corresponding to the first pixel point with grayscale value i in the target image.
4. The method for detecting abnormalities in lighting equipment according to claim 1, characterized in that, Determine the target brightness level for each lighting device in the target object based on the ambient light intensity within the target area, including: The ambient light brightness is matched with a preset brightness level table to determine the brightness level that matches the ambient light brightness in the preset brightness level table, and the brightness level that matches the ambient light brightness in the preset brightness level table is determined as the target brightness level.
5. The method for detecting abnormalities in lighting equipment according to claim 1, characterized in that, After determining the target brightness level of each lighting device in the target object based on the ambient light intensity within the target area, the method further includes: Determine the brightness parameters corresponding to the target brightness level; Construct the target instruction corresponding to each lighting device based on the brightness parameter and the device identifier corresponding to each lighting device; The target instructions are sent sequentially to the target object to sequentially illuminate each of the lighting devices in the target object.
6. The method for detecting abnormalities in lighting equipment according to claim 1, characterized in that, Each lighting device is subjected to anomaly detection based on each first video image and an abnormal light spot template image to determine whether there are stains in the target object, including: The anomaly detection model is trained based on the abnormal spot template image; Each of the first video images is input into the trained anomaly detection model so that the trained anomaly detection model outputs the detection result corresponding to each of the first video images; If each test result is determined to be a normal result, it is determined that there are no stains in the target object; If any detection result is determined to be an abnormal result, it is determined that there is a stain in the target object.
7. The method for detecting abnormalities in lighting equipment according to claim 1, characterized in that, After performing anomaly detection on each lighting device based on each first video image and an abnormal light spot template image to determine whether there are stains in the target object, the method further includes: If stains are found in the target object, the cleaning equipment in the target object is operated to clean the target object.
8. The method for detecting abnormalities in lighting equipment according to claim 7, characterized in that, After operating the cleaning equipment on the target object to clean the target object, the method further includes: When each cleaned lighting device is lit sequentially at the target brightness level, a second video image corresponding to each cleaned lighting device is acquired, wherein each cleaned lighting device is used to indicate each lighting device in the cleaned target object obtained after cleaning the target object; Determine the first pixel value corresponding to each second pixel point contained in the first video image, and determine the second pixel value corresponding to each third pixel point contained in the second video image; Anomaly detection is performed on each cleaned lighting device based on the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object.
9. The method for detecting abnormalities in lighting equipment according to claim 8, characterized in that, Anomaly detection is performed on each cleaned lighting device based on the first pixel value and the second pixel value to determine whether there are stains in the cleaned target object, including: Determine the pixel difference between the first video image and the second video image; The pixel difference is compared with a preset threshold to determine the comparison result; If the comparison result indicates that the pixel difference is less than the preset threshold, it is determined that there are no stains in the cleaned target object.
10. The method for detecting abnormalities in lighting equipment according to claim 9, characterized in that, Determining the pixel difference between the first video image and the second video image includes: The pixel difference is calculated according to the second formula, wherein the second formula is: , The pixel difference, Let be the first pixel value of the second pixel point at the (x, y) coordinate position in the first video image. Let M be the second pixel value of the third pixel point at the (x, y) coordinate position in the second video image, M be the number of pixels of the second pixel point, and N be the number of pixels of the third pixel point.
11. An anomaly detection device for lighting equipment, characterized in that, include: A determining module is used to determine the target brightness level of each lighting device in the target object based on the ambient light brightness within the target area, wherein the target area includes: the target object; The acquisition module is used to acquire a first video image corresponding to each lighting device being lit up when each lighting device is lit up sequentially based on the target brightness level. The detection module is used to perform anomaly detection on each of the lighting devices based on each first video image and the abnormal light spot template image, so as to determine whether there are stains in the target object.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 10.
13. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the method described in any one of claims 1 to 10 through the computer program.