Bulk oral tablet code scanning identification method, system and equipment based on AI image
Through the AI image scanning and recognition method, tablet images are automatically acquired and segmented and analyzed, solving the problems of low recognition efficiency and high error rate of bulk tablets, and realizing accurate recognition and intelligent management of tablets.
Patent Information
- Application Number
- CN202510715289.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-12
AI Technical Summary
In the existing technology, the identification method of bulk oral tablets relies on manual observation, which is difficult to achieve automated and accurate classification, resulting in low recognition efficiency and high misjudgment rate, and is not suitable for intelligent recognition scenarios.
An AI-based image-based code scanning and recognition method is used to obtain images of the tablets at different angles by scanning QR codes or barcodes. The image segmentation algorithm is used to identify key feature areas, and the recognition and analysis algorithm is combined to determine the tablet information. The results are then compared with the database and displayed.
It achieves accurate identification and differentiation of pills, improves identification efficiency and accuracy, reduces the burden on medical staff, and enhances patient medication compliance.
Smart Images

Figure CN120635545A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of drug identification technology, and more specifically, to a method, system, and device for scanning and identifying bulk oral tablets based on AI images. Background Art
[0002] Currently, hospitals typically use automatic pill dispensers to dispense multiple oral tablets for each meal into a single medicine bag. However, different medications require different dosing times; for example, some should be taken before meals, while others should be taken afterward. Because pills look similar, patients, especially the elderly or those with poor memory, often struggle to accurately identify medication types and when to take them. Even if doctors or nurses provide instructions ahead of time, patients often forget, leading to frequent inquiries from healthcare professionals. This not only increases the workload for healthcare professionals but also complicates medication management. Against this backdrop, artificial intelligence (AI) is gaining increasing application in drug identification. Image recognition-based technologies can classify and identify bulk oral tablets using their visual features, providing a foundation for subsequent information association and code scanning. This enables visual management and data support for bulk medications after dispensing.
[0003] Most of the existing identification methods rely on manual observation, which is not conducive to automatic identification and accurate classification. It is difficult to handle mixed tablets, diverse appearances and real-time information acquisition, resulting in low recognition efficiency and high error rate. It is not suitable for intelligent identification scenarios of bulk oral tablets.
[0004] Currently, no effective solutions have been proposed for the problems in related technologies. Summary of the Invention
[0005] In response to the shortcomings of the existing technology, the present invention proposes an AI image-based bulk oral tablet scanning and recognition method, system and equipment, which solves the problem proposed in the above background technology that the existing recognition methods mostly rely on manual observation, are not convenient for automatic recognition and accurate classification, and are difficult to handle mixed tablets, diverse appearances and real-time information acquisition, resulting in low recognition efficiency, high error rate, and unsuitable for intelligent recognition scenarios of bulk oral tablets.
[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0007] According to a first aspect of the present invention, a method for scanning and identifying bulk oral tablets based on AI images is provided, comprising:
[0008] S1. Scan the QR code or barcode to automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of bulk oral tablets;
[0009] S2. Based on an image segmentation algorithm, performing region segmentation on the bulk oral tablet feature image and identifying key feature regions in the bulk oral tablet feature image;
[0010] S3. Analyzing the key feature areas using a recognition analysis algorithm to determine relevant information about the bulk oral tablets;
[0011] S4. Compare the relevant information of the bulk oral tablets with the information of the bulk oral tablets in a known database, and display the tablet information based on the comparison result.
[0012] Furthermore, based on the image segmentation algorithm, the bulk oral tablet feature image is segmented, and the key feature areas in the bulk oral tablet feature image are identified, including:
[0013] S21. Acquire a characteristic image of the bulk oral tablets, generate an image grayscale histogram, and analyze the brightness and contrast information of the image;
[0014] S22, setting the initial parameters of the image segmentation algorithm, including the maximum number of iterations, the population size, and the segmentation threshold;
[0015] S23, using a screening algorithm to initialize the population position, and encoding the individual positions of the bulk oral tablet features into a set of segmentation thresholds;
[0016] S24. Calculate the fitness of the characteristic individuals of the bulk oral tablets in the population according to the Tsallis entropy, update the weight parameters and positions, and adjust the boundaries and positions of the tablet characteristic regions;
[0017] S25. Individual variation of bulk oral tablet characteristics using lens imaging adversarial learning mechanism;
[0018] S26. If the maximum number of iterations is reached, the bulk oral tablet feature individual with the largest Tsallis entropy value is returned and decoded as the optimal segmentation threshold; otherwise, go to step S24;
[0019] S27 . Performing region segmentation on the bulk oral tablet feature image according to the optimal segmentation threshold, and outputting key feature regions in the bulk oral tablet feature image.
[0020] Furthermore, the population position is initialized using a screening algorithm, and the individual positions of the bulk oral tablet features are encoded into a set of segmentation thresholds including:
[0021] S231, setting the population size and the maximum number of iterations of the screening algorithm, and initializing the positions of the characteristic individuals of the bulk oral tablets as the initial codes of the candidate threshold set;
[0022] S232, sorting the bulk oral tablet feature individuals according to fitness, and selecting the best tablet feature individual as a search reference using a roulette wheel method;
[0023] S233. Using a search algorithm to balance the distribution of individual features of bulk oral tablets in the feature space;
[0024] S234. Compare the performance of the current bulk oral tablet feature individual with the performance of the historical bulk oral tablet feature individual, retain the bulk oral tablet feature individual with the highest information entropy, and record its position as a potential segmentation solution;
[0025] S235. Fine-tune the distribution of the characteristic individuals of the bulk oral tablets in combination with the guidance mechanism, and after reaching the maximum number of iterations, encode the positions of the characteristic individuals of the bulk oral tablets into a set of segmentation thresholds.
[0026] Furthermore, the search algorithm is used to balance the distribution of bulk oral tablet feature individuals in the feature space, including:
[0027] S2331. Initialize the spatial position of the characteristic individuals of the bulk oral tablets and set the maximum number of iterations of the search algorithm;
[0028] S2332. Construct a fitness function based on regional information entropy and edge continuity to evaluate the expressiveness and balance of individual features of bulk oral tablets in the image feature space.
[0029] S2333. Dynamically adjust the population size based on fitness feedback to ensure that the characteristic individuals of bulk oral tablets remain fully distributed in the high-dimensional feature space;
[0030] S2334. Perform non-dominated sorting based on fitness to divide the bulk oral tablets characteristic individuals into core bulk oral tablets characteristic individuals and auxiliary bulk oral tablets characteristic individuals;
[0031] S2335. Generate new bulk oral tablet feature individuals within the preset area, and introduce a perturbation mechanism to the core bulk oral tablet feature individuals;
[0032] S2336. Fusion of the current bulk oral tablets feature individuals and the new bulk oral tablets feature individuals, retaining the optimal bulk oral tablets feature individuals through non-dominated sorting screening, and forming a new generation of balanced bulk oral tablets feature individuals distributed in the feature space.
[0033] Furthermore, the current bulk oral tablet feature individuals are fused with the new bulk oral tablet feature individuals, and the optimal bulk oral tablet feature individuals are retained through non-dominated sorting screening to form a new generation of balanced bulk oral tablet feature individuals. The distribution in the feature space includes:
[0034] S23361. Generate an initial set of bulk oral tablet feature individuals using a diversified generation method, and improve the set of tablet feature individuals using an improvement strategy.
[0035] S23362. Select the most dispersed high-quality bulk oral tablets feature individuals from the current bulk oral tablets feature individual set to construct a reference subset, and guide the future bulk oral tablets feature individuals to cover the feature space area;
[0036] S23363. Generating a set of bulk oral tablet feature individual subsets from the current bulk oral tablet feature individual set, performing a combination operation on each bulk oral tablet feature individual subset to generate a new bulk oral tablet feature individual, and improving the new bulk oral tablet feature individual using an improvement strategy, so that the improved new bulk oral tablet feature individuals constitute a new bulk oral tablet feature individual subset;
[0037] S23364. Merge the current bulk oral tablet feature individual with the new bulk oral tablet feature individual subset, and select the optimal bulk oral tablet feature individual through non-dominated sorting to form an updated set;
[0038] S23365. If the maximum number of iterations has not been reached, return to step S23363 to continue iterating; otherwise, output the optimal bulk oral tablet feature individual to form a new generation of balanced bulk oral tablet feature individuals distributed in the feature space.
[0039] Furthermore, the key feature areas are analyzed using recognition analysis algorithms to determine that the relevant information of the bulk oral tablets includes:
[0040] S31, extracting multiple candidate feature regions from the key feature region, generating an initial feature information solution set based on a recognition analysis algorithm, and constructing a search space;
[0041] S32, using a region selection algorithm to select the candidate feature region with the highest recognition degree from each candidate feature region, and randomly generate new feature region solutions in other regions of the key feature region to expand the global recognition range;
[0042] S33. Integrate the recognition results of all feature areas and extract relevant information of the bulk oral tablets.
[0043] Furthermore, the region selection algorithm is used to select the candidate feature region with the highest recognition degree from each candidate feature region, and new feature region solutions are randomly generated in other regions of the key feature region to expand the global recognition range.
[0044] S321, setting the number of iterations of the region selection algorithm, initializing an initial solution set of feature regions consisting of several candidate feature regions in the candidate feature regions;
[0045] S322, randomly selecting a feature region from the initial solution set, performing recognition analysis operations on it, extracting visual information of the tablet and recording it as the current recognition solution;
[0046] S323, calculating the recognition degree of each feature region solution, screening out the optimal feature region, updating the optimal recognition region of the individual feature region and the global recognition optimal solution;
[0047] S324, generating a new feature region solution based on the position of the identified feature region, integrating the existing information, and updating the candidate feature region solution set for the next round of recognition;
[0048] S325. When the maximum number of iterations is reached, the feature region with the highest global recognition degree is output as a new feature region solution, and the global recognition range is expanded.
[0049] Furthermore, feature regions are randomly selected from the initial solution set, and recognition analysis operations are performed on them to extract visual information of the tablet and record it as the current recognition solution, including:
[0050] S3221. Randomly select a number of selected feature regions from the initial solution set as the input sample set for this round of recognition analysis;
[0051] S3222, extracting characteristic visual features from the selected feature area and constructing a multi-dimensional visual feature vector;
[0052] S3223. Input the constructed multi-dimensional visual feature vector into a preset prediction model, output the tablet category prediction result of the selected feature area, form the visual information of the tablet and record it as the current recognition solution.
[0053] According to a second aspect of the present invention, a bulk oral tablet code scanning and recognition system based on AI images is provided, the system comprising:
[0054] A data acquisition module is used to scan a QR code or barcode, automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of the bulk oral tablets;
[0055] A region segmentation module is used to perform region segmentation on the bulk oral tablet feature image based on an image segmentation algorithm, and identify key feature regions in the bulk oral tablet feature image;
[0056] An information recognition module, configured to analyze key feature areas using a recognition analysis algorithm to determine relevant information about the bulk oral tablets;
[0057] The information comparison and display module is used to compare the relevant information of bulk oral tablets with the information of bulk oral tablets in a known database, and display the tablet information based on the comparison results.
[0058] According to a third aspect of the present invention, a scanner device is provided, comprising a frame, a camera module and a visual processor, wherein the visual processor comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned AI image-based bulk oral tablet code scanning and recognition method are implemented.
[0059] The beneficial effects of the present invention are:
[0060] 1. This invention automatically activates the recognition process by scanning a QR code. Combining image segmentation and feature analysis algorithms, it achieves precise extraction and recognition of tablet images, improving the ability to distinguish between similar-looking tablets. This effectively addresses issues such as mixed tablets and low recognition efficiency, thereby improving the accuracy and intelligence of drug identification, reducing the burden on medical staff and enhancing patient medication compliance.
[0061] 2. The present invention achieves accurate recognition and efficient segmentation of key feature areas in bulk oral tablet images by constructing a multi-level, evolutionarily optimized image segmentation and feature extraction mechanism. It integrates non-dominated sorting, diversified generation, and adversarial learning strategies to effectively improve the distribution balance and recognition stability of feature individuals in the feature space, and enhances the adaptability to the complexity of tablet types and appearance similarity, thereby supporting intelligent and high-accuracy drug recognition.
[0062] 3. The present invention improves the accuracy and coverage of pill recognition within key feature areas by constructing an initial feature solution set and integrating region selection and recognition analysis algorithms. Through multi-dimensional visual feature extraction and prediction model recognition mechanisms, it achieves high-resolution recognition of pills with similar appearances. Combined with global optimal solution updating and iterative optimization strategies, it enhances the stability of pill recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0064] Figure 1 is a flow chart of a method for scanning and identifying bulk oral tablets based on AI images according to an embodiment of the present invention;
[0065] Figure 2 1 is a principle block diagram of an AI image-based bulk oral tablet code scanning and recognition system according to an embodiment of the present invention.
[0066] In the picture:
[0067] 1. Data acquisition module; 2. Data acquisition module; 3. Information identification module; 4. Information comparison and display module. DETAILED DESCRIPTION
[0068] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0069] In the description of the present invention, unless otherwise specified, "plurality" means two or more. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0070] According to an embodiment of the present invention, a method, system, and device for scanning and identifying bulk oral tablets based on AI images are provided.
[0071] The present invention will now be further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, the method for scanning and identifying bulk oral tablets based on AI images according to an embodiment of the present invention includes:
[0072] S1. Scan (using a scanner) a QR code or barcode to automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of the bulk oral tablets;
[0073] Specifically, each bag of bulk oral tablets is affixed with a unique QR code or barcode on the outer packaging, which encodes the medicine bag number, patient information or dispensing task number, etc. After scanning with a scanner, the system automatically reads the code and triggers the back-end recognition task scheduling program.
[0074] Specifically, the feature images of bulk oral tablets include geometric appearance feature images, color and texture feature images, engraving recognition images, etc.
[0075] S2. Based on an image segmentation algorithm, performing region segmentation on the bulk oral tablet feature image and identifying key feature regions in the bulk oral tablet feature image;
[0076] Specifically, the key feature areas include the tablet outline area, surface engraving area, color area, surface texture area, etc.
[0077] S3. Analyzing the key feature areas using a recognition analysis algorithm to determine relevant information about the bulk oral tablets;
[0078] Specifically, the relevant information includes tablet name and dosage form, tablet specifications, manufacturer information, approval number or identification code, tablet batch and production date, dosage, usage method, side effects, etc.
[0079] S4. Compare the relevant information of the bulk oral tablets with the information of the bulk oral tablets in a known database, and display the tablet information based on the comparison result.
[0080] Specifically, when comparing the relevant information of bulk oral tablets with the information in a known database, the identified visual features and coding information of the tablets are first extracted, and then matched and verified with the corresponding fields in the database; during the comparison process, multi-dimensional similarity judgments are made based on features such as shape, color, and engraving; finally, the identity of the tablet is determined based on the comparison results, and its complete information such as name, specifications, dosage, manufacturer, etc. is displayed through voice broadcast or display screen.
[0081] In this optional embodiment, the performing of region segmentation on the bulk oral tablet feature image based on the image segmentation algorithm and identifying key feature regions in the bulk oral tablet feature image includes:
[0082] S21. Acquire a characteristic image of the bulk oral tablets, generate an image grayscale histogram, and analyze the brightness and contrast information of the image;
[0083] S22, setting the initial parameters of the image segmentation algorithm, including the maximum number of iterations, the population size, and the segmentation threshold;
[0084] S23, using a screening algorithm to initialize the population position, and encoding the individual positions of the bulk oral tablet features into a set of segmentation thresholds;
[0085] S24. Calculate the fitness of the characteristic individuals of the bulk oral tablets in the population according to the Tsallis entropy, update the weight parameters and positions, and adjust the boundaries and positions of the tablet characteristic regions;
[0086] S25. Individual variation of bulk oral tablet characteristics using lens imaging adversarial learning mechanism;
[0087] Specifically, the formula of the lens imaging adversarial learning mechanism is:
[0088]
[0089] Where, represents the individual characteristic position of bulk oral tablets after mutation; T a Indicates the individual position of the current bulk oral tablet feature; T f represents the characteristic focus (the focal individual, which can be the current optimal individual or the center of the group); λ represents the lens refraction scale factor (controls the distance of the individual mapping, λ>0); δ a represents the adaptive perturbation term, which is used to fine-tune the individual jumping properties.
[0090] S26. If the maximum number of iterations is reached, the bulk oral tablet feature individual with the largest Tsallis entropy value is returned and decoded as the optimal segmentation threshold; otherwise, go to step S24;
[0091] S27 . Performing region segmentation on the bulk oral tablet feature image according to the optimal segmentation threshold, and outputting key feature regions in the bulk oral tablet feature image.
[0092] Specifically, the system first captures images of bulk oral tablets and generates a grayscale histogram to analyze brightness contrast. Initial parameters for image segmentation are then set, and a sieving algorithm is used to initialize the positions of individual populations within the tablet images, encoding these positions as a set of segmentation thresholds. Tsallis entropy is used to assess individual fitness and optimize their boundaries, while a lens imaging adversarial learning mechanism is employed to enhance diversity. After the system reaches the maximum number of iterations, it decodes the optimal segmentation thresholds, enabling efficient identification of key feature regions. This improves image segmentation accuracy and the stability of key feature extraction.
[0093] Specifically, the image segmentation algorithm is an improved slime mold algorithm. It leverages the algorithm's heuristic search mechanism to find the optimal image segmentation threshold, effectively reducing the algorithm's time complexity. A screening algorithm is introduced into the traditional slime mold algorithm to optimize the initial population diversity, and a dynamic lens imaging adversarial learning mechanism is used to improve search accuracy. The improved slime mold algorithm uses Tsallis entropy to evaluate the fitness of individual slime molds, and it iteratively searches for the optimal image segmentation threshold.
[0094] In this optional embodiment, the method of initializing the population position using a screening algorithm and encoding the individual characteristic positions of the bulk oral tablets into a segmentation threshold set includes:
[0095] S231, setting the population size and the maximum number of iterations of the screening algorithm, and initializing the positions of the characteristic individuals of the bulk oral tablets as the initial codes of the candidate threshold set;
[0096] S232, sorting the bulk oral tablet feature individuals according to fitness, and selecting the best tablet feature individual as a search reference using a roulette wheel method;
[0097] S233. Using a search algorithm to balance the distribution of individual features of bulk oral tablets in the feature space;
[0098] S234. Compare the performance of the current bulk oral tablet feature individual with the performance of the historical bulk oral tablet feature individual, retain the bulk oral tablet feature individual with the highest information entropy, and record its position as a potential segmentation solution;
[0099] S235. Fine-tune the distribution of the characteristic individuals of the bulk oral tablets in combination with the guidance mechanism, and after reaching the maximum number of iterations, encode the positions of the characteristic individuals of the bulk oral tablets into a set of segmentation thresholds.
[0100] Specifically, the algorithm first sets the number of iterations and population size for the screening algorithm, initializes the locations of characteristic individuals in the pill image as initial threshold codes, ranks individuals based on fitness, selects the optimal individual using a roulette wheel method as a search reference, and uses a search algorithm to optimize its distribution in the feature space. Individuals with the highest information entropy are continuously recorded as potential solutions, and the individual distribution is fine-tuned using a guidance mechanism to ultimately form an optimal set of segmentation thresholds. This improves the representativeness of the initial segmentation values, enhances search efficiency, and enhances recognition accuracy.
[0101] Specifically, the screening algorithm is a multiverse optimization algorithm, a heuristic optimization algorithm that simulates the interaction of multiple parallel universes in the universe. It finds the global optimal solution by simultaneously searching for solutions in multiple "universes." In this invention, the multiverse optimization algorithm is used to initialize the population position, balance the distribution of characteristic individuals, and adjust the position and distribution of characteristic individuals in the bulk oral tablets through iterative optimization, ultimately obtaining the optimal set of segmentation thresholds.
[0102] In this optional embodiment, the method of using a search algorithm to balance the distribution of individual features of bulk oral tablets in the feature space includes:
[0103] S2331. Initialize the spatial position of the characteristic individuals of the bulk oral tablets and set the maximum number of iterations of the search algorithm;
[0104] S2332. Construct a fitness function based on regional information entropy and edge continuity to evaluate the expressiveness and balance of individual features of bulk oral tablets in the image feature space.
[0105] S2333. Dynamically adjust the population size based on fitness feedback to ensure that the characteristic individuals of bulk oral tablets remain fully distributed in the high-dimensional feature space;
[0106] S2334. Perform non-dominated sorting based on fitness to divide the bulk oral tablets characteristic individuals into core bulk oral tablets characteristic individuals and auxiliary bulk oral tablets characteristic individuals;
[0107] S2335. Generate new bulk oral tablet feature individuals within the preset area, and introduce a perturbation mechanism to the core bulk oral tablet feature individuals;
[0108] S2336. Fusion of the current bulk oral tablets feature individuals and the new bulk oral tablets feature individuals, retaining the optimal bulk oral tablets feature individuals through non-dominated sorting screening, and forming a new generation of balanced bulk oral tablets feature individuals distributed in the feature space.
[0109] Specifically, the search algorithm is the Dandelion algorithm, a swarm intelligence optimization algorithm based on the dispersal behavior of dandelion seeds, which possesses both global and local search capabilities. In this paper, the Dandelion algorithm is used to initialize the positions of individual tablet features and, through fitness guidance and perturbation mechanisms, evenly distributes these features within the feature space, thereby improving image segmentation.
[0110] Specifically, the spatial positions of the tablet's characteristic individuals are initialized, and the maximum number of iterations of the search algorithm is set. A fitness function based on information entropy and edge continuity is constructed to evaluate the individual's characteristic expression and distribution balance. The population size is dynamically adjusted based on fitness, and core and auxiliary individuals are divided through non-dominated sorting. New individuals are generated within a pre-set region, and perturbations are introduced to the core individuals. Finally, the current and newly generated individuals are merged, and the optimal individuals are retained through screening to form a new generation distribution. This optimizes the distribution of characteristic individuals and improves the robustness and accuracy of region segmentation.
[0111] In this optional embodiment, the method of fusing the current bulk oral tablet feature individuals with the new bulk oral tablet feature individuals, retaining the optimal bulk oral tablet feature individuals through non-dominated sorting screening (through a scattered search algorithm), and forming a new generation of balanced bulk oral tablet feature individuals in the feature space includes:
[0112] S23361. Generate an initial set of bulk oral tablet feature individuals using a diversified generation method, and improve the set of tablet feature individuals using an improvement strategy.
[0113] S23362. Select the most dispersed high-quality bulk oral tablets feature individuals from the current bulk oral tablets feature individual set to construct a reference subset, and guide the future bulk oral tablets feature individuals to cover the feature space area;
[0114] S23363. Generating a set of bulk oral tablet feature individual subsets from the current bulk oral tablet feature individual set, performing a combination operation on each bulk oral tablet feature individual subset to generate a new bulk oral tablet feature individual, and improving the new bulk oral tablet feature individual using an improvement strategy, so that the improved new bulk oral tablet feature individuals constitute a new bulk oral tablet feature individual subset;
[0115] S23364. Merge the current bulk oral tablet feature individual with the new bulk oral tablet feature individual subset, and select the optimal bulk oral tablet feature individual through non-dominated sorting to form an updated set;
[0116] S23365. If the maximum number of iterations has not been reached, return to step S23363 to continue iterating; otherwise, output the optimal bulk oral tablet feature individual to form a new generation of balanced bulk oral tablet feature individual distribution in the feature space.
[0117] Specifically, the scatter search algorithm is an optimization method that emphasizes solution diversity and global coverage, and is suitable for global optimization in complex solution spaces. In this invention, the scatter search algorithm is used to screen the most widely distributed tablet feature individuals, guide the generation and fusion of new individuals, and retain the optimal individuals through non-dominated sorting, achieving a balanced distribution within the feature space.
[0118] Specifically, the method first constructs a collection of tablet feature individuals through a diversified generation method and combines this with a strategy to improve and optimize it. High-quality individuals with a relatively dispersed distribution are then selected as references to guide future generations to cover a wider feature space. Existing individuals are combined to generate and improve new subsets. The new and old sets of individuals are then merged, and the optimal individual is selected through non-dominated sorting. If the iteration limit is not reached, it continues to iterate and update, ultimately outputting a balanced new generation of individual distributions. This improves the diversity of segmented individuals and global search capabilities, enhancing the model's generalization performance.
[0119] In this optional embodiment, the analyzing the key feature areas using the recognition analysis algorithm to determine the relevant information of the bulk oral tablets includes:
[0120] S31, extracting multiple candidate feature regions from the key feature region, generating an initial feature information solution set based on a recognition analysis algorithm, and constructing a search space;
[0121] S32, using a region selection algorithm to select the candidate feature region with the highest recognition degree from each candidate feature region, and randomly generate new feature region solutions in other regions of the key feature region to expand the global recognition range;
[0122] S33. Integrate the recognition results of all feature areas and extract relevant information of the bulk oral tablets.
[0123] Specifically, the recognition and analysis algorithm is a bee algorithm. In the present invention, the bee algorithm is used to construct a search space in the key feature area, explore the candidate feature area through the "scout bee" and "collector bee" mechanisms, and dynamically adjust the search strategy, and finally integrate the optimal recognition results to efficiently extract the key feature information of the tablets.
[0124] Specifically, the algorithm first extracts multiple candidate regions from the segmented key feature regions. Using a recognition analysis algorithm, it generates an initial feature solution set, building an image feature search space. Subsequently, a region selection algorithm selects the most recognizable candidate region from each candidate region. Simultaneously, new feature regions are generated in other areas of the image to expand the recognition range. Finally, all recognition results are integrated to extract key information such as the tablet's shape, color, and inscription. This improves feature recognition accuracy and regional coverage, enhancing the stability and comprehensiveness of tablet recognition.
[0125] In this optional embodiment, the region selection algorithm is used to select the candidate feature region with the highest recognition degree from each candidate feature region, and new feature region solutions are randomly generated in other regions of the key feature region. Expanding the global recognition range includes:
[0126] S321, setting the number of iterations of the region selection algorithm, initializing an initial solution set of feature regions consisting of several candidate feature regions in the candidate feature regions;
[0127] S322, randomly selecting a feature region from the initial solution set, performing recognition analysis operations on it, extracting visual information of the tablet and recording it as the current recognition solution;
[0128] S323, calculating the recognition degree of each feature region solution, screening out the optimal feature region, updating the optimal recognition region of the individual feature region and the global recognition optimal solution;
[0129] S324, generating a new feature region solution based on the position of the identified feature region, integrating the existing information, and updating the candidate feature region solution set for the next round of recognition;
[0130] S325. When the maximum number of iterations is reached, the feature region with the highest global recognition degree is output as a new feature region solution, and the global recognition range is expanded.
[0131] Specifically, the region selection algorithm is a quantum evolutionary algorithm. In the present invention, the quantum evolutionary algorithm is used to initialize and iteratively update the candidate feature region solution set, and efficiently search for the optimal recognition region through quantum superposition and probabilistic selection mechanism, thereby expanding the global recognition range of tablet images.
[0132] Specifically, the algorithm first sets the number of iterations for the region selection algorithm and initializes several feature regions from the candidate feature regions to form an initial solution set. Then, it randomly selects regions for recognition analysis, extracts the visual features of the tablet, and selects the optimal region based on its recognition degree. This region is then combined with its position information to generate a new feature region solution. The solution set is then optimized and updated in successive rounds, ultimately outputting the feature region with the highest global recognition degree at the end of the iterations as the final recognition basis. This improves the intelligence and accuracy of the recognition region selection, enhancing feature coverage and recognition efficiency.
[0133] In this optional embodiment, randomly selecting a feature region from the initial solution set, performing recognition analysis operations on the feature region, extracting visual information of the tablet, and recording the extracted information as the current recognition solution includes:
[0134] S3221. Randomly select a number of selected feature regions from the initial solution set as the input sample set for this round of recognition analysis;
[0135] S3222, extracting characteristic visual features from the selected feature area and constructing a multi-dimensional visual feature vector;
[0136] S3223. Input the constructed multi-dimensional visual feature vector into a preset prediction model (including but not limited to a convolutional neural network model, a support vector machine, a random forest, etc.), output the tablet category prediction result of the selected feature area, form the visual information of the tablet and record it as the current recognition solution.
[0137] Specifically, several feature regions are randomly selected from the initial solution set as the recognition sample set for the current round. Image features are then extracted from each selected region to generate a multidimensional visual feature vector. This vector is then fed into the trained pill category prediction model, which outputs the corresponding category recognition result and records it as the current recognition solution. This effectively improves the diversity of recognition samples and prediction accuracy, enhancing classification robustness.
[0138] like Figure 2 As shown, according to another embodiment of the present invention, a bulk oral tablet code scanning and recognition system based on AI image is provided, comprising:
[0139] Data acquisition module 1, used to scan the QR code or barcode, automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of bulk oral tablets;
[0140] A region segmentation module 2 is used to perform region segmentation on the bulk oral tablet feature image based on an image segmentation algorithm, and identify key feature regions in the bulk oral tablet feature image;
[0141] Information recognition module 3, used to analyze key feature areas using recognition and analysis algorithms to determine relevant information about bulk oral tablets;
[0142] The information comparison and display module 4 is used to compare the relevant information of the bulk oral tablets with the information of the bulk oral tablets in the known database, and display the tablet information based on the comparison result.
[0143] According to another embodiment of the present invention, a scanning device is provided, including a frame, a camera module and a visual processor. The visual processor includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of the above-mentioned AI image-based bulk oral tablet code scanning and recognition method are implemented.
[0144] Specifically, the frame includes a bracket and a crossbeam, and the bracket and the crossbeam are connected.
[0145] Specifically, the camera module is installed on the beam and is used to collect image information on the outer packaging of bulk oral tablets with a QR code or barcode located below the beam.
[0146] Specifically, the visual processor is used to detect the QR code or barcode in the image information, and identify the detected QR code or barcode to obtain the QR code or barcode information therein.
[0147] The above description is only a preferred embodiment of the present invention and is not intended to limit 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 scanning and identifying bulk oral tablets based on AI images, characterized in that: include: S1. Scan the QR code or barcode to automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of bulk oral tablets; S2. Based on an image segmentation algorithm, performing region segmentation on the bulk oral tablet feature image and identifying key feature regions in the bulk oral tablet feature image; S3. Analyzing the key feature areas using a recognition analysis algorithm to determine relevant information about the bulk oral tablets; S4. Compare the relevant information of the bulk oral tablets with the information of the bulk oral tablets in a known database, and display the tablet information based on the comparison result.
2. The method for scanning and identifying bulk oral tablets based on AI images according to claim 1, characterized in that: The method of performing region segmentation on the bulk oral tablet feature image based on the image segmentation algorithm and identifying key feature regions in the bulk oral tablet feature image includes: S21. Acquire a characteristic image of the bulk oral tablets, generate an image grayscale histogram, and analyze the brightness and contrast information of the image; S22, setting the initial parameters of the image segmentation algorithm, including the maximum number of iterations, the population size, and the segmentation threshold; S23, using a screening algorithm to initialize the population position, and encoding the individual positions of the bulk oral tablet features into a set of segmentation thresholds; S24. Calculate the fitness of the characteristic individuals of the bulk oral tablets in the population according to the Tsallis entropy, update the weight parameters and positions, and adjust the boundaries and positions of the tablet characteristic regions; S25. Individual variation of bulk oral tablet characteristics using lens imaging adversarial learning mechanism; S26. If the maximum number of iterations is reached, the bulk oral tablet feature individual with the largest Tsallis entropy value is returned and decoded as the optimal segmentation threshold; otherwise, go to step S24; S27 . Performing region segmentation on the bulk oral tablet feature image according to the optimal segmentation threshold, and outputting key feature regions in the bulk oral tablet feature image.
3. The method for scanning and identifying bulk oral tablets based on AI images according to claim 2, characterized in that: The method of initializing the population position by using a screening algorithm and encoding the individual positions of the bulk oral tablet features into a segmentation threshold set includes: S231, setting the population size and the maximum number of iterations of the screening algorithm, and initializing the positions of the characteristic individuals of the bulk oral tablets as the initial codes of the candidate threshold set; S232, sorting the bulk oral tablet feature individuals according to fitness, and selecting the best tablet feature individual as a search reference using a roulette wheel method; S233. Using a search algorithm to balance the distribution of individual features of bulk oral tablets in the feature space; S234. Compare the performance of the current bulk oral tablet feature individual with the performance of the historical bulk oral tablet feature individual, retain the bulk oral tablet feature individual with the highest information entropy, and record its position as a potential segmentation solution; S235. Fine-tune the distribution of the characteristic individuals of the bulk oral tablets in combination with the guidance mechanism, and after reaching the maximum number of iterations, encode the positions of the characteristic individuals of the bulk oral tablets into a set of segmentation thresholds.
4. The method for scanning and identifying bulk oral tablets based on AI images according to claim 3, characterized in that: The method of using a search algorithm to balance the distribution of bulk oral tablet feature individuals in the feature space includes: S2331. Initialize the spatial position of the characteristic individuals of the bulk oral tablets and set the maximum number of iterations of the search algorithm; S2332. Construct a fitness function based on regional information entropy and edge continuity to evaluate the expressiveness and balance of individual features of bulk oral tablets in the image feature space. S2333. Dynamically adjust the population size based on fitness feedback to ensure that the characteristic individuals of bulk oral tablets remain fully distributed in the high-dimensional feature space; S2334. Perform non-dominated sorting based on fitness to divide the bulk oral tablets characteristic individuals into core bulk oral tablets characteristic individuals and auxiliary bulk oral tablets characteristic individuals; S2335. Generate new bulk oral tablet feature individuals within the preset area, and introduce a perturbation mechanism to the core bulk oral tablet feature individuals; S2336. Fusion of the current bulk oral tablets feature individuals and the new bulk oral tablets feature individuals, retaining the optimal bulk oral tablets feature individuals through non-dominated sorting screening, and forming a new generation of balanced bulk oral tablets feature individuals distributed in the feature space.
5. The AI image-based bulk oral tablet code scanning and recognition method according to claim 4, characterized in that: The fusion of the current bulk oral tablet feature individuals and the new bulk oral tablet feature individuals, retaining the optimal bulk oral tablet feature individuals through non-dominated sorting screening, and forming a new generation of balanced bulk oral tablet feature individuals in the feature space includes: S23361. Generate an initial set of bulk oral tablet feature individuals using a diversified generation method, and improve the set of tablet feature individuals using an improvement strategy. S23362. Select the most dispersed high-quality bulk oral tablets feature individuals from the current bulk oral tablets feature individual set to construct a reference subset, and guide the future bulk oral tablets feature individuals to cover the feature space area; S23363. Generating a set of bulk oral tablet feature individual subsets from the current bulk oral tablet feature individual set, performing a combination operation on each bulk oral tablet feature individual subset to generate a new bulk oral tablet feature individual, and improving the new bulk oral tablet feature individual using an improvement strategy, so that the improved new bulk oral tablet feature individuals constitute a new bulk oral tablet feature individual subset; S23364. Merge the current bulk oral tablet feature individual with the new bulk oral tablet feature individual subset, and select the optimal bulk oral tablet feature individual through non-dominated sorting to form an updated set; S23365. If the maximum number of iterations has not been reached, return to step S23363 to continue iterating; otherwise, output the optimal bulk oral tablet feature individual to form a new generation of balanced bulk oral tablet feature individuals distributed in the feature space.
6. The method for scanning and identifying bulk oral tablets based on AI images according to claim 1, characterized in that: The identification and analysis algorithm is used to analyze the key feature areas to determine the relevant information of the bulk oral tablets, including: S31, extracting multiple candidate feature regions from the key feature region, generating an initial feature information solution set based on a recognition analysis algorithm, and constructing a search space; S32, using a region selection algorithm to select the candidate feature region with the highest recognition degree from each candidate feature region, and randomly generate new feature region solutions in other regions of the key feature region to expand the global recognition range; S33. Integrate the recognition results of all feature areas and extract relevant information of the bulk oral tablets.
7. The method for scanning and identifying bulk oral tablets based on AI images according to claim 6, characterized in that: The region selection algorithm is used to select the candidate feature region with the highest recognition degree from each candidate feature region, and randomly generate new feature region solutions in other regions of the key feature region to expand the global recognition range. S321, setting the number of iterations of the region selection algorithm, initializing an initial solution set of feature regions consisting of several candidate feature regions in the candidate feature regions; S322, randomly selecting a feature region from the initial solution set, performing recognition analysis operations on it, extracting visual information of the tablet and recording it as the current recognition solution; S323, calculating the recognition degree of each feature region solution, screening out the optimal feature region, updating the optimal recognition region of the individual feature region and the global recognition optimal solution; S324, generating a new feature region solution based on the position of the identified feature region, integrating the existing information, and updating the candidate feature region solution set for the next round of recognition; S325. When the maximum number of iterations is reached, the feature region with the highest global recognition degree is output as a new feature region solution, and the global recognition range is expanded.
8. The method for scanning and identifying bulk oral tablets based on AI images according to claim 7, characterized in that: The process of randomly selecting a feature region from the initial solution set, performing recognition analysis on the feature region, extracting visual information of the tablet and recording the information as the current recognition solution includes: S3221. Randomly select a number of selected feature regions from the initial solution set as the input sample set for this round of recognition analysis; S3222, extracting characteristic visual features from the selected feature area and constructing a multi-dimensional visual feature vector; S3223. Input the constructed multi-dimensional visual feature vector into a preset prediction model, output the tablet category prediction result of the selected feature area, form the visual information of the tablet and record it as the current recognition solution.
9. An AI image-based bulk oral tablet code scanning and recognition system, used to implement the AI image-based bulk oral tablet code scanning and recognition method according to any one of claims 1 to 8, characterized in that: The system includes: A data acquisition module is used to scan a QR code or barcode, automatically activate tablet recognition, obtain images of bulk oral tablets at different angles, and extract feature images of the bulk oral tablets; A region segmentation module is used to perform region segmentation on the bulk oral tablet feature image based on an image segmentation algorithm, and identify key feature regions in the bulk oral tablet feature image; An information recognition module, configured to analyze key feature areas using a recognition analysis algorithm to determine relevant information about the bulk oral tablets; The information comparison and display module is used to compare the relevant information of bulk oral tablets with the information of bulk oral tablets in a known database, and display the tablet information based on the comparison results.
10. A scanner device comprising a frame, a camera module and a visual processor, wherein the visual processor comprises a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the bulk oral tablet scanning and recognition method based on AI image are implemented as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Intelligent image segmentation method based on artificial myxomycete colony
CN113744216A
Metal surface rusty spot detection method fused with multi-direction multi-element universe local segmentation
CN117115075A
Drug information identification method and device
CN117911668A
Article identification method, system and device and computer readable storage medium
CN118982681A
Leaf state identification method in tea leaf processing process
CN119810809A