A method for monitoring the purification process of chebulagic acid extract based on image processing
By combining edge detection and deep learning algorithms with a lightweight semantic segmentation model and dynamically adjusting the threshold, the problem of bias in the determination of high-purity regions in traditional methods is solved, and high-precision monitoring of the purification process of Terminalia chebula acid extract is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAANXI TIANXINGJIAN BIOCHEMICAL TECH CO LTD
- Filing Date
- 2026-03-11
- Publication Date
- 2026-06-09
Smart Images

Figure CN122176304A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of purification monitoring engineering, specifically to a method for monitoring the purification process of Terminalia chebula acid extract based on image processing. Background Technology
[0002] Terminalia chebulic acid, as a natural polyphenol compound, has important applications in medicine, food, and other fields. The purification process of its extract is crucial to the purity and quality of the final product. To achieve precise monitoring of the purification process, it is necessary to analyze the migration and enrichment status of the terminalia chebulic acid bands in core steps such as resin column chromatography in real time, so as to ensure the efficient separation and collection of high-purity terminalia chebulic acid.
[0003] Existing methods for monitoring the purification process of chebulic acid extract often employ a fixed threshold segmentation method based on traditional image processing to analyze the resin column window image. Specifically, by setting a single grayscale threshold, the chebulic acid banded areas in the image are divided into background and impurity areas to identify chebulic acid-rich regions. However, during the purification process of chebulic acid extract, the banded characteristics vary significantly at different stages. Traditional fixed threshold segmentation methods cannot adaptively adjust the segmentation criteria according to these dynamic changes, leading to deviations in the determination of high-purity chebulic acid regions and ultimately affecting the accuracy and reliability of the entire purification process monitoring. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a method for monitoring the purification process of chebulic acid extract based on image processing, thereby solving the problem of deviations in the determination of high-purity chebulic acid regions.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for monitoring the purification process of Terminalia chebula acid extract based on image processing, comprising the following steps: Step S1: Obtain the grayscale image of the resin column during the purification process of chebulic acid extract, and preprocess the grayscale image based on the edge detection algorithm to obtain the effective chromatography region image of the resin column. Step S2: Construct a lightweight semantic segmentation model based on deep learning algorithm, input the effective tomographic region image of the resin column into the lightweight semantic segmentation model, and output a binary segmentation map of the chebulic acid band region. Step S3: Calculate the initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration during the purification process of chebulic acid extract based on the binary segmentation map of the chebulic acid color band region, and then calculate the final chebulic acid enrichment probability. Step S4: Collect historical data of the purification process of chebulic acid extract, use a clustering algorithm to perform staged clustering of the historical data, calculate the stage threshold, compare the final chebulic acid enrichment probability with the stage threshold, and screen out high-purity chebulic acid regions. Step S5: Based on the high-purity chebulic acid region, obtain the purity and purification rate of chebulic acid, and issue an early warning when the purity is lower than a preset purity threshold or the purification rate is not within a preset purification rate threshold range.
[0006] Preferably, obtaining grayscale images of the resin column during the purification process of chebulic acid extract includes: First, the resin column window image, i.e., the RGB image, is acquired and then Gaussian filtering is performed to remove noise. Subsequently, to enhance the characteristics of the chebulic acid band and improve its contrast with the background, an adaptive weighted method based on the color features of the band was used for grayscale conversion. The grayscale conversion formula is as follows: ; Where R, G, and B represent the pixel intensities of the red, green, and blue channels of a pixel in the input RGB image, respectively. Adaptive weighting coefficients were used to obtain the grayscale image of the resin column. This will serve as the basis for subsequent processing.
[0007] Preferably, the resin column window image is preprocessed based on an edge detection algorithm to obtain an image of the effective tomographic region of the resin column, including: In the edge detection stage, the Canny algorithm is used to extract the contour, and the gradient magnitude M is calculated by the Sobel operator. Then, non-maximum suppression and double threshold hysteresis are performed to output a continuous single-pixel wide edge map. In the geometric modeling stage, the effective region is accurately located using the Hough transform; for cylindrical resin columns, a circular Hough transform is used. The optimal center coordinates (a, b) and radius r are determined through a parameter space accumulator voting mechanism. The geometric features are then encapsulated into a four-tuple structure. ; Ultimately based on the quadruple The image of the effective chromatography region of the resin column is cropped out.
[0008] Preferably, lightweight semantic segmentation models built based on deep learning algorithms include: The lightweight semantic segmentation model is based on the AMCNet framework and adopts an encoder-decoder structure. The encoder uses a short-term dense connection network as the backbone network; the decoder enhances feature representation through a multi-scale feature fusion module and a multi-path feature attention fusion module. The model training uses a combination of binary cross-entropy loss and Dice loss. Combination loss function
[0009] ; in, It is binary cross-entropy loss; It is a Dice loss.
[0010] Preferably, inputting the effective chromatography region image of the resin column into a lightweight semantic segmentation model to output a binary segmentation map of the chebulic acid band region includes: The result obtained in step S1 is based on the quadruple. The cropped image of the effective chromatography region of the resin column is input into a lightweight semantic segmentation model for forward propagation. The final output is the segmentation result of the chebulic acid band region, i.e., the binary segmentation map of the chebulic acid band region. , where a pixel value of 1 represents the target area and 0 represents the background.
[0011] Preferably, the calculation of the initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration during the purification process of chebulic acid extract based on the binary segmentation map of the chebulic acid color band region includes: The initial chebulic acid enrichment probability H is calculated as follows: ; in, It is the initial probability of chebulic acid enrichment; is the normalized band area; P is the positional characteristic value associated with the elution progress. and These are the weighting coefficients; It is a stage correction factor; The texture uniformity T is calculated as follows: First, the calculation range is limited to the segmented Terminalia chebulic acid color band region; then, a gray-level co-occurrence matrix is constructed; finally, the texture uniformity T is calculated. ; Where T is texture uniformity; Homogeneity is the homogeneity index; Contrast is the contrast index; weights of 0.7 and 0.3 emphasize the dominant role of homogeneity. The color distribution concentration C is calculated as follows: The calculation scope is limited to the cropped RGB sub-image of the color band. ; for the RGB sub-image of the color band Perform rapid white balance correction; finally, calculate the color distribution concentration C: ; in, It refers to the concentration of color distribution; It is the first-order moment of RGB three channels; It is the average of the second moments of the three RGB channels; It is the average of the third moments of the three RGB channels; and These are the average values of the second moments of the RGB three channels in historical high-purity successful batch samples. The average value of the second moment of the three RGB channels | The 95th percentile of |.
[0012] Preferably, the formula for calculating the final enrichment probability of chebulic acid is: ; Where H is the initial probability of chebulic acid enrichment; T is the texture uniformity; and C is the color distribution concentration. , , These are the basic weights; , and It is the confidence level of dynamic features.
[0013] Preferably, historical data on the purification process of Terminalia chebula acid extract is collected, and a clustering algorithm is used to perform staged clustering on the historical data to calculate the stage thresholds, including: The first step is data collection, which involves collecting historical data from multiple purification processes. Each process includes a series of time points and their corresponding... value; Then, a phased cluster analysis was performed to analyze all historical batches. The values are aggregated into a dataset, which is then divided into K clusters using the K-means clustering algorithm. The stage division is then achieved by minimizing the objective function J of the within-cluster squared error. After clustering, each time point is assigned a stage label. ∈{1,2,...,K}; For each stage k obtained from clustering, its baseline threshold is calculated.
[0014] Baseline threshold based on trend characteristics Adjust to phased threshold For the current time point t and its corresponding stage k, the corrected stage threshold is... The calculation is as follows: ; in, It is the corrected staged threshold; η is the correction coefficient.
[0015] Preferably, the final chebulic acid enrichment probability is compared with the staged threshold to screen for high-purity chebulic acid regions, including: Obtain the corrected staged threshold Then, a final determination is made based on purity characteristics, and the final enrichment probability of chebulic acid is determined. ≥ Phased threshold At that time, the area was determined to be a high-purity chebulic acid region.
[0016] Preferably, step S5 includes: Purity of chebulic acid Using this region in multiple adjacent frames The average value is calculated using the following formula: ; in, This indicates the purity of chebulic acid at the current time t; It is the region-level enrichment probability value used to determine the high-purity output region at time τ; T is the size of the time smoothing window.
[0017] Purification speed A comprehensive monitoring strategy combining instantaneous displacement rate and area change rate is adopted; firstly, the instantaneous displacement rate at time t is calculated. Then, the area change rate is calculated by statistically analyzing the change in the total number of pixels in the color band. Ultimately, the purification speed The formula for calculating at time point t is: ; in, , Instantaneous displacement rate The mean and standard deviation of historical normal data; , Area change rate The mean and standard deviation of historical normal data; weights of 0.7 and 0.3 reflect... Dominance; The threshold settings are based on historical normal production data and are divided into purity threshold and speed threshold, which are used to detect abnormal fluctuations in purity and speed, respectively. The early warning mechanism makes judgments based on real-time calculated values of purity and purification rate, and uses OR logic to trigger the early warning. When the purity is lower than the preset purity threshold or the purification rate is not within the preset purification rate threshold range, that is, as long as either indicator is abnormal, an early warning signal is generated.
[0018] This invention provides a method for monitoring the purification process of Terminalia chebula acid extract based on image processing, involving machine learning and deep learning technologies, which has the following beneficial effects: (1) The image processing-based method for monitoring the purification process of chebulic acid extract adopts a lightweight semantic segmentation model based on the AMCNet framework, combined with multi-scale feature fusion (DASPP module) and attention mechanism (MFFM module), to achieve pixel-level learning of the texture, color and morphological features of chebulic acid bands. The model uses the BCE+Dice combined loss function to effectively balance the class imbalance problem, which improves the accuracy of band region segmentation by more than 30%, which is significantly better than the traditional fixed threshold segmentation method, and provides an accurate data foundation for subsequent purity feature calculation.
[0019] (2) The image processing-based method for monitoring the purification process of Terminalia chebula extract significantly enhances the small target segmentation capability while maintaining the lightweight nature of the model by optimizing the network structure (such as the block downsampling strategy of STDC network and reducing the number of filters to 32 per branch). The model improves the recall rate of trace impurity segmentation on edge devices by more than 25%, effectively solving the pain point of difficulty in balancing lightweight deployment and high-precision recognition in industrial scenarios.
[0020] (3) Image processing-based method for monitoring the purification process of chebulic acid extract. Based on the K-means clustering algorithm, historical purification data is modeled in stages (such as adsorption mid-stage, elution peak, and elution end stage). The baseline threshold is dynamically set by combining the 95th percentile and the threshold is corrected in real time by trend features (such as sliding window slope analysis). This dynamic threshold model enables the high purity region judgment criteria to be adaptively adjusted with the purification process, effectively avoiding the problem of missed judgment at the elution peak and misjudgment at the end stage by a single threshold, and improving the judgment accuracy by more than 20%.
[0021] (4) The image processing-based method for monitoring the purification process of chebulic acid extract, by introducing time series analysis technology (such as short-term trend characteristics and correction coefficients), captures the changing patterns of color band characteristics in real time and makes forward-looking corrections to the threshold. This mechanism can detect abnormal trends (such as impurity mixing or oxidation) 10-20 seconds in advance, significantly reducing product losses caused by the lag in threshold adjustment. At the same time, the multi-indicator collaborative monitoring (purity and speed) enhances the anti-interference ability and robustness in complex industrial environments. Attached Figure Description
[0022] Figure 1 This is a flowchart of a method for monitoring the purification process of Terminalia chebula acid extract based on image processing, as proposed in this invention.
[0023] Figure 2 The hierarchical map of the binary segmentation image is obtained by the image processing-based method for monitoring the purification process of Terminalia chebula acid extract proposed in this invention.
[0024] Figure 3This is a hierarchical diagram for over-threshold early warning in a method for monitoring the purification process of Terminalia chebula acid extract based on image processing proposed in this invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] Please see Figure 1-3 This invention provides a technical solution: a method for monitoring the purification process of chebulic acid extract based on image processing. Specifically, the method for monitoring the purification process of chebulic acid extract based on image processing is provided below. Figure 1 The method includes the following steps: Step S1: Obtain the grayscale image of the resin column during the purification process of chebulic acid extract, and preprocess the grayscale image based on the edge detection algorithm to obtain the effective chromatography region image of the resin column.
[0027] This step, as a fundamental part of image preprocessing, aims to accurately extract the geometric parameters of the effective tomographic region of the resin column from a complex industrial environment. This provides structured input data for the subsequent semantic segmentation model, and achieves a robust transformation from the original image to the target parameters through a combination of multi-level algorithms.
[0028] In the purification process of chebulic acid extract, resin column chromatography is the core separation technology, specifically as follows: Chebulic acid is separated from impurities through adsorption and elution within the resin column. During this process, chebulic acid forms characteristic colored bands within the resin column window. The migration position, morphological uniformity, and color concentration of these bands directly correspond to key purification stages and purity changes. Therefore, acquiring images of the resin column window is crucial for visually capturing these colored band characteristics, providing visual data support for subsequent analysis of the enrichment state and purity level of chebulic acid. This is a prerequisite for real-time monitoring, anomaly warning, and precise control of the purification process.
[0029] First, image acquisition and Gaussian filtering for noise reduction are performed. During real-time monitoring of the chebulic acid extract purification process, image acquisition is the primary foundation for ensuring the accuracy of subsequent analysis. The industrial camera is fixed in front of the resin column window using a dedicated bracket. Its installation position is precisely calibrated, requiring the lens optical axis to be strictly aligned with the center normal of the cylindrical window. The installation distance is adjusted within the range of 0.5 to 1.0 meters to ensure that the window area fills more than three-quarters of the image frame, while avoiding perspective distortion from affecting subsequent geometric measurements. The camera operates continuously at an adjustable frame rate, with a standard acquisition frequency set to 5 to 10 frames per second. This frequency range is based on historical statistical data of ribbon migration speed, effectively controlling the total amount of data while capturing sufficient dynamic details of the process to meet the processing capabilities of edge computing devices. The camera uses a global shutter sensor, coupled with short exposure times, to significantly suppress motion blur caused by liquid flow or equipment vibration. The camera resolution is configured according to the actual size of the viewport and the required measurement accuracy, with a minimum of 2 megapixels to ensure that subtle changes at the ribbon edges can be distinguished. To ensure consistent image quality in the resin column windows, the acquisition process employs an external trigger mode synchronized with PLC control, or uses a built-in precise timer for timed shooting to avoid timestamp discrepancies. Illumination utilizes a ring-shaped LED light source to diffusely and evenly illuminate the windows from the front, effectively eliminating reflections and shadows and minimizing the impact of ambient light fluctuations on the images. All acquired resin column window image sequences are named with timestamps and batch numbers and cached in real time in local storage before being streamed to an image processing server for further analysis.
[0030] Considering the dynamic changes in noise intensity in industrial environments (such as camera noise and environmental electromagnetic interference), Gaussian filtering with fixed parameters has an insignificant smoothing effect when noise is strong, and easily leads to edge blurring when noise is weak. Therefore, this method adopts an adaptive Gaussian filtering strategy based on noise estimation.
[0031] First, calculate the noise variance of the image. (For example, perform statistical analysis on a 16×16 neighborhood of a flat region in the image). Based on... The values of the Gaussian filter standard deviation σ and kernel size are dynamically adjusted, according to the following rules: like If the noise level is less than 10 (low noise), then a 5×5 filter core is used, and σ=0.8 is taken.
[0032] If 10≤ If the noise level is less than 30 (medium noise), then a 5×5 filter core is used, and σ=1.5 is taken.
[0033] like If the noise level is ≥30 (high noise), then a 5×5 filter core is used, and σ=2.2 is taken.
[0034] The formula for adaptive Gaussian filtering is as follows: ; in, These are the Gaussian kernel weight coefficients at coordinates (x, y); The relative coordinates are with the center of the Gaussian kernel as the origin; The standard deviation is dynamically determined according to the above rules and is used to control the degree of smoothing. This formula defines a Gaussian filter (smoothing template). A feedback mechanism based on edge strength is introduced to fine-tune the σ value, calculating the edge strength of the denoised image (e.g., the mean of the Sobel gradient). If the edge strength is lower than a preset threshold (typically 10), the σ value is decreased by 0.2 to avoid over-smoothing; if the edge strength is higher than the threshold (typically 50), the σ value is increased by 0.2 to enhance the denoising effect.
[0035] Subsequently, to enhance the chebulic acid banding characteristics and improve its contrast with the background, an adaptive weighting method based on the banding color features was used for grayscale conversion. First, sample images of the high-purity chebulic acid banding region from historical purification processes were collected, and the typical color distribution ranges of its R, G, and B channels were statistically analyzed. Then, with maximizing the inter-class variance between the target banding and the background as the optimization objective, a set of optimal weighting coefficients was determined through linear regression. The grayscale conversion formula is as follows: ; Where R, G, and B represent the pixel intensities of the red, green, and blue channels of a pixel in the input RGB image, respectively. , , These are adaptive weighted coefficients, summing to 1. These coefficients are optimized based on the spectral characteristics of the chebulic acid band, replacing traditional human visual characteristic coefficients. Typical values are: It adapts to the yellowish-brown color band. If the color band changes on-site, the coefficients can be recalibrated by updating the training set online. This yields a grayscale image of the resin column. This will serve as the basis for subsequent processing.
[0036] The edge detection stage uses the Canny algorithm to process grayscale images. Contour extraction is achieved. This edge detection algorithm first calculates the gradient magnitude using the Sobel operator. The formula is as follows: ; in, It is the gradient magnitude of the pixel. The larger the value, the more drastic the brightness change at that point, and the more likely it is to be an edge. , The gradients are approximations in the horizontal and vertical directions. Non-maximum suppression and dual-threshold hysteresis are then applied (the high threshold is the 70th quantile of the gradient magnitude distribution, and the low threshold is the 40th quantile), outputting a continuous single-pixel wide edge map. The edge map obtained in this stage contains multiple contour information, including the viewport border and the resin bed interface.
[0037] In the geometric modeling stage, the effective region is accurately located using the Hough transform. For cylindrical resin columns, a circular Hough transform is used, as shown in the following formula: ; in,( , Let (a, b) be the center coordinates of the effective area of the circular target to be detected, i.e., the resin column; and let r be the radius of the circle to be detected. The optimal center coordinates (a, b) and radius r are determined through a parameter space accumulator voting mechanism (with a threshold set to 60% of the number of points on the circumference). This algorithm effectively overcomes the problem of missing or interfering edges.
[0038] The final output target region parameter set is used for data transmission. Geometric features are encapsulated as a four-tuple structure: ; in, This represents the effective region area. This parameter set is transferred to step S2 via a memory-sharing mechanism, providing spatial prior constraints for the semantic segmentation model and ensuring the accuracy and efficiency of subsequent chebulic acid banding analysis. The entire preprocessing workflow, through tight integration between algorithms, achieves a complete transformation from pixel-level processing to geometric parameter generation.
[0039] According to the quadruple The effective tomographic region image of the resin column is cropped out. The cropped effective region image is normalized to a fixed size (e.g., 1024x512, to adapt to the input of the S2 semantic segmentation model) using bilinear interpolation. During normalization, the aspect ratio of the image is maintained, and blank areas are filled with black (pixel value = 0) to avoid color banding distortion caused by stretching.
[0040] This step, serving as the cornerstone of data preprocessing in this monitoring method, transforms the original resin column window image into a precise set of geometric parameters through an image processing workflow. Its core function is to establish a reliable spatial reference framework, providing structured input data for the subsequent semantic segmentation model. After acquiring image sequences using an industrial camera, this step sequentially performs Gaussian filtering to suppress environmental noise, grayscale processing to optimize feature representation, and Canny edge detection to extract contour features. Finally, the geometric modeling capabilities of Hough transform are used to accurately locate the center coordinates, radius, and area parameters of the effective tomographic region of the resin column, and these data are encapsulated into quadruples. And based on this quadruple By cropping out the effective tomographic region image of the resin column, this series of algorithms not only effectively eliminates industrial site interference such as shell reflection, but also ensures seamless integration of the entire monitoring process from pixel-level processing to semantic understanding.
[0041] Step S2: Construct a lightweight semantic segmentation model based on a deep learning algorithm. Input the effective tomographic region image of the resin column into the lightweight semantic segmentation model and output a binary segmentation map of the chebulic acid band region.
[0042] This step aims to use the effective tomographic region image of the resin column output from step S1 as input to a lightweight semantic segmentation model built based on a deep learning algorithm to obtain the segmentation result of the chebulic acid band region. This step is based on the AMCNet framework, designing an efficient encoder-decoder network that emphasizes a balance between lightweight design and accuracy. A specific parameter is defined for the final output so that it can be directly referenced in the subsequent step S3. This parameter represents the segmentation result and will serve as the input to step S3, ensuring the continuity of the process.
[0043] The lightweight semantic segmentation model is based on the AMCNet framework and employs an encoder-decoder structure. The encoder uses a Short-Term Dense Connection Network (STDC) as its backbone to extract multi-level features; the decoder enhances feature representation through a Multi-Scale Feature Fusion Module (DASPP) and a Multi-Path Feature Attention Fusion Module (MFFM), ultimately outputting pixel-level segmentation results. The model design prioritizes lightweight implementation, with approximately 5.886M parameters and approximately 53.237 GFLOPs of floating-point computation, making it suitable for resource-constrained environments. The input is the effective tomographic region of the resin column from step S1 (image size can be adjusted to 1024x512), and the output is a binary segmentation map of the chebulic acid band region.
[0044] The encoder construction process is as follows: The encoder processes the input image through a short, densely connected network containing multiple STDCL blocks, progressively downsampling to capture multi-scale features. To reduce detail loss during downsampling, this method optimizes the downsampling strategy: convolutions with a stride of 2 are used only in some blocks, while the stride is set to 1 in the remaining blocks, thus reducing the overall downsampling rate.
[0045] The Short-Term Dense Connection Network (STDC network) consists of 5 STDCL Blocks, and its internal structure is as follows: Each STDCL Block consists of several convolutional layers, batch normalization layers, and ReLU activation layers. The first convolutional layer is used for feature transformation and channel number adjustment. Subsequent convolutional layers use short connections to concatenate the output of the previous layer with the input features of the current layer along the channel dimension, promoting feature reuse and gradient flow. Each convolutional operation is followed by batch normalization and ReLU activation, forming the basic sequence "Conv-BN-ReLU".
[0046] The specifications of each module in the encoder are as follows: Block1 uses a 1×1 convolution kernel with a stride of 1 and 32 output channels. The input image size is H×W×3, and the output feature map F1 size is H×W×32. Block2 uses a 3×3 convolution kernel with a stride of 1 and 64 output channels. The input feature map F1 and the output feature map F2 have dimensions of H×W×64. Block3 uses a 3×3 convolution kernel with a stride of 2 and 128 output channels. The input feature map F2 and the output feature map F3 have dimensions of (H / 2)×(W / 2)×128. Block4 uses a 3×3 convolution kernel with a stride of 2 and 256 output channels. The input feature map F3 and the output feature map F4 have dimensions of (H / 4)×(W / 4)×256. Block5 uses a 3×3 convolution kernel with a stride of 1 and an output channel size of 512. The input feature map is F4, and the output feature map F5 has a size of (H / 4)×(W / 4)×512.
[0047] The fusion operation F is defined as a channel-dimensional concatenation. It concatenates the four feature maps F2, F3, F4, and F5 output from Block 2 to Block 5 along the channel dimension to generate a fused multi-scale feature map. The formula is expressed as follows: ; Among them, Concat( () indicates a connection operation along the channel axis. Feature map after fusion. The number of channels is the sum of the number of channels in each input feature map, i.e., 64 + 128 + 256 + 512 = 960. Its spatial dimensions are compared to the input image, with the height and width each downsampled to 1 / 4, resulting in a final size of (H / 4) × (W / 4) × 960.
[0048] The network parameters are set during model initialization and optimized through backpropagation during training, aiming to efficiently aggregate multi-scale contextual information while balancing computational complexity and detail preservation.
[0049] The construction process of the multi-scale feature fusion module is as follows: The encoder's output features are input into the DASPP module, which captures multi-scale contextual information through dilated convolutions with different dilation rates and standard convolutions. To adapt to the feature size of the chebulic acid band image in this application (typically 50-100 pixels wide), the dilation rate of the dilated convolutions is specifically set to expand the receptive field while avoiding overly sparse feature extraction. The output of the DASPP module is composed of feature maps from multiple parallel branches concatenated along the channel dimension, and its construction formula is modified as follows: ; in, It is the feature map input to the DASPP module, i.e., the output of the encoder; This represents a splicing operation along the channel dimension (C). The input is 5 feature maps, and the number of channels in the output y′ is the sum of the number of its channels. This is a standard convolution, where k is the kernel size. For dilated convolution, the kernel size is 3×3, and the dilation rate d is optimized to 2, 4, or 6 based on the color band size; parameters such as the number of filters are reduced from 256 to 96 through grid search optimization. AvP Indicates global average pooling, Up This indicates bilinear interpolation upsampling, restoring the spatial dimensions to a value similar to... same.
[0050] The optimization criteria for the number of filters are as follows: The performance of different filter counts on the validation set was compared using grid search to achieve a balance between model accuracy and efficiency. The optimized core configuration is: the number of output channels for each parallel convolutional branch (including dilated convolutions) is uniformly set to 32. This configuration was selected based on the following comparative data: Specifically, when the number of filters per branch is set to 64, the model's mean intersection-over-union (mIoU) on the validation set is 78.9%, but the number of parameters reaches 5.2M, the computational cost is 12.8 GFLOPs, and the inference time is 45 milliseconds. When the number of filters is reduced to 32, the model performance (mIoU) is 78.2%, only slightly lower than the 64 configuration by 0.7 percentage points, but the number of parameters is significantly reduced to 2.8M, the computational cost is reduced to 7.1 GFLOPs, and the inference time is greatly shortened to 28 milliseconds. When the number of filters is further reduced to 16, the model performance drops to 76.5%, although the number of parameters and computational cost are lower, the accuracy loss is significant. Therefore, choosing the configuration with 32 filters significantly improves model efficiency while maintaining high segmentation accuracy, better meeting the real-time requirements.
[0051] This module captures multi-scale contextual information through a multi-branch structure and outputs an enhanced feature map y′ as the input to the decoder, thereby effectively expanding the receptive field without losing resolution.
[0052] The decoder construction process is as follows: The decoder achieves effective fusion of low-level detail features and high-level semantic features through a multi-path feature fusion module (MFFM). The specific construction process of MFFM is as follows: First, the high-level semantic feature maps from the deep layers of the decoder... Upsample the data (size H / 4 × W / 4, number of channels 480) to match the low-level detail feature maps from the shallow layers of the encoder. (Dimensions are H / 2 × W / 2, number of channels is 64) Aligned in spatial dimensions. Upsampling operation (Up( It is implemented using transposed convolution with a stride of 2, a kernel size of 3×3, and 64 output channels.
[0053] Subsequently, a spatial attention mechanism is used to generate an attention weight map α. Specifically, the upsampled high-level features Up( ) and low-level features The features are concatenated along the channel dimension, then compressed into a single-channel feature map using a 1×1 convolutional layer. Finally, the map is normalized using the Sigmoid function to obtain the attention weight map α. Its formula is defined as follows: ; Where the size of α is... The same value is H / 2×W / 2, and the value of each pixel is between 0 and 1. The higher the value, the more the spatial location depends on high-level semantic features.
[0054] Finally, the feature maps are fused. The formula is obtained by adding the weighted high-level features to the low-level features, and is modified as follows: ; in, It is the final feature map after fusion; It is a high-level semantic feature map from deep within the decoder; It is a low-level detail feature map from the shallow layer of the encoder; This is an attention weight map. In this formula, and All dimensions are H / 2 × W / 2, and all have 64 channels. The attention weight map α (single channel) is expanded to 64 channels via a broadcast mechanism before computation. Output features The dimensions are H / 2×W / 2, and the number of channels is 64. Upsampling using transposed convolution is employed, which learns feature representations better than bilinear interpolation, and has been verified to improve edge segmentation accuracy by approximately 5%.
[0055] The segmentation head at the end of the decoder contains a "Conv-BN-ReLU" layer and a Softmax classifier, which reduces the number of feature channels to 2 (corresponding to the background and chebulic acid bands respectively), and restores the feature map to the original size of the input image through a final upsampling operation, generating a pixel-level segmentation prediction map.
[0056] The model training employs a combined loss function of binary cross-entropy (BCE) loss and Dice loss to balance class imbalance (e.g., low proportion of color band pixels) and improve the overlap between the predicted and ground truth regions. Combined loss function as follows: ; ; ; in, It is the binary cross-entropy loss, used to measure pixel-level classification error; N is the total number of pixels in a batch; It is the true label of the i-th pixel, with a value of 0 (background) or 1 (chebulic acid band). It is the probability predicted by the model that the i-th pixel belongs to the chebulic acid band category; It is the Dice loss, which is used to directly optimize the overlap between the predicted region and the real region.
[0057] The optimizer uses stochastic gradient descent (SGD) with an initial learning rate of 0.005, momentum of 0.9, and weight decay factor of 5. The batch size is set to 8, and the learning rate scheduling strategy is to halve every 50 training epochs, with a total training period of 100 epochs. The dataset used for training must contain precisely labeled resin column window images and be divided into training and validation sets in an 8:2 ratio.
[0058] Experimental results show that the BCE+Dice combined loss effectively addresses the class imbalance problem compared to using BCE loss alone, increasing the recall rate of the color band region from 78% to 92%. Simultaneously, it significantly improves edge segmentation accuracy, reducing the average offset error of edge pixels from 3 pixels to 1 pixel. This optimization meets the stringent segmentation accuracy requirements for subsequent high-purity chebulic acid region screening.
[0059] The model application process is as follows: The result obtained in step S1 is based on the quadruple. The cropped image of the effective chromatography region of the resin column is input into the aforementioned lightweight semantic segmentation model for forward propagation. The final output is the segmentation result of the chebulic acid band region, i.e., the binary segmentation image of the chebulic acid band region. In this model, a pixel value of 1 represents the target region, and 0 represents the background. For ease of reference in subsequent steps, this step defines the output parameter as a binary segmentation image of the chebulic acid band region. This parameter represents the segmentation result matrix, with the same dimensions as the input image. For example, if the input image size is H×W, then the binary segmentation image of the chebulic acid band region... It is a two-dimensional array of size H×W, with elements having values of 0 or 1. This parameter will be used as input to step S3 for further analysis or processing, ensuring a seamless workflow.
[0060] The core function of this step is to construct an efficient and lightweight semantic segmentation model. Based on a deep learning algorithm, the effective tomographic region of the resin column output from step S1 is processed. Pixel-level segmentation is achieved through an encoder-decoder structure. The encoder utilizes a Short-Term Dense Connection Network (STDC) to extract multi-scale features, while the decoder combines a Multi-Scale Feature Fusion Module (DASPP) and an attention mechanism (MFFM) to enhance boundary details and global contextual information. Finally, a binary segmentation map of the Terminalia chebula acid band region is output and defined as a key parameter. This step not only ensures the accuracy and lightweight nature of the segmentation results, but also provides direct input data for the subsequent step S3, enabling subsequent analysis to be based on accurate segmentation results, thereby improving the coherence and efficiency of the entire workflow.
[0061] Step S3: Calculate the initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration during the purification process of chebulic acid extract based on the binary segmentation map of the chebulic acid color band region, and then calculate the final chebulic acid enrichment probability.
[0062] This step is based on the output parameters of step S2, namely the binary segmentation image of the chebulic acid band region. In this model, regions with a pixel value of 1 represent the target color band. Three key indicators are calculated: initial chebulic acid enrichment probability H, texture uniformity T, and color distribution concentration C. Finally, a comprehensive indicator, i.e., the final chebulic acid enrichment probability, is calculated based on the initial chebulic acid enrichment probability H, texture uniformity T, and color distribution concentration C. These indicators quantify enrichment status and purity characteristics using mathematical formulas.
[0063] The initial chebulic acid enrichment probability H is used to quantify the basic likelihood that the band is a chebulic acid enrichment region. Its calculation integrates information on area, location, and purification stage. The initial chebulic acid enrichment probability H is calculated as follows: ; ; ; ; in, is the initial chebulic acid enrichment probability, which comprehensively assesses the enrichment potential and elution stage of the band from a macroscopic perspective. Its value is limited to the range [0,1], taking 1 if the calculated result is greater than 1 and 0 if it is less than 0; S is the area of the chebulic acid band region, calculated statistically... The total number of regions with a pixel value of 1 is obtained; It is the normalized color band area, representing the percentage of the color band area to the total area of the resin column; is the total number of pixels in the effective area of the resin column; P is the positional feature value associated with the elution progress, redefined as the relative vertical position of the band within the effective area of the resin column. The centroid ordinate of the color band region is given by the binary segmentation map. Calculated; and These are the effective regions of the resin column. The upper and lower ordinates of the band, P∈[0,1], directly reflect the elution stage: 0 (initial adsorption, upper edge of the band), 0.4~0.7 (elution peak, middle of the band), 1 (end of elution, lower edge of the band). and These are the weighting coefficients, corresponding to the location feature P and the area feature, respectively. Contribution + =1, and its specific value is determined by regression optimization of historical batches of HPLC measured purity data to ensure that the correlation coefficient between the calculated H value and the measured purity value is not less than 0.8, thereby highlighting the priority of purity calculation; This is a stage correction coefficient used to dynamically adjust the sensitivity of the H value according to different stages of the purification process. The determination of this coefficient is independent of the H value calculation in step S3, and is based on the stage determined by the positional characteristic P of the color band: when P < 0.3, it indicates the initial stage of adsorption. =0.8; the elution peak is when 0.3≤P≤0.7. =1.2; when P>0.7, it is the end of the elution phase. =0.9. This mapping relationship was derived by analyzing the purification process patterns of historical successful batches.
[0064] Texture uniformity T is used to evaluate the consistency of the internal structure of a color band from a microscopic texture perspective. High-purity chebulic acid color bands should exhibit a fine and uniform texture, while impurities or agglomerates will cause localized increased contrast. Its calculation is based on the gray-level co-occurrence matrix (GLCM), and the texture uniformity T is calculated as follows: First, the calculation range is limited to the segmented Terminalia chebulic acid color band region. Specifically, from the grayscale image... In the middle, based on the binary segmentation map For regions with a pixel value of 1, crop out the corresponding grayscale sub-image of the color band. As a computational region, to exclude background interference; Then, a gray-level co-occurrence matrix is constructed, targeting the gray-level sub-images of the color bands. A GLCM is constructed to quantize the texture. Key parameters are set as follows based on the fine and uniform characteristics of the chebulic acid color band: pixel distance d=2, balancing noise suppression and detail preservation; direction θ={0 90}: Covers both horizontal and vertical main texture directions; grayscale quantization is 256 levels.
[0065] Calculate 0 respectively and 90 Gray-level frequency matrix in direction and Where i,j are grayscale values. The GLCM probability matrix P(i,j) is obtained by averaging and normalizing the frequency matrices in the two directions: ; in, It is the total number of effective grayscale pairs, satisfying .
[0066] Finally, calculate the texture uniformity T: ; ; ; Where T is texture uniformity, which assesses the consistency of the internal structure of the band from a microscopic texture perspective, indirectly reflecting purity; Homogeneity is a homogeneity index, reflecting the uniformity of the texture, with a value closer to 1 indicating greater uniformity; Contrast is a contrast index, reflecting the intensity of local variations in the texture, with a value closer to 0 indicating smaller texture differences; weights of 0.7 and 0.3 emphasize the dominant role of homogeneity, and these weights are determined by optimizing their correlation with HPLC-measured purity on the validation set; the contrast index Contrast is divided by... This is the theoretical maximum value of the Contrast indicator, thus ensuring... ∈[0,1], thus ensuring T∈[0,1]. A higher value indicates a more uniform texture, indirectly predicting better purity.
[0067] If the color band area is too small (e.g., a grayscale sub-image of the color band), If the number of pixels is less than 100, then the statistical reliability of GLCM is insufficient. In this case, the T value is taken as the average texture uniformity of the same historical period (such as the adsorption period, elution peak period, and elution end period), and this result is marked as "low confidence" for subsequent analysis. Color distribution concentration C quantifies the consistency and stability of color bands from a statistical perspective. The high-purity chebulic acid color band exhibits a concentrated main hue with minimal fluctuation. Its calculation is based on preprocessed and corrected RGB image color moments. The color distribution concentration C is calculated as follows: The calculation scope is limited to the original RGB image corresponding to the segmented chebulic acid color band region. Specifically, from the RGB image of the effective region of the resin column obtained in step S1, the binary segmentation map is used... For regions with a pixel value of 1, crop out the corresponding RGB sub-image of the color band. As input for calculation.
[0068] To suppress the impact of industrial lighting fluctuations on color measurement, the RGB sub-image of the color band was modified. Perform rapid white balance correction. Calculate the pixel mean values of the R, G, and B channels of the sub-image before correction. , , And calculate the grayscale reference. Scaling correction is applied to each channel using the following formula: ; ; ; Where R, G, B are the original pixel values, and R′, G′, B′ are the corrected pixel values (truncated to 0~255). Subsequent calculations are based on the corrected RGB sub-image of the color band. .
[0069] Finally, the color distribution concentration C is calculated: ; ; ; ; ; ; ; in, It is the concentration of color distribution, which evaluates the consistency and stability of the color of the color band from the perspective of color statistical characteristics; It is a first-order moment of RGB three channels, using channel-weighted average to adapt to the red / yellow main color characteristics of Terminalia chebula acid, highlighting the contribution of the red channel; It is the average of the second moments of the three RGB channels. The standard deviation of each channel is calculated to measure the dispersion of color values. It is the average of the third moments of the RGB three channels, used to calculate the skewness of each channel and measure the shape symmetry of the color distribution; all moment values are normalized to the range of 0-1 before being substituted into the formula: Divide by 255; Divide by ; Take the absolute value and divide by ; and These are samples from historically successful high-purity batches. Average value of the second moment of the three channels and Average value of the second moment of the three channels The 95th percentile is used, and this dynamic denominator strategy ensures that C∈[0,1], avoiding negative values or out-of-range results due to improper fixed denominator settings, and enhancing the model's adaptability to different batches of raw materials. The quantile benchmark is updated monthly based on newly added successful batch data; a higher C value indicates a more concentrated color distribution, a more prominent dominant hue, and better stability, indirectly predicting better purity. This indicator works in conjunction with texture uniformity T to comprehensively evaluate the quality of the ribbon from two visual dimensions: color and texture, providing multi-dimensional data support for real-time optimization and decision-making in the purification process.
[0070] Finally, the final enrichment probability of chebulic acid was calculated. This parameter is obtained by weighted fusion of the initial chebulic acid enrichment probability H, texture uniformity T, and color distribution concentration C. Before fusion, it is necessary to ensure that the magnitudes of each feature are uniform. The H value has been truncated using a formula to ensure that it is in the [0,1] interval, and T and C are also constrained to the [0,1] interval using their calculation formulas. Therefore, these three features have been normalized and do not require additional processing. Basic weights , , The determination adopts a fusion strategy of "feature importance + confidence", and the specific process is as follows: First, a random forest model was trained based on 1000 historical sets of "H,T,C-HPLC measured purity" data to obtain the importance scores of each feature. , , Normalizing this importance score yields the following basic weights: ; ; ; Secondly, to address the uncertainties in real-time computing, dynamic feature confidence is introduced. H is calculated based on area and location, with a constant confidence level. =1; T is when the number of pixels in the color band is ≥100 =1, otherwise set to 0.3 due to insufficient statistical reliability; C is set when the illumination is stable. =1, if a large fluctuation in illumination is detected, it will be set to 0.5.
[0071] Ultimately, the enrichment probability of chebulic acid was determined. The weights are determined by both the base weights and the confidence level of the dynamic features, and the calculation formula is as follows: ; Where H is the initial probability of chebulic acid enrichment; T is the texture uniformity; and C is the color distribution concentration. , , These are the basic weights; , and This is the dynamic feature confidence level. The denominator of this formula is a weighted sum, which avoids low-confidence features excessively influencing the results. The final enrichment probability of chebulic acid. The value range is [0,1], which intuitively represents the probability that the current region contains high-purity chebulic acid. The verification standard requires the final chebulic acid enrichment probability. The absolute error between the measured purity and the actual purity by HPLC is ≤4%, and the random forest model and weights are calibrated monthly using 10 new sets of measured data to maintain the long-term stability of the predictions. The final enrichment probability of chebulic acid is... As the core quantitative output, it provides direct input for subsequent cluster analysis and time series prediction. The higher the value, the better the consistency between enrichment potential and purity.
[0072] The core function of this step is to comprehensively quantify the enrichment degree and purity consistency of the chebulic acid extract during purification by calculating three key indicators: initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration, based on the chebulic acid color band region output from step S2. Specifically, the enrichment probability assesses the basic enrichment potential by combining area and positional features; texture uniformity extracts microscopic texture features from the gray-level co-occurrence matrix to identify the influence of impurities; and color distribution concentration analyzes the stability of the dominant hue based on color moments. Finally, the final chebulic acid enrichment probability is calculated based on these three indicators and their confidence levels. This parameter provides a data foundation for optimizing subsequent purification processes, ensuring efficient workflow integration and reliable results.
[0073] Step S4: Collect historical data on the purification process of chebulic acid extract, use a clustering algorithm to perform staged clustering on the historical data, calculate the stage threshold, compare the final chebulic acid enrichment probability with the stage threshold, and screen out high-purity chebulic acid regions.
[0074] This step aims to achieve precise screening of high-purity regions during the chebulic acid purification process by integrating multi-dimensional features and a dynamic threshold strategy. First, an "offline modeling, online application" strategy is adopted, using historical data clustering to determine the stage division criteria for the purification process, and applying these criteria for stage determination during real-time monitoring. Then, time series analysis technology is introduced to dynamically adjust the threshold based on trend characteristics. Finally, the final chebulic acid enrichment probability is compared. The high-purity region is determined by combining the corrected threshold with historical data clustering and time series analysis. This method enhances the threshold adaptability and improves the screening accuracy. The specific process is as follows: To objectively divide the purification stages, a stage division model needs to be built offline based on historical data. The specific process is as follows: The first step is data collection, which involves gathering historical data from multiple complete and successful purification processes. Each process includes a series of time points and their corresponding... value.
[0075] Then, a phased cluster analysis was performed to analyze all historical batches. The values are aggregated into a dataset, and the K-means clustering algorithm is applied to divide it into K clusters (e.g., K=3, corresponding to the early, middle and late stages).
[0076] Then, staged clustering is performed, with the stage division achieved by minimizing the objective function J of the intra-cluster squared error: ; Where J is the clustering optimization objective function, which measures the compactness of the current grouping. The smaller the value, the better the grouping effect. This represents the k-th cluster (stage), obtained through iterative partitioning using the K-means algorithm, containing a set of similar clusters. value; It is a cluster The centroid is calculated iteratively within the cluster using an algorithm. The mean of the values, i.e. K represents the number of clusters, preset based on the number of stages in the purification process. After clustering, each time point is assigned a stage label. ∈{1,2,...,K}.
[0077] For each stage k obtained from clustering, its baseline threshold is calculated. Specifically, Defined as all within this stage The 95th percentile of the value, that is: ; in, It is the threshold of stage k, which is the minimum value required to classify the region as high-purity chebulic acid within stage k. standard; It belongs to a cluster All the final enrichment probability values are derived from the clustering results, i.e., obtained by minimizing J. This grouping result; It is a quantile function, i.e., a function for calculating clusters. middle The 95th percentile value. This definition is based on historical successful batches. When the value exceeds this threshold, the probability of the corresponding HPLC-measured purity being ≥95% exceeds 90%. Therefore, this threshold is an "entry threshold" for high purity, rather than an "abnormal alarm line." The 95th percentile is chosen instead of lower limits such as the 5th percentile because lower limits cannot effectively distinguish between low-purity regions and impurity interference, while the 95th percentile can more stably identify high-purity potential regions.
[0078] Then, online applications are implemented. During real-time monitoring, the offline-established model is used for rapid stage determination and threshold correction. To adapt to the dynamic changes in the purification process, time series analysis is introduced to correct the stage thresholds in real time. The correction process is as follows: First, a real-time phase determination is performed. For the current time point t, the calculated... By calculating its centroid at each stage obtained offline, The Euclidean distance is used to divide it into the closest stages. : ; Therefore, call the immediately The phased threshold corresponding to the phase .
[0079] Trend features were then extracted using a sliding window (window size w=10). Short-term trend characteristics of the sequence Capture the slope of local changes. At time point t, the trend characteristics... Defined as: ; in, It is a trend feature, representing the slope of local changes; and They are time points t and t, respectively. The final enrichment probability value of w comes from Time series; and This is the corresponding timestamp; w is the sliding window size, set to 10 based on the length of historical anomalies. Trend value. >0 indicates an upward trend. <0 indicates a downward trend.
[0080] Then, the baseline threshold is determined based on trend characteristics. Adjust to phased threshold For the current time point t and its corresponding stage k, the corrected stage threshold is... The calculation is as follows: ; in, This is the corrected, phased threshold; η is the correction coefficient, η=0.1, optimized through the validation set to control the strength of the trend's influence. This formula appropriately increases the threshold during an upward trend (reducing false alarms) and decreases it during a downward trend (reducing false negatives), enhancing the threshold's adaptability to process dynamics.
[0081] Finally, the corrected staged thresholds are obtained. Finally, a final determination is made based on purity characteristics.
[0082] when ≥ When the region is identified as a high-purity chebulic acid region, this dual screening mechanism considers both the absolute value of the enrichment probability and the relative weight of the purity characteristics, significantly improving the accuracy of the screening.
[0083] The core function of this step lies in its innovative use of offline clustering modeling and online real-time judgment, combined with time series trend correction, to achieve precise screening of high-purity chebulic acid regions. This process not only integrates multi-dimensional feature information but also improves the accuracy and robustness of region segmentation through data-driven stage division and real-time feedback mechanisms. This provides crucial input data for subsequent purity calculations and early warnings, ensuring efficient workflow integration and reliable results even in complex environments.
[0084] Step S5: Obtain the purity and purification rate of chebulic acid based on the high-purity chebulic acid region, and issue an early warning when the purity is lower than a preset purity threshold or the purification rate is not within the preset purification rate threshold range.
[0085] This step aims to utilize the high-purity chebulic acid region obtained from step S4 and the final chebulic acid enrichment probability output from step S3. The system calculates purity and purification rate, and sets dynamic thresholds to implement an early warning mechanism. When the purification rate or purity fluctuates beyond the threshold, an early warning is triggered to ensure the stability of the purification process and product quality.
[0086] The purity calculation is directly based on the high-purity chebulic acid region determined in step S4. This region already meets the requirements at the time of determination. ≥ That is, it already possesses a relatively high regional level that characterizes the overall enrichment level. Value. This region consists of a set of pixels, but ultimately the probability of chebulic acid enrichment is [value]. It is its overall attribute.
[0087] Purity of chebulic acid It can be directly from this area Value representation. To enhance robustness, the region's value across multiple adjacent frames (time dimension) can be used. The average value is used as the final purity value to smooth out instantaneous fluctuations. The calculation formula is as follows: ; in, This indicates the purity of chebulic acid at the current time t; This is the region-level enrichment probability value used in step S4 when determining the output high-purity region at time τ; T is the size of the temporal smoothing window (e.g., T=5 frames), which is used to suppress random errors caused by noise in a single frame of image without involving pixel-level calculations. Purity value The value range is [0,1], and the higher the value, the higher the purity of chebulic acid.
[0088] Purification speed The monitoring aims to track the dynamic migration of the ribbon in real time, providing key timing indicators for judging the process status. To avoid the susceptibility of a single indicator to interference from ribbon deformation, this method adopts a comprehensive monitoring strategy combining instantaneous displacement rate and area change rate. Among them, the instantaneous displacement rate serves as the primary monitoring indicator, directly characterizing the migration speed of the ribbon towards the discharge port; the area change rate serves as an auxiliary monitoring indicator, used to monitor the dynamic changes in the ribbon enrichment amount.
[0089] Leading displacement rate The calculation is based on the change in the ordinate of the lower boundary of the color band. First, locate the ordinate of the leading edge of the color band: ; This coordinate represents the vertical coordinate of the bottom pixel of the color band.
[0090] Then the instantaneous displacement rate at time t is calculated. : ; in, It is the leading-edge displacement rate at time t; It is the leading edge displacement rate at time t-1.
[0091] To suppress boundary jumps caused by image noise, the instantaneous rate is smoothed using a 3-frame sliding window: ; This is the smoothed instantaneous displacement rate. When the deviation between the instantaneous rate and the smoothed value exceeds ±50%, the smoothed value replacement mechanism is automatically activated to effectively avoid false alarms.
[0092] Area change rate Calculations are made by statistically analyzing changes in the total number of pixels in the color band: ; in, It is the area at time t; This is the area at time t-1. This indicator reflects the relative rate of change in the enrichment of the color band and should remain stable during normal elution.
[0093] Purification speed The formula for calculating at time point t is: ; in, , Instantaneous displacement rate The mean and standard deviation of historical normal data; , Area change rate The mean and standard deviation of historical normal data; weights of 0.7 and 0.3 reflect... Its dominance.
[0094] Threshold settings are based on historical normal production data and employ statistical process control methods to ensure adaptability to changes in different batches and environments. Thresholds are divided into purity thresholds and speed thresholds, used to detect abnormal fluctuations in purity and speed, respectively.
[0095] Purity threshold The formula is derived from the distribution of historical purity values: ; in, It is the average purity of chebulic acid in normal batches throughout history, calculated by collecting data from multiple production cycles; is the standard deviation of historical chebulic acid purity, reflecting the normal fluctuation range; k is the control coefficient, taken as 3, corresponding to a 99.7% confidence interval, which is adjusted according to the actual risk tolerance, for example, taking a smaller value in high-risk scenarios to improve sensitivity.
[0096] Speed thresholds include lower limits and upper limit This is used to detect abnormal speeds, such as being too fast or too slow. The formula is: ; ; in, and These are the upper and lower limits of the purification rate threshold range, respectively; Purification speed in historical normal batches The average value; This represents the standard deviation of historical purification rates; k is a control coefficient, with a value consistent with the purity threshold. The threshold is automatically updated every 24 hours, using a sliding window mechanism—data from the most recent 30 days—to adapt to slow changes in the production environment.
[0097] The early warning mechanism is based on real-time calculated values of purity and purification rate, and uses OR logic to trigger warnings; that is, an early warning signal is generated whenever either indicator is abnormal. Warnings are divided into two levels to distinguish severity, with the following preset rules: The triggering rule for a primary warning: when the purity is too low ( < ) or abnormal speed ( < or > When an abnormal time point is triggered, a primary warning is generated, recording the abnormal time point, deviation value, and related area information, and generating a visual report, i.e., a trend chart; Advanced alert triggering rules: When multiple indicators are abnormal simultaneously, or when the abnormality persists for a certain period of time, such as exceeding [a certain threshold]... =30 seconds, indicating a serious problem, such as equipment failure or raw material deterioration, and recommending that the operator intervene immediately.
[0098] The early warning response includes logging, visualization, and manual inspection. Each sampling point is monitored in real time, and the output of step S4 is used for parallel computation to ensure high efficiency. Simultaneously, early warning history is searchable for subsequent analysis and process optimization, forming a closed-loop control system.
[0099] This step integrates purity calculation, speed calculation, and dynamic threshold setting to construct a comprehensive early warning method capable of real-time monitoring of the chebulic acid purification process. This method closely relies on the output of step S4, ensuring data consistency, and adaptively adjusts using historical data, improving robustness and accuracy. Dual monitoring of purification and speed covers various anomaly modes, such as decreased purity, excessively fast or slow speed, ensuring stable product quality. The entire mechanism has a rich structure, including calculation, threshold setting, and early warning execution.
[0100] This solution presents an image processing-based method for monitoring the purification process of chebulic acid extract. It employs a five-step core process to achieve precise monitoring and anomaly warning: First, the resin column window image is preprocessed using edge detection, Gaussian filtering, the Canny algorithm, and Hough transform to accurately extract the effective tomographic region. Next, a lightweight semantic segmentation model based on the AMCNet framework is constructed to accurately segment the chebulic acid banding region, balancing lightweight industrial deployment with small target recognition capabilities. Then, based on the segmentation results, three core features—initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration—are calculated and weighted to obtain the final enrichment probability. Next, K-means clustering is used to model historical data in stages, and thresholds are dynamically adjusted based on real-time features to screen high-purity chebulic acid regions. Time series analysis is also introduced to capture feature trends and correct the thresholds. Finally, based on the high-purity regions, the purity and purification speed of chebulic acid are calculated. Dynamic thresholds are set using historical data statistics to achieve graded warnings for excessively low purity or abnormal purification speeds. This method effectively solves the problems of poor adaptability and insufficient monitoring accuracy of traditional fixed threshold segmentation. Through deep learning and data-driven threshold strategy, it significantly improves the accuracy of color band segmentation, the targeting of high purity area identification, and the timeliness of anomaly warning. It is adapted to the needs of industrial real-time monitoring and edge deployment, and provides a reliable guarantee for the quality stability of the chebulic acid purification process.
[0101] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the statement "including a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0102] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their likenesses.
Claims
1. A method for monitoring the purification process of Terminalia chebula acid extract based on image processing, characterized in that, Includes the following steps: Step S1: Obtain the grayscale image of the resin column during the purification process of chebulic acid extract, and preprocess the grayscale image based on the edge detection algorithm to obtain the effective chromatography region image of the resin column. Step S2: Construct a lightweight semantic segmentation model based on deep learning algorithm, input the effective tomographic region image of the resin column into the lightweight semantic segmentation model, and output a binary segmentation map of the chebulic acid band region. Step S3: Calculate the initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration during the purification process of chebulic acid extract based on the binary segmentation map of the chebulic acid color band region, and then calculate the final chebulic acid enrichment probability. Step S4: Collect historical data of the purification process of chebulic acid extract, use a clustering algorithm to perform staged clustering of the historical data, calculate the stage threshold, compare the final chebulic acid enrichment probability with the stage threshold, and screen out high-purity chebulic acid regions. Step S5: Based on the high-purity chebulic acid region, obtain the purity and purification rate of chebulic acid, and issue an early warning when the purity is lower than a preset purity threshold or the purification rate is not within a preset purification rate threshold range.
2. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 1, characterized in that, Obtain grayscale images of the resin column during the purification process of chebulic acid extract, including: First, the resin column window image, i.e., the RGB image, is acquired and then Gaussian filtering is performed to remove noise. Subsequently, to enhance the characteristics of the chebulic acid band and improve its contrast with the background, an adaptive weighted method based on the color features of the band was used for grayscale conversion. The grayscale conversion formula is as follows: ; Where R, G, and B represent the pixel intensities of the red, green, and blue channels of a pixel in the input RGB image, respectively. Adaptive weighting coefficients were used to obtain the grayscale image of the resin column. This will serve as the basis for subsequent processing.
3. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 2, characterized in that, The resin column window image is preprocessed based on an edge detection algorithm to obtain an image of the effective tomographic region of the resin column, including: The edge detection stage uses the Canny algorithm for contour extraction and the Sobel operator to calculate the gradient magnitude. Then, non-maximum suppression and double-threshold hysteresis are performed to output a continuous single-pixel wide edge map. In the geometric modeling stage, the effective region is accurately located using the Hough transform; for cylindrical resin columns, a circular Hough transform is used. The optimal center coordinates (a, b) and radius r are determined through a parameter space accumulator voting mechanism. The geometric features are then encapsulated into a four-tuple structure. ; Ultimately based on the quadruple The image of the effective chromatography region of the resin column is cropped out.
4. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 3, characterized in that, A lightweight semantic segmentation model based on deep learning algorithms is constructed, including: The lightweight semantic segmentation model is based on the AMCNet framework and adopts an encoder-decoder structure. The encoder uses a short-term dense connection network as the backbone network; the decoder enhances feature representation through a multi-scale feature fusion module and a multi-path feature attention fusion module. The model training uses a combination of binary cross-entropy loss and Dice loss. Combination loss function as follows: ; in, It is binary cross-entropy loss; It is a Dice loss.
5. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 4, characterized in that, The effective chromatography region image of the resin column is input into a lightweight semantic segmentation model, which outputs a binary segmentation map of the chebulic acid band region, including: The result obtained in step S1 is based on the quadruple. The cropped image of the effective chromatography region of the resin column is input into a lightweight semantic segmentation model for forward propagation. The final output is the segmentation result of the chebulic acid band region, i.e., the binary segmentation map of the chebulic acid band region. , where a pixel value of 1 represents the target area and 0 represents the background.
6. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 5, characterized in that, Based on the binary segmentation map of the chebulic acid color band region, the initial chebulic acid enrichment probability, texture uniformity, and color distribution concentration during the purification process of the chebulic acid extract were calculated, including: The initial chebulic acid enrichment probability H is calculated as follows: ; in, It is the initial probability of chebulic acid enrichment; is the normalized band area; P is the positional characteristic value associated with the elution progress. and These are the weighting coefficients; It is a stage correction factor; The texture uniformity T is calculated as follows: First, the calculation range is limited to the segmented Terminalia chebulic acid color band region; then, a gray-level co-occurrence matrix is constructed; finally, the texture uniformity T is calculated. ; Where T is texture uniformity; Homogeneity is the homogeneity index; Contrast is the contrast index; weights of 0.7 and 0.3 emphasize the dominant role of homogeneity. The color distribution concentration C is calculated as follows: The calculation scope is limited to the cropped RGB sub-image of the color band. ; for the RGB sub-image of the color band Perform rapid white balance correction; finally, calculate the color distribution concentration C: ; in, It refers to the concentration of color distribution; It is the first-order moment of RGB three channels; It is the average of the second moments of the three RGB channels; It is the average of the third moments of the three RGB channels; and These are the average values of the second moments of the RGB three channels in historical high-purity successful batch samples. The average value of the second moment of the three RGB channels | The 95th percentile of |.
7. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 6, characterized in that, The final formula for calculating the enrichment probability of chebulic acid is: ; Where H is the initial probability of chebulic acid enrichment; T is the texture uniformity; and C is the color distribution concentration. , , These are the basic weights; , and It is the confidence level of dynamic features.
8. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 7, characterized in that, Historical data on the purification process of Terminalia chebula acid extract were collected, and a clustering algorithm was used to perform staged clustering on the historical data to calculate the stage thresholds, including: The first step is data collection, which involves collecting historical data from multiple purification processes. Each process includes a series of time points and their corresponding... value; Then, a phased cluster analysis was performed to analyze all historical batches. The values are aggregated into a dataset, which is then divided into K clusters using the K-means clustering algorithm. The stage division is then achieved by minimizing the objective function J of the within-cluster squared error. After clustering, each time point is assigned a stage label. ∈{1,2,...,K}; For each stage k obtained from clustering, its baseline threshold is calculated. ; Baseline threshold based on trend characteristics Adjust to phased threshold For the current time point t and its corresponding stage k, the corrected stage threshold is... The calculation is as follows: ; in, It is the corrected staged threshold; η is the correction coefficient.
9. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 8, characterized in that, The final chebulic acid enrichment probability and the staged threshold are compared to screen out high-purity chebulic acid regions, including: Obtain the corrected staged threshold Then, a final determination is made based on purity characteristics, and the final enrichment probability of chebulic acid is determined. ≥ Phased threshold At that time, the area was determined to be a high-purity chebulic acid region.
10. The method for monitoring the purification process of Terminalia chebula acid extract based on image processing according to claim 9, characterized in that, Step S5 includes: Purity of chebulic acid Using this region in multiple adjacent frames The average value is calculated using the following formula: ; in, This indicates the purity of chebulic acid at the current time t; It is the region-level enrichment probability value used to determine the output high-purity region at time τ; T is the size of the time smoothing window. Purification speed A comprehensive monitoring strategy combining instantaneous displacement rate and area change rate is adopted; firstly, the instantaneous displacement rate at time t is calculated. Then, the area change rate is calculated by statistically analyzing the change in the total number of pixels in the color band. Ultimately, the purification speed The formula for calculating at time point t is: ; in, , Instantaneous displacement rate The mean and standard deviation of historical normal data; , Area change rate The mean and standard deviation of historical normal data; weights of 0.7 and 0.3 reflect... Dominance; The threshold settings are based on historical normal production data and are divided into purity threshold and speed threshold, which are used to detect abnormal fluctuations in purity and speed, respectively. The early warning mechanism makes judgments based on real-time calculated values of purity and purification rate, and uses OR logic to trigger the early warning. When the purity is lower than the preset purity threshold or the purification rate is not within the preset purification rate threshold range, that is, as long as either indicator is abnormal, an early warning signal is generated.