A method and system for forming artificial rainbows based on visual feedback

By optimizing artificial rainbow formation through visual sensors and machine learning algorithms, the problem of not considering the influence of water mist and droplet density and pressure on rainbow formation in existing technologies has been solved, and the automatic adjustment and optimization of rainbow effects has been achieved.

CN118279656BActive Publication Date: 2026-01-06XIAMEN UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410392601.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-02
Publication Date
2026-01-06
Estimated Expiration
2044-04-02

AI Technical Summary

Technical Problem

Existing artificial rainbow devices fail to effectively consider the impact of water mist and droplet density, water pressure and air pressure on the visual effect of rainbow formation, and the intelligent adjustment part is not perfect.

Method used

The hue, saturation, and brightness of the rainbow are obtained by a visual sensor, and an artificial rainbow algorithm is formed by training a CNN network. The random forest regression model is used to predict control parameters and adjust the spraying system to optimize the rainbow effect.

Benefits of technology

The rainbow formation effect has been optimized by automatically adjusting the incident angle and nozzle position, taking into account factors such as water mist droplet density, water pressure and air pressure, thus improving the visual performance of the rainbow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118279656B_ABST
    Figure CN118279656B_ABST
Patent Text Reader

Abstract

The application discloses a kind of artificial rainbow formation method and system based on visual feedback, its method includes: the last fully connected layer of convolutional neural network AlexNet is modified, it outputs four values, respectively corresponding hue, saturation, color brightness and arc length;AlexNet is initialized using pre-training weight and is trained, and the obtained AlexNet model is used as identification model;According to AlexNet model, sampling image is identified to obtain identification result;Using random forest regression model to predict control parameter, according to the predicted control parameter adjustment spraying system.The artificial rainbow formation method of the application considers incident angle, spatial position, time parameter, water pressure and air pressure size and the density and size of water droplet of water mist, improves the existing artificial rainbow calculation method;By real-time feedback and output decision to the rainbow image sprayed by spraying device, the incident angle of sunlight and spray head can be automatically controlled by spraying device, so that better rainbow effect is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial rainbow technology, specifically a method and system for forming artificial rainbows based on visual feedback. Background Technology

[0002] Because small water droplets have a light-dispersing effect, when a large number of small water droplets are sprayed into the sky, a rainbow is formed under the illumination of light. Associate Professor Liu Kejie of the Physics Department of Baotou Teachers College, in his article "Rainbows in Artificial Fountains and Their Formation," describes the relationship between the path of sunlight through water droplets and the formation of rainbows, such as... Figure 1 As shown. If sunlight refracts, reflects, and refracts again inside a water droplet before exiting, it forms the primary rainbow. If the process is refraction, reflection, reflection, and refraction before exiting the droplet, a secondary rainbow, also known as a neon rainbow, may form. For example, light rays b1b2 are refracted into the droplet, b2b3 are reflected on the inner wall of the droplet, b3b4 are reflected again, and finally b4b5 is refracted again to produce light rays b5b6, which are observed by the naked eye. Similarly, the formation of an nth rainbow involves sunlight undergoing n reflections inside the droplet before exiting. Water droplets are visible molecules in the air, and their radii are generally greater than 100 times the wavelength of the incident light. Therefore, geometric optics can be used to solve the scattering problem. The exit angle of the primary rainbow varies depending on the angle of incident light, and these angles have extreme values. The violet light of the primary rainbow has a large scattering angle and therefore scatters inside the primary rainbow, while the red light has a small scattering angle and therefore scatters on the outside. Calculations show that the primary rainbow can be observed at an angle of approximately 40°-42°. The opposite is true for the neon, which appears as purple on the outside and red on the inside.

[0003] In their paper "Optical Principles of Rainbow Formation and Derivation of Scattering Angle," Yu Xiaoying and Li Fansheng point out that Fresnel's formula provides a method for calculating the ratio of reflected energy and refracted energy to incident energy. Furthermore, the more times light is reflected within a water droplet, the faster the energy decays, resulting in lower light intensity. Consequently, the brightness of a secondary rainbow is significantly lower than that of a primary rainbow, appearing dimmer and wider. In reality, it is very difficult to observe rainbows with three or more tertiary rainbows.

[0004] Furthermore, invention patent CN102555653A discloses an artificial rainbow, including a spraying device and a lighting device. The spraying device has an arc-shaped water pipe connected to a pressurizing device, and the arc-shaped water pipe is equipped with nozzles. The lighting device has high-intensity LED lights, and the lamp tubes of the lighting device are arc-shaped lamp tubes of the same shape and size as the arc-shaped water pipes. The arc-shaped lamp tubes are placed parallel to the arc-shaped water pipes, and the shortest line connecting any point of the arc-shaped lamp tube to the arc-shaped water pipe constitutes the light incident direction. The light incident direction and the plane where the arc-shaped water pipe is located form a light incident angle of 48 degrees. In this patent, the observation direction is set to a horizontal direction, and the artificial spraying device is arranged in a staggered, curved pattern. Before the water is introduced into the pipe, it first passes through the pressurizing device to increase the pressure, and then is sprayed out from the nozzle through the arc-shaped water pipe, forming a ring of water mist. Under the illumination of the side lighting device, the white light is dispersed, achieving the effect of an artificial rainbow.

[0005] Chinese patent application CN104346984A discloses a rainbow box that uses three sets of LED spotlights as the light source; three 1.5-volt batteries as the power source for the LED lights and a small water pump; a micro-atomizer to spray tiny water droplets with adjustable spray direction; and a small water pump to provide the water flow. The LED light source is mounted on top of the rainbow box, the micro-atomizer on the bottom, and the small water pump on the bottom. To create the rainbow, first activate the small water pump to spray water droplets, then turn on the light source; the rainbow will then be visible from the front.

[0006] Invention patent CN110858258A discloses a method for calculating the position of an artificial rainbow, filling a gap in the practical application of rainbows and the theoretical knowledge related to rainbow position calculation. This allows for the application of artificial rainbow technology in education and commercial fields such as tourism. The method includes the following steps:

[0007] Step 1: Determine the required initial parameters based on the location of the artificial rainbow. These initial parameters include spatial parameters, temporal parameters, and observation parameters. The spatial parameters include local latitude N and local longitude E; the temporal parameters include year, month, day, and local Beijing time; the observation parameters include observation distance l and observation height h, where observation distance l is the distance from the observation point to the water mist, and observation height h is the horizontal distance from the observation point to the ground. Step 2: Calculate the solar altitude angle Htai. If Htai < 45°, calculate the rainbow altitude angle Hhong. Step 3: Calculate the solar azimuth angle Atai. Step 4: Calculate the rainbow height hhong, rainbow width dhong, and rainbow span lhong. Step 5: The parameters calculated in steps 1 to 4 are used in the design and optimization of devices to facilitate the observation of artificial rainbows.

[0008] Utility model patent CN206951474U discloses an artificial rainbow device and an artificial rainbow window, which includes a water supply unit, multiple nozzles, a high-pressure water pump, and a control valve. The water supply unit is used to store water. The multiple nozzles are respectively connected to the outlet of the water supply unit. The high-pressure water pump is connected between the water supply unit and the multiple nozzles to supply water from the water supply unit to the multiple nozzles. The control valve is used to control the opening and closing of the multiple nozzles. The multiple nozzles are arranged in at least one row with spacing between them, and the multiple nozzles are inclined. The diameter of the multiple nozzles is 2mm-4.5mm.

[0009] The invention patent with publication number CN104772252A discloses an intelligent artificial rainbow machine, which forms a fine water mist band through a pressure pump and an atomizing device, and intelligently adjusts the intensity and angle of the light source shining on the water mist band to artificially create a rainbow.

[0010] As can be seen from the above, in existing technologies, the light source of artificial rainbow devices relies on artificial light sources, and the intelligent adjustment mechanism does not consider the influence of the density and size of water droplets, water pressure, and air pressure on the visual effect of rainbow formation. Furthermore, the design methods for artificial rainbows (such as the position calculation method for artificial rainbows disclosed in CN110858258A) only consider spatial, temporal, and observational parameters, neglecting factors strongly correlated with rainbow formation, such as the density and size of water droplets in the air and the magnitude of water and air pressure. Summary of the Invention

[0011] A brief overview of embodiments of the invention is provided below to provide a basic understanding of certain aspects of the invention. It should be understood that this overview is not an exhaustive summary of the invention. It is not intended to identify key or essential parts of the invention, nor is it intended to limit the scope of the invention. Its purpose is merely to present certain concepts in a simplified form as a prelude to the more detailed description that follows.

[0012] The idea behind this invention is to acquire the hue, saturation, and value of the artificial rainbow formed at the measured location using a visual sensor, as well as the rainbow arc length, latitude and longitude of the observation point, solar altitude angle, and air and hydraulic pressure of the spraying system. Then, a corresponding visual feedback-based artificial rainbow formation algorithm is obtained by training a CNN network.

[0013] According to one aspect of this application, a method for forming an artificial rainbow based on visual feedback includes:

[0014] Step 1: Visual attribute recognition and obtaining the AlexNet model:

[0015] A dataset was created using a certain number of rainbow photos: the rainbow photos covered different weather conditions, different days, and rainbows at different angles and distances, and were labeled with four target attributes: hue, saturation, brightness, and arc length; all rainbow photos were resized to the uniform size required by the convolutional neural network AlexNet, and the pixel values ​​of the resized rainbow photos were normalized to be between 0 and 1, and the data diversity was increased.

[0016] Designing the AlexNet model: The dataset is divided into training, validation, and test sets. The AlexNet (Convolutional Neural Network) is pre-trained using the training set to obtain pre-trained weights. The last fully connected layer of the AlexNet is modified to output four values, corresponding to hue, saturation, brightness, and arc length, respectively. The AlexNet is initialized and trained using the pre-trained weights, and the resulting AlexNet model is used as the recognition model.

[0017] Training the AlexNet model: Training can be performed using the Adaptive Moment Estimation (Adam) method, while monitoring the performance on the validation set during training to adjust model parameters and avoid overfitting;

[0018] For newly captured rainbow images, the trained AlexNet model is used to predict their visual attributes: the rainbow image to be identified is collected as a sample image, and the sample image is identified according to the AlexNet model to obtain the identification result;

[0019] Step 2: Use a random forest regression model to predict control parameters, and adjust the spraying system based on the predicted control parameters:

[0020] Data preprocessing steps: The hue, saturation, brightness, and arc length of the rainbow photos are used to form an attribute dataset [H,S,V,l], where H, S, V, and l represent hue, saturation, brightness, and rainbow arc length, respectively. The attribute dataset is labeled with the latitude and longitude of the observation point, the solar altitude angle, and the air and hydraulic pressure of the spraying system (to control the size of the spray droplets) to obtain a control dataset [B,L,H,ap,hp], where B, L, H, ap, and hp represent the latitude and longitude of the observation point, the solar altitude angle, and the air and hydraulic pressure of the spraying system, respectively. The hue, saturation, brightness, and arc length features of the attribute dataset are standardized. The standardized attribute dataset is then divided into an attribute training set, an attribute validation set, and an attribute test set (e.g., attribute training set (70%), attribute validation set (15%), and attribute test set (15%)).

[0021] Use a random forest regressor (e.g., sklearn.ensemble.RandomForestRegressor) to train a random forest regression model, where the number of decision trees in the random forest regression model can be set to n_estimators = 100;

[0022] Using mean squared error (MSE) and coefficient of determination (R²) 2 The performance of the random forest regression model was evaluated, and the model was adjusted based on the evaluation results.

[0023] The adjusted random forest regression model was used to predict the attribute test set: the control parameters (B, L, H, ap, hp) were predicted based on the actual rainbow attribute data (H, S, V, l).

[0024] Adjust the spraying system based on the obtained predictive control parameters to optimize the rainbow formation effect.

[0025] As one implementation scheme, in step 1 above, the dataset is created using a sufficient number of rainbow photographs (e.g., 30,000). These photographs should cover different weather conditions, different times of day, and rainbows at different angles and distances, and be labeled with four target attributes: hue, saturation, brightness, and arc length, where:

[0026] 1) Hue: The approximate range or specific value of the main color of the rainbow;

[0027] 2) Saturation: The intensity or purity of rainbow colors;

[0028] 3) Lightness / Brightness: The brightness of a rainbow;

[0029] 4) Arc length: The length of the rainbow arc, which can be the actual length or a proportion relative to the photo size.

[0030] As one implementation approach, in step 1 above, all rainbow photos are resized to the uniform size required by the AlexNet convolutional neural network, such as 224x224 pixels. The pixel values ​​of the resized photos are then normalized to a range between 0 and 1, or other suitable normalization methods are used. These methods, such as rotation, scaling, cropping, and adjusting brightness and contrast, increase data diversity, helping the model learn more generalized features and reducing overfitting.

[0031] Furthermore, the data preprocessing step in step 2 above can be performed simultaneously with the dataset creation in step 1. Specifically, it includes: acquiring a sufficient number of rainbow photos; processing these photos to obtain a YCbCr image set; labeling the YCbCr image set with hue, saturation, brightness, and rainbow arc length to form an attribute dataset [H,S,V,l], where H,S,V,l represent hue, saturation, brightness, and rainbow arc length, respectively; labeling the attribute dataset with the latitude and longitude of the observation point, solar altitude angle, and spray system air and hydraulic pressure, respectively, to obtain a control dataset [B,L,H,ap,hp]; and simultaneously selecting and labeling the best rainbow effect from the control dataset. B,L,H,ap,hp represent the latitude and longitude of the observation point, solar altitude angle, and spray system air and hydraulic pressure, respectively.

[0032] Furthermore, the YCbCr image set is obtained through the following formulas (1)-(3):

[0033] Y=0.299R+0.587G+0.114B; (1)

[0034] Cb=-0.172R-0.339G+0.511B+128; (2)

[0035] Cr=0.511R-0.428G-0.083B+128; (3)

[0036] Where Y represents the brightness and intensity of the color, and Cb and Cr represent the blue and red intensity offsets, respectively.

[0037] As one implementation scheme, step 1 of the above-mentioned design of the AlexNet model specifically includes: AlexNet typically consists of 5 convolutional layers and 3 fully connected layers, with the output dimension of the last fully connected layer (usually called fc8) matching the number of classes in the classification task. The adjustment scheme is as follows:

[0038] 1) Remove the last fully connected layer: The original fc8 layer was designed for the 1000-class ImageNet classification task. Given that this approach is for a regression task, this layer will be removed.

[0039] 2) Add a new fully connected layer: Add a new fully connected layer to replace the removed fc8. This new fully connected layer will have two output nodes, corresponding to the predicted values ​​of the rainbow arc length and chromaticity, respectively.

[0040] 3) Adjust the activation function: After this new fully connected layer, the softmax activation function (which is used for classification tasks) is not needed; the values ​​of the two nodes are directly output.

[0041] 4) Loss function selection: Since the task of this scheme is regression rather than classification, mean squared error (MSE) is used to train the network.

[0042] As one implementation scheme, in step 1 above, when training the AlexNet model, the dataset segmentation specifically includes: dividing the dataset into a training set, a validation set, and a test set; using the training set to train the AlexNet model; and monitoring the performance on the validation set during training to adjust model parameters and avoid overfitting. The preferred parameter settings for the training process are as follows: 130 consecutive epochs and an initial learning rate of 0.0001. Of course, the above parameters can be further modified according to the actual situation.

[0043] As one implementation scheme, the specific steps for training the AlexNet model in step 1 above include:

[0044] Define the loss function MSE;

[0045] Select optimizer: Train using the Adam optimizer;

[0046] Split the dataset: Divide the dataset into a training set (70%), a validation set (15%), and a test set (15%);

[0047] Batch training: In each training cycle, the training set data is processed in batches, the loss between the AlexNet model output and the true label is calculated, and the model weights are updated using the backpropagation algorithm;

[0048] Model evaluation: After each epoch, the model's performance is evaluated using a validation set, and parameters are adjusted as needed.

[0049] As one implementation, the standardization process in step 2 of the data preprocessing step can be Z-Score Normalization: converting the feature values ​​into a form with a mean of 0 and a standard deviation of 1. For a given feature X, the standardized value X' is calculated using the following formula:

[0050]

[0051] Where μ is the mean of X and σ is the standard deviation of X.

[0052] As one implementation, step 2 uses mean squared error (MSE) and coefficient of determination (R²). 2 Evaluating the performance of a random forest regression model specifically includes:

[0053] 1) Mean Square Error Where n is the number of samples, and yi is the actual value of the i-th sample. It is the predicted value of the i-th sample, i∈n;

[0054] The smaller the MSE, the closer the model's prediction is to the actual value, and the better the model's performance.

[0055] 2) The coefficient of determination is a statistic reflecting the goodness of fit of the model, and its value ranges from 0 to 1; R0 2 The closer a value is to 1, the better the model fit. Its calculation formula is:

[0056] in It is the average of the actual values ​​of all samples.

[0057] Furthermore, for newly captured rainbow images, the visual attributes are predicted using a trained AlexNet model: Rainbow images to be identified are collected as sample images, and the sample images are identified using the AlexNet model to obtain recognition results. Specifically, this includes: spraying water mist into the sky through a spraying device to form a rainbow, capturing the current rainbow scene as a sample image, inputting the sample image into the trained AlexNet model, extracting rainbow features (hue, saturation, brightness, and arc length) from the captured sample image, obtaining the state matrix [H,S,V,l] of the sample image, inputting the extracted features into a random forest regression model to obtain the optimal control parameters, obtaining the control dataset [B,L,H,ap,hp], generating control decisions, and determining the optimal incident angle, optimal nozzle height, and spray air and water pressure under the current environment.

[0058] According to another aspect of this application, a visual feedback-based artificial rainbow formation system includes...

[0059] The AlexNet model acquisition module is used to perform the following procedures:

[0060] A dataset was created using a certain number of rainbow photos: the rainbow photos covered different weather conditions, different days, and rainbows at different angles and distances, and were labeled with four target attributes: hue, saturation, brightness, and arc length; all rainbow photos were resized to the uniform size required by the convolutional neural network AlexNet, and the pixel values ​​of the resized rainbow photos were normalized to be between 0 and 1, and the data diversity was increased.

[0061] Design the AlexNet model: Divide the dataset into training, validation, and test sets. Perform self-supervised pre-training on the convolutional neural network AlexNet using the training set to obtain pre-trained weights. Modify the last fully connected layer of the convolutional neural network AlexNet to output four values, corresponding to hue, saturation, brightness, and arc length, respectively. Initialize the convolutional neural network AlexNet using the pre-trained weights and train it. The resulting AlexNet model is used as the recognition model.

[0062] Train the AlexNet model while monitoring its performance on the validation set during training to adjust model parameters and avoid overfitting;

[0063] For newly captured rainbow images, the trained AlexNet model is used to predict their visual attributes: the rainbow image to be identified is collected as a sample image, and the sample image is identified according to the AlexNet model to obtain the identification result;

[0064] The spraying system adjustment module is used to perform the following processes:

[0065] Data preprocessing steps: The hue, saturation, brightness, and arc length of the rainbow photos are used to form an attribute dataset [H,S,V,l], where H, S, V, and l represent hue, saturation, brightness, and rainbow arc length, respectively. The attribute dataset is labeled with the latitude and longitude of the observation point, the solar altitude angle, and the air and hydraulic pressure of the spraying system to obtain a control dataset [B,L,H,ap,hp], where B, L, H, ap, and hp represent the latitude and longitude of the observation point, the solar altitude angle, and the air and hydraulic pressure of the spraying system, respectively. The hue, saturation, brightness, and arc length features of the attribute dataset are standardized. The standardized attribute dataset is then divided into an attribute training set, an attribute validation set, and an attribute test set.

[0066] The random forest regression model was trained using a random forest regressor, and its performance was evaluated. The model was then adjusted based on the evaluation results.

[0067] The adjusted random forest regression model was used to predict the attribute test set: the control parameters (B, L, H, ap, hp) were predicted based on the actual rainbow attribute data (H, S, V, l).

[0068] Adjust the spraying system based on the obtained predictive control parameters to optimize the rainbow formation effect.

[0069] Compared with the prior art, the present invention, through the above-described solution, has the following advantages:

[0070] (1) The artificial rainbow formation method of the present invention takes into account the incident angle, spatial position, time parameters, water pressure and air pressure, as well as the density and size of water mist and water droplets, and improves the existing artificial rainbow calculation method.

[0071] (2) By providing real-time feedback on the rainbow image sprayed by the spraying device, the current incident angle, spatial position, time parameters, water pressure and air pressure of the spraying device are obtained through the visual sensor. The algorithm determines the most suitable incident angle of light and outputs the decision so that the spraying device can automatically control the incident angle of sunlight and nozzle, thereby obtaining a better rainbow effect. Attached Figure Description

[0072] The present invention can be better understood by referring to the description given below in conjunction with the accompanying drawings, in which the same or similar reference numerals are used throughout the drawings to denote the same or similar parts. These drawings, together with the following detailed description, are incorporated in and form part of this specification, and are used to further illustrate preferred embodiments of the invention and explain the principles and advantages of the invention. (See the accompanying drawings.)

[0073] In the picture:

[0074] Figure 1 This is a schematic diagram of the light path of sunlight in a water droplet. Detailed Implementation

[0075] Embodiments of the present invention will now be described with reference to the accompanying drawings. Elements and features described in one drawing or embodiment of the invention may be combined with elements and features shown in one or more other drawings or embodiments. It should be noted that, for clarity, representations and descriptions of components and processes unrelated to the present invention and known to those skilled in the art have been omitted from the drawings and description.

[0076] This invention provides a method for forming an artificial rainbow based on visual feedback. This method can be used to spray water from a sprinkler placed under natural sunlight to create the best artificial rainbow effect.

[0077] The algorithm investigates the influence of parameters such as sunlight intensity, illumination angle, spray range, particle size, and flow rate on rainbow formation. Images acquired by a visual sensor are trained using an AlexNet network to obtain the measured hue, saturation, and value of the artificial rainbow, as well as its arc length. This data is then input into a random forest regression model to obtain the control parameters related to the observation point's latitude and longitude, solar altitude angle, and the air and hydraulic pressure of the spraying system. This constitutes the complete visual feedback-based artificial rainbow formation algorithm. The algorithm further provides optimal control schemes for the illumination angle, spray range, and air and hydraulic pressure of the water mist spraying system. Existing commercially available devices can be modified to achieve automatic adjustment upon power-on.

[0078] Specifically, the method for forming an artificial rainbow based on visual feedback according to the present invention includes the following steps:

[0079] Step 1. Visual Attribute Recognition

[0080] (1a) Create a training set;

[0081] (1b). AlexNet model design and tuning;

[0082] (1c) Perform self-supervised pre-training on the AlexNet model to obtain pre-trained weights;

[0083] (1d) Initialize the AlexNet model training using pre-trained weights;

[0084] (1e) For newly captured rainbow images, use the trained AlexNet model to predict their visual attributes: collect the rainbow image to be identified as a sample image, identify the sample image according to the recognition model, and obtain the recognition result.

[0085] Step 2. Control Parameter Prediction Section

[0086] (2a) Dataset labeling

[0087] (2b) Perform Z-Score Normalization on features such as hue, saturation, brightness, and arc length.

[0088] (2c) Use sklearn.ensemble.RandomForestRegressor to initialize and train the model.

[0089] (2d) Predict the test set using the trained model: Use the trained model to predict the control parameters (B,L,H,ap,hp) based on the actual rainbow attribute data (H,S,V,l).

[0090] Specifically, step (1a) includes the following steps:

[0091] (a1) Use enough rainbow photos (30,000) to cover rainbows under different weather conditions, at different times of day, and at different angles and distances.

[0092] (a2) Perform morphological processing and color feature extraction on the image. Use formulas (1)-(3) to convert the input image into a YCbCr image, where Y represents the brightness and concentration of the color, and Cb and Cr represent the blue concentration offset and red concentration offset of the color, respectively.

[0093] Y=0.299R+0.587G+0.114B; (1)

[0094] Cb=-0.172R-0.339G+0.511B+128; (2)

[0095] Cr=0.511R-0.428G-0.083B+128; (3)

[0096] (a3) Label the rainbow dataset in step (a2) with hue, saturation, and value, as well as the rainbow arc length, to form the dataset [H,S,V,l];

[0097] (a4) Label the latitude and longitude of the observation point, the solar altitude angle, and the air pressure and hydraulic pressure of the spraying system in the dataset [H,S,V,l] obtained in step (a3) ​​to form a dataset [B,L,H,ap,hp]. At the same time, select the best rainbow effect in the dataset and label it.

[0098] Step (1b) involves modifying the last fully connected layer of AlexNet to output four values, corresponding to hue, saturation, brightness, and arc length. AlexNet typically consists of 5 convolutional layers and 3 fully connected layers, with the output dimension of the last fully connected layer (often called fc8) matching the number of classes in the classification task. The adjustment scheme is as follows:

[0099] 1) Remove the last fully connected layer: The original fc8 layer was designed for the 1000-class ImageNet classification task. Given that this approach is for a regression task, this layer will be removed.

[0100] 2) Add a new fully connected layer: Add a new fully connected layer to replace the removed fc8. This new fully connected layer will have two output nodes, corresponding to the predicted values ​​of the rainbow arc length and chromaticity, respectively.

[0101] 3) Adjust the activation function: After this new fully connected layer, the softmax activation function (which is used for classification tasks) is not needed; the values ​​of the two nodes are directly output.

[0102] 4) Loss function selection: Since the task of this scheme is regression rather than classification, mean squared error (MSE) is used to train the network.

[0103] Step (1c) includes the following steps:

[0104] Dataset splitting: The dataset was divided into a training set (70%), a validation set (15%), and a test set (15%). Training was performed using the Adaptive Moments Estimation (Adam) method, while monitoring performance on the validation set during training to adjust model parameters and avoid overfitting. The training parameters were set as follows: 130 consecutive epochs, with an initial learning rate of 0.0001.

[0105] Step (1d) involves initial training of the AlexNet model using pre-trained weights, specifically including: defining the loss function MSE; selecting an optimizer: training using the Adam optimizer; splitting the dataset: dividing the dataset into a training set (70%), a validation set (15%), and a test set (15%); batch training: in each training epoch, batch processing of the training set data, calculating the loss between the AlexNet model output and the true label, and updating the model weights using the backpropagation algorithm; and evaluating the model: after each epoch, evaluating the model's performance using the validation set and adjusting the parameters as needed.

[0106] In evaluating the model, the mean square error (MSE) loss function measures the average of the squared differences between the model's predicted and actual values. Specifically, the details of how MSE works during the training process are as follows: minimizing the root mean square error (MSE).

[0107]

[0108] Where N is the number of samples from the dataset, For the target (true value), This represents the network output of the c-th output channel corresponding to the k-th sample. The goal of the training process is to find model parameters that minimize the loss function.

[0109] Step (2b) includes the following steps:

[0110] Z-score standardization transforms feature values ​​into a form with a mean of 0 and a standard deviation of 1. For a given feature X, the standardized value X' is calculated using the following formula:

[0111]

[0112] Where μ is the mean of X and σ is the standard deviation of X.

[0113] Using a trained model, control parameters (B, L, H, ap, hp) are predicted based on the actual rainbow attribute data (H, S, V, l), and the spraying system is adjusted to optimize the rainbow formation effect.

[0114] The present invention has the following advantages through the above solution:

[0115] (1) No external light source or additional nozzles are required; simply place the device in sunlight to generate a good rainbow effect.

[0116] (2) Using a visual feedback algorithm, the device obtains the current incident angle, spatial position, time parameters, water pressure and air pressure through the visual sensor. The algorithm determines the most suitable incident angle of light and outputs a decision that can automatically control the incident angle of sunlight and nozzle.

[0117] (3) In the visual feedback algorithm, the incident angle, spatial position, time parameters, water pressure and air pressure, as well as the density and size of water mist and water droplets are considered to improve the existing method for calculating the position of artificial rainbows.

[0118] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.

[0119] Furthermore, the method of the present invention is not limited to being executed in the chronological order described in the specification, but may also be executed in other chronological orders, in parallel, or independently. Therefore, the execution order of the method described in this specification does not constitute a limitation on the technical scope of the present invention.

[0120] Although the invention has been disclosed above through the description of specific embodiments, it should be understood that all the embodiments and examples described above are exemplary and not restrictive. Those skilled in the art can design various modifications, improvements, or equivalents to the invention within the spirit and scope of the appended claims. These modifications, improvements, or equivalents should also be considered to be included within the protection scope of the invention.

Claims

1. A method for artificial rainbow formation based on visual feedback, characterized by: The application relates to a method for predicting the visual attributes of a rainbow and adjusting a spraying system to form a rainbow, and comprises the following steps: Step 1, visual attribute recognition and acquisition of an AlexNet model, specifically comprising: A certain number of rainbow photos are used to make a data set: the rainbow photos cover different weather conditions, different time of day, and different angles and distances of the rainbow, and are labeled with four target attributes: hue, saturation, color value and arc length; all the rainbow photos are adjusted to a uniform size required by the convolutional neural network AlexNet, the pixel values of the adjusted rainbow photos are normalized to make the range between 0 and 1, and data diversity is increased; An AlexNet model is designed: the data set is divided into a training set, a validation set and a test set, the convolutional neural network AlexNet is pre-trained through the training set to obtain pre-training weights; the last fully connected layer of the convolutional neural network AlexNet is modified to output four values corresponding to hue, saturation, color value and arc length; the convolutional neural network AlexNet is initialized using the pre-training weights and trained to obtain an AlexNet model as a recognition model; The AlexNet model is trained, and the performance on the validation set in the training process is monitored to adjust the model parameters and avoid overfitting; For a newly captured rainbow picture, the trained AlexNet model is used to predict the visual attributes: a rainbow picture to be recognized is collected as a sampling image, and the sampling image is recognized according to the AlexNet model to obtain a recognition result; Step 2, prediction of the control parameters using a random forest regression model, and adjustment of the spraying system according to the predicted control parameters, specifically comprising: A data preprocessing step: the hue, saturation, color value and arc length of the rainbow photo form an attribute data set [H, S, V, l], H, S, V and l respectively represent hue, saturation, color value and rainbow arc length; the attribute data set is labeled with observation point longitude and latitude, solar elevation angle, spraying system air pressure and hydraulic pressure to obtain a control data set [B, L, H, ap, hp], B, L, H, ap and hp respectively represent observation point longitude and latitude, solar elevation angle, spraying system air pressure and hydraulic pressure; the hue, saturation, color value and arc length features of the attribute data set are standardized; the standardized attribute data set is divided into an attribute training set, an attribute validation set and an attribute test set; A random forest regressor is used to train a random forest regression model, and the performance of the random forest regression model is evaluated, and the random forest regression model is adjusted according to the evaluation result; The adjusted random forest regression model is used to predict the attribute test set: the control parameters (B, L, H, ap, hp) are predicted according to the actual rainbow attribute data (H, S, V, l); The spraying system is adjusted according to the obtained predicted control parameters to optimize the effect of rainbow formation.

2. The method of artificial rainbow formation based on visual feedback according to claim 1, characterized in that: The modification of the last fully connected layer of the convolutional neural network AlexNet in the step 1 design AlexNet model specifically includes that the convolutional neural network AlexNet includes 5 convolutional layers and 3 fully connected layers, the last fully connected layer is recorded as fc8, the output dimension of fc8 matches the number of categories of the classification task, and the fc8 of the convolutional neural network AlexNet is reshaped to obtain the AlexNet model, and the specific reshaping adjustment includes: 1) removing the last fully connected layer fc8 of the convolutional neural network AlexNet; 2) adding a new fully connected layer to replace the removed fc8, the new fully connected layer has 2 output nodes, respectively corresponding to the predicted values of the arc length and chroma of the rainbow; 3) adjusting the activation function: after this new fully connected layer, there is no need for a softmax activation function, and the values of the 2 output nodes are directly outputted; 4) using mean square error to train the network.

3. The method of artificial rainbow formation based on visual feedback according to claim 1, characterized in that: The data set is made by using a certain number of rainbow photos, specifically including: obtaining a sufficient number of rainbow photos, processing these photos to obtain a YCbCr image set; the YCbCr image set is obtained by formulas (1)-(3): Y = 0.299R + 0.587G + 0.114B; (1) Cb = -0.172R - 0.339G + 0.511B + 128; (2) Cr = 0.511R - 0.428G - 0.083B + 128; (3) Wherein, Y represents the brightness and concentration of color, Cb and Cr represent the blue concentration offset and red concentration offset of color respectively.

4. The method of artificial rainbow formation based on visual feedback according to claim 1, characterized in that: The standardization processing of the data preprocessing step of step 2 is Z-score standardization: the value of a feature is converted into a form with 0 as the mean value and 1 as the standard deviation; for a given feature X, the standardized value X' is calculated as follows: Wherein, μ is the mean of X, and σ is the standard deviation of X.

5. The method of artificial rainbow formation based on visual feedback according to claim 1, characterized in that: The step 2 uses mean square error and coefficient of determination to evaluate the performance of the random forest regression model, specifically including: mean squared error where n is the number of samples, yi is the actual value of the i-th sample, is the predicted value of the i-th sample, i ∈ n; The smaller the MSE, the closer the predicted results of the model to the actual values, and the better the performance of the model; The coefficient of determination is a statistic that measures the goodness of fit of a model, whose value ranges from 0 to 1; R 2 The closer to 1, the better the model fits; its formula is: Where is the mean of all sample actual values.

6. The method of artificial rainbow formation based on visual feedback according to claim 1, characterized in that: The trained AlexNet model is used to predict the visual attributes of a newly captured rainbow picture: Collect the rainbow picture to be identified as a sample image, and identify the sample image according to the AlexNet model to obtain an identification result, specifically including: spraying water mist into the sky through a spraying device and forming a rainbow, shooting the current rainbow picture as a sample image, inputting the sample image into the trained AlexNet model, extracting the features of the rainbow from the captured sample image, obtaining the state matrix [H, S, V, I] of the sample image, inputting the extracted features into the random forest regression model to obtain the best control parameters, obtaining the control data set [B, L, H, ap, hp], generating control decision, and obtaining the best incident angle, the best height of the spray head and the size of the spray air pressure and water pressure in the current environment.

7. A visual feedback based artificial rainbow forming system for implementing the steps of the visual feedback based artificial rainbow forming method according to any one of claims 1 to 6, characterized in that: The AlexNet model acquisition module is used to execute the following process: A dataset is created using a number of rainbow photos: the rainbow photos cover different weather conditions, different times of day, and different angles and distances of the rainbow, and are labeled with four target attributes: hue, saturation, value, and arc length; all the rainbow photos are adjusted to a uniform size required by the convolutional neural network AlexNet, the pixel values of the adjusted rainbow photos are normalized to a range of 0 to 1, and data diversity is increased; An AlexNet model is designed: the dataset is divided into a training set, a validation set, and a test set, the convolutional neural network AlexNet is pre-trained through the training set in a self-supervised manner to obtain pre-training weights; the last fully connected layer of the convolutional neural network AlexNet is modified to output four values corresponding to hue, saturation, value, and arc length, respectively; the convolutional neural network AlexNet is initialized using the pre-training weights and trained to obtain an AlexNet model as a recognition model; The AlexNet model is trained while monitoring its performance on the validation set during the training process to adjust the model parameters and avoid overfitting; For a newly captured rainbow picture, the trained AlexNet model is used to predict its visual attributes: a rainbow picture to be identified is collected as a sample image, and the sample image is identified according to the AlexNet model to obtain an identification result; A spraying system adjustment module is used to perform the following process: A data preprocessing step: the hue, saturation, value, and arc length of the rainbow photos form an attribute dataset [H, S, V, l], where H, S, V, and l represent hue, saturation, value, and rainbow arc length, respectively; the attribute dataset is labeled with observation point longitude and latitude, solar elevation angle, and spraying system air pressure and hydraulic pressure to obtain a control dataset [B, L, H, ap, hp], where B, L, H, ap, and hp represent observation point longitude and latitude, solar elevation angle, and spraying system air pressure and hydraulic pressure, respectively; the hue, saturation, value, and arc length features of the attribute dataset are standardized; the standardized attribute dataset is divided into an attribute training set, an attribute validation set, and an attribute test set; A random forest regressor is used to train a random forest regression model, and the performance of the random forest regression model is evaluated, and the random forest regression model is adjusted according to the evaluation results; The adjusted random forest regression model is used to predict the attribute test set: the control parameters (B, L, H, ap, hp) are predicted according to the actual rainbow attribute data (H, S, V, l); The spraying system is adjusted according to the obtained predicted control parameters to optimize the effect of rainbow formation.

Citation Information

Patent Citations

  • Artificial rainbow

    CN102555653A

  • Rainbow box

    CN104346984A

  • Intelligent artificial rainbow machine

    CN104772252A

  • A equipment for producing artificial rainbow

    CN206951474U

  • Position calculation method of artificial rainbow

    CN110858258A