[go: up one dir, main page]

CN117796760A - A sleep quality prediction method, electronic device and system - Google Patents

A sleep quality prediction method, electronic device and system Download PDF

Info

Publication number
CN117796760A
CN117796760A CN202211178383.2A CN202211178383A CN117796760A CN 117796760 A CN117796760 A CN 117796760A CN 202211178383 A CN202211178383 A CN 202211178383A CN 117796760 A CN117796760 A CN 117796760A
Authority
CN
China
Prior art keywords
sleep
electronic device
user
data
feature
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211178383.2A
Other languages
Chinese (zh)
Inventor
柳杰灵
刘杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202211178383.2A priority Critical patent/CN117796760A/en
Publication of CN117796760A publication Critical patent/CN117796760A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/48Other medical applications
    • A61B5/4806Sleep evaluation
    • A61B5/4815Sleep quality

Landscapes

  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Biophysics (AREA)
  • Pathology (AREA)
  • Engineering & Computer Science (AREA)
  • Biomedical Technology (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Physics & Mathematics (AREA)
  • Molecular Biology (AREA)
  • Surgery (AREA)
  • Animal Behavior & Ethology (AREA)
  • General Health & Medical Sciences (AREA)
  • Public Health (AREA)
  • Veterinary Medicine (AREA)
  • Telephone Function (AREA)

Abstract

本申请提供了一种睡眠质量预测方法、电子设备及系统,该方法包括:电子设备响应于开始睡眠预测的用户操作,获取用户数据;用户数据包括体能数据、精力数据以及环境数据的至少一种;电子设备基于用户数据,得到用户的助眠建议以及第一睡眠质量,第一睡眠质量为用户采用助眠建议时的睡眠质量;电子设备显示第一睡眠质量和睡眠改善情况中的至少一项以及助眠建议,睡眠改善情况是基于第一睡眠质量得到的。实施本申请实施例,可以基于用户数据预测睡眠质量,满足用户的睡眠需求,提高用户体验。

The present application provides a sleep quality prediction method, electronic device and system. The method includes: the electronic device acquires user data in response to a user operation to start sleep prediction; the user data includes at least one of physical energy data, energy data and environmental data. ; The electronic device obtains the user's sleep aid suggestions and the first sleep quality based on the user data. The first sleep quality is the sleep quality when the user adopts the sleep aid suggestions; the electronic device displays at least one of the first sleep quality and sleep improvement. As well as sleep aid suggestions, sleep improvement is based on the first sleep quality. Implementing the embodiments of this application can predict sleep quality based on user data, meet the user's sleep needs, and improve user experience.

Description

一种睡眠质量预测方法、电子设备及系统A sleep quality prediction method, electronic device and system

技术领域Technical field

本申请实施例涉及终端技术,尤其涉及一种睡眠质量预测方法、电子设备及系统。Embodiments of the present application relate to terminal technology, and in particular, to a sleep quality prediction method, electronic device, and system.

背景技术Background technique

现代生活中的人们对于健康生活的需求超越了以往时代,这种需求催生了利用物联网及人工智能技术测量心率、血氧等生理特征的穿戴设备与居家监测设备的诞生。越来越多的穿戴设备使得实时常态化生理特征监测成为可能,这使得人们可以从个体精细到分钟级别的数据变化中获取对于健康状态的认知。以困扰现代人的失眠问题为例,当前的睡眠监测设备对于人体睡眠状态中的多种阶段的监测功能均已进入平稳商业化落地阶段。People in modern life have a demand for healthy living that exceeds previous eras. This demand has given rise to the birth of wearable devices and home monitoring devices that use the Internet of Things and artificial intelligence technology to measure physiological characteristics such as heart rate and blood oxygen. More and more wearable devices make it possible to monitor normalized physiological characteristics in real time, which allows people to gain knowledge of health status from individual data changes down to the minute level. Taking the insomnia problem that plagues modern people as an example, current sleep monitoring equipment has entered the stage of stable commercialization for its monitoring functions of various stages of human sleep state.

如何满足用户的睡眠需求,提高用户体验,是当前及未来的研究方向。How to meet users' sleep needs and improve user experience is the current and future research direction.

发明内容Summary of the invention

本申请提供了一种睡眠质量预测方法、电子设备及系统,在该睡眠质量预测方法中,可以基于用户数据预测睡眠质量,满足用户的睡眠需求,提高用户体验。This application provides a sleep quality prediction method, electronic device and system. In the sleep quality prediction method, sleep quality can be predicted based on user data to meet the user's sleep needs and improve the user experience.

第一方面,本申请实施例提供了一种睡眠质量预测方法,应用于电子设备,该方法包括:In a first aspect, embodiments of the present application provide a method for predicting sleep quality, which is applied to electronic devices. The method includes:

电子设备响应于开始睡眠预测的用户操作,获取用户数据;用户数据包括用户的体能数据、精力数据以及环境数据的至少一种;The electronic device acquires user data in response to a user operation to start sleep prediction; the user data includes at least one of the user's physical energy data, energy data, and environmental data;

电子设备基于用户数据,得到用户的助眠建议以及第一睡眠质量,第一睡眠质量为用户采用助眠建议时的睡眠质量;Based on the user data, the electronic device obtains the user's sleep aid suggestions and the first sleep quality. The first sleep quality is the sleep quality when the user adopts the sleep aid suggestions;

电子设备显示第一睡眠质量和睡眠改善情况中的至少一项以及助眠建议,睡眠改善情况为用户采用助眠建议时的睡眠质量的改善情况。The electronic device displays at least one of the first sleep quality and the sleep improvement condition and the sleep aid suggestion, where the sleep improvement condition is the improvement of the sleep quality when the user adopts the sleep aid suggestion.

本申请实施例中,电子设备可以响应于用户操作,自动获取用户数据,无需用户输入;进而,基于用户数据,得到用户的助眠建议和用户采用助眠建议时的睡眠质量(即第一睡眠质量);最后,显示第一睡眠质量和睡眠改善情况中的至少一项以及助眠建议,睡眠改善情况为用户采用助眠建议时的睡眠质量的改善情况。该方法无需用户输入,可以自动化显示第一睡眠质量和睡眠改善情况中的至少一项以及助眠建议,该显示内容有利于满足用户对个人健康状态的认知,可以满足用户希望得到助眠建议以及助眠建议达到的睡眠改善情况的需求,提高用户体验。In the embodiments of the present application, the electronic device can automatically obtain user data in response to user operations without user input; further, based on the user data, the user's sleep aid suggestions and the sleep quality when the user adopts the sleep aid suggestions (i.e., the first sleep) are obtained. quality); finally, display at least one of the first sleep quality and sleep improvement status as well as sleep aid suggestions, and the sleep improvement status is the improvement of sleep quality when the user adopts the sleep aid suggestions. This method does not require user input and can automatically display at least one of the first sleep quality and sleep improvement conditions as well as sleep aid suggestions. The display content is conducive to satisfying the user's awareness of personal health status and can satisfy the user's desire to receive sleep aid suggestions. And the sleep aid suggestions meet the needs of improving sleep conditions and improve user experience.

结合第一方面,在一种可能的实现方式中,体能数据为表征用户体能消耗的相关数据,例如体能数据可以包括心率、运动时长、步数、卡路里和活动小时数中的至少一项;精力数据为表征用户的精力情况的相关数据,例如精力数据可以包括血压、血氧、压力、咖啡因摄入量和酒精摄入量中的至少一项;环境数据为表征用户所处环境的相关数据,例如环境数据可以包括环境光照和噪音分贝中的至少一项。In combination with the first aspect, in a possible implementation method, physical data is relevant data that characterizes the user's physical energy consumption, for example, physical data may include at least one of heart rate, exercise duration, number of steps, calories, and activity hours; energy data is relevant data that characterizes the user's energy status, for example, energy data may include at least one of blood pressure, blood oxygen, pressure, caffeine intake, and alcohol intake; environmental data is relevant data that characterizes the user's environment, for example, environmental data may include at least one of ambient light and noise decibels.

结合第一方面,在一种可能的实现方式中,体能数据用于确定体力消耗因子,精力数据用于确定精力消耗因子,环境数据用于确定临睡环境影响因子。例如,用户数据包括多个时段的数据,每一个时段的数据包括该时段内的体能数据、精力数据以及环境数据的至少一种;每一个时段的体力数据用于确定该时段的体力消耗因子,每一个时间段的精力数据用于确定该时段的精力消耗因子,每一个时段的环境数据用于确定该时段的临睡环境影响因子。In combination with the first aspect, in a possible implementation, the physical data is used to determine the physical exertion factor, the energy data is used to determine the energy exertion factor, and the environmental data is used to determine the sleep environment impact factor. For example, the user data includes data for multiple time periods, and the data for each time period includes at least one of the physical data, energy data, and environmental data within the time period; the physical data for each time period is used to determine the physical exertion factor for the time period, the energy data for each time period is used to determine the energy exertion factor for the time period, and the environmental data for each time period is used to determine the sleep environment impact factor for the time period.

结合第一方面,在一种可能的实现方式中,方法还包括:Combined with the first aspect, in a possible implementation manner, the method also includes:

电子设备基于用户数据,得到第二睡眠质量,第二睡眠质量为用户未采纳助眠建议时的睡眠质量;The electronic device obtains the second sleep quality based on the user data, and the second sleep quality is the sleep quality when the user does not adopt the sleep aid suggestions;

电子设备显示第二睡眠质量。Electronic devices display second sleep quality.

本申请实施例中,电子设备可以响应于用户操作,自动获取用户数据,无需用户输入;进而,基于用户数据,得到第二睡眠质量,第二睡眠质量为用户未采纳助眠建议时的睡眠质量;进而,显示第二睡眠质量。该方法无需用户输入,可以自动化显示第二睡眠质量,显示内容有利于满足用户对个人健康状态的认知,可以满足用户预测当前入睡时睡眠质量的需求,提高用户体验。In the embodiment of the present application, the electronic device can automatically obtain user data in response to user operations without user input; further, based on the user data, the second sleep quality is obtained, and the second sleep quality is the sleep quality when the user does not adopt the sleep aid suggestions. ;Furthermore, the second sleep quality is displayed. This method does not require user input and can automatically display the second sleep quality. The display content is conducive to satisfying the user's understanding of personal health status, can meet the user's need to predict the current sleep quality when falling asleep, and improve the user experience.

结合第一方面,在一种可能的实现方式中,睡眠质量包括预设时长内的睡眠时长和深睡比例中的至少一项,睡眠改善情况包括睡眠时长的改善情况和深度比例的改善情况中的至少一项;方法还包括:Combined with the first aspect, in a possible implementation, sleep quality includes at least one of sleep duration and deep sleep ratio within a preset duration, and sleep improvement includes improvement of sleep duration and improvement of deep sleep ratio. At least one of; the method also includes:

电子设备基于第一睡眠质量和第二睡眠质量,得到睡眠时长的改善情况和深度比例的改善情况中的至少一项;第二睡眠质量为用户未采纳助眠建议时的睡眠质量。The electronic device obtains at least one of an improvement in sleep duration and an improvement in sleep depth ratio based on the first sleep quality and the second sleep quality; the second sleep quality is the sleep quality when the user does not adopt the sleep-aiding suggestions.

在一种可能的实现方式中,睡眠质量可以包括预设时长内的睡眠时长、深睡比例。浅睡比例、快速眼动比例中的至少一项,睡眠改善情况可以包括睡眠时长的改善情况、深度比例的改善情况、浅睡比例的改善情况和快速眼动比例中的至少一项。In a possible implementation, sleep quality may include sleep duration within a preset duration and deep sleep ratio. At least one of the light sleep ratio and the rapid eye movement ratio, and the sleep improvement may include at least one of the improvement of sleep duration, the improvement of the deep ratio, the improvement of the light sleep ratio, and the rapid eye movement ratio.

本申请实施例中,电子设备显示睡眠时长的改善情况、深度比例的改善情况、浅睡比例的改善情况和快速眼动比例中的至少一项,有利于用户直观的认知助眠建议带来的改善效果,可以提高用户体验。In the embodiment of the present application, the electronic device displays at least one of the improvement of sleep duration, the improvement of depth ratio, the improvement of light sleep ratio and the rapid eye movement ratio, which is conducive to the user's intuitive cognitive sleep assistance suggestions. The improvement effect can improve the user experience.

结合第一方面,在一种可能的实现方式中,用户数据包括多个特征的特征值,电子设备基于用户数据,得到用户的助眠建议以及第一睡眠质量,包括:Combined with the first aspect, in a possible implementation, the user data includes feature values of multiple features, and the electronic device obtains the user's sleep aid suggestions and first sleep quality based on the user data, including:

电子设备基于多个特征的特征值,从多个特征中确定目标特征;The electronic device determines the target feature from the plurality of features based on the feature values of the plurality of features;

电子设备确定针对目标特征的助眠建议;针对目标特征的助眠建议用于更新目标特征的特征值。The electronic device determines sleep aid suggestions based on the target feature; the sleep aid suggestions based on the target feature are used to update feature values of the target feature.

本申请实施例中,电子设备可以基于多个特征的特征值,确定目标特征;助眠建议是针对目标特征得到的。该方法可以针对用户需要调整的特征,针对性的提出助眠建议,该方法可以提高助眠建议的有效程度。In the embodiment of the present application, the electronic device can determine the target feature based on the feature values of multiple features; the sleep-aiding suggestion is obtained for the target feature. The method can make targeted sleep-aiding suggestions for the features that the user needs to adjust, and the method can improve the effectiveness of the sleep-aiding suggestions.

结合第一方面,在一种可能的实现方式中,电子设备基于多个特征的特征值,从多个特征中确定目标特征,包括:Combined with the first aspect, in a possible implementation manner, the electronic device determines the target feature from the multiple features based on the feature values of the multiple features, including:

电子设备将多个特征中每一个特征的特征值与每一个特征对应的预设值对比,得到每一个特征的偏差程度;The electronic device compares the feature value of each feature among the multiple features with the preset value corresponding to each feature to obtain the degree of deviation of each feature;

电子设备将偏差程度大的前N个特征确定为目标特征,N是正整数。The electronic device determines the first N features with large deviations as target features, where N is a positive integer.

本申请实施例中,电子设备可以基于多个特征中每一个特征的特征值与每一个特征对应的预设值的偏差程度,确定目标特征。该方法可以确定对用户睡眠影响较大的特征,从而针对性的提出助眠建议,该方法可以提高助眠建议的有效程度,有效改善用户的睡眠质量。In the embodiment of the present application, the electronic device may determine the target feature based on the degree of deviation between the feature value of each feature among the multiple features and the preset value corresponding to each feature. This method can determine the characteristics that have a greater impact on the user's sleep, thereby making targeted sleep aid suggestions. This method can improve the effectiveness of the sleep aid suggestions and effectively improve the user's sleep quality.

结合第一方面,在一种可能的实现方式中,用户数据包括第M个时段的特征数据和其它时段的特征数据;M为正整数,电子设备基于用户数据,得到用户的助眠建议以及第一睡眠质量,包括:Combined with the first aspect, in a possible implementation, the user data includes characteristic data of the Mth period and characteristic data of other periods; M is a positive integer, and the electronic device obtains the user's sleep aid suggestions and the user's sleep aid suggestions based on the user data. 1. Sleep quality, including:

电子设备基于针对目标特征的助眠建议,更新第M个时段的特征数据中目标特征的特征数据,得到更新后的第M个时段的特征数据;Based on the sleep aid suggestions for the target feature, the electronic device updates the feature data of the target feature in the feature data of the Mth time period, and obtains the updated feature data of the Mth time period;

电子设备基于更新后的第M个时段的特征数据,得到更新后的第M个时段的睡眠影响因子;The electronic device obtains the updated sleep impact factor of the M-th period based on the updated characteristic data of the M-th period;

电子设备将更新后的第M个时段的睡眠影响因子和其它时段的睡眠影响因子作为输入,通过目标模型,得到第一睡眠质量;The electronic device takes the updated sleep influencing factor of the Mth period and the sleep influencing factors of other periods as input, and obtains the first sleep quality through the target model;

其它时段的睡眠影响因子是基于其它时段的特征数据得到的;目标模型是以样本睡眠影响因子为输入,以样本睡眠影响因子对应的睡眠质量为标签训练得到的。The sleep influencing factors of other periods are obtained based on the characteristic data of other periods; the target model is trained using the sample sleep influencing factors as input and the sleep quality corresponding to the sample sleep influencing factors as labels.

本申请实施例中,电子设备可以基于更新后的特征数据,预测采纳助眠建议后的睡眠质量。该方法中,采用了针对目标特征的助眠建议,该助眠建议可以有效改善用户的睡眠质量,因此,可以得到大幅改善后的睡眠质量;该方法可以使用户直观看到针对助眠建议的改善效果,提高用户体验。In the embodiment of the present application, the electronic device can predict the sleep quality after adopting the sleep-aiding suggestion based on the updated feature data. In this method, a sleep-aiding suggestion for the target feature is adopted, and the sleep-aiding suggestion can effectively improve the user's sleep quality, so that a significantly improved sleep quality can be obtained; this method can enable the user to intuitively see the improvement effect of the sleep-aiding suggestion, thereby improving the user experience.

结合第一方面,在一种可能的实现方式中,用户数据包括第M个时段的特征数据和其它时段的特征数据,其中,第M个时段为当前时段,也即是电子设备响应于开始睡眠预测的用户操作时所处的时段;其它时段为当天用户起床后到当前时段之间的若干个时段。In conjunction with the first aspect, in a possible implementation, the user data includes characteristic data of the Mth period and characteristic data of other periods, where the Mth period is the current period, that is, the electronic device responds to starting sleep. The predicted period of time when the user operates; other periods are several periods between the day when the user wakes up and the current period.

结合第一方面,在一种可能的实现方式中,用户数据包括多个时段的特征数据,电子设备基于用户数据,得到第二睡眠质量,包括:Combined with the first aspect, in a possible implementation, the user data includes characteristic data of multiple periods, and the electronic device obtains the second sleep quality based on the user data, including:

电子设备基于多个时段中每一个时段的特征数据,得到每一个时段的睡眠影响因子;The electronic device obtains a sleep influencing factor for each time period based on the characteristic data of each time period in the plurality of time periods;

电子设备基于每一个时段的睡眠影响因子和目标模型,得到第二睡眠质量;The electronic device obtains the second sleep quality based on the sleep influencing factors and target models of each period;

目标模型是以样本睡眠影响因子为输入,以样本睡眠影响因子对应的睡眠质量为标签训练得到的。The target model is trained by taking the sample sleep influencing factors as input and the sleep quality corresponding to the sample sleep influencing factors as labels.

本申请实施例中,用户数据包括多个时段的特征数据;电子设备基于多个时段中每一个时段的特征数据,得到每一个时段的睡眠影响因子;基于每一个时段的睡眠影响因子和目标模型可以得到第二睡眠质量。该方法考虑各个时段间的活动相关性,可以提高预测第二睡眠质量的准确性。In the embodiment of the present application, the user data includes characteristic data of multiple periods; the electronic device obtains the sleep impact factor of each period based on the characteristic data of each period in the multiple periods; based on the sleep influence factor and target model of each period You can get second quality sleep. This method considers activity correlation between various periods and can improve the accuracy of predicting second sleep quality.

结合第一方面,在一种可能的实现方式中,预设时段内的睡眠影响因子包括体力消耗因子、精力消耗因子和临睡环境影响因子中的至少一个;Combined with the first aspect, in a possible implementation manner, the sleep influencing factors within the preset period include at least one of a physical consumption factor, an energy consumption factor and a sleep environment influencing factor;

体力消耗因子是基于预设时段内的心率、运动时长、步数、卡路里和活动小时数中的至少一项确定的;精力消耗因子是基于预设时段内血压、血氧、压力、咖啡因摄入量和酒精摄入量中的至少一项确定的;临睡环境影响因子是基于预设时段内环境光照和噪音分贝中的至少一项确定的。本申请实施例中,用户数据的信息量大,可以有效提高预测准确性。The physical exertion factor is determined based on at least one of the heart rate, exercise duration, steps, calories, and activity hours in a preset period; the energy consumption factor is determined based on at least one of the blood pressure, blood oxygen, stress, caffeine intake, and alcohol intake in a preset period; and the sleep environment impact factor is determined based on at least one of the ambient light and noise decibels in a preset period. In the embodiment of the present application, the user data has a large amount of information, which can effectively improve the prediction accuracy.

结合第一方面,在一种可能的实现方式中,方法还包括:Combined with the first aspect, in a possible implementation manner, the method also includes:

电子设备获取预训练模型,预训练模型是基于用户所在群体的历史用户数据得到的;The electronic device obtains a pre-trained model, where the pre-trained model is obtained based on historical user data of the group to which the user belongs;

电子设备基于用户的历史用户数据对预训练模型进行训练,得到目标模型。The electronic device trains the pre-training model based on the user's historical user data to obtain the target model.

本申请实施例中,该目标模型是先基于用户所在群体的历史用户数据进行训练;再基于用户的历史用户数据训练得到的。该方法中,先基于用户所在群体的历史用户数据进行训练可以保证预测结果不偏离群体;再以群体数据为基准,通过个人数据进行训练,可以使目标模型更具有个性化,该方法可以提高目标模型的输出的准确度。In the embodiment of this application, the target model is first trained based on the historical user data of the user's group, and then trained based on the user's historical user data. In this method, first training based on the historical user data of the user's group can ensure that the prediction results do not deviate from the group; then using the group data as the benchmark and training with personal data can make the target model more personalized. This method can improve the target The accuracy of the model's output.

在一种可能的实现方式中,预训练模型是服务器训练得到的,目标模型是电子设备基于预训练模型训练得到的。该方法可以有效控制服务器和电子设备的计算量,避免训练全由服务器或电子设备执行时出现计算量太大,影响速度的情况;在电子设备基于用户的历史用户数据训练预训练模型,还可以保护用户的隐私安全;在服务器训练预训练模型,可以将预训练模型提供至群体内的其它用户,可以避免重复计算,浪费计算资源。该方法可以减少整体计算量,提高计算速度,保护用户隐私。In a possible implementation, the pre-trained model is trained by the server, and the target model is trained by the electronic device based on the pre-trained model. This method can effectively control the calculation amount of the server and the electronic device, and avoid the situation where the calculation amount is too large and affects the speed when the training is all performed by the server or the electronic device; when the electronic device trains the pre-training model based on the user's historical user data, it can also Protect the privacy and security of users; train the pre-trained model on the server and provide the pre-trained model to other users in the group, which can avoid repeated calculations and waste of computing resources. This method can reduce the overall calculation amount, improve calculation speed, and protect user privacy.

结合第一方面,在一种可能的实现方式中,电子设备响应于开始睡眠预测的用户操作,获取用户数据,包括:Combined with the first aspect, in a possible implementation manner, the electronic device responds to a user operation to start sleep prediction, and obtains user data, including:

电子设备响应于开始睡眠预测的用户操作,向服务器发送获取请求;The electronic device responds to the user operation of starting sleep prediction and sends an acquisition request to the server;

电子设备接收服务器发送的用户数据,用户数据包括服务器从用户佩戴的设备获取的数据。The electronic device receives user data sent by the server, and the user data includes data obtained by the server from the device worn by the user.

本申请实施例中,服务器可以从用户佩戴的至少一个设备中获取用户数据,至少一个设备可以包括运动手表、智能眼镜等;再将用户数据发送至电子设备。该方法中,电子设备可获取到用户其他设备中的用户数据,该用户数据的数据量大,可以提高预测的准确度;无需用户输入,可以提高用户体验。In this embodiment of the present application, the server may obtain user data from at least one device worn by the user, and the at least one device may include a sports watch, smart glasses, etc.; and then send the user data to the electronic device. In this method, the electronic device can obtain user data from other devices of the user. The user data has a large amount of data, which can improve the accuracy of prediction; no user input is required, which can improve the user experience.

第二方面,本申请实施例提供了一种电子设备,包括一个或多个功能模块,该一个或多个功能模块可用于执行如上述任一方面中或任一方面中任一可能的实现方式中的睡眠质量预测方法。In a second aspect, embodiments of the present application provide an electronic device, including one or more functional modules. The one or more functional modules can be used to perform any of the above aspects or any possible implementation of any aspect. sleep quality prediction method.

第三方面,本申请提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得通信装置执行上述任一方面中或任一方面中任一可能的实现方式中的睡眠质量预测方法。In a third aspect, the present application provides a computer storage medium, including computer instructions, which, when executed on an electronic device, enables a communication device to execute a sleep quality prediction method in any of the above aspects or in any possible implementation of any of the aspects.

第四方面,本申请提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面中或任一方面中任一可能的实现方式中的睡眠质量预测方法。In a fourth aspect, the present application provides a computer program product. When the computer program product is run on a computer, it causes the computer to execute the sleep quality prediction method in any of the above aspects or any possible implementation of any aspect.

第五方面,本申请提供了一种芯片,包括:处理器和接口,所述处理器和接口相互配合,使得所述芯片执行上述任一方面中或任一方面中任一可能的实现方式中的睡眠质量预测方法。In a fifth aspect, the present application provides a chip, comprising: a processor and an interface, wherein the processor and the interface cooperate with each other so that the chip executes the sleep quality prediction method in any of the above aspects or any possible implementation of any of the aspects.

可以理解地,上述第二方面提供的电子设备、第三当面提供的计算机可读存储介质、第四方面提供的计算机程序产品、第五方面提供的芯片均用于执行本申请实施例所提供的方法。因此,其所能达到的有益效果可参考对应方法中的有益效果,此处不再赘述。It can be understood that the electronic device provided in the second aspect, the computer-readable storage medium provided in the third aspect, the computer program product provided in the fourth aspect, and the chip provided in the fifth aspect are all used to execute the tasks provided by the embodiments of the present application. method. Therefore, the beneficial effects it can achieve can be referred to the beneficial effects in the corresponding methods, and will not be described again here.

附图说明Description of drawings

图1是本申请实施例提供的一种预测系统的框架图;Figure 1 is a framework diagram of a prediction system provided by an embodiment of the present application;

图2是本申请实施例提供的一种电子设备100的硬件结构示意图;Figure 2 is a schematic diagram of the hardware structure of an electronic device 100 provided by an embodiment of the present application;

图3是本申请实施例提供的电子设备100的软件结构框图;Figure 3 is a software structure block diagram of the electronic device 100 provided by the embodiment of the present application;

图4是本申请提供的一种睡眠质量预测方法的整体流程示意图;Figure 4 is a schematic diagram of the overall flow of a sleep quality prediction method provided by this application;

图5是本申请提供的一种睡眠质量预测方法的流程示意图;FIG5 is a flow chart of a sleep quality prediction method provided by the present application;

图6是本申请实施例提供的一种构建一个时段的睡眠影响因子的示意图;Figure 6 is a schematic diagram of constructing a sleep influencing factor for a period provided by an embodiment of the present application;

图7是本申请实施例提供的一次训练过程的示意图;Figure 7 is a schematic diagram of a training process provided by the embodiment of the present application;

图8是本申请实施例提供的一种预测过程的示意图;Figure 8 is a schematic diagram of a prediction process provided by an embodiment of the present application;

图9A是本申请实施例提供的一种确定目标特征的示意图;Figure 9A is a schematic diagram of determining target characteristics provided by an embodiment of the present application;

图9B是本申请实施例提供的另一种确定目标特征的示意图;Figure 9B is another schematic diagram for determining target features provided by an embodiment of the present application;

图10是本申请实施例提供的一种特征和特征对应的课程的示意图;Figure 10 is a schematic diagram of a feature provided by an embodiment of the present application and a course corresponding to the feature;

图11是本申请实施例提供的一种目标用户的当天特征数据的示意图;Figure 11 is a schematic diagram of a target user's characteristic data of the day provided by the embodiment of the present application;

图12A是本申请实施例提供的一种更新后的当天特征数据的示意图;Figure 12A is a schematic diagram of updated characteristic data of the day provided by the embodiment of the present application;

图12B是本申请实施例提供的另一种更新后的当天特征数据的示意图;Figure 12B is a schematic diagram of another updated characteristic data of the day provided by the embodiment of the present application;

图13是本申请实施例提供的一种确定采纳建议后的睡眠质量的示意图;Figure 13 is a schematic diagram for determining sleep quality after adopting suggestions provided by an embodiment of the present application;

图14是本申请实施例提供的一种更新睡眠影响因子的示意图;Figure 14 is a schematic diagram of updating sleep impact factors provided by an embodiment of the present application;

图15A-图15D为是本申请实施例提供的电子设备上实现的用户界面。Figures 15A-15D are user interfaces implemented on the electronic device provided by the embodiment of the present application.

具体实施方式Detailed ways

下面将结合附图对本申请实施例中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms “first” and “second” are used for descriptive purposes only and shall not be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, “plurality” The meaning is two or more.

本申请以下实施例中的术语“用户界面(user interface,UI)”,是应用程序或操作系统与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。用户界面是通过java、可扩展标记语言(extensible markuplanguage,XML)等特定计算机语言编写的源代码,界面源代码在电子设备上经过解析,渲染,最终呈现为用户可以识别的内容。用户界面常用的表现形式是图形用户界面(graphicuser interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的文本、图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。The term "user interface (UI)" in the following embodiments of this application is a media interface for interaction and information exchange between an application or operating system and a user. It realizes the difference between the internal form of information and the form acceptable to the user. conversion between. The user interface is source code written in specific computer languages such as Java and extensible markup language (XML). The interface source code is parsed and rendered on the electronic device, and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed graphically. It can be text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets and other visual interface elements displayed on the display screen of an electronic device.

为了更加清楚、详细地介绍本申请实施例提供的睡眠质量预测方法,下面先介绍本申请实施例提供的预测系统。In order to introduce the sleep quality prediction method provided by the embodiment of the present application more clearly and in detail, the prediction system provided by the embodiment of the present application is first introduced below.

请参见图1,图1是本申请实施例提供的一种预测系统的框架图。Please refer to Figure 1. Figure 1 is a framework diagram of a prediction system provided by an embodiment of the present application.

如图1所示,预测系统可以包括服务器10和终端设备20。其中,服务器10可以为部署在云端的服务器;终端设备20可以为手机、手表等电子设备(图1示例性示出了终端设备20为手机)。As shown in Fig. 1, the prediction system may include a server 10 and a terminal device 20. The server 10 may be a server deployed in the cloud; the terminal device 20 may be an electronic device such as a mobile phone or a watch (Fig. 1 exemplarily shows that the terminal device 20 is a mobile phone).

在一些实施例中,终端设备20可以向服务器10发送获取请求,该获取请求包括目标用户的标识;服务器10可以响应于该获取请求,向终端设备20发送目标用户的睡眠影响数据和预训练模型;终端设备20可以基于预训练模型和目标用户的睡眠影响数据,预测目标用户的当前睡眠质量,还可以确定针对目标用户的助眠建议以及采纳助眠建议后的睡眠质量。其中,终端设备20预测目标用户的当前睡眠质量,或者确定针对目标用户的助眠建议以及采纳助眠建议后的睡眠质量的具体实现可以参见下文中的相关描述,在此不作展开。其中,当前睡眠质量为用户当前时刻预测到的未采纳助眠建议时的睡眠质量。In some embodiments, the terminal device 20 may send an acquisition request to the server 10, the acquisition request including the identification of the target user; the server 10 may respond to the acquisition request, send the target user's sleep impact data and the pre-training model to the terminal device 20 ; The terminal device 20 can predict the target user's current sleep quality based on the pre-trained model and the target user's sleep impact data, and can also determine sleep aid suggestions for the target user and the sleep quality after adopting the sleep aid suggestions. The specific implementation of how the terminal device 20 predicts the current sleep quality of the target user, or determines the sleep aid suggestions for the target user and the sleep quality after adopting the sleep aid suggestions can be found in the relevant description below and will not be elaborated here. Among them, the current sleep quality is the sleep quality predicted by the user at the current moment when the sleep aid suggestions are not adopted.

其中,本申请实施例中的服务器100可以用独立的服务器或者是多个服务器组成的服务器集群来实现。Among them, the server 100 in the embodiment of the present application can be implemented as an independent server or a server cluster composed of multiple servers.

终端设备20可以包括但不限于手机、穿戴设备(如手表等)、平板、显示器、电视机、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机、上网本,增强现实设备、虚拟现实设备、人工智能设备、车载设备、智能家居设备等电子设备。The terminal device 20 may include but is not limited to a mobile phone, a wearable device (such as a watch, etc.), a tablet, a monitor, a television, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a super mobile personal computer, a netbook, or an augmented reality device. , virtual reality equipment, artificial intelligence equipment, vehicle equipment, smart home equipment and other electronic equipment.

在一种实现中,终端设备20可以包括多个电子设备;多个电子设备可以为不同用户使用的电子设备,多个电子设备可以分别将其使用者的用户数据发送至服务器10,其中,用户数据可以包括睡眠影响数据和个人信息等。进而,服务器10可以保存不同电子设备发送的使用者的用户数据。例如,用户日常佩戴手表,该手表为终端设备20;在获取用户同意后,手表可以将用户的个人信息、运动情况以及睡眠质量等用户数据发送至服务器10;服务器10可以保存该用户数据。In one implementation, the terminal device 20 may include multiple electronic devices; the multiple electronic devices may be electronic devices used by different users, and the multiple electronic devices may respectively send user data of their users to the server 10 , where the user The data can include sleep impact data and personal information, among other things. Furthermore, the server 10 can save the user's user data sent by different electronic devices. For example, the user wears a watch on a daily basis, and the watch is the terminal device 20; after obtaining the user's consent, the watch can send user data such as the user's personal information, exercise status, and sleep quality to the server 10; the server 10 can save the user data.

可以理解的是,图1中的预测系统架构只是本申请实施例中的一种示例性的实施方式,本申请实施例中的预测系统架构包括但不仅限于以上预测系统架构。It can be understood that the prediction system architecture in Figure 1 is only an exemplary implementation in the embodiment of the present application. The prediction system architecture in the embodiment of the present application includes but is not limited to the above prediction system architecture.

以下示例性以电子设备100为例对图1中的终端设备20进行介绍。The following takes the electronic device 100 as an example to introduce the terminal device 20 in FIG. 1 .

图2示出了电子设备100的硬件结构示意图。FIG. 2 shows a schematic diagram of the hardware structure of the electronic device 100 .

下面以电子设备100为例对实施例进行具体说明。应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The following uses the electronic device 100 as an example to describe the embodiment in detail. It should be understood that electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different component configuration. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.

电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2. Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), an image signal processor ( image signal processor (ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), etc. . Among them, different processing units can be independent devices or integrated in one or more processors.

其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (PCM) interface, and a universal asynchronous receiver (universal asynchronous receiver) /transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and/or Universal serial bus (USB) interface, etc.

I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces. For example, the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .

I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(displayserial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (displayserial interface, DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 . The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .

GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.

SIM卡接口可以被用于与SIM卡接口195通信,实现传送数据到SIM卡或读取SIM卡中数据的功能。The SIM card interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.

USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.

可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。A modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite system. (global navigation satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.

在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidounavigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellitesystem,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and/or satellite based augmentation system (SBAS).

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode,AMOLED),柔性发光二极管(flex light-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. Display 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode). , AMOLED), flexible light-emitting diodes (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.

摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.

内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用(比如人脸识别功能,指纹识别功能、移动支付功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如人脸信息模板数据,指纹信息模板等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universalflash storage,UFS)等。Internal memory 121 may be used to store computer executable program code, which includes instructions. The processor 110 executes instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100 . The internal memory 121 may include a program storage area and a data storage area. Among them, the stored program area can store the operating system, at least one application required for the function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.). The storage data area can store data created during the use of the electronic device 100 (such as face information template data, fingerprint information templates, etc.). In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions, etc.

耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The headphone interface 170D is used to connect wired headphones. The headphone interface 170D may be a USB interface 130, or may be a 3.5 mm open mobile terminal platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor may include at least two parallel plates of conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is performed on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity smaller than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.

陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory gaming scenarios.

气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。Magnetic sensor 180D includes a Hall sensor. The electronic device 100 may utilize the magnetic sensor 180D to detect opening and closing of the flip holster. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.

加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.

距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outwardly through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in holster mode, and pocket mode automatically unlocks and locks the screen.

环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The buttons 190 include a power button, a volume button, etc. Key 190 may be a mechanical key. It can also be a touch button. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .

马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 can generate vibration prompts. The motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback. For example, touch operations for different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. The motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 . Different application scenarios (such as time reminders, receiving information, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于合成请求,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to synthesize requests, missed calls, notifications, etc.

SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 . The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.

本申请实施例中,电子设备100可以通过处理器110执行所述睡眠质量预测方法。In this embodiment of the present application, the electronic device 100 can execute the sleep quality prediction method through the processor 110 .

图3是本申请实施例提供的电子设备100的软件结构框图。FIG. 3 is a software structure block diagram of the electronic device 100 provided by the embodiment of the present application.

分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, and each layer has clear roles and division of labor. The layers communicate through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime) and system libraries, and kernel layer.

应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.

如图3所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息和运动健康等应用程序。As shown in FIG. 3 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, and sports health.

在一些实施例中,用户可以通过电子设备100的运动健康与其他设备(如上文中服务器10)进行通信连接,例如向其他设备发送获取请求或获取其他设备发送的睡眠影响数据。In some embodiments, the user can communicate with other devices (such as the server 10 above) through the sports health of the electronic device 100, for example, send acquisition requests to other devices or obtain sleep impact data sent by other devices.

应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

如图3所示,应用程序框架层可以包括显示(display)管理器,传感器(sensor)管理器,跨设备连接管理器,事件管理器,任务(activity)管理器,窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。As shown in Figure 3, the application framework layer can include a display manager, a sensor manager, a cross-device connection manager, an event manager, an activity manager, a window manager, and a content provider. , view system, resource manager, notification manager, etc.

显示管理器用于系统的显示管理,负责所有显示相关事务的管理,包括创建、销毁、方向切换、大小和状态变化等。一般来说,单设备上只会有一个默认显示模块,即主显示模块。The display manager is used for system display management and is responsible for the management of all display-related transactions, including creation, destruction, orientation switching, size and status changes, etc. Generally speaking, there will only be one default display module on a single device, which is the main display module.

传感器管理器负责传感器的状态管理,并管理应用向其监听传感器事件,将事件实时上报给应用。The sensor manager is responsible for managing the status of sensors, managing applications to monitor sensor events, and reporting events to applications in real time.

跨设备连接管理器用于与其他设备建立通信连接。Cross-device connection manager is used to establish communication connections with other devices.

事件管理器用于系统的事件管理服务,负责接收底层上传的事件并分发给各窗口,完成事件的接收和分发等工作。The event manager is used for the event management service of the system. It is responsible for receiving the events uploaded by the underlying layer and distributing them to each window, and completing the reception and distribution of events.

任务管理器用于任务(Activity)组件的管理,包括启动管理、生命周期管理、任务方向管理等。The task manager is used for the management of task (Activity) components, including startup management, life cycle management, task direction management, etc.

窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。窗口管理器还用于负责窗口显示管理,包括窗口显示方式、显示大小、显示坐标位置、显示层级等相关的管理。The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc. The window manager is also responsible for window display management, including window display mode, display size, display coordinate position, display level, etc.

以上各个实施例的具体执行过程可以参见下文中人机对话方法的相关内容。For the specific execution process of each of the above embodiments, please refer to the relevant content of the human-machine dialogue method below.

内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。Content providers are used to store and retrieve data and make this data accessible to applications. Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls that display text, controls that display pictures, etc. A view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.

通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.

Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. The Android runtime is responsible for the scheduling and management of the Android system.

核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and application framework layer run in virtual machines. The virtual machine executes the java files of the application layer and application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.

系统库(也可称为数据管理层)可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)和事件数据等。The system library (also called data management layer) can include multiple functional modules. For example: surface manager (surface manager), media libraries (Media Libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL) and event data, etc.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.

2D图形引擎是2D绘图的绘图引擎。2D Graphics Engine is a drawing engine for 2D drawing.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

接下来,先基于预测系统的软件框架示例性的介绍睡眠质量预测方法的整体流程。Next, the overall process of the sleep quality prediction method is introduced as an example based on the software framework of the prediction system.

请参见图4,图4是本申请提供的一种睡眠质量预测方法的整体流程示意图。图4中的服务器可以为图1所示的预测系统中的服务器10;图4中的电子设备可以为图1所示的预测系统中的终端设备20。Please refer to Figure 4, which is a schematic diagram of the overall process of a sleep quality prediction method provided by the present application. The server in Figure 4 can be the server 10 in the prediction system shown in Figure 1; the electronic device in Figure 4 can be the terminal device 20 in the prediction system shown in Figure 1.

其中,目标用户为电子设备的使用者,服务器包括目标用户的个人数据库以及其他用户的个人数据库,图4中的训练参数数据库为其他用户的个人数据库。Among them, the target user is the user of the electronic device, the server includes the target user's personal database and the personal databases of other users, and the training parameter database in Figure 4 is the personal database of other users.

如图4所示,该软件框架可以包括数据存取层、算法逻辑层和展示层。其中,数据存取层可以包括训练参数数据库、目标用户的个人数据库和数据获取模块,其中,训练参数数据库和目标用户的个人数据库位于服务器,数据获取模块位于电子设备;算法逻辑层和展示层均位于电子设备。As shown in Figure 4, the software framework may include a data access layer, an algorithm logic layer, and a display layer. The data access layer may include a training parameter database, a target user's personal database, and a data acquisition module, wherein the training parameter database and the target user's personal database are located on a server, and the data acquisition module is located in an electronic device; the algorithm logic layer and the display layer are both located in the electronic device.

其中,数据获取模块用于从目标用户的个人数据库获取目标用户的用户数据。该用户数据可以包括用户的个人信息及用户的睡眠影响数据,其中,个人信息包括年龄、性别、地区日照时长数据等;睡眠影响数据可以包括历史睡眠数据和当天特征数据,其中,历史睡眠数据可以包括当天前若干天每天的特征数据和睡眠质量,当天特征数据为获取用户数据的当天目标用户的特征数据,特征数据可以包括一个或多个特征的数据,特征可以为心率、运动时长等;睡眠质量可以包括睡眠时长、深睡比例、浅睡比例、快速眼动比例等。Among them, the data acquisition module is used to obtain the user data of the target user from the personal database of the target user. The user data may include the user's personal information and the user's sleep impact data, where the personal information includes age, gender, regional sunshine duration data, etc.; the sleep impact data may include historical sleep data and characteristic data of the day, where the historical sleep data may It includes daily characteristic data and sleep quality for several days before the current day. The characteristic data for that day is the characteristic data of the target user on the day when the user data is obtained. The characteristic data can include data of one or more characteristics, and the characteristics can be heart rate, exercise duration, etc.; sleep Quality can include sleep duration, deep sleep ratio, light sleep ratio, rapid eye movement ratio, etc.

数据获取模块还用于基于目标用户的个人信息从训练参数数据库获取目标用户所属群体的历史睡眠数据。其中,目标用户所属群体中的用户的个人信息与目标用户的个人信息的信息差距在预设范围内;目标用户所属群体也可以称为目标群体。The data acquisition module is also used to obtain historical sleep data of the target user's group from the training parameter database based on the target user's personal information. Among them, the information gap between the personal information of the users in the target user's group and the target user's personal information is within a preset range; the target user's group can also be called the target group.

特征预处理模块用于基于目标用户的历史睡眠数据和目标群体的历史睡眠数据得到训练数据,训练数据可以包括群体训练数据和目标用户的个体训练数据。The feature preprocessing module is used to obtain training data based on the historical sleep data of the target user and the historical sleep data of the target group. The training data may include group training data and individual training data of the target user.

特征预处理模块还用于基于目标用户的当天特征数据得到目标用户当天的睡眠影响因子。The feature preprocessing module is also used to obtain the target user's sleep influencing factors for the day based on the target user's feature data for the day.

模型训练模块用于基于训练数据训练初始睡眠质量预测模型,得到目标模型。The model training module is used to train the initial sleep quality prediction model based on the training data to obtain the target model.

睡眠质量预测模块用于基于目标模型和目标用户当天的睡眠影响因子,得到当前预测结果。其中,预测结果可以包括睡眠时长、深睡比例,浅睡比例和快速眼动比例。The sleep quality prediction module is used to obtain the current prediction results based on the target model and the sleep influencing factors of the target user on that day. The prediction results may include sleep duration, deep sleep ratio, light sleep ratio and rapid eye movement ratio.

展示层用于显示该当前预测结果。The presentation layer is used to display the current prediction results.

改善服务推荐模块用于基于目标模型的模型参数中的权重和目标用户的当天特征数据,确定助眠建议;基于助眠建议,更新目标用户的当天特征数据。The improved service recommendation module is used to determine sleep-aiding suggestions based on the weights in the model parameters of the target model and the target user's characteristic data of the day; based on the sleep-aiding suggestions, the target user's characteristic data of the day is updated.

睡眠质量预测模块基于更新后的当天特征数据和目标模型得到采纳助眠建议后的预测结果。展示层用于显示该助眠建议和采纳助眠建议后的预测结果。The sleep quality prediction module obtains the prediction results after adopting the sleep aid suggestions based on the updated characteristic data of the day and the target model. The display layer is used to display the sleep aid suggestions and the predicted results after adopting the sleep aid suggestions.

以下以电子设备为手机为例,详细的介绍本申请实施例提供的睡眠质量预测方法。The following takes a mobile phone as an example of an electronic device to introduce in detail the sleep quality prediction method provided in the embodiment of the present application.

请参见图5,图5是本申请提供的一种睡眠质量预测方法的流程示意图。Please refer to Figure 5, which is a schematic flow chart of a sleep quality prediction method provided by this application.

S501:电子设备响应于预测睡眠质量的用户操作,向服务器发送获取请求,该获取请求包括目标用户的用户标识。S501: In response to a user operation for predicting sleep quality, the electronic device sends an acquisition request to the server, where the acquisition request includes the user identification of the target user.

在一些实施例中,电子设备安装有运动健康的应用,该应用界面可以包括预测睡眠质量的控件;电子设备可以显示该应用界面,电子设备可以在检测到用户针对该控件的用户操作时,响应于该用户操作,向服务器发送获取请求。其中,该获取请求可以包括目标用户的用户标识,该用户标识可以为目标用户登录运动健康的账号或者华为账号等。In some embodiments, the electronic device is installed with a sports and health application, and the application interface may include a control for predicting sleep quality; the electronic device may display the application interface, and the electronic device may respond when detecting a user operation on the control. In response to this user operation, a fetch request is sent to the server. The acquisition request may include the user ID of the target user, and the user ID may be the target user's sports and health account or Huawei account, etc.

例如,电子设备可以显示如图15B所示的用户界面;电子设备在检测到用户针对睡眠质量预测控件620的用户操作时,向服务器发送获取请求。For example, the electronic device may display a user interface as shown in FIG. 15B; when detecting a user operation on the sleep quality prediction control 620, the electronic device sends an acquisition request to the server.

S502:服务器响应于获取请求,基于用户标识获取目标用户的个人信息和目标用户的睡眠影响数据。S502: The server responds to the acquisition request and acquires the target user's personal information and the target user's sleep impact data based on the user identification.

在一种实现中,服务器包括目标用户的个人数据库。那么,服务器可以基于用户标识,从目标用户的个人数据库中获取目标用户的个人信息和目标用户的睡眠影响数据。In one implementation, the server includes a personal database of the target user. Then, the server can obtain the personal information of the target user and the sleep impact data of the target user from the personal database of the target user based on the user identifier.

其中,个人信息可以包括用户所在城市的当月日照时长、性别、年龄层;睡眠影响数据包括历史睡眠数据和当天特征数据,其中,历史睡眠数据可以包括过去每天的特征数据和睡眠质量。Among them, personal information can include the sunshine duration of the month, gender, and age group in the city where the user is located; sleep impact data includes historical sleep data and characteristic data of the day, where historical sleep data can include characteristic data and sleep quality of each day in the past.

S503:服务器基于用户的个人信息,确定目标用户所属的目标群体。S503: The server determines the target group to which the target user belongs based on the user's personal information.

其中,目标群体可以包括至少两个用户;目标群体中的用户的个人信息均符合预设要求,例如目标群体中的用户的性别为预设性别、年龄在预设年龄层内且用户所在地区日照时长为预设时长。Among them, the target group may include at least two users; the personal information of the users in the target group all meets the preset requirements, for example, the gender of the users in the target group is the preset gender, the age is within the preset age group, and the area where the user is located is sunny. The duration is the default duration.

在一些实施例中,服务器可以基于用户所在城市的当月日照时长、性别、年龄层划分不同的群体,其中,同一群体的性别相同;同一群体内的用户所在城市的当月日常时长为同一等级,例如服务器可以统计不同城市当月日照时长,从极小值到极大值,按每十小时作为同一级别进行划分;同一群体内的用户为同一年龄层,例如年龄层按每十岁作为差值,以末尾为零的年龄作为该年龄层的起始。In some embodiments, the server can divide the users into different groups based on the sunshine duration in the city where the users are located, gender, and age group, wherein the gender of the same group is the same; the daily sunshine duration in the city where the users in the same group are located is at the same level, for example, the server can count the sunshine duration in different cities that month, from the minimum value to the maximum value, and divide them into the same level every ten hours; the users in the same group are of the same age group, for example, the age group is divided into ten years as the difference, and the age ending with zero is used as the starting point of the age group.

需要说明的是,划分群体的方法还可以有其他方法,此处对划分群体的方法不作限定。It should be noted that there can be other methods for dividing groups, and the method for dividing groups is not limited here.

S504:服务器获取目标群体的历史睡眠数据。S504: The server obtains the historical sleep data of the target group.

在一些实施例中,服务器在确定目标用户所属的目标群体后,可以在存储中获取目标群体中每一个用户的历史睡眠数据。例如服务器中包括训练参数数据库,训练参数数据库中包括目标群体的历史睡眠数据,则服务器可以从训练参数数据库中获取目标群体的历史睡眠数据。In some embodiments, after determining the target group to which the target user belongs, the server may obtain the historical sleep data of each user in the target group from the storage. For example, the server includes a training parameter database, and the training parameter database includes historical sleep data of the target group, then the server can obtain the historical sleep data of the target group from the training parameter database.

其中,上述历史睡眠数据可以包括过去每天的特征数据和睡眠质量,即目标群体的历史睡眠数据包括目标群体中每一个用户过去每天的特征数据和睡眠质量。其中,特征数据可以包括一个或多个特征的数据,特征可以为心率、运动时长等;睡眠质量可以包括睡眠时长、深睡比例、浅睡比例、快速眼动比例等。The above historical sleep data may include the characteristic data and sleep quality of every day in the past, that is, the historical sleep data of the target group includes the characteristic data and sleep quality of each user in the target group every day in the past. Among them, the characteristic data may include data of one or more characteristics, and the characteristics may be heart rate, exercise duration, etc.; sleep quality may include sleep duration, deep sleep ratio, light sleep ratio, rapid eye movement ratio, etc.

例如,目标群体包括N个用户,则目标群体的历史睡眠数据包括N个用户中每一个用户的历史睡眠数据,一个用户的历史睡眠数据为该用户过去M天内每天的特征数据和每天的睡眠质量,M为正整数。例如M为30,用户A为目标群体中的用户,用户A的历史睡眠数据可以包括用户A在当天之前近30天每天的特征数据和每天的睡眠质量,如当天为2022年9月5日,则电子设备可以获取用户A在2022年8月6日至2022年9月4日每天的特征数据和每天的睡眠质量。For example, if the target group includes N users, the historical sleep data of the target group includes the historical sleep data of each of the N users. The historical sleep data of a user is the daily characteristic data and daily sleep quality of the user in the past M days, where M is a positive integer. For example, M is 30, and user A is a user in the target group. The historical sleep data of user A may include the daily characteristic data and daily sleep quality of user A for nearly 30 days before today. For example, if today is September 5, 2022, the electronic device may obtain the daily characteristic data and daily sleep quality of user A from August 6, 2022 to September 4, 2022.

S505:服务器基于目标群体的历史睡眠数据,对初始睡眠质量预测模型进行训练,得到预训练模型。S505: The server trains the initial sleep quality prediction model based on the historical sleep data of the target group to obtain a pre-trained model.

其中,目标群体的历史睡眠数据包括目标群体中每一个用户过去每一天的历史睡眠数据;该初始睡眠质量预测模型的模型参数中包括每一个特征对应的初始权重,训练过程中不断更新模型参数中每一个特征对应的权重。其中,初始睡眠质量预测模型可以为循环神经网络、长短期记忆神经网络(Long short-term memory,LSTM),也可以为其他神经网络,此处不作限定。Among them, the historical sleep data of the target group includes the historical sleep data of each user in the target group for each past day; the model parameters of the initial sleep quality prediction model include the initial weight corresponding to each feature, and the model parameters are continuously updated during the training process. The weight corresponding to each feature. Among them, the initial sleep quality prediction model can be a recurrent neural network, a long short-term memory neural network (Long short-term memory, LSTM), or other neural networks, which are not limited here.

在一些实施例中,服务器可以将目标群体中每一个用户过去一天的历史睡眠数据作为一条历史睡眠数据,例如目标群体的历史睡眠数据包括N个用户中每一个用户过去M天内每天的特征数据和每天的睡眠质量,也就是有N×M条历史睡眠数据;进而,服务器可以针对每一条历史睡眠数据,基于该条历史睡眠数据中的特征数据和上次训练后的模型的模型参数中的特征权重构建睡眠影响因子;最后,将该睡眠影响因子和该条历史睡眠数据中的睡眠质量作为一条群体训练数据对上次训练后的模型进行训练,其中,睡眠影响因子为输入数据,睡眠质量为输出目标。需要说明的是,上次训练后的模型为该条历史睡眠数据的前一条历史睡眠数据训练后的模型;对初始睡眠质量预测模型进行第一次训练时采用的特征权重为初始睡眠质量预测模型中的模型参数的初始权重。In some embodiments, the server can use the historical sleep data of each user in the target group in the past day as a piece of historical sleep data. For example, the historical sleep data of the target group includes the daily characteristic data of each of the N users in the past M days and Daily sleep quality, that is, there are N×M pieces of historical sleep data; furthermore, the server can target each piece of historical sleep data based on the feature data in the historical sleep data and the features in the model parameters of the model after the last training. The weight constructs the sleep influence factor; finally, the sleep influence factor and the sleep quality in the historical sleep data are used as a group training data to train the model after the last training, where the sleep influence factor is the input data and the sleep quality is Output target. It should be noted that the model after the last training is the model trained on the previous piece of historical sleep data; the feature weight used in the first training of the initial sleep quality prediction model is the initial sleep quality prediction model. The initial weights of the model parameters in .

例如,服务器可以基于第一条历史睡眠数据中的特征数据和每一个特征对应的初始权重,生成第一条历史睡眠数据对应的睡眠影响因子,将该睡眠影响因子和该条历史睡眠数据中的睡眠质量作为第一条训练数据;利用第一条训练数据对初始睡眠质量预测模型进行训练,得到第一次训练后的模型;接下来,再基于第一次训练后的模型的模型参数中的每一个特征对应的权重和第二条历史睡眠数据中的特征数据,生成第二条历史睡眠数据对应的睡眠影响因子,将该睡眠影响因子和该条历史睡眠数据中的睡眠质量作为第二条训练数据;利用第二条训练数据对初始睡眠质量预测模型进行训练,得到第二次训练后的模型,依次类推,直至满足预设条件时结束训练,得到预训练模型。For example, the server can generate a sleep impact factor corresponding to the first piece of historical sleep data based on the feature data in the first piece of historical sleep data and the initial weight corresponding to each feature, and combine the sleep impact factor and the initial weight in the piece of historical sleep data. Sleep quality is used as the first training data; use the first training data to train the initial sleep quality prediction model to obtain the model after the first training; next, based on the model parameters of the model after the first training The weight corresponding to each feature and the feature data in the second piece of historical sleep data are used to generate the sleep influence factor corresponding to the second piece of historical sleep data, and the sleep influence factor and the sleep quality in the piece of historical sleep data are used as the second piece of historical sleep data. Training data; use the second piece of training data to train the initial sleep quality prediction model to obtain the model after the second training, and so on, until the preset conditions are met and the training is terminated to obtain the pre-trained model.

其中,预设条件可以是损失最小,也可以是迭代次数达到预设次数,还可以是其他预设条件,本申请实施例对此不做限定。Among them, the preset condition can be the minimum loss, the number of iterations reaching a preset number, or other preset conditions, which are not limited in the embodiments of the present application.

其中,一条训练数据中的睡眠影响因子可以包括该天每一时段的睡眠影响因子;睡眠影响因子可以包括一个或多个因子,因子可以为体力消耗因子(Strength ConsumeFactor,SCF)、精力消耗因子(Energy Consume Factor,ECF)、临睡环境影响因子(SleepEnvironment Impact Factor,SIEF)等。其中,一天的每一时段可以是基于以用户该天睡眠结束时刻为起点,以该天入睡时刻为终点的时间段划分的,例如,用户某一天的睡眠结束时刻为上午九点,该天入睡时刻为晚上十点,则电子设备可以将上午九点至晚上十点划分为若干个时间段,此处对时间段的时长不作限定,例如可以为一个小时。Among them, the sleep influencing factors in a piece of training data can include sleep influencing factors for each period of the day; the sleep influencing factors can include one or more factors, and the factors can be physical consumption factors (Strength Consume Factor, SCF), energy consumption factors ( Energy Consume Factor (ECF), SleepEnvironment Impact Factor (SIEF), etc. Each time period of a day can be divided based on the time period starting from the user's sleep end time of the day and ending with the user's sleep time of the day. For example, the user's sleep end time of a certain day is 9 am, and the user falls asleep on that day. If the time is ten o'clock in the evening, the electronic device can divide nine o'clock in the morning to ten o'clock in the evening into several time periods. The length of the time period is not limited here, for example, it can be one hour.

以下示例性以用户A在t时段的特征数据为例,介绍生成睡眠影响因子的一种可能的实现方法。The following takes user A's characteristic data in period t as an example to introduce a possible implementation method of generating sleep influence factors.

请参见图6,图6是本申请实施例提供的一种构建一个时段的睡眠影响因子的示意图。图6示例性示出了用户A在t时段的12个特征,特征1为心率,特征2为运动时长,特征3为步数,特征4为卡路里,特征5为活动小时数,特征6为血压,特征7为血氧,特征8为压力,特征9为咖啡因摄入量,特征10为酒精摄入量,特征11为环境光照,特征12为噪音分贝。用户A在t时段的特征数据可以由12个特征的特征值组成,如图6所示,其中,各项特征的特征值依次分别为x1、x2、x3、x4、x5、x6、x7、x8、x9、x10、x11和x12。每一个特征在睡眠质量预测模型中有对应的权重依次分别为w1、w2、w3、w4、w5、w6、w7、w8、w9、w10、w11和w12Please refer to FIG. 6 , which is a schematic diagram of constructing a sleep influencing factor for a period provided by an embodiment of the present application. Figure 6 exemplarily shows 12 features of user A in period t. Feature 1 is heart rate, feature 2 is exercise duration, feature 3 is step count, feature 4 is calories, feature 5 is activity hours, and feature 6 is blood pressure. , feature 7 is blood oxygen, feature 8 is pressure, feature 9 is caffeine intake, feature 10 is alcohol intake, feature 11 is ambient lighting, and feature 12 is noise decibels. The feature data of user A in period t can be composed of the feature values of 12 features, as shown in Figure 6. Among them, the feature values of each feature are x 1 , x 2 , x 3 , x 4 , x 5 , respectively. x 6 , x 7 , x 8 , x 9 , x 10 , x 11 and x 12 . Each feature has a corresponding weight in the sleep quality prediction model, which are w 1 , w 2 , w 3 , w 4 , w 5 , w 6 , w 7 , w 8 , w 9 , w 10 , w 11 and w 12 .

如图6所示,电子设备可以将体力消耗因子对应的特征的数据和特征的权重对应相乘后求和,可以得到体力消耗因子电子设备可以将精力消耗因子对应的特征的数据和特征的权重对应相乘后求和,可以得到精力消耗因子电子设备可以将临睡环境影响因子对应的特征的数据和特征的权重对应相乘后求和,可以得到临睡环境影响因子/>那么,电子设备最后可以得到用户A在t时段的睡眠影响因子yt=[SCFt、ECFt、SIEFt]。As shown in Figure 6, the electronic device can multiply the data of the feature corresponding to the physical exertion factor and the weight of the feature and sum them up to obtain the physical exertion factor. The electronic device can multiply the data of the feature corresponding to the energy consumption factor and the weight of the feature and sum them up to obtain the energy consumption factor. The electronic device can multiply the data of the characteristics corresponding to the sleep environment impact factor and the weights of the features and sum them up to obtain the sleep environment impact factor/> Then, the electronic device can finally obtain user A's sleep impact factor y t =[SCFt, ECFt, SIEFt] in period t.

在一种实现中,若t时段为日落后的时段,则用户A在t时段的睡眠影响因子可以为上述yt,即包括体力消耗因子、精力消耗因子、临睡环境影响因子;若t时段为日落后的时段,则用户A在t时段的睡眠影响因子可以仅包括体力消耗因子和精力消耗因子。In one implementation, if period t is the period after sunset, the sleep impact factor of user A in period t can be the above y t , that is, including physical consumption factor, energy consumption factor, and sleep environment influencing factor; if period t is the period after sunset, then user A's sleep influencing factors in period t may only include physical consumption factors and energy consumption factors.

以下以用户A的一条训练数据为例介绍一次训练过程。假设该条训练数据为用户A第i天对应的训练数据,该条训练数据包括第i天t个时段中每个时段的睡眠影响因子和第i天的睡眠质量Ot’,其中,第i天为M天中的一天,i为正整数;t个时段包括第j个时段,j为正整数,t为正整数。需要说明的是,隐向量mj为第j个时段的目标模型的隐藏层的输出,隐向量mj用于代表第j个时段的特征数据对用户A第i天睡眠的影响The following uses a piece of training data from user A as an example to introduce a training process. Assume that this piece of training data is the training data corresponding to the i-th day of user A. This piece of training data includes the sleep impact factor of each period in the t periods on the i-th day and the sleep quality O t ' of the i-th day, where, the i-th Day is one of M days, i is a positive integer; t periods include the jth period, j is a positive integer, and t is a positive integer. It should be noted that the latent vector m j is the output of the hidden layer of the target model in the j-th period, and the latent vector m j is used to represent the impact of the feature data in the j-th period on user A’s sleep on the i-th day.

请参见图7,图7是本申请实施例提供的一次训练过程的示意图。Please refer to Figure 7, which is a schematic diagram of a training process provided in an embodiment of the present application.

如图7所示,电子设备可以将用户A第i天醒后第一个时段的睡眠影响因子y1输入上一条训练数据训练后的睡眠质量预测模型LSTM,得到的输出结果为睡眠质量o1,还可以得到隐向量m1,隐向量m1为第一个时段的目标模型的隐藏层的输出,隐向量m1用于代表第1个时段的特征数据对用户A第i天睡眠的影响;进而,电子设备将o1和m1输入LSTM,得到的输出结果为睡眠质量o2,还可以得到隐向量m2;依次类推,直至最后一个时段(即第t个时段)时,将mt-1输入LSTM,得到的输出结果为睡眠质量ot。其中,在日落前的睡眠影响因子可以由体力消耗因子和精力消耗因子组成,日落后的睡眠影响因子可以由体力消耗因子、精力消耗因子、临睡环境影响因子组成。As shown in Figure 7, the electronic device can input the sleep influence factor y 1 of the first period after user A wakes up on the i-th day into the sleep quality prediction model LSTM trained on the previous training data, and the obtained output result is sleep quality o 1 , you can also get the latent vector m 1 , which is the output of the hidden layer of the target model in the first period. The latent vector m 1 is used to represent the impact of the feature data in the first period on user A’s sleep on the i-th day . ;Furthermore, the electronic device inputs o1 and m1 into the LSTM, and the output result is the sleep quality o 2 , and the hidden vector m 2 can also be obtained; and so on, until the last period (that is, the t-th period), m t- 1Input LSTM, and the output result obtained is sleep quality o t . Among them, the sleep influencing factors before sunset can be composed of physical consumption factors and energy consumption factors, and the sleep influencing factors after sunset can be composed of physical consumption factors, energy consumption factors, and sleep environment influencing factors.

进而,电子设备可以基于睡眠质量ot和第i天的睡眠质量ot’得到损失,基于损失调整LSTM中各个特征对应的权重。其中,损失可以是基于损失函数交叉熵函数得到的,也可以是基于其他损失函数得到的,此处不作限定。Furthermore, the electronic device can obtain the loss based on the sleep quality o t and the sleep quality o t ' on the i-th day, and adjust the weight corresponding to each feature in the LSTM based on the loss. Among them, the loss can be obtained based on the loss function cross-entropy function, or can be obtained based on other loss functions, which is not limited here.

需要说明的是,电子设备可以将损失最小时的模型确定为目标模型;电子设备也可以在进行多轮迭代训练后,得到目标模型,本申请实施例对迭代次数不做限定。It should be noted that the electronic device can determine the model with the smallest loss as the target model; the electronic device can also obtain the target model after performing multiple rounds of iterative training. The embodiment of the present application does not limit the number of iterations.

S506:服务器向电子设备发送预训练模型和目标用户的睡眠影响数据,其中,目标用户的睡眠影响数据包括目标用户的历史睡眠数据和当天特征数据。S506: The server sends the pre-trained model and the target user's sleep impact data to the electronic device, where the target user's sleep impact data includes the target user's historical sleep data and the characteristic data of the day.

其中,目标用户的历史睡眠数据可以包括目标用户过去m天内每天的特征数据和每天的睡眠质量。其中,m为正整数。需要说明的是,上述n和上述m可以相等,也可以不相等。The historical sleep data of the target user may include the characteristic data of each day and the sleep quality of each day in the past m days of the target user, wherein m is a positive integer. It should be noted that the above n and the above m may be equal or unequal.

其中,目标用户的当天特征数据为电子设备开始预测睡眠质量的当天目标用户的特征数据。例如,步骤S501中电子设备响应于预测睡眠质量的用户操作为当天21点,则目标用户的当天特征数据为目标用户当天截止至21点的特征数据。Among them, the characteristic data of the target user on the day is the characteristic data of the target user on the day when the electronic device starts to predict the sleep quality. For example, in step S501, if the electronic device responds to the user operation of predicting sleep quality at 21 o'clock on the day, then the target user's characteristic data of the day is the target user's characteristic data of the day up to 21 o'clock.

其中,当天可以是指电子设备开始预测睡眠质量的当天目标用户醒来到开始预测的时刻的时间段。假设将该时间段分为多个时间段,则目标用户的当天特征数据可以包括多个时间段的特征数据,其中,一个时间段的特征数据可以包括多个特征的特征值。The current day may refer to the time period from when the target user wakes up on the day when the electronic device starts predicting sleep quality to when the prediction starts. Assuming that the time period is divided into multiple time periods, the target user's characteristic data of the day may include characteristic data of multiple time periods, wherein the characteristic data of one time period may include characteristic values of multiple characteristics.

S507:电子设备基于目标用户的历史睡眠数据,对预训练模型进行训练,得到目标模型。S507: The electronic device trains the pre-training model based on the target user's historical sleep data to obtain the target model.

在一些实施例中,服务器可以将目标用户过去一天的历史睡眠数据作为一条历史睡眠数据,例如目标用户的历史睡眠数据包括其过去M天内每天的特征数据和每天的睡眠质量,也就是有M条历史睡眠数据;进而,针对每一条历史睡眠数据,基于该条历史睡眠数据中的特征数据和上次训练后的预训练模型的模型参数中的特征权重构建睡眠影响因子;最后,将该睡眠影响因子和该条历史睡眠数据中的睡眠质量作为一条个体训练数据对上次训练后的模型进行训练,其中,睡眠影响因子为输入数据,睡眠质量为输出目标。需要说明的是,上次训练后的预训练模型为该条历史睡眠数据的前一条历史睡眠数据训练后的模型;对预训练模型进行第一次训练时采用的特征权重为预训练模型的模型参数中的初始权重。In some embodiments, the server can use the target user's historical sleep data of the past day as a piece of historical sleep data. For example, the target user's historical sleep data includes his daily characteristic data and daily sleep quality in the past M days, that is, there are M pieces of historical sleep data. Historical sleep data; then, for each piece of historical sleep data, a sleep impact factor is constructed based on the feature data in the historical sleep data and the feature weights in the model parameters of the pre-trained model after the last training; finally, the sleep impact factor is The factor and the sleep quality in the historical sleep data are used as an individual training data to train the model after the last training, in which the sleep influencing factor is the input data and the sleep quality is the output target. It should be noted that the pre-trained model after the last training is the model trained on the previous piece of historical sleep data; the feature weights used in the first training of the pre-trained model are the models of the pre-trained model. Initial weights in parameters.

其中,关于构建睡眠影响因子和训练过程的具体实现可以参见步骤S505中的相关内容,此处不再赘述。For the specific implementation of constructing the sleep influencing factors and training process, please refer to the relevant content in step S505, which will not be described again here.

S508:电子设备基于目标用户的当天特征数据和目标模型的特征权重,确定目标用户当天每一个时段的睡眠影响因子。S508: The electronic device determines the target user's sleep influencing factors for each period of the day based on the target user's feature data of the day and the feature weight of the target model.

在一些实施例中,电子设备可以以目标用户当天睡眠结束时刻为起点,以开始预测的时刻(如步骤S101中电子设备检测到预测睡眠质量的用户操作时)为终点,划分多个时段;进而,基于目标用户的当天特征数据中每一个时段的特征数据和目标模型的模型参数中每一个特征的权重,构建用户当天每一个时段的睡眠影响因子。其中,特征数据可以包括多个特征的数据,如心率、运动时长等;睡眠影响因子可以包括体力消耗因子、精力消耗因子、临睡环境影响因子中的至少一个。In some embodiments, the electronic device can divide multiple periods using the end time of the target user's sleep that day as the starting point and the time when the prediction starts (such as when the electronic device detects a user operation for predicting sleep quality in step S101) as the end point; and then, , based on the characteristic data of each period in the target user's characteristic data of the day and the weight of each feature in the model parameters of the target model, the user's sleep influence factors for each period of the day are constructed. The characteristic data may include data of multiple characteristics, such as heart rate, exercise duration, etc.; the sleep influencing factors may include at least one of physical consumption factors, energy consumption factors, and sleep environment influencing factors.

在一种实现中,当天的所有时段可以分为日落前的时段和日落后的时段;电子设备可以以当日苏醒时间为起点,计算日落前每小时的[SCFt、ECFt]作为日落前每个时段的睡眠影响因子;计算日落后每小时的[SCFt、ECFt、SIEFt]作为日落后每个时段的睡眠影响因子。In one implementation, all time periods of the day can be divided into a time period before sunset and a time period after sunset; the electronic device can take the wake-up time of the day as the starting point, calculate [SCF t , ECF t ] every hour before sunset as the sleep impact factor of each time period before sunset; and calculate [SCF t , ECF t , SIEF t ] every hour after sunset as the sleep impact factor of each time period after sunset.

需要说明的是,电子设备计算目标当天每一个时段的睡眠影响因子的过程可以参见上文中图6对应的计算过程,也即是图6中的权重为目标模型的权重,用户A的特征数据为目标用户的当天数据即可以得到目标用户对应的睡眠影响因子,此处不再赘述。It should be noted that the electronic device calculates the sleep influencing factors for each period of the target day. Please refer to the calculation process corresponding to Figure 6 above. That is, the weight in Figure 6 is the weight of the target model, and the characteristic data of user A is The sleep influencing factors corresponding to the target user can be obtained from the target user's data for the day, which will not be described again here.

S509:电子设备基于目标用户当天每一个时段的睡眠影响因子和目标模型,得到当前睡眠质量。S509: The electronic device obtains the current sleep quality based on the sleep influencing factors and the target model of the target user in each period of the day.

其中,当前睡眠质量为预测得到的当前时段的睡眠质量;当前时段为电子设备检测到预测睡眠质量的用户操作的时段。例如,当前时段可以为步骤S501中电子设备响应于针对预测睡眠质量控件的用户操作的时段。Wherein, the current sleep quality is the predicted sleep quality of the current period; the current period is the period when the electronic device detects the user operation that predicts the sleep quality. For example, the current period may be the period during which the electronic device responds to the user operation for the predicted sleep quality control in step S501.

在一些实施例中,电子设备将目标用户当天每一个时段的睡眠影响因子按照时间从早上到晚上的时间顺序分别输入目标模型中,除第一个时段外其他时段输入目标模型的数据还包括上一个时段的睡眠影响因子输入目标模型后得到的隐向量,最后一个时段为当前时段;在输入当前时段的睡眠影响因子和当前时段的上一个时段得到的隐向量后可以得到当前睡眠质量。此处对每一个时段的时长不作限定,每一个时段的时长可以相等,也可以不等。In some embodiments, the electronic device inputs the target user's sleep influencing factors for each period of the day into the target model in chronological order from morning to evening. In addition to the first period, the data entered into the target model for other periods also includes the above. The latent vector obtained after inputting the sleep influencing factor of a period into the target model, and the last period is the current period; the current sleep quality can be obtained after inputting the sleep influencing factor of the current period and the implicit vector obtained from the previous period of the current period. There is no limit to the length of each period here, and the length of each period can be equal or unequal.

请参见图8,图8是本申请实施例提供的一种预测过程的示意图。如图8所示,假设当前时段为第k个时段,目标用户当天醒来后的时段至当前时段按照时间顺序依次是第一个时段、第二个时段直至第k个时段,日落前的睡眠影响因子由组成,日落后的睡眠影响因子由组成;电子设备将目标用户在当天醒后第一个时段的睡眠影响因子Y1输入目标模型,得到睡眠质量O1和隐向量M1;进而,电子设备将当天醒后第二个时段的睡眠影响因子Y2和隐向量M1输入目标模型,得到睡眠质量O2和隐向量M2;进而,电子设备当天醒后第二个时段的睡眠影响因子Y3和隐向量M2将输入目标模型,得到睡眠质量O3和隐向量M3;直至将当前时段的睡眠影响因子Yk和隐向量Mk-1输入目标模型,得到睡眠质量Ok,睡眠质量Ok即为预测到的目标用户的当前睡眠质量。Please refer to Figure 8, which is a schematic diagram of a prediction process provided by an embodiment of the present application. As shown in Figure 8, assuming that the current time period is the kth time period, the time period after the target user wakes up that day to the current time period is the first time period, the second time period, and the kth time period in chronological order, the sleep influence factor before sunset is composed of, and the sleep influence factor after sunset is composed of; the electronic device inputs the sleep influence factor Y1 of the target user in the first time period after waking up that day into the target model to obtain the sleep quality O1 and the latent vector M1 ; then, the electronic device inputs the sleep influence factor Y2 and the latent vector M1 of the second time period after waking up that day into the target model to obtain the sleep quality O2 and the latent vector M2 ; then, the sleep influence factor Y3 and the latent vector M2 of the second time period after waking up that day will be input into the target model to obtain the sleep quality O3 and the latent vector M3 ; until the sleep influence factor Yk and the latent vector Mk -1 of the current time period are input into the target model to obtain the sleep quality Ok , and the sleep quality Ok is the predicted current sleep quality of the target user.

S510:电子设备基于目标用户的当天特征数据和目标模型,得到助眠建议。S510: The electronic device obtains sleep aid suggestions based on the target user's characteristic data and target model of the day.

在一些实施例中,目标模型的模型参数中包括至少一个特征的权重;电子设备可以基于用户的当天特征数据和至少一个特征的权重,确定目标特征;进而,将针对该目标特征的建议确定为助眠建议。In some embodiments, the model parameters of the target model include the weight of at least one feature; the electronic device can determine the target feature based on the user's feature data of the day and the weight of the at least one feature; and then determine the recommendation for the target feature as Sleep aid suggestions.

在一种实现中,电子设备可以将权重最大且当天特征值最小的特征确定为目标特征。其中,当天特征值可以为当天每一个时段的特征值累加;也可以为当天每一个时段的特征值的平均值。需要说明的是,当天每一个时段可以是指用户醒来到当前时段的每个时段。In one implementation, the electronic device may determine the feature with the largest weight and the smallest feature value on that day as the target feature. Among them, the characteristic value of the day can be the accumulation of the characteristic values of each period of the day; it can also be the average value of the characteristic values of each period of the day. It should be noted that each period of the day may refer to each period from when the user wakes up to the current period.

请参见图9A,图9A是本申请实施例提供的一种确定目标特征的示意图。如图9A所示,以图所示的12个特征为例;这12个特征在目标模型的模型参数中的权重依次分别为w1、w2直至w12这12个权重;目标用户的每一个特征的当天数据之和分别为X1、X2直至X12这12个数据和,即目标用户当天一天的心率之和为X1,目标用户当天一天的运动时长之和为X2Please refer to FIG. 9A. FIG. 9A is a schematic diagram of determining target characteristics provided by an embodiment of the present application. As shown in Figure 9A, taking the 12 features shown in the figure as an example; the weights of these 12 features in the model parameters of the target model are respectively w 1 , w 2 , and w 12 ; each of the target users The sum of the day's data for a feature is the sum of the 12 data from X 1 , X 2 to X 12 , that is, the sum of the target user's heart rate for the day is X 1 , and the sum of the target user's exercise duration for the day is X 2 .

在另一种实现中,电子设备可以基于预设特征值和目标用户的当天特征值,确定每一个特征的偏差程度;将偏差程度较大的前若干个特征作为目标特征。在偏差程度相同时,电子设备可以优先取权重较大的特征。其中,偏差程度可以是基于预设特征值和目标用户的当天特征值的偏差值通过归一化处理得到的。In another implementation, the electronic device may determine the degree of deviation of each feature based on the preset feature value and the feature value of the target user on the day; and take the first several features with larger deviation degrees as the target features. When the deviation degrees are the same, the electronic device may give priority to the features with larger weights. The degree of deviation may be obtained by normalizing the deviation value between the preset feature value and the feature value of the target user on the day.

请参见图9B,图9B是本申请实施例提供的另一种确定目标特征的示意图。如图9B所示,电子设备可以获取经群体训练数据训练后的模型输出最佳睡眠质量时的最佳特征数据,该最佳特征数据包括每一个特征的特征值之和;将目标用户每一个特征的当天特征值分别与最佳特征数据中每一个特征的特征值之和进行对比,得到每一个特征的偏差值;进而,将每一个特征的偏差值进行归一化处理,得到每一个特征的偏差比例,偏差比例用于表示特征的特征值与最佳特征数据中特征值的偏差程度;最后,将偏差比例较大的前若干个特征作为目标特征。Please refer to Figure 9B, which is another schematic diagram of determining the target feature provided by an embodiment of the present application. As shown in Figure 9B, the electronic device can obtain the best feature data when the model trained by the group training data outputs the best sleep quality, and the best feature data includes the sum of the feature values of each feature; the feature value of each feature of the target user on the day is compared with the sum of the feature values of each feature in the best feature data to obtain the deviation value of each feature; then, the deviation value of each feature is normalized to obtain the deviation ratio of each feature, and the deviation ratio is used to indicate the degree of deviation between the feature value of the feature and the feature value in the best feature data; finally, the first several features with larger deviation ratios are used as target features.

如图9A所示,i为1至12中的一个整数;假设w1至w12中数值最大的权重为wi;X1至X12中确定当天特征值最小的数据和为Xi;则特征i为目标特征,特征i对应的课程为针对特征i的建议。As shown in Figure 9A, i is an integer from 1 to 12; assume that the weight with the largest value among w 1 to w 12 is w i ; the sum of the data from X 1 to X 12 that determines the smallest characteristic value on the day is X i ; then Feature i is the target feature, and the courses corresponding to feature i are suggestions for feature i.

需要说明的是,本申请实施例对目标特征对应的课程内容不作限定。以下示例性介绍部分特征对应的课程。It should be noted that the embodiments of this application do not limit the course content corresponding to the target features. The following is an example of the courses corresponding to some features.

请参见图10,图10是本申请实施例提供的一种特征和特征对应的课程的示意图。如图10所示,卡路里(特征4)对应的课程可以为健身课程1;压力(特征8)和噪音分贝(特征12)对应的课程可以为舒眠音乐;压力(特征8)对应的课程可以为呼吸训练和冥想;心率(特征1)对应的课程可以为健身课程2。其中,特征对应的课程可以有该课程对应的参数,该参数用于更新该特征的数据;例如健身课程1可以消耗x’的卡路里。Please refer to Figure 10, which is a schematic diagram of a feature provided by an embodiment of the present application and a course corresponding to the feature. As shown in Figure 10, the course corresponding to calories (feature 4) can be fitness course 1; the course corresponding to pressure (feature 8) and noise decibel (feature 12) can be sleeping music; the course corresponding to pressure (feature 8) can be It is breathing training and meditation; the course corresponding to heart rate (feature 1) can be fitness course 2. Among them, the course corresponding to the feature can have parameters corresponding to the course, which are used to update the data of the feature; for example, fitness course 1 can consume x’ calories.

S511:电子设备基于助眠建议更新目标用户的当天特征数据,得到更新后的当天特征数据。S511: The electronic device updates the target user's characteristic data for the day based on the sleep aid suggestion to obtain updated characteristic data for the day.

其中,目标用户的当天特征数据包括至少一个目标特征;更新后的当天特征数据包括更新后的至少一个目标特征的数据。The target user's feature data for the day includes at least one target feature; and the updated feature data for the day includes updated data of at least one target feature.

在一些实施例中,助眠建议为目标特征对应的建议;电子设备可以基于目标特征对应的建议,更新该目标特征的数据,得到更新后的目标特征的数据;更新后的当天特征数据包括更新后的目标特征的数据和不更新特征的数据。In some embodiments, the sleep aid suggestions are suggestions corresponding to the target feature; the electronic device can update the data of the target feature based on the suggestions corresponding to the target feature to obtain updated data of the target feature; the updated feature data of the day includes updated The data of the target features after the update and the data of the features that are not updated.

以下以图11所示的当天特征数据为例,示例性的介绍两种更新当天特征数据的方法。The following takes the current day's characteristic data shown in Figure 11 as an example to introduce two exemplary methods for updating the current day's characteristic data.

请参见图11,图11是本申请实施例提供的一种目标用户的当天特征数据的示意图。如图11所示,目标用户的当天特征数据包括当前时段前其他时段的特征数据以及当前时段的特征数据;其中,当天时段的特征数据包括不更新特征的特征值和目标特征的特征值。此处对不更新特征和目标特征的个数不做限定。Please refer to Figure 11. Figure 11 is a schematic diagram of a target user's characteristic data of the day provided by an embodiment of the present application. As shown in Figure 11, the target user's characteristic data of the day includes characteristic data of other periods before the current period and characteristic data of the current period; among them, the characteristic data of the current period includes the characteristic values of the non-updated characteristics and the characteristic values of the target characteristics. There is no limit on the number of non-updating features and target features here.

在一种实现中,电子设备可以基于助眠建议,更新当天特征数据中当前时段的特征数据,得到更新后的当天特征数据,当天除当前时段外其他时段的特征数据不变。其中,电子设备可以基于针对目标特征的助眠建议,仅对当前时段的特征数据中目标特征的特征值(即图11中的粗体字部分)进行更新,得到图12A中的更新后的目标特征的特征值(即图12A中的粗体字部分);当前时段中其他特征(即不更新特征)的特征值不变;图12A所示的数据即为更新后的当天特征数据。In one implementation, the electronic device can update the characteristic data of the current period in the characteristic data of the day based on the sleep aid suggestion, and obtain the updated characteristic data of the day. The characteristic data of other periods of the day except the current period remain unchanged. Among them, the electronic device can update only the feature value of the target feature in the feature data of the current period (ie, the bold part in Figure 11) based on the sleep aid suggestion for the target feature, to obtain the updated target in Figure 12A The characteristic value of the feature (i.e., the bold font part in Figure 12A); the feature value of other features (i.e., the feature that is not updated) in the current period remains unchanged; the data shown in Figure 12A is the updated feature data of the day.

例如,当前时段的特征数据包括特征1的特征值x1、特征2的特征值x2,特征3的特征值x3,其中,特征1为目标特征,特征2和特征3为不更新特征。特征1为卡路里,特征1对应的助眠建议为健身课程1,该健身课程可以消耗x’卡路里,则电子设备可以更新特征1的特征值为x1’=x1-x’,更新后的特征1的特征值x1’即为上述更新后的目标特征的数据,未更新的特征2和特征3的特征值即为上述不更新特征的特征数据,更新后的当前时段的特征数据包括更新后的特征1特征值和未更新的特征2和特征3的特征值。For example, the feature data of the current period includes the feature value x 1 of feature 1, the feature value x 2 of feature 2, and the feature value x 3 of feature 3. Feature 1 is the target feature, and feature 2 and feature 3 are non-updated features. Feature 1 is calories, and the sleep aid suggestion corresponding to feature 1 is fitness course 1. This fitness course can consume x' calories, then the electronic device can update the feature value of feature 1 to x 1 '=x 1 -x', and the updated The eigenvalue x 1 ' of feature 1 is the data of the above-mentioned updated target feature. The eigenvalues of feature 2 and feature 3 that have not been updated are the feature data of the above-mentioned non-updated features. The updated feature data of the current period includes updated The updated feature 1 eigenvalues and the unupdated feature 2 and feature 3 eigenvalues.

在另一种实现中,电子设备可以基于助眠建议,预测当前时段的下一时段的特征数据;在目标用户的当天特征数据中新增下一时段的特征数据,得到更新后的当天特征数据。示例性的,电子设备可以基于针对目标特征的助眠建议和图11中的目标特征的特征值(即图11中的粗体字部分),预测下一时段的目标特征的特征值(即图12B中的粗体字部分);下一时段中除目标特征外其它特征(即不更新特征)的特征值与当前时段的不更新特征的特征值相同,可以得到下一时段的特征数据(即图11中标为新增的部分);在目标用户的当天特征数据中加入下一时段的特征数据,得到更新后的当天特征数据。In another implementation, the electronic device can predict the characteristic data of the next period in the current period based on the sleep aid suggestions; add the characteristic data of the next period to the target user's characteristic data of the day to obtain the updated characteristic data of the day. . For example, the electronic device can predict the feature value of the target feature in the next period (ie, the feature value of the target feature in Figure 11) based on the sleep aid suggestion for the target feature and the feature value of the target feature in Figure 11 (ie, the bold part in Figure 11). The bold part in 12B); the characteristic values of other features (i.e., non-updated features) except the target feature in the next period are the same as the characteristic values of the non-updated features in the current period, and the characteristic data of the next period (i.e. The new part marked in Figure 11); add the characteristic data of the next period to the target user's characteristic data of the day to obtain the updated characteristic data of the day.

以下示例性介绍一种更新目标特征的特征数据的一种实现方法。The following is an example of an implementation method for updating feature data of a target feature.

在一种实现中,助眠建议为目标特征对应的课程,该课程对应的参数用于更新该特征的数据;则电子设备基于该课程对应的参数更新目标特征的特征数据。例如健身课程1可以消耗x’的卡路里,则将该健身课程1对应的x’卡路里增加至当前时段的卡里路的特征数据中,得到更新后的当天特征数据,更新后的当天特征数据中当前时段的卡路里的特征值发生改变,更新后的当天特征数据中其他特征的特征值未发生改变。In one implementation, the sleep aid suggestion is a course corresponding to the target feature, and the parameters corresponding to the course are used to update the data of the feature; then the electronic device updates the feature data of the target feature based on the parameters corresponding to the course. For example, fitness class 1 can consume x' calories. Then add x' calories corresponding to fitness class 1 to the calorie feature data of the current period to obtain the updated feature data of the day. In the updated feature data of the day The characteristic value of calories in the current period has changed, and the characteristic values of other features in the updated characteristic data of the day have not changed.

S512:电子设备基于更新后的当天特征数据和目标模型,得到改善效果。S512: The electronic device obtains improvement results based on the updated feature data and target model of the day.

其中,更新后的当天特征数据包括至少一个目标特征的新数据;改善效果可以包括采纳助眠建议后的睡眠质量和睡眠质量的改善情况,其中,睡眠质量可以包括睡眠时长、深睡比例、浅睡比例和快速眼动等,睡眠质量的改善情况可以包括睡眠时长的增加值和深睡时长的增加值等。Among them, the updated characteristic data of the day includes new data of at least one target characteristic; the improvement effect may include the sleep quality after adopting the sleep aid suggestions and the improvement of sleep quality, where the sleep quality may include sleep duration, deep sleep ratio, light sleep ratio, and sleep quality improvement. Sleep ratio and rapid eye movement, etc., the improvement of sleep quality can include the increase in sleep duration and the increase in deep sleep duration.

在一些实施例中,更新后的当天特征数据包括未更新的其它时段的特征数据和更新后的当前时段的特征数据(如图12A所示);电子设备基于更新后的当前时段的特征数据,计算更新后的当前时段的睡眠影响因子;基于未更新其它时段的睡眠影响因子和更新后的当前时段的睡眠影响因子,通过目标模型,预测采纳建议后的睡眠质量。其中,通过目标模型预测采纳建议后的睡眠质量的详细过程可以参见步骤S509的相关实现。In some embodiments, the updated characteristic data of the current day includes non-updated characteristic data of other periods and updated characteristic data of the current period (as shown in Figure 12A); the electronic device is based on the updated characteristic data of the current period, Calculate the updated sleep impact factor for the current period; based on the sleep impact factors for other periods that have not been updated and the updated sleep impact factor for the current period, predict the sleep quality after adopting the recommendations through the target model. The detailed process of predicting the sleep quality after adopting the advice through the target model can be found in the related implementation of step S509.

在另一些实施例中,更新后的当天特征数据包括原始的当天特征数据和预测的下一时段的特征数据(如图12B所示);电子设备基于下一时段的特征数据,计算下一时段的睡眠影响因子;基于原始的当天特征数据对应的睡眠影响因子和下一时段的睡眠影响因子,通过目标模型,预测采纳建议后的睡眠质量。其中,其中,通过目标模型预测采纳建议后的睡眠质量的详细过程可以参见步骤S509的相关实现。In other embodiments, the updated characteristic data of the day includes the original characteristic data of the day and the predicted characteristic data of the next time period (as shown in FIG. 12B ); the electronic device calculates the sleep impact factor of the next time period based on the characteristic data of the next time period; based on the sleep impact factor corresponding to the original characteristic data of the day and the sleep impact factor of the next time period, the target model is used to predict the sleep quality after adopting the suggestion. The detailed process of predicting the sleep quality after adopting the suggestion through the target model can be referred to the relevant implementation of step S509.

请参见图13,图13是本申请实施例提供的一种确定采纳建议后的睡眠质量的示意图。如图13所示,假设特征i为目标特征,助眠建议为特征i对应的课程,电子设备可以基于特征i对应的课程更新特征i的数据;基于更新后的特征i的数据更新目标用户的睡眠影响因子,将更新后的睡眠影响因子输入目标模型,得到采纳建议后的睡眠质量。其中,基于更新后的睡眠影响因子和目标模型得到采纳建议后的睡眠质量的过程可以参见上述预测当前睡眠质量的过程,此处不再住宿。Please refer to Figure 13. Figure 13 is a schematic diagram for determining sleep quality after adopting recommendations provided by an embodiment of the present application. As shown in Figure 13, assuming that feature i is the target feature and the sleep aid recommendation is the course corresponding to feature i, the electronic device can update the data of feature i based on the course corresponding to feature i; update the target user's data based on the updated data of feature i Sleep influencing factors: input the updated sleep influencing factors into the target model to obtain the sleep quality after adopting the recommendations. Among them, the process of obtaining the sleep quality after adopting the recommendations based on the updated sleep influencing factors and target model can be found in the above-mentioned process of predicting the current sleep quality, which will not be discussed here.

以下示例性的介绍更新睡眠影响因子的实现。The following is an exemplary introduction to the implementation of updating the sleep impact factor.

在一种实现中,更新后的当天特征数据中的所有特征的数据都已更新,则电子设备可以基于更新的所有特征的数据,更新睡眠影响因子中的每一个因子。In one implementation, the data of all features in the updated feature data of the current day have been updated, and then the electronic device can update each factor in the sleep influencing factors based on the updated data of all features.

在另一种实现中,更新后的当天特征数据可以包括目标特征的新数据和未更新特征的数据;则更新后的睡眠影响因子可以包括更新的因子和未更新的因子。In another implementation, the updated feature data of the day may include new data of the target feature and data of the un-updated feature; then the updated sleep influencing factors may include updated factors and un-updated factors.

例如,多个因子可以包括体力消耗因子、精力消耗因子、临睡环境影响因子等;每一个因子对应不同的特征,电子设备可以仅更新目标特征对应的因子,得到更新后的睡眠影响因子。例如,睡眠影响因子包括体力消耗因子、精力消耗因子、临睡环境影响因子,目标特征为体力消耗因子对应的特征,则电子设备可以基于更新后的特征数据更新体力消耗因子,得到的更新后的睡眠影响因子,更新后的睡眠影响因子包括未更新的精力消耗因子、临睡环境影响因子和更新后的体力消耗因子。For example, multiple factors may include physical consumption factors, energy consumption factors, sleep environment influencing factors, etc.; each factor corresponds to a different feature, and the electronic device can only update the factor corresponding to the target feature to obtain the updated sleep influencing factors. For example, the sleep influencing factors include physical exertion factors, energy consumption factors, and sleep environment influencing factors. The target feature is the feature corresponding to the physical exertion factor. Then the electronic device can update the physical exertion factor based on the updated feature data to obtain the updated Sleep influencing factors. The updated sleep influencing factors include the unupdated energy consumption factor, the sleep environment influencing factor and the updated physical exertion factor.

以图6为例,若目标特征为特征1至特征5中的一个或多个特征,则电子设备基于更新后的当天特征数据更新体力消耗因子;若目标特征为特征6至特征10中的一个或多个特征,则电子设备基于更新后的当天特征数据更新精力消耗因子;若目标特征为特征11至特征12中的一个或多个特征,则电子设备基于更新后的当天特征数据更新临睡环境影响因子。Taking Figure 6 as an example, if the target feature is one or more features from features 1 to features 5, the electronic device updates the physical exertion factor based on the updated feature data of the day; if the target feature is one or more features from features 6 to features 10, the electronic device updates the energy exertion factor based on the updated feature data of the day; if the target feature is one or more features from features 11 to features 12, the electronic device updates the sleeping environment impact factor based on the updated feature data of the day.

请参见图14,图14是本申请实施例提供的一种更新睡眠影响因子的示意图。图14示例性示出了更新前的睡眠影响因子,更新前的睡眠影响因子包括k个时段的睡眠影响因子;目标特征的新数据用于更新最后一个时间段的睡眠影响因子(即Yk),其他时段的睡眠影响因子如Y1和Y2等未发生改变;假设体力消耗因子对应的特征为目标特征,其他特征未更新,则更新后的睡眠影响因子中更新的因子为体力消耗因子,更新前的体力消耗因子为SCFk,更新后的体力消耗因子为SCFk’;未更新的因子为精力消耗因子EFCk和临睡环境影响因子SIEFk。更新前的睡眠影响因子的详细内容可以参见图8的相关介绍,此处不再赘述。Please refer to Figure 14, which is a schematic diagram of updating the sleep impact factor provided by an embodiment of the present application. Figure 14 exemplarily shows the sleep impact factor before updating, and the sleep impact factor before updating includes the sleep impact factors of k time periods; the new data of the target feature is used to update the sleep impact factor of the last time period (i.e., Y k ), and the sleep impact factors of other time periods such as Y 1 and Y 2 have not changed; assuming that the feature corresponding to the physical exertion factor is the target feature, and other features are not updated, then the updated factor in the updated sleep impact factor is the physical exertion factor, the physical exertion factor before updating is SCF k , and the physical exertion factor after updating is SCF k' ; the factors that have not been updated are the energy consumption factor EFC k and the sleeping environment impact factor SIEF k . The details of the sleep impact factor before updating can be found in the relevant introduction of Figure 8, which will not be repeated here.

S513:电子设备显示上述当前睡眠质量、上述助眠建议和上述改善效果。S513: The electronic device displays the above-mentioned current sleep quality, the above-mentioned sleep aid suggestions and the above-mentioned improvement effect.

在一些实施例中,电子设备可以响应于开始睡眠预测的用户操作,执行上述步骤S501至步骤S510得到当前睡眠质量和助眠建议,进而,显示当前睡眠质量和上述助眠建议;再响应于预测采纳该助眠建议后的睡眠质量的用户操作,执行上述步骤S511和步骤S512得到改善效果,进而,显示上述改善效果。In some embodiments, the electronic device may respond to the user operation of starting sleep prediction, perform the above-mentioned steps S501 to S510 to obtain the current sleep quality and the sleep-aid suggestions, and then display the current sleep quality and the above-mentioned sleep-aid suggestions; and then respond to the prediction The user operates the sleep quality after adopting the sleep aid suggestion and performs the above-mentioned step S511 and step S512 to obtain an improvement effect, and then displays the above-mentioned improvement effect.

例如,电子设备响应于针对图15B所示的用户界面62显示的睡眠质量预测控件620的用户操作,执行上述步骤S501至步骤S507得到当前睡眠质量,进而,通过图15C所示的用户界面63显示当前睡眠质量和上述助眠建议,例如显示窗630用于显示当前睡眠质量;进而,响应于针对用户界面63显示的查看控件634的用户操作,执行上述步骤S508和步骤S509得到改善效果,进而,通过如图15D所示的用户界面64显示上述改善效果。For example, in response to the user operation of the sleep quality prediction control 620 displayed on the user interface 62 shown in FIG. 15B , the electronic device performs the above steps S501 to S507 to obtain the current sleep quality, and then displays the current sleep quality through the user interface 63 shown in FIG. 15C The current sleep quality and the above-mentioned sleep aid suggestions, for example, the display window 630 is used to display the current sleep quality; furthermore, in response to the user operation on the view control 634 displayed on the user interface 63, the above-mentioned steps S508 and S509 are performed to obtain an improvement effect, and further, The above improvement effect is displayed through the user interface 64 as shown in Figure 15D.

在另一些实施例,电子设备可以响应于开始睡眠预测的用户操作,执行上述步骤S501至步骤S509得到当前睡眠质量,进而,显示当前睡眠质量;再响应于提供助眠建议的用户操作,执行上述步骤S510得到上述助眠建议,进而显示助眠建议;再响应于改善效果的用户操作,执行上述步骤S511和步骤S512得到改善效果,进而,显示上述改善效果。In other embodiments, the electronic device may perform the above steps S501 to S509 in response to the user operation of starting sleep prediction to obtain the current sleep quality, and then display the current sleep quality; and then in response to the user operation of providing sleep aid suggestions, perform the above steps. In step S510, the above-mentioned sleep aid suggestions are obtained, and then the sleep aid suggestions are displayed; and then in response to the user operation of improving the effect, the above-mentioned steps S511 and step S512 are executed to obtain the improvement effect, and then the above-mentioned improvement effect is displayed.

在又一些实施例中,电子设备可以响应于开始睡眠预测的用户操作,执行上述步骤S501至步骤S512后,显示上述当前睡眠质量、上述助眠建议和上述改善效果。In some embodiments, the electronic device may display the current sleep quality, the sleep aid suggestions, and the improvement effect after performing the above steps S501 to S512 in response to the user operation of starting sleep prediction.

以下示例性示出了本申请实施例中电子设备可能的用户界面,图15A-图15D为电子设备上实现的用户界面。The following exemplarily shows a possible user interface of the electronic device in the embodiment of the present application. Figures 15A-15D are user interfaces implemented on the electronic device.

图15A示出了电子设备上的用于展示已安装应用程序的示例性用户界面61。该用户界面61显示有:状态栏、运动健康应用的图标610、图库应用的图标以及其他应用程序的图标等。其中,状态栏可包括:移动通信信号(又可称为蜂窝信号)的一个或多个信号强度指示符、Wi-Fi信号的一个或多个信号强度指示符,电池状态指示符、时间指示符等。FIG15A shows an exemplary user interface 61 for displaying installed applications on an electronic device. The user interface 61 displays: a status bar, an icon 610 of a sports and health application, an icon of a gallery application, and icons of other applications, etc. The status bar may include: one or more signal strength indicators of a mobile communication signal (also referred to as a cellular signal), one or more signal strength indicators of a Wi-Fi signal, a battery status indicator, a time indicator, etc.

如图15A所示,用户可以点击运动健康应用的图标610,相应的,电子设备响应于该用户操作,可以显示如图15B所示的用户界面62。应理解,该用户界面62为示例性示出的运动健康应用的应用界面,不应造成本申请实施例的限定。As shown in Figure 15A, the user can click the icon 610 of the sports and health application. Correspondingly, the electronic device can display the user interface 62 as shown in Figure 15B in response to the user operation. It should be understood that the user interface 62 is an application interface of an exemplary sports and health application and should not be limited to the embodiments of the present application.

如图15B所示,用户界面62显示有睡眠质量预测控件620;电子设备响应于用户针对图15B所示的用户界面62显示的睡眠质量预测控件620的操作,可以显示如图15C所示的用户界面63。As shown in FIG. 15B , the user interface 62 displays a sleep quality prediction control 620 ; in response to the user's operation of the sleep quality prediction control 620 displayed on the user interface 62 shown in FIG. 15B , the electronic device may display a user interface as shown in FIG. 15C Interface 63.

用户界面63包括显示窗630、呼吸训练控件631、健身课程控件632、舒眠音乐633和查看控件634。其中,显示窗630用于显示预测的睡眠质量,如睡眠时长、深睡比例、浅睡比例和快速眼动等;呼吸训练控件631用于显示呼吸训练对应的课程内容;健身课程控件632用于显示健身课程对应的课程内容;舒眠音乐633用于显示舒眠音乐对应的课程内容;查看控件634用于显示采纳建议后的睡眠质量。The user interface 63 includes a display window 630, a breathing training control 631, a fitness course control 632, sleep music 633 and a viewing control 634. Among them, the display window 630 is used to display the predicted sleep quality, such as sleep duration, deep sleep ratio, light sleep ratio, rapid eye movement, etc.; the breathing training control 631 is used to display the course content corresponding to the breathing training; the fitness course control 632 is used to Display the course content corresponding to the fitness course; the sleeping music 633 is used to display the course content corresponding to the sleeping music; and the viewing control 634 is used to display the sleep quality after adopting the suggestions.

如图15C所示,用户可以点击查看控件634,相应的,电子设备响应于针对查看控件634的用户操作,可以显示如图15D所示的用户界面64。用户界面64可以显示采纳建议后的睡眠质量,如睡眠时长、深睡比例、浅睡比例和快速眼动等;以及睡眠时长的增加值和深睡时长的增加值。As shown in Figure 15C, the user can click the view control 634. Correspondingly, the electronic device can display the user interface 64 as shown in Figure 15D in response to the user operation on the view control 634. The user interface 64 can display the sleep quality after adopting the recommendations, such as sleep duration, deep sleep ratio, light sleep ratio, rapid eye movement, etc.; as well as the increased value of sleep duration and the increased value of deep sleep duration.

在另一些实施例中,目标模型可以是由服务器生成的。例如,电子设备响应于预测睡眠质量的用户操作,向服务器发送获取请求;服务器响应于获取请求,基于目标群体的历史睡眠数据和目标用户的历史睡眠数据对初始睡眠质量预测模型进行训练,得到目标模型;进而。服务器向电子设备发送目标模型和目标用户的当天特征数据;最后,电子设备可以执行步骤S508至步骤S513。In other embodiments, the target model may be generated by the server. For example, in response to a user operation for predicting sleep quality, the electronic device sends an acquisition request to the server; in response to the acquisition request, the server trains the initial sleep quality prediction model based on the historical sleep data of the target group and the historical sleep data of the target user, and obtains the target model; further. The server sends the target model and the target user's characteristic data of the day to the electronic device; finally, the electronic device can perform steps S508 to S513.

在又一些实施例中,上述当前睡眠质量、上述助眠建议和上述改善效果均可以是由服务器生成的。例如,电子设备响应于预测睡眠质量的用户操作,向服务器发送获取请求;服务器响应于获取请求,基于目标群体的历史睡眠数据和目标用户的历史睡眠数据对初始睡眠质量预测模型进行训练,得到目标模型;进而,服务器基于目标模型和目标用户的当天特征数据得到上述当前睡眠质量、上述助眠建议和上述改善效果;进而,服务器可以向电子设备发送上述当前睡眠质量、上述助眠建议和上述改善效果;最后,电子设备可以执行步骤S513。In some embodiments, the above-mentioned current sleep quality, the above-mentioned sleep aid suggestions and the above-mentioned improvement effects may all be generated by the server. For example, in response to a user operation for predicting sleep quality, the electronic device sends an acquisition request to the server; in response to the acquisition request, the server trains the initial sleep quality prediction model based on the historical sleep data of the target group and the historical sleep data of the target user, and obtains the target model; furthermore, the server obtains the above-mentioned current sleep quality, the above-mentioned sleep-aid suggestions and the above-mentioned improvement effect based on the target model and the target user's characteristic data of the day; furthermore, the server can send the above-mentioned current sleep quality, the above-mentioned sleep-aid suggestions and the above-mentioned improvements to the electronic device Effect; Finally, the electronic device can perform step S513.

本申请实施例还提供了一种电子设备,电子设备包括一个或多个处理器和一个或多个存储器;其中,一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述实施例描述的方法。Embodiments of the present application also provide an electronic device. The electronic device includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to For storing computer program code, the computer program code includes computer instructions. When one or more processors execute the computer instructions, the electronic device causes the electronic device to perform the method described in the above embodiments.

本申请实施例还提供了一种包含指令的计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述实施例描述的方法。The embodiments of the present application also provide a computer program product including instructions. When the computer program product is executed on an electronic device, the electronic device executes the method described in the above embodiments.

本申请实施例还提供了一种计算机可读存储介质,包括指令,当指令在电子设备上运行时,使得电子设备执行上述实施例描述的方法。Embodiments of the present application also provide a computer-readable storage medium, which includes instructions. When the instructions are run on an electronic device, the electronic device causes the electronic device to execute the method described in the above embodiment.

可以理解的是,本申请的各实施方式可以任意进行组合,以实现不同的技术效果。It can be understood that the various embodiments of the present application can be combined arbitrarily to achieve different technical effects.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid StateDisk)等。In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments are implemented. This process can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, , may include the processes of the above method embodiments. The aforementioned storage media include: ROM, random access memory (RAM), magnetic disks, optical disks and other media that can store program codes.

总之,以上所述仅为本申请技术方案的实施例而已,并非用于限定本申请的保护范围。凡根据本申请的揭露,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。In short, the above description is only an embodiment of the technical solution of this application, and is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of this application shall be included in the protection scope of this application.

Claims (12)

1.一种睡眠质量预测方法,其特征在于,应用于电子设备,所述方法包括:1. A sleep quality prediction method, characterized in that it is applied to electronic devices, and the method includes: 所述电子设备响应于开始睡眠预测的用户操作,获取用户数据;所述用户数据包括体能数据、精力数据以及环境数据的至少一种;The electronic device acquires user data in response to a user operation to start sleep prediction; the user data includes at least one of physical energy data, energy data, and environmental data; 所述电子设备基于所述用户数据,得到用户的助眠建议以及第一睡眠质量,所述第一睡眠质量为所述用户采用所述助眠建议时的睡眠质量;The electronic device obtains the user's sleep aid suggestions and first sleep quality based on the user data, where the first sleep quality is the sleep quality when the user adopts the sleep aid suggestions; 所述电子设备显示所述第一睡眠质量和睡眠改善情况中的至少一项以及所述助眠建议,所述睡眠改善情况为所述用户采用所述助眠建议时睡眠质量的改善情况。The electronic device displays at least one of the first sleep quality and sleep improvement situation and the sleep assistance suggestion, and the sleep improvement situation is the improvement of sleep quality when the user adopts the sleep assistance suggestion. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, characterized in that, the method further comprises: 所述电子设备基于所述用户数据,得到第二睡眠质量,所述第二睡眠质量为所述用户未采纳所述助眠建议时的睡眠质量;The electronic device obtains a second sleep quality based on the user data, where the second sleep quality is the sleep quality when the user does not adopt the sleep aid suggestion; 所述电子设备显示所述第二睡眠质量。The electronic device displays the second sleep quality. 3.根据权利要求1或2所述的方法,其特征在于,所述睡眠质量包括预设时长内的睡眠时长和深睡比例中的至少一项,所述睡眠改善情况包括睡眠时长的改善情况和深度比例的改善情况中的至少一项;所述方法还包括:3. The method according to claim 1 or 2, wherein the sleep quality includes at least one of sleep duration within a preset duration and deep sleep ratio, and the sleep improvement includes an improvement in sleep duration. and at least one of improvement of depth ratio; the method further includes: 所述电子设备基于所述第一睡眠质量和第二睡眠质量,得到所述睡眠时长的改善情况和深度比例的改善情况中的至少一项;所述第二睡眠质量为所述用户未采纳所述助眠建议时的睡眠质量。The electronic device obtains at least one of the improvement in the sleep duration and the improvement in the sleep depth ratio based on the first sleep quality and the second sleep quality; the second sleep quality is the sleep quality when the user does not adopt the sleep aid suggestion. 4.根据权利要求1-3中任一项所述的方法,其特征在于,所述用户数据包括多个特征的特征值,所述电子设备基于所述用户数据,得到用户的助眠建议以及第一睡眠质量,包括:4. The method according to any one of claims 1 to 3, characterized in that the user data includes feature values of a plurality of features, and the electronic device obtains the user's sleep aid suggestions based on the user data and First sleep quality, including: 所述电子设备基于所述多个特征的特征值,从所述多个特征中确定目标特征;The electronic device determines a target feature from the plurality of features based on feature values of the plurality of features; 所述电子设备确定针对所述目标特征的助眠建议;所述针对所述目标特征的助眠建议用于更新所述目标特征的特征值。The electronic device determines a sleep aid suggestion for the target feature; the sleep aid suggestion for the target feature is used to update the feature value of the target feature. 5.根据权利要求4所述的方法,其特征在于,所述电子设备基于所述多个特征的特征值,从所述多个特征中确定目标特征,包括:5. The method of claim 4, wherein the electronic device determines a target feature from the plurality of features based on feature values of the multiple features, including: 所述电子设备将所述多个特征中每一个特征的特征值与所述每一个特征对应的预设值对比,得到所述每一个特征的偏差程度;The electronic device compares the characteristic value of each feature in the plurality of features with the preset value corresponding to each feature to obtain the degree of deviation of each feature; 所述电子设备将偏差程度大的前N个特征确定为所述目标特征,所述N是正整数。The electronic device determines the first N features with large deviations as the target features, where N is a positive integer. 6.根据权利要求4或5所述的方法,其特征在于,所述用户数据包括第M个时段的特征数据和其它时段的特征数据,所述特征数据包括多个特征的特征值,所述M为正整数;所述电子设备基于所述用户数据,得到用户的助眠建议以及第一睡眠质量,包括:6. The method according to claim 4 or 5, characterized in that the user data includes characteristic data of the Mth time period and characteristic data of other time periods, the characteristic data includes characteristic values of multiple characteristics, and M is a positive integer; the electronic device obtains the user's sleep-aiding advice and the first sleep quality based on the user data, comprising: 所述电子设备基于针对所述目标特征的助眠建议,更新第M个时段的特征数据中所述目标特征的特征值,得到更新后的第M个时段的特征数据;The electronic device updates the feature value of the target feature in the feature data of the Mth time period based on the sleep aid suggestion for the target feature, and obtains the updated feature data of the Mth time period; 所述电子设备基于所述更新后的第M个时段的特征数据,得到更新后的第M个时段的睡眠影响因子;The electronic device obtains the updated sleep impact factor of the Mth period based on the updated characteristic data of the Mth period; 所述电子设备将更新后的第M个时段的睡眠影响因子和其它时段的睡眠影响因子作为输入,通过目标模型,得到所述第一睡眠质量;The electronic device uses the updated sleep impact factor of the Mth time period and the sleep impact factors of other time periods as input, and obtains the first sleep quality through the target model; 所述其它时段的睡眠影响因子是基于所述其它时段的特征数据得到的;所述目标模型是以样本睡眠影响因子为输入,以样本睡眠影响因子对应的睡眠质量为标签训练得到的。The sleep impact factors of other time periods are obtained based on the characteristic data of other time periods; the target model is trained using the sample sleep impact factors as input and the sleep quality corresponding to the sample sleep impact factors as labels. 7.根据权利要求2-6中任一项所述的方法,其特征在于,所述用户数据包括多个时段的特征数据,所述电子设备基于所述用户数据,得到第二睡眠质量,包括:7. The method according to any one of claims 2 to 6, wherein the user data includes characteristic data of multiple time periods, and the electronic device obtains the second sleep quality based on the user data, including : 所述电子设备基于所述多个时段中每一个时段的特征数据,得到所述每一个时段的睡眠影响因子;The electronic device obtains the sleep impact factor of each time period based on the characteristic data of each time period in the multiple time periods; 所述电子设备基于所述每一个时段的睡眠影响因子和目标模型,得到所述第二睡眠质量;The electronic device obtains the second sleep quality based on the sleep influencing factor and the target model of each time period; 所述目标模型是以样本睡眠影响因子为输入,以样本睡眠影响因子对应的睡眠质量为标签训练得到的。The target model is trained using the sample sleep influencing factors as input and the sleep quality corresponding to the sample sleep influencing factors as labels. 8.根据权利要求6或7所述的方法,其特征在于,预设时段内的睡眠影响因子包括体力消耗因子、精力消耗因子和临睡环境影响因子中的至少一个;8. The method according to claim 6 or 7, characterized in that the sleep influencing factors within the preset period include at least one of a physical consumption factor, an energy consumption factor and a sleeping environment influencing factor; 所述体力消耗因子是基于所述预设时段内心率、运动时长、步数、卡路里和活动小时数中的至少一项确定的;所述精力消耗因子是基于所述预设时段内血压、血氧、压力、咖啡因摄入量和酒精摄入量中的至少一项确定的;所述临睡环境影响因子是基于所述预设时段内环境光照和噪音分贝中的至少一项确定的。The physical exertion factor is determined based on at least one of the heart rate, exercise duration, number of steps, calories and activity hours in the preset time period; the energy exertion factor is determined based on at least one of the blood pressure, blood oxygen, stress, caffeine intake and alcohol intake in the preset time period; the sleep environment impact factor is determined based on at least one of the ambient light and noise decibels in the preset time period. 9.根据权利要求6-8中任一项所述的方法,其特征在于,所述方法还包括:9. The method according to any one of claims 6-8, characterized in that the method further includes: 所述电子设备获取预训练模型,所述预训练模型是基于所述用户所在群体的历史用户数据得到的;The electronic device acquires a pre-training model, where the pre-training model is obtained based on historical user data of the group to which the user belongs; 所述电子设备基于所述用户的历史用户数据对所述预训练模型进行训练,得到所述目标模型。The electronic device trains the pre-trained model based on the historical user data of the user to obtain the target model. 10.根据权利要求1-8中任一项所述的方法,其特征在于,所述电子设备响应于开始睡眠预测的用户操作,获取用户数据,包括:10. The method according to any one of claims 1 to 8, characterized in that the electronic device acquires user data in response to a user operation of starting sleep prediction, comprising: 所述电子设备响应于开始睡眠预测的用户操作,向服务器发送获取请求;The electronic device sends a request to the server in response to a user operation of starting sleep prediction; 所述电子设备接收所述服务器发送的所述用户数据,所述用户数据包括所述服务器从所述用户佩戴的设备获取的数据。The electronic device receives the user data sent by the server, where the user data includes data acquired by the server from a device worn by the user. 11.一种电子设备,其特征在于,所述电子设备包括一个或多个处理器和一个或多个存储器;其中,所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,使得所述电子设备执行如权利要求1-10中任一项所述的方法。11. An electronic device, characterized in that the electronic device comprises one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-10. 12.一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1-10中任一项所述的方法。12. A computer-readable storage medium comprising instructions, characterized in that, when the instructions are run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1-10.
CN202211178383.2A 2022-09-26 2022-09-26 A sleep quality prediction method, electronic device and system Pending CN117796760A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211178383.2A CN117796760A (en) 2022-09-26 2022-09-26 A sleep quality prediction method, electronic device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211178383.2A CN117796760A (en) 2022-09-26 2022-09-26 A sleep quality prediction method, electronic device and system

Publications (1)

Publication Number Publication Date
CN117796760A true CN117796760A (en) 2024-04-02

Family

ID=90418870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211178383.2A Pending CN117796760A (en) 2022-09-26 2022-09-26 A sleep quality prediction method, electronic device and system

Country Status (1)

Country Link
CN (1) CN117796760A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119818032A (en) * 2025-03-17 2025-04-15 爱梦睡眠(珠海)智能科技有限公司 Sleep quality assessment method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119818032A (en) * 2025-03-17 2025-04-15 爱梦睡眠(珠海)智能科技有限公司 Sleep quality assessment method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113794800B (en) Voice control method and electronic equipment
WO2020151387A1 (en) Recommendation method based on user exercise state, and electronic device
CN111316199B (en) Information processing method and electronic equipment
CN110825469A (en) Voice assistant display method and device
WO2020042112A1 (en) Terminal and method for evaluating and testing ai task supporting capability of terminal
CN109976626A (en) A kind of switching method and electronic equipment of application icon
CN113224804B (en) Charging control method and electronic device
WO2021052139A1 (en) Gesture input method and electronic device
CN114168065B (en) Method and device for adjusting memory configuration parameters
WO2021238460A1 (en) Risk pre-warning method, risk behavior information acquisition method, and electronic device
CN113177229B (en) Data processing method and related device
CN112671080A (en) Charging method and device
CN113284585A (en) Data display method, terminal device and storage medium
WO2021169370A1 (en) Method for cross-device allocation of service elements, terminal device, and storage medium
CN116048831B (en) Target signal processing method and electronic device
CN115525372B (en) Method and device for displaying interface
CN116070035B (en) Data processing methods and electronic equipment
CN113986369B (en) Internet of things equipment control method and system, electronic equipment and storage medium
CN117796760A (en) A sleep quality prediction method, electronic device and system
WO2025036044A1 (en) Resource scheduling method and apparatus, and electronic device
CN118402756A (en) Optimization method for monitoring sleep wakefulness and related electronic equipment
CN117234398A (en) Screen brightness adjusting method and electronic equipment
CN118689425A (en) Image synthesis method, device and electronic device
CN118155837A (en) Arrhythmia risk prediction method and related electronic equipment
CN118072723A (en) Cooperative awakening method, device and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination