A weather type image detection and foggy image processing method and device
By integrating image and data classification models into the image acquisition device, the weather type can be determined in real time and image processing can be performed, solving the problems of low image clarity and color contrast under hazy weather, and realizing the real-time defogging effect of the device and improving the accuracy of image data.
Patent Information
- Application Number
- CN202211199412.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-29
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-09-29
AI Technical Summary
Existing image dehazing technology has failed to achieve real-time linkage with image acquisition equipment, resulting in low image clarity and color contrast in images taken under weather conditions such as fog and haze.
By acquiring images and environmental data of the target area, the weather type is determined using image classification and data classification models, and automatic color level processing and gamma correction are performed to improve the real-time defogging capability of the image acquisition equipment.
It enables real-time defogging processing of image acquisition equipment, improving the clarity and color contrast of images under weather conditions such as fog and haze, and enhancing the real-time performance of status monitoring and the accuracy of image data.
Smart Images

Figure CN115620119B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method and apparatus for weather type image detection and foggy image processing. Background Technology
[0002] Due to low atmospheric visibility during foggy or hazy weather conditions, images taken in such conditions often suffer from low clarity and poor color contrast.
[0003] However, since existing image dehazing technology has not yet achieved real-time linkage with most image acquisition devices, it is difficult to optimize images captured by image acquisition devices in real time under weather conditions such as fog and haze. Summary of the Invention
[0004] Therefore, it is necessary to provide a method and apparatus for weather type image detection and foggy image processing to address the aforementioned technical problems.
[0005] In a first aspect, this application provides a method for weather type image detection and foggy image processing, applied to the processor of an image acquisition device, the method comprising:
[0006] Acquire the image and environmental data of the target area to be identified;
[0007] The image to be identified is input into the image classification model to obtain the first meteorological classification probability output by the image classification model;
[0008] The environmental data to be identified is input into the data classification model to obtain the second meteorological classification probability output by the data classification model.
[0009] Based on preset weights, the first meteorological classification probability, and the second meteorological classification probability, the weather type corresponding to the target area is determined.
[0010] If the weather type corresponding to the target area is determined to be the target weather type, then the image to be identified is taken as the target image;
[0011] The target image is subjected to automatic color level processing, and gamma correction is performed on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing, so as to obtain the processing result of the target image.
[0012] In one embodiment, the target weather type includes foggy weather; the environmental data to be identified includes ambient temperature data and ambient humidity data; the ambient humidity data includes average ambient humidity data; the average ambient humidity data is obtained based on several humidity sensors; before inputting the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model, the method further includes the following steps:
[0013] Within several preset time periods, the ambient temperature data and the average ambient humidity data of the target area are acquired; the weather type corresponding to the target area within each preset time period is acquired; the ambient temperature data, the average ambient humidity data, and the weather type of the target area acquired within each preset time period are fitted to construct a meteorological data training set for the target area; and the data classification model is trained based on the meteorological data training set.
[0014] In one embodiment, the data classification model is a gradient descent tree model.
[0015] In one embodiment, the image classification model is the DenseNet convolutional neural network model.
[0016] In one embodiment, the pixel value range corresponding to the target image after automatic color level processing includes [0, 255]; the step of performing gamma correction on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing includes:
[0017] Based on a preset gamma value, pre-compensation processing is performed on each integer in the range [0, 255] to obtain a pre-compensation value corresponding to each integer; a gamma correction lookup table is constructed based on the pre-compensation value corresponding to each integer; a grid search method is used to find the gamma correction parameter corresponding to each pixel of the target image after automatic color level processing from the gamma correction lookup table; based on the gamma correction parameter, the pixel value corresponding to each pixel of the gamma-corrected target image is determined.
[0018] In one embodiment, the step of determining the weather type corresponding to the target area based on preset weights, the first meteorological classification probability, and the second meteorological classification probability uses the following formula to determine the weather type corresponding to the target area:
[0019]
[0020] in, P represents the probability that the weather type corresponding to the target area is a certain weather type. i The probability of the first meteorological category. Let α be the probability of the second meteorological classification, β be the preset weight corresponding to the probability of the first meteorological classification, and α+β=1.
[0021] Secondly, this application also provides a weather type image detection and foggy weather image processing device, applied to a processor of an image acquisition device, the device comprising:
[0022] The data acquisition module is used to acquire the image to be identified and the environmental data to be identified in the target area.
[0023] The first meteorological probability output module is used to input the image to be identified into the image classification model to obtain the first meteorological classification probability output by the image classification model.
[0024] The second meteorological probability output module is used to input the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model.
[0025] The weather type determination module is used to determine the weather type corresponding to the target area based on several preset weights, the first meteorological classification probability, and the second meteorological classification probability.
[0026] The target image determination module is used to determine the image to be identified as the target image if the weather type corresponding to the target area is determined to be the target weather type.
[0027] The processing result output module is used to perform automatic color level processing on the target image, and to perform gamma correction on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing, so as to obtain the processing result of the target image.
[0028] Thirdly, this application also provides an image acquisition device. The image acquisition device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described method.
[0029] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.
[0030] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described method.
[0031] The aforementioned weather type image detection and foggy image processing method and apparatus first acquires the image to be identified and the environmental data to be identified for the target area. Then, the image to be identified is input into an image classification model to obtain a first meteorological classification probability output by the image classification model. Next, the environmental data to be identified is input into a data classification model to obtain a second meteorological classification probability output by the data classification model. Then, based on preset weights, the first meteorological classification probability, and the second meteorological classification probability, the weather type corresponding to the target area is determined. If the weather type corresponding to the target area is determined to be the target weather type, the image to be identified is used as the target image. Finally, automatic color level processing is performed on the target image, and gamma correction is performed on the target image based on the pixel value range corresponding to the automatically color level processed target image to obtain the processing result of the target image. This application determines the weather type of the target area based on images and environmental data acquired from the target area, and performs defogging processing on images with the target weather type. This not only realizes real-time linkage between defogging processing technology and image acquisition equipment, but also effectively improves the real-time performance of status monitoring of the target area based on image acquisition equipment, as well as the accuracy of image data acquired by image acquisition equipment. Attached Figure Description
[0032] Figure 1 This is a flowchart illustrating a weather type image detection and foggy image processing method in one embodiment;
[0033] Figure 2 This is a flowchart illustrating a specific method for obtaining a meteorological data training set for training a data classification model in one embodiment.
[0034] Figure 3 This is a flowchart illustrating a specific method for performing gamma correction on a target image after automatic color level processing in one embodiment.
[0035] Figure 4 This is a structural block diagram of a weather type image detection and foggy weather image processing device in one embodiment;
[0036] Figure 5 This is an internal structural diagram of an image acquisition device in one embodiment;
[0037] Figure 6 This is a schematic diagram illustrating the effect of a weather type image detection and fog image processing method in a practical application, as shown in one embodiment. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0040] The weather type image detection and fog image processing method provided in this application embodiment can be applied to server execution. The data storage system can store the data that the server needs to process; the data storage system can be integrated on the server, or it can be located in the cloud or on other network servers; the server can be a standalone server or a server cluster composed of multiple servers.
[0041] In one embodiment, such as Figure 1 As shown, a method for weather type image detection and foggy image processing is provided. This method is applied to the processor of an image acquisition device and includes the following steps:
[0042] Step S110: Obtain the image to be identified and the environmental data to be identified for the target area.
[0043] In this step, the target area can be any area that needs to be monitored by acquiring images and environmental data in real time; the image to be identified refers to an image taken in the target area that has not yet undergone classification and identification processing; the environmental data to be identified refers to environmental data obtained from the target area that has not yet undergone classification and identification processing; the environmental data can include environmental temperature data, environmental humidity data, and other environmental state data that can be used to characterize the weather type of a certain area within a certain time period; the environmental temperature data can be obtained based on a temperature sensor; the environmental humidity data can be obtained based on a humidity sensor; the humidity sensor can be an outdoor humidity sensor.
[0044] For example, assuming the target area is a substation, an intelligent inspection robot equipped with image acquisition equipment can be used to capture images in real time that represent the state of the area where the substation is located, which can be used as the images to be identified. Furthermore, environmental status data of the area where the substation is located can be collected in real time by setting up multiple humidity sensors and temperature sensors in the area where the substation is located.
[0045] Step S120: Input the image to be identified into the image classification model to obtain the first meteorological classification probability output by the image classification model.
[0046] In this step, the image to be identified refers to an image taken in the target area that has not yet undergone classification and identification processing; the image classification model refers to an image classification model that has the function of determining the weather type when the image to be identified was taken based on the image to be identified; the first meteorological classification probability refers to the probability output by the image classification model that the weather type when the image to be identified was one or more weather types.
[0047] For example, assuming the classification criteria of the image classification model are three weather types: foggy, rainy, and other weather, by inputting the image to be identified into the image classification model, we can obtain the probability values output by the image classification model of the weather type when the image to be identified was taken: foggy, rainy, and other weather. For example, by inputting the image to be identified into the image classification model, the image classification model can output the following probability values: the probability value of the weather type when the image to be identified was foggy is P1, the probability value of the weather type when the image to be identified was rainy is P2, and the probability value of the weather type when the image to be identified was other weather is P3.
[0048] Step S130: Input the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model.
[0049] In this step, the environmental data to be identified refers to the environmental data obtained from the target area that has not yet undergone classification and identification processing; the environmental data may include environmental temperature data, environmental humidity data, and other environmental state data that can be used to characterize the weather type of a certain area within a certain time period; the data classification model refers to a data classification model that has the function of determining the weather type when the environmental data to be identified is obtained based on the environmental data to be identified; the second meteorological classification probability refers to the probability output by the data classification model that the weather type when the environmental data to be identified is one or more weather types.
[0050] For example, assuming the classification criteria of the data classification model are three weather types: foggy, rainy, and other weather, then by inputting the environmental data to be identified into the data classification model, we can obtain the probability values output by the data classification model of the weather type when the environmental data to be identified is foggy, rainy, or other weather. For instance, by inputting the environmental data to be identified into the data classification model, the data classification model can output the following information: the probability value of the weather type when the environmental data to be identified is foggy is... The probability value that the weather type when obtaining the environmental data to be identified is rainy is... The probability value of the weather type being "other" when acquiring environmental data to be identified is...
[0051] Step S140: Determine the weather type corresponding to the target area based on preset weights, the probability of the first meteorological classification, and the probability of the second meteorological classification.
[0052] In this step, the preset weights can be the preset weights corresponding to the first meteorological classification probability and the second meteorological classification probability, respectively. The first meteorological classification probability refers to the probability output by the image classification model that the weather type when the image to be identified is one or more weather types. The second meteorological classification probability refers to the probability output by the data classification model that the weather type when the environmental data to be identified is one or more weather types. The weather type corresponding to the target area refers to the weather type of the target area when the image to be identified and the environmental data to be identified are acquired. The specific method for determining the weather type corresponding to the target area can be to determine the probability that the weather type of the target area is one or more weather types when the image to be identified and the environmental data to be identified are acquired based on the first meteorological classification probability, the second meteorological classification probability and their respective preset weights, and then take the weather type with the highest probability value as the weather type corresponding to the target area.
[0053] Step S150: If the weather type corresponding to the target area is determined to be the target weather type, then the image to be identified is taken as the target image.
[0054] In this step, the weather type corresponding to the target area refers to the weather type corresponding to the target area determined based on the above-mentioned image to be identified and the above-mentioned environmental data to be identified. The target weather type can be any weather type determined according to the actual image processing requirements. For example, the target weather type can be set to foggy weather.
[0055] For example, assuming the target weather type is set to foggy, the image with the corresponding foggy weather type will be used as the target image for subsequent image processing.
[0056] Furthermore, based on the potential status monitoring needs of the target area corresponding to the image acquisition device, corresponding subsequent execution steps can be set for weather types other than the target weather type. For example, when the weather type corresponding to the target area is determined to be rainy, an instruction to turn on the windshield wipers of the image acquisition device is generated to improve the image quality captured under rainy conditions; when the weather type corresponding to the target area is determined to be foggy or other than rainy, the image captured by the image acquisition device is directly output (since images captured by smoke generated by fire and images captured by fog generated under natural conditions have high feature similarity, defogging optimization processing is only performed on images captured by fog generated under natural conditions, which can effectively avoid the problem of missing smoke images representing fire accidents when using automatic image defogging processing technology when monitoring the status of the target area based on the image acquisition device).
[0057] Step S160: Perform automatic color level processing on the target image, and perform gamma correction on the target image based on the pixel value range corresponding to the target image after automatic color level processing, to obtain the processing result of the target image.
[0058] In this step, "Auto Levels" refers to the process of first assigning the brightest and darkest pixel values as white and black in the corresponding red, green, and blue (R, G, B) channels of the image, and then redistributing the pixel values in the red, green, and blue channels based on a preset ratio. "Gamma Correction" refers to gamma correction. The processing result of the target image refers to the target image after processing with Auto Levels and Gamma Correction.
[0059] For example, a specific method for automatically processing the color levels of a target image can be as follows: First, perform histogram statistics on the pixel values in the red, green, and blue (R, G, B) channels of the target image respectively, and obtain the pixel thresholds of the first and last 0.5% of the target image's red channel (R channel), denoted as R. min (Lower threshold of R channel) and R max (Upper threshold of R channel), the pixel threshold of the first and last 0.5% of the green channel (G channel) of the target image, denoted as G. min (Lower threshold of G channel) and G max (The upper limit threshold of the G channel), and the pixel thresholds of the first and last 0.5% of the target image's corresponding blue channel (B channel), denoted as B. min (Lower threshold of channel B) and B max (Upper threshold of B channel); Then, according to the following formula, establish a linear mapping relationship between each pixel value in the red, green, and blue (R, G, B) channels of the target image and the interval [0, 255]:
[0060]
[0061] Where u is any pixel value in the red, green, and blue (R, G, B) channels of the target image, and min is the lower threshold of the channel corresponding to that pixel value (i.e., R). min G min , or B min ), where max is the upper threshold of the channel corresponding to that pixel value (i.e., R). max G max , or B max And the value of u satisfies min <u<max。
[0062] The aforementioned weather type image detection and foggy image processing method first acquires the target area's image to be identified and the target environment data. Then, the image to be identified is input into an image classification model to obtain the first meteorological classification probability output by the model. Next, the target environment data is input into a data classification model to obtain the second meteorological classification probability output by the model. Then, based on preset weights, the first meteorological classification probability, and the second meteorological classification probability, the weather type corresponding to the target area is determined. If the weather type corresponding to the target area is determined to be the target weather type, the image to be identified is used as the target image. Finally, automatic color level processing is performed on the target image, and gamma correction is applied to the target image based on the pixel value range corresponding to the automatically color level processed target image to obtain the processed target image. This application determines the weather type of the target area based on images and environmental data acquired from the target area, and performs defogging processing on images with the target weather type. This not only realizes real-time linkage between defogging processing technology and image acquisition equipment, but also effectively improves the real-time performance of status monitoring of the target area based on image acquisition equipment, as well as the accuracy of image data acquired by image acquisition equipment.
[0063] In one embodiment, the target weather type includes foggy weather; the environmental data to be identified includes ambient temperature data and ambient humidity data; the ambient humidity data includes average ambient humidity data; the average ambient humidity data is obtained based on several humidity sensors; the specific method for obtaining the meteorological data training set used to train the data classification model is as follows: Figure 2 As shown, before step S130 above, the following steps are also included:
[0064] Step S210: Acquire ambient temperature data and average humidity data of the target area within a certain preset time period.
[0065] In this step, the preset time periods can be determined based on the frequency of monitoring the required status of the target area; the ambient temperature data of the target area can be obtained by temperature sensors set up in the target area; the average ambient humidity data of the target area can be the average value of ambient humidity data obtained by several humidity sensors set up in the target area; the several humidity sensors can be several outdoor humidity sensors.
[0066] For example, suppose the ambient humidity data obtained by several humidity sensors set up in the target area is (H1, H2, ..., H...). n The average humidity data of the target area can then be calculated using the following expression:
[0067]
[0068] Where i∈n.
[0069] Step S220: Obtain the weather type corresponding to the target area within each preset time period.
[0070] In this step, each preset time period can be a time period determined based on the frequency of demand status monitoring for the target area; the weather type corresponding to the target area refers to the weather type of the target area during the time period when the ambient temperature data and the average ambient humidity data of the target area are acquired.
[0071] Step S230 involves fitting the ambient temperature data, average humidity data, and weather type of the target area acquired within each preset time period to construct a meteorological data training set for the target area.
[0072] In this step, the specific method for fitting the target area's ambient temperature data, average ambient humidity data, and corresponding weather type within each preset time period can be based on a gradient descent tree model (sklearn GBDT). This model fits the relational dataset formed by the target area's ambient temperature data, average ambient humidity data, and corresponding weather type within each preset time period. The meteorological data training set for the target area refers to the meteorological data training set obtained after fitting the relational dataset formed by the target area's ambient temperature data, average ambient humidity data, and corresponding weather type within each preset time period.
[0073] For example, assuming the classification criterion for the weather type corresponding to the target area is rainy, foggy, and other weather, and the three categories of rainy, foggy, and other weather are represented as 0, 1, and 2 respectively, then the above relational dataset can be represented in the form shown in Table 1 below: Table 1
[0074]
[0075] Step S240: Train the data classification model based on the meteorological data training set.
[0076] In this step, the meteorological data training set refers to the meteorological data training set of the target area. After training the data classification model based on the meteorological data training set of the target area, the probability of the target area being a certain weather type when the target area obtains environmental temperature data and average environmental humidity data can be obtained by inputting environmental temperature data and average environmental humidity data obtained from the target area into the data classification model.
[0077] The above embodiments improve the accuracy of the prediction results of the weather type of the target area obtained based on the data classification model by training the data classification model with a meteorological data training set that is fitted with the ambient temperature data, average humidity data and weather type of the target area obtained in each preset time period, thereby improving the data accuracy of the image obtained by the image acquisition device.
[0078] In one embodiment, the data classification model described above is a gradient descent tree model.
[0079] For example, suppose we need to use a gradient descent tree model (i.e., the data classification model mentioned above) to predict the weather type of a target area for m rounds when obtaining ambient temperature and average humidity data from the target area, with the prediction function being F. m The initial constant or a certain prediction period is f. m Given the input variables X = {H, C}, where H represents ambient humidity and C represents ambient temperature, the following formula can be used to predict and output the weather type for the target area:
[0080] F m (X)=F m-1 (X)+f m (X);
[0081]
[0082] Where P is the predicted value based on the output of the Sigmoid function (i.e., the probability of the second meteorological classification mentioned above).
[0083] In one embodiment, the image classification model described above is a DenseNet convolutional neural network model.
[0084] The DenseNet convolutional neural network model (i.e., the image classification model mentioned above) uses the Softmax function to output the predicted value (i.e., the probability of the first meteorological classification mentioned above).
[0085] In one embodiment, the pixel value range corresponding to the target image after automatic color level processing includes [0, 255]; the specific method for performing gamma correction on the target image after automatic color level processing is as follows: Figure 3 As shown, step S160 specifically includes:
[0086] Step S310: Based on the preset gamma value, pre-compensation processing is performed on each integer in the interval [0, 255] to obtain the pre-compensation value corresponding to each integer.
[0087] In this step, the preset gamma value can be a gamma value determined based on the image resolution; the pre-compensation value refers to performing pre-compensation processing on each integer in the range [0, 255] to obtain the pre-compensation value corresponding to each integer.
[0088] Step S320: Construct a gamma correction lookup table based on the pre-compensation value corresponding to each integer.
[0089] In this step, the specific way to construct the gamma correction lookup table based on the pre-compensation value corresponding to each integer is to store the pre-compensation value corresponding to each integer into a pre-set gamma correction lookup table.
[0090] Step S330: Using the grid search method, find the gamma correction parameters corresponding to each pixel of the target image after automatic color level processing from the gamma correction lookup table.
[0091] In this step, grid search refers to the grid search method; gamma correction parameters are the gamma correction parameters used to determine the pixel value corresponding to each pixel of the gamma-corrected target image; there is a one-to-one correspondence between the gamma correction parameters and each pixel of the target image.
[0092] Step S340: Based on the gamma correction parameters, determine the pixel value corresponding to each pixel point of the gamma-corrected target image.
[0093] In this step, the specific method for determining the pixel value corresponding to each pixel of the gamma-corrected target image based on the gamma correction parameters can be to replace the output pixel value at the corresponding position of each pixel of the target image with the gamma correction parameters corresponding to each pixel of the target image.
[0094] For example, assuming the pixel value range of the target image is known to be [0, 255], and the preset gamma value is gamma, the output pixel value corresponding to each pixel in the red, green, and blue channels of the target image can be calculated using the following expression:
[0095] R'=[255*(R / 255)]^(1 / gamma);
[0096] G'=[255*(G / 255)]^(1 / gamma);
[0097] B'=[255*(B / 255)]^(1 / gamma);
[0098] Where R' is the output pixel value corresponding to each pixel in the R channel (Red Channel), R is the original pixel value corresponding to each pixel in the R channel, G' is the output pixel value corresponding to each pixel in the G channel (Green Channel), G is the original pixel value corresponding to each pixel in the G channel, B' is the output pixel value corresponding to each pixel in the B channel (Blue Channel), and B is the original pixel value corresponding to each pixel in the B channel.
[0099] The above embodiments effectively improve the clarity and color contrast of images acquired by image acquisition devices by performing gamma correction on the target image after automatic color gradation processing, thereby improving the data accuracy of images acquired by image acquisition devices.
[0100] In one embodiment, in step S140 above, the weather type corresponding to the target area is determined using the following formula:
[0101]
[0102] in, Let P be the probability that the weather type corresponding to the above target area is a certain weather type. i The above is the probability of the first meteorological category. Let α be the probability of the second meteorological classification mentioned above, β be the preset weight corresponding to the probability of the first meteorological classification mentioned above, and α+β=1.
[0103] The above embodiments effectively ensure the accuracy of the weather type results corresponding to the target image acquired by the image acquisition device by determining the probability of the target image belonging to one or more weather types based on the preset weight values corresponding to the first meteorological classification probability and the second meteorological classification probability, thereby improving the data accuracy of the image acquired by the image acquisition device.
[0104] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0105] Based on the same inventive concept, this application also provides a weather type image detection and fog image processing apparatus for implementing the weather type image detection and fog image processing methods described above. The solution provided by this apparatus is similar to the implementation scheme described in the above methods. Therefore, the specific limitations in one or more embodiments of the weather type image detection and fog image processing apparatus provided below can be found in the limitations of the weather type image detection and fog image processing methods described above, and will not be repeated here.
[0106] In one embodiment, such as Figure 4 As shown, a weather type image detection and fog image processing device is provided, which is applied to the processor of an image acquisition device. The device 400 includes:
[0107] The data acquisition module 410 is used to acquire the image to be identified and the environmental data to be identified in the target area.
[0108] The first meteorological probability output module 420 is used to input the image to be identified into the image classification model to obtain the first meteorological classification probability output by the image classification model;
[0109] The second meteorological probability output module 430 is used to input the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model.
[0110] The weather type determination module 440 is used to determine the weather type corresponding to the target area based on several preset weights, the first meteorological classification probability, and the second meteorological classification probability.
[0111] The target image determination module 450 is used to determine the image to be identified as the target image if the weather type corresponding to the target area is determined to be the target weather type.
[0112] The processing result output module 460 is used to perform automatic color level processing on the target image, and perform gamma correction on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing, so as to obtain the processing result of the target image.
[0113] In one embodiment, the above apparatus further includes: a training set acquisition module, configured to acquire ambient temperature data and average ambient humidity data of the target area within several preset time periods; acquire the weather type corresponding to the target area within each preset time period; perform fitting processing on the ambient temperature data, average ambient humidity data, and weather type of the target area acquired within each preset time period to construct a meteorological data training set for the target area; and train the data classification model based on the meteorological data training set.
[0114] In one embodiment, the data classification model in the second meteorological probability output module 430 is a gradient descent tree model.
[0115] In one embodiment, the image classification model in the first meteorological probability output module 420 is a DenseNet convolutional neural network model.
[0116] In one embodiment, the pixel value range corresponding to the target image after automatic color level processing in the processing result output module 460 includes [0, 255]. Specifically, the processing result output module 460 is used to perform pre-compensation processing on each integer in the range [0, 255] based on a preset gamma value to obtain the pre-compensation value corresponding to each integer; construct a gamma correction lookup table based on the pre-compensation value corresponding to each integer; use a grid search method to find the gamma correction parameter corresponding to each pixel of the target image after automatic color level processing from the gamma correction lookup table; and determine the pixel value corresponding to each pixel of the gamma-corrected target image based on the gamma correction parameter.
[0117] In one embodiment, the weather type determination module 440 is specifically used to determine the weather type corresponding to the target area using the following formula:
[0118]
[0119] in, P represents the probability that the weather type corresponding to the target area is a certain weather type. i The probability of the first meteorological category. Let α be the probability of the second meteorological classification, β be the preset weight corresponding to the probability of the first meteorological classification, and α+β=1.
[0120] Each module in the aforementioned weather type image detection and fog image processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the image acquisition device in hardware form or independent of it, or stored in the memory of the image acquisition device in software form, so that the processor can call and execute the corresponding operations of each module.
[0121] In one embodiment, an image acquisition device is provided, the internal structure of which can be shown in the following diagram: Figure 5 As shown, the image acquisition device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media. The database stores images and environmental data of the target area. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a weather type image detection and fog image processing method.
[0122] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the solution of this application and does not constitute a limitation on the image acquisition device to which the solution of this application is applied. A specific image acquisition device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0123] In one embodiment, such as Figure 6 As shown, a schematic diagram illustrating the effects of the aforementioned weather type image detection and fog image processing methods in practical applications is provided. Figure 6 As can be seen, the above-mentioned weather type image detection and fog image processing methods can effectively improve the clarity and color contrast of images taken under weather conditions such as fog and haze.
[0124] In one embodiment, an image acquisition device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.
[0125] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0126] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described above.
[0127] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0128] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0129] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0130] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for weather type image detection and foggy weather image processing, characterized in that, The method, applied to a processor of an image acquisition device, includes: The system acquires an image to be identified and environmental data to be identified for a target area; wherein, the target area is a substation; the image to be identified is an image taken in real time by an intelligent inspection robot that represents the state of the area to which the substation belongs; the environmental data to be identified is collected by setting up multiple humidity sensors and temperature sensors in the area to which the substation belongs. The image to be identified is input into the image classification model to obtain the first meteorological classification probability output by the image classification model; The environmental data to be identified is input into the data classification model to obtain the second meteorological classification probability output by the data classification model. Based on preset weights, the first meteorological classification probability, and the second meteorological classification probability, the weather type corresponding to the target area is determined. If the weather type corresponding to the target area is determined to be the target weather type, then the image to be identified is taken as the target image; The target image is subjected to automatic color level processing, and gamma correction is performed on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing, so as to obtain the processing result of the target image. The target weather type is foggy; the environmental data to be identified includes ambient temperature data and ambient humidity data; the ambient humidity data includes average ambient humidity data; the average ambient humidity data is obtained based on several humidity sensors. The data classification model is a gradient descent tree model; the image classification model is a DenseNet convolutional neural network model; the pixel value range of the target image after automatic color level processing includes [0, 255]; The step of performing gamma correction on the target image after automatic color gradation processing based on the pixel value range corresponding to the target image after automatic color gradation processing includes: performing pre-compensation processing on each integer in the interval [0, 255] based on a preset gamma value to obtain a pre-compensation value corresponding to each integer; constructing a gamma correction lookup table based on the pre-compensation value corresponding to each integer; using a grid search method to find the gamma correction parameter corresponding to each pixel of the target image after automatic color gradation processing from the gamma correction lookup table; and determining the pixel value corresponding to each pixel of the gamma-corrected target image based on the gamma correction parameter. The method further includes: when the weather type corresponding to the target area is determined to be rainy, generating an operation command to turn on the windshield wipers of the image acquisition device; when the weather type corresponding to the target area is determined to be other than foggy or rainy weather, directly outputting the image captured by the image acquisition device.
2. The method according to claim 1, characterized in that, Before inputting the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model, the method further includes the following steps: Within a certain preset time period, acquire the ambient temperature data and the average ambient humidity data of the target area; Obtain the weather type corresponding to the target area within each preset time period; The ambient temperature data, average ambient humidity data, and weather type of the target area acquired within each preset time period are fitted to construct a meteorological data training set for the target area. The data classification model is trained based on the meteorological data training set.
3. The method according to claim 1 or 2, characterized in that, In the step of determining the weather type corresponding to the target area based on preset weights, the first meteorological classification probability, and the second meteorological classification probability, the weather type corresponding to the target area is determined using the following formula: in, P represents the probability that the weather type corresponding to the target area is a certain weather type. i The probability of the first meteorological category. Let α be the probability of the second meteorological classification, β be the preset weight corresponding to the probability of the first meteorological classification, and α+β=1.
4. A weather type image detection and foggy weather image processing device, characterized in that, A processor applied to an image acquisition device, the device comprising: The data acquisition module is used to acquire the image to be identified and the environmental data to be identified of the target area; wherein, the target area is a substation; The first meteorological probability output module is used to input the image to be identified into the image classification model to obtain the first meteorological classification probability output by the image classification model. The second meteorological probability output module is used to input the environmental data to be identified into the data classification model to obtain the second meteorological classification probability output by the data classification model. The weather type determination module is used to determine the weather type corresponding to the target area based on several preset weights, the first meteorological classification probability, and the second meteorological classification probability. The target image determination module is used to determine the image to be identified as the target image if the weather type corresponding to the target area is determined to be the target weather type. The processing result output module is used to perform automatic color level processing on the target image, and perform gamma correction on the target image after automatic color level processing based on the pixel value range corresponding to the target image after automatic color level processing, so as to obtain the processing result of the target image. The target weather type is foggy; the environmental data to be identified includes ambient temperature data and ambient humidity data; the ambient humidity data includes average ambient humidity data; the average ambient humidity data is obtained based on several humidity sensors. The data classification model is a gradient descent tree model; the image classification model is a DenseNet convolutional neural network model; the pixel value range of the target image after automatic color level processing includes [0, 255]; The processing result output module is specifically used to perform pre-compensation processing on each integer in the range [0, 255] based on a preset gamma value, to obtain a pre-compensation value corresponding to each integer; to construct a gamma correction lookup table based on the pre-compensation value corresponding to each integer; to use a grid search method to find the gamma correction parameter corresponding to each pixel of the target image after automatic color level processing from the gamma correction lookup table; and to determine the pixel value corresponding to each pixel of the gamma-corrected target image based on the gamma correction parameter. The device is also used to generate an operation command to turn on the windshield wipers of the image acquisition device when the weather type corresponding to the target area is determined to be rainy; and to directly output the image captured by the image acquisition device when the weather type corresponding to the target area is determined to be other than foggy or rainy weather.
5. An image acquisition device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Intelligent weather phenomenon information processing method and system
CN110766333A
Board card image enhancement method, device and equipment and readable storage medium
CN114255193A