Intelligent quality inspection system for medicine hollow capsule
By integrating multi-dimensional optical feature acquisition, dynamic thermodynamic response analysis, and near-infrared spectral composition inversion modules, the problem of identifying destructive losses and cross-domain correlation defects in the detection of pharmaceutical empty capsules has been solved. This has enabled full-batch integrity verification and dynamic adaptive detection, improving detection efficiency and accuracy.
Patent Information
- Application Number
- CN202511403333.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2045-09-29
AI Technical Summary
Existing pharmaceutical empty capsule testing technologies suffer from destructive sample loss, difficulty in capturing cross-domain correlations due to separation of detection dimensions, and insufficient dynamic adaptability, resulting in the inability to achieve full batch integrity verification and production line interruptions.
By employing a multi-dimensional optical feature acquisition module, a dynamic thermodynamic response analysis module, and a near-infrared spectral composition inversion module, combined with a multi-source data fusion decision module and an adaptive feedback optimization module, comprehensive detection and defect identification of the capsule surface and internal structure can be achieved through non-contact multispectral imaging, mechanical excitation, and spectral analysis.
It enables non-destructive full-batch testing of pharmaceutical empty capsules, accurately identifying multiple coupled defects such as surface hidden cracks, abnormal local cross-linking degree, and decreased elastic modulus, improving the system's dynamic adaptability and testing efficiency, and avoiding the risk of false alarms and downtime.
Smart Images

Figure CN120891163B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent quality inspection, more particularly, to an intelligent quality inspection system for medicinal hollow capsules. BACKGROUND
[0002] The quality control of medicinal hollow capsules is a core link to ensure drug safety, and the current mainstream detection technology is still dominated by offline and destructive methods. In the specific implementation process, the conventional detection process includes three progressive stages: first, the capsules are batched and transported to the visual detection station by a conveyor belt, and single-angle visible light imaging is used for appearance defect screening; then, about 0.5% of the samples are taken for laboratory analysis, including the use of a dissolution tester to determine the disintegration time, and the Kjeldahl method to detect the gelatin content and other destructive tests; finally, a batch quality report is established based on the sampling data.
[0003] This mode has three systematic defects: first, the destructive chemical test causes permanent loss of samples, making it impossible to verify the integrity of the entire batch of capsules, for example, the cross-linking degree test requires the capsules to be completely dissolved in an acidic solution; second, the discrete detection dimension (separation of physical inspection and chemical analysis) is difficult to capture cross-domain associated defects, such as the coupling effect of surface micro-cracks and internal gelatin molecular chain rupture; third, the fixed threshold determination mechanism lacks dynamic adaptability, and when the capsule raw material batch changes or the environmental temperature and humidity fluctuate, the equipment parameters need to be recalibrated, causing the production line to be interrupted. SUMMARY
[0004] In order to overcome the above-mentioned defects of the prior art, the present application provides an intelligent quality inspection system for medicinal hollow capsules, which solves the problems raised in the background art by the following scheme.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical scheme: an intelligent quality inspection system for medicinal hollow capsules, comprising:
[0006] A multi-dimensional optical feature acquisition module: the optical features of the surface and internal structure of the hollow capsule are acquired by non-contact multi-spectral imaging technology, combined with multi-angle light sources and high-resolution image sensors, to generate a three-dimensional data matrix containing reflectivity, transmissivity, and texture distribution;
[0007] A dynamic thermodynamic response analysis module: based on non-contact mechanical excitation and vibration response analysis, the deformation characteristics of the capsule shell at a specific frequency are quantified to detect abnormal elastic modulus or internal structure defects;
[0008] A near-infrared spectral component inversion module: through short-wave near-infrared diffuse reflectance spectroscopy analysis, the gelatin cross-linking degree of the capsule shell is inverted and abnormal samples are detected;
[0009] Multi-source data fusion decision module: based on D-S evidence theory, optical, mechanical and spectral features are fused, and fuzzy integral and random forest classifier are used to realize defect type grading judgment;
[0010] Adaptive feedback optimization module: through reinforcement learning, detection parameters are dynamically adjusted to optimize the adaptability of the system to batch differences.
[0011] Preferably, the multi-dimensional optical feature acquisition module adopts a non-contact multi-spectral imaging technology, which is composed of a ring-shaped multi-spectral LED array and a high-resolution CMOS sensor.
[0012] Preferably, the ring-shaped multi-spectral LED array is uniformly distributed in a circle with a capsule as the center, and contains three different waveband LED light sources, with a wavelength range of 400-1100 nm, corresponding to visible light, near-infrared and short-wave infrared spectra respectively. Each group of light sources is independently controlled and alternately lit according to a preset time sequence, with incident angle settings of 30 degrees, 60 degrees and 90 degrees. Through multi-angle illumination, shadow interference under a single light source is eliminated and surface texture features are enhanced.
[0013] Preferably, the CMOS image sensor has a resolution of not less than 20MP and a frame rate of 120fps per second. Through a synchronous triggering mechanism, the reflection and transmission images of the capsule are captured within a millisecond time window.
[0014] Preferably, first, the original image data is subjected to noise suppression processing. A threshold filtering method based on multi-layer wavelet decomposition is adopted to dynamically adjust the denoising intensity parameters by analyzing the light scattering characteristics of the capsule material, so as to eliminate abnormal pixel fluctuations caused by environmental stray light or sensor electronic interference.
[0015] Preferably, then, a geometric correction process is performed. A morphological edge detection algorithm is used to extract the capsule outer contour boundary point set, and a least squares method is used to fit an elliptical model to calculate the capsule long axis angle offset. An affine transformation is performed on the original image to compensate for the attitude tilt error caused by the conveyor belt vibration. The image after geometric correction enters the feature enhancement stage. A multi-scale Gaussian difference filter is applied to separate surface texture details and background areas. Local contrast enhancement coefficients are calculated for reflection images of different incident angles, and gray histogram equalization is used on transmission images to improve the visibility of internal structures. Based on the separated surface texture detail images, a box dimension algorithm is used to calculate the fractal dimension value. First, the texture image is binarized. The minimum grid number covering the texture contour at different scales is counted by a multi-resolution grid covering method. The linear regression slope of the grid size logarithm and the grid number logarithm is obtained by least squares fitting. This slope value is the fractal dimension quantifying the texture complexity.
[0016] Preferably, the final integration processing result generates a three-dimensional data matrix, the first dimension stores the reflectivity distribution diagram under the incident angle of 30 degrees, 60 degrees and 90 degrees, the second dimension records the transmission intensity gradient diagram, and the third dimension encodes the direction consistency index, the spatial frequency spectrum and the fractal dimension value of the texture feature.
[0017] Preferably, a piezoelectric ceramic array is selected as the core excitation device, the array is composed of 32 independently controlled piezoelectric ceramic sheets arranged in a ring shape, each ceramic sheet has a diameter of 5 mm and a spacing of 1.5 mm, and is installed 3 cm below the capsule transmission channel; the excitation signal is generated by a digital signal generator to generate a linear sweep sound wave of 0.1-10 kHz, and the sweep frequency period is controlled within 50 milliseconds to match the residence time of the capsule in the detection station, and the frequency step precision is 1 Hz during the sweep process; the excitation strength is dynamically adjusted according to the capsule specifications, and the default setting is that the sound pressure level at the main frequency band of 2 kHz is 75 dB, and the system automatically adjusts within a range of ±10 dB for different specifications of the capsule to keep the vibration displacement in a safe range of 0.5 to 5 microns; the excitation signal synchronously triggers a laser Doppler vibration meter, the spot positioning accuracy of the vibration meter is 0.01 mm, and the vibration velocity signal in the normal direction of the capsule surface is captured at a sampling rate of 200 times per second.
[0018] Preferably, the collected vibration response signal is first converted to the frequency domain by fast Fourier transform, and then energy density quantization processing is performed on a specific frequency band: selecting a target frequency point as the center, expanding to both sides with a fixed bandwidth of 50 Hz to form an analysis interval, and calculating the integral value of the square of the spectrum amplitude in the interval as the energy density characteristic of the frequency band;
[0019] Then a wavelet packet decomposition algorithm is used to implement 6-layer deep decomposition on the original vibration signal to obtain 64 terminal node coefficients; the energy entropy value of each node coefficient is calculated, which is defined as the logarithmic proportion of the node signal energy to the total energy, and finally the top 16 nodes with significant energy entropy value are selected to form a multi-dimensional feature vector representing the integrity of the capsule structure.
[0020] Preferably, a linear array of optical fiber probes with a diameter of 2 mm and a fixed center-to-center distance of 5 mm is used, and the array is installed parallel to the long axis of the hollow capsule; while the capsule passes through the detection station at a constant speed along the conveyor belt, the optical fiber probe array is driven to perform continuous line scanning along the long axis of the capsule at a speed of 10 mm per second, ensuring that each capsule surface is covered by at least 20 scanning points; each optical fiber probe synchronously collects diffuse reflectance spectral signals in the 900-1700 nm waveband, and the spectral resolution of the spectrometer is set to no more than 5 nm, recording raw spectral data at a frequency of once per millisecond, shielding environmental stray light interference during the acquisition process, and automatically performing baseline calibration every 5 minutes through the built-in reference white board; the raw spectral data is transmitted in real time to the data processing unit, and the standard normal variate transformation and first derivative processing are performed by the spectral preprocessing submodule to form a standardized spectral matrix.
[0021] Preferably, for the quantitative analysis of gelatin crosslinking degree, a partial least squares regression algorithm is used to construct a prediction model, first inputting the preprocessed spectral matrix as the independent variable, and inputting the true value of gelatin crosslinking degree measured by the laboratory reference method as the dependent variable; by iteratively calculating latent variables and maximizing the covariance of spectral data and target attributes, a regression coefficient matrix is generated; after the model training is completed, the coefficient matrix is directly applied to calculate the prediction value of gelatin crosslinking degree for new spectral data collected in real time.
[0022] Preferably, for abnormal sample screening, the mean vector and covariance matrix of the spectral data set of historical qualified capsules are calculated; for each newly collected spectral sample, the Mahalanobis distance value between it and the qualified data set is calculated; when the Mahalanobis distance value exceeds a preset threshold, it is determined as an abnormal sample, and the threshold is determined according to the 99% confidence interval of the chi-square distribution of historical data; the coordinate information of all abnormal samples is marked in real time and transmitted to the multi-source data fusion decision module.
[0023] Preferably, first, based on the analysis results output by the multi-dimensional optical feature acquisition module, the dynamic thermodynamic response analysis module, and the near-infrared spectral component inversion module, a basic probability assignment function is established for each module, respectively defined as an optical module confidence function, a mechanical module confidence function, and a spectral module confidence function; these three confidence functions quantify the detection results of each module as the probability support of different subsets in the defect type hypothesis space, where the defect type hypothesis space contains all predefined capsule defect categories.
[0024] Preferably, the fusion process includes:
[0025] S1, for any target defect category in the hypothesis space, traverse all possible subset combinations, only when the subset intersection of the three module determinations is exactly equal to the target defect category, multiply the confidence function values corresponding to the three subsets, and sum all the products that meet the conditions as the numerator item;
[0026] S2, calculate the conflict factor, that is, count the sum of the confidence function value products that lead to the three module subset intersection being empty, which reflects the degree of conclusion conflict between modules;
[0027] S3, divide the numerator item obtained in the first step by the difference between 1 and the conflict factor, and finally output the comprehensive confidence of the fused target defect category.
[0028] Preferably, the multi-source data fusion decision module uses an improved random forest classifier as the core classification tool, the input features include the texture fractal dimension from the multi-dimensional optical feature acquisition module, the 3kHz frequency band energy ratio from the dynamic thermodynamic response analysis module, and the 1530nm absorption peak second derivative value from the near-infrared spectrum component inversion module. The random forest is composed of 500 decision trees, and the Gini index is used as the impurity measure at node splitting for each tree. The splitting process continues until the number of node samples is below the preset threshold or the maximum depth is reached. In the training stage, the bootstrap sampling method is used to extract training subsets for each tree, and a feature subset is randomly selected for splitting to improve the model generalization ability.
[0029] Preferably, the improved random forest classifier outputs a five-level defect label: 0 for qualified, 1 for slight deformation, 2 for local cracks, 3 for composition deviation, and 4 for structure failure. When the maximum prediction probability of a single sample by the random forest is less than 85%, the local coordinate re-inspection mechanism of the near-infrared spectrum component inversion module is triggered. If four-level defect determination occurs for three consecutive samples, send a parameter calibration instruction to the adaptive feedback optimization module to correct the detection sensitivity.
[0030] Preferably, the adaptive feedback optimization module defines a state space and an action space, the state space is composed of three types of real-time data: the first type is the capsule material type, the gelatin crosslinking degree value inverted by the spectrum module is mapped into a discrete code, low crosslinking degree (0-0.3) is coded as 1, medium crosslinking degree (0.3-0.6) is coded as 2, and high crosslinking degree (0.6-1.0) is coded as 3; the second type is the environmental temperature and humidity, the sensor data is directly read and stored as a floating-point number; the third type is the historical false detection rate, the false alarm times percentage of the multi-source data fusion decision module in the last 100 detections is counted; the action space includes three groups of executable operations: the first group adjusts the intensity of the ring-shaped LED array of the multi-dimensional optical feature acquisition module, which is increased or decreased in steps of 5% in the range of 0% to 100%; the second group adjusts the piezoelectric ceramic excitation frequency of the dynamic thermodynamic response analysis module, which is linearly offset by ±10% based on the current set value; the third group adjusts the PLSR modeling window width of the near-infrared spectral component inversion module, which is dynamically stretched and contracted in the range of 80% to 120% of the original window; the action selection mechanism adopts an ε-greedy strategy, with a 90% probability of selecting the action with the highest Q value in the current state and a 10% probability of randomly exploring the action space.
[0031] Preferably, the adaptive feedback optimization module loads a pre-trained Q value table at system initialization, the Q value table contains the initial scores of 200 typical state and action combinations, and the real-time reward is calculated according to the classification result output by the multi-source data fusion decision module after each capsule detection is completed: if the classification result is consistent with the artificial recheck and is a qualified product, the reward is +1; if the defect type is correctly identified, the reward is +2; if false positives or omissions occur, the penalty is -3; when updating the Q value, the time difference method is used to adjust the score of the current state and action pair in the direction of the future three-step maximum predicted reward, the learning rate is fixed at 0.2, and the discount factor is set to 0.9 to balance the current and long-term rewards.
[0032] Technical effects and advantages of the present application:
[0033] The present application completely avoids sample loss caused by traditional destructive analysis by integrating a non-contact detection architecture, the multi-dimensional optical feature acquisition module uses a 400-1100nm multi-spectral band and a three-angle ring-shaped light source array to synchronously acquire the reflectance distribution of the capsule surface and the sub-surface structure transmission spectrum, and combines a wavelet transform denoising algorithm to accurately quantify texture abnormalities, thereby achieving 100% coverage detection of shell defects while maintaining the physical integrity of the capsule.
[0034] The multi-source data fusion decision module constructs a cross-domain feature correlation model through D-S evidence theory, effectively solves the misjudgment problem under a single detection dimension, and precisely identifies multiple coupled defect modes such as "surface invisible crack-local crosslinking degree anomaly-elastic modulus drop" by spatiotemporally aligning and confidence-weighting the texture fractal dimension of the optical module, the vibration energy attenuation slope of a specific frequency band of the mechanical module, and the 1530nm characteristic absorption peak shift of the spectral module.
[0035] The adaptive feedback optimization module establishes an environmental response mechanism based on a reinforcement learning framework, significantly improves the system robustness, dynamically adjusts the LED wavelength combination weight of the optical module, the sweep frequency range of the mechanical excitation, and the window width of the spectral modeling by monitoring the capsule material characteristics and production line environmental parameters in real time, realizes the self-matching of detection parameters and material characteristics, and eliminates the false alarm shutdown risk caused by batch differences. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 It is a schematic diagram of the overall structure of the present application.
[0037] Figure 2 It is a schematic diagram of the multi-dimensional optical feature acquisition module structure of the present application.
[0038] Figure 3 It is a schematic diagram of the dynamic thermodynamic response analysis module structure of the present application.
[0039] Figure 4 It is a schematic diagram of the near-infrared spectral component inversion module structure of the present application. DETAILED DESCRIPTION
[0040] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0041] Reference Figures 1-4 The intelligent quality inspection system for the medicine hollow capsule shown comprises:
[0042] The multi-dimensional optical feature acquisition module acquires the optical features of the surface and internal structure of the hollow capsule through non-contact multi-spectral imaging technology, combines multi-angle light sources and high-resolution image sensors, and generates a three-dimensional data matrix containing reflectivity, transmissivity, and texture distribution.
[0043] The multi-dimensional optical feature acquisition module adopts non-contact multi-spectral imaging technology and is composed of a ring-shaped multi-spectral LED array and a high-resolution CMOS sensor.
[0044] The annular multi-spectral LED array is evenly distributed in a circle around the capsule, containing three different waveband LED light sources, with wavelength range covering 400-1100nm, corresponding to visible light, near-infrared and short-wave infrared spectrum respectively, each group of light source is independently controlled and lit alternately according to preset timing, the incident angle is set to three modes of 30 degrees, 60 degrees and 90 degrees, and the shadow interference under single light source is eliminated and the surface texture features are enhanced through multi-angle irradiation.
[0045] The resolution of the CMOS image sensor is not less than 20MP, and the frame rate is set to 120fps per second, and the reflected light and transmitted light images of the capsule are captured respectively within a millisecond time window through a synchronous triggering mechanism and LED light source linkage.
[0046] The reflected light imaging is used to extract surface defects and texture features, and the transmitted light imaging detects internal bubbles or uneven thickness problems through the light attenuation difference of the internal structure of the capsule shell.
[0047] The original image data obtained by the multi-dimensional optical feature acquisition module is first subjected to noise suppression processing, a threshold filtering method based on multi-layer wavelet decomposition is adopted, the noise suppression intensity parameters are dynamically adjusted by analyzing the light scattering characteristics of the capsule material, and the abnormal pixel fluctuations caused by environmental stray light or sensor electronic interference are eliminated; then a geometric correction process is performed, the morphological edge detection algorithm is used to extract the capsule outer contour boundary point set, the least square method is used to fit the ellipse model to calculate the capsule long axis angle offset, and the original image is subjected to affine transformation to compensate for the attitude tilt error caused by the conveyor belt vibration; the image after geometric correction enters the feature enhancement stage, a multi-scale Gaussian difference filter is applied to separate the surface texture details and background area, the local contrast enhancement coefficient is calculated for the reflected light images of different incident angles, and the internal structure visibility is improved by using histogram equalization for the transmitted light images; based on the separated surface texture detail image, the box dimension algorithm is used to calculate the fractal dimension value, the texture image is first binarized, the minimum grid number covering the texture contour at different scales is counted by the multi-resolution grid covering method, and the linear regression slope of the grid size logarithm and the grid number logarithm is obtained by least square fitting. The slope value is the fractal dimension value quantifying the texture complexity; finally, the processed results are integrated to generate a three-dimensional data matrix, the first dimension stores the reflectivity distribution graph under 30 degrees, 60 degrees and 90 degrees incident angles, the second dimension records the transmitted light intensity gradient graph, and the third dimension encodes the direction consistency index, spatial frequency spectrum and fractal dimension value of the texture features; the matrix is transmitted in real time to the dynamic thermodynamic response analysis module through the Ethernet interface, ensuring that the subsequent modules can locate the sensitive areas based on the spatially registered optical features. The entire preprocessing process is completed on the FPGA hardware acceleration platform, and the single-frame processing delay is controlled within 8 milliseconds.
[0048] The pixel gray value of the original image with coordinates is , and the pixel gray value after denoising is , : two-dimensional discrete wavelet transform operation, which decomposes the image into frequency components of different scales, and the essence is to convert the spatial domain light intensity distribution into the frequency domain energy distribution, separating noise (high frequency) and capsule structure information (low frequency); : adaptive threshold function, acting on wavelet coefficients, is a dynamic threshold parameter, whose value is determined by the light scattering properties of the capsule material: high scattering materials (such as rough gelatin) correspond to a larger , forcing more high-frequency components to be filtered to suppress surface diffuse reflection noise, and low scattering materials (such as smooth coating) correspond to a smaller , retaining high-frequency details to detect micro-cracks, : inverse wavelet transform, reconstructing the frequency domain coefficients after thresholding to the spatial domain image, realizing signal recovery after noise suppression, : wavelet decomposition level, representing different resolution scales: : fine scale, capturing micro-defects, : medium scale, extracting texture features, : coarse scale, retaining the main outline; this formula uses the difference between the narrow-band energy concentration characteristics of defect signals in the frequency domain and the wide-band uniform distribution of noise, combined with the optical properties of the material (such as scattering coefficient and surface smoothness) to realize frequency domain selective filtering, ensuring that subsequent geometric correction can be based on sub-pixel level optical features to perform affine transformation, and the essence is a multi-scale adaptive signal enhancement mechanism driven by the physical model in the optical imaging system.
[0049] Dynamic thermodynamic response analysis module: based on non-contact mechanical excitation and vibration response analysis, quantifying the deformation characteristics of the capsule shell at a specific frequency, detecting elastic modulus abnormalities or internal structure defects.
[0050] The dynamic thermodynamic response analysis module uses non-contact mechanical excitation and vibration response analysis technology to excite micro-vibration of the medicinal hollow capsule by an external excitation source, and collects its dynamic response signal to realize defect detection.
[0051] Specifically, a piezoelectric ceramic array is selected as the core excitation device. This array consists of 32 independently controlled piezoelectric ceramic plates arranged in a ring, each with a diameter of 5 mm and a spacing of 1.5 mm, installed 3 cm below the capsule transmission channel. The excitation signal is generated by a digital signal generator, producing a linear sweep frequency sound wave of 0.1-10 kHz. The sweep frequency period is controlled within 50 milliseconds to match the dwell time of the capsule at the detection station, and the frequency step accuracy during the sweep is 1 Hz. The excitation intensity is dynamically adjusted according to the capsule specifications. The default setting is a sound pressure level of 75 dB at the main frequency band of 2 kHz. For different capsule specifications, it is automatically adjusted within a range of ±10 dB to maintain the vibration displacement within a safe range of 0.5 to 5 micrometers. The excitation signal synchronously triggers a laser Doppler vibrometer. The vibrometer has a spot positioning accuracy of 0.01 mm and captures the vibration velocity signal in the normal direction of the capsule surface at a sampling rate of 200 samples per second.
[0052] The dynamic thermodynamic response analysis module first converts the collected vibration response signal to the frequency domain through a fast Fourier transform, and then performs energy density quantization processing on a specific frequency band: the target frequency point is selected as the center, and the analysis interval is formed by expanding to both sides with a fixed bandwidth of 50Hz. The integral value of the square of the spectral amplitude in the interval is calculated as the energy density feature of the frequency band.
[0053] Let the time-domain signal of the vibration velocity on the capsule surface be... Fixed bandwidth is Then the energy density characteristics , :right The result of performing a Fast Fourier Transform represents the complex amplitude distribution of the vibration signal in the frequency domain. The magnitude of the frequency domain amplitude characterizes the vibration intensity of different frequency components. The target center frequency is preset based on the inherent resonant characteristics of the capsule material. Frequency infinitesimal element, used for integration operations. :frequency The vibrational energy density at a point represents the energy density at that point. The cumulative intensity of vibrational energy within the frequency band; this formula is directly related to the mechanical integrity of the capsule structure: when the capsule is defect-free, the vibrational energy is highly concentrated in... Narrow band Reaching peak value; however, the presence of internal cracks or material degradation will cause a shift in resonant frequency or energy diffusion, manifesting as The value decreased significantly, while the bandwidth... The setting is derived from the statistical optimization value of the resonant peak width of gelatin capsules, ensuring both coverage of defect-sensitive frequency bands and suppression of noise interference;
[0054] Then the original vibration signal is decomposed by 6 layers using wavelet packet decomposition algorithm to obtain 64 terminal node coefficients; the energy entropy value of each node coefficient is calculated, which is defined as the logarithmic proportion of the node signal energy to the total energy, and finally the top 16 nodes with significant energy entropy value are selected to form a multi-dimensional feature vector representing the integrity of the capsule structure.
[0055] Near-infrared spectral component inversion module: through short-wave near-infrared diffuse reflectance spectroscopy analysis, the gelatin crosslinking degree of the capsule shell is inverted and abnormal samples are detected.
[0056] The near-infrared spectral component inversion module uses a linear array of optical fiber probes with a diameter of 2 mm and a fixed center-to-center distance of 5 mm between adjacent probes, which is installed parallel to the long axis direction of the hollow capsule; when the capsule passes through the detection station at a constant speed along the conveyor belt, the optical fiber probe array is driven to perform continuous line scanning along the long axis direction of the capsule at a speed of 10 mm per second, ensuring that the surface of each capsule is covered by at least 20 scanning points; each optical fiber probe synchronously collects diffuse reflectance spectroscopy signals in the 900-1700 nm waveband, and the spectral resolution of the spectrometer is set to no more than 5 nm; the original spectroscopy data is recorded at a frequency of once per millisecond, and the ambient stray light interference is shielded during the collection process, and a built-in reference white board is used to perform baseline calibration automatically every 5 minutes; the original spectroscopy data is transmitted in real time to the data processing unit, and the standard normal variable transformation and first derivative processing are performed by the spectroscopy preprocessing submodule to form a standardized spectroscopy matrix;
[0057] For quantitative analysis of gelatin crosslinking degree, a partial least squares regression (PLSR) algorithm is used to construct a prediction model, first the preprocessed spectroscopy matrix is input as the independent variable, and the true value of the gelatin crosslinking degree measured by the laboratory reference method is input as the dependent variable; by iteratively calculating the latent variables and maximizing the covariance of the spectroscopy data and the target attribute, a regression coefficient matrix is generated; after the model training is completed, the coefficient matrix is directly applied to calculate the predicted value of the gelatin crosslinking degree from the newly collected spectroscopy data; standard samples are used daily to drift calibration to ensure the applicability of the model; let the spectroscopy matrix be , the partial least squares regression model is , : the laboratory reference measurement value matrix of the gelatin crosslinking degree, each element is the true crosslinking degree value of the capsule, : the regression coefficient matrix, reflecting the weight of different wavelength characteristics on the prediction of crosslinking degree, Residual matrix; the method is embodied in converting the spectral absorbance change of the capsule shell in a specific wave band into a quantifiable cross-linking degree index, for example, when the regression coefficient corresponding to the 1530 nm wavelength is negative, it indicates that the absorbance enhancement of this wave band corresponds to the increase of water content in the gelatin structure, which leads to the increase of the looseness of intermolecular cross-linking, which conforms to the inherent chemical mechanism of the competition between water and cross-linking bonds in the gelatin material, so as to realize the real-time inversion of the cross-linking state of the capsule shell through non-destructive spectral analysis;
[0058] For abnormal sample screening, the multi-dimensional mean vector and the covariance matrix of the historical qualified capsule spectral data set are calculated; for each newly collected spectral sample, the Mahalanobis distance value between it and the qualified data set is calculated; when the Mahalanobis distance value exceeds the preset threshold value, it is determined as an abnormal sample, and the threshold value is determined according to the 99% confidence interval of the chi-square distribution of the historical data; the coordinate information of all abnormal samples is marked and transmitted to the multi-source data fusion decision module in real time; the spectral vector of the capsule sample to be tested is , the mean vector of the historical qualified sample spectral data is , representing the spectral reference of the normal capsule, the inverse matrix of the qualified sample spectral covariance matrix is , for standardizing the correlation between different wavelengths, then the Mahalanobis distance , the formula calculates the multi-dimensional space distance between the spectral vector of the capsule sample to be tested and the mean vector of the historical qualified sample spectrum, and standardizes the distance by using the inverse matrix of the qualified sample spectral covariance matrix, so as to eliminate the dimensional difference and correlation interference between different wavelength variables; its physical meaning is that the distance value can sensitively capture spectral abnormal features, when the capsule has foreign matter pollution or process deviation, the reflectivity abnormality under a specific wavelength will make the sample to be tested significantly deviate from the center of the qualified cluster in the statistical space defined by the covariance matrix, at this time the inverse matrix will amplify the distance contribution in the irregular variation direction, so that the local spectral distortion caused by foreign matter pollution is effectively identified as a high Mahalanobis distance value, and then the implicit defect detection based on the overall morphological statistical characteristics of the spectrum is realized.
[0059] Multi-source data fusion decision module: based on D-S evidence theory, the optical, mechanical and spectral features are fused, and the fuzzy integral and random forest classifier are used to realize the defect type grading judgment.
[0060] The multi-source data fusion decision module first establishes a corresponding basic probability assignment function for each module based on the analysis results output by the multi-dimensional optical feature acquisition module, the dynamic thermodynamic response analysis module and the near-infrared spectrum component inversion module, and respectively defines the optical module confidence function, the mechanical module confidence function and the spectrum module confidence function; the three confidence functions quantize the detection results of each module into the probability support of different subsets in the defect type hypothesis space, wherein the defect type hypothesis space contains all predefined capsule defect categories;
[0061] The specific fusion process includes:
[0062] S1, for any target defect category in the hypothesis space, traverse all possible subset combinations, only when the intersection of the subsets determined by the three modules is exactly equal to the target defect category, multiply the confidence function values corresponding to the three subsets, and sum all the products that meet the conditions as the numerator item;
[0063] S2, calculate the conflict factor, that is, the sum of the confidence function value products that cause the intersection of the three module subsets to be empty, which reflects the degree of conclusion conflict between the modules;
[0064] S3, divide the numerator item obtained in the first step by the difference between 1 and the conflict factor, and finally output the comprehensive confidence of the fused target defect category.
[0065] This process synchronously traverses all defect categories to generate a complete fusion confidence distribution, providing a probability basis for subsequent classification decisions.
[0066] Let the target defect category to be determined be , the basic probability assignment value of the defect subset by the multi-dimensional optical feature acquisition module is , the basic probability assignment value of the defect subset by the dynamic thermodynamic response analysis module is , and the basic probability assignment value of the defect subset by the near-infrared spectrum component inversion module is , then the comprehensive confidence , , is the conflict factor, representing the total probability of complete contradiction between the conclusions of the three modules; this formula fits the cross-scale characteristics of the hollow capsule defect: surface defects need to be verified by the correlation of optical texture anomalies and mechanical vibration responses, internal component anomalies need to be cross-verified by spectral features and transmission optical behavior, and the conflict factor adaptively offsets false positives of a single module caused by differences in capsule wall thickness or environmental interference, and finally realizes the determination only when there is consistent evidence of the defect in the multi-dimensional physical space.
[0067] The multi-source data fusion decision module adopts an improved random forest classifier as the core classification tool, the input features include the texture fractal dimension from the multi-dimensional optical feature acquisition module, the 3kHz frequency band energy ratio from the dynamic thermodynamic response analysis module, and the 1530nm absorption peak second derivative value from the near-infrared spectrum component inversion module, the random forest is composed of 500 decision trees, and the Gini index is used as the impurity measure standard at node splitting of each tree, and the splitting process continues until the number of node samples is lower than the preset threshold or the maximum depth is reached, in the training stage, a training subset is extracted for each tree by bootstrap sampling method, and a feature subset is randomly selected for splitting to improve the model generalization ability;
[0068] The output result of the improved random forest classifier is a five-level defect label: 0 qualified, 1 slight deformation, 2 local crack, 3 composition deviation, and 4 structure failure, when the maximum prediction probability of a single sample by the random forest is less than 85%, the local coordinate re-inspection mechanism of the near-infrared spectrum component inversion module is triggered; if four-level defects are found in three consecutive samples, a parameter calibration instruction is sent to the adaptive feedback optimization module to correct the detection sensitivity.
[0069] The adaptive feedback optimization module dynamically adjusts the detection parameters through reinforcement learning to optimize the adaptability of the system to batch differences.
[0070] The adaptive feedback optimization module defines a state space and an action space, the state space is composed of three types of real-time data: the first type is the capsule material type, the gelatin crosslinking degree value inverted by the spectrum module is mapped to a discrete code, low crosslinking degree (0-0.3) is coded as 1, medium crosslinking degree (0.3-0.6) is coded as 2, and high crosslinking degree (0.6-1.0) is coded as 3; the second type is the environment temperature and humidity, the sensor data is directly read and stored as a floating point number; the third type is the historical false detection rate, the false detection times percentage of the multi-source data fusion decision module in the last 100 detections is counted; the action space includes three groups of executable operations: the first group adjusts the intensity of the ring LED array of the multi-dimensional optical feature acquisition module, which increases or decreases by 5% steps in the range of 0% to 100%; the second group adjusts the piezoelectric ceramic excitation frequency of the dynamic thermodynamic response analysis module, which linearly shifts by ±10% based on the current set value; the third group adjusts the PLSR modeling window width of the near-infrared spectrum component inversion module, which dynamically stretches and shrinks in the range of 80% to 120% of the original window; the action selection mechanism adopts an ε-greedy strategy, 90% probability selects the action with the highest Q value in the current state, and 10% probability randomly explores the action space.
[0071] The adaptive feedback optimization module loads a pre-trained Q value table containing initial scores of 200 typical state-action combinations at system initialization. After each capsule detection, the immediate reward is calculated based on the classification results output by the multi-source data fusion decision module: +1 if the classification results are consistent with manual review and the product is qualified; +2 if the defect type is correctly identified; -3 if false positives or missed detections occur. The Q value is updated using the time difference method, adjusting the score of the current state-action pair in the direction of the immediate reward plus the maximum predicted reward for the next three steps. The learning rate is fixed at 0.2, and the discount factor is set to 0.9 to balance current and long-term rewards. At the same time, the PLSR model coefficient matrix of the near-infrared spectral component inversion module is updated using a sliding window mechanism: only the spectral matrix and measured gelatin crosslinking degree of the last 1000 valid samples are retained, and when new samples are added, the oldest samples are automatically removed. The regression coefficient matrix is recalculated every 50 new samples to ensure that the model adapts to material fluctuations on the production line.
[0072] Let the learning rate be The immediate reward is The discount factor is The update rule is: , : The long-term expected reward score of performing action in state , : The maximum expected reward that can be obtained after entering new state , : New state; this formula is based on the time difference learning principle, and the core logic is to continuously correct the long-term expected reward of system decision through actual feedback. Its physical meaning is: when the system is in a specific state (a combination of capsule material type, environmental temperature and humidity, and historical false detection rate), performing a certain action (such as adjusting the LED intensity of the optical module or the mechanical excitation frequency) will trigger state migration to (a new working condition with reduced false detection rate), while obtaining immediate reward (a positive / negative feedback determined by detection accuracy).
[0073] The present application starts from a multi-dimensional optical feature acquisition module that acquires the optical features of the surface and internal structure of a hollow capsule by non-contact multispectral imaging technology. The module uses a ring-shaped multispectral LED array and a high-resolution CMOS sensor to irradiate the capsule with light sources at multiple angles and generate a three-dimensional data matrix containing reflectivity, transmissivity, and texture distribution. The image data is then processed by wavelet denoising, geometric correction, and feature enhancement and transmitted to a dynamic thermodynamic response analysis module. The dynamic thermodynamic response analysis module excites the capsule to produce microscopic vibrations by a piezoelectric ceramic array and uses a laser Doppler vibrometer to collect vibration signals. The frequency energy density and energy entropy features are extracted by fast Fourier transform and wavelet packet decomposition to detect elastic modulus anomalies or internal defects. The near-infrared spectral component inversion module collects diffuse reflectance spectral data from the surface of the capsule by a linear array of optical fiber probes. After preprocessing, the gelatin cross-linking degree is inverted using the partial least squares regression algorithm, and abnormal samples are screened based on Mahalanobis distance calculation. The multi-source data fusion decision module integrates the optical texture fractal dimension, mechanical frequency band energy ratio, and spectral absorption peak features based on D-S evidence theory, realizes defect type grading determination through fuzzy integration and random forest classifier, and outputs a five-level defect label. The adaptive feedback optimization module dynamically adjusts the optical LED intensity, mechanical excitation frequency, and spectral modeling parameters through a reinforcement learning mechanism, optimizes the system adaptability based on real-time state and detection feedback, ensures continuous and stable operation of the production line, and significantly reduces the misjudgment rate.
[0074] Secondly: the drawings of the disclosed embodiments of the present application only involve the structures involved in the disclosed embodiments of the present application, other structures can refer to the usual design, and in the case of no conflict, the same embodiments and different embodiments of the present application can be combined with each other;
[0075] Finally: the above only describes the preferred embodiments of the present application and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A system for intelligent quality inspection of pharmaceutical hollow capsules, characterized in that it comprises: Comprise: Multi-dimensional optical feature acquisition module: Obtain the optical features of the surface and internal structure of the hollow capsule through non-contact multi-spectral imaging technology, combine multi-angle light source and high-resolution image sensor to generate a three-dimensional data matrix containing reflectivity, transmissivity and texture distribution; Dynamic thermodynamic response analysis module: Based on non-contact mechanical excitation and vibration response analysis, excite the capsule to produce micro-vibration through a piezoelectric ceramic array, and collect vibration signals using a laser Doppler vibration meter, extract frequency energy density and energy entropy features through fast Fourier transform and wavelet packet decomposition to detect elastic modulus anomalies or internal defects; Near-infrared spectral component inversion module: Through short-wave near-infrared diffuse reflectance spectroscopy analysis, diffuse reflectance spectral data of the capsule surface is collected through a linear array of optical fiber probes, and after pretreatment, the gelatin crosslinking degree is inverted using a partial least squares regression algorithm, and abnormal sample detection is performed based on Mahalanobis distance calculation; Multi-source data fusion decision module: Based on D-S evidence theory, the texture fractal dimension from the multi-dimensional optical feature acquisition module, the 3kHz frequency band energy ratio from the dynamic thermodynamic response analysis module, and the 1530nm absorption peak second derivative value from the near-infrared spectral component inversion module are fused, and defect type classification is determined through fuzzy integration and random forest classifier; Self-adaptive feedback optimization module: dynamically adjust detection parameters through reinforcement learning to optimize the adaptability of the system to batch differences.
2. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The optical features of the surface and internal structure of the hollow capsule obtained by non-contact multi-spectral imaging technology include: The multi-dimensional optical feature acquisition module uses non-contact multi-spectral imaging technology, which is composed of a ring-shaped multi-spectral LED array and a high-resolution CMOS sensor; The ring-shaped multi-spectral LED array is evenly distributed in a circle around the capsule, containing three different wavelength LED light sources, with a wavelength range of 400-1100nm, corresponding to visible light, near-infrared and short-wave infrared spectra respectively, each group of light sources is independently controlled and alternately lit according to a preset time sequence, the incident angle is set to three modes of 30 degrees, 60 degrees and 90 degrees, through multi-angle illumination to eliminate shadow interference under single light source and enhance surface texture features; The high-resolution CMOS sensor has a resolution of not less than 20MP and a frame rate of 120fps per second, through a synchronous trigger mechanism and LED light source linkage, it captures the reflected light and transmitted light images of the capsule within a millisecond time window.
3. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The three-dimensional data matrix includes: First, the original image data is processed for noise suppression, a threshold filtering method based on multi-layer wavelet decomposition is used, the noise suppression strength parameter is dynamically adjusted by analyzing the light scattering characteristics of the capsule material, and pixel abnormal fluctuations caused by environmental stray light or sensor electronic interference are eliminated; Subsequently, a geometric correction process is performed, an outer contour boundary point set of the capsule is extracted by using a morphological edge detection algorithm, an elliptical model is fitted by using a least square method to calculate an angle offset of a long axis of the capsule, and an original image is subjected to an affine transformation to compensate for posture tilt errors caused by a vibrating conveyor; the image subjected to the geometric correction enters a feature enhancement stage, a multi-scale Gaussian difference filter is applied to separate surface texture details and background regions, local contrast enhancement coefficients are calculated for reflection light images at different incident angles, and a gray level histogram equalization is synchronously performed on the transmission light image to improve internal structure visibility; based on the separated surface texture detail image, a box dimension algorithm is used to calculate a fractal dimension value, the texture image is first binarized, a multi-resolution grid covering method is used to count the minimum number of grids covering the texture contour at different scales, a linear regression slope of the grid size logarithm and the grid number logarithm is obtained by using a least square fitting, and the slope value is the fractal dimension quantifying the texture complexity; Finally, a three-dimensional data matrix is generated by integrating the processing results, the first dimension stores reflectivity distribution graphs at 30 degrees, 60 degrees and 90 degrees incident angles, the second dimension records transmission light intensity gradient graphs, and the third dimension encodes the direction consistency index, the spatial frequency spectrum and the fractal dimension value of the texture features.
4. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The non-contact mechanical excitation includes: A piezoelectric ceramic array is selected as a core excitation device, the array is composed of 32 independently controlled piezoelectric ceramic sheets arranged in a ring shape, each ceramic sheet has a diameter of 5 mm and a spacing of 1.5 mm, and is installed 3 cm below the capsule transmission channel; an excitation signal is generated by a digital signal generator to generate a linear sweep frequency sound wave of 0.1-10 kHz, the sweep frequency cycle is controlled within 50 milliseconds to match the residence time of the capsule in the detection station, and the frequency step precision is 1 Hz during the sweep frequency process; the excitation strength is dynamically adjusted according to the capsule specifications, and the default setting is that the sound pressure level at the main frequency band of 2 kHz is 75 dB, and the system automatically adjusts within a range of ±10 dB for different specifications of the capsule to keep the vibration displacement in a safe range of 0.5 to 5 microns; the excitation signal synchronously triggers a laser Doppler vibration tester, the spot positioning accuracy of the tester is 0.01 mm, and the vibration velocity signal in the normal direction of the capsule surface is captured at a sampling rate of 200 times per second.
5. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The vibration response analysis includes: The collected vibration response signal is first converted to the frequency domain by fast Fourier transform, and then energy density quantization processing is performed on a specific frequency band: a target frequency point is selected as the center, a fixed bandwidth of 50 Hz is expanded to both sides to form an analysis interval, and the integral value of the square of the spectrum amplitude in the interval is calculated as the energy density characteristic of the frequency band; Then, a wavelet packet decomposition algorithm is used to implement 6-layer deep decomposition on the original vibration signal to obtain 64 terminal node coefficients; the energy entropy value of each node coefficient is calculated, which is defined as the logarithmic proportion of the node signal energy to the total energy, and finally the top 16 nodes with significant energy entropy values are selected to form a multi-dimensional feature vector representing the integrity of the capsule structure.
6. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The short wave near infrared diffuse reflectance spectrum analysis includes: The linear array of optical fiber probes with a diameter of 2 mm and a fixed center-to-center distance of 5 mm between adjacent probes is installed in parallel to the long axis direction of the hollow capsule; when the capsule passes through the detection station at a constant speed along the conveying belt, the optical fiber probe array is driven to perform continuous line scanning along the long axis direction of the capsule at a speed of 10 mm per second, ensuring that the surface of each capsule is covered by at least 20 scanning points; each optical fiber probe synchronously collects the diffuse reflectance spectrum signal in the waveband of 900-1700 nm, the spectral resolution of the spectrometer is set to be not greater than 5 nm, and the original spectrum data is recorded at a frequency of once per millisecond, the ambient stray light interference is shielded during the collection process, and the baseline calibration is automatically performed every 5 minutes through the built-in reference white board; the original spectrum data is transmitted to the data processing unit in real time, and the standard normal variable transformation and first-order derivative processing are performed by the spectrum preprocessing submodule to form a standardized spectrum matrix.
7. The intelligent capsule-in- capsule system according to claim 1, wherein, The detection of the abnormal sample includes: For the quantitative analysis of the cross-linking degree of gelatin, a partial least squares regression algorithm is used to construct a prediction model, first the preprocessed spectrum matrix is input as the independent variable, and the true value of the cross-linking degree of gelatin measured by the laboratory reference method is input as the dependent variable; by iteratively calculating the latent variables and maximizing the covariance of the spectrum data and the target attribute, a regression coefficient matrix is generated; after the model training is completed, the coefficient matrix is directly applied to calculate the predicted value of the cross-linking degree of gelatin from the newly collected spectrum data; For the screening of abnormal samples, the multi-dimensional mean vector and the covariance matrix of the spectrum data set of the historical qualified capsules are calculated; for each newly collected spectrum sample, the Mahalanobis distance value between it and the qualified data set is calculated; when the Mahalanobis distance value exceeds the preset threshold, it is determined as an abnormal sample, and the threshold is determined according to the 99% confidence interval of the chi-square distribution of the historical data; the coordinate information of all abnormal samples is marked and transmitted to the multi-source data fusion decision module in real time.
8. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The multi-source data fusion decision module includes: First, based on the analysis results output by the multi-dimensional optical feature acquisition module, the dynamic thermodynamic response analysis module and the near-infrared spectrum component inversion module, a corresponding basic probability assignment function is established for each module, which is defined as an optical module confidence function, a mechanical module confidence function and a spectrum module confidence function respectively; the three confidence functions quantify the detection results of each module as the probability support of different subsets in the defect type hypothesis space, wherein the defect type hypothesis space contains all predefined capsule defect categories; The fusion process includes: S1, for any target defect category in the hypothesis space, traverse all possible subset combinations, only when the intersection of the three modules is exactly equal to the target defect category, multiply the confidence function values of the three subsets, and sum all the products that meet the conditions as the numerator; S2, calculate the conflict factor, that is, the sum of the confidence function value products that cause the intersection of the three module subsets to be empty, which reflects the degree of conclusion conflict between the modules; S3, divide the numerator obtained in the first step by the difference between 1 and the conflict factor, and finally output the comprehensive confidence of the fused target defect category.
9. The pharmaceutical hollow capsule intelligent quality inspection system according to claim 1, characterized in that, The random forest classifier includes: The multi-source data fusion decision module adopts an improved random forest classifier as the core classification tool, the input features include the texture fractal dimension from the multi-dimensional optical feature acquisition module, the 3kHz frequency band energy ratio from the dynamic thermodynamic response analysis module, and the 1530nm absorption peak second derivative value from the near-infrared spectrum component inversion module, the random forest is composed of 500 decision trees, each tree uses Gini index as the impurity measure standard when splitting nodes, and the splitting process continues until the number of node samples is lower than the preset threshold or the maximum depth is reached, in the training stage, the bootstrap sampling method is used to extract the training subset for each tree, and the feature subset is randomly selected for splitting to improve the model generalization ability; The output result of the improved random forest classifier is a five-level defect label: 0 level qualified, 1 level slight deformation, 2 level local crack, 3 level composition deviation, and 4 level structure failure, when the maximum prediction probability of a single sample by the random forest is less than 85%, the local coordinate re-inspection mechanism of the near-infrared spectrum component inversion module is triggered; if four-level defects are found in three consecutive samples, a parameter calibration instruction is sent to the adaptive feedback optimization module to correct the detection sensitivity.
Citation Information
Patent Citations
Visual detection method for capsule medicine quality
CN117974644A
Automatic fish maw detecting and grading system
CN119354918A