Tablet identification method and system based on machine learning

By combining convolutional neural networks with integrated learning tablet recognition framework, combining weight information and multi-light source image acquisition, image preprocessing is optimized, and the complex environmental adaptability, insufficient data set and real-time problems of tablet detection in the prior art are solved, and high-precision and efficient tablet defect detection are achieved.

CN120279544APending Publication Date: 2025-07-08GUANGDONG JINHAIKANG MEDICAL NUTRITION PRODUCTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510364467.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The existing tablet automated detection technology has limitations in the face of complex production environments, insufficient data sets, insufficient identification of small defects and poor real-time performance, and it is difficult to meet the efficient detection needs of industrial production.

Method used

The tablet recognition framework based on convolutional neural network and integrated learning is adopted, combining tablet weight information and multi-light image acquisition, preliminary and secondary recognition is performed through deep learning models, image preprocessing and light source design are optimized, and high-precision and real-time tablet defect detection are achieved.

Benefits of technology

It improves the accuracy of identification of small defects, enhances the robustness and real-time nature of the system, meets the efficient detection needs of industrial production lines, and reduces missed inspections and misjudgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120279544A_ABST
    Figure CN120279544A_ABST
Patent Text Reader

Abstract

The invention discloses a tablet identification method and system based on machine learning, and the method comprises the steps: collecting a tablet image, carrying out the cutting, denoising, enhancement and normalization processing of the tablet image, and obtaining a preprocessed image; based on a deep learning neural network model and in combination with tablet weight information, tablet defects are preliminarily identified and classified, and tablets with tiny defects are obtained; training a tablet recognition framework based on a convolutional neural network and ensemble learning to obtain a recognition model, and performing secondary recognition on tablets with tiny defects through the recognition model to obtain a target classification recognition result; and outputting a target classification and recognition result to an assembly line control system through an interface to realize automatic sorting. According to the method, image data and weight information are combined for double recognition, integrated learning and deep learning are introduced to be combined, the recognition capability of tiny defects is greatly improved, and therefore the defect recognition precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of tablet identification and classification in pharmaceutical production and processing, and in particular relates to a tablet identification method and system based on machine learning. Background Art

[0002] Tablets are one of the common solid dosage forms in the pharmaceutical and health care industries, and quality control during their production is crucial. During the tablet production process, various defects may occur due to factors such as raw materials, equipment, and operation. Common defects include black spots, missing edges and corners, cracks, powder sticking to the mold, etc. These defects may directly affect the quality of the tablets, and then affect the efficacy or use effect. In order to ensure that the tablets produced meet the standards and quality requirements, online automated detection of tablets has become an urgent problem to be solved.

[0003] At present, there are mainly the following technical solutions for automated tablet detection:

[0004] (1) Traditional visual inspection system: This solution uses a camera and a light source to collect tablet images and judges the appearance quality of tablets based on image processing techniques (such as edge detection, morphological processing, etc.). Although this method has been applied to some tablet production processes, it mainly relies on traditional image processing algorithms and has limited recognition capabilities for some complex defects (such as tiny cracks, texture changes, etc.). In addition, it is prone to misjudgment or missed detection in complex backgrounds or unstable lighting conditions.

[0005] (2) Image recognition based on machine learning: In recent years, with the development of deep learning, especially convolutional neural networks (CNN), image recognition technology has been widely used in tablet inspection. By training the CNN model, the system can automatically learn features from tablet images and identify various defects. However, these methods face the problem of insufficient data sets. Especially when labeled data is difficult to obtain, the model is prone to overfitting and poor generalization ability, resulting in limited recognition accuracy in practical applications.

[0006] (3) Ensemble learning method: Ensemble learning improves the accuracy and robustness of recognition by combining the prediction results of multiple models. Compared with a single model, ensemble learning can better leverage the advantages of different models, thereby improving the generalization ability and accuracy of the system. In tablet recognition, some studies have adopted ensemble learning strategies to improve recognition results. However, ensemble learning also has the problem of large computational complexity and requires higher computing resources, which may become a bottleneck in large-scale production.

[0007] (4) Weight and image combined recognition: To improve the recognition accuracy, some advanced solutions also combine the weight information of tablets with image data. By integrating a high-precision metering module with an image acquisition device, the system can effectively reduce errors in image processing and enhance the quality recognition ability of tablets. This method has obvious advantages especially in the recognition of tiny defects, but it requires the simultaneous acquisition of image and weight data, increasing the complexity of the system.

[0008] Although the existing technical solutions have achieved automated detection of tablets to a certain extent, there are still several limitations in practical applications:

[0009] (1) Limitations of image processing: Traditional visual detection methods often struggle to cope with complex production environments, such as factors like different lighting and background changes, which easily lead to missed detections and misjudgments in tablet recognition. As the production scale expands, the impact of environmental factors on recognition accuracy becomes more significant.

[0010] (2) Dataset and training issues: Deep learning models usually require a large amount of high-quality labeled data for training, which may be difficult to obtain in practical applications. Especially with a wide variety of tablet defect types and significant differences in the appearance of tablets from different production batches, obtaining a sufficient and diverse dataset poses a major challenge. In addition, the data annotation work also requires a large amount of manual intervention, increasing the development and maintenance costs of the system.

[0011] (3) Insufficient recognition of tiny defects: Although existing detection systems can identify larger defects (such as cracked tablets, missing corners, etc.), the recognition accuracy for some tiny defects (such as small black dots, microcracks, etc.) is relatively low. Since these defects may exhibit very fine and local features on the tablet surface, traditional image processing and relatively shallow machine learning models are difficult to effectively capture these details.

[0012] (4) Real-time issues: In industrial large-scale production, the real-time requirement of the automated detection system is very high. Existing deep learning models, especially when processing high-resolution images, have a large amount of calculations, which may result in a slow recognition speed. This delay may affect the overall efficiency of the system on the production line and cannot meet the needs of high-efficiency production. Summary of the Invention

[0013] To solve the above technical problems, the present invention provides a machine learning-based tablet recognition method and system. Among them, a machine learning-based tablet recognition method includes:

[0014] Collect a tablet image, and perform cropping, denoising, enhancement, and normalization processing on the tablet image to obtain a preprocessed image;

[0015] Based on a deep learning neural network model and combined with tablet weight information, initially identify and classify tablet defects to obtain tablets with minor defects;

[0016] Train an identification model based on a convolutional neural network and ensemble learning framework. Through the identification model, perform secondary identification on tablets with minor defects to obtain the target classification and identification results;

[0017] Output the target classification and identification results to the pipeline control system through an interface to achieve automatic sorting.

[0018] Preferably, the process of collecting tablet images includes:

[0019] Install a CCD industrial camera above the horizontal transfer workbench. Place the tablets on the surface of the horizontal transfer workbench. While collecting multi-angle and multi-feature images of the tablets through a bar light source and a point light source in cooperation with the CCD industrial camera, measure the weight of the tablets and preliminarily determine whether there are problems such as black spots, missing corners, and cracks on the appearance of the current tablets;

[0020] Among them, the bar light source is used to eliminate the influence of ambient light and highlight the features of the tablets when cooperating with the CCD industrial camera to capture tablet images;

[0021] The point light source is used to illuminate the tablets and characterize the defects of local micro-features of the tablets.

[0022] Preferably, the process of collecting multi-angle and multi-feature images of the tablets through a bar light source and a point light source in cooperation with the CCD industrial camera includes:

[0023] First, turn on the bar light source to illuminate the entire morphology of the tablets. After the preliminary judgment by the vision system, if the range of missing corners of the tablets is greater than the preset threshold, there is no need to turn on the point light source for illumination;

[0024] If there are no obvious defects on the appearance of the tablets, turn on the point light source to illuminate the tablets for minor defects to characterize the defects of local micro-features of the tablets;

[0025] Among them, the bar light source includes a primary bar light source and a secondary bar light source. The bottom of the tablets is illuminated by the primary bar light source, and the top of the tablets is illuminated by the secondary bar light source; at the same time, by adjusting the light source angles of the primary bar light source and the secondary bar light source, irradiate from different angles and adjust the light entering the lens.

[0026] Preferably, the process of cropping, denoising, enhancing, and normalizing the tablet images to obtain the preprocessed images includes:

[0027] Extract the region of interest from the tablet image and remove background interference to obtain a region that retains the key features of the tablet;

[0028] Perform data augmentation on the region that retains the key features of the tablet to obtain an image after data augmentation processing; the data augmentation processing includes horizontal flipping, vertical flipping, and random rotation;

[0029] Uniformly adjust the image after data augmentation processing to a size of 380×380×3, and then perform normalization processing to scale the pixel values to the range of [0, 1] to obtain a preprocessed image.

[0030] Preferably, based on a deep learning neural network model and combined with tablet weight information, the process of preliminarily identifying and classifying tablet defects to obtain tablets with minor defects includes:

[0031] Based on a deep learning neural network model, associate image information with weight information to construct a tablet recognition model;

[0032] According to the tablet recognition model, judge the appearance problems of tablets by visual methods, and preliminarily identify and classify tablet defects to obtain tablets with minor defects.

[0033] Preferably, the process of training an identification model based on a tablet recognition framework combining a convolutional neural network and ensemble learning includes:

[0034] Adopt transfer learning technology, load the pre-trained model weights based on the ImageNet dataset, remove the fully connected layer and replace it with a new layer related to the tablet classification task;

[0035] The settings of model training parameters include: select Adam as the optimizer, set the initial learning rate to 0.001, and set the learning rate to be halved every 10 rounds; the batch size is 16, and the maximum number of training rounds is 60;

[0036] The dataset is divided into a training set, a validation set, and a test set according to 60%, 20%, and 20%;

[0037] Evaluate the performance of a single model through 5-fold cross-validation, and further implement ensemble learning optimization by combining majority voting and average voting strategies.

[0038] Preferably, the process of secondary identification of tablets with minor defects by the identification model includes:

[0039] Package the defective tablets and normal tablets identified by the identification model as training data, which is used as the original data for training the identification model, and iteratively update the identification model in real time.

[0040] The present invention also provides a tablet identification system based on machine learning, comprising:

[0041] An image acquisition module, configured to acquire tablet images;

[0042] A data preprocessing module, connected to the image acquisition module, configured to perform cropping, denoising, enhancement, and normalization processing on the tablet images to obtain preprocessed images;

[0043] A first identification module, connected to the data preprocessing module, configured to perform preliminary identification and classification of tablet defects based on a deep learning neural network model in combination with tablet weight information to obtain tablets with minor defects;

[0044] A second identification module, connected to the first identification module, configured to train an identification model based on a tablet identification framework of a convolutional neural network and ensemble learning, and perform secondary identification on the tablets with minor defects through the identification model to obtain a target classification and identification result;

[0045] A result output module, connected to the second identification module, configured to output the target classification and identification result to a pipeline control system through an interface to achieve automated sorting.

[0046] Preferably, the image acquisition module includes a horizontal transfer workbench, a CCD industrial camera, a metering module, a bar light source, and a point light source;

[0047] Wherein, the CCD industrial camera is installed above the horizontal transfer workbench and is configured to acquire tablet images;

[0048] The metering module is configured to measure the weight of the tablets;

[0049] The bar light source is configured to eliminate the influence of ambient light and highlight the features of the tablets when cooperating with the CCD industrial camera to capture tablet images;

[0050] The point light source is configured to illuminate the tablets and characterize the defects of local micro-features of the tablets.

[0051] Preferably, the bar light source includes a first-level bar light source and a second-level bar light source;

[0052] The first-level bar light source is configured to illuminate the bottom of the tablets;

[0053] The second-level bar light source is configured to illuminate the top of the tablets;

[0054] The light source angles of the first-level bar light source and the second-level bar light source are adjustable, and the light is irradiated from different angles by adjusting the light source angles to adjust the light entering the lens.

[0055] Compared with the prior art, the present invention has the following advantages and technical effects:

[0056] (1) Introduction of the combination of integrated learning and deep learning: The present invention proposes a tablet recognition framework based on convolutional neural network (CNN) and integrated learning (EL). Through hierarchical feature extraction by convolutional neural network (such as EfficientNetV2s), it can automatically learn the complex textures and morphological features in the tablet image, thereby improving the recognition accuracy of defects. At the same time, the integrated learning combines the results of multiple models, which helps to enhance the robustness and generalization ability of the system, further improving the recognition accuracy and reducing missed detections and misjudgments.

[0057] (2) Combining weight information with visual data: The present invention enhances the recognition accuracy by combining the weight information of the tablet with the image data. Since there are large errors in calculating the weight by visual methods, the present invention obtains the actual weight of the tablet through a high-precision metering module and combines it with the image recognition result to achieve higher-precision recognition. This method not only improves the recognition ability of minor defects but also effectively reduces the inaccurate judgments caused by image processing errors.

[0058] (3) Optimization of image acquisition and light source design: The present invention designs multiple light source configurations (such as bar light sources, point light sources, etc.) in combination with a CCD camera. By precisely controlling the light source angle and illumination sequence, the image acquisition process is optimized. The reasonable combination of bar light sources and point light sources can effectively eliminate background interference in different working environments, highlight the features of the tablet, especially in the detection of minor defects, and can obtain higher-quality images, improving the recognition accuracy.

[0059] (4) Improvement of real-time performance and efficiency: The machine learning system of the present invention adopts an efficient convolutional neural network structure and combines an integrated learning algorithm to ensure a low computational load and a fast processing speed. This enables the system to be applied in industrial production environments with high real-time requirements and meet the high-efficiency detection needs of automated production lines.

[0060] Through the above innovations, the present invention aims to provide a high-precision, high-robustness, and real-time tablet recognition method and system, solve the challenges such as image processing limitations, dataset problems, insufficient recognition of minor defects, and poor real-time performance in the prior art, and improve the accuracy of tablet quality detection and production efficiency. Brief Description of the Drawings

[0061] The drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation to this application. In the drawings:

[0062] Figure 1Schematic flowchart of the method according to an embodiment of the present invention;

[0063] Figure 2 Schematic flowchart of constructing a tablet recognition model by associating image information with weight information according to an embodiment of the present invention;

[0064] Figure 3 Schematic diagram of the recognition process of the tablet recognition model according to an embodiment of the present invention;

[0065] Figure 4 Schematic diagram of the structure of the image acquisition module according to an embodiment of the present invention;

[0066] Wherein, 1, CCD industrial camera; 2, first-stage bar light source; 3, second-stage bar light source; 4, point light source; 5, metering module; 6, horizontal transfer workbench. Detailed implementation manners

[0067] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0068] It should be noted that the steps shown in the flowchart of the drawings may be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here.

[0069] The following are several main disadvantages of the prior art in the automatic detection of tablets:

[0070] (1) Limitations in image processing: Traditional vision detection methods mostly rely on simple image processing algorithms, such as edge detection and morphological processing, and are unable to cope with complex production environments (such as light changes, background interference, etc.). These methods have low accuracy in detecting tiny or local defects (such as micro-cracks, small black dots), and are prone to missed detection and misjudgment.

[0071] (2) Dataset and training problems: Although deep learning technology has made certain progress in image recognition, its performance highly depends on a large amount of high-quality labeled data. In tablet production, due to the diversity of defect types and morphologies, and the difficulty in obtaining labeled data, the training dataset is insufficient or unbalanced, thereby affecting the accuracy and generalization ability of the model.

[0072] (3) Insufficient recognition of tiny defects: Existing deep learning models perform well in dealing with large-scale defects (such as split tablets, missing corners), but have low recognition accuracy for tiny defects (such as small black dots, micro-cracks, etc.). This is because these defects often have tiny morphological and texture differences, which are difficult to capture by traditional vision methods or relatively shallow neural networks.

[0073] (4) Real-time issue: Although deep learning models have improved in recognition accuracy, their computational requirements are typically high, making it difficult to meet the real-time and high-efficiency requirements of industrial production. Especially in large-scale production environments, the system needs to process each tablet image in real time and make classification decisions, but the computational efficiency of existing technologies in this regard is not high enough, resulting in a detection speed that cannot match the production line speed.

[0074] To address the above drawbacks of the existing technology, this embodiment aims to overcome these problems by proposing a machine learning-based tablet recognition method and system.

[0075] Embodiment 1

[0076] As Figures 1-3 shown, this embodiment provides a machine learning-based tablet recognition method, including the following steps:

[0077] Collect tablet images, and perform cropping, denoising, enhancement, and normalization processing on the tablet images to obtain preprocessed images;

[0078] Based on a deep learning neural network model and combined with tablet weight information, preliminarily identify and classify tablet defects to obtain tablets with minor defects;

[0079] Train a recognition model based on a convolutional neural network and ensemble learning-based tablet recognition framework, and perform secondary recognition on the tablets with minor defects through the recognition model to obtain the target classification recognition results;

[0080] Output the target classification recognition results to the pipeline control system through an interface to achieve automatic sorting.

[0081] Furthermore, the process of collecting tablet images includes:

[0082] Install the CCD industrial camera 1 above the horizontal conveyor workbench 6. Place the tablets on the surface of the horizontal conveyor workbench 6. While collecting multi-angle and multi-feature images of the tablets through the cooperation of the bar light source and the point light source 4 with the CCD industrial camera 1, measure the weight of the tablets and preliminarily determine whether there are problems such as black spots, missing corners, and cracks on the appearance of the current tablets;

[0083] Among them, the bar light source is used to eliminate the influence of ambient light and highlight the features of the tablets when cooperating with the CCD industrial camera 1 to capture tablet images;

[0084] The point light source 4 is used to illuminate the tablets and characterize the defects of local micro-features of the tablets.

[0085] Specifically, the CCD industrial camera 1 is mainly used to collect image information during the operation. Since there may be various subjective human errors in manual tablet identification, in this embodiment, an intelligent identification method is adopted. Specifically, a high-precision weighing scale is used to measure the exact weight of the tablets, and at the same time, a high-end industrial CCD camera is used to take pictures of the tablets.

[0086] The identification of tablets is divided into the processes of preliminary identification and secondary identification. As Figure 2 shown, first, the CCD industrial camera 1 is used to collect the tablet images, and a high-precision metering module 5 is used to measure the tablets. Finally, the image information and the weight information are associated to establish a tablet identification model.

[0087] Through the images obtained by the CCD industrial camera 1, it can be initially judged that there is no problem with the appearance of the current tablet. For example, there may be problems such as black spots, missing corners, and cracked tablets on the tablets.

[0088] The CCD industrial camera 1 is installed above the horizontal conveyor workbench 6, and the tablets are on the surface of the horizontal conveyor workbench 6.

[0089] Furthermore, the process of using the bar light source and the point light source 4 to cooperate with the CCD industrial camera 1 to collect multi-angle and multi-feature images of the tablets includes:

[0090] First, turn on the bar light source to illuminate the entire morphology of the tablet. After the preliminary judgment of the vision system, if the range of missing corners of the tablet is greater than the preset threshold, there is no need to turn on the point light source 4 for illumination;

[0091] If there are no obvious defects in the appearance of the tablet, then the point light source 4 is turned on for illumination of the tablet to characterize the defects of the local micro-features of the tablet.

[0092] Among them, the bar light source includes a first-level bar light source 2 and a second-level bar light source 3. The bottom of the tablet is illuminated by the first-level bar light source 2, and the top of the tablet is illuminated by the second-level bar light source 3; at the same time, by adjusting the light source angles of the first-level bar light source 2 and the second-level bar light source 3, the light is irradiated from different angles to adjust the light entering the lens.

[0093] Specifically, the bar light source is mainly used to cooperate with the CCD industrial camera 1 for shooting, eliminate the influence of ambient light, highlight the features of the tablets, facilitate image processing, reduce the design difficulty of the vision algorithm, and enhance the accuracy of the identification model. The first-level bar light source 2 mainly illuminates the bottom of the tablet, and the second-level bar light source 3 mainly illuminates the top of the tablet. At the same time, the left and right two-level light sources are irradiated at different angles, which can adjust the light entering the lens to enhance the quality of the obtained tablet images.

[0094] The first-level strip light source 2 and the second-level strip light source 3 can adjust their respective angles to suit the current working conditions.

[0095] The described point light source 4 is mainly used to characterize the defects of local micro features, such as small black dots. Since the energy density of the strip light source is not as high as that of the point light source 4, using the point light source 4 to characterize micro features can achieve better results.

[0096] The light sources are lit in a sequence. First, the strip light source illuminates the entire morphology of the tablet. After a preliminary judgment by the vision system, if it is a tablet with large-scale missing corners or edges, there is no need to activate the point light source 4 for illumination. If there are no obvious defects on the appearance of the tablet, there may be some micro defects, such as black dots, micro cracks, etc. Then the point light source 4 will be activated to illuminate the tablet to characterize the defects. The strip light source and the point light source 4 cooperate with each other to start illumination, which is conducive to the reasonable use of the light source system and improves the accuracy and efficiency of defect recognition.

[0097] Furthermore, the process of cropping, denoising, enhancing, and normalizing the tablet image to obtain the preprocessed image includes:

[0098] Extract the region of interest from the tablet image and remove background interference to obtain the region retaining the key features of the tablet;

[0099] Perform data enhancement processing on the region retaining the key features of the tablet to obtain the image after data enhancement processing; the data enhancement processing includes horizontal flipping, vertical flipping, and random rotation;

[0100] Uniformly adjust the image after data enhancement processing to a size of 380×380×3, and then perform normalization processing to scale the pixel values to the range of [0, 1] to obtain the preprocessed image.

[0101] Through the combination of a CCD camera and multiple light sources, clearly capture the tablet image, and use preprocessing techniques such as denoising, cropping, and enhancement to ensure the image quality.

[0102] Furthermore, the process of preliminarily identifying and classifying tablet defects based on a deep learning neural network model and combining tablet weight information to obtain tablets with micro defects includes:

[0103] Based on the deep learning neural network model, associate the image information with the weight information to construct a tablet recognition model;

[0104] According to the tablet recognition model, judge the appearance problems of the tablets by visual methods, preliminarily identify and classify the tablet defects, and obtain the tablets with micro defects.

[0105] Specifically, through a neural network model, a tablet recognition model applicable to the current system is trained to preliminarily judge the appearance problems of tablets by visual means.

[0106] Further explanation, as Figure 2 shown, the weight information of the tablets is added to the tablet recognition model. Since there may be large errors in calculating the weight by obtaining the three-dimensional tablet volume through visual means. Therefore, in this embodiment, the weight of the tablets is measured by the high-precision metering module 5, and then the tablet weight is associated with the tablet recognition model to achieve the effect of high-precision tablet recognition.

[0107] Further, the process of training the recognition model based on the tablet recognition framework of convolutional neural network and ensemble learning includes:

[0108] Adopt transfer learning technology, load the pre-trained model weights based on the ImageNet dataset, remove the fully connected layer and replace it with a new layer related to the tablet classification task;

[0109] The settings of the model training parameters include: the optimizer selects Adam, the initial learning rate is set to 0.001, and the learning rate is halved every 10 rounds; the batch size is 16, and the maximum number of training rounds is 60;

[0110] The dataset is divided into a training set, a validation set and a test set according to 60%, 20%, 20%;

[0111] The performance of a single model is evaluated through 5-fold cross-validation, and further combined with the majority voting and average voting strategies to implement ensemble learning optimization.

[0112] Specifically, in complex manufacturing scenarios, although traditional neural network models can achieve a certain degree of feature extraction and classification, they still face many challenges in practical applications. On the one hand, traditional models mostly rely on shallow structures and are difficult to effectively capture the subtle features in tablet images, such as complex differences in texture and morphology; on the other hand, shallow networks are prone to overfitting on small-scale datasets, and their generalization ability is insufficient when facing disturbances in real production environments such as complex backgrounds and lighting changes. In addition, traditional models have poor adaptability to high-resolution input data, low computational efficiency, and need to reconstruct the model structure when adding new categories, lacking sufficient flexibility and scalability. These deficiencies significantly limit the practical application value of traditional neural network models in industrial production.

[0113] To overcome these problems, this embodiment proposes a tablet recognition framework based on convolutional neural network (CNN) and ensemble learning (EL). Through the hierarchical feature extraction ability of the deep learning model, it can automatically learn and capture the complex texture and morphological features of different tablet categories, thus improving the classification accuracy and generalization performance. The ensemble learning strategy that combines the results of multiple models further enhances the robustness and stability of the system, while effectively meeting the requirements of industrial production for real-time and flexibility.

[0114] The improved solution based on deep learning and its implementation process will be elaborated in detail below. Specifically, the implementation steps are as follows:

[0115] Step 1: Data collection and preprocessing

[0116] Under standardized lighting conditions, multi-angle and multi-state images of tablets are collected through a high-definition camera, ensuring that the image resolution is 1600×1200px to capture clear detail information. The collected images are first preprocessed. By extracting the region of interest (ROI), background interference is removed to retain the key feature regions of the tablets. Subsequently, data augmentation processing is performed on the images, including horizontal flipping, vertical flipping, and random rotation, etc., to expand the diversity of the dataset and thus improve the generalization ability of the model. Then, all images are uniformly adjusted to a size of 380×380×3 to ensure that the input data meets the requirements of subsequent model training. Finally, the images are normalized, and the pixel values are scaled to the range [0, 1] to enhance the stability and efficiency of model training.

[0117] Step 2: Model training

[0118] To classify tablet images, three CNN models, namely EfficientNetB2, EfficientNetV2s, and ResNet18, are selected for training. The transfer learning technique is adopted to load the pre-trained model weights based on the ImageNet dataset. After removing the fully connected layer, it is replaced with a new layer related to the tablet classification task to adapt to specific classification requirements. The model training parameters are set as follows: The optimizer is selected as Adam, the initial learning rate is set to 0.001, and the learning rate is halved every 10 epochs; the batch size is 16, and the maximum number of training epochs is 60. The dataset is divided into a training set, a validation set, and a test set according to 60%, 20%, and 20%. The performance of a single model is evaluated through 5-fold cross-validation, and further ensemble learning optimization is implemented by combining the majority voting and average voting strategies to improve the stability and accuracy of the final classification results.

[0119] A tablet recognition method combining high-precision image acquisition and deep learning proposed in this embodiment adopts a convolutional neural network (CNN) and an ensemble learning method to achieve high-precision and real-time defect recognition. By using deep learning models such as EfficientNetV2s and ensemble learning methods, the recognition accuracy is improved, and dual recognition is carried out by combining image data and weight information to enhance the detection ability of minor defects.

[0120] Step 3: Model Deployment and Application

[0121] Deploy the trained model to an embedded device (such as NVIDIA Jetson Nano) and integrate it into the industrial pipeline to achieve automated classification tasks. On the embedded device, by optimizing the algorithm and hardware performance, ensure that image acquisition and classification processing can be completed in real time, and the classification time for each time is controlled within 0.2 seconds to meet the requirements of high-efficiency production. At the same time, develop a friendly user interface to display the classification results in real time and provide visualization functions for statistical data and historical records, facilitating users to monitor and analyze data, thereby enhancing the practicality and operation convenience of the system.

[0122] This embodiment uses an optimized deep learning model to ensure that the classification time for each tablet is controlled within 0.2 seconds, meeting the real-time detection requirements of the industrial production line.

[0123] Furthermore, the process of secondary recognition of tablets with minor defects by the recognition model includes:

[0124] Package the defective tablets and normal tablets identified by the recognition model as training data, which serves as the original data for training the recognition model, and iteratively update the recognition model in real time.

[0125] Further explanation, the tablet recognition system of this embodiment is divided into two recognitions. The model for the first recognition is the superposition of a traditional neural network model and weight information, and the recognition model for the second time is trained based on the tablet recognition framework of a convolutional neural network and ensemble learning.

[0126] The first recognition model has classified some initially recognizable defects. There may still be some tablets with defects that the first model cannot recognize and are identified as normal tablets. Such tablets are called minor defect tablets. Therefore, the second model is mainly used to recognize minor defect tablets. The training data used by the second recognition model comes from the data of the first recognition model, which is conducive to quickly marking the corresponding defective tablets. The specific work process is as Figure 3 shown. By recognizing tablets through the two models, the recognition accuracy of the tablets can be increased.

[0127] Further explanation, the defective tablets and normal tablets identified by the machine learning tablet recognition model will be encapsulated as training data, serving as the original data for training the machine learning tablet recognition model, which enables the recognition model to have real-time iterative updates and further improves the accuracy of tablet recognition.

[0128] In summary, by combining deep learning, ensemble learning, weight information, and high-precision image acquisition technology, the present invention exhibits significant advantages in terms of improving recognition accuracy, real-time performance, robustness, etc., and can effectively solve the limitations of the prior art in tablet recognition.

[0129] (1)Combination of high precision and real-time performance: This embodiment combines high-precision image acquisition and deep learning technology, and adopts an advanced convolutional neural network (CNN) model (such as EfficientNetV2s), which can achieve high-precision tablet defect recognition in a complex industrial environment. At the same time, the optimized model ensures that the classification time of each tablet is controlled within 0.2 seconds, meeting the real-time requirements of large-scale industrial production lines, while it is often difficult for the prior art to balance real-time performance and accuracy.

[0130] (2)Dual recognition mechanism: This embodiment combines image data and weight information for dual recognition, greatly improving the recognition ability for tiny defects (such as small black dots, microcracks, etc.). The prior art usually only relies on visual information for detection and is difficult to identify tablets with irregular shapes or inconspicuous surface features. However, this embodiment effectively makes up for this deficiency by combining weight data, ensuring higher recognition accuracy.

[0131] (3)Ensemble learning and transfer learning: This embodiment adopts an ensemble learning method to combine the results of multiple deep learning models, significantly improving the robustness and recognition accuracy of the system. Moreover, through transfer learning technology, the dependence on large-scale datasets is reduced, and the training effect of small-sample data is improved. The prior art usually only uses a single model or simple algorithms and is difficult to achieve the same robustness and accuracy.

[0132] (4)Optimized image acquisition and data preprocessing technology: This embodiment adopts a combination of a CCD industrial camera and multiple light sources, which can provide high-quality images in a complex production environment, especially in the case of different lighting and background changes. In addition, the image preprocessing process (such as denoising, cropping, and enhancement) is also optimized to ensure the consistency and quality of the input data. The image acquisition systems of the prior art often have difficulty maintaining the stability of image quality under different environmental conditions.

[0133] (5) The overall system design has strong adaptability to industrial applications: In this embodiment, not only the hardware and software are optimized, but also its design is closely combined with industrial applications to ensure that the system can adapt to the efficient operation of industrial production lines. Especially in the deployment of embedded devices and system integration, it can work stably in a real-time production environment, avoiding the deployment and adaptation problems that may be encountered by existing technologies in industrial environments.

[0134] Embodiment 2

[0135] Based on the same inventive concept, as Figure 4 shown, this embodiment also provides a tablet identification system based on machine learning, including:

[0136] An image acquisition module for acquiring tablet images;

[0137] A data preprocessing module connected to the image acquisition module for cropping, denoising, enhancing, and normalizing the tablet images to obtain preprocessed images;

[0138] A first identification module connected to the data preprocessing module for preliminarily identifying and classifying tablet defects based on a deep learning neural network model in combination with tablet weight information to obtain tablets with minor defects;

[0139] A second identification module connected to the first identification module for training an identification model based on a tablet identification framework of convolutional neural network and ensemble learning, and performing secondary identification on the tablets with minor defects through the identification model to obtain the target classification identification result;

[0140] A result output module connected to the second identification module for outputting the target classification identification result to the pipeline control system through an interface to achieve automatic sorting.

[0141] Furthermore, the image acquisition module includes a horizontal transfer workbench 6, a CCD industrial camera 1, a metering module 5, a bar light source, and a point light source 4;

[0142] Among them, the CCD industrial camera 1 is installed above the horizontal transfer workbench 6 for acquiring tablet images;

[0143] The metering module 5 is used to measure the weight of the tablets;

[0144] The bar light source is used to eliminate the influence of ambient light and highlight the characteristics of the tablets when cooperating with the CCD industrial camera 1 to capture tablet images;

[0145] The point light source 4 is used to illuminate the tablets and characterize the defects of local micro features of the tablets.

[0146] Furthermore, the bar light source includes a primary bar light source 2 and a secondary bar light source 3;

[0147] The first-level bar-shaped light source 2 is used to illuminate the bottom of the tablet;

[0148] The second-level bar-shaped light source 3 is used to illuminate the top of the tablet;

[0149] The light source angles of the first-level bar-shaped light source 2 and the second-level bar-shaped light source 3 are adjustable. By adjusting the light source angles, illumination is performed from different angles to adjust the light entering the lens.

[0150] A tablet recognition system based on machine learning provided in this embodiment has all the advantages of the tablet recognition method based on machine learning provided in the first embodiment.

[0151] Embodiment III

[0152] This embodiment also discloses a computer device, including a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the steps of the method described in the first embodiment.

[0153] Embodiment IV

[0154] This embodiment also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first embodiment are implemented.

[0155] Embodiment V

[0156] This embodiment also discloses a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the method described in the first embodiment are implemented.

[0157] The above is only a preferred specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A tablet recognition method based on machine learning, characterized in that, Including: Collect tablet images, crop, denoise, enhance, and normalize the tablet images to obtain preprocessed images; Based on a deep learning neural network model and combined with tablet weight information, preliminarily identify and classify tablet defects to obtain tablets with minor defects; Train an identification model based on a tablet identification framework combining a convolutional neural network and ensemble learning, and perform secondary identification on the tablets with minor defects through the identification model to obtain the target classification and identification results; Output the target classification and identification results to the pipeline control system through an interface to achieve automatic sorting.

2. The method according to claim 1, wherein: The process of collecting tablet images includes: Install a CCD industrial camera above a horizontal transfer workbench, place the tablets on the surface of the horizontal transfer workbench, and while collecting multi-angle and multi-feature images of the tablets by cooperating a bar light source and a point light source with the CCD industrial camera, measure the weight of the tablets and preliminarily judge whether there are problems such as black spots, missing corners, and cracks on the appearance of the current tablets; Among them, the bar light source is used to eliminate the influence of ambient light and highlight the features of the tablets when cooperating with the CCD industrial camera to take tablet images; The point light source is used to illuminate the tablets and characterize the defects of local micro-features of the tablets.

3. The method according to claim 2, wherein: The process of collecting multi-angle and multi-feature images of the tablets by cooperating a bar light source and a point light source with the CCD industrial camera includes: First, turn on the bar light source to illuminate the entire morphology of the tablets. After a preliminary judgment by the vision system, if the missing corner range of the tablets is greater than a preset threshold, there is no need to turn on the point light source for illumination; If there are no obvious defects on the appearance of the tablets, turn on the point light source to illuminate the tablets for minor defects to characterize the defects of local micro-features of the tablets; Among them, the bar light source includes a primary bar light source and a secondary bar light source. The bottom of the tablets is illuminated by the primary bar light source, and the top of the tablets is illuminated by the secondary bar light source; at the same time, by adjusting the light source angles of the primary bar light source and the secondary bar light source to irradiate from different angles, the light entering the lens is adjusted.

4. The method according to claim 1, wherein: The process of cropping, denoising, enhancing, and normalizing the tablet images to obtain preprocessed images includes: Extract the region of interest from the tablet images and remove background interference to obtain a region retaining the key features of the tablets; Perform data enhancement processing on the region retaining the key features of the tablets to obtain an image after data enhancement processing; the data enhancement processing includes horizontal flipping, vertical flipping, and random rotation; Uniformly adjust the image after data enhancement processing to a size of 380×380×3, and then perform normalization processing to scale the pixel values to the range of [0, 1] to obtain preprocessed images.

5. The method according to claim 1, wherein: The process of preliminarily identifying and classifying tablet defects based on a deep learning neural network model and combined with tablet weight information to obtain tablets with minor defects includes: Based on a deep learning neural network model, associate image information with weight information to construct a tablet recognition model; According to the tablet recognition model, judge the appearance problems of tablets by visual methods, preliminarily identify and classify tablet defects, and obtain tablets with minor defects.

6. The method according to claim 1, wherein: The process of training the recognition model based on the tablet recognition framework of convolutional neural network and ensemble learning includes: Adopt transfer learning technology, load the pre-trained model weights based on the ImageNet dataset, remove the fully connected layer and replace it with a new layer related to the tablet classification task; The settings of the model training parameters include: select Adam as the optimizer, set the initial learning rate to 0.001, and set the learning rate to be halved every 10 rounds; the batch size is 16, and the maximum number of training rounds is 60; The dataset is divided into a training set, a validation set, and a test set according to 60%, 20%, and 20%; Evaluate the performance of a single model through 5-fold cross-validation, and further combine the majority voting and average voting strategies to implement ensemble learning optimization.

7. The method according to claim 1, wherein: The process of secondary recognition of tablets with minor defects by the recognition model includes: Package the defective tablets and normal tablets identified by the recognition model as training data, which are used as the original data for training the recognition model, and iteratively update the recognition model in real time.

8. A tablet recognition system based on machine learning, characterized in that, It includes: An image acquisition module for acquiring tablet images; A data preprocessing module connected to the image acquisition module for cropping, denoising, enhancing, and normalizing the tablet images to obtain preprocessed images; A first recognition module connected to the data preprocessing module for preliminarily identifying and classifying tablet defects based on a deep learning neural network model in combination with tablet weight information to obtain tablets with minor defects; A second recognition module connected to the first recognition module for training a recognition model based on the tablet recognition framework of convolutional neural network and ensemble learning, and performing secondary recognition on the tablets with minor defects through the recognition model to obtain a target classification recognition result; A result output module connected to the second recognition module for outputting the target classification recognition result to the pipeline control system through an interface to achieve automatic sorting.

9. The system according to claim 8, wherein: The image acquisition module includes a horizontal transfer workbench, a CCD industrial camera, a metering module, a bar light source, and a point light source; Among them, the CCD industrial camera is installed above the horizontal transfer workbench for acquiring tablet images; The metering module is used for measuring the weight of tablets; The bar light source is used to eliminate the influence of ambient light and highlight the characteristics of the tablets when cooperating with the CCD industrial camera to take tablet images; The point light source is used for illuminating the tablets to characterize the defects of local microscopic features of the tablets.

10. The system according to claim 9, wherein: The bar light source includes a first-level bar light source and a second-level bar light source; The first-level bar light source is used to illuminate the bottom of the tablets; The secondary strip light source is used to illuminate the top of the tablet; The light source angles of the primary strip light source and the secondary strip light source are adjustable. By adjusting the light source angles, illumination is performed from different angles to adjust the light entering the lens.