Vehicle atmosphere light control method, device, electronic device and storage medium
By identifying user emotions and the beat of music in the car, and adjusting the color and flashing frequency of the ambient light in the car, the problem of insufficient intelligent control of the ambient light in the existing technology is solved, and the user experience and driving safety are improved.
Patent Information
- Application Number
- CN202410790082.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing in-car ambient lights cannot integrate the user's emotions and in-car music to achieve intelligent control, resulting in poor user experience.
By identifying emotions based on user facial imaging, determining the color parameters of the ambient light, identifying the beat based on the frequency of music in the car, and adjusting the flashing frequency of the ambient light, synchronous control of emotions and music is achieved.
It improves the intelligence and user experience of the ambient lighting in the car, enhances driving safety, and avoids driving risks under extreme emotions.
Smart Images

Figure CN118358356B
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle light control, and more specifically, to a vehicle ambient light control method, device, electronic device, and storage medium. Background Art
[0002] With the development of the automotive industry, people's requirements for the driving experience are increasing. Currently, interior ambient lighting is an interactive automotive interior component, but existing interior ambient lighting is not intelligent enough. It cannot integrate the user's mood and in-car music to realize ambient lighting control, resulting in a poor user experience. Summary of the Invention
[0003] The purpose of the embodiments of the present application is to provide a vehicle ambient light control method, device, electronic device and storage medium, so as to adjust the flashing frequency of the vehicle ambient light based on the beat of the music in the car while controlling the vehicle ambient light based on the user's mood.
[0004] In a first aspect, the present invention provides a method for controlling a vehicle ambient light, the method comprising:
[0005] Recognize the user's emotions based on facial imaging of the user;
[0006] determining a color parameter of a vehicle ambient light based on the user's emotion;
[0007] Identifying the frequency of the in-car music, and determining the tempo of the in-car music based on the frequency of the in-car music;
[0008] The flashing frequency of the vehicle ambient light is determined based on the beat of the in-car music.
[0009] The present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then determine the flashing frequency of the vehicle atmosphere lights based on the beat of the in-car music, and finally realize the adjustment of the vehicle atmosphere lights based on the user's emotions.
[0010] In an optional embodiment, identifying the frequency of in-car music includes:
[0011] Obtaining a music waveform of the in-car music;
[0012] Performing bass emphasis preprocessing on the music waveform of the in-car music to obtain a music waveform after emphasis preprocessing;
[0013] The music waveform after the weighted preprocessing is divided into multiple waveform frames, and each waveform frame is sampled based on a window function to obtain a frequency recognition result of the in-car music, wherein each waveform frame includes a plurality of sampling points, and each sampling point serves as a window.
[0014] This optional implementation method obtains the music waveform of the in-car music, and then performs bass emphasis pre-processing on the music waveform of the in-car music to obtain the music waveform after emphasis pre-processing, and then divides the music waveform after emphasis pre-processing into multiple waveform frames, and samples each of the waveform frames based on a window function to obtain a frequency recognition result of the in-car music, wherein each of the waveform frames includes a number of sampling points, and each of the sampling points serves as a window.
[0015] In an optional embodiment, determining the tempo of the in-car music based on the frequency of the in-car music includes:
[0016] Calculating a waveform energy value of the window based on the frequency recognition result;
[0017] Extracting the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and a window preceding the current window;
[0018] Calculating an average differential energy value of the current window based on the beat periodicity feature of the current window;
[0019] Determining whether the average differential energy value of the current window is greater than a preset threshold, if the average differential energy is greater than the preset threshold and the average differential energy value of the previous window is less than the preset threshold, determining that a beat exists in the current window;
[0020] The beat of the in-car music is determined based on the beats of several of the windows, wherein the beat of the in-car music is represented based on a binary sequence, wherein an element of the binary sequence table corresponds to one of the windows, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
[0021] This optional implementation can calculate the waveform energy value of the window based on the frequency recognition result, and then extract the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and the window before the current window, and then calculate the average differential energy value of the current window based on the beat periodicity feature of the current window. It can then be determined whether the average differential energy value of the current window is greater than a preset threshold. If the average differential energy is greater than the preset threshold and the average differential energy value of the previous window is less than the preset threshold, it is determined that there is a beat in the current window. It can then determine the beat of the in-car music based on the beats of several windows, wherein the beat of the in-car music is represented based on a binary sequence, wherein one element of the binary sequence table corresponds to one window, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
[0022] In an optional embodiment, determining the flashing frequency of the vehicle ambient light based on the beat of the in-car music includes:
[0023] acquiring a sub-binary sequence within a preset time interval based on the beat of the in-car music;
[0024] The flashing frequency of the vehicle ambient light is calculated based on the total number of elements with a value of 1 in the sub-binary sequence and the preset time interval.
[0025] This optional implementation can obtain a sub-binary sequence within a preset time interval based on the beat of the in-car music, and then calculate the flashing frequency of the vehicle atmosphere light based on the total number of elements with a value of 1 in the sub-binary sequence and the preset time interval.
[0026] In an optional embodiment, the identifying the user's emotion based on the user's facial image includes:
[0027] An input feature map is extracted based on facial imaging of the user, and the input feature map is used as input to an image recognition model to identify the user's emotions based on the image recognition model, wherein the image recognition model is constructed based on a YOLOv5s algorithm, the image recognition model includes a channel attention module and a spatial attention module, and the image recognition model is pre-trained based on a face dataset.
[0028] This optional embodiment can extract an input feature map based on facial imaging of the user and use the input feature map as input to an image recognition model to identify the user's emotions based on the image recognition model. The image recognition model is constructed based on the YOLOv5s algorithm, includes a channel attention module and a spatial attention module, and is pre-trained based on a facial dataset. Compared to the prior art, the image recognition model constructed based on the YOLOv5s algorithm can improve the model's emotion recognition speed and accuracy.
[0029] In an optional embodiment, the color parameters of the vehicle atmosphere light include hue, saturation and brightness, and the user's emotions include fear, sadness, neutrality, happiness and anger, wherein each emotion corresponds to a combination of hue, saturation and brightness.
[0030] This optional implementation can adjust the combination of hue, saturation and brightness based on any one of the emotions of fear, sadness, neutrality, happiness and anger.
[0031] In an optional embodiment, the method further comprises:
[0032] When the image recognition model does not recognize the user's emotion, the current hue is randomly adjusted within a preset numerical range based on the hue at the previous moment, the current saturation is randomly adjusted within a preset numerical range based on the saturation at the previous moment, and the current brightness is randomly adjusted within a preset numerical range based on the brightness at the previous moment.
[0033] This optional implementation can randomly adjust the current hue within a preset numerical range based on the hue at the previous moment, and randomly adjust the current saturation within a preset numerical range based on the saturation at the previous moment, and randomly adjust the current brightness within a preset numerical range based on the brightness at the previous moment when the image recognition model fails to recognize the user's emotion.
[0034] In a second aspect, the present invention provides a vehicle ambient light control device, the device comprising:
[0035] a first recognition module for recognizing a user's emotion based on a facial image of the user;
[0036] A first determining module, configured to determine a color parameter of a vehicle ambient light based on the user's emotion;
[0037] a second recognition module, configured to recognize the frequency of the in-car music and determine the tempo of the in-car music based on the frequency of the in-car music;
[0038] The second determining module is used to determine the flashing frequency of the vehicle atmosphere light based on the beat of the in-car music.
[0039] The device of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then determine the flashing frequency of the vehicle atmosphere lights based on the beat of the in-car music, and finally realize the adjustment of the vehicle atmosphere lights based on the user's emotions.
[0040] In a third aspect, the present invention provides an electronic device, comprising:
[0041] processor; and
[0042] A memory is configured to store machine-readable instructions, which, when executed by the processor, execute the vehicle ambient light control method as described in any one of the aforementioned embodiments.
[0043] The electronic device of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere light based on the user's emotions, and then can recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then can determine the flashing frequency of the vehicle atmosphere light based on the beat of the in-car music, and finally realize the adjustment of the vehicle atmosphere light based on the user's emotions.
[0044] In a fourth aspect, the present invention provides a storage medium storing a computer program, wherein the computer program is executed by a processor to implement the vehicle ambient light control method as described in any one of the aforementioned embodiments.
[0045] The storage medium of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere light based on the user's emotions, and then recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then determine the flashing frequency of the vehicle atmosphere light based on the beat of the in-car music, and finally realize the adjustment of the vehicle atmosphere light based on the user's emotions. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0047] Figure 1This is a flow chart of a vehicle ambient light control method disclosed in an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of an image recognition model disclosed in an embodiment of the present application;
[0049] Figure 3 This is a schematic structural diagram of a vehicle ambient light control device disclosed in an embodiment of the present application;
[0050] Figure 4 This is a structural diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0052] Example 1
[0053] See also Figure 1 , Figure 1 This is a flow chart of a vehicle ambient light control method disclosed in an embodiment of the present application, such as Figure 1 As shown, the method of the embodiment of the present application includes the following steps:
[0054] 101. Recognize the user’s emotions based on the user’s facial image;
[0055] 102. Determine the color parameters of the vehicle ambient light based on the user's mood;
[0056] 103. Identify the frequency of the in-car music and determine the tempo of the in-car music based on the frequency of the in-car music;
[0057] 104. Determine the flashing frequency of the vehicle ambient light based on the beat of the music in the car.
[0058] The embodiments of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then determine the flashing frequency of the vehicle atmosphere lights based on the beat of the in-car music, and at the same time adjust the vehicle atmosphere lights based on the user's emotions.
[0059] In the embodiment of the present application, adjusting the vehicle atmosphere lights based on the user's emotions and determining the flashing frequency of the vehicle atmosphere lights based on the beat of the music in the car can be applied to the scenario of improving driving safety. For example, when it is recognized that the user's current situation is angry, the color of the vehicle atmosphere lights is controlled to blue, thereby avoiding the user from being in extreme emotions, thereby avoiding driving under the user's extreme emotions, and ultimately reducing the probability of traffic accidents.
[0060] It should be noted that the technical concept of the embodiments of the present application can be applied to the control of other types of lamps, for example, bedroom light control for the elderly, lighting control for classrooms, etc.
[0061] In an embodiment of the present application, for step 101, the user's facial imaging can be obtained by a camera device installed inside the vehicle, wherein the camera device installed inside the vehicle can be a camera or a laser device that can capture facial features, wherein the laser device can generate point cloud data of the human face.
[0062] Furthermore, regarding the installation method of the camera equipment inside the vehicle, the camera equipment can be integrated into the vehicle control panel, wherein when the user enters the main driving seat, the camera equipment can image the user's face.
[0063] In an embodiment of the present application, the number of camera devices inside the vehicle can be multiple. For example, four camera devices are installed inside the vehicle, wherein the four devices respectively image the user's face from four angles. The four angles can be set at a difference interval of 45 degrees, thereby capturing the user's facial features within an imaging range of 180 degrees directly in front of the user.
[0064] In an embodiment of the present application, for step 102, the color parameters of the vehicle atmosphere light are used to control the color display of the vehicle atmosphere light. For example, the color parameter A of the vehicle atmosphere light is used to make the vehicle atmosphere light appear as a bright red color. Furthermore, in some scenarios, the color change caused by the color parameters of the vehicle atmosphere light may cause dizziness in the user. For example, when the color parameters of the vehicle atmosphere light cause the brightness of the vehicle atmosphere light to exceed the user's tolerance limit, it may cause the user to experience short-term dizziness. In this way, the color change caused by the color parameters of the vehicle atmosphere light may cause dizziness in the user, and may increase safety hazards. For example, the user may be prone to car accidents during dizziness. For this scenario, after determining the color parameters of the vehicle atmosphere light based on the user's emotions, the color parameters of the vehicle atmosphere light need to be adjusted so that the adjusted color parameters will not cause the driver to experience dizziness or lose sight of the front field.
[0065] Furthermore, for adjusting the color of the ambient light, the embodiment of the present application adopts the following specific methods:
[0066] The color parameters of the vehicle atmosphere light determined based on the user's emotions are compared with preset color values, wherein, when the value of the color parameters of the vehicle atmosphere light determined based on the user's emotions is greater than or equal to the preset color value, it is determined that the color parameters of the vehicle atmosphere light determined based on the user's emotions will produce color changes that will make the user dizzy, wherein the preset color value can be set by the user, and the settable value can be stored in an on-board memory. After the color parameters of the vehicle atmosphere light are determined based on the user's emotions, they are obtained by reading from the on-board memory.
[0067] Furthermore, the preset color value can also be determined based on the user's reaction to color changes. Specifically, after the user enters the vehicle's main driving position, the colors are first displayed in the order in which they change. During the time period of the individual color display, the user's facial image displayed for each color is captured, and the user's reaction to each color is then identified based on the facial image. When the user's reaction to a color, i.e., the color-specific facial image, is captured, the image recognition model is used to determine whether the user has made an avoidance action in response to the color, such as covering their face with their hands or twisting their head and neck. If such an avoidance action is made, it is determined that the color will cause the user to be dizzy. Similarly, the upper limit of the user's tolerance for the color is found and used as the preset color value.
[0068] Furthermore, for the user's reaction to color, an image recognition model may be trained based on facial training data, so that the image recognition model can output the user's reaction to color.
[0069] It should be noted that the training process of the image recognition model for identifying the user's reaction to color can refer to the existing technology. The embodiment of the present application emphasizes that after using the image recognition model to identify the user's reaction to color, the color parameters of the vehicle atmosphere light determined based on the user's emotions are adjusted based on the user's reaction to color. Therefore, while determining the color parameters of the vehicle atmosphere light based on the user's emotions, the color change of the vehicle atmosphere light will not affect driving safety. It also emphasizes that the method of determining the preset color value based on the user's reaction to color can have higher judgment accuracy than the user's self-setting. For example, the value set by the user may be too large, which may cause the color change to make the user dizzy.
[0070] Furthermore, in the above manner, the time range for displaying a single color may be 2 seconds, or 4 seconds, or other durations sufficient to elicit a user's response.
[0071] In some implementations, the determination of the color parameters of the vehicle ambient light based on the user's mood and the flashing frequency of the vehicle ambient light based on the tempo of the in-car music may also require further control based on environmental variables. Furthermore, the specific method for collaboratively controlling environmental variables, the user's mood, and the tempo of the in-car music is as follows:
[0072] Get environment variables and determine their credibility;
[0073] Determine the adjustment coefficient corresponding to the environmental variable according to the credibility of the environmental variable;
[0074] The color parameters of the vehicle ambient light and the flashing frequency of the vehicle ambient light are adjusted based on the adjustment coefficient corresponding to the environmental variable.
[0075] As an example, assuming the credibility of an environmental variable is 0.6 and the color parameter (i.e., color value) of the vehicle ambient light is 234, then based on the credibility of the environmental variable being 0.6, the environmental variable is determined to be credible because it is greater than 0.5. Thus, the adjustment coefficient corresponding to the environmental variable is determined based on the credibility of the environmental variable. Furthermore, a specific method for determining the adjustment coefficient corresponding to the environmental variable based on the credibility of the environmental variable is as follows:
[0076] When the credibility of the environment variable indicates that the environment variable is credible, the environment variable is used to query a preset table to obtain an adjustment coefficient corresponding to the environment variable, wherein the preset table stores the correspondence between the environment variables and the adjustment coefficients. Furthermore, the association between the environment variable and the adjustment coefficient can be one environment variable corresponding to one adjustment coefficient, or it can be that a combination of multiple environment variables corresponds to one adjustment coefficient, for example, the combination of environment variables A, environment variables B, and environment variables C corresponds to adjustment coefficient S.
[0077] Furthermore, environmental variables may include weather, humidity, temperature, traffic conditions, and statutory holidays. As an example of determining an adjustment coefficient corresponding to an environmental variable, when the weather is sunny, the adjustment coefficient is 1.2. Thus, an adjustment coefficient greater than 1 can adjust the vehicle's ambient light to a brighter color. As another example, when the weather is cloudy and traffic conditions are congested, the adjustment coefficient is 0.8, thereby adjusting the color of the vehicle's ambient light to a more peaceful color.
[0078] Furthermore, the embodiment of the present application combines the function of adjusting the color of the vehicle ambient light based on the user's mood with the function of determining the flashing frequency of the vehicle ambient light based on the beat of the in-car music. During the combination process, a technical obstacle is encountered, namely, the flashing frequency of the vehicle ambient light reflects the user's state and the user state reflected by the color parameters of the vehicle ambient light conflicts. To address this conflict, some existing technologies resolve it based on user confirmation. For example, a confirmation interface is generated to allow the user to determine whether to set the vehicle ambient light based on a certain parameter. In this way, the user decides, thereby avoiding conflicts. However, this method is cumbersome and time-consuming, and the user needs to operate manually. Based on this, the embodiment of the present application adopts the following specific methods to resolve the above conflict:
[0079] Adjust the color parameters of the vehicle's ambient light based on the user's mood and determine the flashing frequency range;
[0080] Determine whether the flashing frequency of the vehicle atmosphere light is within the flashing frequency range. If the flashing frequency of the vehicle atmosphere light is within the flashing frequency range, determine the flashing frequency of the vehicle atmosphere light based on the beat of the music in the car. If the flashing frequency of the vehicle atmosphere light is not within the flashing frequency range, adjust the flashing frequency of the vehicle atmosphere light based on the flashing frequency range so that the flashing frequency of the vehicle atmosphere light is within the flashing frequency range.
[0081] Furthermore, the flicker frequency range can be obtained based on a query of a frequency table, wherein the frequency table stores a correspondence between color parameters and flicker frequency ranges. When querying, the color parameters of the vehicle ambient light can be used as query conditions.
[0082] In some scenarios, the ability to adjust the vehicle's ambient light color based on the user's mood can be combined with the ability to determine the ambient light's flashing frequency based on the tempo of the in-car music. This can further coordinate the ambient light color and flashing frequency. Specifically, the ambient light color type is determined based on the ambient light color parameters, and the flashing frequency is then matched to the ambient light color type. For example, if the ambient light color types include green and red, the flashing frequency corresponding to red is S1, while the flashing frequency corresponding to green is S2.
[0083] It can be seen from this that the embodiments of the present application can adjust the color parameters of the vehicle atmosphere lights according to the user's emotions and determine the flashing frequency of the vehicle atmosphere lights based on the beat of the music in the car. More importantly, when adjusting the color and flashing frequency of the vehicle atmosphere lights, the technical barriers of combining the two functions are overcome, and better results are achieved. That is, the color and flashing frequency of the vehicle atmosphere lights can be adjusted while improving driving safety, and the color and flashing frequency of the vehicle atmosphere lights can be adjusted in a coordinated manner to avoid conflicts between the user status reflected by the color of the vehicle atmosphere lights and the user status reflected by the flashing frequency.
[0084] In an optional embodiment, the step of identifying the frequency of the music in the car includes the following sub-steps:
[0085] Get the music waveform of the music in the car;
[0086] Performing bass emphasis pre-processing on the music waveform of the in-car music to obtain a music waveform after emphasis pre-processing;
[0087] The music waveform after weighted preprocessing is divided into multiple waveform frames, and each waveform frame is sampled based on the window function to obtain the frequency recognition result of the in-car music, wherein each waveform frame includes several sampling points, and each sampling point serves as a window.
[0088] This optional implementation method obtains the music waveform of the music in the car, and then performs bass emphasis pre-processing on the music waveform of the music in the car to obtain the music waveform after emphasis pre-processing, and then divides the music waveform after emphasis pre-processing into multiple waveform frames, and samples each waveform frame based on the window function to obtain the frequency recognition result of the music in the car, wherein each waveform frame includes several sampling points, and each sampling point serves as a window.
[0089] In the above optional implementation manner, the music waveform of the in-car music can be obtained through a car recording device or from a car player, wherein the audio signal output by the car player can be used as the music waveform.
[0090] In the above optional implementation manner, the mathematical expression corresponding to the bass emphasis preprocessing of the music waveform of the in-car music is:
[0091] ;
[0092] Among them, y(n) is the music waveform after weighted preprocessing, x(n) is the original music signal, a is the weighted coefficient, and n represents the sampling point sequence in the time series.
[0093] In the above optional implementation, the waveform y(n) after the weighting is divided into multiple waveform frames according to a constant length, and each frame contains N sampling points. Let the kth frame be , where n represents the sampling point index in the kth frame.
[0094] ;
[0095] in, Indicates the kth frame The processing results of the sampling, Represents a window function, which is used to weight the frequency signal to prevent spectrum leakage. Furthermore, the window function is a Hanning window, It represents the length of the window, that is, the number of sampling points, and its expression is:
[0096]
[0097] In an optional embodiment, the step of determining the tempo of the in-car music based on the frequency of the in-car music comprises the following steps:
[0098] Calculate the waveform energy value of the window based on the frequency recognition result;
[0099] Extracting a beat periodic feature of a current window based on a difference between waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and a window preceding the current window;
[0100] Calculate the average differential energy value of the current window based on the beat periodicity characteristics of the current window;
[0101] Determine whether the average differential energy value of the current window is greater than a preset threshold; if the average differential energy is greater than the preset threshold and the average differential energy value of the previous window is less than the preset threshold, determine that there is a beat in the current window;
[0102] The beat of the in-car music is determined based on the beats of several windows, wherein the beat of the in-car music is represented based on a binary sequence, wherein an element of the binary sequence table corresponds to a window, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
[0103] This optional implementation can calculate the waveform energy value of the window based on the frequency recognition result, and then extract the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and the window before the current window, and then calculate the average differential energy value of the current window based on the beat periodicity feature of the current window. It can then be determined whether the average differential energy value of the current window is greater than a preset threshold. If the average differential energy is greater than the preset threshold and the average differential energy value of the previous window is less than the preset threshold, it is determined that there is a beat in the current window. It can then determine the beat of the in-car music based on the beat of several windows, wherein the beat of the in-car music is represented based on a binary sequence, wherein one element of the binary sequence table corresponds to one window, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
[0104] For the above optional implementation method, the calculation formula for the waveform energy value of the calculation window based on the frequency recognition result is:
[0105] .
[0106] in, is the total number of frames, express The amplitude.
[0107] For the above optional implementation, the calculation formula for extracting the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows is:
[0108] ;
[0109] For the above optional implementation, the calculation formula for calculating the average differential energy value of the current window based on the beat periodicity characteristics of the current window is:
[0110] ;
[0111] in, represents the average difference energy value.
[0112] For the above optional implementation, set a threshold To judge whether the differential energy is large enough, if Greater than threshold ,at the same time Less than threshold , then it is considered that there is a beat. Define a binary sequence ,in Indicates the There is a beat in each window. Indicates the There is no beat for this window. The calculation method is:
[0113]
[0114] In an optional embodiment, the step of determining the flashing frequency of the vehicle ambient light based on the beat of the in-car music includes the following steps:
[0115] obtaining a sub-binary sequence within a preset time interval based on the beat of the music in the car;
[0116] The flashing frequency of the vehicle ambient light is calculated based on the total number of elements with a value of 1 in the sub-binary sequence and a preset time interval.
[0117] This optional implementation can obtain a sub-binary sequence within a preset time interval based on the beat of the music in the car, and then calculate the flashing frequency of the vehicle atmosphere light based on the total number of elements with a value of 1 in the sub-binary sequence and the preset time interval.
[0118] For the above optional implementation, the preset time interval can be 5S. For example, by calculating the frequency of the music in the last 5 seconds, the flashing frequency of the car atmosphere light is adjusted. The duration of each window is set to seconds, then 5 seconds can get a length of The binary sequence , The calculation formula is:
[0119]
[0120] Furthermore, by obtaining the binary sequence in The number of , and use the formula to calculate the frequency of the music in the past 5 seconds:
[0121]
[0122] Obtaining music beat frequency through algorithm , and timely adjust the flashing frequency of the car atmosphere to improve the interactivity of the atmosphere lights, which helps to create a better in-car atmosphere.
[0123] In an optional embodiment, the step of identifying the user's emotion based on the user's facial image comprises the following steps:
[0124] An input feature map is extracted based on the user's facial imaging, and the input feature map is used as the input of an image recognition model to identify the user's emotions based on the image recognition model. The image recognition model is built based on the YOLOv5s algorithm, and the image recognition model includes a channel attention module and a spatial attention module. The image recognition model is pre-trained based on a face dataset.
[0125] This optional embodiment extracts an input feature map based on a user's facial image and uses the input feature map as input to an image recognition model to identify the user's emotions. The image recognition model is built based on the YOLOv5s algorithm, includes a channel attention module and a spatial attention module, and is pre-trained based on a facial dataset. Compared to existing technologies, the YOLOv5s algorithm improves the model's emotion recognition speed and accuracy.
[0126] For the above optional implementation method, an improved YOLOv5s algorithm is selected to recognize the user's facial emotions in the image and classify the emotions into five types: anger, sadness, neutral, happiness and surprise.
[0127] Furthermore, if Figure 2As shown in the figure, a convolutional block attention module CBAM (Convolutional Block Attention Module) is added to the algorithm, including a channel attention module CAM (Channel Attention Module) and a spatial attention module SAM (Spatial Attention Module). Figure 2 It is a schematic diagram of an image recognition model disclosed in an embodiment of the present application.
[0128] Furthermore, if Figure 2 As shown, there are:
[0129]
[0130] in, , is the input feature map ( Indicates the number of input feature map channels, Represent the height and width of the input feature map respectively); is the feature map obtained by weighting the channel attention module; is the feature map obtained by weighting the spatial attention module; Output weights for channel attention; is the spatial attention output weight; symbol Represents the multiplication of corresponding elements.
[0131] In an optional embodiment, the color parameters of the vehicle ambient light include hue, saturation, and brightness, wherein the adjustment range of hue, saturation, and brightness is 0 to 255. Furthermore, the user's emotions include fear, sadness, neutrality, happiness, and anger, wherein each emotion corresponds to a combination of hue, saturation, and brightness.
[0132] This optional implementation can adjust the combination of hue, saturation and brightness based on any one of the emotions of fear, sadness, neutrality, happiness and anger.
[0133] Regarding the above optional implementation method, please refer to Table 1, which shows the correspondence between emotional states and colors.
[0134]
[0135] Table 1
[0136] In an optional embodiment, the method of the embodiment of the present application further includes the following steps:
[0137] When the image recognition model does not recognize the user's emotion, the current hue is randomly adjusted within a preset numerical range based on the hue at the previous moment, the current saturation is randomly adjusted within a preset numerical range based on the saturation at the previous moment, and the current brightness is randomly adjusted within a preset numerical range based on the brightness at the previous moment.
[0138] This optional implementation can randomly adjust the current hue within a preset numerical range based on the hue at the previous moment, and randomly adjust the current saturation within a preset numerical range based on the saturation at the previous moment, and randomly adjust the current brightness within a preset numerical range based on the brightness at the previous moment when the image recognition model does not recognize the user's emotions.
[0139] For the above optional implementation method, the hue, saturation and brightness of the color can be randomly adjusted within a certain range to enrich the color changes of the atmosphere light.
[0140]
[0141] in, is the color parameter of the next moment state, is the color parameter of the previous moment, is a function to get random numbers, [ ] for Round up, then pass Perform the remainder operation on 5, so that exist Before obtaining a new recognition result from the emotion recognition module, the car atmosphere light can be centered on the current hue value. The hue value of the RGB lamp is changed to a certain range, thereby increasing the diversity of the ambient light color; similarly, the saturation and brightness You can center it around the current value. By adding a random adjustment function to the color adjustment module, the diversity of the car atmosphere light color can be increased, while preventing the color atmosphere from changing due to a large change range.
[0142] Example 2
[0143] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of a vehicle atmosphere light control device disclosed in an embodiment of the present application. Figure 3 As shown, the device of the embodiment of the present application includes the following functional modules:
[0144] A first recognition module 201 is configured to recognize a user's emotions based on a facial image of the user;
[0145] A first determining module 202 is configured to determine a color parameter of the vehicle ambient light based on the user's emotions;
[0146] The second recognition module 203 is used to recognize the frequency of the in-car music and determine the tempo of the in-car music based on the frequency of the in-car music;
[0147] The second determining module 204 is configured to determine a flashing frequency of the vehicle ambient light based on the tempo of the in-car music.
[0148] The device of the embodiment of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then recognize the frequency of the in-car music, and determine the beat of the in-car music based on the frequency of the in-car music, and then determine the flashing frequency of the vehicle atmosphere lights based on the beat of the in-car music, and finally realize the adjustment of the vehicle atmosphere lights based on the user's emotions.
[0149] It should be noted that for other detailed descriptions of the device in the embodiment of the present application, please refer to the relevant description of the first embodiment of the present application, and the embodiment of the present application will not go into details thereon.
[0150] Example 3
[0151] See also Figure 4 , Figure 4 is a structural diagram of an electronic device disclosed in an embodiment of the present application, such as Figure 4 As shown, the electronic device of the embodiment of the present application includes:
[0152] Processor 301; and
[0153] The memory 302 is configured to store machine-readable instructions. When the instructions are executed by the processor 301, the vehicle ambient light control method according to any one of the aforementioned embodiments is executed.
[0154] The electronic device of the embodiment of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then can recognize the frequency of the music in the car, and determine the beat of the music in the car based on the frequency of the music in the car, and then can determine the flashing frequency of the vehicle atmosphere lights based on the beat of the music in the car, and finally realize the adjustment of the vehicle atmosphere lights based on the user's emotions.
[0155] Example 4
[0156] An embodiment of the present application provides a storage medium storing a computer program, and the computer program is executed by a processor as a vehicle ambient light control method as described in any of the aforementioned embodiments.
[0157] The storage medium of the embodiment of the present application can recognize the user's emotions based on the user's facial imaging, and then determine the color parameters of the vehicle atmosphere lights based on the user's emotions, and then recognize the frequency of the music in the car, and determine the beat of the music in the car based on the frequency of the music in the car, and then determine the flashing frequency of the vehicle atmosphere lights based on the beat of the music in the car, and finally realize the adjustment of the vehicle atmosphere lights based on the user's emotions.
[0158] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0159] In addition, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] Furthermore, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0161] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0162] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.
[0163] The above are merely examples of the present application and are not intended to limit the scope of protection of the present application. Those skilled in the art will appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A vehicle atmosphere light control method, characterized in that: The method comprises: Recognize the user's emotions based on the user's facial imaging; determining a color parameter of a vehicle ambient light based on the user's emotion; Identifying the frequency of the in-car music, and determining the beat of the in-car music based on the frequency of the in-car music; Determining the flashing frequency of the vehicle ambient light based on the beat of the in-car music; And, the identifying frequency of the in-car music includes: Acquire the music waveform of the in-car music; Performing bass emphasis preprocessing on the music waveform of the in-car music to obtain a music waveform after emphasis preprocessing; Dividing the music waveform after the weighted preprocessing into a plurality of waveform frames, and sampling each of the waveform frames based on a window function to obtain a frequency recognition result of the in-car music, wherein each of the waveform frames includes a plurality of sampling points, and each of the sampling points serves as a window; And, determining the beat of the in-car music based on the frequency of the in-car music comprises: Calculating a waveform energy value of the window based on the frequency recognition result; Extracting the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and a window before the current window; Calculating an average differential energy value of the current window based on the beat periodicity characteristics of the current window; Determine whether the average differential energy value of the current window is greater than a preset threshold value, if the average differential energy value is greater than the preset threshold value, and the average differential energy value of the previous window is less than the preset threshold value, then determine that there is a beat in the current window; The beat of the in-car music is determined based on the beats of several windows, wherein the beat of the in-car music is represented based on a binary sequence, an element of the binary sequence corresponds to one window, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
2. The method according to claim 1, characterized in that The step of determining the flashing frequency of the vehicle atmosphere light based on the beat of the in-vehicle music comprises: Acquire a sub-binary sequence within a preset time interval based on the beat of the in-car music; The flashing frequency of the vehicle atmosphere light is calculated based on the total number of elements with a value of 1 in the sub-binary sequence and the preset time interval.
3. The method according to claim 1, characterized in that The method of recognizing the user's emotion based on the user's facial imaging comprises: An input feature map is extracted based on the facial imaging of the user, and the input feature map is used as an input of an image recognition model to recognize the user's emotions based on the image recognition model, wherein the image recognition model is constructed based on the YOLOv5s algorithm, the image recognition model includes a channel attention module and a spatial attention module, and the image recognition model is pre-trained based on a face dataset.
4. The method according to claim 1, characterized in that The color parameters of the vehicle atmosphere light include hue, saturation and brightness, and the user's emotions include fear, sadness, neutrality, happiness and anger, wherein each emotion corresponds to a combination of hue, saturation and brightness.
5. The method according to claim 3, characterized in that The method further comprises: When the image recognition model fails to recognize the emotion of the user, the current hue is randomly adjusted within a preset numerical range based on the hue at the previous moment, the current saturation is randomly adjusted within a preset numerical range based on the saturation at the previous moment, and the current brightness is randomly adjusted within a preset numerical range based on the brightness at the previous moment.
6. A vehicle atmosphere light control device, characterized in that: The device comprises: A first recognition module, for recognizing the user's emotions based on the user's facial imaging; A first determination module, configured to determine a color parameter of a vehicle ambient light based on the user's emotion; A second recognition module is used to recognize the frequency of the in-car music and determine the beat of the in-car music based on the frequency of the in-car music; A second determination module, configured to determine the flashing frequency of the vehicle atmosphere light based on the beat of the in-car music; And, the specific method of identifying the frequency of the music in the car is: Acquire the music waveform of the in-car music; Performing bass emphasis preprocessing on the music waveform of the in-car music to obtain a music waveform after emphasis preprocessing; Dividing the music waveform after the weighted preprocessing into a plurality of waveform frames, and sampling each of the waveform frames based on a window function to obtain a frequency recognition result of the in-car music, wherein each of the waveform frames includes a plurality of sampling points, and each of the sampling points serves as a window; The determining the tempo of the in-car music based on the frequency of the in-car music comprises: Calculating a waveform energy value of the window based on the frequency recognition result; Extracting the beat periodicity feature of the current window based on the difference between the waveform energy values of two adjacent windows, wherein the two adjacent windows include the current window and a window before the current window; Calculating an average differential energy value of the current window based on the beat periodicity characteristics of the current window; Determine whether the average differential energy value of the current window is greater than a preset threshold value, if the average differential energy value is greater than the preset threshold value, and the average differential energy value of the previous window is less than the preset threshold value, then determine that there is a beat in the current window; The beat of the in-car music is determined based on the beats of several windows, wherein the beat of the in-car music is represented based on a binary sequence, an element of the binary sequence corresponds to one window, and when there is a beat in the window, the value of the element is 1, otherwise it is 0.
7. An electronic device, characterized in that: include: processor; as well as A memory configured to store machine-readable instructions, which, when executed by the processor, execute the vehicle ambient light control method as described in any one of claims 1-5.
8. A storage medium, characterized in that: The storage medium stores a computer program, and the computer program is executed by a processor to implement the vehicle ambient light control method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Music style recognition method, apparatus, computer device and storage medium
CN109308912A
Control method and device of vehicle-mounted atmosphere lamp, storage medium and vehicle-mounted atmosphere lamp
CN109743819A
Light control method and device of vehicle-mounted entertainment system and vehicle-mounted entertainment system
CN111332197A
Music rhythm control device and method for vehicle-mounted atmosphere lamp
CN116528439A
In-vehicle atmosphere lamp adjusting method and system based on DMS and vehicle-mounted KTV
CN116714512A
