Traditional Chinese medicine processing process abnormality monitoring method and system based on reinforcement learning

By using a reinforcement learning-based method for monitoring anomalies in the processing of Chinese medicinal materials, a state feature sequence is constructed using surface color and temperature difference values. Combined with water loss rate and air temperature uniformity, dynamic anomaly assessment is performed, which solves the problem of insufficient monitoring accuracy in existing technologies and achieves stable and reliable monitoring of the drying process of Chinese medicinal materials.

CN123181906APending Publication Date: 2026-11-27INST OF MEDICINAL PLANTS YUNNAN ACAD OF AGRI SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611257787.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-19
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In the current hot air drying process of Chinese medicinal materials, the monitoring methods rely on manual inspection and fixed parameter judgment, which leads to insufficient accuracy in anomaly identification and difficulty in adapting to the characteristics of different batches of Chinese medicinal materials and the dynamic changes in the drying process, thus affecting the stability of the processing process and the stability of quality.

Method used

An anomaly monitoring method based on reinforcement learning for the processing of Chinese medicinal materials is adopted. By acquiring surface color values ​​and the temperature difference between hot air inlet and outlet, a state feature sequence is constructed. The probability distribution parameters of water loss rate are predicted using a reinforcement learning agent. Anomaly assessment is performed by combining the actual water loss rate and the uniformity of air temperature. The anomaly threshold is dynamically adjusted to improve the monitoring accuracy.

Benefits of technology

It improves the reliability and stability of monitoring the hot air drying process of Chinese medicinal materials, reduces false alarms and missed alarms, can adapt to different processing conditions, and accurately identify quality abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181906A_ABST
    Figure CN123181906A_ABST
Patent Text Reader

Abstract

The application discloses a traditional Chinese medicinal material processing process abnormality monitoring method and system based on reinforcement learning, and relates to the technical field of intelligent data processing, and comprises the following steps: acquiring surface chroma values and hot air inlet and outlet temperature difference values in a hot air drying process of traditional Chinese medicinal materials, and constructing a state feature sequence; outputting probability distribution parameters of an expected water loss rate based on a reinforcement learning intelligent agent; acquiring abnormal characteristic parameters by combining the deviation of an actual water loss rate from an expected value and the deviation of air temperature uniformity; correcting the uncertainty according to hot air temperature fluctuation and dynamically adjusting an abnormal threshold value; and judging quality abnormality based on the abnormal characteristic value and the dynamic abnormal threshold value. The method solves the problems that the processing process state monitoring mode is single, the processing state change cannot be accurately reflected, the abnormality recognition reliability is insufficient, and the monitoring stability is poor in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent data processing technology, specifically to a method and system for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning. Background Technology

[0002] Traditional Chinese medicinal herbs typically undergo drying during processing to reduce their internal moisture content, improve storage stability, and ensure their quality characteristics. Hot air drying is a commonly used method, and the temperature, humidity, and drying time during this process significantly impact the appearance, internal component stability, and final quality of the herbs. Therefore, effective monitoring of the herbs' condition during hot air drying is crucial for ensuring the quality of processed traditional Chinese medicinal herbs.

[0003] Currently, in the hot air drying process of Chinese medicinal materials, the condition of the materials is usually judged by manual inspection. For example, the drying status is evaluated by observing the appearance characteristics such as color and shape changes on the surface of the materials and combining them with the experience of the operators; or alarm conditions are set according to the preset range of process parameters such as temperature and humidity, and an abnormal prompt is given when the detected parameters exceed the set range.

[0004] However, in practical applications, the aforementioned monitoring methods are easily affected by factors such as the operator's experience level and differences in judgment standards, leading to variations in the evaluation results of the medicinal materials' condition by different personnel. Furthermore, when judgments are based on fixed parameter ranges, it is difficult to adapt to the characteristics of different batches of raw medicinal materials and the dynamic changes brought about by the drying process. When the state changes during processing do not reach the preset alarm conditions, potential quality anomalies may not be detected in time, while short-term fluctuations in local parameters may generate unnecessary alarms, affecting the stable operation of the processing process. Therefore, existing monitoring methods for the hot air drying process of medicinal materials still suffer from insufficient accuracy in anomaly identification and are insufficient to meet the requirements for quality stability in actual processing. Summary of the Invention

[0005] This invention provides a method and system for monitoring anomalies in the processing of Chinese medicinal materials based on reinforcement learning. This addresses the problems in existing technologies where data analysis methods for monitoring the processing status are relatively simple, making it difficult to accurately reflect changes in the processing status, resulting in insufficient reliability in identifying anomalies and poor stability in monitoring results.

[0006] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: In a first aspect, the present invention provides a method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning, including: The surface color values ​​and hot air inlet / outlet temperature differences of Chinese medicinal materials at multiple sampling times during the hot air drying process were obtained to form a state feature sequence. Based on the reinforcement learning agent, the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage are output, with the state feature sequence as input. The probability distribution parameters include the expected value and uncertainty. Collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient. Collect the wind temperature uniformity at multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient; An initial anomaly threshold is set, the uncertainty is corrected based on the current hot air temperature fluctuation range, the corrected uncertainty is obtained, and the initial anomaly threshold is dynamically adjusted to obtain a dynamic anomaly threshold. Based on the first deviation coefficient and the second deviation coefficient, an abnormal characterization value is calculated, and when the abnormal characterization value is greater than the dynamic abnormal threshold, it is determined that a quality abnormality has occurred in the drying process of Chinese medicinal materials.

[0007] Secondly, this invention provides an anomaly monitoring system for the processing of traditional Chinese medicinal materials based on reinforcement learning, comprising: The state feature acquisition module is used to acquire the surface color value and hot air inlet and outlet temperature difference value of Chinese medicinal materials at multiple sampling times during the hot air drying process, forming a state feature sequence. The reinforcement learning prediction module is used to output the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage, based on the reinforcement learning agent and the state feature sequence as input. The probability distribution parameters include the expected value and uncertainty. The water loss deviation calculation module is used to collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient. The wind temperature uniformity analysis module is used to collect the wind temperature uniformity of multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient. The dynamic threshold adjustment module is used to set an initial abnormal threshold, correct the uncertainty based on the current hot air temperature fluctuation range, obtain the corrected uncertainty, and dynamically adjust the initial abnormal threshold to obtain a dynamic abnormal threshold. The anomaly monitoring and judgment module is used to calculate the anomaly characterization value based on the first deviation coefficient and the second deviation coefficient, and to determine that a quality abnormality has occurred in the drying process of Chinese medicinal materials when the anomaly characterization value is greater than the dynamic anomaly threshold.

[0008] One or more technical solutions provided in this invention have at least the following technical effects or advantages: By acquiring state information such as surface color value and temperature difference between hot air inlet and outlet during hot air drying, a state feature sequence reflecting changes in the processing process is constructed, improving the comprehensiveness of processing state characterization. A reinforcement learning agent is used to analyze the processing state, obtaining a predicted water loss rate matching the current drying stage. Anomaly assessment is then performed based on actual water loss and changes in air temperature uniformity, improving the accuracy of quality anomaly identification. Furthermore, the anomaly judgment conditions are adjusted according to hot air temperature fluctuations, enabling anomaly monitoring to adapt to different processing state changes, reducing false alarms and missed alarms, and improving the reliability and stability of monitoring the hot air drying process of Chinese medicinal materials. Attached Figure Description

[0009] Figure 1 This is a schematic diagram of the process flow of the method for monitoring anomalies in the processing of Chinese medicinal materials based on reinforcement learning, provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the closed-loop control for monitoring abnormalities in hot air drying of Chinese medicinal materials provided in this embodiment of the invention; Figure 3 This is a schematic diagram of the structure of the reinforcement learning-based abnormal monitoring system for the processing of Chinese medicinal materials provided in an embodiment of the present invention.

[0010] In the attached diagram, the components represented by each number are as follows: The module includes: State Feature Acquisition Module 11, Reinforcement Learning Prediction Module 12, Water Loss Deviation Calculation Module 13, Wind Temperature Uniformity Analysis Module 14, Dynamic Threshold Adjustment Module 15, and Anomaly Monitoring and Judgment Module 16. Detailed Implementation

[0011] This invention provides a method and system for monitoring anomalies in the processing of Chinese medicinal materials based on reinforcement learning. It specifically addresses the problems in existing technologies where the data analysis methods for monitoring the processing status are relatively simple, making it difficult to accurately reflect changes in the processing status, resulting in insufficient reliability in identifying anomalies and poor stability in monitoring results.

[0012] It should be noted that the terms "comprising" and "having" are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to these processes, methods, products, or devices.

[0013] Example 1, as Figure 1 and Figure 2 As shown, this invention provides a method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning, including: S100: Obtain the surface color value and hot air inlet / outlet temperature difference value of Chinese medicinal materials at multiple sampling times during the hot air drying process to form a state feature sequence; Step S100 in the method provided in this embodiment of the invention includes: The surface chromaticity value is obtained by collecting images of the Chinese medicinal materials at each sampling time and converting them to the CIELAB color space. The average values ​​of the three channels (brightness, red-green, and yellow-blue) are extracted to form the original chromaticity vector. The vector is then smoothed by taking the median value of each channel back N times from the current time. The temperature difference between the inlet and outlet of the hot air is obtained by smoothing the temperature difference between the inlet and outlet at the same sampling time using the median value of the same N times, where N is an integer greater than 1.

[0014] Specifically, during the hot air drying process, an image acquisition device installed inside the drying equipment acquires images of the surface of the medicinal materials according to a preset sampling period, and then converts the acquired surface images into the CIELAB color space. The CIELAB color space includes a lightness component, a red-green component, and a yellow-blue component, which are used to characterize the changes in brightness, red-green, and yellow-blue on the surface of the medicinal materials, respectively.

[0015] Furthermore, all pixel values ​​corresponding to the lightness component, red-green chromaticity component, and yellow-blue chromaticity component in the converted CIELAB color space image are extracted respectively, and the arithmetic mean of all pixel values ​​of each component is calculated as the original chromaticity vector corresponding to the current sampling time.

[0016] Specifically, the mean value of the lightness component is calculated as follows: The mean value of the brightness component = the sum of the brightness values ​​of all pixels ÷ the total number of pixels in the image.

[0017] The mean weight of red and green samples is calculated as follows: Mean value of red-green chromaticity = sum of red-green chromaticity values ​​of all pixels ÷ total number of pixels in the image.

[0018] The mean value of the yellow-blue sample weight is calculated as follows: The mean value of the yellow-blue chromaticity component = the sum of the yellow-blue chromaticity values ​​of all pixels ÷ the total number of pixels in the image.

[0019] Using the above method, the mean values ​​of the lightness component, red-green magenta component, and yellow-blue magenta component corresponding to the current sampling time are obtained.

[0020] Since the surface color of Chinese medicinal materials usually shows a continuous trend during the hot air drying process, the image acquisition process may be affected by factors such as changes in light, equipment vibration and local occlusion, resulting in random fluctuations in the colorimetric data acquired at a single sampling moment. Therefore, this embodiment further uses the midpoint smoothing method in the time window to process the original colorimetric data.

[0021] Specifically, taking the current sampling time as the endpoint, backtracking N consecutive sampling times, sorting the mean values ​​of the lightness component, the mean values ​​of the red-green chromaticity component, and the mean values ​​of the yellow-blue chromaticity component corresponding to the N sampling times, and selecting the value at the middle position of the sorted values ​​as the smooth chromaticity value corresponding to the current sampling time.

[0022] For example, when N is set to 5, the mean values ​​of the five lightness components, including the current sampling time and the previous four sampling times, are obtained and sorted according to their numerical values. The third data after sorting is selected as the smoothed lightness value of the current sampling time. The red-green magenta component and the yellow-blue magenta component are processed in the same way.

[0023] The value of N is determined based on the image sampling period and the rate of color change of the medicinal materials. In this embodiment, the image sampling period is set to 1 minute, and N is set to 5, meaning that the median smoothing is performed using data collected within the most recent 5 minutes. This parameter is derived from the fact that color changes during hot air drying are continuous, while short-term random disturbances are usually short-lived. Smoothing using 5 sampling points can reduce the impact of abnormal fluctuations while ensuring a fast response to trends in quality changes.

[0024] Furthermore, while acquiring images of the surface of the medicinal herbs, the inlet and outlet temperatures of the hot air drying equipment are simultaneously collected, and the temperature difference between the inlet and outlet of the hot air is calculated based on the inlet and outlet temperatures at the same sampling time. Specifically: The temperature difference between hot air inlet and outlet = hot air inlet temperature - hot air outlet temperature.

[0025] Subsequently, the same time window median value smoothing method as the chromaticity data is used to process the hot air inlet and outlet temperature difference values ​​corresponding to the current sampling time and the previous N-1 sampling times to obtain the smoothed hot air inlet and outlet temperature difference values.

[0026] Furthermore, in order to reduce the impact of differences in the initial state of different batches of Chinese medicinal materials on the abnormal monitoring results, this embodiment performs standardization processing based on the historical state data corresponding to the current sampling time.

[0027] Specifically, taking the current sampling time as the endpoint, we trace back M consecutive sampling times and use the smoothed brightness value, smoothed red-green value, smoothed yellow-blue value, and smoothed hot air inlet and outlet temperature difference value obtained above to form the color history window and temperature difference history window, respectively.

[0028] Where M is an integer greater than N, and its value is determined according to the state change cycle during the hot air drying process. In this embodiment, the sampling period is set to 1 minute, and M is set to 30, that is, the data within the previous 30 minutes is used as the historical window.

[0029] The reason for using a 30-minute historical window is that the color changes and hot air temperature changes during the hot air drying process of Chinese medicinal materials usually have phased characteristics. Data within a 30-minute range can reflect the overall trend of the current drying stage, while avoiding the weakening of the current state characteristics due to excessively long historical data.

[0030] Furthermore, based on data from multiple sampling times within the colorimetric history window, the moving averages of the lightness component, red-green chromaticity component, yellow-blue chromaticity component, and the temperature difference between the hot air inlet and outlet are calculated respectively. Specifically: The moving average of the brightness component = the sum of all smoothed brightness values ​​within the history window ÷ the number of sampling times in the history window.

[0031] The moving average of the red-green chromaticity component = the sum of all smoothed red-green chromaticity values ​​within the historical window ÷ the number of sampling times in the historical window.

[0032] The moving average of the yellow-blue chromaticity component = the sum of all smoothed yellow-blue chromaticity values ​​within the historical window ÷ the number of sampling times in the historical window.

[0033] The moving average of the hot air inlet and outlet temperature difference = the sum of all smoothed hot air inlet and outlet temperature difference values ​​within the historical window ÷ the number of sampling times in the historical window.

[0034] Furthermore, the sliding standard deviation corresponding to each state parameter is calculated separately. Specifically: .

[0035] By using the above method, the dynamic range of each state parameter within the current drying stage can be obtained.

[0036] Furthermore, standardized state parameters are obtained based on the smoothed state data at the current sampling time and the historical window statistics. Specifically: Standardized lightness value = (smoothed lightness value at the current sampling time - moving mean of lightness components) ÷ moving standard deviation of lightness components.

[0037] Standardized red-green chromaticity value = (smoothed red-green chromaticity value at the current sampling time - moving mean of red-green chromaticity component) ÷ moving standard deviation of red-green chromaticity component.

[0038] Standardized yellow-blue chromaticity value = (smoothed yellow-blue chromaticity value at the current sampling time - moving mean of yellow-blue chromaticity component) ÷ moving standard deviation of yellow-blue chromaticity component.

[0039] Standardized temperature difference = (smoothed hot air inlet and outlet temperature difference at the current sampling time - moving average of hot air inlet and outlet temperature difference) ÷ moving standard deviation of hot air inlet and outlet temperature difference.

[0040] Subsequently, the standardized lightness values, standardized red-green chromaticity values, standardized yellow-blue chromaticity values, and standardized temperature difference values ​​obtained above are combined according to a preset order to form a four-dimensional state vector corresponding to the current sampling time. Specifically: State vector = (normalized lightness value, normalized red-green chromaticity value, normalized yellow-blue chromaticity value, normalized temperature difference value).

[0041] For example, during the hot air drying process of a certain batch of Astragalus membranaceus, after historical window calculation, the following values ​​were obtained at the current sampling time: standardized lightness value -0.94, standardized red-green value 0.67, standardized yellow-blue value -0.42, and standardized temperature difference value 1.20. Therefore, the state vector corresponding to the current sampling time is (-0.94, 0.67, -0.42, 1.20).

[0042] Furthermore, the four-dimensional state vectors corresponding to multiple sampling times are arranged sequentially according to the order of sampling time to form a state feature sequence.

[0043] In summary, this step collects surface color information and hot air inlet / outlet temperature difference information of Chinese medicinal materials during the hot air drying process. Combined with time window median value smoothing and historical window standardization, it eliminates the influence of data acquisition disturbances and batch differences, obtaining a multi-dimensional state feature sequence that can characterize the current drying state change trend. This state feature sequence simultaneously contains information on the quality changes of the Chinese medicinal materials and the heat transfer state of the hot air, providing a stable data foundation for subsequent reinforcement learning agents to predict the expected water loss rate and identify abnormal states.

[0044] S200: Based on a reinforcement learning agent, it takes the state feature sequence as input and outputs the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage. The probability distribution parameters include the expected value and uncertainty. Step S200 in the method provided in this embodiment of the invention includes: A policy network is constructed, which takes the state feature sequence as input to extract temporal features and outputs a hidden state representation vector with a fixed dimension. The hidden state representation vector is mapped to the action prediction head and the water loss rate prediction head respectively. The action prediction head outputs the strategy distribution parameters of the continuous action space, which is defined as the two-dimensional continuous action of hot air temperature adjustment and hot air speed adjustment. The water loss rate prediction head outputs the predicted expected value and logarithmic standard deviation of the water loss rate, and obtains the predicted standard deviation through exponential function activation. Together, they constitute the probability distribution parameters of the expected water loss rate. The execution action is obtained by sampling the strategy distribution parameters of the action prediction head and applied to the hot air drying control device. The actual water loss rate and the wind temperature uniformity of each sampling point within the preset time window after the action is applied are collected as feedback data. A reward signal is constructed based on the deviation between the actual measured water loss rate and the expected value of the expected water loss rate, as well as the deviation between the measured value of wind temperature uniformity and the preset uniformity threshold. The reward signal is negatively correlated with the deviation and the degree of deviation. The policy gradient loss function is constructed with the goal of maximizing the expected value of the reward signal, and the network parameters of the policy network are updated with the gradient direction of the policy gradient loss function. Repeat the action sampling, reward calculation and parameter update until the policy gradient loss function converges, and fix the policy network parameters after convergence; The expected value of the water loss rate output by the strategy network is used as the expected value of the probability distribution parameter of the expected water loss rate, and the standard deviation of the predicted distribution of the water loss rate output by the strategy network is used as the uncertainty of the probability distribution parameter.

[0045] In this embodiment, after obtaining the state feature sequence of Chinese medicinal materials during the hot air drying process, the state feature sequence is input into a pre-constructed reinforcement learning agent. The reinforcement learning agent learns the state change pattern of Chinese medicinal materials under different drying stages and outputs the expected water loss rate probability distribution parameters that match the current Chinese medicinal material variety and drying stage.

[0046] Specifically, the reinforcement learning agent includes a policy network, an action prediction head, and a water loss rate prediction head.

[0047] The policy network is used to extract temporal features from the input state feature sequence and generate a fixed-dimensional hidden state representation vector; the action prediction head is used to generate policy distribution parameters corresponding to the continuous action space based on the hidden state representation vector, and the continuous action space includes the hot air temperature adjustment amount and the hot air speed adjustment amount; the water loss rate prediction head is used to predict the water loss rate probability distribution parameters under the current dry state based on the hidden state representation vector.

[0048] Specifically, the policy network is implemented using a recurrent neural network structure, including an input layer, a temporal feature extraction layer, a fully connected mapping layer, and an output layer.

[0049] The input layer is used to receive the state feature sequence. In this embodiment, the state vector corresponding to each sampling time includes standardized brightness value, standardized red-green chromaticity value, standardized yellow-blue chromaticity value, and standardized temperature difference value, for a total of 4 state dimensions. Therefore, the input dimension of the input layer is set to 4.

[0050] The temporal feature extraction layer employs a long short-term memory (LSTM) network structure to extract the state change patterns between consecutive sampling times. In this embodiment, the temporal feature extraction layer includes two LTM layers. The first LTM layer comprises 64 hidden units, used to extract short-term change features from the state feature sequence. The second LTM layer comprises 128 hidden units, used to further fuse dry state change information at different time scales.

[0051] Furthermore, a fully connected mapping layer is set at the output of the Long Short-Term Memory network to map the temporal hidden states to a fixed-dimensional hidden state representation space. In this embodiment, the output dimension of the fully connected mapping layer is set to 128 dimensions, that is, the hidden state representation vector dimension = 128. The 128-dimensional hidden state representation vector is used to comprehensively represent the color changes, hot air environment changes, and moisture migration states corresponding to the current drying stage of the Chinese medicinal materials.

[0052] For example, when the input is a sequence of state features corresponding to the most recent 30 sampling times, the policy network first receives 30 sets of four-dimensional state vectors through the input layer, then extracts time-related features through two layers of long short-term memory network, and finally outputs a hidden state representation vector containing 128 feature values.

[0053] Furthermore, the hidden state representation vector is input into the action prediction head to generate policy distribution parameters corresponding to the continuous action space. The action prediction head includes an action feature mapping layer and an action parameter output layer. Specifically, the action feature mapping layer has 64 neurons to reduce the dimensionality of the hidden state representation vector and extract action decision-related features. The action parameter output layer generates policy distribution parameters corresponding to the continuous action space based on the action features output by the action feature mapping layer.

[0054] Among them, the strategy distribution parameter is used to describe the probability distribution of the hot air temperature adjustment amount and the hot air speed adjustment amount in the current state.

[0055] Specifically, the action parameter output layer outputs the first set of action distribution parameters corresponding to the hot air temperature adjustment amount and the second set of action distribution parameters corresponding to the hot air speed adjustment amount.

[0056] Among them, the first set of action distribution parameters and the second set of action distribution parameters together constitute the strategy distribution parameters of the two-dimensional continuous action space.

[0057] Furthermore, the hidden state representation vector is input into the water loss rate prediction head to obtain the expected water loss rate probability distribution parameters. The water loss rate prediction head includes a first fully connected layer, a second fully connected layer, and an output layer. Specifically, the first fully connected layer performs feature compression on the 128-dimensional hidden state representation vector, outputting 64-dimensional intermediate features; the second fully connected layer further extracts feature information related to the water loss rate, outputting a 32-dimensional feature representation; the output layer includes two output nodes, which output the expected value of the predicted water loss rate and the logarithmic standard deviation of the predicted water loss rate, respectively. The first output node outputs the average level of the predicted water loss rate under the current dry state; the second output node outputs the logarithmic standard deviation corresponding to the uncertainty of the predicted water loss rate.

[0058] Since the standard deviation needs to satisfy the non-negativity constraint, this embodiment applies an exponential function activation process to the output logarithmic standard deviation. Specifically: Forecast standard deviation = .

[0059] Furthermore, the expected value and standard deviation of the predicted water loss rate are used together as the probability distribution parameters of the expected water loss rate. Wherein: Expected water loss rate probability distribution parameter = (expected value of water loss rate prediction, standard deviation of prediction).

[0060] For example, during the hot-air drying process of a batch of Astragalus membranaceus, after inputting a continuous 30-minute state feature sequence of the current stage, the policy network outputs a 128-dimensional hidden state representation vector. The water loss rate prediction head outputs a predicted expected value of 0.85% / min for the water loss rate, and the predicted logarithmic standard deviation of the water loss rate is -1.20. Therefore, the prediction standard deviation = =0.30% / min. Therefore, the expected water loss rate probability distribution parameters corresponding to the current drying stage are (0.85% / min, 0.30% / min).

[0061] Furthermore, in order to enable the reinforcement learning agent to continuously optimize its prediction capabilities based on the actual drying effect, this embodiment uses a policy optimization method based on feedback rewards to train the policy network.

[0062] Specifically, during the training process, the state feature sequence of historical hot air drying processes is input into the policy network, and a reward signal is constructed based on the network output and the actual processing feedback.

[0063] The feedback data includes the actual measured value of water loss rate and the measured value of wind temperature uniformity corresponding to multiple sampling points.

[0064] The measured value of wind temperature uniformity is obtained by assessing the dispersion of temperature values ​​detected by multiple temperature sensors at the same sampling time. Specifically: .

[0065] Furthermore, a reward signal is constructed based on the deviation between the actual measured water loss rate and the predicted expected water loss rate, as well as the deviation between the measured wind temperature uniformity and the preset uniformity threshold. Specifically: Reward signal = -(absolute value of water loss rate deviation × 0.6 + absolute value of wind temperature uniformity deviation × 0.4).

[0066] Here, 0.6 and 0.4 represent the weights corresponding to the deviations in water loss rate and air temperature uniformity, respectively. These weights are derived from statistical results of historical drying experiment data. Specifically, hot air drying data for 100 batches of Chinese medicinal materials were collected, and the correlations between the degree of change in water loss rate and the degree of air temperature uniformity with the final quality evaluation results were calculated and normalized according to the correlation ratio. In this embodiment, the correlation between the change in water loss rate and the quality score was found to be approximately 60%, and the correlation between the degree of air temperature uniformity and the quality score was approximately 40%. Therefore, the corresponding weights were set to 0.6 and 0.4, respectively.

[0067] Furthermore, the policy network parameters are updated with the optimization objective of maximizing the expected value of the reward signal. Specifically: Policy network parameter update amount = learning rate × policy gradient direction.

[0068] In this embodiment, gradient descent is used to update the network parameters. The learning rate is set to 0.001, the batch size to 64, and the maximum number of training epochs to 500. During each training epoch, training samples are input into the policy network, a reward signal is calculated, and the network parameters are adjusted based on the reward signal. When the average change in the reward signal is less than 0.001 over 10 consecutive training epochs, the policy network is considered to have converged, and the converged network parameters are fixed.

[0069] Finally, in the actual monitoring of abnormalities during the hot-air drying of Chinese medicinal materials, the real-time acquired state feature sequences are input into the trained reinforcement learning agent. Among them: Expected water loss rate = Expected water loss rate output by the water loss rate prediction head.

[0070] Uncertainty of expected water loss rate = standard deviation of prediction output from water loss rate prediction head.

[0071] Step S200 in the method provided in this embodiment of the invention further includes: The hidden state representation vectors are input into the temperature regulator network and the wind speed regulator network, respectively. The temperature regulator network outputs the mean and logarithmic standard deviation of the hot air temperature regulation amount and obtains the temperature regulation standard deviation by exponential function activation. The wind speed regulator network outputs the mean and logarithmic standard deviation of the hot air wind speed regulation amount and obtains the wind speed regulation standard deviation by exponential function activation. The mean and standard deviation of each dimension constitute the strategy distribution parameters of a two-dimensional diagonal Gaussian distribution. The original action values ​​are obtained by sampling from a two-dimensional diagonal Gaussian distribution. The original action values ​​are scaled by a hyperbolic tangent function with the action boundaries of the hot air temperature regulation and the hot air speed regulation, respectively, to obtain the execution action. The execution action is applied to the hot air drying control device and feedback data is collected to construct a reward signal and update the strategy network.

[0072] After obtaining the motion features output by the motion prediction head, the motion features are input into the temperature regulation head network and the wind speed regulation head network respectively to establish the motion probability distributions corresponding to the hot air temperature regulation amount and the hot air wind speed regulation amount respectively.

[0073] Among them, the temperature regulating head network is used to describe the uncertainty changes of the hot air temperature regulating action, and the wind speed regulating head network is used to describe the uncertainty changes of the hot air wind speed regulating action.

[0074] Specifically, the temperature control head network includes a temperature parameter mapping layer and a temperature parameter output layer.

[0075] The temperature parameter mapping layer is used to further transform the motion features output by the motion prediction head, extracting motion features related to hot air temperature regulation. In this embodiment, the temperature parameter mapping layer includes 32 neural nodes, used to reduce the dimensionality of motion features and enhance the expressive power of temperature regulation features.

[0076] Furthermore, the temperature parameter output layer outputs the mean parameter and the logarithmic standard deviation parameter corresponding to the hot air temperature adjustment amount. Among them, the mean value of the hot air temperature adjustment amount is used to represent the direction and magnitude of the hot air temperature adjustment in the current state; the logarithmic standard deviation of the hot air temperature adjustment amount is used to represent the degree of uncertainty of the temperature adjustment action.

[0077] Because the standard deviation needs to satisfy the non-negativity constraint, an exponential function activation is applied to the logarithmic standard deviation of the hot air temperature regulation. Specifically: Hot air temperature regulation standard deviation = .

[0078] Furthermore, the wind speed regulating head network includes a wind speed parameter mapping layer and a wind speed parameter output layer. The wind speed parameter mapping layer is used to transform the motion features output by the motion prediction head, extracting motion features related to the hot air flow state. In this embodiment, the wind speed parameter mapping layer also includes 32 neural nodes.

[0079] Furthermore, the wind speed parameter output layer outputs the mean parameter and the logarithmic standard deviation parameter corresponding to the hot air wind speed adjustment amount. Among them, the mean value of the hot air wind speed adjustment amount is used to represent the direction and magnitude of the wind speed adjustment in the current state; the logarithmic standard deviation of the hot air wind speed adjustment amount is used to represent the degree of uncertainty of the wind speed adjustment action.

[0080] The standard deviation of hot air velocity regulation is obtained by applying an exponential function to the logarithmic standard deviation of the regulation. Specifically: Standard deviation of hot air speed adjustment = .

[0081] Furthermore, a two-dimensional diagonal Gaussian distribution is constructed based on the mean of hot air temperature adjustment, the standard deviation of hot air temperature adjustment, the mean of hot air velocity adjustment, and the standard deviation of hot air velocity adjustment. Specifically: Two-dimensional continuous motion strategy distribution parameters = (mean value of hot air temperature adjustment, standard deviation of hot air temperature adjustment, mean value of hot air velocity adjustment, standard deviation of hot air velocity adjustment).

[0082] In this model, the first dimension of the action corresponds to the adjustment of the hot air temperature, and the second dimension corresponds to the adjustment of the hot air speed. By using a two-dimensional diagonal Gaussian distribution to describe continuous actions, different control variables have independent probability distribution characteristics, while preserving the action exploration ability during reinforcement learning.

[0083] For example, during the hot air drying process of a certain batch of Panax notoginseng, after the motion characteristics output by the motion prediction head are input into the temperature regulation head network and the wind speed regulation head network, the mean value of the hot air temperature regulation is 0.8℃, the logarithmic standard deviation of the hot air temperature regulation is -1.5, the mean value of the hot air wind speed regulation is 0.12m / s, and the logarithmic standard deviation of the hot air wind speed regulation is -1.2. Therefore, the standard deviation of the hot air temperature regulation = exponential function of the natural constant (-1.5) ≈ 0.22℃, and the standard deviation of the hot air wind speed regulation = exponential function of the natural constant (-1.2) ≈ 0.30m / s. Thus, the two-dimensional continuous motion strategy distribution parameters corresponding to the current state are (0.8℃, 0.22℃, 0.12m / s, 0.30m / s).

[0084] Furthermore, motion sampling is performed based on a two-dimensional diagonal Gaussian distribution to obtain the original motion values. Specifically, The original action value of hot air temperature is obtained by sampling a Gaussian distribution based on the mean of the hot air temperature adjustment and the standard deviation of the hot air temperature adjustment.

[0085] The original action value of hot air speed is obtained by Gaussian distribution sampling based on the mean of hot air speed adjustment and the standard deviation of hot air speed adjustment.

[0086] Since the original motion values ​​obtained from sampling may exceed the allowable range of the hot air drying control device, this embodiment uses a hyperbolic tangent function to constrain the original motion values. Specifically: Normalized motion value = hyperbolic tangent function (original motion value).

[0087] After processing with the hyperbolic tangent function, the action value is restricted to the range of (-1, 1).

[0088] Furthermore, based on the action boundaries of the hot air temperature regulation and the hot air velocity regulation, a linear mapping is performed on the normalized action values ​​to obtain the actual executed action. Specifically: The amount of adjustment for the action is calculated as follows: (normalized action value × (maximum action boundary - minimum action boundary) ÷ 2) + (maximum action boundary + minimum action boundary) ÷ 2.

[0089] The action boundary is determined based on the adjustment capability of the hot air drying control device and the requirements of the Chinese medicinal material drying process.

[0090] In this embodiment, the effective boundary for hot air temperature regulation is set as follows: -5℃ ≤ hot air temperature regulation amount ≤ 5℃; the effective boundary for hot air velocity regulation is set as follows: -0.5m / s ≤ hot air velocity regulation amount ≤ 0.5m / s. These parameters are derived from the actual control range of the hot air drying equipment. The temperature regulation boundary is used to prevent rapid temperature changes that could lead to rapid water loss from the surface of the medicinal herbs, while the velocity regulation boundary is used to ensure the stability of the drying airflow.

[0091] For example, the original action value of hot air temperature is 0.6 and the original action value of hot air velocity is -0.4 obtained by sampling according to a two-dimensional diagonal Gaussian distribution. After processing with a hyperbolic tangent function, the normalized action value of temperature is approximately 0.54 and the normalized action value of velocity is approximately -0.38. Further, the hot air temperature adjustment is calculated as (0.54 × (5 - (-5)) ÷ 2) + (5 + (-5)) ÷ 2 ≈ 2.7℃. The hot air velocity adjustment is calculated as (-0.38 × (0.5 - (-0.5)) ÷ 2) + (0.5 + (-0.5)) ÷ 2 ≈ -0.19 m / s. Therefore, the final action value is (hot air temperature adjustment 2.7℃, hot air velocity adjustment -0.19 m / s).

[0092] Furthermore, the execution action is sent to the hot air drying control device, so that the control device adjusts the hot air temperature and hot air speed according to the execution action.

[0093] Within a preset feedback time window after the action is performed, corresponding feedback data is collected, and a reward signal is constructed based on the feedback data.

[0094] The feedback data includes the actual measured values ​​of water loss rate and wind temperature uniformity.

[0095] Furthermore, the impact of the current action on the drying effect is evaluated based on the feedback data, and the evaluation results are fed back to the reinforcement learning agent for subsequent policy parameter optimization.

[0096] In summary, this step constructs a reinforcement learning agent, uses a policy network to extract temporal features from the state feature sequence, and combines this with a water loss rate prediction head that outputs probability distribution parameters containing expected values ​​and uncertainties to predict the expected water loss state at the current drying stage. Simultaneously, an action prediction head generates a hot air regulation strategy, and feedback rewards are used to continuously optimize the network parameters, enabling the reinforcement learning agent to adapt to state changes in different Chinese medicinal herb varieties and drying stages, thereby improving the accuracy of water loss rate prediction and the reliability of anomaly monitoring.

[0097] S300: Collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient; Step S300 in the method provided in this embodiment of the invention includes: The instantaneous mass value of the Chinese medicinal materials is continuously collected at fixed time intervals during the current drying stage. The difference between the instantaneous mass values ​​of two adjacent sampling times is divided by the fixed time interval to obtain the measured value of the instantaneous water loss rate in each sampling interval. The instantaneous deviation in each sampling interval is obtained by subtracting the measured instantaneous water loss rate in each sampling interval from the expected value of the expected water loss rate at the same sampling time. The instantaneous deviations of all sampling intervals within the current drying stage are time-weighted and accumulated. The instantaneous deviations are multiplied by each instantaneous deviation at fixed time intervals and summed to obtain the cumulative integral value of the instantaneous deviations within the current drying stage, which is used as the cumulative deviation. Calculate the arithmetic mean of the expected water loss rates at each sampling time within the current drying stage, and combine it with the total duration of the current drying stage to obtain the expected cumulative water loss baseline value; Divide the cumulative deviation by the expected cumulative water loss baseline value to obtain the first deviation coefficient.

[0098] After obtaining the probability distribution parameters of the expected water loss rate corresponding to the current drying stage output by the reinforcement learning agent, the degree of deviation between the actual water loss process and the expected water loss process is further quantified based on the changes in the water loss rate during the actual drying process to obtain the first deviation coefficient.

[0099] During the current drying stage, the instantaneous mass values ​​of the medicinal materials are continuously acquired at preset fixed time intervals, and the measured instantaneous water loss rate within each sampling interval is calculated based on the mass change between adjacent sampling times. Specifically: Measured instantaneous water loss rate = (instantaneous mass value at the previous sampling time - instantaneous mass value at the current sampling time) ÷ fixed time interval.

[0100] Since the quality change of Chinese medicinal materials during hot air drying mainly comes from water evaporation, the quality difference between adjacent sampling times can reflect the actual water loss rate change within the current sampling interval.

[0101] Furthermore, the measured instantaneous water loss rate within each sampling interval is compared with the expected water loss rate output by the reinforcement learning agent to obtain the instantaneous deviation corresponding to each sampling interval. Specifically: Instantaneous deviation = Measured instantaneous water loss rate - Expected water loss rate.

[0102] The expected value of the expected water loss rate is the expected value in the probability distribution parameter of the expected water loss rate output by the reinforcement learning agent.

[0103] By calculating the instantaneous deviation, we can reflect the degree of deviation between the actual water loss process and the model-predicted water loss process during the current drying stage.

[0104] For example, within a certain sampling interval, the actual measured water loss rate is 0.90% / min, and the expected water loss rate output by the reinforcement learning agent is 0.85% / min. Therefore, the instantaneous deviation is 0.90 - 0.85 = 0.05% / min, indicating that the actual water loss rate at the current stage is higher than the expected water loss rate.

[0105] Furthermore, to avoid the impact of instantaneous fluctuations within a single sampling interval on anomaly detection, this embodiment performs time-accumulation processing on the instantaneous deviations corresponding to multiple sampling intervals within the current drying stage.

[0106] Specifically, based on the sampling time sequence, the instantaneous deviations within each sampling interval are time-weighted and accumulated. A fixed time interval is used as the time integration step size to obtain the cumulative integral value corresponding to the instantaneous deviation within the current drying stage, and the cumulative integral value is used as the cumulative deviation.

[0107] Cumulative deviation = fixed time interval × (instantaneous deviation of the first sampling interval + instantaneous deviation of the second sampling interval + ... + instantaneous deviation of the nth sampling interval).

[0108] Where n represents the number of sampling intervals contained in the current drying stage.

[0109] The above method can convert the deviation in water loss rate over a short period of time into the cumulative deviation over the entire drying process.

[0110] Furthermore, to eliminate the incomparability of deviations caused by the duration of different drying stages and the differences in the varieties of Chinese medicinal materials, this embodiment further calculates the expected cumulative water loss benchmark value corresponding to the current drying stage and normalizes the cumulative deviation.

[0111] Specifically, the arithmetic mean of the expected water loss rates at each sampling time within the current drying stage is first calculated.

[0112] Average expected water loss rate = (expected water loss rate at the first sampling time + expected water loss rate at the second sampling time + ... + expected water loss rate at the nth sampling time) ÷ number of sampling times.

[0113] Subsequently, based on the average expected rate of water loss and the duration of the current drying phase, the baseline value for expected cumulative water loss is calculated. Specifically: Expected cumulative water loss baseline = average expected water loss rate × total duration of the current drying phase.

[0114] The total duration of the current drying stage is determined based on the start time of the drying stage and the current monitoring time.

[0115] Furthermore, the cumulative deviation is normalized to the expected cumulative water loss baseline value to obtain the first deviation coefficient. Specifically: First deviation coefficient = cumulative deviation amount ÷ expected cumulative water loss baseline value.

[0116] The first deviation coefficient is used to characterize the overall degree of deviation between the actual water loss process and the expected water loss process during the current drying stage. When the first deviation coefficient is close to 0, it indicates that the actual water loss process is relatively consistent with the expected water loss process. When the absolute value of the first deviation coefficient increases, it indicates that the actual water loss process deviates more from the expected process.

[0117] For example, during the hot air drying process of a batch of Astragalus membranaceus, the current drying stage lasted for 60 minutes, with a fixed sampling time interval of 5 minutes, resulting in 12 sampling intervals. The cumulative deviation of the instantaneous water loss rate in each sampling interval was calculated as follows: 0.06% / min, 0.04% / min, -0.02% / min, 0.08% / min, 0.05% / min, 0.03% / min, 0.01% / min, 0.06% / min, 0.02% / min, -0.01% / min, 0.04% / min, and 0.04% / min. After time integration, the cumulative deviation was 2.0%. Simultaneously, based on the expected water loss rate output by the reinforcement learning agent at each moment, the average expected water loss rate was calculated to be 0.8% / min. Therefore, the expected cumulative water loss baseline value was 0.8 × 60 = 48%. The first deviation coefficient was further obtained as 2.0 ÷ 48 = 0.042. This indicates that the actual water loss process during the current drying phase deviates by approximately 4.2% from the water loss process predicted by the reinforcement learning agent.

[0118] Step S300 in the method provided in this embodiment of the invention further includes: The instantaneous mass value of Chinese medicinal materials is obtained by distributing multiple weighing sensors under the support structure that carries the Chinese medicinal materials in the hot air drying oven, synchronously collecting the mass signals output by each sensor, using the median value of each mass signal as the original mass measurement value at the current moment, and then using the hot air wind speed signal at the current moment to compensate for wind pressure disturbances in the original mass measurement value, and then smoothing it through a first-order low-pass filter.

[0119] Specifically, multiple weighing sensors are installed below the support structure used to support the Chinese medicinal materials inside the hot air drying oven.

[0120] Multiple weighing sensors are distributed along the bottom of the support structure, so that the weight of the Chinese medicinal materials and the force of the hot air at different locations can be detected simultaneously.

[0121] In this embodiment, four weighing sensors are installed at the four corners of the support structure to simultaneously collect mass signals corresponding to different areas of the support structure.

[0122] Furthermore, the mass signals output by each weighing sensor are simultaneously acquired at the same sampling time, and the original mass measurement value corresponding to the current time is obtained by median value fusion. Specifically, the original mass measurement value = the median value of the mass signals output by multiple weighing sensors.

[0123] The median value is the mass signal value located in the middle position after sorting the mass signals output by multiple weighing sensors according to their numerical values.

[0124] When the number of weighing sensors is even, the arithmetic mean of the two middle mass signal values ​​after sorting is taken as the median value.

[0125] Using the median value as the fusion result can reduce the impact of instantaneous shocks, local airflow disturbances, or abnormal sensor drift on individual weighing sensors.

[0126] For example, at a certain sampling moment, the mass signals output by the four weighing sensors are 12.54 kg, 12.61 kg, 12.57 kg, and 12.56 kg, respectively. Arranged in ascending order, these are 12.54 kg, 12.56 kg, 12.57 kg, and 12.61 kg. Therefore, the original mass measurement value = (12.56 + 12.57) ÷ 2 = 12.565 kg. That is, the original mass measurement value corresponding to the current sampling moment is 12.565 kg.

[0127] Furthermore, since changes in hot air velocity during hot air drying can cause varying degrees of airflow pressure on the load-bearing structure, resulting in additional disturbances in the weighing sensor output, this embodiment compensates for the wind pressure disturbances in the original mass measurement value based on the hot air velocity signal collected at the current moment.

[0128] Specifically, a mapping relationship between hot air velocity and mass disturbance is established in advance.

[0129] The mapping relationship was obtained through calibration experiments. Specifically, under the condition of no change in the quality of Chinese medicinal materials, different hot air speed conditions were set, and the output changes of the weighing sensor were collected to obtain the mass disturbance under different wind speed conditions. A wind speed-disturbance compensation model was then established through fitting.

[0130] In this embodiment, the wind pressure disturbance compensation amount is obtained as 0.015 × hot air velocity² based on historical calibration experimental data. Here, 0.015 is the wind pressure disturbance compensation coefficient, which is derived from 20 sets of no-load calibration experimental results under different hot air velocity conditions and obtained through least squares fitting.

[0131] Furthermore, the corresponding wind pressure disturbance compensation is calculated based on the current hot air velocity signal. Specifically, Compensated mass measurement value = Original mass measurement value + Wind pressure disturbance compensation amount.

[0132] Since the hot air effect causes the weighing result to shift downward, an additive compensation method is used to offset the mass reduction error caused by the airflow.

[0133] For example, if the original mass measurement at the current sampling time is 12.565 kg and the hot air velocity is 2 m / s, then the wind pressure disturbance compensation is 0.015 × 2² = 0.06 kg. Therefore, the compensated mass measurement is 12.565 + 0.06 = 12.625 kg.

[0134] Furthermore, to reduce the impact of high-frequency noise from the weighing sensor and residual fluctuations from hot air disturbance on the judgment of mass change trends, this embodiment performs first-order low-pass filtering on the compensated mass measurement value to obtain the final instantaneous mass value used for calculating the water loss rate. Specifically: Current instantaneous quality value = filter coefficient × current compensated quality measurement value + (1 - filter coefficient) × previous instantaneous quality value.

[0135] The filtering coefficients are used to control the fusion ratio between the current sampled data and the historical data.

[0136] In this embodiment, the filtering coefficient was set to 0.2. This parameter was derived from the analysis results of historical drying experimental data. Specifically, mass change data of 50 batches of Chinese medicinal materials during the hot air drying process were collected, and smoothing was performed using different filtering coefficients. The mean square error between the filtered mass curve and the result of manual precision weighing was calculated. Experimental results showed that when the filtering coefficient was 0.2, the mass decrease trend during the water loss process could be preserved while reducing high-frequency fluctuations; therefore, the filtering coefficient was determined to be 0.2.

[0137] For example, at a certain sampling moment, the current compensated mass measurement value is 12.625 kg, the instantaneous mass value at the previous moment is 12.700 kg, and the filter coefficient is 0.2. Then, the current instantaneous mass value is 0.2 × 12.625 + (1 - 0.2) × 12.700 = 12.685 kg. This value is used as the instantaneous mass value of the medicinal material at the current sampling moment for subsequent calculation of the actual water loss rate.

[0138] This step quantifies the deviation of the actual water loss process of Chinese medicinal materials from the predicted water loss rate by combining the probability distribution parameters of the expected water loss rate output by the reinforcement learning agent with the quality change data during the actual drying process. Specifically, instantaneous quality values ​​are obtained using multi-sensor fusion, wind speed disturbance compensation, and low-pass filtering, and the actual water loss rate within each sampling interval is calculated. Furthermore, the deviation between the actual water loss rate and the expected water loss rate is accumulated by time integration, and normalized using the expected cumulative water loss to obtain the first deviation coefficient characterizing the overall water loss deviation. This avoids the influence of single-point fluctuations on the anomaly judgment results and improves the stability of quality anomaly detection during the drying process.

[0139] S400: Collect the wind temperature uniformity of multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient. Step S400 in the method provided in this embodiment of the invention includes: Multiple temperature sensors are arranged in a spatial orthogonal grid within the effective working area of ​​the hot air drying oven, and the temperature readings of each temperature sensor are collected synchronously at each sampling time during the current drying stage. The steps for defining the effective work area include: Multiple temperature measuring points are arranged inside the hot air drying oven according to a three-dimensional spatial grid, and each temperature measuring point is equidistant in both the horizontal and vertical directions. Based on the set temperature of the hot air drying oven, the oven was run under no-load conditions until the temperature stabilized, and the steady-state temperature values ​​of each temperature measuring point were collected. Calculate the temperature deviation between the steady-state temperature value and the set temperature at each temperature measuring point. The effective working area is defined as the spatial range in which the absolute value of each temperature deviation does not exceed the preset temperature deviation limit. The preset temperature deviation limit is set according to the preset uniformity threshold and process requirements. The standard deviation of the temperature readings of all temperature sensors at the same sampling time is used as the instantaneous wind temperature uniformity at the sampling time, and the instantaneous wind temperature uniformity sequence within the current drying stage is constructed according to the sampling time order. Calculate the arithmetic mean of the instantaneous wind temperature uniformity sequence as the wind temperature uniformity characterization value for the current drying stage; Calculate the difference between the wind temperature uniformity characterization value and the preset uniformity threshold, and divide the difference by the preset uniformity threshold to obtain the second deviation coefficient.

[0140] Because airflow patterns may differ in different areas within the drying chamber during hot air drying, deviations may occur between the actual and set temperatures in different zones, resulting in varying degrees of thermal effects on the same batch of medicinal herbs. Therefore, this embodiment first identifies the effective working area within the hot air drying chamber that meets the process temperature requirements, and then collects temperature data at multiple points within this area.

[0141] Specifically, multiple temperature measuring points are arranged in a three-dimensional spatial grid pattern inside the hot air drying oven. These temperature measuring points are evenly spaced along both the horizontal and vertical directions to cover different spatial locations within the hot air drying oven.

[0142] In this embodiment, based on the internal space dimensions of the hot air drying oven, temperature measuring points are arranged at intervals of 20cm horizontally, 20cm vertically, and 20cm in depth. Temperature measuring points are also placed at the intersections of these grids.

[0143] Furthermore, before determining the effective working area, the no-load temperature stability test of the hot air drying oven was first conducted.

[0144] Specifically, the hot air drying oven is set to the target working temperature and operated without any Chinese medicinal materials. Once the temperature inside the oven reaches a stable state, the steady-state temperature values ​​corresponding to each temperature measuring point are collected simultaneously.

[0145] The criteria for determining a stable temperature state are based on the temperature change amplitude over multiple consecutive sampling periods.

[0146] In this embodiment, when the temperature change at each temperature measuring point is less than 0.5℃ within 10 consecutive minutes, the hot air drying oven is considered to have reached a stable state.

[0147] Furthermore, the effective working area is determined based on the deviation between the steady-state temperature value corresponding to each temperature measuring point and the set temperature of the hot air drying oven. Specifically: Temperature deviation value = steady-state temperature value - set temperature.

[0148] Further calculate the absolute value of the temperature deviation at each temperature measuring point and determine whether it meets the preset temperature deviation limit. Specifically: Absolute value of temperature deviation = |Steady-state temperature value - Set temperature|.

[0149] When the absolute value of the temperature deviation is less than or equal to the preset temperature deviation limit, the spatial area where the corresponding temperature measuring point is located is determined as the area that meets the requirements. All continuous spatial areas that meet the above conditions are combined and considered as the effective working area of ​​the hot air drying oven.

[0150] The preset temperature deviation limit is determined based on the preset uniformity threshold and the requirements of the Chinese medicinal materials drying process. Specifically, the preset temperature deviation limit is obtained through statistical analysis of historical drying experimental data. In this embodiment, hot air drying experimental data of 50 batches of Chinese medicinal materials were collected, and the drying uniformity and final quality score were recorded under different temperature deviation conditions. The experimental results show that when the spatial temperature deviation is controlled within the range of ±3℃ of the set temperature, the difference in the degree of drying of different areas of the Chinese medicinal materials is small, and the final quality score meets the process requirements. Therefore, in this embodiment, the preset temperature deviation limit is set to 3℃.

[0151] For example, the hot air drying oven is set to a temperature of 60℃. After stabilization under no-load conditions, a certain temperature measuring point measures a steady-state temperature of 61.2℃. The temperature deviation is then 61.2 - 60 = 1.2℃. Since |1.2| < 3℃, the area corresponding to this temperature measuring point is within the effective working area. If another temperature measuring point measures a steady-state temperature of 64℃, the temperature deviation is 64 - 60 = 4℃. Since |4| > 3℃, this location is not within the effective working area.

[0152] Furthermore, after determining the effective working area, multiple temperature sensors are arranged within the effective working area, and the temperature readings of each temperature sensor are collected synchronously according to a preset sampling cycle during the current drying stage.

[0153] In this embodiment, eight temperature sensors are arranged within the effective working area to detect the hot air temperature at different spatial locations. During the current drying phase, the temperature readings of each temperature sensor are collected synchronously every 1 minute.

[0154] Furthermore, the dispersion of temperature readings from all temperature sensors at the same sampling time is used as the instantaneous wind temperature uniformity at that sampling time. Specifically: .

[0155] in: Average temperature = Sum of temperature readings from all temperature sensors ÷ Number of temperature sensors

[0156] The smaller the instantaneous wind temperature uniformity, the closer the temperature is at different spatial locations at the same sampling time, and the more uniform the hot air distribution is.

[0157] For example, at a certain sampling moment, the temperature values ​​collected by the eight temperature sensors are 60.2℃, 60.5℃, 60.1℃, 59.8℃, 60.3℃, 60.0℃, 60.4℃, and 59.9℃, respectively. The calculated average temperature is 60.15℃. Further calculation of the instantaneous wind temperature uniformity... =0.24℃.

[0158] Furthermore, the instantaneous wind temperature uniformity corresponding to all sampling times within the current drying stage is arranged in chronological order of sampling time to form an instantaneous wind temperature uniformity sequence.

[0159] Subsequently, the instantaneous wind temperature uniformity sequence was averaged to obtain the wind temperature uniformity characterization value corresponding to the current drying stage. Specifically: Wind temperature uniformity characterization value = (instantaneous wind temperature uniformity at the first sampling time + instantaneous wind temperature uniformity at the second sampling time + ... + instantaneous wind temperature uniformity at the nth sampling time) ÷ number of sampling times.

[0160] For example, during the drying stage of a certain batch of Astragalus membranaceus, five sampling times were collected, with corresponding instantaneous wind temperature uniformity of 0.24℃, 0.28℃, 0.22℃, 0.31℃, and 0.25℃. Therefore, the wind temperature uniformity value is (0.24 + 0.28 + 0.22 + 0.31 + 0.25) ÷ 5 = 0.26℃.

[0161] Furthermore, a second deviation coefficient is obtained based on the degree of deviation between the wind temperature uniformity characterization value and the preset uniformity threshold. Specifically: Second deviation coefficient = (wind temperature uniformity characterization value - preset uniformity threshold) ÷ preset uniformity threshold.

[0162] The preset uniformity threshold is determined based on the requirements of the hot air drying process for Chinese medicinal materials. In this embodiment, data on the uniformity of air temperature during the drying process of 100 batches of Chinese medicinal materials were collected and statistically analyzed in conjunction with the final drying quality evaluation results. When the uniformity of air temperature does not exceed 0.5℃, the difference in the degree of drying in different areas of the Chinese medicinal materials is small, which can meet the quality requirements. Therefore, the preset uniformity threshold is set to 0.5℃.

[0163] For example, the current temperature uniformity characterization value during the drying stage is 0.26℃, and the preset uniformity threshold is 0.5℃. Then the second deviation coefficient is (0.26-0.5)÷0.5=-0.48.

[0164] This step involves collecting and analyzing temperature data from multiple spatial locations within the effective working area of ​​the hot air drying oven to establish a second deviation coefficient characterizing the uniformity of hot air distribution. Specifically, an effective working area meeting the process temperature requirements is determined through no-load temperature stability testing, and an instantaneous air temperature uniformity sequence is obtained within this area using a multi-point synchronous temperature acquisition method. Furthermore, the air temperature uniformity characterization value within the current drying stage is calculated, and a normalized deviation calculation is performed based on a preset uniformity threshold to obtain the second deviation coefficient reflecting the stability of the hot air temperature field, thereby quantifying the drying quality risk caused by uneven airflow distribution.

[0165] S500: Set an initial anomaly threshold, correct the uncertainty based on the current hot air temperature fluctuation range, obtain the corrected uncertainty, and dynamically adjust the initial anomaly threshold to obtain a dynamic anomaly threshold; Step S500 in the method provided in this embodiment of the invention includes: Using the current sampling time as the endpoint, backtrack N sampling times to calculate the hot air inlet and outlet temperature difference values, and calculate the sliding deviation of the hot air inlet and outlet temperature difference values ​​within the backtracking window as the current hot air temperature fluctuation range. The temperature difference between the inlet and outlet of the hot air is used as the reference temperature difference at the first sampling moment after the time-varying slope of the lightness component of the surface color value changes from positive to negative during the hot air drying process. Based on the relative ratio between the current hot air temperature fluctuation amplitude and the reference temperature difference, the relative ratio is mapped to the 0 to 1 range through a nonlinear saturation function to obtain the temperature control confidence decay factor. The uncertainty is positively weighted and corrected using the temperature control confidence decay factor to obtain the corrected uncertainty. The corrected uncertainty is positively correlated with the temperature control confidence decay factor. The threshold adjustment factor is determined based on the relative relationship between the dispersion and central tendency of the instantaneous wind temperature uniformity sequence at the current moment. The initial anomaly threshold is scaled in the first stage according to the relative proportion of the corrected uncertainty to the uncertainty, and then modulated in the second stage according to the threshold adjustment factor to obtain the dynamic anomaly threshold.

[0166] In this embodiment, after obtaining the expected water loss rate probability distribution parameters output by the reinforcement learning agent, since the hot air temperature fluctuation during the hot air drying process will affect the stability of the water loss process of the Chinese medicinal materials, the uncertainty of the reinforcement learning model's prediction result of the water loss rate will change. Therefore, this embodiment dynamically corrects the original uncertainty according to the current hot air temperature change state, and adjusts the anomaly judgment threshold in combination with the hot air uniformity change, so as to obtain a dynamic anomaly threshold applicable to the current drying state.

[0167] Specifically, starting from the current sampling time, a preset number of sampling times are traced back to obtain the hot air inlet and outlet temperature difference values ​​within the corresponding time window.

[0168] The inlet and outlet temperature difference of hot air is the difference between the inlet temperature and the outlet temperature of the hot air drying chamber, which is used to reflect the heat exchange status of hot air during the drying process.

[0169] In this embodiment, the backtracking window length N=10. That is, fluctuation analysis is performed using 10 sets of hot air inlet and outlet temperature difference values ​​corresponding to the current sampling time and the previous 9 consecutive sampling times.

[0170] Furthermore, the sliding standard deviation of the hot air inlet and outlet temperature difference within the backtracking window is calculated and used as the current hot air temperature fluctuation range. Specifically: .

[0171] in: Average temperature difference = Sum of temperature differences of all hot air inlets and outlets within the traceback window ÷ Number of sampling windows.

[0172] The greater the fluctuation range of the current hot air temperature, the more drastic the change in the current hot air temperature, and the lower the stability of the drying process.

[0173] For example, during the hot air drying process of a certain batch of Astragalus membranaceus, tracing back 10 sampling times from the current sampling moment, the temperature differences between the hot air inlet and outlet were obtained as follows: 12.0℃, 12.2℃, 11.8℃, 12.1℃, 12.3℃, 11.9℃, 12.4℃, 12.0℃, 12.2℃, and 12.1℃. The calculated average temperature difference was 12.10℃. Further calculations were made to determine the current hot air temperature fluctuation range. =0.18℃.

[0174] Furthermore, since the sensitivity of hot air temperature changes varies at different drying stages, this embodiment uses the position where the trend of color change on the surface of Chinese medicinal materials changes inflection as the benchmark for evaluating temperature stability.

[0175] Specifically, the time-varying slope of the lightness component is calculated based on the changes in the lightness component at adjacent sampling times. Lightness component time-varying slope = (lightness component value at the current sampling time - lightness component value at the previous sampling time) ÷ sampling time interval.

[0176] When the time-varying slope of the brightness component changes from positive to negative, it indicates a reversal in the trend of surface brightness change of the medicinal material, signifying the stable water loss stage after entering the constant-rate drying stage. The temperature difference between the hot air inlet and outlet at this turning point is obtained as the reference temperature difference. Specifically: Reference temperature difference = the temperature difference between the hot air inlet and outlet corresponding to the first sampling moment after the time-varying slope of the brightness component changes from positive to negative.

[0177] Furthermore, based on the relative relationship between the current hot air temperature fluctuation amplitude and the reference temperature difference, the relative ratio of temperature fluctuation is calculated. Specifically: Relative ratio = Current hot air temperature fluctuation range ÷ Baseline temperature difference.

[0178] The larger the relative ratio, the greater the deviation of the current hot air state from the stable drying stage.

[0179] Furthermore, a negative exponential function is used to map the relative ratio to the range of 0 to 1 to obtain the temperature control confidence decay factor. Specifically: Temperature control confidence decay factor = .

[0180] Using the above mapping method, when the hot air temperature fluctuation is small, the relative ratio is close to 0, and the temperature control confidence decay factor is close to 1; when the hot air temperature fluctuation increases, the temperature control confidence decay factor gradually decreases.

[0181] For example, the first sampling moment after the lightness component time-varying slope changes from positive to negative corresponds to a hot air inlet / outlet temperature difference of 2℃, and the current hot air temperature fluctuation is 0.18℃. Therefore, the relative ratio = 0.18 ÷ 2 = 0.09, and the temperature control confidence decay factor = ≈0.914.

[0182] Furthermore, the uncertainty of the reinforcement learning agent's output is corrected based on the temperature control confidence decay factor. Specifically: Corrected uncertainty = Uncertainty × (1 + Correction intensity coefficient × Temperature control confidence decay factor).

[0183] The correction intensity coefficient is used to control the degree of influence of temperature fluctuations on prediction uncertainty. In this embodiment, the correction intensity coefficient is set to 1. This parameter is derived from the calibration results of historical drying experiments. Specifically, hot air drying data of 50 batches of Chinese medicinal materials were collected, and the matching degree between anomaly detection results and artificial quality evaluation results under different correction intensity coefficients was tested. The experimental results show that when the correction intensity coefficient is 1, it can take into account both the sensitivity to temperature disturbances and the stability of anomaly judgment; therefore, the correction intensity coefficient is determined to be 1.

[0184] For example, the uncertainty of the reinforcement learning agent's output is 0.30% / min. The temperature control confidence decay factor is 0.914. Then the corrected uncertainty is 0.30 × (1 + 1 × 0.914) = 0.574% / min.

[0185] Furthermore, in order to reflect the stability of hot air uniformity during the current drying stage, this embodiment determines the threshold adjustment factor based on the relationship between the dispersion and central tendency of the instantaneous air temperature uniformity sequence.

[0186] Specifically, taking the current moment as the endpoint, the instantaneous wind temperature uniformity sequence within the preset time window is obtained.

[0187] Calculate the moving standard deviation and moving mean for this series. Where: Threshold adjustment factor = Moving standard deviation of instantaneous wind temperature uniformity series ÷ Moving mean of instantaneous wind temperature uniformity series.

[0188] The larger the threshold adjustment factor, the more obvious the fluctuation in the uniformity of the current wind temperature, and the more necessary it is to improve the adaptability of the anomaly judgment threshold.

[0189] For example, the instantaneous wind temperature uniformity sequence within the current window has a moving standard deviation of 0.06℃ and a moving mean of 0.30℃. Therefore, the threshold adjustment factor is 0.06 ÷ 0.30 = 0.20.

[0190] Furthermore, based on the proportional relationship between the corrected uncertainty and the original uncertainty, the initial anomaly threshold is scaled at the first level. Specifically: Level 1 adjustment threshold = initial anomaly threshold × (corrected uncertainty ÷ uncertainty).

[0191] Subsequently, secondary modulation is performed based on the threshold adjustment factor. Specifically: Dynamic anomaly threshold = initial anomaly threshold × (corrected uncertainty ÷ uncertainty) × (1 + threshold adjustment factor).

[0192] The first part reflects the changes in the uncertainty of the prediction model itself, and the second part reflects the changes in the stability of the hot air environment.

[0193] For example, the initial anomaly threshold is 0.15. The uncertainty before correction is 0.30% / min. The uncertainty after correction is 0.574% / min. The threshold adjustment factor is 0.20. Therefore, the dynamic anomaly threshold is 0.15 × (0.574 ÷ 0.30) × (1 + 0.20) ≈ 0.344.

[0194] This step dynamically adjusts the anomaly detection threshold by combining the hot air temperature fluctuation state, prediction uncertainty, and the characteristics of air temperature uniformity changes. Specifically, the current temperature fluctuation amplitude is calculated based on the hot air inlet and outlet temperature difference sequence, and a reference temperature difference is determined by combining the inflection point of the brightness change trend. Furthermore, a temperature control confidence attenuation factor is obtained to correct the uncertainty of the reinforcement learning agent's output. Simultaneously, a threshold adjustment factor is determined based on the dispersion of the instantaneous air temperature uniformity sequence. A dynamic anomaly threshold is obtained by using uncertainty scaling and air temperature uniformity modulation, enabling anomaly judgment to adapt to different drying stages and hot air disturbance states, thereby improving the reliability of anomaly detection.

[0195] S600: Calculate the abnormal characterization value based on the first deviation coefficient and the second deviation coefficient, and determine that the quality of the Chinese medicinal materials has become abnormal when the abnormal characterization value is greater than the dynamic abnormal threshold.

[0196] Step S600 in the method provided in this embodiment of the invention includes: The abnormal characterization value is positively correlated with both the first deviation coefficient and the second deviation coefficient. When it is determined that a quality abnormality has occurred in the drying process of Chinese medicinal materials, an alarm signal is triggered. The current state feature sequence, the first deviation coefficient, the second deviation coefficient, and the dynamic abnormality threshold are recorded. The hot air temperature adjustment amount and hot air speed adjustment amount obtained by the action output layer in the reinforcement learning agent at the current time are sent to the hot air drying control device for regulation. After the regulation is completed, the process returns to the step of obtaining the state feature sequence to determine the quality abnormality until the abnormal characterization value is less than the dynamic abnormality threshold.

[0197] In this embodiment, after obtaining the first deviation coefficient, the second deviation coefficient, and the dynamic abnormality threshold corresponding to the current drying stage, multiple abnormal influencing factors are further evaluated to determine whether the current hot air drying process of Chinese medicinal materials has caused quality abnormalities.

[0198] Specifically, the anomaly representation value is calculated as follows: Anomaly characterization value = .

[0199] The first deviation coefficient and the second deviation coefficient represent the degree of abnormal deviation in different dimensions, respectively.

[0200] The influence of deviation direction is eliminated by squaring, so that both positive and negative deviations can participate in the evaluation of the degree of anomaly. Multidimensional deviation fusion is achieved by squaring and square root operations.

[0201] Since the abnormal characterization value is composed of the first deviation coefficient and the second deviation coefficient, the abnormal characterization value increases when the first deviation coefficient increases, and the abnormal characterization value increases when the second deviation coefficient increases.

[0202] Furthermore, when the abnormal characterization value exceeds the dynamic abnormality threshold, it is determined that a quality abnormality has occurred in the current hot air drying process of the Chinese medicinal materials. Specifically: If the abnormal characterization value is greater than the dynamic abnormal threshold, then a quality abnormality is determined to have occurred. If the abnormal characterization value is less than or equal to the dynamic abnormal threshold, then the current drying process is determined to be in a normal state.

[0203] The dynamic anomaly threshold is dynamically obtained based on the changes in prediction uncertainty and hot air uniformity in the aforementioned embodiments, and is used to adapt to environmental fluctuations at different drying stages.

[0204] For example, during the hot air drying process of a certain batch of Astragalus membranaceus, the first deviation coefficient was calculated to be 0.042, and the second deviation coefficient was calculated to be 0.20. Therefore, the anomaly characteristic value is... ≈0.204. If the current dynamic anomaly threshold is 0.18, and since 0.204 > 0.18, it is determined that a quality anomaly has occurred in the current drying process of the Chinese medicinal materials.

[0205] Furthermore, when a quality abnormality is determined to occur, this embodiment triggers an alarm signal and records the data corresponding to the current abnormal state.

[0206] Specifically, while generating an alarm signal, the data corresponding to the current abnormal moment is stored in the abnormal record database.

[0207] The recorded data includes at least the current state feature sequence, the first deviation coefficient, the second deviation coefficient, and the dynamic anomaly threshold.

[0208] Furthermore, after triggering an abnormal alarm, this embodiment further calls upon the action output result corresponding to the current moment of the reinforcement learning agent to automatically adjust the hot air drying process.

[0209] Specifically, at the current anomaly detection moment, the current state feature sequence is input into the reinforcement learning agent after training is completed.

[0210] The reinforcement learning agent performs forward propagation calculations based on the current state features, and the corresponding control actions are output by the action output layer.

[0211] The control actions include adjusting the hot air temperature and the hot air speed. Specifically: Control action = (Hot air temperature adjustment amount, hot air speed adjustment amount).

[0212] Among them, the hot air temperature adjustment is used to adjust the heat input level inside the hot air drying oven, and the hot air speed adjustment is used to adjust the hot air circulation intensity and moisture migration rate.

[0213] For example, when an anomaly occurs, after the current state feature sequence is input into the reinforcement learning agent, the action output layer outputs a hot air temperature adjustment of -2℃ and a hot air velocity adjustment of 0.15m / s. This indicates that under the current drying state, the reinforcement learning agent believes it is necessary to lower the hot air temperature and increase the hot air circulation speed to reduce the deviation of the water loss process. Subsequently, the above control actions are sent to the hot air drying control device for execution.

[0214] Furthermore, after the hot air drying control device performs regulation, the current state data of the drying process is re-acquired, and the anomaly detection process is re-executed. Specifically, this includes re-acquiring the surface color value of the Chinese medicinal materials and the temperature difference between the hot air inlet and outlet, constructing an updated state feature sequence; re-acquiring the probability distribution parameters of the expected water loss rate based on the reinforcement learning agent; recalculating the first deviation coefficient and the second deviation coefficient; and recalculating the anomaly characterization value according to the dynamic anomaly threshold.

[0215] Furthermore, repeat the above anomaly detection and control adjustment process until the anomaly characterization value is less than or equal to the dynamic anomaly threshold.

[0216] When the above conditions are met, the current hot air drying process is considered to have returned to normal, and abnormal control is stopped.

[0217] For example, after performing one adjustment, the first deviation coefficient is recalculated to be 0.018 and the second deviation coefficient to be 0.10. Then the anomaly characteristic value is... ≈0.102. If the current dynamic anomaly threshold is still 0.18, since 0.102 < 0.18, it is determined that the current drying process has returned to normal, and further control is stopped.

[0218] In summary, this step constructs anomaly representation values ​​based on the first and second deviation coefficients and compares them with a dynamic anomaly threshold. When the anomaly representation value exceeds the dynamic anomaly threshold, a quality anomaly is determined to have occurred in the current drying process. The abnormal state data is further recorded, and the reinforcement learning agent is invoked to output corresponding hot air temperature and wind speed adjustment actions for adaptive control of the drying process. After adjustment, the state features are reacquired and repeatedly detected until the anomaly representation value returns to within the dynamic anomaly threshold range, thereby achieving automatic identification and closed-loop control of drying quality anomalies.

[0219] Example 2, as Figure 3 As shown, this invention provides an anomaly monitoring system for the processing of traditional Chinese medicinal materials based on reinforcement learning, comprising: State feature acquisition module 11 is used to acquire the surface color value and hot air inlet and outlet temperature difference value of Chinese medicinal materials at multiple sampling times during the hot air drying process, and form a state feature sequence; The reinforcement learning prediction module 12 is used to output the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage, based on the reinforcement learning agent and the state feature sequence as input. The probability distribution parameters include the expected value and uncertainty. The water loss deviation calculation module 13 is used to collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient. The wind temperature uniformity analysis module 14 is used to collect the wind temperature uniformity of multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient. The dynamic threshold adjustment module 15 is used to set an initial abnormal threshold, correct the uncertainty based on the current hot air temperature fluctuation range, obtain the corrected uncertainty, and dynamically adjust the initial abnormal threshold to obtain a dynamic abnormal threshold. The anomaly monitoring and judgment module 16 is used to calculate the anomaly characterization value based on the first deviation coefficient and the second deviation coefficient, and to determine that a quality abnormality has occurred in the drying process of Chinese medicinal materials when the anomaly characterization value is greater than the dynamic anomaly threshold.

[0220] In this embodiment of the invention, the state feature acquisition module 11 is further configured to: The surface chromaticity value is obtained by collecting images of the Chinese medicinal materials at each sampling time and converting them to the CIELAB color space. The average values ​​of the three channels (brightness, red-green, and yellow-blue) are extracted to form the original chromaticity vector. The vector is then smoothed by taking the median value of each channel back N times from the current time. The temperature difference between the inlet and outlet of the hot air is obtained by smoothing the temperature difference between the inlet and outlet at the same sampling time using the median value of the same N times, where N is an integer greater than 1.

[0221] In this embodiment of the invention, the reinforcement learning prediction module 12 is further configured to: A policy network is constructed, which takes the state feature sequence as input to extract temporal features and outputs a hidden state representation vector with a fixed dimension. The hidden state representation vector is mapped to the action prediction head and the water loss rate prediction head respectively. The action prediction head outputs the strategy distribution parameters of the continuous action space, which is defined as the two-dimensional continuous action of hot air temperature adjustment and hot air speed adjustment. The water loss rate prediction head outputs the predicted expected value and logarithmic standard deviation of the water loss rate, and obtains the predicted standard deviation through exponential function activation. Together, they constitute the probability distribution parameters of the expected water loss rate. The execution action is obtained by sampling the strategy distribution parameters of the action prediction head and applied to the hot air drying control device. The actual water loss rate and the wind temperature uniformity of each sampling point within the preset time window after the action is applied are collected as feedback data. A reward signal is constructed based on the deviation between the actual measured water loss rate and the expected value of the expected water loss rate, as well as the deviation between the measured value of wind temperature uniformity and the preset uniformity threshold. The reward signal is negatively correlated with the deviation and the degree of deviation. The policy gradient loss function is constructed with the goal of maximizing the expected value of the reward signal, and the network parameters of the policy network are updated with the gradient direction of the policy gradient loss function. Repeat the action sampling, reward calculation and parameter update until the policy gradient loss function converges, and fix the policy network parameters after convergence; The expected value of the water loss rate output by the strategy network is used as the expected value of the probability distribution parameter of the expected water loss rate, and the standard deviation of the predicted distribution of the water loss rate output by the strategy network is used as the uncertainty of the probability distribution parameter.

[0222] Here, the hidden state representation vector is mapped to the policy distribution parameters of a continuous action space, which is defined as a two-dimensional continuous action of hot air temperature regulation and hot air speed regulation, including: The hidden state representation vectors are input into the temperature regulator network and the wind speed regulator network, respectively. The temperature regulator network outputs the mean and logarithmic standard deviation of the hot air temperature regulation amount and obtains the temperature regulation standard deviation by exponential function activation. The wind speed regulator network outputs the mean and logarithmic standard deviation of the hot air wind speed regulation amount and obtains the wind speed regulation standard deviation by exponential function activation. The mean and standard deviation of each dimension constitute the strategy distribution parameters of a two-dimensional diagonal Gaussian distribution. The original action values ​​are obtained by sampling from a two-dimensional diagonal Gaussian distribution. The original action values ​​are scaled by a hyperbolic tangent function with the action boundaries of the hot air temperature regulation and the hot air speed regulation, respectively, to obtain the execution action. The execution action is applied to the hot air drying control device and feedback data is collected to construct a reward signal and update the strategy network.

[0223] In this embodiment of the invention, the water loss deviation calculation module 13 is further used for: The instantaneous mass value of the Chinese medicinal materials is continuously collected at fixed time intervals during the current drying stage. The difference between the instantaneous mass values ​​of two adjacent sampling times is divided by the fixed time interval to obtain the measured value of the instantaneous water loss rate in each sampling interval. The instantaneous deviation in each sampling interval is obtained by subtracting the measured instantaneous water loss rate in each sampling interval from the expected value of the expected water loss rate at the same sampling time. The instantaneous deviations of all sampling intervals within the current drying stage are time-weighted and accumulated. The instantaneous deviations are multiplied by each instantaneous deviation at fixed time intervals and summed to obtain the cumulative integral value of the instantaneous deviations within the current drying stage, which is used as the cumulative deviation. Calculate the arithmetic mean of the expected water loss rates at each sampling time within the current drying stage, and combine it with the total duration of the current drying stage to obtain the expected cumulative water loss baseline value; Divide the cumulative deviation by the expected cumulative water loss baseline value to obtain the first deviation coefficient.

[0224] The instantaneous mass value of the Chinese medicinal materials is obtained by distributing multiple weighing sensors under the support structure that carries the Chinese medicinal materials in the hot air drying oven, synchronously collecting the mass signals output by each sensor, using the median value of each mass signal as the original mass measurement value at the current moment, and then using the hot air wind speed signal at the current moment to compensate for wind pressure disturbances in the original mass measurement value, and then smoothing it through a first-order low-pass filter.

[0225] In this embodiment of the invention, the wind temperature uniformity analysis module 14 is further used for: Multiple temperature sensors are arranged in a spatial orthogonal grid within the effective working area of ​​the hot air drying oven, and the temperature readings of each temperature sensor are collected synchronously at each sampling time during the current drying stage. The steps for defining the effective work area include: Multiple temperature measuring points are arranged inside the hot air drying oven according to a three-dimensional spatial grid, and each temperature measuring point is equidistant in both the horizontal and vertical directions. Based on the set temperature of the hot air drying oven, the oven was run under no-load conditions until the temperature stabilized, and the steady-state temperature values ​​of each temperature measuring point were collected. Calculate the temperature deviation between the steady-state temperature value and the set temperature at each temperature measuring point. The effective working area is defined as the spatial range in which the absolute value of each temperature deviation does not exceed the preset temperature deviation limit. The preset temperature deviation limit is set according to the preset uniformity threshold and process requirements. The standard deviation of the temperature readings of all temperature sensors at the same sampling time is used as the instantaneous wind temperature uniformity at the sampling time, and the instantaneous wind temperature uniformity sequence within the current drying stage is constructed according to the sampling time order. Calculate the arithmetic mean of the instantaneous wind temperature uniformity sequence as the wind temperature uniformity characterization value for the current drying stage; Calculate the difference between the wind temperature uniformity characterization value and the preset uniformity threshold, and divide the difference by the preset uniformity threshold to obtain the second deviation coefficient.

[0226] In this embodiment of the invention, the dynamic threshold adjustment module 15 is further configured to: Using the current sampling time as the endpoint, backtrack N sampling times to calculate the hot air inlet and outlet temperature difference values, and calculate the sliding deviation of the hot air inlet and outlet temperature difference values ​​within the backtracking window as the current hot air temperature fluctuation range. The temperature difference between the inlet and outlet of the hot air is used as the reference temperature difference at the first sampling moment after the time-varying slope of the lightness component of the surface color value changes from positive to negative during the hot air drying process. Based on the relative ratio between the current hot air temperature fluctuation amplitude and the reference temperature difference, the relative ratio is mapped to the 0 to 1 range through a nonlinear saturation function to obtain the temperature control confidence decay factor. The uncertainty is positively weighted and corrected using the temperature control confidence decay factor to obtain the corrected uncertainty. The corrected uncertainty is positively correlated with the temperature control confidence decay factor. The threshold adjustment factor is determined based on the relative relationship between the dispersion and central tendency of the instantaneous wind temperature uniformity sequence at the current moment. The initial anomaly threshold is scaled in the first stage according to the relative proportion of the corrected uncertainty to the uncertainty, and then modulated in the second stage according to the threshold adjustment factor to obtain the dynamic anomaly threshold.

[0227] In this embodiment of the invention, the anomaly monitoring and determination module 16 is further configured to: The abnormal characterization value is positively correlated with both the first deviation coefficient and the second deviation coefficient. When it is determined that a quality abnormality has occurred in the drying process of Chinese medicinal materials, an alarm signal is triggered. The current state feature sequence, the first deviation coefficient, the second deviation coefficient, and the dynamic abnormality threshold are recorded. The hot air temperature adjustment amount and hot air speed adjustment amount obtained by the action output layer in the reinforcement learning agent at the current time are sent to the hot air drying control device for regulation. After the regulation is completed, the process returns to the step of obtaining the state feature sequence to determine the quality abnormality until the abnormal characterization value is less than the dynamic abnormality threshold.

[0228] In summary, this invention provides an anomaly monitoring system for the processing of traditional Chinese medicine (TCM) materials based on reinforcement learning. By acquiring surface color information, hot air temperature difference status, and water loss change data during the hot air drying process of TCM materials, a time-series state feature sequence is constructed. A reinforcement learning agent is then used to predict the expected water loss rate and control actions at different drying stages. Simultaneously, by combining actual water loss process deviations and air temperature uniformity deviations, a multi-dimensional anomaly evaluation index is constructed, and the anomaly judgment threshold is dynamically adjusted based on temperature fluctuations and environmental stability to improve the adaptability of anomaly detection. When a quality anomaly is detected, the reinforcement learning strategy is invoked to output corresponding control actions, achieving adaptive adjustment of hot air temperature and wind speed. This enables intelligent monitoring and closed-loop optimization control of the TCM material drying process, improving the stability of the drying process and the processing quality.

[0229] It should be noted that the processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some implementations, multitasking and parallel processing are possible or may be advantageous.

[0230] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0231] This specification and accompanying drawings are merely illustrative examples of the invention and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the invention. Clearly, those skilled in the art can make various alterations and modifications to the invention without departing from its scope. Therefore, if such modifications and modifications fall within the scope of the invention and its equivalents, the invention is intended to include these modifications and modifications.

Claims

1. A method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning, characterized in that, The method includes: The surface color values ​​and hot air inlet / outlet temperature differences of Chinese medicinal materials at multiple sampling times during the hot air drying process were obtained to form a state feature sequence. Based on the reinforcement learning agent, the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage are output, with the state feature sequence as input. The probability distribution parameters include the expected value and uncertainty. Collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient. Collect the wind temperature uniformity at multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient; An initial anomaly threshold is set, the uncertainty is corrected based on the current hot air temperature fluctuation range, the corrected uncertainty is obtained, and the initial anomaly threshold is dynamically adjusted to obtain a dynamic anomaly threshold. Based on the first deviation coefficient and the second deviation coefficient, an abnormal characterization value is calculated, and when the abnormal characterization value is greater than the dynamic abnormal threshold, it is determined that a quality abnormality has occurred in the drying process of Chinese medicinal materials.

2. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, The surface chromaticity value is obtained by collecting images of the Chinese medicinal materials at each sampling time and converting them to the CIELAB color space. The average values ​​of the three channels (brightness, red-green, and yellow-blue) are extracted to form the original chromaticity vector. The vector is then smoothed by taking the median value of each channel back N times from the current time. The hot air inlet and outlet temperature difference value is obtained by smoothing the inlet and outlet temperature difference at the same sampling time using the median value of the same N times, where N is an integer greater than 1.

3. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, The steps for constructing the reinforcement learning agent include: A policy network is constructed, which extracts temporal features from the state feature sequence as input and outputs a hidden state representation vector of fixed dimension. The hidden state representation vector is mapped to the action prediction head and the water loss rate prediction head respectively. The action prediction head outputs the strategy distribution parameters of the continuous action space. The action space is defined as a two-dimensional continuous action of hot air temperature adjustment and hot air speed adjustment. The water loss rate prediction head outputs the predicted expected value and logarithmic standard deviation of the water loss rate, and obtains the predicted standard deviation through exponential function activation. Together, they constitute the probability distribution parameters of the expected water loss rate. The execution action is obtained by sampling the strategy distribution parameters of the action prediction head and applied to the hot air drying control device. The actual water loss rate and the wind temperature uniformity of each sampling point within the preset time window after the action is applied are collected as feedback data. A reward signal is constructed based on the deviation between the measured actual water loss rate and the expected value of the expected water loss rate, and the deviation between the measured wind temperature uniformity and the preset uniformity threshold. The reward signal is negatively correlated with the deviation and the degree of deviation. A policy gradient loss function is constructed with the goal of maximizing the expected value of the reward signal, and the network parameters of the policy network are updated with the gradient direction of the policy gradient loss function. Repeat the action sampling, reward calculation and parameter update until the policy gradient loss function converges, and fix the converged policy network parameters; The expected value of the water loss rate output by the strategy network is used as the expected value of the probability distribution parameter of the expected water loss rate, and the standard deviation of the predicted distribution of the water loss rate output by the strategy network is used as the uncertainty of the probability distribution parameter.

4. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 3, characterized in that, The hidden state representation vector is mapped to policy distribution parameters in a continuous action space, whereby the action space is defined as a two-dimensional continuous action involving hot air temperature adjustment and hot air speed adjustment, including: The hidden state representation vector is input into the temperature regulator network and the wind speed regulator network respectively. The temperature regulator network outputs the mean and logarithmic standard deviation of the hot air temperature regulation amount and obtains the temperature regulation standard deviation by exponential function activation. The wind speed regulator network outputs the mean and logarithmic standard deviation of the hot air wind speed regulation amount and obtains the wind speed regulation standard deviation by exponential function activation. The mean and standard deviation of each dimension constitute the strategy distribution parameters of a two-dimensional diagonal Gaussian distribution. The original action value is obtained by sampling from the two-dimensional diagonal Gaussian distribution. The original action value is scaled by the hyperbolic tangent function with the action boundary of hot air temperature regulation and the action boundary of hot air speed regulation, respectively, to obtain the execution action. The execution action is applied to the hot air drying control device and feedback data is collected to construct a reward signal and update the strategy network.

5. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, Collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain a first deviation coefficient, including: The instantaneous mass value of the Chinese medicinal materials is continuously collected at fixed time intervals during the current drying stage. The difference between the instantaneous mass values ​​of two adjacent sampling times is divided by the fixed time interval to obtain the measured value of the instantaneous water loss rate in each sampling interval. The instantaneous deviation in each sampling interval is obtained by subtracting the measured instantaneous water loss rate in each sampling interval from the expected value of the expected water loss rate at the same sampling time. The instantaneous deviations of all sampling intervals within the current drying stage are time-weighted and accumulated. The fixed time interval is multiplied by each instantaneous deviation and summed to obtain the cumulative integral value of the instantaneous deviation within the current drying stage, which is used as the cumulative deviation. Calculate the arithmetic mean of the expected water loss rate at each sampling time within the current drying stage, and combine it with the total duration of the current drying stage to obtain the expected cumulative water loss baseline value; The first deviation coefficient is obtained by dividing the cumulative deviation by the expected cumulative water loss benchmark value.

6. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 5, characterized in that, The instantaneous mass value of the Chinese medicinal materials is obtained by distributing multiple weighing sensors under the support structure carrying the Chinese medicinal materials in the hot air drying oven, synchronously collecting the mass signals output by each sensor, using the median value of each mass signal as the original mass measurement value at the current moment, and then using the hot air wind speed signal at the current moment to compensate for wind pressure disturbances on the original mass measurement value, and then smoothing it through a first-order low-pass filter.

7. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, Collect the wind temperature uniformity at multiple sampling points during the current drying stage, calculate the deviation of the wind temperature uniformity from a preset uniformity threshold, and obtain a second deviation coefficient, including: Multiple temperature sensors are arranged in a spatial orthogonal grid within the effective working area of ​​the hot air drying oven, and the temperature readings of each temperature sensor are collected synchronously at each sampling time during the current drying stage. The steps for defining the effective working area include: Multiple temperature measuring points are arranged in a three-dimensional spatial grid inside the hot air drying oven, and each temperature measuring point is equidistant in both the horizontal and vertical directions. Based on the set temperature of the hot air drying oven, after the temperature stabilizes under no-load conditions, the steady-state temperature values ​​of each temperature measuring point are collected. Calculate the temperature deviation between the steady-state temperature value of each temperature measuring point and the set temperature. Determine the effective working area as the spatial range in which the absolute value of each temperature deviation does not exceed the preset temperature deviation limit. The preset temperature deviation limit is set according to the preset uniformity threshold and process requirements. The standard deviation of the temperature readings of all temperature sensors at the same sampling time is used as the instantaneous wind temperature uniformity at the sampling time, and the instantaneous wind temperature uniformity sequence within the current drying stage is constructed according to the sampling time order. Calculate the arithmetic mean of the instantaneous wind temperature uniformity sequence as the wind temperature uniformity characterization value for the current drying stage; Calculate the difference between the wind temperature uniformity characterization value and the preset uniformity threshold, and divide the difference by the preset uniformity threshold to obtain the second deviation coefficient.

8. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, An initial anomaly threshold is set, the uncertainty is corrected based on the current hot air temperature fluctuation range, the corrected uncertainty is obtained, and the initial anomaly threshold is dynamically adjusted to obtain a dynamic anomaly threshold, including: Using the current sampling time as the endpoint, backtrack N sampling times to calculate the hot air inlet and outlet temperature difference values, and calculate the sliding deviation of the hot air inlet and outlet temperature difference values ​​within the backtracking window as the current hot air temperature fluctuation range. The temperature difference between the inlet and outlet of the hot air is used as the reference temperature difference at the first sampling moment after the time-varying slope of the lightness component of the surface color value changes from positive to negative during the hot air drying process. Based on the relative ratio between the current hot air temperature fluctuation amplitude and the reference temperature difference, the relative ratio is mapped to the 0 to 1 interval through a nonlinear saturation function to obtain the temperature control confidence decay factor. The uncertainty is positively weighted and corrected using the temperature control confidence decay factor to obtain the corrected uncertainty, wherein the corrected uncertainty is positively correlated with the temperature control confidence decay factor. The threshold adjustment factor is determined based on the relative relationship between the dispersion and central tendency of the instantaneous wind temperature uniformity sequence at the current moment. The initial anomaly threshold is scaled in the first stage according to the relative proportion of the corrected uncertainty to the uncertainty, and then modulated in the second stage according to the threshold adjustment factor to obtain the dynamic anomaly threshold.

9. The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning according to claim 1, characterized in that, The abnormal characterization value is positively correlated with both the first deviation coefficient and the second deviation coefficient. When it is determined that a quality abnormality has occurred in the drying process of the Chinese medicinal materials, an alarm signal is triggered. The state feature sequence, the first deviation coefficient, the second deviation coefficient, and the dynamic abnormality threshold at the current moment are recorded. The hot air temperature adjustment amount and hot air speed adjustment amount obtained by the action output layer in the reinforcement learning agent at the current moment are sent to the hot air drying control device for regulation. After the regulation is completed, the process returns to the step of obtaining the state feature sequence to determine the quality abnormality until the abnormal characterization value is less than the dynamic abnormality threshold.

10. A reinforcement learning-based anomaly monitoring system for the processing of traditional Chinese medicinal materials, characterized in that, The method for monitoring anomalies in the processing of traditional Chinese medicinal materials based on reinforcement learning, as described in any one of claims 1 to 9, comprises: The state feature acquisition module is used to acquire the surface color value and hot air inlet and outlet temperature difference value of Chinese medicinal materials at multiple sampling times during the hot air drying process, forming a state feature sequence. The reinforcement learning prediction module is used to output the probability distribution parameters of the expected water loss rate matching the Chinese medicinal material variety under the current drying stage, based on the reinforcement learning agent and the state feature sequence as input. The probability distribution parameters include the expected value and uncertainty. The water loss deviation calculation module is used to collect the actual water loss rate during the current drying stage, calculate the cumulative deviation of the actual water loss rate from the expected value, and obtain the first deviation coefficient. The wind temperature uniformity analysis module is used to collect the wind temperature uniformity of multiple sampling points during the current drying stage, calculate the degree of deviation between the wind temperature uniformity and the preset uniformity threshold, and obtain the second deviation coefficient. The dynamic threshold adjustment module is used to set an initial abnormal threshold, correct the uncertainty based on the current hot air temperature fluctuation range, obtain the corrected uncertainty, and dynamically adjust the initial abnormal threshold to obtain a dynamic abnormal threshold. The anomaly monitoring and judgment module is used to calculate the anomaly characterization value based on the first deviation coefficient and the second deviation coefficient, and to determine that a quality abnormality has occurred in the drying process of Chinese medicinal materials when the anomaly characterization value is greater than the dynamic anomaly threshold.