Drug particle intelligent detection system and method based on image processing
By combining multi-scale residual enhancement, structure-guided filtering, layered outline evolution and graph neural network technology, an intelligent detection system for drug particles was built, solving the problem of drug particles defect detection in complex backgrounds, and achieving the effect of high-precision and multi-category defect classification.
Patent Information
- Application Number
- CN202510715401.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-05-30
AI Technical Summary
The prior art is difficult to efficiently and accurately detect defects such as microcracks and foreign matter adhesion of pharmaceutical particles under complex backgrounds.
Multi-scale residual enhancement, structure-guided filtering, layered profile evolution and graph neural network (GNN) are used to build an intelligent detection system for drug particles through image processing and machine learning algorithms.
It significantly improves the accuracy and adaptability of drug particle defect detection, can accurately identify small and weak significant defects in complex backgrounds, and achieve high-precision classification of multiple categories of defects.
Smart Images

Figure CN120235871A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image defect detection, and particularly to an intelligent detection system and method for pharmaceutical particles based on image processing. Background Art
[0002] The quality inspection of pharmaceutical particles is a core link in the pharmaceutical production process, which is directly related to the safety and efficacy stability of drugs; with the expansion of the pharmaceutical production scale and the improvement of quality control standards, the traditional methods relying on manual visual inspection or semi-automatic equipment are gradually difficult to meet the high-precision and high-efficiency quality inspection requirements; in recent years, the deep integration of image processing technology, machine learning algorithms and industrial detection equipment has provided a new direction for automated detection, but the detection of defects such as micro-cracks and foreign object attachments on the surface of pharmaceutical particles still faces challenges in complex backgrounds (such as non-uniform illumination, high noise, and weak contrast).
[0003] A Chinese invention patent application with the publication number CN118527377B discloses a device and method for detecting and removing debris. The method includes obtaining an image sequence of a predetermined area from a high-definition camera illuminated by reticular projection; preprocessing and preliminarily segmenting the image sequence to obtain a two-dimensional image mask of the segmented tablet, and constructing two-dimensional and three-dimensional data sets of the tablet in combination with the two-dimensional image mask; based on the two-dimensional and three-dimensional data sets, performing image registration and fusion, and performing fine segmentation, texture analysis, shape analysis and spectral feature extraction to obtain a comprehensive data set of the tablet; reading the comprehensive data set, and calling a pre-configured comprehensive defect feature vector, using an integrated learning module to perform fine classification on the fine module, and evaluating the severity of the defect according to the fine classification result, giving an overall quality score of the tablet; if the overall quality score is less than the threshold, sending a removal instruction to the removal mechanism; removing debris through pure vision, solving the problem that the photoelectric counter is easily blocked by dust, resulting in counting and detection errors.
[0004] With the improvement of the requirements for intelligentization and automation in the pharmaceutical industry, the development of an efficient and accurate intelligent detection system has become an urgent need in the industry. The present invention aims to optimize the accuracy and adaptability of pharmaceutical particle defect detection by combining technologies such as multi-scale residual enhancement, structure-guided filtering, hierarchical contour evolution, and graph neural network (GNN), providing technical support for the standardization and intelligentization of quality control in the pharmaceutical production line. Summary of the Invention
[0005] The object of the present invention is to propose an intelligent detection system and method for pharmaceutical particles based on image processing to solve the problems in the background art.
[0006] The technical solution of the present invention: An intelligent detection method for pharmaceutical particles based on image processing includes the following specific implementation steps: S1. Collect the original images of pharmaceutical particles on the production line; S2. Extract the detail residuals by constructing multi-scale Gaussian blurred images, enhance the image microstructure by weighted fusion of multi-scale residual information, improve the discrimination by combining local contrast normalization, use a spatial-pixel joint guided filter to suppress noise and preserve edges, and finally generate an enhanced image through an adaptive fusion strategy; S3. Generate the main structure response map through direction-aware multi-scale structure gradients, construct an edge confidence fusion map by combining regional shape priors, use a hierarchical contour evolution model and a dynamic threshold strategy, adaptively adjust the segmentation threshold based on the regional mean and local texture variance, and output a segmentation mask; S4. Construct a boundary relative potential field based on the segmentation mask, calculate by combining the multi-directional texture perturbation intensity, capture the damage of the defect to the direction consistency, generate a texture-enhanced feature map by weighted fusion of the perturbation map and the potential map, and extract the regional average perturbation intensity, standard deviation, skewness, and kurtosis to construct a regional-level defect-aware texture feature vector; S5. Construct a texture anomaly density map and a morphological heterogeneity parameter, fuse the texture-morphology joint score, statistically discriminate the defect area based on a dynamic threshold, and use a multi-class defect classification method based on graph structure, combine the graph neural network GNN to model the spatial semantic relationship between regions, and identify the defect category; S6. Perform result annotation and visualization processing on the particles with identified defects, and output a traceable defect detection report.
[0007] Preferably, the enhancement process of enhancing the image microstructure by weighted fusion of multi-scale residual information is as follows: S21. Based on the original image I(x, y), construct Gaussian blurred images of several scales : ; wherein, represents the two-dimensional Gaussian kernel function, and its standard deviation controls the degree of blurring, i = 1, 2,..., n; represents the two-dimensional convolution operation; n represents different blurring scales; represents the image blurred at scale ; S22. Perform a difference operation on the original image and the blurred images of each scale to extract the detail residual information at the corresponding scale: ; Subsequently, the multi-scale residuals are weighted and fused to form an enhanced image: ; wherein, represents the detail residual map at scale ; represents the residual information weight at the corresponding scale , ; Indicates the image enhancement result after fusing multi-scale detailed information.
[0008] Preferably, the enhancement process of generating the enhanced image through the adaptive fusion strategy is as follows: B1. Standardize the image using the local contrast normalization method: ; Among them, Indicates the standardized image after contrast adjustment; Indicates the neighborhood average value with a radius of r centered at the point (x, y); Indicates the neighborhood standard deviation with a radius of r centered at the point (x, y); Indicates a very small positive number; B2. Use the structure-guided filter to remove random noise but retain the structural edges: ; ; Among them, Indicates the local window centered on the pixel p = (x, y); Indicates the spatial-pixel value joint guidance weight; Indicates the standard deviation in the spatial domain; Indicates the standard deviation of the pixel intensity difference; Indicates the normalization factor; Indicates the natural exponential function; Indicates the image after denoising; p represents the current pixel coordinate, p = (x, y); q represents the neighborhood pixel coordinate, q = (i, j); B3. Fuse the original image with the structure-preserving map to generate the final enhanced image: ; Among them, Indicates the final output image; Indicates the fusion weight coefficient, .
[0009] Preferably, the generation process of the edge confidence fusion map is as follows: S31. Use the direction-aware multi-scale structure gradient extraction operator , and construct the structure response map: ; Among them, Indicates the specified main direction; s represents the scale parameter, ; Indicates the direction-scale structure gradient operator; Indicates the gradient response map at the direction θ and scale s; Subsequently, the multi-scale responses are fused to obtain the main structure response map : ; S32. Construct the local region prior map: ; Among them, represents the neighborhood centered at the point (x, y) with a radius r; and respectively represent the average gray value and the standard deviation of the neighborhood; represents the regional shape prior response map; S33. Combine the main structure response map with the regional shape prior response map , and fuse them to obtain the edge confidence fusion map: ; Among them, represents the normalization function, mapping the value range to [0, 1]; represents the fusion weight of the edge and the regional response, ; represents the final edge confidence map.
[0010] Preferably, the segmentation process of the segmentation mask is as follows: Input the edge confidence map into the hierarchical contour evolution model, and adopt the dynamic threshold strategy for region segmentation: ; ; Among them, k represents the current segmentation level; represents the segmentation mask of the k-th layer, and the value of 1 indicates belonging to the target of this layer; represents the dynamic threshold at the k-th layer, which is adaptively set based on the regional mean , the local texture variance : represents the segmentation sensitivity control parameter of the k-th layer.
[0011] Preferably, the construction process of the region-level defect-aware texture feature vector is as follows: S41. Based on the segmentation mask , construct the relative potential field from each candidate region to its contour boundary, and capture the texture attenuation trend in the region towards the boundary: ; Among them, represents the boundary relative potential of the pixel point (x, y) in region k; represents the Euclidean distance from the point (x, y) to the corresponding region boundary; represents the Gaussian scale parameter that controls the distance attenuation speed; S42. In each region, calculate the local texture perturbation intensity in multiple directions: ; where I(x, y) represents the grayscale value of the original image; represents the pixel offset corresponding to the direction θ; represents the texture perturbation intensity in the direction θ; Subsequently, calculate the comprehensive perturbation map : ; S43. Weightedly fuse the perturbation map with the relative potential map to introduce the regional potential into the texture perturbation modeling and form a texture enhancement feature map: ; where represents the texture potential fusion map of region k; represents the potential weight adjustment factor, ; S44. Perform statistical coding on the texture fusion feature map k of each region S : ; ; where represents the average perturbation intensity of the region; represents the standard deviation; represents the skewness; represents the kurtosis, characterizing the texture concentration trend; represents the region-level defect-aware texture feature vector.
[0012] Preferably, the identification process of the defect region is as follows: S51. Construct a texture anomaly density mapping function: ; where represents the normalized texture anomaly density index; S52. Calculate the geometric shape parameters of the region: ; where represents the perimeter of the region contour; represents the area of the region; represents the morphological heterogeneity; S53. Construct a joint discriminant scoring function: ; where represents the comprehensive defect score of the region; represents the collaborative weight of texture and morphology, ; S54. Construct a dynamic discrimination strategy based on score distribution statistics: ; ; wherein, and respectively represent the mean and standard deviation of all region scores ; represents the dynamic threshold; represents the final region defect discrimination label; When the identified final region defect discrimination label is "abnormal", execute the multi-class defect classification method based on the graph structure to identify the final defect category; otherwise, directly output the normal result of the current pharmaceutical granule.
[0013] Preferably, the implementation process of the multi-class defect classification method based on the graph structure is as follows: A1. Construct a region graph structure G=(V,E): The graph node V={ }: Each node corresponds to the extracted defect region, and the node feature is : ; wherein, represents the normalized texture abnormality density index; represents the region comprehensive defect score; represents the morphological isomerism degree; represents the contour compactness; represents the region centroid coordinate; Construction of graph edge E: The strategy for constructing graph edges is the combined strategy of semantic space constraint + texture similarity: ; wherein, represents the Euclidean distance of the centroids of regions i and j; represents the cosine similarity; and respectively represent the spatial threshold and the similarity threshold; represents the edge between nodes i and j; A2. Graph attention neural network classification and inference Use a multi-layer graph attention network for node feature propagation and defect classification prediction: ; wherein, represents the representation of node k at the l+1 layer, initially ; represents the linear mapping matrix at the l layer; Denote the set of neighbor nodes of node k; Denote the attention weights; Denote the LeakyReLU activation function; The output of the final layer is a softmax classification probability vector : ; where, Denote the output of the nodes in the last layer of the GNN; Denote the probability that the node belongs to the c-th class; A3. Determine the final defect category according to the maximum value of the classification probability vector Output: ; ; where, Denote the final defect category of the region; Denote the defect confidence score.
[0014] Preferably, the formulated main direction θ includes .
[0015] The technical solution of the present invention: An intelligent drug particle detection system based on image processing, which is used to execute an intelligent drug particle detection method based on image processing, including: An image acquisition module, which is used to acquire the original images of drug particles on the production line; A preprocessing module, which is used to adopt a multi-scale residual information enhancement and structure-preserving adaptive filtering method to dynamically fuse different-scale residual signals and use local contrast normalization to enhance the micro-structure differentiation, and combine a spatial-pixel joint guided filter to suppress noise and retain edges, and finally output an enhanced denoised image; A contour extraction module, which is used to fuse the direction-aware multi-scale structure gradient, regional shape prior, and edge confidence response, and adaptively segment the main contour and micro-cracks of drug particles through a hierarchical contour evolution model combined with a dynamic threshold strategy to generate a segmentation mask; A defect analysis module, which is used to quantify the gradient perturbation, structural discontinuity, and local contrast change in the defect area based on a multi-scale direction texture perception method guided by a boundary relative potential map, construct a joint discriminant score by statistically nested fusion of texture, morphology, and spatial distribution features, and introduce a graph neural network to model the spatial semantic relationship between regions, so as to achieve robust recognition and multi-class classification of tiny and weakly significant defects; A result output module, which is used to label and visualize the detection results, generate a traceable report including defect scores, class labels, and spatial positions, and support drug particle quality traceability and automated sorting decisions.
[0016] Compared with the prior art, the above technical solution of the present invention has the following beneficial technical effects: The present invention designs an intelligent detection system and method for pharmaceutical particles based on image processing. Through multi-scale residual information enhancement and structure-preserving adaptive filtering, the distinguishability of microstructures in the image is effectively improved, and non-uniform noise interference is suppressed. By adopting a hierarchical contour evolution model that fuses direction-aware structural gradient and regional shape prior, the main contour and micro-cracks of pharmaceutical particles can be accurately extracted. By introducing a multi-scale texture perception method guided by a boundary relative potential map, the sensitive recognition ability for small and weakly significant defect regions is improved. By constructing spatial semantic dependency relationships between regions through a graph neural network, high-precision classification of multi-category defects is achieved. The overall system has the advantages of high detection accuracy, strong adaptability, good robustness, and high automation degree, significantly improving the intelligent level and industrial application value of pharmaceutical particle quality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a system architecture diagram of an intelligent detection system for pharmaceutical particles based on image processing proposed by the present invention; Figure 2 It is a method flow chart of an intelligent detection method for pharmaceutical particles based on image processing proposed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] Example 1, as Figure 1 shown, an intelligent detection system for pharmaceutical particles based on image processing proposed by the present invention includes: an image acquisition module, a preprocessing module, a contour extraction module, a defect analysis module, and a result output module.
[0019] The image acquisition module dynamically captures pharmaceutical particles on the production line through a high-resolution industrial camera combined with a polarized light source, precisely controls exposure, focal length, and lighting parameters, and obtains high-quality original images with multiple angles and multiple light sources, providing a clear and stable image data basis for subsequent processing; The preprocessing module adopts a multi-scale residual information enhancement and structure-preserving adaptive filtering method, dynamically fuses different-scale residual signals, uses local contrast normalization to enhance the distinguishability of microstructures, combines a spatial-pixel joint guided filter to suppress noise and retain edges, and finally outputs an enhanced denoised image; The contour extraction module fuses direction-aware multi-scale structural gradient, regional shape prior, and edge confidence response, and adaptively segments the main contour and micro-cracks of pharmaceutical particles through a hierarchical contour evolution model combined with a dynamic threshold strategy, generating an accurate segmentation mask; The defect analysis module, based on the multi-scale directional texture perception method guided by the boundary relative potential map, quantifies the gradient perturbation, structural discontinuity, and local contrast change in the defect area. By statistically fusing the nested texture, morphological, and spatial distribution features, a joint discriminant score is constructed, and a graph neural network (GNN) is introduced to model the spatial semantic relationship between regions, realizing the robust recognition and multi-class classification of tiny and weakly significant defects. The result output module annotates and visualizes the detection results, generates a traceable report containing defect scores, class labels, and spatial positions, and supports the quality traceability of pharmaceutical granules and automated sorting decisions.
[0020] Example 2, as Figure 2 shown, a pharmaceutical granule intelligent detection method based on image processing proposed by the present invention is applied to a pharmaceutical granule intelligent detection system proposed in Example 1, and its specific implementation steps are as follows: S1. The image acquisition module uses a high-resolution industrial camera combined with a polarized light source to dynamically capture pharmaceutical granules on the production line and obtain the original image I(x, y).
[0021] S2. The preprocessing module proposes a method for fusing multi-scale residual information extraction and structure-preserving adaptive filtering. By introducing methods for multi-scale residual information enhancement, structure-preserving denoising, and contrast-driven adjustment, the multi-scale residual signal is used as the core intermediate quantity for image enhancement, and a structure-guided method and an adaptive fusion strategy are fused to achieve the adaptive enhancement and denoising of pharmaceutical granule images under complex backgrounds and non-uniform noise conditions. The specific implementation process is as follows: S21. Based on the original image I(x, y), Gaussian blurred images at several scales are constructed to simulate different levels of structural information: ; where represents the two-dimensional Gaussian kernel function, and its standard deviation controls the degree of blurring, i = 1, 2,..., n; represents the two-dimensional convolution operation; n represents different blurring scales; represents the image blurred at scale ; S22. The original image and the blurred images at each scale are subjected to a difference operation to extract the detail residual information at the corresponding scale: ; Subsequently, the multi-scale residuals are weighted and fused to form an enhanced image: ; where represents the detail residual map at scale ; represents the corresponding scale The weight of the residual information under is dynamically adjusted according to the local texture energy of the image (variance is used in this embodiment) to avoid mis-enhancement of high-frequency noise. ; represents the image enhancement result after fusing multi-scale detail information; S23. To further improve the visual distinguishability of microstructures in the image, the local contrast normalization method is used to standardize the image: ; where, represents the standardized image after contrast adjustment; represents the neighborhood average value with a radius of r centered at the point (x, y); represents the neighborhood standard deviation with a radius of r centered at the point (x, y); represents a very small positive number used to prevent division by zero errors; It should be noted that the neighborhood with a radius of r centered at the pixel (x, y) means that r pixels need to be extended from the current pixel up, down, left, and right. Therefore: r rows are extended upward and r rows are extended downward, for a total of r + r + 1 = 2r + 1 rows; r columns are extended to the left and r columns are extended to the right, for a total of 2r + 1 columns. Therefore, the size of this neighborhood (local window) is: (2r + 1) × (2r + 1); S24. Use a structure-guided filter to remove random noise while retaining structural edges: ; ; where, represents the local window centered at the pixel p = (x, y) (a square window with a side length of 2r + 1 centered at (x, y)); represents the spatial-pixel value joint guidance weight; represents the standard deviation in the spatial domain used to control the decay of neighborhood weights; represents the standard deviation of pixel intensity differences, controlling the edge protection ability; represents the normalization factor; represents the natural exponential function; represents the denoised image; p represents the current pixel coordinate, p = (x, y); q represents the neighborhood pixel coordinate, q = (i, j); S25. Fuse the original image with the structure-preserving map to generate the final enhanced image: ; where, represents the final output image; represents the fusion weight coefficient, .
[0022] S3. The contour extraction module fuses the structural gradient, regional shape prior, and edge confidence response, and combines the region-guided + multi-scale contour response fusion + threshold evolution joint method. The specific implementation process is as follows: S31. Adopt a direction-aware multi-scale structural gradient extraction operator , and construct a structural response map: ; Among them, represents the specified main direction. In this embodiment, the set main directions are ; s represents the scale parameter, which controls the receptive field of the convolution kernel, ; represents the direction-scale structural gradient operator, which is composed of direction difference + Gaussian weight in this embodiment; represents the gradient response map at direction θ and scale s; Subsequently, fuse the multi-scale responses to obtain the main structural response map : ; S32. In view of the characteristics that the particle distribution in the image is relatively regular and the isolated region features are obvious, construct a local region prior map: ; Among them, represents the neighborhood centered at point (x, y) with a radius of r; and represent the average gray value and standard deviation of the neighborhood respectively; represents the regional shape prior response map; S33. Combine the main structural response map and the regional shape prior response map , and fuse them to obtain the edge confidence fusion map: ; Among them, represents the normalization function, which maps the value range to [0, 1]; represents the fusion weight of the edge and regional responses, ; represents the final edge confidence map, which comprehensively considers the edge strength and regional consistency; S34. Input the edge confidence map into the hierarchical contour evolution model, and adopt a dynamic threshold strategy for region segmentation: ; ; Among them, k represents the current segmentation level (including but not limited to the main contour, secondary contour, and microcrack); represents the segmentation mask of the k-th layer, and a value of 1 indicates belonging to the target of this layer; Denote the dynamic threshold under the k-th layer, based on the regional mean , the local texture variance is adaptively set as follows: Denote the segmentation sensitivity control parameter of the k-th layer.
[0023] S4. The defect analysis module, based on the multi-scale directional texture perception method guided by the boundary relative potential map, fuses the spatial gradient perturbation, directional structure discontinuity, and adaptive local contrast change in the defect area to achieve a sensitive texture expression for the tiny and weakly significant defect areas in the complex surface image. The specific implementation process is as follows: S41. Based on the segmentation mask , construct the relative potential field from each candidate region to its contour boundary to capture the texture attenuation trend towards the boundary inside the region: ; wherein, denote the boundary relative potential of the pixel point (x, y) in region k; denote the Euclidean distance from the point (x, y) to the corresponding region boundary; denote the Gaussian scale parameter controlling the distance attenuation speed; S42. In each region, calculate the local texture perturbation intensity along multiple directions to characterize the damage of potential defects to the direction consistency: ; wherein, I(x, y) denotes the gray value of the original image; denote the pixel offset corresponding to the direction θ; denote the texture perturbation intensity in the direction θ; Subsequently, calculate the comprehensive perturbation map : ; S43. Weightedly fuse the perturbation map with the relative potential map to introduce the regional potential into the texture perturbation modeling and form a texture enhancement feature map: ; wherein, denote the texture potential fusion map of region k, emphasizing the high potential defect positions with abnormal texture and close to the center inside the region; denote the potential weight adjustment factor, controlling the suppression degree of the perturbation response near the boundary, ; S44. Perform statistical coding on the texture fusion feature map k of each region S to extract the descriptors for subsequent defect recognition: ; ; wherein, represents the regional average perturbation intensity; represents the standard deviation, measuring the texture instability; represents the skewness, reflecting the bias of the texture distribution; represents the kurtosis, characterizing the texture central tendency; represents the regional-level defect-aware texture feature vector.
[0024] S5. The defect analysis module constructs a texture density mapping and collaborative threshold decision method based on irregular morphology coupling. By statistically nesting and fusing the texture response, spatial distribution deviation, and structural geometric morphology of the defect area at multiple levels, robust recognition of non-significant texture defects is carried out. The specific implementation process is as follows: S51. Construct a texture anomaly density mapping function: ; Among them, represents the normalized texture anomaly density index, and the larger the value, the more severe the texture anomaly; S52. Calculate the geometric morphology parameters of the area to evaluate its degree of structural irregularity: ; Among them, represents the perimeter of the area contour; represents the area of the area; represents the morphological heterogeneity, reflecting the complexity and irregularity of the area edge; S53. Construct a joint discriminant scoring function: ; Among them, represents the comprehensive defect score of the area; represents the collaborative weight of texture and morphology, ; S54. Construct a dynamic discriminant strategy based on score distribution statistics: ; ; Among them, and respectively represent the mean and standard deviation of all area scores ; represents the dynamic threshold; represents the final area defect discriminant label; When the recognized final area defect discriminant label is "abnormal", execute step S55 to identify the final defect category; otherwise, directly output the normal result of the current pharmaceutical particle; S55. A multi-class defect classification method based on graph structure. On the basis of texture-morphology joint modeling, a graph neural network (GNN) is introduced to capture the spatial semantic and texture structure dependencies between regions, realizing high-precision discrimination of multi-class defects in fine-grained pharmaceutical images and outputting the final defect categories.
[0025] S6. The result output module performs result annotation and visualization processing on the particles with identified defects, and outputs a traceable defect detection report, including but not limited to the regional comprehensive defect score, the final regional defect discrimination label and the defect category, which is convenient for statistics and quality traceability.
[0026] Example 2. An intelligent detection method for pharmaceutical particles proposed by the present invention further includes a multi-class defect classification method based on graph structure, and its specific implementation steps are as follows: A1. Construct a regional graph structure G=(V, E): Graph nodes V={ }: Each node corresponds to a suspected defect region extracted, and the node feature is : ; Among them, represents the normalized texture anomaly density index; represents the regional comprehensive defect score; represents the morphological heterogeneity; represents the contour compactness; represents the regional centroid coordinates, which are used for edge building and spatial constraints; Graph edge E construction: The strategy for constructing graph edges is the combined strategy of semantic space constraint + texture similarity: ; Among them, represents the Euclidean distance of the centroids of regions i and j; represents the cosine similarity; and respectively represent the spatial threshold and the similarity threshold; represents the edge between nodes i and j.
[0027] A2. Graph attention neural network classification and reasoning A multi-layer graph attention network (GAT) is used for node feature propagation and defect classification prediction: ; Among them, represents the representation of node k in the l+1 layer, initially ; represents the linear mapping matrix in the l-th layer; Denote the set of neighbor nodes of node k; Denote the attention weights; Denote the non-linear activation function. In this embodiment, the LeakyReLU activation function is adopted; The output of the final layer is the softmax classification probability vector : ; Among them, Denote the output of the nodes in the last layer of the GNN; Denote the probability that the node belongs to the c-th class.
[0028] A3. Determine the final defect category according to the maximum value of the classification probability vector output: ; ; Among them, Denote the final defect category of the region; Denote the defect confidence score.
[0029] The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited thereto. Within the scope of knowledge possessed by those skilled in the art to which the present invention pertains, various changes can be made without departing from the spirit of the present invention.
Claims
1. An intelligent detection method for pharmaceutical particles based on image processing, characterized in that, It includes the following specific implementation steps: S1. Collect the original images of the drug particles on the production line; S2. Extract the detail residuals by constructing multi-scale Gaussian blurred images, enhance the image micro-structure by weighted fusion of multi-scale residual information, improve the discrimination by combining local contrast normalization, use the spatial-pixel joint guided filter to suppress noise and retain edges, and finally generate an enhanced image through an adaptive fusion strategy; S3. Generate the main structure response map through the direction-aware multi-scale structure gradient, construct the edge confidence fusion map by combining the regional shape prior, use the hierarchical contour evolution model and the dynamic threshold strategy, adaptively adjust the segmentation threshold based on the regional mean and local texture variance, and output the segmentation mask; S4. Construct the boundary relative potential field based on the segmentation mask, calculate the multi-directional texture perturbation intensity, capture the damage of the defect to the direction consistency, generate the texture-enhanced feature map by weighted fusion of the perturbation map and the potential map, and extract the regional average perturbation intensity, standard deviation, skewness and kurtosis to construct the regional-level defect-aware texture feature vector; S5. Construct the texture anomaly density map and the morphological heterogeneity parameter, fuse the texture-morphology joint score, statistically discriminate the defect area based on the dynamic threshold, and use the multi-class defect classification method based on the graph structure to combine the graph neural network GNN to model the spatial semantic relationship between regions and identify the defect category; S6. Perform result annotation and visualization processing on the particles with identified defects, and output a traceable defect detection report.
2. The intelligent detection method for pharmaceutical particles based on image processing according to claim 1, wherein The enhancement process of enhancing the image micro-structure by weighted fusion of multi-scale residual information is as follows: S21. Based on the original image I(x, y), construct Gaussian blurred images of several scales : ; Among them, represents a two-dimensional Gaussian kernel function, whose standard deviation controls the degree of blurring, where i = 1, 2, …, n; represents a two-dimensional convolution operation; n represents different blurring scales; represents the blurred image at scale S22. Perform a difference operation on the original image and the blurred images at each scale to extract the detail residual information at the corresponding scale: ; Subsequently, the multi-scale residuals are weighted and fused to form an enhanced image: ; Among them, represents the detailed residual map at scale ; represents the residual information weight corresponding to scale ; ; represents the image enhancement result after fusing multi-scale detailed information.
3. The intelligent detection method for pharmaceutical particles based on image processing according to claim 2, characterized in that, The enhancement process of generating an enhanced image through an adaptive fusion strategy is as follows: B1. Standardize the image using the local contrast normalization method: ; in, represents the normalized image after contrast adjustment; Represents the average value of the neighborhood with radius r and centered at point (x, y); Represents the standard deviation of the neighborhood with radius r and centered at point (x, y); Represents a very small positive number; B2. Use the structure-guided filter to remove random noise but retain the structural edges: ; ; Among them, represents a local window centered on the pixel p = (x, y); represents the spatial-pixel value joint guidance weight; represents the standard deviation in the spatial domain; represents the standard deviation of the pixel intensity difference; represents the normalization factor; represents the natural exponential function; represents the denoised image; p represents the current pixel coordinates, p = (x, y); q represents the neighborhood pixel coordinates, q = (i, j); B3. Fuse the original image and the structure-preserving map to generate the final enhanced image: ; Among them, represents the final output image; represents the fusion weight coefficient, .
4. An intelligent detection method for pharmaceutical particles based on image processing according to claim 3, characterized in that, The generation process of the edge confidence fusion map is as follows: S31. Adopt a direction-aware multi-scale structure gradient extraction operator , and construct a structure response map: ; Among them, represents the specified main direction; s represents the scale parameter, ; represents the direction-scale structure gradient operator; represents the gradient response map at direction θ and scale s; Subsequently, the multi-scale responses are fused to obtain the main structure response map : ; S32. Construct a local region prior map: ; Among them, represents a neighborhood centered at the point (x, y) with a radius r; and respectively represent the average gray value and the standard deviation of the neighborhood; represents the prior response map of the region shape; S33. Combine the main structure response map with the regional shape prior response map , and fuse them to obtain the edge confidence fusion map: ; Among them, represents a normalization function that maps the value range to [0, 1]; represents the fusion weight of the edge and region responses, ; represents the final edge confidence map.
5. The intelligent detection method for pharmaceutical particles based on image processing according to claim 4, characterized in that, The segmentation process of the segmentation mask is as follows: Input the edge confidence map into the hierarchical contour evolution model and perform region segmentation using a dynamic threshold strategy: ; ; where k represents the current segmentation level; represents the segmentation mask of the k-th layer, and a value of 1 indicates belonging to the target of that layer; represents the dynamic threshold under the k-th layer, which is adaptively set based on the regional mean , local texture variance : represents the segmentation sensitivity control parameter of the k-th layer.
6. The intelligent detection method for pharmaceutical particles based on image processing according to claim 5, characterized in that, The construction process of the regional-level defect-aware texture feature vector is as follows: S41. Based on the segmentation mask , construct the relative potential field from each candidate region to its contour boundary to capture the texture attenuation trend inside the region towards the boundary: ; Among them, represents the boundary relative potential of the pixel point (x, y) in region k; represents the Euclidean distance from the point (x, y) to the corresponding region boundary; represents the Gaussian scale parameter that controls the distance decay rate; S42. In each region, calculate the local texture perturbation intensity in multiple directions: ; Among them, I(x, y) represents the gray value of the original image; represents the pixel offset corresponding to the direction θ; represents the texture perturbation intensity in the direction θ; Subsequently, the comprehensive disturbance map is calculated : ; S43. Combine the perturbation map with the relative potential map through weighted fusion, introduce the regional potential into the texture perturbation modeling, and form a texture enhanced feature map: ; Among them, represents the texture potential fusion map of region k; represents the potential weight adjustment factor, ; S44. Perform statistical coding on the texture fusion feature map of each region S k : ; ; Among them, represents the regional average perturbation intensity; represents the standard deviation; represents the skewness; represents the kurtosis, characterizing the texture central tendency; represents the regional-level defect-aware texture feature vector.
7. The intelligent detection method for pharmaceutical particles based on image processing according to claim 6, characterized in that, The identification process of the defect area is as follows: S51. Construct a texture anomaly density mapping function: ; Among them, represents the normalized texture abnormality density index; S52. Calculate the geometric shape parameters of the calculation area: ; Among them, represents the perimeter of the region contour; represents the area of the region; represents the morphological isomerism degree; S53. Construct a joint discrimination scoring function: ; Among them, represents the regional comprehensive defect score; represents the collaborative weight of texture and morphology, ; S54. Construct a dynamic discrimination strategy based on score distribution statistics: ; ; Among them, and respectively represent the mean and standard deviation of all regional scores ; represents the dynamic threshold; represents the final regional defect discrimination label; When the final regional defect discrimination label identified is "abnormal", perform the multi-class defect classification method based on the graph structure to identify the final defect category; otherwise, directly output the normal result of the current drug particle.
8. An intelligent detection method for pharmaceutical particles based on image processing according to claim 7, characterized in that, The implementation process of the multi-class defect classification method based on the graph structure is as follows: A1. Construct the regional graph structure G=(V,E): Graph node V = { }: Each node corresponds to the extracted defect area, and the node feature is :[[]]END]] ; Among them, represents the normalized texture anomaly density index; represents the regional comprehensive defect score; represents the morphological isomerism degree; represents the contour compactness; represents the regional centroid coordinates; Construction of graph edge E: The strategy for constructing graph edges is the joint strategy of semantic space constraint + texture similarity: ; Among them, represents the Euclidean distance of the centroids of regions i and j; represents the cosine similarity; and respectively represent the spatial threshold and the similarity threshold; represents the edge between nodes i and j; A2. Graph attention neural network classification inference Use a multi-layer graph attention network for node feature propagation and defect classification prediction: ; Among them, represents the representation of node k at the (l + 1)-th layer, initially ; represents the linear mapping matrix at the l-th layer; represents the set of neighbor nodes of node k; represents the attention weight; represents the LeakyReLU activation function; The output of the final layer is a softmax classification probability vector : ; Among them, represents the output of the last layer of nodes in the GNN; represents the probability that the node belongs to the c-th class; A3. Determine the final defect category based on the maximum value output from the classification probability vector Output: ; ; Among them, represents the final defect category of the area; represents the defect confidence score.
9. The intelligent detection method for pharmaceutical particles based on image processing according to claim 4, characterized in that, The established main direction θ includes .
10. An intelligent detection system for pharmaceutical particles based on image processing, which is used to execute an intelligent detection method for pharmaceutical particles based on image processing according to any one of claims 1 to 9, characterized in that, It includes: An image acquisition module for collecting the original images of the drug particles on the production line; A preprocessing module for using the multi-scale residual information enhancement and structure-preserving adaptive filtering method to dynamically fuse different-scale residual signals, use local contrast normalization to improve the discrimination of micro-structures, combine the spatial-pixel joint guided filter to suppress noise and retain edges, and finally output the enhanced denoised image; The contour extraction module is used to fuse the multi-scale structural gradient with direction perception, regional shape prior, and edge confidence response. By combining a hierarchical contour evolution model with a dynamic threshold strategy, it adaptively segments the main contour of the drug particles and microcracks to generate a segmentation mask. The defect analysis module is used to quantify the gradient perturbation, structural discontinuity, and local contrast change in the defect area based on a multi-scale direction texture perception method guided by the boundary relative potential map. By statistically nesting and fusing texture, morphological, and spatial distribution features to construct a joint discriminant score, and introducing a graph neural network to model the spatial semantic relationship between regions, it realizes the robust recognition and multi-class classification of tiny and weakly significant defects. The result output module is used to label and visualize the detection results, generate a traceable report containing defect scores, class labels, and spatial positions, and support the quality traceability of drug particles and automated sorting decisions.
Citation Information
Patent Citations
Debris detection and removal device and method
CN118527377B
Nuclear power pipeline defect detection method based on multi-scale pyramid structure
CN111899225A
Small-scale pedestrian target rapid super-resolution method for intelligent roadside equipment
CN112132746A
Bearing fault diagnosis method based on EEMD-MSE and multi-scale one-dimensional convolutional neural network
CN112834221A
Packaging box soft edge flaw detection method and device
CN114066809A
Cited By
Calcium carbonate master batch wind shear forming detection system based on machine vision
CN120404499A
Computer vision image processing method based on artificial intelligence
CN120495100A
Part defect identification and detection method and system based on image model
CN120953679A
Coal granularity analysis method and system in intelligent coal preparation process based on machine vision
CN121169921A
Intelligent coal preparation process coal particle size analysis method and system based on machine vision
CN121169921B