Medicine production whole-process quality tracing method and system applying block chain technology
By using blockchain technology to obtain the effective detection area inside the injection bottle and performing adaptive enhancement processing, the problem of missed detection and misjudgment caused by optical interference in traditional detection systems is solved, and high-precision automated drug quality detection is achieved.
Patent Information
- Application Number
- CN202511275151.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2026-01-20
AI Technical Summary
Traditional automated visual inspection systems are susceptible to optical interference from transparent glass vials when detecting insoluble microparticles in injectable drugs, leading to missed detections or misjudgments and affecting the reliability of drug quality control.
Using blockchain technology, a liquid matrix composed of pixel values of the liquid region inside the injection bottle is obtained. A region growing method is used to obtain an effective test area, and the pixel values are adaptively enhanced to train a recognition network to identify impurity types.
It precisely avoids blurry areas at the bottle edge and bottom, improving the visibility of tiny impurities, reducing missed detections and false positives, and enhancing the accuracy and reliability of automated detection.
Smart Images

Figure CN121365981A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a medicine production whole-process quality traceability method and system using blockchain technology. BACKGROUND
[0002] As a distributed ledger technology, blockchain technology has the characteristics of decentralization, tamper resistance, and full traceability, and can effectively establish a multi-party collaboration trust mechanism. It has been gradually applied in the fields of supply chain management, food traceability, medical data sharing, etc. In medicine traceability, blockchain stores key data of production, circulation, and sales through chain storage to ensure the authenticity and integrity of the traceability information, providing a technical foundation for realizing whole-life-cycle supervision. In medicine production quality traceability, some image recognition processing methods can be used to detect liquid medicines.
[0003] In the production process of medicines, the quality control of injection medicines is of great importance. One of the key links is to detect whether insoluble particles (such as glass chips, rubber chips, and other impurities) exist in the liquid medicine and whether the liquid level meets the standard. At present, automatic visual detection has gradually replaced traditional manual lamp detection to improve efficiency and accuracy. However, injection medicines generally use transparent glass bottles as containers, and the curved surface characteristics of the bottle body will cause complex light refraction and reflection, resulting in distortion, defocus, and missing of key information in the collected images in the edge and bottom areas of the bottle. This optical interference makes it difficult for traditional automatic visual detection systems to accurately locate the truly clear and effective detection area in the bottle, especially when identifying small-sized and low-contrast suspended impurities. The lack of obvious features often leads to missed detection or misjudgment, seriously affecting the reliability of medicine quality control. SUMMARY
[0004] In order to reduce the missed detection and misjudgment of medicine detection and improve the timeliness and reliability of medicine traceability, the present application provides a medicine production whole-process quality traceability method and system using blockchain technology.
[0005] In a first aspect, the present application provides a medicine production whole-process quality traceability method using blockchain technology, which adopts the following technical solution:
[0006] The medicine production whole-process quality traceability method using blockchain technology acquires a liquid matrix composed of pixel values of the internal liquid area of an injection bottle; uses a region growing method to acquire an effective test area in the liquid matrix; processes the pixel values of the effective test area to obtain an enhanced matrix; trains a recognition network to identify the type of impurities in the enhanced matrix; collects the enhanced matrix in the production process and uses the trained recognition network to identify whether impurities exist; and in response to the existence of impurities, prompts relevant personnel to conduct quality inspection on the corresponding production process.
[0007] The step of processing the pixel values of the effective test region to obtain an enhancement matrix comprises: obtaining an optimal enhancement coefficient in a preset value range, and in response to a pixel value of any pixel point being greater than a mean value of pixel values of all pixel points in the effective test region, performing enhancement processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value; and in response to the pixel value of the pixel point being less than the mean value of the pixel values of all pixel points in the effective test region, performing suppression processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain the enhanced value, the enhanced value of each pixel point constituting the enhancement matrix.
[0008] The beneficial effect is that the region growing method is used to expand from the center of the image, intelligently avoiding the fuzzy distortion area of the bottle edge and the bottle bottom, so as to accurately obtain an effective test region without optical interference; and a differentiated pixel enhancement strategy is constructed, the pixel value is high, the enhancement processing is applied, the pixel value is low, the pixel point is suppressed, and the optimal enhancement coefficient is automatically found, so that the visibility of the micro impurities is greatly improved. Thus, the missing detection and misjudgment problems caused by poor image quality in the prior art are reduced, and the accuracy and reliability of the automatic impurity detection are improved.
[0009] Optionally, the step of performing enhancement processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value comprises: for any pixel point, taking a ratio of the pixel point to a mean value of all pixel points in the effective test region as a reference value, taking a product of the optimal enhancement coefficient, the reference value and the pixel value as an adjustment value, and taking an integral result of the adjustment value as the enhanced value.
[0010] The step of performing suppression processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value comprises: taking a ratio of the pixel point to a mean value of all pixel points in the effective test region as a reference value, taking a product of a result of the reference value as a base and the optimal enhancement coefficient as an index and the pixel value as an adjustment value, and taking an integral result of the adjustment value as the enhanced value.
[0011] The beneficial effect is that a kind of enhancement mode is used for background pixels, and another weakening mode is used for darker potential impurity pixels. This nonlinear and differentiated processing method can more effectively enlarge the gray difference between impurities and background, maximize the signal-to-noise ratio, and thus highlight the impurities.
[0012] Optionally, the step of obtaining the effective test region using the region growing method comprises: selecting a growing starting point, taking pixel points in a neighborhood of the growing starting point as candidate growing points, obtaining a growing distance based on a difference between the pixel values of the candidate growing points and the starting point; calculating a difference value between the growing distance and a mean value of growing distances of already grown points to obtain a growing value; and in response to the growing value being less than a set threshold, determining the candidate growing point as a growing point.
[0013] The method can dynamically and accurately grow a detection range that conforms to the actual clear area contour, and ensures that subsequent detection is performed on high-quality image data.
[0014] Optionally, the growth starting point is a pixel point corresponding to a geometric center position of the liquid matrix.
[0015] The starting point is set at the geometric center that is hardly affected by the bottle wall surface refraction, and the region growing process is started from the clearest and most stable area, thereby ensuring the stability of the region growing process and the accuracy of the finally generated effective test area.
[0016] Optionally, the step of obtaining the optimal enhancement coefficient in the preset value range comprises: starting from the minimum value in the preset value range, increasing the enhancement coefficient each time, performing DBSCAN clustering on the enhanced matrix after each increase, and calculating the enhancement evaluation to obtain an enhancement evaluation sequence; taking the ratio of two adjacent enhancement evaluations as adjacent changes, for any enhancement evaluation, obtaining the mean value of the adjacent changes corresponding to all enhancement evaluations before the enhancement evaluation in the enhancement evaluation sequence, and taking the enhancement evaluation and the mean value of the adjacent changes as the change coefficient; in response to the change coefficient being less than the set threshold for the first time, the corresponding enhancement coefficient is the optimal enhancement coefficient.
[0017] The effect of each enhancement is evaluated by iteratively increasing the enhancement coefficient and using the enhancement evaluation defined by the DBSCAN clustering result until the enhancement effect is saturated.
[0018] Optionally, in the process of performing DBSCAN clustering on the enhanced matrix, the distance between two pixel points is measured as the normalized result of the pixel value difference between the two pixel points.
[0019] Optionally, the step of calculating the enhancement evaluation comprises: counting the number of pixel points in each cluster after DBSCAN clustering, taking the minimum value of the number of pixel points in the cluster and the ratio of the preset minimum number of samples in the cluster as the first index, taking the result of the number of clusters after hyperbolic tangent function processing as the second index, and taking the product of the first index and the second index as the enhancement evaluation.
[0020] Optionally, the preset minimum number of samples in the cluster is the result of 0.05% multiplied by the number of all pixel points in the enhanced matrix and rounded.
[0021] Optionally, the step of identifying whether the impurities exist by using the trained recognition network comprises: after the injection bottle is shaken up and down, a plurality of enhanced matrices are collected in real time, the plurality of enhanced matrices are input into the impurity recognition network, and all impurities in the plurality of enhanced matrices are marked.
[0022] In a second aspect, the application provides a medicine production whole-process quality traceability system using blockchain technology, which uses the following technical solution:
[0023] The medicine production whole-process quality traceability system using blockchain technology comprises a processor and a memory, and the memory stores computer program instructions which, when executed by the processor, implement the medicine production whole-process quality traceability method using blockchain technology described above.
[0024] The beneficial effect is that the medicine production whole-process quality traceability method using blockchain technology described above is generated into a computer program and stored in the memory to be loaded and executed by the processor, so that the system made of the memory and the processor is convenient to use.
[0025] The application has the following technical effects:
[0026] In the application, the accurate effective detection area is first obtained through the region growing algorithm to reduce the influence of the fuzzy area of the bottle body or the bottle bottom on the subsequent medicine detection. Meanwhile, the pixel points in the effective detection area are processed by different strategies to improve the contrast of the impurities and the background, highlight the impurities, and thus improve the accuracy of medicine detection and provide a reliable foundation for subsequent medicine traceability. BRIEF DESCRIPTION OF DRAWINGS
[0027] Figure 1 FIG. 1 is a method flowchart of the medicine production whole-process quality traceability method using blockchain technology of the embodiment of the application.
[0028] Figure 2 FIG. 2 is a method flowchart of step S3 of the medicine production whole-process quality traceability method using blockchain technology of the embodiment of the application.
[0029] Figure 3 FIG. 3 is a method flowchart of step S31 of the medicine production whole-process quality traceability method using blockchain technology of the embodiment of the application. DETAILED DESCRIPTION
[0030] The embodiment of the application discloses a medicine production whole-process quality traceability method using blockchain technology, which accurately extracts the effective detection area in the bottle body, then adaptively enhances the contrast of impurities, and finally classifies the impurities by using a deep learning network, so as to realize high-precision automatic detection of medicine quality and defect traceability of production links.
[0031] Reference Figure 1 The medicine production whole-process quality traceability method using blockchain technology comprises steps S1-S5.
[0032] S1: Obtain a liquid matrix composed of pixel values of the internal liquid area of the injection bottle.
[0033] In the embodiment, the detection device mainly comprises an image acquisition unit and a rotating structure. The image acquisition unit comprises a light source and a light acquisition plate, which are fixed oppositely on the same horizontal line. The rotating structure is located at the bottom of the injection medicine bottle and is used to rotate the bottle body at a fixed rotating speed. During the rotation, the light acquisition plate continuously acquires the light transmitted through the bottle body to form a series of light intensity matrices, i.e. original image data.
[0034] Since the injection medicine bottle is a transparent curved glass, the original light intensity matrix acquired contains not only the bottle body information but also a large amount of background information, and the edge of the bottle body is blurred due to optical distortion. In order to accurately extract the core region required for subsequent analysis, it is necessary to first segment the bottle body.
[0035] Specifically, an injection bottle segmentation network is trained. The network is a kind of semantic segmentation network. The training process is as follows: first, a batch of light intensity matrix samples are manually labeled, and the injection bottle region in the image is labeled as label 1 and the background region is labeled as label 0. Then, these 0-1 labeled matrices are input into the semantic segmentation network as the training set. The loss function of the network is set as the cross-entropy loss function. When the loss function value is less than the preset convergence threshold or the training reaches the preset iteration number, the training is completed, and an injection bottle segmentation network capable of effectively distinguishing the bottle body from the background is obtained.
[0036] In actual detection, the real-time acquired light intensity matrix is input into the trained injection bottle segmentation network, and the network outputs a 0-1 matrix with the same size as the original matrix, wherein the pixels with a value of 1 correspond to the bottle body region. Multiplying the 0-1 matrix and the original light intensity matrix according to the corresponding positions can filter out the background to obtain an injection bottle matrix containing only the bottle body information.
[0037] Based on the fixed proportional relationship between the bottle body and the liquid volume, the lower half can be obtained according to the preset proportion based on the overall height of the bottle body in the injection bottle matrix. Here, it can also be understood that under the condition that the liquid volume in the injection bottle is fixed, the liquid level is also fixed, so the liquid region can be determined based on the proportional relationship between the liquid level and the overall height of the bottle body to obtain the liquid matrix.
[0038] S2: Use the region growing method to obtain an effective test region in the liquid matrix.
[0039] The left and right sides and the bottom region of the liquid matrix are poor in image quality due to the bottle body curve and the bottle bottom bump, and are not effective detection regions. Therefore, the effective test region needs to be further constructed. In this embodiment, a center point growing algorithm is used to determine the effective test region. Taking any frame of the liquid matrix as an example, first, the pixel point of the geometric center position is determined as the starting center point (starting point) of growth. Then, starting from the center point, the adjacent pixel points are continuously grown.
[0040] Specifically, the step of obtaining the effective test region using the region growing method includes: selecting a growth starting point, taking the pixel points in the neighborhood of the growth starting point as candidate growth points, obtaining a growth distance based on the pixel value difference between the candidate growth points and the starting point; calculating the difference between the growth distance and the average growth distance of the grown points to obtain a growth value; in response to the growth value being less than a set threshold, determining the candidate growth point as a growth point
[0041] In this step, the calculation formula of the growth distance can be expressed as: wherein, d k is the growth distance between the kth candidate growth point and the center pixel point, h k is the pixel value of the kth candidate growth point, and h0 is the pixel value of the center pixel point. The case that the pixel value is 0 is not considered, or a positive number can be added to the denominator part in other embodiments to prevent the denominator from being 0.
[0042] As can be seen from the formula, the closer the pixel value of the candidate growth point k is to the center point pixel value, the smaller the growth distance, indicating that the point is more similar to the characteristics of the center region.
[0043] The calculation formula of the growth value can be expressed as: r k = d k -mean{D}; wherein, r k is the growth value of the kth candidate pixel point, mean{D} is the average growth distance of all grown pixel points, and d k is the growth distance between the kth candidate growth point and the center pixel point. The formula compares the growth distance of the current candidate pixel point with the average growth distance of the grown region pixel points to determine whether the current point deviates from the overall characteristics of the effective region.
[0044] In response to the growth value r k of a new pixel point being less than or equal to a preset growth threshold, the point is determined as an effective growth point, which is included in the effective test region, and further growth is continued on the un-grown pixel points around it. Otherwise, if r kIf the value is greater than the threshold, it is considered that the fuzzy boundary has been reached, and the growth in this direction is stopped. In this embodiment, the growth threshold is preferably 0.2, which is an empirical value. In the implementation process, those skilled in the art can determine it based on their own experience. When the threshold is set too high, the effective area may be too small, and part of the detection information may be lost; when it is set too low, part of the fuzzy area may be misjudged as an effective area. The growth in all directions is iterated until completion, and all the growth points determined together constitute the final effective test area of the liquid matrix of the frame.
[0045] S3: processing the pixel values of the effective test area to obtain an enhanced matrix.
[0046] Impurities in the injection liquid are often small in size or high in transparency, and have low contrast with the background in the original image, making it difficult to detect directly. Therefore, an adaptive contrast enhancement algorithm is used here to maximize the difference in pixel values and make the impurity area more prominent.
[0047] Reference Figure 2 Step S3 includes steps S310-S33.
[0048] S31: obtaining an optimal enhancement coefficient in a preset value range.
[0049] The step of obtaining an optimal enhancement coefficient in a preset value range includes:
[0050] S311: starting from the minimum value in the preset value range, increasing the enhancement coefficient each time, and after each increase, performing DBSCAN clustering on the enhanced matrix and calculating the enhancement evaluation to obtain an enhancement evaluation sequence.
[0051] To determine the optimal enhancement coefficient, an iterative optimization strategy is introduced in this embodiment, that is, to select the optimal enhancement coefficient in a similar preset value range. Here, the preset range is [1, +∞) to positive infinity, that is, the initial value of the enhancement coefficient is set to 1. In each iteration, the value of a is increased by 1, and the pixel values of the pixel points in the effective test area are enhanced to generate an enhanced matrix. Subsequently, the enhanced matrix is analyzed using the DBSCAN clustering algorithm to quantify the prominence of the impurities.
[0052] In the step of enhancing the pixel values of the pixel points in the effective test area, the main principle is to enhance the pixel points with large pixel values and weaken the pixel values of the pixel points with small pixel values to improve the contrast.
[0053] For any pixel point, in response to the pixel value of the pixel point being greater than the average of the pixel values of all pixel points in the effective test area, the pixel value of the pixel point is enhanced based on the enhancement coefficient to obtain an enhanced value.
[0054] The step of enhancing the pixel value of the pixel point based on the enhancement coefficient to obtain an enhanced value comprises: for any pixel point, taking the ratio of the pixel point to the mean value of all pixel points in the effective test region as a reference value, taking the product of the optimal enhancement coefficient, the reference value and the pixel value as an adjustment value, and taking the result of rounding off the adjustment value as the enhanced value.
[0055] In response to the pixel value of the pixel point being less than the mean value of the pixel values of all pixel points in the effective test region, the pixel value of the pixel point is suppressed based on the enhancement coefficient to obtain an enhanced value; the enhanced values of the pixel points form an enhanced matrix.
[0056] The step of suppressing the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value comprises: taking the ratio of the pixel point to the mean value of all pixel points in the effective test region as a reference value, taking the product of the result with the reference value as the base and the optimal enhancement coefficient as the index and the pixel value as an adjustment value, and taking the result of rounding off the adjustment value as the enhanced value.
[0057] In summary, the enhanced value of the pixel point in the effective test region can be represented by the following formula: In the formula, h represents the enhanced value of the pixel point, a represents the enhancement coefficient; h' represents the original pixel value of the pixel point; mean{H} represents the mean value of the pixel values of all pixel points in the effective test region; E() represents the rounding function.
[0058] In the formula, for pixels (usually the background) brighter than the average brightness (pixel value), a stronger amplification mode of linear gain is adopted; for pixels (possibly impurities) darker than the average brightness, suppression in the form of an exponential function is adopted to enhance the impurities while suppressing the background noise.
[0059] Through the above steps, the enhanced values corresponding to the pixel points in the effective test region are obtained, the enhanced values of the pixel points form an enhanced matrix, and then the enhanced matrix is subjected to DBSCAN clustering and the enhanced evaluation is calculated.
[0060] In the process of DBSCAN clustering of the enhanced matrix, the distance between two pixel points is measured as the normalized result of the pixel value difference between the two pixel points. Meanwhile, in the clustering process, the preset minimum neighborhood density can reach a distance of 0.1, and the minimum number of samples in the cluster is an empirical value b, and a plurality of clusters are obtained after the clustering process is completed.
[0061] After the clustering is completed, the enhanced evaluation corresponding to the current enhancement is calculated: the number of pixel points in each cluster after DBSCAN clustering is counted, the ratio of the minimum number of pixel points in the cluster to the preset minimum number of samples in the cluster is taken as the first index, the number of clusters is processed by the hyperbolic tangent function, and the result is taken as the second index, and the product of the first index and the second index is taken as the enhanced evaluation.
[0062] The calculation formula of the enhancement evaluation can be represented as: where w is the enhancement evaluation, c is the number of clustering clusters, {m} is the sequence of the number of pixel points in all clustering clusters; min{m} is the number of pixel points in the smallest clustering cluster; b is the minimum sample number in the clustering cluster, which is an empirical value, and is usually 0.05% multiplied by the number of all pixel points of the enhancement matrix and rounded; tanh() is a hyperbolic tangent function. The tanh(c) term is used to smoothly reflect the contribution of the number of clustering clusters, while The term focuses on whether the least obvious impurity cluster is large enough and sufficiently reliable. The larger the enhancement evaluation, the clearer and more significant the impurities are segmented.
[0063] The ratio of the two adjacent enhancement evaluations is taken as the adjacent change. For any enhancement evaluation, the mean value of the adjacent changes corresponding to all the enhancement evaluations before the enhancement evaluation in the enhancement evaluation sequence is obtained, the enhancement evaluation and the mean value of the adjacent changes are taken as the change coefficient, and in response to the change coefficient being less than a set threshold for the first time, the corresponding enhancement coefficient is the optimal enhancement coefficient.
[0064] With the continuous increase of the enhancement coefficient, an enhancement evaluation sequence [w1, w2, ···, w a ] is obtained. In order to judge whether the enhancement effect has reached saturation, the change coefficient of the enhancement evaluation sequence is calculated.
[0065] S312: The ratio of the two adjacent enhancement evaluations is taken as the adjacent change. For any enhancement evaluation, the mean value of the adjacent changes corresponding to all the enhancement evaluations before the enhancement evaluation in the enhancement evaluation sequence is obtained, the enhancement evaluation and the mean value of the adjacent changes are taken as the change coefficient; and in response to the change coefficient being less than a set threshold for the first time, the corresponding enhancement coefficient is the optimal enhancement coefficient.
[0066] The calculation formula of the change coefficient can be represented as: In the formula, q represents the change coefficient when the enhancement coefficient is a; w a The enhancement evaluation when the enhancement coefficient is a.
[0067] The change coefficient q reflects the ratio of the evaluation improvement brought by the latest enhancement to the average level before. When q is less than a preset change threshold (in this embodiment, the threshold is preferably 0.5), it is indicated that the enhancement effect cannot be significantly improved by continuously increasing the enhancement coefficient a, and the iteration process is terminated. At this time, the corresponding a value is the optimal enhancement coefficient.
[0068] S32: For any pixel point, in response to the pixel value of the pixel point being greater than the mean value of the pixel values of all pixel points in the effective test region, performing enhancement processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value; in response to the pixel value of the pixel point being less than the mean value of the pixel values of all pixel points in the effective test region, performing suppression processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value, and the enhanced values of the pixel points constitute an enhanced matrix.
[0069] This step is the same as the step of enhancing the effective test region in step S311 described above, and will not be described here.
[0070] S4: Training an identification network to identify the type of impurities in the enhanced matrix.
[0071] After obtaining the enhanced matrix that can clearly highlight the impurities, the purpose of this step is to automatically classify the impurities and associate them to specific production links. For this purpose, a network for identifying impurities needs to be trained, which can use a convolutional neural network (CNN) architecture.
[0072] The training process is as follows: first, a professional technician manually labels different types of impurities in a batch of enhanced matrix samples. For example, metal shavings are labeled as category 1, rubber particles are labeled as category 2, and precipitates are labeled as category 3, etc. These enhanced matrices carrying impurity category labels are used as training data and input into the CNN. Similarly, the loss function is set to the cross-entropy loss function, and the network weights are continuously optimized through the backpropagation algorithm. When the loss value converges or reaches the maximum training epoch, the training is complete, and a network for identifying and classifying multiple common impurities is obtained; the neural network memory training step is a conventional technical means in the art, and will not be described here.
[0073] S5: Collecting enhanced matrices in the production process and using the trained identification network to identify whether there are impurity types; in response to the presence of impurity types, prompting relevant personnel to conduct quality inspection on the corresponding production process.
[0074] In actual application, when an injection bottle is shaken, the system will continuously collect images for a period of time (for example, 10 seconds), and perform processing of steps S1 and S2 on each frame of image to generate a time sequence containing 10 enhanced matrices. These 10 enhanced matrices are sequentially input into the trained impurity identification network. The network will identify all impurity regions in each matrix and output their category labels, and in response to the presence of impurity types, prompt relevant personnel to conduct quality inspection on the corresponding production process to complete the traceability of drug quality.
[0075] The application further discloses a medicine production whole-process quality tracing system applying a blockchain technology, comprising a processor and a memory.
[0076] The system further comprises a communication bus and a communication interface and other components well known to those skilled in the art, and the arrangement and functions of the components are known in the art, and thus will not be described here.
[0077] The above are preferred embodiments of the application, and are not intended to limit the protection scope of the application, so that: any equivalent changes made according to the structure, shape, principle of the application should be covered within the protection scope of the application.
Claims
1. A method for tracing the quality of a drug product throughout the entire production process using blockchain technology, characterized in that, The method comprises the following steps: acquiring a liquid matrix composed of pixel values of a liquid area inside a syringe bottle; acquiring an effective test area in the liquid matrix using a region growing method; processing pixel values of the effective test area to obtain an enhanced matrix; training a recognition network to recognize impurity types in the enhanced matrix; collecting the enhanced matrix in a production process and using the trained recognition network to recognize whether there is an impurity type; in response to the presence of an impurity type, prompting relevant personnel to conduct quality inspection on the corresponding production process; wherein the step of processing the pixel values of the effective test area to obtain the enhanced matrix comprises: acquiring an optimal enhancement coefficient in a preset value range, for any pixel point, in response to the pixel value of the pixel point being greater than the mean value of the pixel values of all pixel points in the effective test area, performing enhancement processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value; in response to the pixel value of the pixel point being less than the mean value of the pixel values of all pixel points in the effective test area, performing suppression processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value, and the enhanced values of the pixel points constitute the enhanced matrix. 2.The medicine production whole-process quality tracing method based on blockchain technology according to claim 1, wherein the step of enhancing the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value comprises: for any pixel point, taking the ratio of the pixel point to the mean value of all pixel points in the effective test area as a reference value, taking the product of the optimal enhancement coefficient, the reference value and the pixel value as an adjustment value, and taking the result of rounding the adjustment value as the enhanced value; the step of performing suppression processing on the pixel value of the pixel point based on the optimal enhancement coefficient to obtain an enhanced value comprises: taking the ratio of the pixel point to the mean value of all pixel points in the effective test area as a reference value, taking the product of the result of taking the reference value as the base and the optimal enhancement coefficient as the index and the pixel value as an adjustment value, and taking the result of rounding the adjustment value as the enhanced value. 3.The medicine production whole-process quality tracing method based on blockchain technology according to claim 1, characterized in that, the step of acquiring the effective test area using the region growing method comprises: selecting a growth starting point, taking the pixel points in the neighborhood of the growth starting point as candidate growth points, and obtaining a growth distance based on the difference between the pixel values of the candidate growth points and the starting point; calculating the difference between the growth distance and the mean value of the growth distances of the grown points to obtain a growth value; in response to the growth value being less than a set threshold, determining the candidate growth points as growth points. 4.The medicine production whole-process quality tracing method based on blockchain technology according to claim 3, characterized in that, the growth starting point is a pixel point corresponding to the geometric center position of the liquid matrix. 5.The medicine production whole-process quality tracing method based on blockchain technology according to claim 1, characterized in that, the step of acquiring the optimal enhancement coefficient in the preset value range comprises: starting from the minimum value in the preset value range, increasing the enhancement coefficient each time, performing DBSCAN clustering on the enhanced matrix after each increase and calculating an enhanced evaluation to obtain an enhanced evaluation sequence; taking the ratio of two adjacent enhanced evaluations as adjacent changes, for any enhanced evaluation, obtaining the mean value of the adjacent changes corresponding to all enhanced evaluations before the enhanced evaluation in the enhanced evaluation sequence, taking the enhanced evaluation and the mean value of the adjacent changes as a change coefficient; in response to the change coefficient being less than a set threshold for the first time, the corresponding enhancement coefficient is the optimal enhancement coefficient. 6.The medicine production whole-process quality tracing method based on blockchain technology according to claim 5, characterized in that, in the process of performing DBSCAN clustering on the enhanced matrix, the distance between two pixel points is the normalized result of the difference between the pixel values of the two pixel points. 7.The medicine production whole-process quality tracing method based on blockchain technology according to claim 5, characterized in that, The step of calculating the enhancement evaluation comprises: counting the number of pixel points in each cluster after DBSCAN clustering, taking the minimum value of the number of pixel points in the cluster as a first index, taking the number of clusters after hyperbolic tangent function processing as a second index, and taking the product of the first index and the second index as the enhancement evaluation. 8.The medicine production whole-process quality tracing method based on blockchain technology according to claim 7, characterized in that, The preset minimum number of samples in the cluster is 0.05% multiplied by the number of all pixel points in the enhancement matrix and rounded. 9.The medicine production whole-process quality tracing method based on blockchain technology according to claim 1, characterized in that, The step of identifying whether there is a type of impurity by using the trained recognition network comprises: after shaking the injection bottle up and down, real-time acquisition of a plurality of enhancement matrices, inputting the plurality of enhancement matrices into the impurity recognition network, and marking all impurities in the plurality of enhancement matrices.
10. A medicine production whole-process quality traceability system using blockchain technology, characterized in that, The method comprises: A processor and a memory, the memory stores computer program instructions, when the computer program instructions are executed by the processor, the method for tracing the quality of the whole process of the drug production by applying the blockchain technology according to any one of claims 1-9 is realized.