Pet equipment voice control method and system based on intelligent switching
By monitoring network status parameters and state machine mechanisms, the voice control mode of pet devices can be intelligently switched, solving the problem of voice control failure of pet devices caused by network interruptions and achieving improved stability and convenience.
Patent Information
- Application Number
- CN202510975725.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-07-15
AI Technical Summary
The existing voice control mode of pet devices fails when the network is interrupted and lacks an intelligent switching mechanism, resulting in cumbersome operation and waste of resources, affecting device performance.
By monitoring the network connection status to generate network status parameters, the state machine mechanism is used to dynamically evaluate the device operation status, and the voice control mode is intelligently switched based on preset conditions. The core process and user interaction context are retained, and the target voice processing component is loaded for seamless switching.
It realizes intelligent adaptive switching of voice control modes of pet devices in network fluctuation scenarios, improves the stability and convenience of mode switching, and ensures the continuity of user interaction and efficient use of resources.
Smart Images

Figure CN120808775A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pet equipment, in particular to a pet equipment voice control method and system based on intelligent switching. BACKGROUND
[0002] The voice control function of the intelligent pet feeder is usually divided into online voice control and offline voice control modes. The online voice control relies on cloud voice recognition and natural language processing technology, and can realize high-precision voice recognition, complex instruction analysis, and cloud skill expansion, and other advanced interaction functions, but the device needs to maintain stable Wi-Fi connection. Once the network is interrupted or the signal is abnormal, the voice control function will be completely disabled, and the user can only control it through manual operation or a mobile phone APP, and the intelligent experience is greatly reduced. The offline voice control realizes basic control function through localized deployment of voice recognition model and instruction set, and has the characteristics of no need for networking and high reliability, but is limited by the device end computing power and storage space. Its recognition accuracy, instruction richness and intelligent interaction ability are significantly weaker than the online mode, and it is difficult to meet the user's demand for diversified voice control.
[0003] Due to the limitations of the above voice control modes, the following problems exist: the voice control is completely disabled when the network is interrupted, and the user may be inconvenienced or even face potential risks in emergency operation scenarios (such as immediately stopping feeding or querying the device status); only offline mode cannot provide advanced interaction functions enabled by the cloud, and the product intelligence level is limited, which cannot meet the user's demand; if both modes are supported but lack an intelligent switching mechanism, the user needs to manually switch modes or restart the device, which is tedious and prone to function abnormalities due to forgetting to switch, and the convenience is poor. Moreover, if there is a delay, state loss or function interruption during mode switching, it will destroy the continuity of the user experience, and running online and offline systems at the same time may waste embedded device resources (such as memory occupation, processor load, and increased power consumption), especially in resource-limited scenarios, affecting device performance.
[0004] Therefore, how to improve the stability and convenience of pet equipment voice control mode switching is a problem to be solved. SUMMARY
[0005] Therefore, how to improve the stability and convenience of pet equipment voice control mode switching is a problem to be solved.
[0006] In a first aspect, the present application provides a pet equipment voice control method based on intelligent switching, comprising:
[0007] The network connection state of the pet device is monitored to obtain network state parameters, which include a network signal stability indicator, a network connectivity state indicator, and an Internet access capability indicator;
[0008] The current running state of the pet device is obtained based on a state machine mechanism adopted by the pet device, and the current running state includes an online state, an offline state, and a switching state;
[0009] According to the preset adjustment condition associated with the current running state and the network state parameters, it is determined whether the pet device has a voice control mode adjustment requirement;
[0010] When the pet device has the voice control mode adjustment requirement, the pet device is adjusted to a target voice control mode according to the network state parameters and the preset adjustment condition, and the target voice control mode includes an online voice control mode and an offline voice control mode;
[0011] If a voice control instruction input by a user is received, a voice processing component corresponding to the target voice control mode is called to analyze the voice control instruction to obtain a control instruction of the pet device;
[0012] The control instruction is executed and an instruction execution result is output.
[0013] Optionally, the network connection state of the pet device is monitored to obtain network state parameters, which include:
[0014] The network signal receiving strength of the pet device is periodically detected to generate a signal strength sequence;
[0015] The signal strength sequence is continuously analyzed for stability, the signal strength fluctuation amplitude of adjacent detection periods is calculated, and the network signal stability indicator is generated based on the signal strength fluctuation amplitude;
[0016] Connectivity test data is sent to a preset network node, and the network connectivity state indicator is generated according to the round-trip transmission state of the connectivity test data, the network connectivity state indicator being used to indicate whether the network connection is normal;
[0017] The Internet access capability indicator is generated according to an access response result of a preset Internet address, the Internet access capability indicator being used to indicate whether the pet device can normally access a cloud service;
[0018] The network state change event of the pet device is listened to, and the network signal stability indicator, the network connectivity state indicator, and the Internet access capability indicator are updated according to the network state change event to generate updated network state parameters.
[0019] Optionally, the determining whether the pet device has the voice control mode adjustment requirement according to the preset adjustment condition associated with the current running state and the network state parameter comprises:
[0020] selecting a corresponding target adjustment condition set from the preset adjustment condition according to the current running state, the target adjustment condition set containing a plurality of condition items matched with the current running state, each condition item being associated with a judgment standard of at least one index in the network state parameter, the judgment standard comprising an index normal range description and an index abnormal range description;
[0021] extracting the network signal stability index, the network connectivity state index and the internet access capability index from the network state parameter to obtain a set of to-be-evaluated network indexes, each index in the set of to-be-evaluated network indexes having a one-to-one correspondence with the condition item in the target adjustment condition set;
[0022] matching each index in the set of to-be-evaluated network indexes with the corresponding condition item in the target adjustment condition set to generate a matching result of each index, the matching result comprising an index meeting a condition item and an index not meeting a condition item; wherein when the actual value of the index is within the index normal range description of the condition item, the matching result of the index meeting the condition item is generated, and when the actual value of the index is within the index abnormal range description of the condition item, the matching result of the index not meeting the condition item is generated;
[0023] performing logical combination processing on the matching results of a plurality of indexes according to a condition combination rule corresponding to the current running state to generate a combination judgment result, the condition combination rule containing a combination mode of logical and and logical or of index matching results under different running states;
[0024] when the combination judgment result meets a preset trigger condition, determining that the pet device has the voice control mode adjustment requirement;
[0025] when the combination judgment result does not meet the preset trigger condition, determining that the pet device does not have the voice control mode adjustment requirement.
[0026] Optionally, the adjusting the pet device to a target voice control mode according to the network state parameter and the preset adjustment condition comprises:
[0027] when the current voice control mode of the pet device is the offline voice control mode, if the network signal stability indicator represents that the network signal stability meets the preset stability condition, the network connectivity state indicator represents that the network connectivity is normal, and the internet access capability indicator represents that the internet can be accessed, the pet device is adjusted to the online voice control mode;
[0028] loading a first voice processing component corresponding to the online voice control mode, the first voice processing component including an online voice recognition model and an online voice instruction set;
[0029] unloading a second voice processing component corresponding to the offline voice control mode, the second voice processing component including an offline voice recognition model and an offline voice instruction set.
[0030] Optionally, the adjusting the pet device to the target voice control mode according to the network state parameter and the preset adjustment condition comprises:
[0031] when the current voice control mode of the pet device is the online voice control mode, if the network signal stability indicator represents that the network signal stability does not meet the preset stability condition, or the network connectivity state indicator represents that the network connectivity is abnormal, or the internet access capability indicator represents that the internet cannot be accessed, the pet device is adjusted to the offline voice control mode;
[0032] loading a second voice processing component corresponding to the offline voice control mode, the second voice processing component including an offline voice recognition model and an offline voice instruction set;
[0033] unloading a first voice processing component corresponding to the online voice control mode, the first voice processing component including an online voice recognition model and an online voice instruction set.
[0034] Optionally, the calling the voice processing component corresponding to the target voice control mode to analyze the voice control instruction to obtain the control instruction of the pet device comprises:
[0035] converting a voice control instruction received by a voice collection unit into a digital audio signal, and pre-processing the digital audio signal to generate a pre-processed audio feature sequence;
[0036] inputting the audio feature sequence into a voice recognition model of the voice processing component to generate a text instruction sequence after processing, the text instruction sequence including continuous lexical units;
[0037] extracting a core control intent word and an associated parameter word from the text instruction sequence to obtain a to-be-matched instruction unit;
[0038] loading a standard instruction template set corresponding to the target voice control mode in a voice instruction set of the voice processing component, the standard instruction template set containing preset standard control intent words and parameter format descriptions;
[0039] calculating similarity between the to-be-matched instruction unit and each standard instruction template in the standard instruction template set, and determining a standard instruction template with the highest similarity as a target standard instruction template;
[0040] taking the standard control intent words of the target standard instruction template as an instruction type identifier, and generating a structured control instruction in combination with the parameter format description of the target standard instruction template.
[0041] Optionally, when the pet device exists the voice control mode adjustment demand, according to the network state parameter and the preset adjustment condition, the pet device is adjusted to a target voice control mode, comprising:
[0042] after determining that the pet device exists the voice control mode adjustment demand, suspending a non-key task process currently being executed, and reserving a core process related to voice control, the core process including a voice collection process, an instruction analysis process and an instruction execution process;
[0043] collecting device parameters of the pet device, the device parameters including a current working mode parameter, a user self-defined setting parameter and a record of a control instruction executed last time;
[0044] extracting user interaction context data in a preset time period, the user interaction context data including a history record of voice control instructions input by the user, a response feedback record of the pet device and a time sequence of user-device interaction;
[0045] storing the device parameters and the user interaction context data into a local state cache file, the state cache file being stored in a key-value pair structure, wherein a key in the key-value pair is a parameter name, and a value in the key-value pair is a parameter value;
[0046] loading a voice processing component corresponding to the target voice control mode, wherein the running of the core process is prohibited during the loading;
[0047] after the voice processing component corresponding to the target voice control mode is loaded, reading the device parameters and the user interaction context data from the state cache file, and replacing an initial working mode parameter of the target voice control mode with the device parameters and inputting the user interaction context data into an instruction analysis process of the target voice control mode;
[0048] Resuming the non-critical task process that is suspended.
[0049] Optionally, the executing the control instruction and outputting an instruction execution result comprises:
[0050] When the pet device is in the offline voice control mode, an independent instruction cache area is divided in a local storage unit of the pet device, a local instruction queue for storing the parsed control instruction is established, and the local instruction queue uses a first-in first-out order to manage the control instruction.
[0051] The control instruction is added to the tail of the local instruction queue.
[0052] A target control instruction is taken out from the head of the local instruction queue according to the first-in first-out order of the local instruction queue, and a hardware drive interface of the pet device is called to execute the target control instruction.
[0053] During the execution of the target control instruction, an execution status code returned by the hardware drive interface is monitored in real time, and when the execution status code represents that the target control instruction is executed, the instruction execution result containing an instruction type identification field and the execution status code is generated.
[0054] The instruction execution result is fed back to the user in at least one of a preset light flashing mode, a screen text display, or a local voice prompt.
[0055] Optionally, the method further comprises:
[0056] If the pet device triggers switching from the offline voice control mode to the online voice control mode, a background synchronization operation is started to encrypt and package the executed control instruction and the corresponding instruction execution result in the local instruction queue to generate a synchronization data packet.
[0057] The synchronization data packet is sent to a preset cloud server, the cloud server analyzes the synchronization data packet, and updates the device state parameter stored in the cloud server.
[0058] A state correction instruction returned by the cloud server is received, and the local state parameter of the pet device is adjusted according to the state correction instruction, so that the local state parameter is consistent with the device state parameter stored in the cloud server, and the state correction instruction contains difference information between the device state parameter and the local state parameter.
[0059] In a second aspect, the present application provides a pet device voice control system based on intelligent switching, comprising a machine readable storage medium and a processor, the machine readable storage medium stores machine executable instructions, and the processor, when executing the machine executable instructions, implements the pet device voice control method based on intelligent switching as described above.
[0060] The pet device voice control method and system based on intelligent switching provided by the present application generates a network state parameter by monitoring the network signal stability, connectivity state and Internet access capability of the pet device, obtains the current running state of the device in combination with the state machine mechanism, and dynamically evaluates whether switching of the voice control mode is needed based on the index judgment criteria and logic combination rules corresponding to different states in the preset adjustment conditions; when switching is needed, the core process is retained, the device parameters and user interaction context are cached to a local state file, the voice processing component corresponding to the target mode is loaded and the non-critical tasks are restored, seamless mode switching is achieved; when the voice instruction is parsed, the preprocessed audio feature sequence is input into the voice recognition model of the target mode to generate a text instruction, and the structured control instruction is extracted by matching the standard instruction template; in the execution stage, the local instruction queue is managed in a first-in-first-out manner in the offline mode, the hardware execution state is monitored in real time and the results are fed back, and at the same time, the offline execution data is uploaded to the cloud through the background synchronization mechanism to correct the local state. This method combines multi-dimensional network state monitoring with the state machine to accurately determine the switching time to avoid misoperation, and through core process reservation and state caching, it ensures that instructions are not lost and user interaction is continuous during the switching process, and through modular component loading and instruction parsing optimization, it adapts to the control requirements in different network environments, improves the response efficiency in offline scenarios through local queue and real-time feedback, and ensures state consistency through cloud synchronization. Thus, intelligent adaptive switching of the pet device voice control mode in network fluctuation scenarios is achieved, and the stability and convenience of the pet device voice control mode switching are improved. BRIEF DESCRIPTION OF DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] Figure 1 A flowchart of a pet device voice control method based on intelligent switching provided by an embodiment of the present application;
[0063] Figure 2 A structural diagram of a pet device voice control system based on intelligent switching provided by an embodiment of the present application.
[0064] The specific embodiments of the present application have been shown by the above drawings, and will be described in more detail hereinafter. These drawings and the written description are not intended to restrict the scope of the present application concept in any way, but to illustrate the present application concept to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0065] In order to make the technical personnel in the art better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. According to the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0066] The terms "first", "second", and the like in the specification and claims of the present application and the above drawings are used to distinguish different objects, not to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or end.
[0067] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearance of the phrase in various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive of other embodiments. It is explicitly and implicitly understood that the embodiments described herein can be combined with other embodiments.
[0068] Figure 1 A flowchart of a pet device voice control method based on intelligent switching provided by the embodiments of the present application is shown. It should be understood that in other embodiments, the order of some steps of the pet device voice control method based on intelligent switching of the present embodiment can be shared according to actual needs, or some steps can be omitted or maintained. As shown in the figure, the method can include the following steps: Figure 1
[0069] Step S110: Monitor the network connection state of the pet device to obtain a network state parameter.
[0070] The network state parameter includes a network signal stability indicator, a network connectivity state indicator, and an Internet access capability indicator.
[0071] In this step, you need to monitor the network connection status of your pet device in all directions to obtain network status parameters that accurately reflect the network status. The following is the specific operation process:
[0072] Step S111: regularly detecting the network signal reception strength of the pet device and generating a signal strength sequence.
[0073] In order to accurately grasp the changes in the network signal reception strength of the pet device, it is necessary to detect it at fixed time intervals. Assuming that the set time interval is T (for example, it can be 1 second, 5 seconds, 30 seconds, 1 minute, 5 minutes, etc.), the network signal reception strength of the pet device is measured once every time T passes. For example, the signal strength indicator (RSSI) value received by the network module (such as the Wi-Fi module) of the pet device can be regularly detected to determine the strength of the network signal (such as the Wi-Fi signal). Too low signal strength may indicate that the network connection is unstable or is about to be disconnected.
[0074] In actual operation, the obtained signal strength values can also be recorded. The signal strength values obtained by multiple measurements form a signal strength sequence. For example, assuming that the signal strength sequence is S = {S1, S2, S3, ..., S n}, where S i Represents the network signal reception strength obtained during the i-th detection. n represents the total number of detections, and the value of n increases over time.
[0075] Step S112: performing continuous stability analysis on the signal strength sequence, calculating the signal strength fluctuation amplitudes of adjacent detection cycles, and generating the network signal stability index based on the signal strength fluctuation amplitudes.
[0076] After obtaining the signal strength sequence, a continuous stability analysis is performed on it. For example, the stability of the network signal can be evaluated by calculating the signal strength fluctuation amplitude between adjacent detection cycles.
[0077] For two adjacent values S in the signal strength sequence S i and S i+1 , the method to calculate the fluctuation range between them is to take the absolute value of the difference. That is, the fluctuation range ΔS i =|S i -S i+1 |. In this way, a series of fluctuation amplitude values can be obtained, which can be recorded as ΔS={ΔS1,ΔS2,ΔS3,…,ΔS n-1}.
[0078] Next, the network signal stability index is generated based on these fluctuation amplitude values. For example, various methods can be used to calculate, such as calculating the average value, variance, standard deviation, etc. of the fluctuation amplitude values. Taking the average value as an example, let the network signal stability index be St, then St=(ΔS1+ΔS2+…+ΔS n-1 ) / (n-1). The average value can reflect the overall fluctuation level. The smaller the average value of the fluctuation amplitude, the more stable the network signal; otherwise, it means that the network signal stability is poor. Taking variance as an example, for the fluctuation amplitude value sequence ΔS, let its variance be Vt. First calculate the average value St of the fluctuation amplitude value, and then use the variance calculation formula Vt=[(ΔS1-St) 2 +(ΔS2-St) 2 +…+(ΔS n-1 -St) 2 ] / (n-1) to calculate the variance. A larger variance indicates a greater dispersion of fluctuations and a worse network signal stability; a smaller variance indicates a better network signal stability.
[0079] Step S113: Sending connectivity test data to a preset network node, generating the network connectivity status indicator according to the round-trip transmission status of the connectivity test data, wherein the network connectivity status indicator is used to indicate whether the network connection is normal.
[0080] In this step, connectivity test data is sent to a pre-defined network node. The pre-defined network node is a selected, representative network node, such as a network server or other reliable network endpoint that is close to the pet device. For example, ping packets can be periodically sent to a Wi-Fi router or pre-defined internet server to check network connectivity. The ping test can determine whether the device can successfully connect to the Wi-Fi network and the network latency.
[0081] When sending connectivity test data, you can record the time t1 when the data is sent. When receiving test data returned from a preset network node, record the reception time t2. By calculating the round-trip time (RTT) = t2 - t1, you can preliminarily determine the network connectivity. You can also check whether the returned test data is complete and accurate.
[0082] If the round-trip time RTT is within the preset normal time range, and the returned test data is not lost, damaged, etc., it indicates that the network connection is normal. At this time, the network connectivity state indicator Cc can be set to a value representing normal, for example, represented by "1". If the round-trip time is too long, exceeds the preset threshold, or the returned test data has problems, such as incomplete data, check error, etc., it indicates that the network connection is abnormal. At this time, the network connectivity state indicator Cc can be set to a value representing abnormal, for example, represented by "0".
[0083] Step S114: Accessing a preset Internet address and generating the Internet access capability indicator according to the access response result, the Internet access capability indicator being used to indicate whether the pet device can normally access the cloud service.
[0084] In this step, a preset Internet address can be accessed, which can be a specific address related to the cloud service (such as the cloud server address corresponding to the pet device), which is specially set for testing the pet device's access capability to the cloud service.
[0085] During the access process, the time t3 of sending the access request can be recorded. If a valid response result is received within a preset time, for example, the expected web page content, data information, etc. is returned, and the format and content of the response result meet the requirements, it indicates that the pet device can normally access the cloud service. At this time, the Internet access capability indicator Ic can be set to a value representing that it can be accessed, for example, represented by "1".
[0086] If no response is received within the preset time, or the received response result does not meet the requirements, such as returning an error code, the page cannot be opened, etc., it indicates that the pet device cannot normally access the cloud service. At this time, the Internet access capability indicator Ic can be set to a value representing that it cannot be accessed, for example, represented by "0".
[0087] Step S115: Listening to network state change events of the pet device, updating the network signal stability indicator, the network connectivity state indicator, and the Internet access capability indicator according to the network state change events, and generating updated network state parameters.
[0088] During the running of the pet device, network state change events can also be continuously listened to. Network state change events can include sudden large changes in network signal strength, network connection interruption and reconnection, inability to access a preset Internet address, etc.
[0089] When a network state change event is detected, the network signal stability indicator, the network connectivity state indicator and the Internet access capability indicator need to be recalculated. For example, if a sudden change in network signal strength is detected, the fluctuation amplitude and stability indicator of the signal strength sequence need to be recalculated; if the network connection is reconnected after being disconnected, connectivity test data needs to be sent to the preset network node again to update the network connectivity state indicator; if the preset Internet address cannot be accessed, access test needs to be performed again to update the Internet access capability indicator.
[0090] The updated network signal stability indicator, the network connectivity state indicator and the Internet access capability indicator are combined to generate an updated network state parameter Np={St', Cc', Ic'}, where St' is the updated network signal stability indicator, Cc' is the updated network connectivity state indicator, and Ic' is the updated Internet access capability indicator.
[0091] Step S120: Obtain the current running state of the pet device based on the state machine mechanism adopted by the pet device.
[0092] The current running state includes an online state, an offline state and a switching state.
[0093] The pet device adopts a state machine mechanism to manage its running state. The state machine is a mechanism that can perform state conversion according to different input conditions and current states.
[0094] In this step, the current running state of the pet device can be obtained by querying the state machine of the pet device. The state machine will perform state judgment and conversion according to the network connection status and system running status of the pet device.
[0095] If the pet device successfully connects to the network and can normally access the cloud service, the state machine sets the state of the pet device to the online state; if the pet device is disconnected from the network and cannot access the cloud service, the state machine sets its state to the offline state; when the pet device is in the process of switching from the online state to the offline state or from the offline state to the online state, the state machine sets its state to the switching state.
[0096] Optionally, the running state can also be displayed in a visual manner, for example, outputting state prompt information (such as displaying the online state, the offline state, switching to the offline state, switching to the online state, the switching state, etc.) on the display screen of the pet device, or outputting the state prompt information in voice, or outputting the state prompt information through different indicator lights, different colors of indicator lights, etc. on the pet device, or outputting the state prompt information to the application interface of the terminal device (such as a mobile phone, a computer, a smart wearable device, etc.) of the user, etc.
[0097] Step S130: According to the preset adjustment condition associated with the current running state and the network state parameter, determine whether the pet device has voice control mode adjustment demand.
[0098] This step needs to combine the current running state of the pet device and the preset adjustment condition and the network state parameter to judge whether the voice control mode needs to be adjusted. The specific process is as follows:
[0099] Step S131: According to the current running state, select the corresponding target adjustment condition set from the preset adjustment condition set, the target adjustment condition set contains a plurality of condition items matched with the current running state, each condition item is associated with the judgment standard of at least one index in the network state parameter, and the judgment standard includes index normal range description and index abnormal range description.
[0100] For different current running states, the corresponding adjustment condition set is set in advance. When the current running state of the pet device is obtained, the target adjustment condition set corresponding to the current running state is selected from the preset adjustment condition set.
[0101] For example, when the pet device is in online state, the corresponding target adjustment condition set may contain a plurality of condition items for network signal stability index, network connectivity state index and internet access capability index. For the network signal stability index, the judgment standard may stipulate that its normal range is that the average value of fluctuation amplitude is less than a threshold A, and the abnormal range is that the average value of fluctuation amplitude is greater than or equal to the threshold A; for the network connectivity state index, the normal range is that the index value is "1", indicating that the network connection is normal, and the abnormal range is that the index value is "0", indicating that the network connection is abnormal; for the internet access capability index, the normal range is that the index value is "1", indicating that the cloud service can be accessed normally, and the abnormal range is that the index value is "0", indicating that the cloud service cannot be accessed.
[0102] Step S132: Extract the network signal stability index, the network connectivity state index and the internet access capability index from the network state parameter to obtain the set of network indicators to be evaluated, each index in the set of network indicators to be evaluated has a one-to-one correspondence with the condition item in the target adjustment condition set.
[0103] The network signal stability index St, the network connectivity state index Cc and the internet access capability index Ic are extracted from the network state parameter obtained before to form the set of network indicators to be evaluated Ni={St,Cc,Ic}.
[0104] Each index in the set of network indicators to be evaluated corresponds to a condition item in the set of target adjustment conditions. For example, the network signal stability indicator St corresponds to the condition item about network signal stability in the set of target adjustment conditions, the network connectivity state indicator Cc corresponds to the condition item about network connectivity, and the internet access capability indicator Ic corresponds to the condition item about internet access capability.
[0105] Step S133: Matching each index in the set of network indicators to be evaluated with the corresponding condition item in the set of target adjustment conditions to generate a matching result for each index, which includes an index meeting a condition item and an index not meeting a condition item.
[0106] When the actual value of the index is within the index normal range description of the condition item, a matching result of the index meeting the condition item is generated. When the actual value of the index is within the index abnormal range description of the condition item, a matching result of the index not meeting the condition item is generated.
[0107] For each index in the set of network indicators to be evaluated, its actual value is compared with the corresponding condition item in the set of target adjustment conditions.
[0108] Taking the network signal stability indicator St as an example, if the value of St is less than the threshold A of the average value of fluctuation amplitude normal range specified in the set of target adjustment conditions, a matching result of the network signal stability indicator meeting the condition item is generated. If the value of St is greater than or equal to the threshold A, a matching result of the network signal stability indicator not meeting the condition item is generated.
[0109] For the network connectivity state indicator Cc, if the value of Cc is “1”, which meets the description of the network connectivity normal range in the set of target adjustment conditions, a matching result of the network connectivity state indicator meeting the condition item is generated. If the value of Cc is “0”, a matching result of not meeting the condition item is generated.
[0110] For the internet access capability indicator Ic, if the value of Ic is “1”, which meets the description of the internet access capability normal range in the set of target adjustment conditions, a matching result of the internet access capability indicator meeting the condition item is generated. If the value of Ic is “0”, a matching result of not meeting the condition item is generated.
[0111] Step S134: According to the condition combination rule corresponding to the current running state, logically combining the matching results of the plurality of indexes to generate a combined judgment result, and the condition combination rule includes the combination mode of logical AND and logical OR of the index matching results under different running states.
[0112] Different current running states correspond to different condition combination rules. These rules specify how to logically combine the matching results of various indicators.
[0113] For example, when the pet device is in an online state, the condition combination rule can specify that the matching results of all indicators need to be condition items to make the combined judgment result meet the condition; that is, the network signal stability indicator meets the condition item, the network connectivity state indicator meets the condition item, and the Internet access capability indicator meets the condition item, and the combination is combined by logical AND. Only when all three conditions are met, the combined judgment result is true.
[0114] When the pet device is in an offline state, the condition combination rule can specify that as long as the matching result of one of the network signal stability indicator, the network connectivity state indicator, and the Internet access capability indicator is a condition item, the combined judgment result is a condition item, and the combination is combined by logical OR.
[0115] Step S135: When the combined judgment result meets the preset trigger condition, it is determined that the pet device has the voice control mode adjustment requirement; when the combined judgment result does not meet the preset trigger condition, it is determined that the pet device does not have the voice control mode adjustment requirement.
[0116] The preset trigger condition is pre-set according to the actual application scene and design requirements. If the combined judgment result obtained after logical combination processing meets the preset trigger condition, for example, the combined judgment result is true, then it can be determined that the pet device has the voice control mode adjustment requirement; if the combined judgment result does not meet the preset trigger condition, for example, the combined judgment result is false, then it is determined that the pet device does not have the voice control mode adjustment requirement.
[0117] Step S140: When the pet device has the voice control mode adjustment requirement, the pet device is adjusted to a target voice control mode according to the network state parameter and the preset adjustment condition, and the target voice control mode includes an online voice control mode and an offline voice control mode.
[0118] When it is determined that the pet device has the voice control mode adjustment requirement, the pet device needs to be adjusted to a suitable target voice control mode according to the network state parameter and the preset adjustment condition. Specifically, there are two cases:
[0119] Case 1: When the pet device is currently in an offline voice control mode
[0120] First, when the current voice control mode of the pet device is the offline voice control mode, if the network signal stability indicator represents that the network signal stability meets the preset stability condition, the network connectivity state indicator represents that the network connectivity is normal, and the internet access capability indicator represents that the internet can be accessed, the pet device is adjusted to the online voice control mode.
[0121] When the pet device is in the offline voice control mode, the network state parameters can be used for judgment. If the network signal stability indicator St is less than the preset fluctuation amplitude average threshold A, it means that the network signal stability meets the preset stability condition; the network connectivity state indicator Cc is "1", indicating that the network connectivity is normal; the internet access capability indicator Ic is "1", indicating that the internet can be accessed. When the three conditions are met at the same time, the voice control mode of the pet device is adjusted from the offline voice control mode to the online voice control mode.
[0122] Secondly, the first voice processing component corresponding to the online voice control mode is loaded, and the first voice processing component includes an online voice recognition model and an online voice instruction set.
[0123] After determining to adjust the pet device to the online voice control mode, the first voice processing component corresponding to the online voice control mode needs to be loaded. The first voice processing component includes an online voice recognition model and an online voice instruction set.
[0124] The online voice recognition model is trained by a large amount of data and can accurately convert voice signals into text information. It can use the powerful computing resources of the cloud for voice recognition processing, and the recognition accuracy is high. The online voice instruction set includes various instruction templates and control intent descriptions related to the online voice control mode. For example, the online voice recognition model and the online voice instruction set can use more complex models and richer instruction sets to provide more powerful voice recognition and semantic understanding capabilities. The online voice instruction set can cover a wider range of functions, such as timed feeding, custom feeding amount, remote monitoring control, cloud skill expansion, etc.
[0125] When loading the first voice processing component, the pet device can download the online voice recognition model and the online voice instruction set from the cloud server and load them into the system memory for subsequent voice control processing.
[0126] Finally, the second voice processing component corresponding to the offline voice control mode is unloaded, and the second voice processing component includes an offline voice recognition model and an offline voice instruction set.
[0127] After loading the first voice processing component corresponding to the online voice control mode, the second voice processing component corresponding to the offline voice control mode can be unloaded to save system resources. The second voice processing component includes an offline voice recognition model and an offline voice instruction set.
[0128] The offline voice recognition model is locally run and has relatively low recognition accuracy due to limited computing resources. The offline voice instruction set is a command template and control intent description specially designed for the offline voice control mode. When the second voice processing component is unloaded, the related resources occupied in the system memory are released, and the running efficiency of the system is improved.
[0129] Optionally, the offline voice recognition model and the instruction set can be simplified. For example, the model size and resource occupation of the offline voice recognition model can be reduced (for example, important weights or neurons in the model are removed in a model pruning manner to reduce the number of parameters; or a more simplified offline voice recognition model is obtained through knowledge distillation), to ensure smooth running on devices with limited resources. For another example, the offline instruction set can only include basic instructions that are most commonly used by the user, such as "feed", "stop", "check status", etc., and a hash table or index tree data structure can be used to construct an instruction index table to realize fast keyword search and instruction mapping. Since the hash table and the index tree have an average time complexity of O(1) or O(logn) for searching, the instruction mapping delay can be significantly reduced.
[0130] Optionally, the second voice processing component corresponding to the offline voice control mode can be unloaded first, and then the first voice processing component corresponding to the online voice control mode is loaded.
[0131] Case two: when the pet device is currently in the online voice control mode
[0132] First, when the current voice control mode of the pet device is the online voice control mode, if the network signal stability indicator represents that the network signal stability does not meet the preset stability condition, or the network connectivity state indicator represents that the network connectivity is abnormal, or the Internet access capability indicator represents that the Internet cannot be accessed, the pet device is adjusted to the offline voice control mode.
[0133] When the pet device is in the online voice control mode, the network state parameters are continuously monitored. If the network signal stability indicator St is greater than or equal to the preset fluctuation amplitude average threshold A, it indicates that the network signal stability does not meet the preset stability condition; or the network connectivity state indicator Cc is "0", indicating that the network connectivity is abnormal; or the Internet access capability indicator Ic is "0", indicating that the Internet cannot be accessed. As long as one of the conditions is met, the voice control mode of the pet device is adjusted from the online voice control mode to the offline voice control mode.
[0134] Secondly, load the second voice processing component corresponding to the offline voice control mode, the second voice processing component including an offline voice recognition model and an offline voice instruction set.
[0135] After determining that the pet device is to be adjusted to the offline voice control mode, the second voice processing component corresponding to the offline voice control mode needs to be loaded. As mentioned above, the second voice processing component includes an offline voice recognition model and an offline voice instruction set.
[0136] When the second voice processing component is loaded, the pet device reads the offline voice recognition model and the offline voice instruction set from the local storage and loads them into the system memory to support the offline voice control function.
[0137] Finally, unload the first voice processing component corresponding to the online voice control mode, the first voice processing component including an online voice recognition model and an online voice instruction set.
[0138] After the second voice processing component corresponding to the offline voice control mode is loaded, in order to save system resources, the first voice processing component corresponding to the online voice control mode needs to be unloaded. When the first voice processing component is unloaded, the resources occupied by the online voice recognition model and the online voice instruction set in the system memory are released, ensuring that the system can stably run in the offline voice control mode.
[0139] Optionally, during the adjustment to the target voice control mode, shared resources (such as shared instruction sets) and modules (such as an audio preprocessing module, a feature extraction module, etc.) between the voice control mode before the adjustment and the target voice control mode can be reused to further reduce resource occupation and improve resource utilization.
[0140] In a possible implementation, the method can further include the following steps:
[0141] Step S141: After determining that the pet device has a voice control mode adjustment requirement, suspend a non-key task process that is currently being executed, and retain a core process related to voice control, the core process including a voice collection process, an instruction analysis process, and an instruction execution process.
[0142] When it is determined that the pet device needs to be adjusted in voice control mode, in order to ensure the smooth progress of the adjustment process, the processes in the system need to be managed. Suspend the non-critical task processes that are currently being executed, which may include some background data synchronization tasks, system update check tasks, etc., and their temporary stop will not affect the voice control function of the pet device. At the same time, the core processes related to voice control, such as the voice collection process, the instruction analysis process and the instruction execution process, are retained. The voice collection process is responsible for real-time collection of user voice control instructions, the instruction analysis process analyzes and converts the collected voice instructions, and the instruction execution process controls the pet device to execute corresponding operations according to the analyzed instructions. When suspending non-critical task processes, a suspend signal can be sent to these processes through the process management mechanism of the system to make them enter the suspended state and wait for the voice control mode adjustment to be completed before resuming operation. For core processes, it is necessary to ensure that they continue to run stably during the entire mode adjustment process to ensure that the user's voice control experience is not affected.
[0143] Step S142: Collecting device parameters of the pet device, the device parameters including current working mode parameters, user-defined setting parameters, and records of the last executed control instruction.
[0144] When adjusting the voice control mode, the device parameters of the pet device need to be collected. The current working mode parameters reflect the running state of the pet device before the mode adjustment, such as whether it is in feeding mode, playing mode or resting mode, etc. The user-defined setting parameters include the personalized settings of the pet device made by the user according to their own needs, such as the time interval of feeding, the duration of playing, etc. The records of the last executed control instruction record the specific control instruction content of the pet device last time, which helps to restore to the appropriate working state after mode adjustment. Collecting these device parameters can obtain relevant information by accessing the system storage area of the pet device. For the current working mode parameters, they can be read from the system state register; the user-defined setting parameters are usually stored in the configuration file of the device and can be obtained through file reading operation; the records of the last executed control instruction can be extracted from the instruction execution log.
[0145] Step S143: Extracting user interaction context data within a preset time period, the user interaction context data including the user input voice control instruction history record, the pet device response feedback record, and the user-device interaction time sequence.
[0146] The preset time period is set to obtain recent user interaction information related to the current voice control mode adjustment. The history record of the voice control instruction input by the user records all voice instruction contents issued by the user to the pet device within the preset time period, which can help the new voice control mode to better understand the user's intention and habit based on the historical voice control instruction and the context semantic relationship between the newly issued voice control instruction. The response feedback record of the pet device records the response of the device to the user's voice instruction, such as whether the instruction is successfully executed, how the execution result is, etc. The interaction time sequence of the user and the device records the specific time of each interaction, and by analyzing the time sequence, the user's usage rule and habit can be understood. Extracting these user interaction context data can be achieved by querying the interaction log database of the pet device. In the database, the relevant records within the preset time period are filtered according to the time range, and are sorted into the corresponding data structure for subsequent storage and use.
[0147] Step S144: storing the device parameters and the user interaction context data into a local state cache file, the state cache file adopting a key-value pair structure for storage.
[0148] The key in the key-value pair is a parameter name, and the value in the key-value pair is a parameter value.
[0149] The collected device parameters and the extracted user interaction context data are stored in the local state cache file, and the key-value pair structure can facilitate data storage and reading. For the device parameters, for example, the current working mode parameter can be represented by the key "current_mode", and the corresponding value is the specific working mode name; the user-defined setting parameter can be represented by different keys according to different setting items, such as "feeding_interval" representing the feeding time interval, and the corresponding value is the specific time interval set by the user. For the user interaction context data, the history record of the voice control instruction input by the user can be represented by the key "voice_command_history", and the corresponding value is a list containing all historical instructions; the response feedback record of the pet device can be represented by the key "response_feedback_history", and the corresponding value is also a list containing all response feedback information; the interaction time sequence of the user and the device can be represented by the key "interaction_time_sequence", and the corresponding value is a list of time stamps arranged in time sequence. By storing these data in the state cache file in the form of key-value pairs, data reading and use can be facilitated in the subsequent mode adjustment process.
[0150] Step S145: Loading the voice processing component corresponding to the target voice control mode, wherein interruption of the core process is prohibited during the loading process.
[0151] After data collection and storage are complete, the voice processing components corresponding to the target voice control mode begin loading. If the target voice control mode is online, the loaded voice processing components include the online voice recognition model and the online voice command set. If the target voice control mode is offline, the offline voice recognition model and the offline voice command set are loaded. During the loading process, interrupting the core processes related to voice control is prohibited.
[0152] For example, the system's resource allocation mechanism can be used to allocate sufficient system resources to core processes, ensuring they can continue to operate stably while the voice processing component is loading. Furthermore, the voice processing component can be loaded asynchronously, allowing the loading operation to proceed in the background without affecting the normal operation of the core process. During the loading process, the loading progress can be monitored in real time, and a corresponding notification signal will be issued upon completion.
[0153] Step S146: After the voice processing component corresponding to the target voice control mode is loaded, the device parameters and the user interaction context data are read from the status cache file, and the initial working mode parameters of the target voice control mode are replaced with the device parameters, and the user interaction context data is input into the instruction parsing process of the target voice control mode.
[0154] After the speech processing component corresponding to the target voice control mode is loaded, the previously stored device parameters and user interaction context data are read from the local state cache file. The initial working mode parameters of the target voice control mode are replaced with the current working mode parameters in the read device parameters. This allows the pet device to restore its previous working state under the new voice control mode, avoiding the impact of mode switching on the pet device's working consistency.
[0155] At the same time, the user interaction context data can be input into the command parsing process of the target voice control mode. The command parsing process can better understand the user's voice control commands based on these historical data. For example, the pet device can more accurately parse the semantics of the voice control commands issued after switching to the target voice control mode based on the contextual relationship between the voice control commands issued by the user before switching to the target voice control mode and the voice control commands issued after switching to the target voice control mode, thereby reducing the reduction in voice control command parsing accuracy and efficiency caused by mode switching.
[0156] When reading the state cache file, the corresponding data can be obtained in the structure of key-value pairs through a file reading operation, and converted into a suitable data type and format for subsequent use.
[0157] Step S147: resume the non-critical task processes that are suspended.
[0158] After the voice processing component corresponding to the target voice control mode is loaded and the device parameters and user interaction context data have been correctly applied to the new mode, the non-critical task processes that were previously suspended are resumed. For example, a resume signal can be sent to these suspended processes through the process management mechanism of the system, so that they are restored from the suspended state to the normal running state. When these processes are resumed, it is necessary to ensure that these processes are compatible with the new voice control mode and will not interfere with the voice control function. At the same time, according to the resource usage of the system, resources can be reasonably allocated to these non-critical task processes that are running again, so as to ensure the stable operation of the entire pet device system.
[0159] Step S150: if a voice control instruction input by the user is received, call the voice processing component corresponding to the target voice control mode to parse the voice control instruction, and obtain the control instruction of the pet device.
[0160] When the pet device receives a voice control instruction input by the user, the voice processing component corresponding to the target voice control mode needs to be called to parse the instruction, so as to obtain a specific instruction that can control the pet device. The specific process is as follows:
[0161] Step S151: convert the voice control instruction received through the voice collection unit into a digital audio signal, and pre-process the digital audio signal to generate a pre-processed audio feature sequence.
[0162] The voice collection unit can be a microphone built into the pet device, for example, which is responsible for collecting the user's voice control instructions. The collected voice signal is an analog signal that needs to be converted into a digital audio signal. The analog voice signal can be converted into a digital audio signal through an analog-to-digital converter (ADC). The converted digital audio signal can contain some noise and interference, so further preprocessing operations can be performed. The preprocessing steps include filtering, noise reduction, normalization, etc. Filtering operations can remove high-frequency noise and low-frequency interference in the signal, making the signal purer. Noise reduction operations can use some advanced noise reduction algorithms, such as adaptive filtering algorithms, to further reduce the noise level in the signal. Normalization adjusts the amplitude of the audio signal to a suitable range for subsequent processing. After preprocessing, the digital audio signal is feature extracted to generate a preprocessed audio feature sequence. Some commonly used audio feature extraction methods, such as the Mel Frequency Cepstral Coefficient (MFCC) extraction method, can be used to convert the audio signal into a series of feature vectors to form an audio feature sequence.
[0163] Step S152: input the audio feature sequence into the speech recognition model of the voice processing component, and generate a text instruction sequence after processing, which contains continuous lexical units.
[0164] The preprocessed audio feature sequence is input into the speech recognition model of the voice processing component corresponding to the target voice control mode. If it is an online voice control mode, an online speech recognition model is used; if it is an offline voice control mode, an offline speech recognition model is used. The speech recognition model is an artificial intelligence model trained on a large amount of data, which can convert the input audio feature sequence into a text instruction sequence. The model can recognize the voice content contained in the audio signal and convert it into the corresponding text by learning a large amount of voice data and corresponding text labels. The generated text instruction sequence is composed of a series of continuous lexical units, which are arranged in the semantic order of the voice instruction.
[0165] Step S153: extract the core control intent word and the associated parameter word from the text instruction sequence to obtain the to-be-matched instruction unit.
[0166] After obtaining the text instruction sequence, the core control intent word and the associated parameter word need to be extracted from it. The core control intent word expresses the main purpose of the user's voice instruction, such as "feeding", "playing", "turning on the light", etc. The associated parameter word is a specific parameter related to the core control intent word, such as "how much food", "how long", etc. The core control intent word and the associated parameter word can be extracted by natural language processing techniques, such as part-of-speech tagging, named entity recognition, etc. First, the text instruction sequence is tagged with part-of-speech, and the part-of-speech of each word is determined. Then, according to the part-of-speech and semantic rules, the core control intent word and the associated parameter word are identified. The extracted core control intent word and the associated parameter word are combined together to form a matching instruction unit. For example, if the text instruction sequence is "feed the pet at 8 pm", the core control intent word is "feeding", the associated parameter word is "8 pm" and "pet", and the matching instruction unit is "feeding (8 pm, pet)".
[0167] Step S154: Load the standard instruction template set corresponding to the target voice control mode in the voice instruction set of the voice processing component, which contains the pre-set standard control intent word and parameter format description.
[0168] Load the standard instruction template set in the voice instruction set of the voice processing component corresponding to the target voice control mode. If it is an online voice control mode, load the standard instruction template set of the online voice instruction set; if it is an offline voice control mode, load the standard instruction template set of the offline voice instruction set. The standard instruction template set contains pre-set standard control intent words and parameter format descriptions. The standard control intent word corresponds to the core control intent word in the matching instruction unit, for example, the standard control intent word in the standard instruction template set may include "feeding", "playing", etc. The parameter format description specifies the format and type of the associated parameters corresponding to each standard control intent word, for example, the parameter format description corresponding to the standard control intent word "feeding" may be "time, object", indicating that the associated parameters should be time and pet object.
[0169] Step S155: Calculate the similarity between the matching instruction unit and each standard instruction template in the standard instruction template set, and determine the standard instruction template with the highest similarity as the target standard instruction template.
[0170] The similarity between the instruction unit to be matched and each standard instruction template in the set of standard instruction templates is calculated. Several similarity calculation methods can be used, such as the edit distance algorithm and the cosine similarity algorithm. The edit distance algorithm measures similarity between two strings by calculating the minimum number of edit operations, including character insertion, deletion, and replacement. The cosine similarity algorithm measures similarity by calculating the cosine of the angle between two vectors. Here, the instruction unit to be matched and the standard instruction templates can be converted into vector representations. For each standard instruction template, a similarity score is calculated with the instruction unit to be matched. These scores are then compared, and the standard instruction template with the highest similarity is determined as the target standard instruction template. For example, if the instruction unit to be matched is "feed (8pm, pet)" and the standard instruction template set includes standard instruction templates such as "feed (time, object)" and "play (duration, object)", the similarity score calculation shows that "feed (time, object)" has the highest similarity and is therefore determined as the target standard instruction template.
[0171] Step S156: using the standard control intention word of the target standard instruction template as an instruction type identifier, and combining it with the parameter format description of the target standard instruction template to generate a structured control instruction.
[0172] The standard control intention words of the target standard instruction template are used as instruction type identifiers, such as "feeding". A structured control instruction is generated by combining the parameter format description of the target standard instruction template and the associated parameter words in the instruction unit to be matched. Taking the target standard instruction template "feeding (time, object)" as an example, the associated parameter words in the instruction unit to be matched are "8 o'clock in the evening" and "pet", and the generated structured control instruction can be "feeding (time: 8 o'clock in the evening, object: pet)". Such a structured control instruction can clearly express the user's voice control intention, making it easier for the instruction execution process of the pet device to accurately perform the corresponding operation.
[0173] Step S160: Execute the control instruction and output the instruction execution result.
[0174] After obtaining the structured control instruction, it is necessary to execute the instruction and output the execution result. The specific process is as follows:
[0175] Step S161: When the pet device is in the offline voice control mode, an independent instruction cache area is divided in the local storage unit of the pet device, and a local instruction queue is established for storing the parsed control instructions. The local instruction queue manages control instructions in a first-in-first-out order.
[0176] When the pet device is in the offline voice control mode, in order to better manage the parsed control instructions, an independent instruction cache area is divided in the local storage unit. This instruction cache area is specially used to store control instructions to avoid confusion with other data. A local instruction queue is established in the instruction cache area, and the control instructions are managed in a first-in-first-out order. The first-in-first-out principle ensures that the control instructions are executed in the order of user input, and the instruction execution confusion does not occur. When establishing the local instruction queue, a queue in the data structure can be used to implement it, one end of the queue is used to insert new control instructions, and the other end is used to take out the control instructions to be executed.
[0177] Step S162: adding the control instruction to the tail of the local instruction queue.
[0178] The parsed structured control instruction is added to the tail of the local instruction queue. In this way, the new control instruction can be ensured to wait for execution in the queue in the first-in-first-out order. When adding the control instruction, a certain format check and verification can be performed on the instruction to ensure the legality and integrity of the instruction. If the instruction does not meet the requirements, error processing may be required, such as feeding back instruction error information to the user.
[0179] Step S163: taking out a target control instruction from the head of the local instruction queue according to the first-in-first-out order of the local instruction queue, and calling a hardware drive interface of the pet device to execute the target control instruction.
[0180] According to the first-in-first-out order of the local instruction queue, the target control instruction is taken out from the head of the queue. The instruction at the head is the earliest instruction entering the queue, that is, the first instruction to be executed. After taking out the target control instruction, the hardware drive interface of the pet device is called to execute the instruction. The hardware drive interface is a bridge between the pet device and the hardware, which is responsible for converting the control instruction into a signal that the hardware can understand and execute. For example, if the target control instruction is "feed (time: 8 pm, object: pet)", the hardware drive interface can control the feeding device of the pet device to feed the specified pet at 8 pm according to the content of the instruction.
[0181] Step S164: during the execution of the target control instruction, the execution status code returned by the hardware drive interface is monitored in real time, and when the execution status code indicates that the target control instruction is executed, the instruction execution result containing the instruction type identification field and the execution status code is generated.
[0182] In the process of executing the target control instruction, the execution status code returned by the hardware driver interface is monitored in real time. The execution status code reflects the current state of instruction execution, such as being executed, execution success, execution failure, etc. When the execution status code indicates that the target control instruction is executed, the instruction execution result is generated. The instruction execution result includes an instruction type identification field and an execution status code. The instruction type identification field is used to identify the type of the instruction, such as "feeding", "playing", etc., and the execution status code specifically indicates the execution of the instruction, such as "success", "failure", etc. For example, if the target control instruction "feeding (time: 8pm, object: pet)" is executed successfully, the generated instruction execution result may be "instruction type: feeding, execution status: success".
[0183] Step S165: feeding back the instruction execution result to the user through at least one of the preset light flashing mode, screen text display or local voice prompt.
[0184] The generated instruction execution result is fed back to the user through a preset manner. At least one of the light flashing mode, screen text display or local voice prompt can be used. The light flashing mode can represent the instruction execution result through the indicator light on the pet device according to a certain flashing rule, for example, fast flashing indicates execution success and slow flashing indicates execution failure. The screen text display can display the text information of the instruction execution result on the display screen of the pet device, such as "feeding instruction execution success". The local voice prompt plays voice information through the built-in speaker of the pet device to broadcast the instruction execution result to the user, such as "your feeding instruction has been successfully executed". By feeding back the instruction execution result to the user through multiple ways, it can ensure that the user can timely and accurately understand the execution of the instruction.
[0185] In a possible implementation, the present application can also include the following method steps:
[0186] Step S210: if the pet device triggers the switching from the offline voice control mode to the online voice control mode, starting the background synchronization operation to encrypt and package the executed control instructions and the corresponding instruction execution results in the local instruction queue to generate a synchronization data packet.
[0187] When the pet device switches from the offline voice control mode to the online voice control mode, a data synchronization operation is needed. First, a background synchronization operation is started, and the executed control instructions in the local instruction queue and the corresponding instruction execution results are encrypted and packaged. The encryption operation can use symmetric encryption algorithms, asymmetric encryption algorithms, etc. If a symmetric encryption algorithm is used, for example, the Advanced Encryption Standard (AES) algorithm can be used to ensure the security and privacy of the data. The executed control instructions and instruction execution results are organized into data blocks in a certain format, and then the data blocks are encrypted using an encryption key. The encrypted data blocks are then packaged to generate a synchronization data packet. In the packaging process, some necessary metadata can be added, such as the identification of the data packet, the timestamp of the data, etc., to facilitate parsing and processing on the cloud server.
[0188] Step S220: Send the synchronization data packet to the preset cloud server, and parse the synchronization data packet and update the device state parameters stored in the cloud server by the cloud server.
[0189] The generated synchronization data packet is sent to the preset cloud server. A secure network transmission protocol such as the Transport Layer Security (TLS) protocol can be used through the network interface of the pet device to ensure the security and integrity of the synchronization data packet during transmission. Before sending the data packet, the pet device needs to establish a connection with the cloud server, for example, an identity verification and handshake process can be performed to ensure the legality and reliability of both parties. After the connection is successfully established, the pet device sends the synchronization data packet to the cloud server.
[0190] After the cloud server receives the synchronization data packet, it first performs a decryption operation. Using the same encryption key as the pet device, the encrypted synchronization data packet is decrypted into the original executed control instructions and corresponding instruction execution results. Then, the cloud server parses the decrypted data to identify the specific content of each control instruction and the corresponding execution result.
[0191] The cloud server stores the device state parameters of the pet device, which reflect various running states and setting information of the pet device. According to the parsed executed control instructions and execution results, the cloud server updates the stored device state parameters. For example, if the executed control instruction is to adjust the feeding time of the pet device, the cloud server will update the stored feeding time parameter accordingly; if the instruction execution result shows that a certain operation fails, the cloud server will also record this failure information for subsequent processing.
[0192] Step S230: receiving the state correction instruction returned by the cloud server, and adjusting the local state parameter of the pet device according to the state correction instruction, so that the local state parameter is consistent with the device state parameter stored in the cloud server. The state correction instruction contains the difference information between the device state parameter and the local state parameter.
[0193] After updating the device state parameter, the cloud server compares the local state parameter of the pet device with the device state parameter stored in the cloud server, and finds out the difference information between the two. According to the difference information, the cloud server generates a state correction instruction and sends it back to the pet device.
[0194] After receiving the state correction instruction returned by the cloud server, the pet device parses the instruction and extracts the difference information between the device state parameter and the local state parameter. According to the difference information, the pet device adjusts the local state parameter. For example, if the difference information shows that the feeding time parameter stored in the cloud is different from the local parameter, the pet device will update the local feeding time parameter to be consistent with the cloud. In this way, the local state parameter of the pet device is consistent with the device state parameter stored in the cloud server, realizing the synchronization of data and the consistency of state.
[0195] The method provided by the embodiments of the present application generates a network state parameter by monitoring the network signal stability, connectivity state and Internet access capability of the pet device, obtains the current running state of the device in combination with a state machine mechanism, and dynamically evaluates whether the voice control mode needs to be switched based on the index judgment criteria and logic combination rules corresponding to different states in the preset adjustment condition; when switching is needed, the core process is reserved, the device parameters and user interaction context are cached to a local state file, the voice processing component corresponding to the target mode is loaded and the non-critical tasks are restored, seamless mode switching is realized; when the voice instruction is parsed, the preprocessed audio feature sequence is input into the voice recognition model of the target mode to generate a text instruction, and the structured control instruction is extracted by matching the standard instruction template; in the execution stage, the local instruction queue is managed in a first-in first-out manner in the offline mode, the hardware execution state is monitored in real time and the results are fed back, and at the same time, the offline execution data is uploaded to the cloud through the background synchronization mechanism to correct the local state. The method combines multi-dimensional network state monitoring with a state machine to accurately determine the switching time to avoid misoperation, and through core process reservation and state caching, it ensures that the instructions are not lost during the switching process, the user interaction is continuous, and through modular component loading and instruction parsing optimization, it adapts to the control requirements in different network environments, improves the response efficiency in offline scenarios through local queue and real-time feedback, and ensures state consistency through cloud synchronization. Thus, intelligent adaptive switching of the voice control mode of the pet device in a network fluctuation scenario is realized, the reliable parsing and execution of the control instruction are ensured, and the user experience in different network conditions is improved.
[0196] Figure 2 A structure diagram of a pet device voice control system 100 based on intelligent switching provided by the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, a processor 120 can be used in the pet device voice control system 100 based on intelligent switching, and used to execute the functions in the present application. Figure 2
[0197] The pet device voice control system 100 based on intelligent switching can be a general server or a special-purpose server, both of which can be used to implement the pet device voice control method based on intelligent switching of the present application. Although only one server is shown in the present application, for the sake of convenience, the functions described in the present application can be implemented in a distributed manner on multiple similar platforms to balance the processing load.
[0198] For example, the smart switching based pet device voice control system 100 can include a network port 110 connected to a network, one or more processors 120 for executing program instructions, a communication bus 130, and different forms of storage media 140, such as a disk, a ROM, or a RAM, or any combination thereof. The smart switching based pet device voice control system 100 can also include program instructions stored in a ROM, a RAM, or other types of non-transitory storage media, or any combination thereof, for example. The method of the present application can be implemented according to these program instructions. The smart switching based pet device voice control system 100 also includes an input / output (I / O) interface 150 between the computer and other input / output devices.
[0199] For ease of illustration, only one processor is described in the smart switching based pet device voice control system 100. However, it should be noted that the smart switching based pet device voice control system 100 in the present application can also include multiple processors, so the steps performed by one processor described in the present application can also be jointly performed or individually performed by multiple processors. For example, if the processor of the smart switching based pet device voice control system 100 performs steps A and B, it should be understood that steps A and B can also be jointly performed by two different processors or individually performed in one processor. For example, a first processor performs step A, a second processor performs step B, or the first processor and the second processor jointly perform steps A and B.
[0200] The embodiment of the present application discloses a computer readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to perform the steps in the smart switching based pet device voice control method of the aforementioned embodiments.
[0201] The embodiment of the present application discloses a computer program product comprising a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the smart switching based pet device voice control method of the aforementioned embodiments.
[0202] The device embodiments described above are only illustrative, wherein the modules illustrated as separate components can or can not be physically separated, and the components shown as modules can or can not be physical modules, i.e., they can be located in one place or distributed to multiple network modules. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0203] Those skilled in the art can clearly understand the technical solutions of the various embodiments through the above specific description of the embodiments. The various embodiments can be realized by means of software and necessary universal hardware platforms, and of course, can also be realized by hardware. Based on such understanding, the above technical solutions, essentially or in terms of the contribution to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer readable storage medium, which includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disk storage, a magnetic disk storage, a magnetic tape storage, or any other medium that can be used to carry or store computer readable instructions. The computer software product can be used to cause a computer to perform the various embodiments of the present application.
[0204] Finally, it should be noted that: the above disclosed is only the preferred embodiment of the present application, only for the description of the technical solutions of the present application, not to limit; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand; it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A voice control method for pet devices based on intelligent switching, characterized in that: The method comprises: Monitoring the network connection status of the pet device to obtain network status parameters, wherein the network status parameters include a network signal stability index, a network connectivity status index, and an Internet access capability index; Acquiring the current operating state of the pet device based on the state machine mechanism adopted by the pet device, wherein the current operating state includes an online state, an offline state, and a switching state; determining whether the pet device needs to adjust the voice control mode according to the preset adjustment condition associated with the current operating state and the network status parameter; When the pet device has the voice control mode adjustment requirement, the pet device is adjusted to a target voice control mode according to the network status parameter and the preset adjustment condition, wherein the target voice control mode includes an online voice control mode and an offline voice control mode; If a voice control instruction input by the user is received, calling the voice processing component corresponding to the target voice control mode to parse the voice control instruction and obtain the control instruction of the pet device; Execute the control instruction and output the instruction execution result.
2. The pet device voice control method based on intelligent switching according to claim 1 is characterized in that: The monitoring of the network connection status of the pet device to obtain network status parameters includes: Regularly detecting the network signal reception strength of the pet device to generate a signal strength sequence; Performing a continuous stability analysis on the signal strength sequence, calculating the signal strength fluctuation amplitudes of adjacent detection cycles, and generating the network signal stability index based on the signal strength fluctuation amplitudes; Sending connectivity test data to a preset network node, and generating the network connectivity status indicator according to the round-trip transmission status of the connectivity test data, wherein the network connectivity status indicator is used to indicate whether the network connection is normal; Accessing a preset Internet address and generating the Internet access capability indicator according to an access response result, wherein the Internet access capability indicator is used to indicate whether the pet device can normally access the cloud service; Monitor the network status change event of the pet device, update the network signal stability index, the network connectivity status index, and the Internet access capability index according to the network status change event, and generate updated network status parameters.
3. The pet device voice control method based on intelligent switching according to claim 1 is characterized in that: The determining whether the pet device has a voice control mode adjustment requirement based on the preset adjustment condition associated with the current operating state and the network state parameter includes: Selecting a corresponding target adjustment condition set from the preset adjustment conditions according to the current operating state, the target adjustment condition set including a plurality of condition items matching the current operating state, each of the condition items being associated with a judgment criterion for at least one indicator in the network status parameter, the judgment criterion including a description of a normal range of the indicator and a description of an abnormal range of the indicator; Extracting the network signal stability index, the network connectivity status index, and the Internet access capability index from the network status parameters to obtain a set of network indicators to be evaluated, wherein each indicator in the set of network indicators to be evaluated has a one-to-one correspondence with the condition item in the target adjustment condition set; Performing a matching judgment on each of the indicators in the set of network indicators to be evaluated and the corresponding condition item in the set of target adjustment conditions, and generating a matching result for each of the indicators, the matching result including whether the indicator meets the condition item and whether the indicator does not meet the condition item; wherein, when the actual value of the indicator is within the indicator normal range description of the condition item, a matching result of the indicator meeting the condition item is generated; and when the actual value of the indicator is within the indicator abnormal range description of the condition item, a matching result of the indicator not meeting the condition item is generated; According to the condition combination rule corresponding to the current operating state, the matching results of the multiple indicators are logically combined to generate a combination judgment result, wherein the condition combination rule includes a logical AND and logical OR combination of the indicator matching results under different operating states; When the combined judgment result meets the preset trigger condition, it is determined that the pet device has the voice control mode adjustment requirement; When the combined judgment result does not meet the preset trigger condition, it is determined that the pet device does not have the voice control mode adjustment requirement.
4. The method for voice control of pet devices based on intelligent switching according to claim 1, characterized in that: The step of adjusting the pet device to a target voice control mode according to the network status parameter and the preset adjustment condition includes: When the current voice control mode of the pet device is the offline voice control mode, if the network signal stability indicator indicates that the network signal stability meets the preset stability condition, and the network connectivity status indicator indicates that the network connectivity is normal, and the Internet access capability indicator indicates that the Internet can be accessed, then the pet device is adjusted to the online voice control mode; Loading a first voice processing component corresponding to the online voice control mode, wherein the first voice processing component includes an online voice recognition model and an online voice instruction set; Uninstall the second voice processing component corresponding to the offline voice control mode, where the second voice processing component includes an offline voice recognition model and an offline voice instruction set.
5. The pet device voice control method based on intelligent switching according to claim 1 is characterized in that: The step of adjusting the pet device to a target voice control mode according to the network status parameter and the preset adjustment condition includes: When the current voice control mode of the pet device is the online voice control mode, if the network signal stability indicator indicates that the network signal stability does not meet the preset stability condition, or the network connectivity status indicator indicates that the network connectivity is abnormal, or the Internet access capability indicator indicates that the Internet cannot be accessed, then the pet device is adjusted to the offline voice control mode; Loading a second voice processing component corresponding to the offline voice control mode, wherein the second voice processing component includes an offline voice recognition model and an offline voice instruction set; Uninstall a first voice processing component corresponding to the online voice control mode, where the first voice processing component includes an online voice recognition model and an online voice instruction set.
6. The method for voice control of pet devices based on intelligent switching according to claim 1, characterized in that: The calling of the voice processing component corresponding to the target voice control mode to parse the voice control instruction to obtain the control instruction of the pet device includes: Converting the voice control command received by the voice acquisition unit into a digital audio signal, and preprocessing the digital audio signal to generate a preprocessed audio feature sequence; Inputting the audio feature sequence into the speech recognition model of the speech processing component to generate a text instruction sequence after processing, wherein the text instruction sequence includes continuous vocabulary units; Extracting core control intention words and associated parameter words from the text instruction sequence to obtain an instruction unit to be matched; Loading a standard instruction template set corresponding to the target voice control mode in the voice instruction set of the voice processing component, the standard instruction template set including preset standard control intention words and parameter format descriptions; Calculating the similarity between the instruction unit to be matched and each standard instruction template in the standard instruction template set, and determining the standard instruction template with the highest similarity as the target standard instruction template; The standard control intention word of the target standard instruction template is used as an instruction type identifier, and combined with the parameter format description of the target standard instruction template to generate a structured control instruction.
7. The method for voice control of pet devices based on intelligent switching according to claim 1, characterized in that: When the voice control mode adjustment requirement exists on the pet device, adjusting the pet device to the target voice control mode according to the network status parameter and the preset adjustment condition includes: After determining that the pet device needs to adjust the voice control mode, suspend the currently executing non-critical task processes and retain the core processes related to voice control, the core processes including the voice collection process, the command parsing process and the command execution process; Collecting device parameters of the pet device, wherein the device parameters include current working mode parameters, user-defined setting parameters, and the most recently executed control instruction record; Extracting user interaction context data within a preset time period, the user interaction context data including a history of voice control commands input by the user, a response feedback record of the pet device, and a time series of interactions between the user and the device; Storing the device parameters and the user interaction context data in a local state cache file, wherein the state cache file is stored in a key-value pair structure, wherein the key in the key-value pair is the parameter name, and the value in the key-value pair is the parameter value; Loading the voice processing component corresponding to the target voice control mode, wherein interrupting the operation of the core process is prohibited during the loading process; After the voice processing component corresponding to the target voice control mode is loaded, the device parameters and the user interaction context data are read from the state cache file, and the initial working mode parameters of the target voice control mode are replaced with the device parameters, and the user interaction context data is input into the instruction parsing process of the target voice control mode; Resuming the suspended non-critical task process.
8. The pet device voice control method based on intelligent switching according to claim 1 is characterized in that: The executing the control instruction and outputting the instruction execution result includes: When the pet device is in the offline voice control mode, an independent instruction cache area is divided in the local storage unit of the pet device to establish a local instruction queue for storing the control instructions obtained by parsing, and the local instruction queue manages the control instructions in a first-in-first-out order; Adding the control instruction to the end of the local instruction queue; Taking out the target control instruction from the head of the local instruction queue according to the first-in-first-out order of the local instruction queue, and calling the hardware driver interface of the pet device to execute the target control instruction; During the execution of the target control instruction, monitoring the execution status code returned by the hardware driver interface in real time, and generating the instruction execution result including the instruction type identification field and the execution status code when the execution status code indicates that the execution of the target control instruction is complete; Feedback the command execution result to the user through at least one of a preset light flashing mode, screen text display or local voice prompt.
9. The method for voice control of pet devices based on intelligent switching according to claim 1, characterized in that: The method further comprises: If the pet device is triggered to switch from the offline voice control mode to the online voice control mode, a background synchronization operation is started to encrypt and package the executed control instructions and the corresponding instruction execution results in the local instruction queue to generate a synchronization data packet; Sending the synchronization data packet to a preset cloud server, which parses the synchronization data packet and updates the device status parameters stored in the cloud server; Receive the status correction instruction returned by the cloud server, and adjust the local status parameters of the pet device according to the status correction instruction so that the local status parameters are consistent with the device status parameters stored in the cloud server, and the status correction instruction includes the difference information between the device status parameters and the local status parameters.
10. A pet device voice control system based on intelligent switching, characterized in that: It includes a processor and a computer-readable storage medium, wherein the computer-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by a computer, the pet device voice control method based on intelligent switching according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Voice control mode switching method and device and equipment with device
CN107424607A
Pet control method based on pet wearable devices and terminal device
CN110419460A
Intelligent household electrical appliance control method based on Internet of Things, terminal, device and storage medium
CN112506401A
Online and offline dual-mode voice control method and system and storage medium
CN112735414A
Household appliance control method, household appliance, server and medium
CN114690650A