Intelligent excrement analysis control method and system based on multi-sensor fusion

The smart toilet device, through multi-sensor fusion and heterogeneous dual-core architecture, solves the shortcomings of existing devices in terms of triggering, imaging, power consumption and privacy security, and achieves high-accuracy trigger detection, excellent imaging quality, ultra-long battery life and strong privacy protection.

CN122432815APending Publication Date: 2026-07-21BEIJING HEZHONG HENGYUE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HEZHONG HENGYUE TECHNOLOGY CO LTD
Filing Date
2026-04-22
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing smart toilet devices have many shortcomings in terms of triggering mechanism, imaging quality, power consumption, privacy and security, and edge computing capabilities, resulting in false triggering, unstable imaging quality, excessive power consumption and privacy leakage risks, and lack of effective edge computing capabilities.

Method used

It adopts a multi-sensor fusion triggering mechanism, combines Bayesian decision tree and adaptive lighting control, utilizes heterogeneous dual-core architecture to manage power consumption, and achieves secure and reliable excrement analysis through edge encryption and sparse coding technology.

Benefits of technology

It achieves high-accuracy trigger detection, excellent imaging quality, ultra-long battery life, strong privacy and security protection, and flexible deployment, reducing false trigger rate, improving imaging quality and privacy protection, and reducing network bandwidth requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432815A_ABST
    Figure CN122432815A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of intelligent health monitoring, and discloses a kind of excrement intelligent analysis control method and system based on multi-sensor fusion, the method comprises: identifying real toilet event;Perform closed-loop adaptive pre-flash iterative adjustment, output the lighting parameter of real toilet event corresponding environment;Pre-flash operation is carried out based on lighting parameter, and image acquisition is carried out to real toilet event, and excrement image is obtained;Excrement image is spatially divided and superblock sparse coding is carried out using target detection network and feature level superblock sparse coding mechanism, and sparse feature map is obtained;End side pretreatment, block-by-block stream encryption and ciphertext domain fusion are carried out to sparse feature map, and the encrypted data to be sent is obtained, uploaded to cloud, and the encrypted data packet is disassembled and isolated, and excrement intelligent analysis is completed.The application solves the problems of high false alarm rate, unstable imaging quality, excessive power consumption and insufficient privacy security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent health monitoring technology, and in particular to an intelligent analysis and control method and system for excrement based on multi-sensor fusion. Background Technology

[0002] With the improvement of people's living standards and the enhancement of health awareness, attention to digestive health is increasing. Traditional intestinal health monitoring mainly relies on professional hospital examinations (such as colonoscopy) or subjective descriptions by users (such as the Bristol Stool Sorting Method), which has drawbacks such as high invasiveness, high cost, poor timeliness, or large subjective bias. In recent years, non-invasive monitoring technology based on computer vision has gradually emerged. By installing cameras on the toilet to collect images of excrement, artificial intelligence algorithms are used to analyze its shape, color, texture, and other characteristics to assess the user's digestive health status.

[0003] However, existing smart toilets or external monitoring devices still face many technical challenges in practical applications:

[0004] First, the triggering mechanism is unreliable. Existing devices mostly use a single infrared proximity sensor or pressure sensor as the trigger source. In the high humidity, large temperature fluctuations, and multiple users environment of a bathroom, a single sensor is prone to false triggers (e.g., someone passes by but does not use the toilet) or missed triggers (e.g., the sensor goes into sleep mode due to the user remaining stationary for too long). This results in the collection of invalid data, wasting storage and transmission bandwidth, and increasing the processing burden on the cloud server.

[0005] Secondly, image quality is greatly affected by the environment. The lighting inside a toilet is complex, and excrement varies in shape (different colors and reflective properties). Traditional fixed-parameter cameras struggle to acquire high-quality images under low light or strong reflective conditions, directly impacting the accuracy of subsequent AI analysis. The lack of adaptive lighting control and image parameter adjustment mechanisms is a common deficiency in existing technologies.

[0006] Third, the trade-off between power consumption and battery life is prominent. These devices are typically battery-powered and require long battery life. However, to achieve "instant response," the system often needs to keep the sensors and main control chip in a high-power standby listening state, leading to rapid battery drain. How to achieve ultra-low power sleep mode while ensuring millisecond-level response speed is a pressing problem that portable intelligent monitoring devices need to solve.

[0007] Fourth, privacy and data security concerns. Images of excrement constitute highly sensitive personal privacy data. Some existing solutions lack sufficient local security isolation mechanisms or have inadequate encryption levels during data transmission, posing a risk of privacy breaches. Furthermore, mechanisms for temporary data collection and complete data erasure in guest mode are not yet fully developed.

[0008] Fifth, insufficient edge computing capabilities. Most existing devices merely act as simple data acquisition terminals, uploading all raw video streams to the cloud for processing. This not only puts pressure on home Wi-Fi network bandwidth but also leads to data loss when the network is unstable. There is a lack of edge computing capabilities for initial screening, encoding, and anomaly detection at the device level.

[0009] Sixth, privacy exposure risks during edge data fusion and feature extraction. Existing edge computing solutions often employ a serial plaintext processing paradigm of "decryption first, fusion second, feature extraction third." When performing multi-sensor data fusion and AI feature extraction on the device side, both the original sensor time-series data and intermediate image feature maps reside in system memory (DRAM) in plaintext. Once the device is physically compromised or subjected to a memory extraction attack, attackers can easily reconstruct the user's toilet habits and excrement patterns, posing a serious risk of "intermediate-state privacy leakage."

[0010] Therefore, the development of intelligent analysis and control methods and systems for excrement based on multi-sensor fusion triggering, with adaptive imaging capabilities, ultra-low power consumption management, and safety and reliability has become an urgent need for technological development in this field. Summary of the Invention

[0011] This invention provides a method and system for intelligent analysis and control of excrement based on multi-sensor fusion, in order to solve the problems mentioned above in the prior art.

[0012] According to a first aspect of the present invention, an intelligent analysis and control method for excrement based on multi-sensor fusion is provided.

[0013] In one embodiment, the intelligent excrement analysis and control method based on multi-sensor fusion includes:

[0014] Based on a feature-weighted Bayesian decision tree hybrid fusion algorithm, combined with multi-sensor data features, real toilet-use events are identified. Using a historical data self-learning strategy and incorporating the brightness histogram feature vector of the current environment preview frame, closed-loop adaptive pre-flash iterative adjustment is performed to output the lighting parameters corresponding to the real toilet-use event. Pre-flash operation is performed based on the lighting parameters, and images of the real toilet-use event are acquired to obtain excrement images. Using a target detection network and a feature-level super-block sparse coding mechanism, the excrement images are spatially partitioned and super-block sparsely encoded to obtain sparse feature maps. The sparse feature maps are preprocessed on the edge, encrypted block by block, and fused with ciphertext domains to obtain encrypted data to be sent. The encrypted data to be sent is uploaded to the cloud, and the encrypted data packets are decrypted and isolated to complete the intelligent analysis of excrement.

[0015] According to a second aspect of the present invention, an intelligent analysis and control system for excrement based on multi-sensor fusion is provided.

[0016] In one embodiment, the excrement intelligent analysis and control system based on multi-sensor fusion includes:

[0017] The toilet incident recognition module identifies real toilet incidents using a feature-weighted Bayesian decision tree hybrid fusion algorithm combined with multi-sensor data features. The lighting parameter output module performs closed-loop adaptive pre-flash iterative adjustment based on historical data self-learning strategies and the brightness histogram feature vector of the current environment preview frame, outputting the lighting parameters corresponding to the environment of the real toilet incident. The image acquisition module performs pre-flash operations based on the lighting parameters and acquires images of real toilet incidents to obtain excrement images. The sparse feature acquisition module uses an object detection network and a feature-level super-block sparse coding mechanism to spatially partition and super-block sparsely code the excrement images to obtain sparse feature maps. The encryption analysis module performs edge-side preprocessing, block-by-block stream encryption, and ciphertext domain fusion on the sparse feature maps to obtain encrypted data to be sent. The encrypted data is then uploaded to the cloud, and the encrypted data packets are decrypted and isolated to complete the intelligent analysis of the excrement.

[0018] According to a third aspect of the present invention, a computer device is provided.

[0019] In some embodiments, the computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described above.

[0020] According to a fourth aspect of the present invention, a computer-readable storage medium is provided.

[0021] In one embodiment, a computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the above method.

[0022] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0023] 1. Extremely high trigger accuracy. Through a multi-sensor fusion algorithm combining TOF ranging and IR / mmWR presence detection, it effectively distinguishes between genuine toilet use behavior and environmental interference, such as passersby, pet activity, and water flow fluctuations, reducing the false trigger rate to below 1% and significantly reducing the generation of invalid data.

[0024] 2. Superior imaging quality. The innovative coaxial ring adaptive lighting system, combined with real-time feedback adjustment by the ISP, solves the problems of uneven lighting, reflections, and shadows inside the toilet, ensuring that high-definition, color-accurate image data can be acquired at different times (day and night) and under different excrement conditions, providing a reliable foundation for subsequent AI diagnosis.

[0025] 3. Extended battery life. Utilizing a heterogeneous dual-core architecture and a three-level power management strategy, the system leverages a low-power MCU for primary monitoring tasks, waking up the high-performance AP only when necessary. Combined with the intermittent operating mode of the sensors, the average current in standby mode is as low as microamps, allowing for several months or even half a year of normal use on a single charge.

[0026] 4. Robust privacy and security protection. Implementing a "transmit immediately after collection, delete immediately after transmission" data lifecycle management strategy, combined with end-to-end AES-256 encrypted transmission and local secure storage, minimizes the risk of privacy leaks. A unique automatic data destruction mechanism in guest mode further meets privacy compliance requirements in multi-user scenarios.

[0027] 5. Flexible deployment and maintenance. Utilizing a non-contact clamping installation design, it requires no modification to the toilet or the provision of a power outlet; simply plug and play. Supports OTA remote firmware upgrades, continuously optimizing sensor fusion algorithms and image processing models to extend product lifecycle.

[0028] 6. Edge computing empowerment and precise end-side data filtering. Overcoming the bandwidth waste and cloud computing pressure caused by the traditional "full upload" of devices, this invention utilizes the NPU built into the main control chip in collaboration with the hardware ISP to complete highly reliable image quality assessment and anomaly filtering on the device side. Through a three-level end-side processing mechanism of ISP statistical filtering, NPU semantic interception, and ROI local encoding, this invention can completely block the upload of invalid and abnormal data locally, reducing the actual network transmission data volume by more than 70%, significantly improving the upload success rate in weak network environments, and greatly reducing the processing load on cloud servers.

[0029] 7. A pioneering encrypted domain fusion and sparse coding architecture achieves a balance between extreme computing power and security. Breaking away from traditional plaintext processing paradigms, it proposes a multi-sensor distributed fragmented acquisition and encrypted domain feature fusion architecture. Within a Trusted Execution Environment (TEE), tokenized fusion and judgment are directly performed on encrypted sensor data packets, completely eliminating the plaintext exposure of the original sensor stream in memory. Simultaneously, feature-level super-block sparse coding technology is introduced on the image processing side, extracting and encrypting only sparse activation blocks containing key pathological features. This mechanism not only achieves absolute security by ensuring "features do not leave the domain," but also compresses the NPU's computational load and the amount of data to be encrypted and transmitted by more than 80%, perfectly meeting the computing power and bandwidth limitations of low-power devices.

[0030] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0031] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0032] Figure 1 This is a flowchart illustrating an intelligent analysis and control method for excrement based on multi-sensor fusion, according to an exemplary embodiment.

[0033] Figure 2 This is a schematic diagram illustrating the principle of an intelligent excrement analysis and control system based on multi-sensor fusion, according to an exemplary embodiment.

[0034] Figure 3 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment;

[0035] Figure 4 This is a module block diagram illustrated according to an exemplary embodiment;

[0036] Figure 5 This is a schematic diagram illustrating a data encryption upload and cleanup process according to an exemplary embodiment; Detailed Implementation

[0037] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some portions and features of certain embodiments may be included in or replace portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents thereof. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.

[0038] The modules in the apparatus or system of this application can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0039] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0040] Figure 1An embodiment of the present invention, which is a smart analysis and control method for excrement based on multi-sensor fusion, is shown.

[0041] In this optional embodiment, the intelligent excrement analysis and control method based on multi-sensor fusion includes:

[0042] S101. Based on the feature-weighted Bayesian decision tree hybrid fusion algorithm, combined with the features of multi-sensor data, real toilet use events are identified.

[0043] S102. Based on the self-learning strategy of historical data, combined with the brightness histogram feature vector of the current environment preview frame, perform closed-loop adaptive pre-flash iterative adjustment and output the lighting parameters of the environment corresponding to the real toilet event.

[0044] S103. Perform pre-flash operation based on lighting parameters and acquire images of real toilet events to obtain excrement images;

[0045] S104. Using a target detection network and a feature-level superblock sparse coding mechanism, the excrement image is spatially divided and superblock sparsely coded to obtain a sparse feature map.

[0046] S105. Perform end-side preprocessing, block-by-block stream encryption, and ciphertext domain fusion on the sparse feature map to obtain encrypted data to be sent; upload the encrypted data to be sent to the cloud, and decrypt and isolate the encrypted data packets to complete the intelligent analysis of excrement.

[0047] In this optional embodiment, based on a feature-weighted Bayesian decision tree hybrid fusion algorithm and combined with multi-sensor data features, the system identifies genuine toilet-use events, including: collecting distance data using a time-of-flight sensor; obtaining presence probability values ​​using an infrared or millimeter-wave radar sensor; calculating the mean and variance of the distance data within a preset sliding window; if the variance of the distance data is greater than a preset jump threshold, it is determined to be interference; otherwise, the presence probability value from the infrared or millimeter-wave radar sensor is read; calculating a continuous count of presence values ​​greater than a preset value within a certain number of consecutive periods; calculating the posterior probability of the current time belonging to a genuine toilet-use event using a Naive Bayes classifier, and expanding it using the Bayesian formula to obtain a Gaussian distribution and a Beta distribution; combining the Gaussian distribution and the Beta distribution with a pre-constructed lookup table to output the Bayesian confidence score; and inputting the Bayesian confidence score and the continuous count into a lightweight decision tree for logical judgment to identify genuine toilet-use events.

[0048] In this optional embodiment, identifying a genuine toilet-use event includes: if the mean of the distance data is greater than a distance threshold, it is judged as an interference event; otherwise, a continuous count is read. If the continuous count is less than a count threshold, it is judged as an interference event; otherwise, a weighted sum is performed based on the Bayes confidence score and the probability of existence to obtain a comprehensive judgment score. If the comprehensive judgment score is greater than a score threshold, it is judged as a genuine toilet-use event; otherwise, it is a non-genuine toilet-use event.

[0049] In this optional embodiment, based on a historical data self-learning strategy and combined with the brightness histogram feature vector of the current environment preview frame, a closed-loop adaptive pre-flash iterative adjustment is performed to output the lighting parameters of the environment corresponding to the real toilet incident. This includes: for the real toilet incident, obtaining the brightness histogram feature vector of the current environment preview frame, as well as the optimal LED duty cycle and ISP exposure parameters successfully acquired in the past, and combining them to form a feature parameter library; based on the Euclidean distance of the brightness histogram feature vector of the current environment preview frame, obtaining the historical optimal LED duty cycle and ISP exposure parameters that are closest to the current environment, using them as initial pre-flash parameters for pre-flash, and obtaining a pre-flash feedback image; calculating the error between the actual average brightness of the pre-flash feedback image and the target brightness, and locking the corresponding parameters if the error is within the allowable range; otherwise, performing a second fine-tuning pre-flash using a PID algorithm until the environmental features meet the standards, and obtaining the lighting parameters of the environment corresponding to the real toilet incident.

[0050] In this optional embodiment, a target detection network and a feature-level superblock sparse coding mechanism are used to spatially partition and superblock sparsely encode the excrement image to obtain a sparse feature map. This includes: extracting target feature maps from the excrement image using a target detection network, and dividing the target feature maps into multiple superblocks in the spatial dimension at the intermediate layer of the target detection network; calculating the sparsity index of the feature vectors within each superblock, comparing it with a sparsity threshold, retaining the sparse feature vectors of the activated superblocks, and generating a binary spatial mask; and outputting the combination of the binary spatial mask and the sparse feature vectors of the activated superblocks to obtain the sparse feature map.

[0051] In this optional embodiment, the target feature map is extracted from the excrement image using a target detection network, including: the target detection network performs forward reasoning on the excrement image to identify images with valid excrement targets; for images with valid excrement targets, the target region is extracted to obtain the target feature map.

[0052] In this optional embodiment, the sparse feature map is preprocessed on the end side, encrypted block by block, and fused with ciphertext domains to obtain encrypted data to be sent. This includes: adding timestamps, device IDs, and session IDs to the sparse feature map to obtain preprocessed data; encrypting the preprocessed data block by block to generate a ciphertext micro-block queue; and fusing the ciphertext micro-block queue with ciphertext domains to obtain encrypted data to be sent.

[0053] In this optional embodiment, ciphertext domain fusion of the ciphertext microblock queue includes: mapping the ciphertext distance value in the ciphertext microblock to discrete interval tokens, mapping the ciphertext existence probability to Boolean existence tokens; inputting the interval tokens and Boolean existence tokens into a weighted decision tree for logical operation to complete the ciphertext domain fusion.

[0054] In this optional embodiment, an intelligent excrement analysis and control method based on multi-sensor fusion further includes a three-level sleep strategy for the main control module; when in the first-level sleep mode, the application processor is downclocked; when in the second-level sleep mode, the application processor is powered off and the sensors work intermittently; when in the third-level sleep mode, the battery detection circuit is kept running.

[0055] Figure 2 An embodiment of an intelligent excrement analysis and control system based on multi-sensor fusion of the present invention is shown.

[0056] In this optional embodiment, the excrement intelligent analysis and control system based on multi-sensor fusion includes:

[0057] The toilet event recognition module 201 is used to identify real toilet events based on a feature-weighted Bayesian decision tree hybrid fusion algorithm combined with multi-sensor data features.

[0058] The lighting parameter output module 202 is used to perform closed-loop adaptive pre-flash iterative adjustment based on a self-learning strategy using historical data and combined with the brightness histogram feature vector of the current environment preview frame, and output the lighting parameters of the environment corresponding to the real toilet event.

[0059] The image acquisition module 203 is used to perform a pre-flash operation based on lighting parameters and to acquire images of real toilet events to obtain images of excrement.

[0060] The sparse feature acquisition module 204 is used to perform spatial partitioning and super-block sparse coding on the excrement image using the target detection network and feature-level super-block sparse coding mechanism to obtain a sparse feature map.

[0061] The encryption analysis module 205 is used to perform end-side preprocessing, block-by-block stream encryption, and ciphertext domain fusion on the sparse feature map to obtain encrypted data to be sent; upload the encrypted data to be sent to the cloud, and decrypt and isolate the encrypted data packets to complete the intelligent analysis of excrement.

[0062] To facilitate understanding of the above technical solutions of the present invention, the following further describes the above technical solutions of the present invention from the perspectives of architecture and principle, as follows:

[0063] This invention relates to Internet of Things (IoT) and digital healthcare technologies, applied to smart bathroom scenarios. It can automatically identify user toilet behavior, accurately collect excrement image data, and perform preliminary processing. Specifically, it utilizes Time-of-Flight (TOF) and Infrared / Millimeter-Wave Radar (IR / mmWR) multi-sensor fusion technology to achieve highly reliable event triggering, and provides a system solution based on an edge computing architecture for low-power management. The aim is to solve the problems of high false alarm rates, unstable imaging quality, excessive power consumption, and insufficient privacy and security in existing technologies. This invention includes a main control module, a multimodal sensing triggering module, a high-definition imaging module, an adaptive lighting module, a wireless communication module, and a power management module. The multimodal sensing triggering module integrates a Time-of-Flight (TOF) sensor and an Infrared / Millimeter-Wave Radar (IR / mmWR) sensor, accurately determining the user's toilet status through a multi-sensor data fusion algorithm, effectively solving the problem of high false trigger rates of single sensors in complex bathroom environments. The main control module uses a high-performance heterogeneous multi-core processor with a built-in Neural Processing Unit (NPU), supporting edge-side image preprocessing and encoding. The device enters a deep low-power sleep mode when not in operation, waking up only when specific biometric signals are detected. This invention also proposes a dynamic acquisition and control algorithm that adjusts the camera frame rate, exposure parameters, and supplementary lighting intensity in real time based on sensor feedback, and automatically performs data encryption upload and local cache clearing after acquisition. This device features contactless installation, strong privacy protection, accurate data acquisition, and low power consumption, making it suitable for non-intrusive monitoring of digestive health in home settings. It achieves accurate toilet event detection through a multi-source sensor data fusion algorithm, and combined with a dynamic power management strategy, maximizes device battery life while ensuring user experience. Data encryption upload and clearing, such as… Figure 5 As shown, it includes data collection, data encryption, data transmission, cloud confirmation, and local deletion.

[0064] Intelligent devices for collecting and analyzing excrement images and videos based on multi-sensor fusion, such as Figure 4 As shown, it includes:

[0065] Main control module: Employs a heterogeneous multi-core processor, including a high-performance application processor core and a low-power microcontroller core. The application processor core integrates a neural network acceleration unit and an image signal processor (ISP) for running the operating system, performing image encoding, and AI inference; the microcontroller core manages low-power sleep mode, sensor polling, and interrupt wake-up.

[0066] Multimodal sensing trigger module: Connected to the main control module and then to the microcontroller, this module includes a time-of-flight distance sensor and an infrared / millimeter-wave radar presence sensor for fusion detection of toilet-related events. The TOF sensor accurately measures distance changes to the target object, while the IR / mmWR sensor detects minute vital signs and their presence, such as breathing and subtle movements. The data from both sensors is fused within the microcontroller core to generate a high-confidence toilet-related event flag.

[0067] High-definition imaging module: Connected to the application processor, it acquires image and video data, including a high-resolution CMOS image sensor and lens assembly. It connects to the application processor core via a MIPI (a high-speed serial interface standard) interface. It is used to acquire high-definition still images and short video sequences of excrement upon receiving a toilet event flag. The high-definition imaging module is integrated with the Neural Processing Unit (NPU) supporting H.264 / H.265 encoding on the same SoC, supporting edge image quality assessment and anomaly filtering. The NPU is a dedicated hardware accelerator built into the RK3562, and its core principles include:

[0068] Hardware architecture optimization: Employing a systolic array or similar dataflow architecture, dedicated computing units, such as the MAC unit, are designed for core neural network operations like convolution and matrix multiplication. This achieves efficient parallel computing through a fixed dataflow pattern, reducing memory access latency. Low-precision computing: Supporting mixed operations of INT4 / INT8 / INT16 / FP16, data precision is compressed using quantization techniques (such as INT8), reducing computational load and memory consumption, and improving energy efficiency. For example, the computational load of INT8 is only 1 / 4 that of FP32, adapting to the low-power requirements of edge devices. Software ecosystem compatibility: Providing model conversion tools, such as the RKNN Toolkit, supports the conversion of models from frameworks like TensorFlow and PyTorch into NPU instruction sets. An API abstraction layer shields underlying hardware details, simplifying development. Its role is to efficiently execute AI inference on the edge, such as object detection and feature extraction, achieving secure processing of features within their domains, such as sparse encoding and ciphertext domain fusion in documents, while simultaneously reducing power consumption and bandwidth usage.

[0069] Adaptive lighting module: Arranged around the high-definition imaging module, this module dynamically adjusts supplemental lighting based on image feedback. It includes a ring-shaped arrangement of high color rendering index (CRI) LEDs and their driving circuitry, coaxially positioned around the lens. A high CRI is defined as a CRI greater than 90. This module dynamically adjusts the brightness and color temperature of the LEDs based on histogram data from the image sensor and ambient light intensity, ensuring uniform illumination of the imaging area without overexposure or underexposure. The image signal processor (ISP) within the application processor calculates the image histogram in real time and adjusts the duty cycle of the LED driving circuitry using a PID algorithm to maintain the average image brightness within a preset dynamic range.

[0070] Wireless communication module: Used for data upload and device network configuration, integrating a dual-mode communication chip of Wi-Fi 6 and Bluetooth 5.2. Bluetooth is used for device network configuration, near-field control, and low-power broadcasting; Wi-Fi is used for high-speed upload of large-capacity image data. Supports NFC near-field communication function, with built-in NDEF (binary data format) recording. When a mobile device without the corresponding application installed touches the device, it automatically redirects to a universal link URL to guide download or activates guest mode for quick pairing and guest mode triggering.

[0071] Power Management Module: Used to power and manage the power consumption status of various modules, including the rechargeable lithium battery pack, battery management system (BMS), and high-efficiency DC-DC conversion circuit. It supports multi-level power domain management and can independently cut off power to inactive modules, achieving microampere-level deep sleep current.

[0072] Housing and mounting mechanism: It adopts a waterproof and dustproof design (IPX4 and above), and includes an adjustable angle clamping structure to adapt to different toilet sidewalls, ensuring that the lens optical axis is perpendicular to the expected imaging area inside the toilet.

[0073] The microcontroller is configured to wake up the application processor to execute the data acquisition task when both a TOF distance signal and an IR presence signal are detected and preset conditions are met simultaneously. The power management module supports three power consumption states: Level 1 Sleep: The application processor operates at a reduced frequency, and the sensor operates at a low frequency; Level 2 Sleep: The application processor is powered off, only the microcontroller and real-time clock run, and the sensor operates intermittently; Level 3 Sleep: Only the battery detection circuit is retained; the system defaults to Level 2 Sleep state when no events occur.

[0074] This invention includes: system initialization, entering a low-power monitoring mode; the microcontroller periodically reading TOF and IR sensor data and performing fusion judgment; if a valid toilet visit event is determined, the microcontroller wakes up the application processor and starts the imaging and lighting modules; the application processor controls the camera to capture still images and videos, and dynamically adjusts the exposure based on lighting feedback; the captured data is encoded, encrypted, and watermarked; the encrypted data is uploaded to the cloud via a wireless network, and the data is erased locally upon receiving confirmation; after detecting that the user has left, the high-power module is turned off, and the system returns to the low-power monitoring mode.

[0075] This invention also includes a dynamic termination mechanism: during video recording, if the TOF sensor detects a target distance greater than a fourth threshold (typically 40cm), recording immediately stops and the current data is saved. A guest mode is also included, which receives guest session instructions via NFC or Bluetooth; the collected data is marked as temporary; and irreversible data destruction is performed upon completion of data analysis or the end of the session.

[0076] The working logic of the multimodal sensing trigger module is as follows:

[0077] The microcontroller core periodically wakes up the TOF sensor to sample distance. When the detected distance is less than a preset threshold (e.g., 30cm) and the duration exceeds the de-jitter time (e.g., 2 seconds), the IR / mmWR sensor is activated for secondary confirmation. If the IR / mmWR sensor detects a static human presence or a slight movement signal, it is considered a valid toilet-use event, and a wake-up interrupt signal is sent to the application processor core. If any sensor fails to meet the conditions, the system returns to deep sleep mode. This logic effectively eliminates false triggers caused by pedestrians passing by, pets approaching, or objects falling.

[0078] The low-power management mechanism of the main control module includes:

[0079] Level 1 Sleep: The application processor runs at a reduced frequency, unnecessary peripherals are turned off, but Wi-Fi / Bluetooth connectivity and low-frequency operation of the TOF sensor are retained; Level 2 Sleep: The application processor is completely powered off, only the microcontroller core and real-time clock run, Wi-Fi / Bluetooth are turned off, the TOF sensor operates intermittently, and the IR / mmWR sensor remains in low-power monitoring mode; Level 3 Sleep: Only the battery voltage detection circuit is retained, all functions are turned off, and it needs to be woken up by a physical button or NFC touch; By default, it enters Level 2 Sleep after 60 seconds of no operation, and automatically enters Level 3 Sleep protection when the battery level is lower than the threshold.

[0080] A method for intelligent analysis and control of excrement based on multi-sensor fusion, comprising:

[0081] I. Legal Authorization and System Initialization. After the device is powered on, the main control module loads the firmware and performs a self-test. Upon first use, the system mandates a connection with the mobile terminal app via Bluetooth (long press the device button for 3 seconds to trigger pairing) or NFC touch. The mobile terminal app interface will display a privacy policy and user authorization agreement, clearly stating that the purpose of image acquisition is solely for digestive health analysis, data flow, and processing rules. Only after the user explicitly clicks "agree" and authorizes will the app issue an activation key and network configuration certificate to the device via Bluetooth GATT (General Attribute Profile) service or NFC APDU (Application Protocol Data Unit) command. After verifying the key, the device calibrates the TOF sensor zero point, checks the camera and LED module status, and establishes a Bluetooth broadcast to await subsequent network configuration. The technical solution of this invention strictly adheres to laws and social ethics: ① Legality of acquisition premises. Excrement image acquisition is strictly based on the user's informed consent and active authorization; unauthorized devices will refuse to activate the imaging module; ② Non-invasive data. The sensors only collect data on distance, probability of presence, and the physical morphology of excrement inside the toilet bowl. They do not involve sensitive biometric features such as facial features or voiceprints, and do not constitute direct surveillance of people; ③ They are ethically sound. The data is used solely for personal health management assistance, and the algorithm rules are intended to provide medical reference indicators. They are not used for any commercial resale, social evaluation, or illegal or irregular monitoring, and are in line with public health interests.

[0082] II. Multi-sensor Fusion Monitoring. The present invention enters a low-power monitoring loop. The microcontroller reads the distance data Dt from the TOF sensor and the presence probability value Pexist from the IR / mmWR sensor. The threshold settings are as follows: Dt is set to 30cm, based on geometric calculations of the vertical distance between the standard toilet sidewall clamping height and the seat ring, effectively filtering out distant pedestrians; Pexist is set to 0.8, based on the signal-to-noise ratio characteristics of the IR / mmWR sensor, filtering out environmental heat source interference; the Tvalid time threshold is set to 2 seconds, used for time window de-jittering to eliminate momentary interference caused by water splashes or pet jumps. Judgment logic: If Dt ≤ 30cm and Pexist ≥ 0.8 for 2 seconds, it is determined that toilet use has begun, and step three is executed; if only the distance condition is met but the presence probability condition is not, it is determined to be interference, and the system remains in sleep mode.

[0083] III. System Wake-up and Pre-Flash Optimization Based on Historical Data Self-Learning. The microcontroller sends a hard interrupt to the application processor to start the main system kernel. During the initialization of the camera and LED modules, closed-loop adaptive pre-flash iterative adjustment is performed:

[0084] ① Input: The brightness histogram feature vector of the current environment preview frame, and a feature-parameter library consisting of the optimal LED duty cycle and ISP exposure parameter combination successfully acquired by the device in the local secure storage area during this time period (or similar lighting environment); ② Processing: The application processor extracts the features of the current preview frame, performs Euclidean distance similarity matching in the historical library, finds the closest historical optimal parameters as the initial pre-flash parameters, and performs a low-brightness pre-flash. After acquiring the pre-flash feedback image, the error between the actual average brightness and the target brightness (e.g., grayscale value 128) is calculated. If the error is within the allowable range, the parameters are locked; if it exceeds the range, a new PWM duty cycle is calculated using the PID algorithm for a second fine-tuned pre-flash. At the same time, the environmental features and optimal parameters that finally meet the standard are updated to the feature-parameter library as new samples, realizing the device's self-learning iteration of the lighting model in a specific toilet environment; ③ Output: The rapidly converged LED drive duty cycle and ISP exposure / gain parameter combination, and the Wi-Fi module is initialized simultaneously. This mechanism breaks the limitations of traditional fixed parameters. With increased usage, the device pre-flash calibration time is significantly shortened, effectively reducing power consumption during the wake-up phase and improving the color reproduction and HDR synthesis quality of the first frame image.

[0085] The specific principle of PID fine-tuning pre-flash is a closed-loop feedback process: Error calculation: The ISP hardware calculates the actual average brightness Ycurr of the pre-flash image and subtracts it from the target brightness (e.g., grayscale value 128) to obtain the brightness error e = Ytarget - Ycurr. PID calculation: Based on the error, a new control quantity is calculated using the formula: new PWM duty cycle = old duty cycle + Kp * e + Ki * error integral, where Kp is the proportional gain and Ki is the integral gain. Overexposure prevention constraint: The proportion of highlight areas in the histogram is additionally checked. If it exceeds 5%, the brightness is forcibly reduced to prioritize the protection of details such as the gloss of excrement. Iterative loop: The new PWM duty cycle is output to the LED driver for adjustment. The image is taken again, and the above steps are repeated until the brightness error falls within the allowable range, and finally, the lighting parameters are locked.

[0086] IV. Dynamic Image and Video Acquisition and Analysis. During the static capture phase, the camera continuously captures N RAW format images at a high frame rate. The ISP performs noise reduction, white balance, and color correction in real time, synthesizing a single high dynamic range (HDR) still image. Specific steps and principles of the video acquisition and analysis phase:

[0087] ① Stream Initialization and Hardware Access. Configure the MIPI CSI-2 interface, enable the V4L2 (a video subsystem) underlying driver, allocate multiple DMA (for hardware write-to-memory) buffers to build a circular queue, and start the RK3562 (a processor model) built-in hardware ISP pipeline; ② Frame-by-Frame Real-Time Processing. The camera outputs underlying RAW data at 1080P@60fps. The hardware ISP pipelines black level correction, bad pixel repair, depixelation, automatic white balance, and automatic exposure for each frame, outputting a YUV4:2:0 format video stream; ③ Hardware Encoding and Dynamic Feature Extraction. The YUV video stream is sent to the built-in H.264 / H.265 hardware encoder (VPU). During encoding, the motion estimation and motion compensation hardware macroblock partitioning mechanism within the VPU is used to extract the dynamic deformation features of excrement under water flow impact, such as settling rate and morphological edge diffusion parameters; ④ Edge-Side AI Concurrent Inference. Keyframes are extracted synchronously through the NPU at a frequency of 1 frame per second, and a lightweight target detection and quality assessment model is run. ⑤ Recording Control. The video recording duration Tvideo is set to 10 seconds, based on the statistical duration of a normal excretion process. During this period, the TOF sensor continuously monitors; if Dt > 40cm, it is determined that the user has left prematurely, recording is immediately terminated, and the process proceeds to step five.

[0088] Lightweight target detection and quality assessment models include:

[0089] 1. Model Structure and Basic Architecture: Employs an improved lightweight object detection network (YOLO-lite). Unlike traditional networks, this model does not output dense feature maps across the entire image in intermediate layers (such as the last convolutional layer). Instead, it divides the feature maps into multiple super-blocks in spatial dimensions, such as 32×32 pixel macroblocks. Sparse Coding Output: The final output is not a complete image, but a combination of a binary spatial mask and sparse feature vectors from a few activated super-blocks.

[0090] 2. Model parameters, quantization parameters: The model undergoes INT8 quantization to compress data precision and adapt to the low-power computing requirements of the RK3562NPU (supporting mixed INT4 / INT8 / INT16 / FP16 operations). Feature determination parameters: The L1 norm is used as a sparsity threshold to determine whether superblocks are activated, including pathological features.

[0091] 3. Specific training process and deployment conversion: The model is converted from a model trained on a general framework such as TensorFlow or PyTorch to a model dedicated to the RK3562 NPU for deployment using the RKNN Toolkit.

[0092] 4. Evaluation Logic and Quality Assessment: Combine ISP hardware to remove overexposed frames (completely black / white) or severely blurred frames. Semantic Filtering: Identify the existence and confidence level of valid excrement targets; determine lens occlusion (large areas of low-texture monochrome blocks) or empty shots of the toilet. ROI Extraction: After confirming valid targets, extract bounding boxes as regions of interest for local encoding.

[0093] V. Edge Preprocessing and Encryption. The application processor compresses and encapsulates the acquired images and videos, such as into MP4 / JPEG formats; it adds timestamps, device IDs, and session ID watermarks. It then calls the Trusted Execution Environment (TEE) to generate a session key, encrypts the data packets using the AES-256-GCM algorithm, and appends an HMAC-SHA256 signature to prevent tampering.

[0094] VI. Data Upload and Privacy Cleanup. Encrypted data packets are uploaded to the cloud server via Wi-Fi using the HTTPS (TLS 1.3) protocol. The cloud performs data anonymization and isolation; original images and videos exist only in memory for AI analysis. After analysis, image files are physically destroyed immediately, and the cloud database retains only structured health indicator results, such as the Bristol classification code. The specific steps and principles of cloud-based AI analysis include:

[0095] Feature Extraction: The AI ​​engine uses computer vision algorithms to analyze raw images / videos in memory, extracting core visual features such as shape, color, and texture of excrement. Indicator Conversion and Evaluation: The extracted features are compared and calculated against medical standards (such as the Bristol Stool Scale) to derive specific health indicators. Structured Output Results: Structured data is generated, such as Bristol Stool Scale codes for assessing intestinal condition; color anomaly warnings (e.g., indications of gastrointestinal bleeding); and occult blood risk alerts.

[0096] Upon completion of the analysis, the original image and video files are immediately physically destroyed from memory, while the cloud database permanently retains only the aforementioned irreversible structured health indicators. After receiving ACK confirmation from the cloud, the device immediately and completely overwrites and erases the original data and keys from its local storage. If the upload fails, the data is temporarily stored in a local encrypted partition, awaiting network recovery for a retry. Users can exercise their right to be forgotten at any time via the app, logging out of the device with a single click and simultaneously clearing all associated results from the cloud.

[0097] VII. Event End and Sleep. When the IR / mmWR sensor does not detect a human signal for a continuous stay time, it is determined that toilet use has ended. The continuous stay time is set to 5 seconds to prevent misjudgment due to user posture adjustments. The camera, LED, and Wi-Fi module are turned off, the current status log is saved, the microcontroller cuts off the application processor power, and the system returns to the second-level sleep state.

[0098] This invention also includes a guest mode process: when an NFC tag touch is detected or a guest session command (0xFFF4 feature value written) is received via Bluetooth, the device enters guest mode. The device requests a one-time temporary token from the cloud and creates a guest session that is not bound to a long-term identity. In this mode: the collected data is marked as a temporary attribute at the metadata layer; during data processing and uploading, the device provides a clear visual privacy reminder through a constantly lit red LED; after the cloud completes the analysis and issues a one-time analysis result, or within 24 hours after the session ends, the cloud issues a destruction command, and the device and the cloud synchronously perform an irreversible data overwrite and destruction operation, such as writing random numbers 0xFF / 0x00 multiple times, to ensure that the temporary data cannot be recovered, completely severing the association with any long-term user profile, and meeting privacy compliance requirements in multiple scenarios.

[0099] Example 1, Hardware System Architecture:

[0100] The core hardware platform utilizes the RK3562 industrial-grade processor. This processor employs a quad-core ARM Cortex-A53 architecture with a clock speed of up to 2.0GHz, and integrates a 1 TOPS NPU and a 13MISP ISP, perfectly meeting the device's requirements for image processing and edge AI inference. Furthermore, the RK3562's integrated low-power management unit can work in conjunction with an external independent GD32 series Cortex-M0 microcontroller to achieve precise power consumption control.

[0101] I. The main control board adopts a double-layer PCB design, with the core board (SoM) on the upper layer and the baseboard on the lower layer. The core board houses the RK3562 chip, LPDDR4 memory (2GB / 4GB optional), and eMMC storage (8GB / 16GB optional). The baseboard is responsible for peripheral interface expansion. Upon startup, the Cortex-M0 MCU runs first, monitoring power status, button input, and sensor data. When a valid event is detected, the MCU pulls high the Enable pin of the PMIC (Power Management Chip) via a GPIO interrupt signal, powering the Cortex-A53 core group and releasing the reset signal to start the Linux operating system. This design ensures that the system consumes only microamps of current 95% of the time. The eMMC storage is divided into four partitions: Boot, System, Data, and Secure. The Secure partition stores the device unique identifier (UUID), Wi-Fi credentials, and encryption keys. Direct reading is prohibited in hardware; access must be through a Trusted Execution Environment (TEE).

[0102] II. Multimodal sensing trigger module design to solve the false triggering problem, including: a Time-of-Flight (TOF) sensor, such as the VL53L7CX. This sensor has an 8×8 area ranging capability, a maximum ranging distance of 4 meters, and an accuracy of ±3%. A TOF sensor connects to the MCU via an I2C interface and is configured in low-power continuous ranging mode. Its main function is to accurately measure the distance to objects above the toilet seat. A threshold of 30cm is set; when an object is detected entering this distance range, a primary trigger signal is generated. An IR / mmWR sensor, i.e., an infrared thermopile sensor or a similar millimeter-wave radar module, such as the STHS34PF80, is selected. This sensor is extremely sensitive to human thermal radiation and minute movements, such as chest rise and fall caused by breathing. It connects to the MCU via an I2C or UART interface. Its main function is to perform presence confirmation.

[0103] Thirdly, to address the high false trigger rate of single sensors in existing technologies, this invention runs a feature-weighted Bayesian decision tree hybrid fusion algorithm within the microcontroller. This algorithm fully utilizes the limited computing power of the MCU to deeply fuse TOF distance data with IR / mmWR existence probabilities in both temporal and spatial dimensions. The specific steps, parameter settings, and calibration process are as follows:

[0104] 1. Algorithm execution process and model architecture: This fusion algorithm adopts a three-stage pipeline architecture.

[0105] (1) Multi-source sensor data preprocessing and feature extraction: wake up the TOF and IR sensors with a period of 500ms. Obtain the distance measurement value Dt at the current moment. To eliminate transient noise such as water splash, construct a sliding window with a length of N=4, and calculate the mean distance μD and variance σD2 within the window. If σD2 is greater than the preset jump threshold, such as 15cm², it is judged as an interference glitch, and μD is set to invalid. Read the original output value Praw∈[0,1] of the existence probability of the IR sensor. Introduce the integral feature of the time dimension and calculate the continuous count Cpersist of Praw>0.5 within K consecutive periods.

[0106] (2) State confidence assessment based on Naive Bayes. For the mean effective distance μD and existence probability Praw after preprocessing, the Naive Bayes classifier is used to calculate the posterior probability P(Stoilet|μD,Praw) of the current time belonging to a real toilet use event (Stoilet). Based on Bayes' theorem, the posterior probability P(real toilet use|distance, existence probability) of the current time belonging to a real toilet use event is calculated. The formula is expanded as follows: Posterior probability ∝ P(distance|real toilet use) × P(existence probability|real toilet use) × P(real toilet use) * Prior probability P(real toilet use) P(real toilet use): set according to the daily usage frequency of household toilets (e.g., 0.05). Distance-likelihood function P(distance|actual toilet): Fitted to a Gaussian distribution using offline collected positive sample data. Existence probability-likelihood function P(existence probability|actual toilet): Fitted to a Beta distribution using offline collected positive sample data.

[0107] Assuming the two sensors are conditionally independent under a given event state, the Bayesian formula is applied: P(Stoilet|μD, Praw) ∝ P(μD|Stoilet) × P(Praw|Stoilet) × P(Stoilet), where: P(Stoilet) is the prior probability of the toilet-use event, set to 0.05 based on the daily usage frequency of household toilets. P(μD|Stoilet) is the distance likelihood function, modeled as a Gaussian distribution N(μD_toilet, σD_toilet2). P(Praw|Stoilet) is the existence probability likelihood function, modeled as a Beta distribution Beta(α, β). The MCU quickly performs multiplication and accumulation using a lookup table method (pre-discretizing the Gaussian and Beta distributions into a 256-level lookup table), outputting the initial Bayesian confidence score Cbayes∈[0, 100]. Because the device runs on a low-power microcontroller (MCU) with limited computing power, it cannot perform complex real-time floating-point operations. Therefore, a lookup table method is used: the Gaussian and Beta distributions are pre-discretized into a 256-level lookup table and stored in the MCU's Flash memory. During operation, the MCU only needs to look up the corresponding probability value based on the input distance and probability value, perform simple multiplication and accumulation, and quickly output a preliminary Bayesian confidence score (0-100 points).

[0108] (3) Spatiotemporally weighted multi-level decision tree decision. The Bayesian confidence score (Cbayes) and the temporal feature (Cpersist) are input into a lightweight decision tree for final logical decision. The decision tree nodes are defined as follows:

[0109] Node 1 (Spatial Hard Truncation). If μD > 30cm, output interference / invalid, clear the timer and return to sleep; otherwise, proceed to Node 2. 30cm is based on the geometric calculation of the toilet sidewall clamping installation height and the seat ring. Node 2 (Time Duration Determination). If Cpersist < 4, i.e., not lasting 2 seconds, output suspected interference and continue monitoring; if Cpersist ≥ 4, proceed to Node 3. Node 3 (Weighted Fusion Determination). Calculate the comprehensive determination score Score = W1 × Cbayes + W2 × (Praw × 100). W1 takes the value of 0.7, and W2 takes the value of 0.3. If Score ≥ Thresholdfinal, output a valid toilet use event and trigger a hardware interrupt to wake up the application processor; otherwise, maintain the current state.

[0110] 2. The training process is detailed, including offline data statistics and parameter calibration mechanisms. Given that this invention runs on a low-power MCU without a deep learning acceleration unit, it does not employ traditional gradient descent backpropagation training. Instead, it uses an offline data statistics and calibration mechanism based on real-world scene data collection, along with a grid search optimization mechanism.

[0111] Training data source. A prototype device was deployed in a closed test bathroom, and multi-source sensor time-series data was collected over a period of one month. The dataset contains 2000 positive samples, representing real toilet use and covering different body types and sitting postures; and 5000 negative samples, including disturbances such as pedestrians passing by, pets jumping, flushing water flow fluctuations, and hands reaching in. Preprocessing and likelihood function fitting. Histogram statistics were performed on μD in the positive sample set, and a Gaussian distribution with mean μDtoilet = 15.2 cm and standard deviation σDtoilet = 4.5 cm was fitted using maximum likelihood estimation; the shape parameters α = 8.2 and β = 1.5 were fitted to Praw, yielding a Beta distribution. These distribution parameters were then stored in the MCU's Flash lookup table. Optimization algorithm for decision tree weights. A grid search algorithm was used to traverse the parameter space of W1∈[0.4, 0.9] (step size 0.1), W2∈[0.1, 0.6] (step size 0.1), and Thresholdfinal∈[50, 80] (step size 5). The objective function was set to minimize the false trigger rate and constrain the missed trigger rate to <1%. The optimal hyperparameter combination was finally determined to be W1=0.7, W2=0.3, and Thresholdfinal=65.

[0112] 3. Explicit Parameter Settings: Criteria for Selecting Key Hyperparameters. To ensure the reproducibility of the algorithm, the criteria for setting core parameters are shown in Table 1 below:

[0113] Table 1. Parameter Setting Basis

[0114]

[0115] 4. Comparison of experimental data:

[0116] To demonstrate the practical technical effectiveness of the aforementioned fusion algorithm, a comparative test was conducted between the device with the above calibration parameters and a traditional solution. Test sample: 50 households, totaling 15,000 toilet visits and daily activities. The test results are shown in Table 2.

[0117] Table 2 Test Results

[0118]

[0119] The data above shows that the feature weighted fusion algorithm based on Bayesian decision tree disclosed in this invention, although introducing a 2-second time decision window that slightly increases the response delay, completely solves the pain point of false alarms in complex bathroom environments while fully meeting the timeliness requirements of non-intrusive monitoring. Moreover, it consumes very little MCU computing power resources, perfectly meeting the low power consumption requirements of battery-powered devices.

[0120] IV. High-definition imaging and illumination module design:

[0121] The camera uses a CMOS sensor, such as the GC2093 or IMX708, supporting 1080P@60fps or higher. The lens is a large-aperture (F1.8), wide-angle (FOV 70°-90°) fixed-focus lens with optically optimized focal length to ensure optimal depth of field and sharpness at a distance of 20-40cm above the toilet. The camera connects directly to the RK3562's ISP unit via a MIPI CSI-2 interface. An adaptive lighting system features a ring-shaped PCB sub-board around which six high color rendering index (CRI > 90) white LEDs (2835 package) are mounted. The LEDs are driven using PWM dimming, controlled by the RK3562's PWM pin or a dedicated LED driver chip.

[0122] When the relevant device of this invention is activated, the ISP first reads a low-exposure preview image and calculates the histogram distribution of the image. If the average brightness is below a threshold, the MCU increases the LED PWM duty cycle; if the highlight area is too large, the duty cycle is decreased. This process is performed once per second during video recording to achieve dynamic light control. In addition, the LED flicker frequency is strictly synchronized with the camera frame rate to avoid stripes caused by the rolling shutter effect.

[0123] V. Wireless Communication and Interaction Module:

[0124] The Wi-Fi / Bluetooth functionality utilizes modules such as the AP6275S or BL-M8822CU1, supporting Wi-Fi 6 (802.11ax) and Bluetooth 5.2. The Wi-Fi and Bluetooth antennas are led out via onboard PCB antennas or external IPEX connectors, with strict impedance matching and isolation requirements during layout to prevent mutual interference. The Bluetooth function is used for initial network pairing. Users open the mobile app, press and hold the device button for 3 seconds to enter pairing mode; the blue LED flashes, and the app writes the home Wi-Fi SSID (Service Set Identifier) ​​and password to the device via BLE GATT service (UUID: 0xFFF0 series). Upon successful pairing, the LED remains lit and a dual beeping sound indicates successful pairing. The NFC function integrates a module such as the HR60-S335III, supporting ISO 7816 APDU commands. The NFC antenna coil is embedded in the top of the device casing. For quick network pairing, a phone with the app installed touches the NFC area, automatically launching the app and completing Wi-Fi configuration. In guest mode, when a phone without the app installed touches the NFC area, it automatically redirects to the UniversalLink webpage, guiding the user to download the app or start a temporary guest session. During the guest session, the device receives commands via BLE (Bluetooth Low Energy), and the collected data is marked as temporary and destroyed immediately after analysis. Audio-visual feedback is provided. The device is equipped with a four-color RGB LED indicator and a miniature buzzer. The indicator colors include red, green, blue, and amber. In the status indicators, flashing blue indicates pairing in progress; solid blue indicates successful pairing / in operation; solid green indicates successful Wi-Fi connection / ready; solid red indicates processing / uploading; and slow flashing blue indicates standby / sleep. Audio prompts include: dual beeps for successful pairing and a long beep for setup completion.

[0125] VI. Power Management Module:

[0126] The battery uses a dual-cell series (7.4V) or single-cell high-capacity (3.7V / 6500mAh) lithium-ion battery pack with a built-in protection board (BMS) providing overcharge, over-discharge, overcurrent, and short-circuit protection. The main power supply path in the DC-DC conversion uses high-efficiency buck-boost chips such as the TPS63020 to stably convert the battery voltage to 3.3V / 1.8V for system use, with a conversion efficiency of over 90%, extending battery life. The power domain is divided into an Always-On domain, Wi-Fi domain, Camera domain, and Core domain. The Always-On domain only supplies power to the MCU, RTC, and sensors. The MCU can independently control the on / off state of other domains via MOSFET switches. In deep sleep mode, only the Always-On domain is powered, and the overall power consumption is less than 50μA.

[0127] VII. Mechanical Structure and Protection:

[0128] The outer shell is made of flame-retardant ABS and PC materials with a stain-resistant coating. The overall design is compact, measuring approximately 80mm × 45mm × 30mm. All interfaces, such as the USB-C charging port and adjustment port, are sealed with silicone plugs in a waterproof design. The seams of the shell are ultrasonically welded or fitted with waterproof rubber rings, achieving an IPX4 splash-proof rating, suitable for the humid environment of a bathroom. The mounting mechanism features a strong anti-slip silicone pad and an adjustable spring clip at the bottom, securely clamping to the toilet sidewall or tank edge without damaging the ceramic surface. The lens angle can be finely adjusted within ±15° to accommodate the internal structure of different toilets.

[0129] Example 2, Software System Architecture Design:

[0130] The software system of this invention adopts a layered and decoupled architecture design to ensure the stability of business logic and the portability of underlying hardware drivers. The software system is divided into four layers from bottom to top:

[0131] 1. Hardware Abstraction Layer (HAL) and Driver Layer. This layer directly interacts with the hardware, including the TOF sensor driver, IR sensor driver, Camera HAL (camera hardware abstraction layer) based on the V4L2 framework, LED PWM driver, Wi-Fi / BT / NFC communication protocol stack, and power management driver, controlling multiple power domains.

[0132] 2. System Middleware Layer. Provides core service support. Includes a sensor data fusion engine that executes Kalman filtering and time window stabilization algorithms; image processing middleware that calls the ISP hardware interface for HDR synthesis and white balance adjustment; security encryption / decryption middleware that interfaces with hardware SE or TEE environments to perform AES and RSA operations; and a device state machine manager that maintains the switching logic for level 1, 2, and 3 sleep states.

[0133] 3. Business Logic Layer. This layer implements specific functional logic, including event listening and judgment services; adaptive lighting control services (calculating duty cycle based on a PID closed-loop algorithm); data acquisition and encoding services (controlling static continuous shooting and H.264 video stream recording); edge AI inference services (calling the NPU for image quality scoring and abnormal frame filtering); and cloud interaction services (handling MQTT / HTTPS connections, resuming interrupted downloads, and ACK confirmation). The specific mechanisms for image quality assessment and abnormal frame filtering are as follows:

[0134] ① Rapid Quality Assessment Based on Hardware ISP: During the process of the camera continuously triggering 10 snapshots and recording 10 seconds of video, the ISP hardware pipeline is used to extract the Y component brightness histogram, local contrast, and autofocus (AF) evaluation value of each frame in real time. The system presets quality judgment thresholds, such as: the average gray value is in the range of 80-180 and the proportion of high-frequency edge pixels is greater than 5%. For frames that are completely black or completely white due to extreme lighting, or frames with severe motion blur due to user actions, they are directly marked as low quality in memory and discarded, and do not enter the encoding process. ② Semantic Anomaly Filtering Based on NPU: For valid frames that pass the quality assessment, the NPU is called to load a lightweight object detection network that has been quantized with INT8, such as the improved YOLO-lite model. ③ ROI Extraction and On-Demand Encoding: When the NPU confirms the existence of a valid target, the bounding box containing the target is extracted as the Region of Interest (ROI). Only the ROI region is subjected to high-quality H.264 video encoding or JPEG still image compression, and a large number of meaningless toilet background areas are discarded.

[0135] The object detection network is an improved YOLO-lite model, the structure and parameters of which have been given previously. The NPU performs forward inference on the image, identifies the semantic features of whether there are valid excrement targets in the scene, and outputs a confidence score. When the lens is detected to be obstructed by foreign objects, such as being completely covered by toilet paper, which appears as a large area of ​​low-texture monochrome block; when there is no target in the toilet, such as in an empty shot; or when the confidence score is lower than a preset threshold, it is judged as abnormal and invalid data.

[0136] 4. Application Interface Layer. Provides a unified interface for interaction with external devices, including the BLEGATT configuration interface, the NFCNDEF message parsing interface, and the local log and diagnostic interface, such as a mobile app.

[0137] The complete operation flow of the software function is as follows:

[0138] 1. After the system powers on and resets, the underlying bootloader loads the MCU firmware, and the MCU completes a hardware self-test, such as checking battery level and I / O. 2 The system communicates with C (a serial communication bus protocol) and initializes the sensor driver. Subsequently, the system enters a low-power monitoring loop, where the MCU polls and reads TOF and IR data at a low frequency, which is then processed by the fusion engine. The bootloader is the first code executed after the MCU powers on or resets.

[0139] 2. When the fusion engine outputs a valid event flag, a hardware interrupt is triggered to wake up the application processor. After the Linux kernel starts, the event listening service of the business logic layer takes over control and sequentially starts the Camera HAL and LED driver. During the acquisition process, the adaptive lighting control service and the image processing middleware form a closed loop: for each captured frame, histogram features are extracted immediately, the PID algorithm calculates a new PWM value and sends it to the driver to achieve frame-by-frame exposure compensation.

[0140] 3. After data acquisition, the data acquisition and encoding service transmits the data stream to the edge AI inference service for quality screening, removing blurry frames. Qualified data flows into the security encryption / decryption middleware for encapsulation and encryption, and is then uploaded by the cloud interaction service. While the network thread waits for a cloud response, the main control thread continuously monitors for sensor departure signals. Once a cloud confirmation is received or the timeout retries reach their limit, the system calls the state machine manager to execute resource release and security erase instructions. Finally, the power management driver cuts off the main system power supply, and the process loop returns to the MCU's low-power monitoring state.

[0141] Example 3: Control Method Flowchart

[0142] This embodiment describes in detail the software control logic based on the above hardware platform. The control method of this embodiment is as follows:

[0143] 1. Initialization. The MCU starts reading BMS data, initializes the sensor, and establishes Bluetooth broadcast. 2. Fusion Monitoring. The system enters Level 2 sleep mode. The MCU wakes up the TOF sensor every 500ms. If the distance is ≤30cm, the IR sensor is activated to calculate the probability of presence. If the condition is met for 2 consecutive seconds, it is considered a valid event; otherwise, the timer is reset. 3. Wake-up Warm-up. The MCU pulls the PMIC (Power Management Integrated Circuit) signal high to start the application processor, initializes the camera and ISP, and calibrates the exposure parameters for LED pre-flash. 4. Dynamic Acquisition. During static capture, HDR images are synthesized; during video recording, H.264 encoding is initiated. The TOF continuously monitors during recording; if the distance is >40cm, recording is immediately terminated. 5. Preprocessing Encryption. A timestamp and device ID watermark are added. The data packet is encrypted using the AES-256-GCM algorithm via TEE, and an HMAC-SHA256 signature is appended. 6. Upload Cleanup. The encrypted packet is uploaded over the network. After receiving ACK confirmation from the cloud, the original local file and key are completely deleted. If this fails, the encrypted partition is temporarily stored. 7. End Sleep Mode. If the IR sensor fails to detect a human signal for 5 consecutive seconds, the process ends, the application processor power is cut off, and the system returns to level two sleep mode. 8. Guest Mode Process. A temporary Session ID is generated via NFC or Bluetooth. After data upload and analysis, a forced data overwrite and erasure is performed locally to ensure unrecoverable data. This describes the data processing flow in guest mode.

[0144] The key technologies of this invention include:

[0145] 1. Multi-sensor spatiotemporal fusion algorithm. Traditional solutions mostly use single sensors, while the fusion algorithm proposed in this invention is optimized in both time and space dimensions.

[0146] 2. Spatial Fusion. Time-of-Flight (TOF) provides a precise distance scalar, while Inductively Reflective (IR) provides an existence vector. They complement each other in three-dimensional space. TOF is susceptible to interference from transparent objects (such as water), while IR is unaffected; IR is susceptible to ambient temperature drift, while TOF is stable. Kalman filtering fuses the observations from both to obtain the optimal state estimate. Temporal Fusion: A sliding time window mechanism is introduced. Instead of a single sampling decision, the signal is required to continuously meet the condition within a continuous time window (e.g., 2 seconds). This effectively filters out transient noise.

[0147] 3. Closed-loop adaptive lighting control. Unlike fixed supplemental lighting strategies, this invention establishes a closed loop of perception, decision-making, and execution. The ISP hardware unit statistically analyzes the histogram of the Y component (brightness) in real time. In PID control, the target average brightness is set as Ytarget, and the current brightness is set as Ycurr. The error e = Ytarget - Ycurr. The LED duty cycle Dutynew = Dutyold + Kp * e + Ki * integral edt.

[0148] 4. Overexposure protection. Additional monitoring of the right tail (highlight area) proportion of the histogram; if it exceeds 5%, the brightness is forcibly reduced to prioritize preserving highlight details, as the gloss of excrement is an important characteristic.

[0149] 5. Multi-sensor distributed fragmented acquisition and ciphertext domain feature fusion mechanism: Addressing the security shortcomings of traditional plaintext fusion solutions, this invention constructs a ciphertext domain fusion architecture within the secure TEE world of the MCU. The specific steps are as follows:

[0150] ① Distributed fragmented acquisition. At the hardware driver layer, the raw data sampled by the TOF and IR sensors is not spliced ​​into whole packets, but is directly collected in fixed-length micro-blocks, such as 16 bytes. The hardware encryption engine is called to perform block-by-block stream encryption to generate a queue of ciphertext micro-blocks. The hardware encryption engine is such as AES-CTR mode.

[0151] ② Ciphertext Domain Token Mapping. The MCU's fusion engine does not perform decryption operations. Instead, it directly reads the header control information of the ciphertext micro-blocks or uses homomorphic operation characteristics to map the ciphertext distance value to discrete interval tokens, such as token A representing <30cm and token B representing >30cm, and maps the ciphertext existence probability to Boolean existence tokens.

[0152] ③ Ciphertext Domain Decision Tree Determination. The aforementioned interval token and existence token are directly input into the weighted decision tree for logical operations, namely pure integer comparison and Boolean operations. Since the decision tree logic itself does not depend on the absolute plaintext value of the data, the encrypted toilet event trigger flag is directly output without decrypting any original sensor data. Throughout the entire process, the original distance and probability values ​​are not exposed in main memory.

[0153] The specific principle of weighted decision trees performing logical operations in encrypted domain fusion: The core of encrypted domain fusion lies in performing tokenization logical operations without decryption. Specifically:

[0154] Token mapping. Within the secure TEE world, the MCU's fusion engine does not perform any decryption operations. Instead, it directly reads the header control information of the encrypted micro-blocks and maps the ciphertext distance value to discrete interval tokens. For example, token A represents <30cm, and token B represents >30cm. The ciphertext existence probability is also mapped to a Boolean existence token (true / false).

[0155] Purely logical decision-making. The decision tree's logic relies solely on spatial truncation (e.g., whether it's >30cm) and temporal duration (e.g., whether it's been 2 seconds). This involves pure integer comparisons and Boolean operations, not absolute plaintext data. Therefore, the discrete interval tokens and Boolean existence tokens are directly input into the decision tree for logical operations. Without decrypting any raw sensor data, an encrypted toilet-use event trigger flag is directly output. Throughout the entire process, the original distance and probability values ​​remain completely hidden in main memory.

[0156] In the decision tree, the spatial threshold is 30cm (calculated based on a vertical distance of approximately 25cm from the toilet fixture mounting surface to the center of the seat, with a 5cm redundancy allowance). The time threshold is a continuous judgment period of K=4 times, corresponding to a time window of 4×500ms=2s, used to filter out transient interference such as flushing water flow. The fusion weights are: Bayesian confidence weight W1=0.7, with high weight due to the strong spatial constraint of TOF ranging; and original existence probability weight W2=0.3, with secondary weight due to the auxiliary confirmation of IR presence detection. The final trigger threshold, Scoreth=65, achieves the optimal Pareto balance between false alarm rate and false negative rate. An offline data statistical calibration and grid search optimization mechanism based on real-world scenario acquisition is used, with the following specific steps:

[0157] Step 1: Collect Training Data. Deploy the prototype device in a closed test bathroom and collect multi-source sensor time-series data for one month. Construct a dataset containing 2000 positive samples and 5000 negative samples. Positive samples represent real toilet use, covering different body types and sitting postures, while negative samples include disturbances such as passersby, pets jumping, and fluctuations in flushing water flow.

[0158] Step 2: Fitting the likelihood function parameters. Histogram statistics are performed on the mean distances in the positive sample set. A Gaussian distribution parameter is fitted using maximum likelihood estimation, with a mean of 15.2 cm and a standard deviation of 4.5 cm. A Beta distribution parameter is fitted for the existence probability, with α = 8.2 and β = 1.5. These distribution parameters are then stored in the MCU's Flash lookup table for outputting the required Bayesian confidence score for node 3.

[0159] Step 3: Grid search to optimize weights. A grid search algorithm is used to traverse the set parameter space: W1∈[0.4, 0.9] (step size 0.1), W2∈[0.1, 0.6] (step size 0.1), and finally trigger threshold∈[50, 80] (step size 5).

[0160] Step 4: Determine the optimal hyperparameters. The objective function is set to minimize the false trigger rate while constraining the missed trigger rate to <1%. Through iterative calculations, the optimal hyperparameter combination is finally determined to be W1=0.7, W2=0.3, and the final trigger threshold is 65.

[0161] 6. Based on the NPU's feature-level super-block sparse coding mechanism, to avoid the memory consumption and privacy leakage caused by the dense feature maps output by traditional AI models, this invention adopts super-block sparse coding in the image processing stage after the application processor (AP) is woken up:

[0162] ① Feature map super-block partitioning: When performing forward inference in a lightweight object detection network (such as YOLO-lite), the NPU does not output a dense feature map across the entire image. Instead, in the middle layers of the network, such as the last convolutional layer, the feature map is divided into multiple super-blocks in the spatial dimension, such as 32×32 pixel macroblocks.

[0163] ② Sparse Activation and Mask Generation: For each super-block, the L1 norm of its internal feature vectors is calculated, which is the sparsity index. An activation threshold is set. If the L1 norm of a super-block is lower than the threshold, it means that the region is meaningless background water or ceramics, so all weights of the super-block are set to zero, and a 0 is recorded in the metadata. If it is higher than the threshold, it means that it contains texture features of excrement targets, so the sparse feature vector of the super-block is retained, and a 1 is recorded. This generates a very simple binary space mask.

[0164] ③ Sparse Feature Packaging and Isolation: The final output is not a complete plaintext image or dense feature map, but a combination of a binary space mask and a few activated superblock sparse feature vectors. This combined data volume is only 5%-10% of the original image, and due to the lack of global structural information, even if intercepted, the true visual morphology of the excrement cannot be reconstructed. Subsequently, only these sparse feature vectors are sent to an encryption module for encapsulation and uploading, achieving extremely secure feature extraction that is usable but invisible.

[0165] 7. Heterogeneous dual-core low-power architecture. It fully utilizes the internal PMU capabilities of the RK3562 and the ultra-low power characteristics of the external MCU. Clear division of labor: Cortex-A53, i.e., Linux, only runs when heavy computation (encoding, AI, networking) is required, with short cumulative working time; Cortex-M0 (RTOS / Bare-metal) runs 24 / 7, but with extremely low current consumption, less than 100μA.

[0166] 8. Power Gating. A dedicated power switch circuit is designed, allowing the MCU to physically cut off power to the AP's DDR memory, CPU core, and peripherals, achieving true power-off hibernation rather than just software suspension. This results in industry-leading standby current.

[0167] 9. Privacy-Prioritized Data Lifecycle Management. Memory Security: All sensitive data (keys, passwords) is stored only in the TEE secure world or a dedicated secure chip, inaccessible directly to Rich OS (a Linux system). Transmission Security: End-to-end TLS 1.3 encrypted channel with two-way certificate authentication. Storage Security: Local storage uses a LUKS or similar encrypted file system. Destruction Mechanism: Logical destruction and physical overwriting in guest mode provide dual protection, complying with privacy regulations.

[0168] Application scenarios and test data of this invention:

[0169] 1. Application Scenarios. The device is mainly used in home bathrooms, installed on the side wall of a regular toilet. Users do not need to change their toilet habits; the device automatically completes the monitoring. After the data is uploaded to the cloud, the AI ​​engine analyzes it and generates a health report, such as Bristol classification, occult blood risk warnings, and color abnormality alerts, which are then pushed to the user's mobile app.

[0170] 2. Test Data Comparison. During a 3-month field test, with a sample size of 50 households and approximately 15,000 toilet visits, the technology of this invention was compared with a traditional single-infrared sensor solution.

[0171] Regarding the false trigger rate, the traditional single-infrared solution has a false trigger rate of 12.5%, mainly caused by passing by or pets; the multi-sensor fusion solution of this invention has a false trigger rate of 0.8%, a reduction of 93.6%. Regarding the missed trigger rate, the traditional single-infrared solution has a false trigger rate of 3.2%, mainly caused by stationary behavior; the multi-sensor fusion solution of this invention has a false trigger rate of 0.5%, a reduction of 84.4%. Regarding the average standby power consumption, the traditional single-infrared solution has a power consumption of 1.2mA, requiring high-frequency polling; the present invention has a power consumption of 0.04mA, with low-frequency MCU polling and sleep mode, a reduction of 96.7%. Regarding battery life, the traditional single-infrared solution has a battery life of approximately 15 days with a 2000mAh battery; the present invention has a battery life of approximately 180 days with a 6500mAh battery, a 12-fold improvement. Regarding image availability, the traditional single-infrared solution has an image availability of 78%, due to excessive darkness or overexposure; the present invention has an image availability of 98.5%, with adaptive lighting, a 20.5% improvement. Regarding user satisfaction, the traditional single-infrared solution has a rating of 3.5 / 5.0; the present invention has a rating of 4.8 / 5.0, a significant improvement. Test results show that this invention has significant advantages in accuracy, power consumption control, and user experience, and possesses extremely high commercialization value. Multi-sensor fusion triggering logic.

[0172] In summary, this invention proposes a complete, efficient, and secure excrement monitoring solution through deep collaborative innovation in both hardware and software. Multi-sensor fusion technology fundamentally solves the problem of false triggering, the heterogeneous computing architecture achieves a perfect balance between performance and power consumption, and a strict privacy protection mechanism eliminates user concerns. This technical solution is not only applicable to the current smart toilet market but also provides important technical reference and implementation examples for a wider range of future home health monitoring devices, demonstrating significant social benefits and broad market prospects.

[0173] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores static and dynamic information data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the above method embodiments.

[0174] Those skilled in the art will understand that Figure 3The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0175] In addition, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0176] In addition, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0177] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0178] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.

Claims

1. A method for intelligent analysis and control of excrement based on multi-sensor fusion, characterized in that, include: Based on the feature-weighted Bayesian decision tree hybrid fusion algorithm, combined with multi-sensor data features, real toilet use events are identified. Based on a self-learning strategy using historical data, and combined with the brightness histogram feature vector of the current environment preview frame, a closed-loop adaptive pre-flash iterative adjustment is performed to output the lighting parameters of the environment corresponding to the actual toilet use event. Pre-flash operation is performed based on lighting parameters, and images of actual toilet events are acquired to obtain images of excrement. By using an object detection network and a feature-level superblock sparse coding mechanism, the excrement image is spatially partitioned and superblock sparsely coded to obtain a sparse feature map. The sparse feature map is preprocessed at the end, encrypted block by block, and fused with ciphertext domain to obtain the encrypted data to be sent. The encrypted data to be sent is uploaded to the cloud, and the encrypted data packets are decrypted and isolated to complete the intelligent analysis of excrement.

2. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 1, characterized in that, The feature-weighted Bayesian decision tree hybrid fusion algorithm, combined with multi-sensor data features, identifies real toilet use events, including: Distance data is collected using a time-of-flight sensor; the probability of presence is obtained using an infrared or millimeter-wave radar sensor. Within a preset sliding window, the mean and variance of the distance data are calculated; if the variance of the distance data is greater than the preset jump threshold, it is determined to be interference; otherwise, the presence probability value of the infrared or millimeter-wave radar sensor is read. Calculate the number of consecutive periods in which the probability value is greater than a preset value. The posterior probability of a real toilet-use event at the current moment is calculated using a Naive Bayes classifier, and the Gaussian and Beta distributions are obtained by expanding the Bayesian formula. Combine the Gaussian and Beta distributions with a pre-built lookup table to output the Bayesian confidence score. By inputting Bayesian confidence scores and persistence counts into a lightweight decision tree for logical judgment, real toilet-use events can be identified.

3. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 2, characterized in that, The identification of real toilet use events includes: If the mean of the distance data is greater than the distance threshold, it is judged as an interference event; otherwise, the count is continuously read. If the count is consistently less than the count threshold, it is judged as an interference event; otherwise, a weighted sum is calculated based on the Bayes confidence score and the probability of existence to obtain a comprehensive judgment score. If the overall score is greater than the score threshold, it is judged as a real toilet use event; otherwise, it is not a real toilet use event.

4. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 1, characterized in that, The self-learning strategy based on historical data, combined with the brightness histogram feature vector of the current environment preview frame, performs closed-loop adaptive pre-flash iterative adjustment, and outputs the lighting parameters of the environment corresponding to the actual toilet use event, including: For real toilet use events, the brightness histogram feature vector of the current environment preview frame is obtained, along with the optimal LED duty cycle and ISP exposure parameters of historically successfully acquired data, and combined to form a feature parameter library; Based on the Euclidean distance of the brightness histogram feature vector of the current environment preview frame, the historical best LED duty cycle and ISP exposure parameters that are closest to the current environment are obtained and used as the initial pre-flash parameters for pre-flashing, and a pre-flash feedback image is obtained. The error between the actual average brightness of the pre-flash feedback image and the target brightness is calculated. If the error is within the allowable range, the corresponding parameters are locked. Otherwise, a second fine-tuning of the pre-flash is performed using a PID algorithm until the environmental characteristics meet the standard, and the lighting parameters of the environment corresponding to the actual toilet use event are obtained.

5. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 1, characterized in that, The method utilizes a target detection network and a feature-level super-block sparse coding mechanism to spatially partition and super-block sparsely code the excrement image, obtaining a sparse feature map, including: An object detection network is used to extract target feature maps from excrement images, and the target feature maps are divided into multiple super-blocks in the spatial dimension in the intermediate layer of the object detection network. Calculate the sparsity index of the feature vector within each superblock, compare it with the sparsity threshold, retain the sparse feature vector of the activated superblock, and generate a binary space mask. The sparse feature map is obtained by combining the output binary space mask with the sparse feature vectors of the activated superblocks.

6. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 5, characterized in that, The extraction of target feature maps from excrement images using a target detection network includes: The target detection network performs forward reasoning on excrement images to identify images containing valid excrement targets; For images containing valid excrement targets, the target region is extracted to obtain a target feature map.

7. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 1, characterized in that, The process of performing end-side preprocessing, block-by-block stream encryption, and ciphertext domain fusion on the sparse feature map to obtain encrypted data to be sent includes: Add timestamps, device IDs, and session IDs to the sparse feature map to obtain preprocessed data; perform block-by-block stream encryption on the preprocessed data to generate a queue of ciphertext micro-blocks; Ciphertext fields are fused into the ciphertext micro-block queue to obtain the encrypted data to be sent.

8. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 7, characterized in that, The ciphertext field fusion of the ciphertext micro-block queue includes: Map the ciphertext distance value in the ciphertext microblock to discrete interval tokens, and map the ciphertext existence probability to Boolean existence tokens; Logical operations are performed on the interval tokens and Boolean existence tokens input into a weighted decision tree to complete the ciphertext field fusion.

9. The intelligent analysis and control method for excrement based on multi-sensor fusion according to claim 1, characterized in that, It also includes a three-level sleep strategy for the main control module; During Level 1 hibernation, the application processor is downclocked; during Level 2 hibernation, the application processor is powered off and the sensors operate intermittently; during Level 3 hibernation, the battery detection circuit remains operational.

10. A smart excrement analysis and control system based on multi-sensor fusion, characterized in that, include: The toilet event recognition module is used to identify real toilet events based on a feature-weighted Bayesian decision tree hybrid fusion algorithm combined with multi-sensor data features. The lighting parameter output module is used to perform closed-loop adaptive pre-flash iterative adjustment based on a self-learning strategy using historical data and combined with the brightness histogram feature vector of the current environment preview frame, and output the lighting parameters corresponding to the environment of the actual toilet event. The image acquisition module is used to perform pre-flash operation based on lighting parameters and to acquire images of actual toileting events to obtain images of excrement. The sparse feature acquisition module is used to perform spatial partitioning and super-block sparse coding on excrement images using a target detection network and a feature-level super-block sparse coding mechanism to obtain sparse feature maps. The encryption analysis module is used to perform end-side preprocessing, block-by-block stream encryption, and ciphertext field fusion on the sparse feature map to obtain encrypted data to be sent. The encrypted data to be sent is uploaded to the cloud, and the encrypted data packets are decrypted and isolated to complete the intelligent analysis of excrement.