Quality detection method and system for coated controlled release tablets
By combining traditional image processing and deep learning technology, Hough circle transformation and improved YOLOv8 model are used to detect concentric circles and side damage of coated controlled release tablets, solving the problem of inefficiency of traditional detection methods, achieving efficient and accurate quality detection, and improving the pass rate and safety of tablet production.
Patent Information
- Application Number
- CN202510615782.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-14
- Publication Date
- 2025-08-22
Smart Images

Figure CN120522191A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial detection technology, and in particular to a quality detection method and system for film-coated controlled-release tablets. Background Art
[0002] During the production process of coated controlled-release tablets, quality factors such as their shape and coating integrity are crucial to the efficacy and safety of the drug. Traditional quality inspection methods for coated controlled-release tablets are often labor-intensive and resource-intensive, and suffer from low efficiency and insufficient detection accuracy, making it difficult to meet the high-speed, high-precision inspection requirements of modern pharmaceutical production lines. For example, when inspecting concentric circles on coated controlled-release tablets, existing technologies are prone to misjudgment when dealing with edge burrs and reflections after coating cutting. Detecting damage to the sides of coated controlled-release tablets and identifying fine cracks or dents is more difficult, and it is difficult to balance inspection speed and system resource consumption while ensuring accuracy. Summary of the Invention
[0003] In response to the shortcomings of the existing technology, the present invention combines traditional image processing and deep learning technology to perform quality inspection of film-coated controlled-release tablets, significantly improving the inspection efficiency and accuracy.
[0004] In order to achieve the above object, the present invention proposes a method for detecting the quality of film-coated controlled-release tablets, comprising the following steps:
[0005] (1) Collecting front and side images of film-coated controlled-release tablets;
[0006] (2) performing image preprocessing on the front image and the side image;
[0007] (3) Construct a detection model that combines concentric circle detection and side damage detection to perform quality inspection on the preprocessed images;
[0008] The concentric circle detection adopts Hough circle transform and edge detection algorithm, and the side damage detection adopts the improved YOLOv8 model.
[0009] Furthermore, Gaussian blur and morphological operations are applied to both the front image and the side image.
[0010] Furthermore, the concentric circle detection is specifically as follows:
[0011] (3.1) For the pre-processed front image, if it is in color, grayscale processing is performed on it to convert it into a grayscale image;
[0012] (3.2) Using an edge detection algorithm to extract edge pixels of the inner circle of the film-coated controlled-release tablet, a binary edge map is obtained;
[0013] (3.3) Use Hough circle transform on the binary edge map, determine the center and radius of the circle through the cumulative value of the parameter space, and count the parameters with the highest frequency as the final center and radius of the inner circle;
[0014] (3.4) Based on the center and radius of the inner circle obtained in step (3.3), an outer circle annular mask region is established based on the inner circle, with the center of the inner circle as the center of the region. The inner radius of the annular mask region is n1 times the radius of the inner circle, and the outer radius is n2 times the radius of the inner circle, where n2>n1;
[0015] (3.5) Repeat steps (3.2) to (3.3) within the annular mask area to obtain the center and radius of the outer circle of the film-coated controlled-release tablet;
[0016] (3.6) Calculate the distance between the center of the outer circle and the center of the inner circle of the film-coated controlled-release tablet and compare it with the preset threshold. If it is less than the preset threshold, it is considered a good product, otherwise it is a defective product.
[0017] Furthermore, the inner circle of the film-coated controlled-release tablet is the inner tablet edge, and the outer circle of the film-coated controlled-release tablet is the coating edge.
[0018] Furthermore, the improved YOLOv8 model is to replace the SPPF layer of its Backbone with an enhanced SPPF layer, and replace the FPN / PAN in the Neck network layer with a BiFPN module;
[0019] The enhanced SPPF adds a small-scale pooling unit with a pooling kernel of 3×3 based on the 5×5, 9×9, and 13×13 pooling kernels of the original SPPF. At the same time, it introduces a compressed excitation channel attention mechanism, assigns different weights to different channels, and adopts a weight-adaptive feature fusion strategy for splicing, replacing the original Concat module.
[0020] Furthermore, the side damage detection is specifically as follows:
[0021] The preprocessed side image is input into the trained improved YOLOv8 model, which outputs the location, type, and confidence of the damage. The output confidence is compared with the predefined confidence. If the confidence is higher than the predefined confidence, it is judged as a defective product, otherwise it is judged as a good product.
[0022] Furthermore, the training of the improved YOLOv8 model is specifically as follows:
[0023] Obtain a side image dataset and apply data augmentation such as rotation change, contrast enhancement, and brightness adjustment to it to increase sample diversity, and annotate the enhanced side image dataset;
[0024] The annotated side image dataset is input into the improved YOLOv8 model for training and verified based on the cross-validation method, with detection accuracy as the evaluation indicator.
[0025] Furthermore, the construction of a detection model combining concentric circle detection and side damage detection to perform quality detection on the preprocessed image is specifically as follows:
[0026] Perform concentric circle detection on the pre-processed image. If it is determined to be defective, the detection ends and the output detection result is defective.
[0027] If it is determined to be a good product, a side damage detection is performed. If it is determined to be a defective product, the detection result is output as a defective product; if it is determined to be a good product, the detection result is output as a good product.
[0028] The present invention also provides a film-coated controlled-release tablet quality detection system, comprising:
[0029] An image acquisition module, used to acquire front and side images of the film-coated controlled-release tablet;
[0030] An image preprocessing module, configured to perform image preprocessing on the front image and the side image;
[0031] Image detection module, used to build a detection model that combines concentric circle detection and side damage detection to perform quality inspection on pre-processed images;
[0032] The data storage module is used to store the collected front and side images, detection results and related detection parameter data.
[0033] Beneficial effects of the present invention:
[0034] This invention employs a two-stage screening mechanism: first, using traditional image processing methods (concentric circle detection) to cost-effectively filter out obvious defects, and then invoking a deep learning method (YOLOv8 side damage detection) to address complex defects. This optimizes resource allocation, improves detection efficiency and accuracy, and reduces the overall computational cost and resource consumption of the system. This leverages the advantages of both methods, achieving a "1+1>2" effect. For example, while reducing the model's computational complexity, it also improves the ability to detect tablet quality defects. Compared to existing solutions that rely solely on a single method, this method is significantly more innovative. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 The figure is a schematic flow chart of the quality inspection method for film-coated controlled-release tablets according to an embodiment of the present invention.
[0036] Figure 2 This is a schematic diagram of a film-coated controlled-release tablet according to an embodiment of the present invention.
[0037] Figure 3 Schematic diagram of an image acquisition device according to an embodiment of the present invention.
[0038] Figure 4 Schematic diagram of the existing YOLOv8 model structure in an embodiment of the present invention.
[0039] Figure 5 This is a schematic diagram of the improved YOLOv8 model structure according to an embodiment of the present invention.
[0040] Figure 6 Schematic diagram of the existing SPPF / enhanced SPPF structure of an embodiment of the present invention.
[0041] Figure 7 Schematic diagram of the structure of the bidirectional feature pyramid network (BiFPN) according to an embodiment of the present invention
[0042] Figure 8 The figure is a schematic structural diagram of a quality detection system for film-coated controlled-release tablets according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The present invention will be further explained and illustrated below with reference to the accompanying drawings and embodiments.
[0044] like Figure 1 As shown, the present invention provides a method for detecting the quality of film-coated controlled-release tablets, comprising the following steps:
[0045] S101. Collect front and side images of the film-coated controlled-release tablet.
[0046] The film-coated controlled-release tablets of the present invention are formed by coating the upper and lower films. Figure 2 The diameter of the inner tablet of this controlled-release tablet is required to be 12mm, and the overall diameter of the coated controlled-release tablet is required to be 16mm.
[0047] Image acquisition is done using Figure 3 The acquisition device shown in the figure uses a Basler acA2400-20gm industrial-grade camera 2 with a resolution of at least 5 megapixels to meet the accuracy requirement of 0.0270 ± 1% mm / pixel per side for a 12 mm diameter controlled-release tablet. It is equipped with a ring light source 3 (6000K color temperature, adjustable brightness). The coated controlled-release tablet is fixed to a bottom light source 4 (6000K color temperature, adjustable brightness), both of which are fixed to the stage. The position of the ring light source and camera is adjusted using the displacement knob 1 to ensure that the light source and camera are coaxial to eliminate surface reflections on the controlled-release tablet. The top displacement knob 1 is then used to adjust the camera height to ensure that the lens is focused on the coated controlled-release tablet surface. After being fixed, front and side images are acquired. The stage rotation step is set to 90° to ensure that the side image covers the entire circumference.
[0048] S102: Perform image preprocessing on the front image and the side image.
[0049] Preprocessing steps such as Gaussian blur and morphological operations are used for both front and side images to deal with edge burrs, reflections, or adhesions after cutting of coated controlled-release tablets, thereby reducing misjudgment.
[0050] For the side image, lighting equalization processing is also required to enhance the contrast between the damaged area and the background.
[0051] S103: Construct a detection model that combines concentric circle detection and side damage detection to perform quality detection on the preprocessed image.
[0052] Concentric circle detection: Based on OpenCV's Hough circle transform and edge detection algorithm (edge detection operator + contour analysis), the front image of the coated controlled-release tablet is processed to locate the main body of the coated controlled-release tablet (inner circle) and the coating edge (outer circle), calculate the coordinates and distance of the circle center, and convert the 0.5mm accuracy threshold into pixel units for judgment to determine whether the concentric circle features of the coated controlled-release tablet meet the quality requirements. The specific process is as follows:
[0053] (1) For the pre-processed front image, if it is in color, it is gray-scale processed to become a gray-scale image.
[0054] (2) The edge detection algorithm is used to extract the edge pixel points of the inner circle of the film-coated controlled-release tablets to obtain a binary edge map.
[0055] (3) Hough circle transform is used for the binary edge map. The center and radius of the circle are determined by the cumulative value of the parameter space. The parameter with the highest frequency of occurrence is counted as the final center and radius of the inner circle.
[0056] For each edge point in the binary edge map, the possible radius values are traversed along the gradient direction, the corresponding circle center coordinates are accumulated in the parameter space, and each possible circle result is voted in the accumulator. Finally, the result with the highest number of votes represents the potential circle.
[0057] (4) According to the center and radius of the inner circle obtained in step (3), an outer circle annular mask area based on the inner circle is established, with the center of the inner circle as the center of the area. The radius in the annular mask area is n1 times the radius of the inner circle, and the outer radius is n2 times the radius of the inner circle, where n2>n1;
[0058] In the embodiment of the present invention, n2=1.4, n1=1.03.
[0059] (5) Repeat steps (2)-(3) within the annular mask area to obtain the center and radius of the outer circle of the film-coated controlled-release tablet.
[0060] (6) Calculate the distance between the center of the outer circle and the center of the inner circle of the film-coated controlled-release tablet and compare it with the preset threshold. If it is less than the preset threshold, it is considered to be a good product, otherwise it is a defective product.
[0061] Side damage detection: An improved YOLOv8 model is used to detect damage on the side images of coated controlled-release tablets. Side damage may manifest as fine cracks or wrinkles caused by the lamination process. The specific detection algorithm is as follows: pre-processed side images are input into the trained improved YOLOv8 model, which outputs the location, type, and confidence level of the damage. The output confidence level is compared with a pre-defined confidence level. If the confidence level exceeds the pre-defined confidence level, the tablet is judged as defective; otherwise, it is judged as good.
[0062] like Figure 5 As shown, the improved YOLOv8 model is based on the YOLOv8 model (such as Figure 4 As shown in the figure, the SPPF layer of its Backbone is replaced with the enhanced SPPF layer, and the FPN / PAN in the Neck network layer is replaced with the BiFPN module to improve the detection accuracy.
[0063] like Figure 6 As shown in the figure, the enhanced SPPF layer improves its ability to extract small target features mainly through three key technical improvements. First, the pooling variant structure is expanded. Based on the original 5×5, 9×9, and 13×13 pooling kernels, a 3×3 small-scale pooling unit is added, effectively retaining more detailed information and texture features of small targets. Second, a compressed excitation (SE) channel attention mechanism is introduced, which assigns different weights to different channels, enabling the model to adaptively focus on key channels containing small target information and suppress redundant feature interference. Finally, a weighted adaptive feature fusion strategy is implemented to replace the original simple feature splicing method. The contribution ratio of features at different scales is dynamically adjusted through learnable parameters, optimizing the integration process of multi-scale features. This series of improvements enables the SPPF layer to significantly improve the perception and detection accuracy of small targets such as minor damage on the side of a tablet while maintaining computational efficiency.
[0064] like Figure 7As shown in the figure, the bidirectional feature pyramid network (BiFPN) structure replaces the original FPN / PAN feature fusion mechanism. This layer realizes bidirectional information flow interaction from top to bottom and bottom to top by constructing a bidirectional cross-scale connection with weighted feature fusion. The core design includes learnable weight coefficients, which enable the network to adaptively adjust the importance of feature maps of different resolutions, effectively solving the problem that small target features are easily diluted by high-level semantic information in traditional feature pyramids. BiFPN adopts a multi-layer stacking structure (3 layers) to form a deep feature fusion network, and realizes more refined multi-scale representation learning through repeated feature interactions. At the same time, deep separable convolution is used to optimize computational efficiency, maintaining inference speed while improving performance. This improvement enables the model to have stronger detection sensitivity and positioning accuracy for small target defects such as tiny damage and cracks on the side of film-coated controlled-release tablets.
[0065] The training of the improved YOLOv8 model is as follows:
[0066] A side image dataset is obtained and data augmentation such as rotation change, contrast enhancement, and brightness adjustment is applied to it to expand sample diversity. The enhanced side image dataset is then annotated.
[0067] The annotated side image dataset is input into the improved YOLOv8 model for training and verified based on the cross-validation method, with detection accuracy as the evaluation indicator.
[0068] In practical applications, the method of the present invention has been tested in a pharmaceutical factory and has been shown to increase the system yield to 99.5%, with a false detection rate of less than 0.1%. The method has high practicality and can meet the strict requirements of modern pharmaceutical production lines for tablet quality testing while greatly reducing manpower. This helps to improve the qualified rate of tablet production and ensure the quality and safety of drugs.
[0069] like Figure 8 As shown, the present invention provides a film-coated controlled-release tablet quality detection system, comprising:
[0070] The image acquisition module 810 is used to acquire the front image and the side image of the film-coated controlled-release tablet.
[0071] The image preprocessing module 820 is used to perform image preprocessing on the front image and the side image.
[0072] The image detection module 830 is used to construct a detection model that combines concentric circle detection and side damage detection to perform quality detection on the pre-processed image.
[0073] The data storage module 840 is used to store the collected front and side images, detection results, and related detection parameter data.
[0074] The above specific description further illustrates the purpose, technical solutions and beneficial effects of the invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for testing the quality of film-coated controlled-release tablets, characterized in that: The steps include: (1) Collecting front and side images of film-coated controlled-release tablets; (2) performing image preprocessing on the front image and the side image; (3) Construct a detection model that combines concentric circle detection and side damage detection to perform quality inspection on the preprocessed images; The concentric circle detection adopts Hough circle transform and edge detection algorithm, and the side damage detection adopts the improved YOLOv8 model.
2. The method for quality inspection of film-coated controlled-release tablets according to claim 1, characterized in that: The preprocessing specifically includes: applying Gaussian blur and morphological operations to both the front image and the side image.
3. The method for quality inspection of film-coated controlled-release tablets according to claim 1, characterized in that: The concentric circle detection is specifically as follows: (3.1) For the pre-processed front image, if it is in color, grayscale processing is performed on it to convert it into a grayscale image; (3.2) Using an edge detection algorithm to extract edge pixels of the inner circle of the film-coated controlled-release tablet, a binary edge map is obtained; (3.3) Use Hough circle transform on the binary edge map, determine the center and radius of the circle through the cumulative value of the parameter space, and count the parameters with the highest frequency as the final center and radius of the inner circle; (3.4) Based on the center and radius of the inner circle obtained in step (3.3), an outer circle annular mask region is established based on the inner circle, with the center of the inner circle as the center of the region. The inner radius of the annular mask region is n1 times the radius of the inner circle, and the outer radius is n2 times the radius of the inner circle, where n2>n1; (3.5) Repeat steps (3.2) to (3.3) within the annular mask area to obtain the center and radius of the outer circle of the film-coated controlled-release tablet; (3.6) Calculate the distance between the center of the outer circle and the center of the inner circle of the film-coated controlled-release tablet and compare it with the preset threshold. If it is less than the preset threshold, it is considered a good product, otherwise it is a defective product.
4. The method for quality inspection of film-coated controlled-release tablets according to claim 1, wherein: The inner circle of the film-coated controlled-release tablet is the inner tablet edge, and the outer circle of the film-coated controlled-release tablet is the coating edge.
5. The method for quality inspection of film-coated controlled-release tablets according to claim 1, wherein: The improved YOLOv8 model replaces the SPPF layer of its Backbone with an enhanced SPPF layer, and replaces the FPN / PAN in the Neck network layer with a BiFPN module. The enhanced SPPF adds a 3×3 small-scale pooling unit to the 5×5, 9×9, and 13×13 pooling cores of the original SPPF, and introduces a compressed excitation channel attention mechanism to assign different weights to different channels. It also adopts a weight-adaptive feature fusion strategy for splicing, replacing the original Concat module.
6. The method for quality inspection of film-coated controlled-release tablets according to claim 1, characterized in that: The side damage detection is specifically as follows: The preprocessed side image is input into the trained improved YOLOv8 model, which outputs the location, type, and confidence of the damage. The output confidence is compared with the predefined confidence. If the confidence is higher than the predefined confidence, it is judged as a defective product, otherwise it is judged as a good product.
7. The method for quality inspection of film-coated controlled-release tablets according to claim 6, characterized in that: The training of the improved YOLOv8 model is specifically as follows: Obtain a side image dataset and apply data augmentation such as rotation change, contrast enhancement, and brightness adjustment to it to increase sample diversity, and annotate the enhanced side image dataset; The annotated side image dataset is input into the improved YOLOv8 model for training and verified based on the cross-validation method, with detection accuracy as the evaluation indicator.
8. The method for quality inspection of film-coated controlled-release tablets according to claim 1, wherein: The construction of the detection model combining concentric circle detection and side damage detection to perform quality detection on the pre-processed image is specifically as follows: Perform concentric circle detection on the pre-processed image. If it is determined to be defective, the detection ends and the output detection result is defective. If it is determined to be a good product, a side damage test is performed; if it is determined to be a defective product, the test result is output as a defective product; If it is judged to be a good product, the output test result is good product.
9. A quality inspection system for film-coated controlled-release tablets, characterized in that: include: An image acquisition module, used to acquire front and side images of the film-coated controlled-release tablet; An image preprocessing module, configured to perform image preprocessing on the front image and the side image; Image detection module, used to build a detection model that combines concentric circle detection and side damage detection to perform quality inspection on pre-processed images; The data storage module is used to store the collected front and side images, detection results and related detection parameter data.