Camera occlusion detection method and device, electronic equipment and readable storage medium
By combining an improved AlexNet model with a method that considers light intensity, the accuracy problem of occlusion detection in grain depot monitoring cameras was solved, achieving efficient occlusion detection under different lighting conditions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING UNIV OF TECH
- Filing Date
- 2022-11-14
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, grain depot monitoring cameras are easily obstructed, leading to video monitoring failure. Manual inspections are inefficient, and machine learning methods lack adaptability and accuracy under different lighting conditions.
An improved AlexNet model is used for image recognition. Combined with illumination intensity judgment, edge detection algorithm and image recognition model are used to process images under different illumination conditions. Data augmentation, batch normalization layer and dropout layer are used to improve the adaptability and accuracy of the model.
It can determine whether the camera is blocked in a timely and accurate manner under any lighting conditions, improving the adaptability and accuracy of occlusion detection.
Smart Images

Figure CN115908802B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition, and more particularly to a method, apparatus, electronic device, and readable storage medium for detecting camera occlusion. Background Technology
[0002] With the improvement of grain depot management systems and electronic monitoring technology, each grain depot installs numerous surveillance cameras. However, due to human or natural factors, these cameras may be obstructed, affecting the normal operation of the video surveillance system.
[0003] In related technologies, it is possible to check whether a surveillance camera is obstructed by manual inspection, or to use machine learning methods to perform image recognition on the images captured by the camera to determine whether the camera is obstructed.
[0004] However, manual inspections are difficult to detect when cameras are obstructed in a timely manner, and machine learning methods have poor scene adaptability and low accuracy in judging whether cameras installed in grain depots are obstructed. Therefore, there is an urgent need for a detection method suitable for monitoring cameras in grain depots to detect whether they are obstructed. Summary of the Invention
[0005] The purpose of this application is to provide a camera occlusion detection method, apparatus, electronic device, and readable storage medium, which can promptly determine whether the camera is occluded under any lighting conditions based on image frames acquired in real time by the camera, thereby improving the accuracy of occlusion detection.
[0006] This application provides a method for detecting camera occlusion, including:
[0007] Acquire a target image captured by a target camera and calculate the illumination intensity of the target image; based on the comparison result of the illumination intensity of the target image with a preset illumination intensity, analyze the target image using a target model and generate analysis results; wherein, the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is obstructed; the analysis results are used to indicate whether the target camera is obstructed.
[0008] Optionally, the step of analyzing the target image using a target model and generating analysis results based on the comparison result of the illumination intensity of the target image with a preset illumination intensity includes: when the illumination intensity of the target image is less than or equal to the preset illumination intensity, analyzing the target image using a first processing unit of the target model and generating analysis results; or, when the illumination intensity of the target image is greater than the preset illumination intensity, analyzing the target image using a second processing unit of the target model and generating analysis results; wherein, the first processing unit is used to determine whether the target camera is occluded through the target image using an edge detection algorithm; the second processing unit includes: an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series; each pair of convolutional layers in the first five convolutional layers of the improved AlexNet model, and after the seventh convolutional layer of the improved AlexNet model, includes: a batch normalization layer and a Dropout layer.
[0009] Optionally, in the improved AlexNet model, the kernel size of each convolutional layer is a first preset size, the activation function is ReLU, and the padding method is Same padding; the parameters of the Dropout layer between the first and second convolutional layers and the Dropout layer between the second and third convolutional layers in the improved AlexNet model are all first parameters; the parameters of the Dropout layer between the third and fourth convolutional layers in the improved AlexNet model are second parameters; the parameters of the Dropout layer between the fourth and fifth convolutional layers and the Dropout layer after the seventh convolutional layer in the improved AlexNet model are third parameters; the value of the first parameter is less than the value of the second parameter; the value of the second parameter is less than the value of the third parameter.
[0010] Optionally, the pooling layers of the improved AlexNet model are all max pooling layers of a second preset size.
[0011] Optionally, the image recognition model is obtained by training the improved AlexNet model based on the following steps: acquiring multiple image frames captured by a camera as sample images, and performing data augmentation processing on the sample images using a preset processing method to obtain a target sample set; the target sample set includes a training set and a validation set; training the improved AlexNet model using the target sample set, and iteratively updating the weight parameters in the improved AlexNet model until a preset convergence condition is met; saving the weight parameters in the improved AlexNet model to obtain the image recognition model.
[0012] This application also provides a camera occlusion detection device, including:
[0013] The acquisition module is used to acquire a target image captured by a target camera and calculate the illumination intensity of the target image; the image analysis module is used to analyze the target image using a target model based on the comparison result of the illumination intensity of the target image and a preset illumination intensity, and generate analysis results; wherein, the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is occluded; the analysis results are used to indicate whether the target camera is occluded.
[0014] Optionally, the image analysis module is specifically used to analyze the target image using the first processing unit of the target model and generate analysis results when the illumination intensity of the target image is less than or equal to the preset illumination intensity; the image analysis module is further used to analyze the target image using the second processing unit of the target model and generate analysis results when the illumination intensity of the target image is greater than the preset illumination intensity; wherein, the first processing unit is used to determine whether the target camera is occluded through the target image using an edge detection algorithm; the second processing unit includes: an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series; each pair of convolutional layers in the first five convolutional layers of the improved AlexNet model, and after the seventh convolutional layer of the improved AlexNet model, includes: a batch normalization layer and a Dropout layer.
[0015] Optionally, in the improved AlexNet model, the kernel size of each convolutional layer is a first preset size, the activation function is ReLU, and the padding method is Same padding; the parameters of the Dropout layer between the first and second convolutional layers and the Dropout layer between the second and third convolutional layers in the improved AlexNet model are all first parameters; the parameters of the Dropout layer between the third and fourth convolutional layers in the improved AlexNet model are second parameters; the parameters of the Dropout layer between the fourth and fifth convolutional layers and the Dropout layer after the seventh convolutional layer in the improved AlexNet model are third parameters; the value of the first parameter is less than the value of the second parameter; the value of the second parameter is less than the value of the third parameter.
[0016] Optionally, the pooling layers of the improved AlexNet model are all max pooling layers of a second preset size.
[0017] Optionally, the device further includes: an image processing module and a training module; the acquisition module is further configured to acquire multiple image frames captured by the camera as sample images; the image processing module is configured to perform data augmentation processing on the sample images using a preset processing method to obtain a target sample set; the target sample set includes: a training set and a validation set; the training module is configured to train the improved AlexNet model using the target sample set and iteratively update the weight parameters in the improved AlexNet model until a preset convergence condition is met; the training module is further configured to save the weight parameters in the improved AlexNet model to obtain the image recognition model.
[0018] This application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of any of the camera occlusion detection methods described above.
[0019] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the above-described camera occlusion detection methods.
[0020] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described camera occlusion detection methods.
[0021] The camera occlusion detection method, apparatus, electronic device, and readable storage medium provided in this application first acquire a target image captured by a target camera and calculate the illumination intensity of the target image. Then, based on a comparison between the illumination intensity of the target image and a preset illumination intensity, a target model is used to analyze the target image and generate analysis results. Finally, based on the analysis results, it is determined whether the camera is occluded. In this way, it is possible to determine whether a camera is occluded in a timely manner under any lighting conditions, greatly improving the accuracy of occlusion detection. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is one of the flowcharts illustrating the camera occlusion detection method provided in this application;
[0024] Figure 2 This is the second flowchart of the camera occlusion detection method provided in this application;
[0025] Figure 3 This is a schematic diagram of the model training process provided in this application;
[0026] Figure 4 This is a schematic diagram of the camera occlusion detection device provided in this application;
[0027] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0030] The following explains the technical fields involved in the embodiments of this application:
[0031] Non-Maximum Suppression (NMS) suppresses elements that are not local maxima, and can be understood as a local maximum search. This locality represents a neighborhood with two variable parameters: the dimension and the size of the neighborhood. NMS is applied to "thinning out" edges. After gradient computation, edges extracted from gradient values are still very blurry. Therefore, NMS helps suppress all gradient values except for local maxima (by setting them to 0), indicating locations with the strongest intensity changes.
[0032] Hysteresis thresholding: This requires two thresholds: a high threshold and a low threshold. It assumes that significant edges in the image are continuous curves, allowing us to track blurred portions of a given curve and avoid mistaking noise pixels that don't contribute to the curve as edges. Therefore, we start with a larger threshold, which identifies more certain true edges. Using the edge direction information, we can then trace the entire edge in the image from these true edges. During tracking, a smaller threshold can be used to track blurred portions of the curve until we return to the starting point. Once this process is complete, we obtain a binary image, where each point represents whether it is an edge point.
[0033] In a convolutional neural network, each convolutional layer consists of several convolutional units, and the parameters of each convolutional unit are optimized through backpropagation. The purpose of convolution is to extract different features from the input. The first convolutional layer may only extract some low-level features such as edges, lines, and corners, while more layers of the network can iteratively extract more complex features from low-level features.
[0034] Pooling Layer: Pooling is another important concept in convolutional neural networks; it's essentially a form of downsampling. There are various non-linear pooling functions, with max pooling being the most common. It divides the input image into several rectangular regions and outputs the maximum value for each sub-region. Intuitively, this mechanism is effective because, after discovering a feature, its precise location is far less important than its relative position to other features. Pooling layers continuously reduce the spatial size of the data, thus decreasing the number of parameters and computational cost, which to some extent controls overfitting. Pooling layers typically act on each input feature separately and reduce its size.
[0035] In grain depot scenarios, due to the enclosed and opaque nature of grain depots, the scene changes very little in the monitoring areas covered by most cameras. Furthermore, the lighting inside the grain depot changes significantly when the doors are dynamically opened and closed. Therefore, the machine learning methods used in related technologies have a high false positive rate for detecting camera occlusion in grain depot scenarios.
[0036] In view of the above-mentioned technical problems in related technologies, the camera occlusion detection method provided in this application embodiment can accurately determine whether a camera is occluded in scenarios with weak light intensity and large changes in light intensity, which greatly improves the adaptability and accuracy of camera occlusion detection in different environments.
[0037] The camera occlusion detection method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0038] like Figure 1 As shown in the embodiment of this application, a camera occlusion detection method is provided, which may include the following steps 101 and 102:
[0039] Step 101: Acquire the target image captured by the target camera and calculate the illumination intensity of the target image.
[0040] For example, the target camera can be any camera in the monitoring system, that is, each camera in the monitoring system can determine whether the camera is blocked by the camera occlusion detection method provided in the embodiments of this application.
[0041] For example, the target image mentioned above can be any one of multiple image frames captured by the target camera.
[0042] It is understandable that image recognition models need to recognize images, and the surveillance video output by the camera is composed of multiple image frames. Therefore, any image frame captured by the camera can be used as the input image for the image recognition model.
[0043] It should be noted that, in order to reduce the computational load of determining whether the camera is blocked, image frames captured by the target camera can be obtained at preset time intervals. For example, image frames captured by the target camera can be obtained once every minute as the basis for determining whether the target camera is blocked.
[0044] For example, in order to improve the accuracy of camera occlusion detection, different detection methods need to be adopted according to different lighting conditions. Therefore, after obtaining the target image, it is also necessary to calculate the light intensity of the target image.
[0045] In one possible implementation, the illumination intensity of each region can be obtained based on the brightness value of each region of the target image. Then, the average value of the illumination intensity of each region is taken as the illumination intensity of the target image.
[0046] Step 102: Based on the comparison results of the illumination intensity of the target image and the preset illumination intensity, the target image is analyzed using the target model, and the analysis results are generated.
[0047] The preset light intensity is the average light intensity of images that incorrectly determine whether the camera is obstructed; the analysis result is used to indicate whether the target camera is obstructed.
[0048] For example, the preset illumination intensity is obtained by recognizing images with different illumination intensities based on machine learning methods in related technologies.
[0049] Understandably, the machine learning methods in related technologies have different accuracy rates for recognizing images with different light intensities. When the light intensity of an image exceeds a certain threshold (i.e., the aforementioned preset light intensity), the machine learning methods in related technologies show a significant decrease in the accuracy of recognizing camera occlusion.
[0050] Specifically, step 102 above may include step 102a, or step 102b:
[0051] Step 102a: When the illumination intensity of the target image is less than or equal to the preset illumination intensity, the first processing unit of the target model is used to analyze the target image and generate analysis results.
[0052] For example, the target model provided in this application embodiment can be processed by different processing units for input images with different light intensity ranges.
[0053] For example, when the illumination intensity of the target image is less than or equal to the preset illumination intensity, the Canny edge detection method can be used to detect whether the camera is obstructed.
[0054] For example, such as Figure 2 As shown, 0.67 (i.e. the above-mentioned preset light intensity) is used as the standard for dividing light intensity. When the light intensity of the input image (i.e. the above-mentioned target image) input to the target model is less than or equal to 0.67, the Canny edge detection method can be used to detect whether the camera is occluded.
[0055] For example, the Canny edge detection algorithm can be divided into the following 5 steps: 1. Apply Gaussian filtering to smooth the image to remove noise; 2. Find the intensity gradients of the image; 3. Apply non-maximum suppression to eliminate false edge detections (detecting edges that are not actually edges); 4. Apply a double thresholding method to determine possible (potential) boundaries; 5. Use hysteresis techniques to track the boundaries.
[0056] Step 102b: When the illumination intensity of the target image is greater than the preset illumination intensity, the second processing unit of the target model is used to analyze the target image and generate analysis results.
[0057] The first processing unit is used to determine whether the target camera is occluded by using an edge detection algorithm on the target image; the second processing unit includes an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series; each pair of convolutional layers in the first five convolutional layers of the improved AlexNet model, as well as after the seventh convolutional layer of the improved AlexNet model, includes a batch normalization layer and a Dropout layer.
[0058] For example, when the light intensity of the target image is greater than the preset light intensity, the second processing unit of the target model can be used to perform image recognition on the target image to determine whether the target camera is blocked.
[0059] For example, such as Figure 2 As shown, when the illumination intensity of the input image is greater than 0.16, the image recognition model in the target model can be used to detect whether the camera is occluded.
[0060] Specifically, the image recognition model in the second processing unit can be used to perform image recognition on the target image. This image recognition model is obtained by training an improved AlexNet model.
[0061] For example, in the improved AlexNet model, the kernel size of each convolutional layer is a first preset size, the activation function is ReLU, and the padding method is Same padding; the parameters of the Dropout layer between the first and second convolutional layers and the Dropout layer between the second and third convolutional layers in the improved AlexNet model are all first parameters; the parameters of the Dropout layer between the third and fourth convolutional layers in the improved AlexNet model are second parameters; the parameters of the Dropout layer between the fourth and fifth convolutional layers and the Dropout layer after the seventh convolutional layer in the improved AlexNet model are third parameters; the value of the first parameter is less than the value of the second parameter; the value of the second parameter is less than the value of the third parameter.
[0062] It should be noted that the AlexNet model in related technologies has five convolutional layers. The improved AlexNet model provided in this application adds a batch normalization layer and a dropout layer between any two of the original five convolutional layers. Two more convolutional layers are added to give the model a deeper network structure. Each convolutional layer generates a feature map, and the receptive field size of the feature maps generated by the convolutional layers gradually increases with the depth of the layers.
[0063] The improved AlexNet model uses a kernel size of (3, 3) for all convolutional layers (i.e., the first preset size mentioned above), a ReLU activation function, and Same padding for all layers. The improved AlexNet model also uses a uniform max-pooling layer with a size of (2, 2) (i.e., the second preset size mentioned above).
[0064] Understandably, as network depth increases, the feature value distribution of each layer gradually approaches the upper and lower limits of the activation function's output range (the activation function's saturation range). This can lead to gradient vanishing. Batch normalization works by pulling the feature value distribution of this layer back to a standard normal distribution. The feature values will fall within the range where the activation function is more sensitive to the input. Small changes in the input can lead to large changes in the loss function, increasing the gradient and preventing gradient vanishing, while also accelerating convergence.
[0065] For example, Table 1 below shows the differences between the improved AlexNet model provided in the embodiments of this application and the AlexNet model in related technologies:
[0066] AlexNet network structure Improved AlexNet network structure Batch Normalization Conv1-96; Conv1-96; MaxPooling Conv1-32; Conv1-32; MaxPooling Batch Normalization; Dropout(0.1) Conv2-256;onv2-256;MaxPooling Conv2-64; Conv2-64; MaxPooling Batch Normalization; Dropout(0.1) Conv3-384; Conv3-384; MaxPooling Conv3-128; Conv3-128; MaxPooling Batch Normalization; Dropout(0.2) Conv4-384; Conv4-384; MaxPooling Conv4-256; Conv4-256; MaxPooling Batch Normalization; Dropout(0.3) Conv5-256; Conv5-256; MaxPooling Conv5-512; Conv5-512; MaxPooling Conv6-512; Conv6-512; MaxPooling Conv7-256; Conv7-256; MaxPooling Batch Normalization; Dropout(0.3) FC6 FC8 FC7 FC9 FC8 FC10
[0067] Table 1
[0068] For example, after obtaining the improved AlexNet model structure described above, it is necessary to initialize and adjust the hyperparameters. The hyperparameters shown in Table 2 below can be selected, and the selection of hyperparameters is not unique:
[0069] Hyperparameters Optimizer LR Epoch Batch size value Adam 0.0001 1000 16
[0070] Table 2
[0071] For example, after initializing the parameters of the improved AlexNet model, the improved AlexNet model can be trained according to the following steps to obtain the image recognition model described above. Figure 3 As shown, the camera occlusion detection method provided in this application embodiment may further include the following steps 301 to 303:
[0072] Step 301: Acquire multiple image frames captured by the camera as sample images, and perform data augmentation processing on the sample images using a preset processing method to obtain the target sample set.
[0073] The target sample set includes a training set and a validation set.
[0074] For example, the sample images in the target sample set mentioned above can be video frames captured by a camera inside the grain depot. For instance, image frames captured by the camera can be extracted at a frequency of 10 frames per second, containing 1850 training image frames and 500 test image frames. The training image frames include 1200 normal image frames and 650 image frames where the camera is occluded.
[0075] For example, during the training phase, to address the issue of a small number of samples in datasets where the camera is obstructed, this application provides a data augmentation method (i.e., the aforementioned preset processing method), which may include at least one of the following: random brightness, random saturation, random horizontal flipping, random noise, and random cropping and scaling.
[0076] It should be noted that data augmentation involves transforming a sample image to a certain extent without changing the core elements of the original sample image, thereby obtaining more sample images.
[0077] Step 302: Train the improved AlexNet model using the target sample set, and iteratively update the weight parameters in the improved AlexNet model until the preset convergence condition is met.
[0078] Step 303: Save the weight parameters in the improved AlexNet model to obtain the image recognition model.
[0079] It should be noted that the improved AlexNet model increases the sample size by performing data augmentation on the samples, and at the same time, it uses multiple Dropout layers to prevent the model from overfitting.
[0080] For example, after training the improved AlexNet model according to steps 301 to 303 above, the above image recognition model can be obtained. The image recognition model is then used to identify images with light intensity greater than a preset light intensity to determine whether the corresponding camera is blocked.
[0081] The camera occlusion detection method provided in this application first acquires a target image captured by the target camera and calculates the illumination intensity of the target image. Then, if the illumination intensity of the target image is less than or equal to a preset illumination intensity, the first processing unit of the target model analyzes the target image; or, if the illumination intensity of the target image is greater than the preset illumination intensity, the second processing unit of the target model analyzes the target image and generates an analysis result. Finally, based on the analysis result, it is determined whether the camera is occluded. In this way, it can promptly determine whether the camera is occluded under any lighting conditions, greatly improving the accuracy of occlusion detection.
[0082] It should be noted that the camera occlusion detection method provided in this application embodiment can be executed by a camera occlusion detection device, or a control module within that camera occlusion detection device for executing the camera occlusion detection method. This application embodiment uses the execution of the camera occlusion detection method by a camera occlusion detection device as an example to illustrate the camera occlusion detection device provided in this application embodiment.
[0083] It should be noted that, in the embodiments of this application, the camera occlusion detection methods shown in the accompanying drawings are all illustrated by way of example with reference to one of the accompanying drawings in the embodiments of this application. In specific implementation, the camera occlusion detection methods shown in the accompanying drawings of the above methods can also be implemented in conjunction with any other accompanying drawings shown in the above embodiments, which will not be elaborated here.
[0084] The camera occlusion detection device provided in this application is described below, and the camera occlusion detection method described below can be referred to in correspondence with the camera occlusion detection method described above.
[0085] Figure 4 This is a schematic diagram of the structure of a camera occlusion detection device provided in an embodiment of this application, as shown below. Figure 4 As shown, it specifically includes:
[0086] The acquisition module 401 is used to acquire a target image captured by a target camera and calculate the illumination intensity of the target image; the image analysis module 402 is used to analyze the target image using a target model based on the comparison result between the illumination intensity of the target image and a preset illumination intensity, and generate analysis results; wherein, the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is occluded; the analysis results are used to indicate whether the target camera is occluded.
[0087] Optionally, the image analysis module 402 is specifically used to analyze the target image using the first processing unit of the target model and generate analysis results when the illumination intensity of the target image is less than or equal to the preset illumination intensity; the image analysis module 402 is further used to analyze the target image using the second processing unit of the target model and generate analysis results when the illumination intensity of the target image is greater than the preset illumination intensity; wherein, the first processing unit is used to determine whether the target camera is occluded through the target image using an edge detection algorithm; the second processing unit includes: an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series; each pair of convolutional layers in the first five convolutional layers of the improved AlexNet model, and after the seventh convolutional layer of the improved AlexNet model, includes: a batch normalization layer and a Dropout layer.
[0088] Optionally, in the improved AlexNet model, the kernel size of each convolutional layer is a first preset size, the activation function is ReLU, and the padding method is Same padding; the parameters of the Dropout layer between the first and second convolutional layers and the Dropout layer between the second and third convolutional layers in the improved AlexNet model are all first parameters; the parameters of the Dropout layer between the third and fourth convolutional layers in the improved AlexNet model are second parameters; the parameters of the Dropout layer between the fourth and fifth convolutional layers and the Dropout layer after the seventh convolutional layer in the improved AlexNet model are third parameters; the value of the first parameter is less than the value of the second parameter; the value of the second parameter is less than the value of the third parameter.
[0089] Optionally, the pooling layers of the improved AlexNet model are all max pooling layers of a second preset size.
[0090] Optionally, the device further includes: an image processing module and a training module; the acquisition module 401 is further configured to acquire multiple image frames captured by the camera as sample images; the image processing module is configured to perform data augmentation processing on the sample images using a preset processing method to obtain a target sample set; the target sample set includes: a training set and a validation set; the training module is configured to train the improved AlexNet model using the target sample set and iteratively update the weight parameters in the improved AlexNet model until a preset convergence condition is met; the training module is further configured to save the weight parameters in the improved AlexNet model to obtain the image recognition model.
[0091] The camera occlusion detection device provided in this application first acquires a target image captured by the target camera and calculates the illumination intensity of the target image. Then, if the illumination intensity of the target image is less than or equal to a preset illumination intensity, the first processing unit of the target model analyzes the target image; or, if the illumination intensity of the target image is greater than the preset illumination intensity, the second processing unit of the target model analyzes the target image and generates analysis results. Finally, based on the analysis results, it is determined whether the camera is occluded. In this way, it can promptly determine whether the camera is occluded under any lighting conditions, greatly improving the accuracy of occlusion detection.
[0092] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a camera occlusion detection method. This method includes: acquiring a target image captured by a target camera and calculating the illumination intensity of the target image; analyzing the target image using a target model based on a comparison result of the illumination intensity of the target image with a preset illumination intensity, and generating an analysis result; wherein the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is occluded; and the analysis result is used to indicate whether the target camera is occluded.
[0093] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] On the other hand, this application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can execute the camera occlusion detection method provided by the above methods. The method includes: acquiring a target image captured by a target camera and calculating the illumination intensity of the target image; analyzing the target image using a target model based on a comparison result of the illumination intensity of the target image and a preset illumination intensity, and generating an analysis result; wherein the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is occluded; and the analysis result is used to indicate whether the target camera is occluded.
[0095] In another aspect, this application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, performs the aforementioned camera occlusion detection methods. The method includes: acquiring a target image captured by a target camera and calculating the illumination intensity of the target image; analyzing the target image using a target model based on a comparison result between the illumination intensity of the target image and a preset illumination intensity, and generating an analysis result; wherein the preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is occluded; and the analysis result is used to indicate whether the target camera is occluded.
[0096] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting camera occlusion, characterized in that, include: Acquire the target image captured by the target camera and calculate the illumination intensity of the target image; Based on the comparison between the illumination intensity of the target image and the preset illumination intensity, the target image is analyzed using the target model, and analysis results are generated. The preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is obstructed; the analysis result is used to indicate whether the target camera is obstructed. The comparison result between the illumination intensity of the target image and the preset illumination intensity is used to analyze the target image using a target model and generate analysis results, including: When the illumination intensity of the target image is less than or equal to the preset illumination intensity, the first processing unit of the target model analyzes the target image and generates analysis results. or, When the illumination intensity of the target image is greater than the preset illumination intensity, the second processing unit of the target model analyzes the target image and generates analysis results. The first processing unit is used to determine whether the target camera is occluded by using an edge detection algorithm on the target image; the second processing unit includes an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model is composed of convolutional layers and fully connected layers connected in series; the first five convolutional layers of the improved AlexNet model include a batch normalization layer and a Dropout layer between every two convolutional layers, and after the seventh convolutional layer of the improved AlexNet model.
2. The method according to claim 1, characterized in that, The improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series.
3. The method according to claim 2, characterized in that, The kernel size of each convolutional layer in the improved AlexNet model is a first preset size, the activation function is ReLU, and the padding method is Same padding. The parameters of the Dropout layer between the first and second convolutional layers and the Dropout layer between the second and third convolutional layers in the improved AlexNet model are all first parameters. The parameters of the Dropout layer between the third and fourth convolutional layers in the improved AlexNet model are second parameters. The parameters of the Dropout layer between the fourth and fifth convolutional layers and the Dropout layer after the seventh convolutional layer in the improved AlexNet model are third parameters. The value of the first parameter is less than the value of the second parameter. The value of the second parameter is less than the value of the third parameter.
4. The method according to claim 2, characterized in that, The pooling layers in the improved AlexNet model are all max pooling layers of the second preset size.
5. The method according to any one of claims 2 to 4, characterized in that, The image recognition model is obtained by training the improved AlexNet model based on the following steps: Multiple image frames captured by the camera are acquired as sample images, and the sample images are subjected to data augmentation processing using a preset processing method to obtain a target sample set; The target sample set includes: a training set and a validation set; The improved AlexNet model is trained using the target sample set, and the weight parameters in the improved AlexNet model are iteratively updated until the preset convergence condition is met. The weight parameters in the improved AlexNet model are saved to obtain the image recognition model.
6. A camera occlusion detection device, characterized in that, The device includes: The acquisition module is used to acquire the target image captured by the target camera and calculate the light intensity of the target image; The image analysis module is used to analyze the target image using a target model based on the comparison result between the illumination intensity of the target image and the preset illumination intensity, and to generate analysis results; The preset illumination intensity is the average illumination intensity of images that incorrectly determine whether the camera is obstructed; the analysis result is used to indicate whether the target camera is obstructed. The image analysis module is specifically used to analyze the target image using the first processing unit of the target model and generate analysis results when the illumination intensity of the target image is less than or equal to the preset illumination intensity. The image analysis module is further configured to analyze the target image using the second processing unit of the target model and generate analysis results when the illumination intensity of the target image is greater than the preset illumination intensity. The first processing unit is used to determine whether the target camera is occluded by using an edge detection algorithm on the target image; the second processing unit includes an image recognition model; the image recognition model is obtained by training an improved AlexNet model; the improved AlexNet model is composed of convolutional layers and fully connected layers connected in series; the first five convolutional layers of the improved AlexNet model include a batch normalization layer and a Dropout layer between every two convolutional layers, and after the seventh convolutional layer of the improved AlexNet model.
7. The apparatus according to claim 6, characterized in that, The improved AlexNet model consists of seven convolutional layers and three fully connected layers connected in series.
8. The apparatus according to claim 7, characterized in that, The device further includes: an image processing module and a training module; The acquisition module is also used to acquire multiple image frames captured by the camera as sample images; The image processing module is used to perform data augmentation processing on the sample images using a preset processing method to obtain a target sample set; the target sample set includes: a training set and a validation set. The training module is used to train the improved AlexNet model using the target sample set and iteratively update the weight parameters in the improved AlexNet model until a preset convergence condition is met. The training module is also used to save the weight parameters in the improved AlexNet model to obtain the image recognition model.
9. An electronic device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the camera occlusion detection method as described in any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the camera occlusion detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Camera detection method based on image local edge characteristics
CN105427276A
Image detection method and device, storage medium and electronic device
CN111489350A