PH test paper reading scoring method, system and equipment and readable storage medium
Through computer vision technology and image processing model, the automatic scoring pH test strip readings are solved, and the problem of poor accuracy and consistency of manual scoring is achieved, and stable and efficient scoring is achieved under different lighting conditions.
Patent Information
- Application Number
- CN202510212253.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-02-25
AI Technical Summary
In the prior art, the evaluation of pH test strip readings relies on manual observation, which has problems such as poor accuracy and consistency, susceptible to light and operator experience, and the existing automation methods lack the accuracy in image processing and analysis, so efficient automatic scoring cannot be achieved.
Using computer vision technology, experimental images are obtained through cameras, and image recognition, clustering and classification models are used to automatically score pH test strip readings, including image recognition model recognition experimental equipment, clustering models perform pixel point binarization and cluster analysis, classification models judge pH values, and automatic scoring is performed in combination with preset scoring rules.
It realizes accurate and automatic scoring of pH test strip readings under different lighting conditions, eliminates artificial errors, improves the objectivity and accuracy of the score, can operate stably in complex environments, and reduces manual intervention.
Smart Images

Figure CN120356196A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of experimental scoring, and in particular, to a method, system, device and readable storage medium for scoring pH test strip readings. Background Art
[0002] Currently, the reading evaluation of pH test strips usually relies on manual observation and visual inspection. Operators judge the pH value by comparing the color change with a preset colorimetric card. This method is quite common in experimental teaching and student evaluation, especially in chemistry experimental teaching at junior high school and primary school stages. Although this method is simple and easy to implement, its accuracy and consistency are poor, and it is easily affected by factors such as light, operator experience, and observation angle. In addition, the manual scoring process may lead to subjective errors, and there are significant differences in the scoring criteria and accuracy among different personnel. Existing technologies assist in reading the pH value through manual or semi-automated methods. Although these methods improve the accuracy of the experiment to a certain extent, they still fail to completely solve the uncertainties in the operation process and the interference of human factors. For example, the existing image processing technologies have insufficient accuracy in equipment recognition, image cropping and analysis, and cannot achieve efficient automatic scoring and judgment. Especially in a multi-variable experimental environment, there are still certain limitations in the processing and analysis of image information.
[0003] Therefore, there is a need for a method and system that can score pH test strip readings in different complex lighting environments to solve the above problems. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, system, device and readable storage medium for scoring pH test strip readings to improve the above problems. To achieve the above purpose, the technical solutions adopted by the present invention are as follows:
[0005] In a first aspect, the present application provides a method for scoring pH test strip readings, including:
[0006] Obtaining first information, where the first information is all image information during the experiment collected by a camera;
[0007] Sending the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour;
[0008] Sending the second information to a preset clustering model for processing to obtain third information. The clustering model is a model for performing binary processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information, and the third information is pixel point information after at least one clustering process;
[0009] Send the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test paper color change center;
[0010] Score the fourth information and the student's answer according to a preset scoring rule to obtain fifth information. The fifth information is the score information of each student's pH test paper reading inspection point.
[0011] In a second aspect, the present application also provides a scoring system for pH test paper readings, including:
[0012] An acquisition unit for acquiring first information, where the first information is all image information during the experiment collected by a camera;
[0013] An identification unit for sending the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour;
[0014] A clustering unit for sending the second information to a preset clustering model for processing to obtain third information. The clustering model is a model for performing binary processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information, and the third information is the pixel point information after at least one clustering process;
[0015] A classification unit for sending the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test paper color change center;
[0016] A scoring unit for scoring the fourth information and the student's answer according to a preset scoring rule to obtain fifth information. The fifth information is the score information of each student's pH test paper reading inspection point.
[0017] In a third aspect, the present application also provides a scoring device for pH test paper readings, including:
[0018] A memory for storing a computer program;
[0019] A processor for implementing the steps of the scoring method for pH test paper readings when executing the computer program.
[0020] Fourthly, the present application also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned scoring method based on the pH test strip reading are implemented.
[0021] The beneficial effects of the present invention are as follows:
[0022] Through computer vision technology, the present invention automatically and accurately scores the color change of the pH test strip. This method obtains all the image information during the experiment through a camera, and combines the preset image recognition, clustering and classification models to gradually process and analyze the pH test strip image, from image recognition, contour cropping to clustering analysis, feature extraction, and finally to automatic scoring. Compared with traditional manual methods and existing automated image processing technologies, the present invention can more accurately identify experimental equipment and discolored areas, eliminate human errors, and has high robustness, and can operate stably in different experimental environments and lighting conditions. In addition, the use of deep learning and clustering analysis methods enables the system to automatically adjust the scoring criteria without relying on manual intervention, realizing personalized student assessment and scoring processes, thereby effectively improving the objectivity and accuracy of experimental scoring.
[0023] Other features and advantages of the present invention will be described in the subsequent specification, and, in part, will be obvious from the specification, or will be understood by implementing the embodiments of the present invention. The objectives and other advantages of the present invention can be realized and obtained by the structures specifically pointed out in the written specification, claims, and drawings. Description of the Drawings
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for use in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0025] Figure 1 It is a schematic flow chart of the scoring method for the pH test strip reading described in the embodiments of the present invention;
[0026] Figure 2 It is a schematic structural diagram of the scoring system for the pH test strip reading described in the embodiments of the present invention;
[0027] Figure 3 It is a schematic structural diagram of the scoring device for the pH test strip reading described in the embodiments of the present invention.
[0028] In the figure: 701, acquisition unit; 702, recognition unit; 703, clustering unit; 704, classification unit; 705, scoring unit; 801, processor; 802, memory; 803, multimedia component; 804, input / output (I / O) interface; 805, communication component. Detailed implementation manners
[0029] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. The components of the embodiments of the present invention described and illustrated herein generally may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0030] It should be noted that like reference numerals and letters denote like items in the following drawings. Therefore, once an item is defined in one drawing, it does not require further definition and explanation in subsequent drawings. Meanwhile, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive distinction and cannot be construed as indicating or implying relative importance.
[0031] Embodiment 1:
[0032] This embodiment provides a method for scoring the reading of a pH test paper.
[0033] Refer to Figure 1 , which shows that this method includes steps S1, S2, S3, S4 and S5.
[0034] Step S1: Acquire first information, where the first information is all image information during the experiment collected by a camera;
[0035] It can be understood that this step provides a large amount of raw data for subsequent image analysis. The first information obtained is not only a real-time record of the experimental process but also includes various details of the experimental equipment (such as the color change of the pH test paper, the calibration of the color comparison card, etc.). The quality of these image information directly determines the effect of subsequent image recognition and data processing. Therefore, the collected information needs to undergo post-image preprocessing, such as noise removal, color correction, etc., to ensure the effectiveness of the image data. In the entire scoring process, image acquisition, as the first step, provides necessary support for the precise analysis in subsequent steps, with the technical effect of laying a foundation and ensuring the reliability of subsequent data processing.
[0036] Step S2: Send the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour.
[0037] It can be understood that through an efficient image recognition algorithm, the position of the experimental equipment is accurately recognized, and key information is extracted through contour cropping. This process significantly improves the processing efficiency and accuracy of subsequent steps. For example, only when the image of the experimental equipment is accurately cropped can subsequent clustering analysis and classification processing be carried out based on clear and interference-free image data. Compared with traditional manual annotation or simple image analysis methods, the image recognition model can automatically adapt to different experimental conditions, reduce manual intervention and errors, and ensure the consistency and accuracy of the processing results. In this step, step S2 includes step S21, step S22, step S23, and step S24.
[0038] Step S21: Convert the first information into at least two frames of images, perform edge detection on each frame of the image, and obtain the contour information of each experimental equipment.
[0039] It can be understood that edge detection can eliminate the noise in the image, focus on the actual contour of the experimental equipment, avoid the interference of irrelevant information, and improve the accuracy and efficiency of subsequent image processing. In this step, step S21 includes step S211, step S212, and step S213.
[0040] Step S211: Perform grayscale processing on each frame of the image in the first information. Specifically, by taking the average value of the brightness of the three RGB components of each frame of the image as the grayscale value, the grayscale-processed image is obtained.
[0041] It can be understood that grayscale processing can effectively reduce the complexity of the image and provide a more concise input for subsequent edge detection. Color images contain a large amount of color information, but edge detection mainly relies on brightness changes to determine the boundaries of objects. By converting the image into a grayscale image, the focus can be placed on the brightness distribution of the image rather than color changes, which helps improve the effect and accuracy of edge detection. Furthermore, after grayscale processing, the amount of image data is also effectively compressed, saving resources for subsequent calculations and improving the processing speed. In practical applications, grayscale images can often reduce the complexity caused by color interference while maintaining key information, making the system more efficient in contour detection and object recognition.
[0042] Step S212: Perform edge detection on the grayscale-processed image using an edge detection algorithm to obtain the edge information corresponding to each grayscale-processed image, and perform differential processing on the grayscale-processed image based on each edge information to obtain the image information after edge detection.
[0043] It can be understood that in this step, the edge information in the image is extracted through an edge detection algorithm, and then differential processing is performed on the image, significantly enhancing the visibility of the contours of the experimental equipment. This process helps to clearly distinguish the experimental equipment from the background or other interfering information, improving the accuracy of image processing. In the subsequent contour cropping and object recognition stages, this edge information will be used as key information input to ensure that the system can accurately locate and extract the contours of the experimental equipment in a complex experimental environment. In addition, differential processing also helps to reduce the interference of redundant information, making the edges in the image clearer and more independent, thus improving the efficiency of subsequent classification and analysis.
[0044] Step S213: Correlate the image information after edge detection with each experimental equipment to obtain the image information after edge detection corresponding to each experimental equipment, and use it as the contour information of each experimental equipment.
[0045] It can be understood that the image obtained after edge detection in this step is usually a binary image containing multiple edges, and these edges may be the boundaries of experimental equipment, the background, or other objects. Therefore, the system needs to identify and distinguish different experimental equipment in the image, extract the edge information corresponding to each experimental equipment from the overall image. Among them, the system analyzes the connected regions in the image, identifies the regions occupied by each experimental equipment, and assigns a unique label to each region. In this way, the system can extract the edge information of different experimental equipment from the image and save the edge information of each equipment as an independent contour image.
[0046] Step S22: Based on the contour information of each experimental equipment, perform bounding box selection and name annotation to obtain a contour sample set of the experimental equipment;
[0047] It can be understood that the bounding box selection process in this step refers to drawing a bounding box for each experimental equipment in the image according to the contour information of the experimental equipment. This box delimits the specific position and size of the experimental equipment in the image. The drawing of the bounding box can be based on the minimum bounding rectangle of the contour or a frame of other shapes, and the specific form depends on the shape of the experimental equipment. After the bounding box selection is completed, the system needs to perform name annotation on each experimental equipment, that is, assign the corresponding name of the experimental equipment to each selected area. Name annotation usually depends on a pre-defined equipment classification system. The system judges the category of the experimental equipment according to the features in the image (such as color, shape, size, etc.) and performs annotation on it.
[0048] Step S23: Divide the historical contour sample set of the preset experimental equipment into a training set, a test set, and a validation set, and input them into the target detection algorithm for training. Among them, according to the change trend of the loss function, adjust the learning rate and the number of iterations until the change value of the loss function is less than the preset threshold to obtain a trained picture recognition model;
[0049] It can be understood that through the training and optimization of the system in this step, an efficient target detection model that can accurately identify experimental equipment is finally obtained. By reasonably dividing the data set and combining the target detection algorithm, the system can effectively improve the recognition accuracy of the model and ensure that the model can operate efficiently in real scenarios. In addition, adjusting the learning rate and the number of iterations, and dynamically adjusting according to the loss function, enables the model to converge quickly during training and avoid overfitting, thus ensuring the generalization ability of the model. This process greatly improves the accuracy of image recognition and the robustness of the system, providing a solid foundation for subsequent steps such as image cropping and clustering analysis.
[0050] Step S24: Input the contour sample set of the experimental equipment into the trained picture recognition model to obtain the name information and position information of the experimental equipment, and perform cropping based on the contour information, name information, and position information of each experimental equipment to obtain experimental equipment pictures.
[0051] It can be understood that in this step, by inputting the contour sample set of the experimental equipment into the trained image recognition model, the system can make predictions based on the learned features. Among them, the trained recognition model is the YOLOv3 model. The image recognition model will, according to the contour information in the input image, identify the category (i.e., name information) of each experimental equipment and their specific positions in the image (i.e., position information). The position is usually represented by a bounding box, which contains the coordinate information of the experimental equipment in the image, usually the coordinates of the upper left corner and the lower right corner of the rectangular box. The name information is given according to the classification result of the model, identifying the type of the object within each bounding box, such as "test tube", "beaker", etc.
[0052] Step S3: Send the second information to a preset clustering model for processing to obtain third information. The clustering model is a model that performs binaryzation processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information. The third information is the pixel point information after at least one clustering process.
[0053] It can be understood that in this step, through binaryzation and clustering analysis, the ability to extract key information in the image is greatly improved. Binaryzation processing can effectively remove the noise in the image, making the clustering analysis more accurate. And the clustering analysis can identify and separate the regions with similar features, thus highlighting the discolored region and the color patches of the colorimetric card. In this step, step S3 includes step S31 and step S32.
[0054] Step S31: Extract the pixel points of the pH test paper image and the preset colorimetric card image in the experimental equipment picture obtained by cutting, and perform binaryzation processing on the pixel points of the discolored center region and the center regions of the fourteen color patches of the colorimetric card image to obtain the pixel point information of the binaryzation experimental equipment image and the colorimetric card image.
[0055] It can be understood that in this step, through pixel point extraction and binaryzation processing, the processing efficiency and accuracy of the image are greatly improved. Binaryzation processing reduces the noise and irrelevant information in the image, making the extraction of the discolored region and the color patch region clearer, and at the same time provides an important basis for subsequent clustering analysis and classification tasks. Through this processing, the system can accurately identify and separate the discolored center region of the pH test paper and the center regions of the color patches of the colorimetric card, thus ensuring the accuracy of the subsequent scoring step.
[0056] Step S32: Use the DBSCAN clustering model to perform clustering analysis on the pixel points of the binaryzation experimental equipment image to obtain at least one pixel point cluster. Mark and call the pixel point cluster with the largest number of pixel points, and delete the other pixel point clusters to obtain the filtered pixel points of the discolored center of the pH test paper and the center points of the fourteen color patches of the colorimetric card.
[0057] It can be understood that in this step, the region of interest R obtained by the recognition module (the region is the smallest square image containing the pH test paper and the colorimetric card) is sent to the clustering module to obtain the coordinates of the centers of the 14 color patches of the colorimetric card and the coordinates of the center point of the pH test paper. These clustering centers are used to cut the region of interest R to generate 15 P×P image patches of equal size. Among them, using the DBSCAN clustering model can significantly improve the accuracy and efficiency of the system when processing experimental images. Through clustering analysis, the system can automatically identify and separate the key regions in the image without manual intervention. By deleting irrelevant clusters and retaining the main clusters, this step ensures that the important information in the image is accurately extracted, thus providing reliable data support for subsequent steps such as image classification and scoring. This not only improves the accuracy of image processing, but also greatly reduces the interference of background noise on the results, enhancing the robustness and practicality of the system.
[0058] Step S4: Send the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test paper color change center.
[0059] It can be understood that through the processing of the classification model in this step, complex image data can be converted into specific pH value information, greatly improving the automation and accuracy of scoring. The classification model can accurately judge the pH value according to different colors and degrees of color change without manual intervention. This enables the system to efficiently and stably process a large amount of experimental data and provide accurate evaluations for each student's answer. In this step, step S4 includes steps S41, S42, S43, and S44.
[0060] Step S41: Divide the pH test paper image in the experimental equipment picture obtained by cutting into a preset number of image patches of a preset size based on the pixel point information in the third information.
[0061] It can be understood that in this step, the pH test paper image in the experimental equipment picture is divided according to the pixel point data in the third information. Here, the "preset number" and "preset size" refer to the number of image patches and the size of each image patch set in advance, usually determined based on the overall size of the image and the detailed information to be extracted. The purpose of image division is to divide the test paper image into multiple smaller regions so that the pixel information in each region is more concentrated and uniform, facilitating subsequent analysis.
[0062] Step S42: Map all the image patches to a vector space of a fixed dimension to obtain the embedding vector corresponding to each image patch.
[0063] It is understandable that this step not only improves the recognition accuracy of the model for image features through the embedded vector mapping, but also optimizes the computational efficiency, enabling the subsequent feature extraction, classification, and scoring processes to be faster and more accurate.
[0064] In this step, 15 image patches are reshaped to obtain an image sequence where is a vector of length P 2 , is an image patch on the colorimetric card, is an image patch on the pH test paper. Each image patch is used as a vector input, and through linear transformation, the features of the image are extracted and an embedded vector sequence representing the image sequence is generated where the linear transformation matrix C is the number of color channels. For general images, there are three RGB channels, and C is equal to 3. D is the dimension of the hidden features.
[0065] Step S43: Encode the embedded vector corresponding to each image patch based on the Transformer encoder, and input the position encoding information of each image patch obtained by the encoding into a preset number of Transformer encoder layers for feature extraction. Among them, each Transformer encoder layer includes a self-attention mechanism and a feed-forward neural network to obtain the feature representation of each image patch;
[0066] It is understandable that before this step sends the feature sequence into the Transformer encoder module for multi-head attention to enhance feature extraction, it is also necessary to perform position encoding on the feature sequence. It can be noted that the colors of adjacent color patches on the colorimetric card are relatively similar, and the pH values are also relatively close. The color differences of color patches that are slightly farther apart are large, and the pH values are also very different. This step hopes to inform the model of this prior knowledge together with the feature sequence, so that the model can learn through the prior knowledge is the image patch for joint determination, while is a different image patch that needs to be predicted.
[0067] This step uses rotational position encoding. A two-dimensional rotation matrix has the following properties: R(θ1)R(θ2) = R(θ1 + θ2), R(θ) T = R(-θ). When there is no position encoding, the self-attention operation in the encoder is attension(q,k) = q·k = qk T ; when rotational position encoding is added, the self-attention operation in the encoder is attension(qR(θ1),kR(θ2)) = qR(θ1)·kR(θ2) = qR(θ1)R(θ2) T kT = qR(θ1 - θ2)k T , so that when self-attention operation is performed between the image patch embedding vectors through the query vector q and the key vector k, the relative position information R(θ1 - θ2) between these two image patches can be obtained. The rotational position encoding can accelerate the convergence speed of the model through the relative position information, and higher prediction accuracy can be obtained in fewer iteration cycles. Generalizing the two-dimensional rotation matrix to N dimensions, we have:
[0068]
[0069] where d is the dimension of the hidden features and P is the width and height of the image patch.
[0070] In this step, the region of interest R is obtained. The width and height of the region R are W and H respectively. Then the region R can be divided into anchor boxes of size P×P. Then the Hungarian algorithm is used to optimally match the 15 image patches obtained previously with these anchor boxes. The core of the Hungarian algorithm is to minimize the total loss value. First, a cost matrix is constructed. For each pair of image patches and anchor boxes, their loss values are calculated, and the GIoU loss is used as the loss function.
[0071]
[0072] where A and B are the image patch and the anchor box for optimal matching respectively, and C is the smallest bounding rectangle of A and B.
[0073] Since there are 15 image patches and anchor boxes, then a matrix will be constructed, where each element represents the GIoU loss between an image patch and an anchor box.
[0074] After using the Hungarian algorithm to match the image patches and the anchor boxes one by one, the unique anchor box number m of each image patch can be obtained, where Substituting the anchor box number into the N-dimensional rotation matrix, the N-dimensional rotational position encoding corresponding to each image patch is obtained
[0075] After adding the discrete rotational position encoding to the embedding vector sequence, the original input z0 is obtained. Among them, due to the "pre-attention mechanism" in the present invention, the image patches change from continuous to discrete, resulting in that the conventional rotational position encoding cannot be used for subsequent position encoding. Therefore, in this step, discrete rotational position encoding is used when embedding the vector sequence, and its specific formula is as follows:
[0076]
[0077] where is a vector of length P 2 which is obtained by reshaping an image patch of size P×P. The superscript i represents the feature vector of the i-th image patch. Patches 1 to 14 are for the pH 1 to 14 regions of the colorimetric card, and patch 15 is for the pH test paper region; E is a linear transformation matrix that maps the feature vector of each image patch into a vector space of a fixed dimension to obtain the embedding vector of the image patch; where R is the real number space, P is the length and width of the image patch, C is the number of color channels of the image, usually 3, and D is the dimension of the hidden feature, that is, the dimension of the "vector space of fixed dimension" mentioned above; is a discrete rotation position encoding matrix, and i represents the encoding matrix of the i-th image patch; where R is the real number space and D is the dimension of the hidden feature.
[0078] Step S44: Perform layer normalization on the feature representations of all image patches, and send the normalized feature representations to the classification head for classification to obtain the classification result.
[0079] It can be understood that the original input z0 is sent to the Transformer encoder to extract high-dimensional features. The Transformer encoder consists of a multi-head self-attention mechanism MSA, a multi-layer perceptron MLP, and layer normalization LN. After passing through L layers of encoders, we have:
[0080] z` l = MSA(LN(z l-1 )) + z l-1
[0081] z l = MLP(LN(z` l )) + z` l
[0082] where MSA is the multi-head self-attention mechanism (Multi-Head Self-Attention), LN is layer normalization (Layer Normalization), MLP is the multi-layer perceptron (Multilayer Perceptron), and z i is the feature representation of the original input z0 after passing through i layers of the Transformer encoder. For example, z l-1 is the feature representation after l - 1 layers, and the difference between z` l and z l is that z` l is the intermediate result only passing through the multi-head self-attention mechanism of l layers of encoders, and z lis the feature representation passing through the complete l - layer encoder, where l = 1…L and L is the total number of layers of the encoder. The last - dimensional vector after feature extraction by the L - layer encoder, that is, the pH test paper image patch feature vector, is layer - normalized and then sent into the classification head for classification to obtain the classification result y. The classification head is a fully - connected layer with a dimension of D×1. The formula of the classification structure is as follows:
[0083]
[0084] where MLP is the Multilayer Perceptron, and LN is the Layer Normalization, L in is the total number of layers of the encoder, is the 15th feature vector of z L which is the feature vector of the pH test paper region image patch after passing through the L - layer Transformer encoder, and y is the classification result.
[0085] Step S5: Score the fourth information and the student's answer according to a preset scoring rule to obtain the fifth information, where the fifth information is the score information of each student's pH test paper reading inspection point.
[0086] It can be understood that this step combines image processing, classification algorithms, scoring rules, and the student's answer situation, effectively improving the automation and accuracy of scoring. Through the automated classification of the machine - learning model, the system can evaluate each experimental process in real - time and quickly give a score according to the preset criteria, reducing the errors and subjectivity in manual scoring. In this step, step S5 includes step S51, step S52, and step S53.
[0087] Step S51: Calculate the difference value between the classification result and the preset category based on the annealing exponential weighted mean - square error, and update the learning rate and weight influence coefficient of the model through the gradient - descent method until the difference value is less than the preset threshold to obtain an optimized classification model;
[0088] During the training process of the neural network model in this step, the loss function is designed using a method different from the traditional cross-entropy loss function based on one-hot encoding. Specifically, the classification task is transformed into a regression task, where the length of the prediction vector is 1 instead of the number of pH values, which is 14. Different from the conventional classification task, in the pH test strip reading task, the prediction result of the model is not a discrete class label, but a continuous numerical value. Therefore, when the model wrongly predicts a test strip with a pH value of 2 as a pH value of 13, or wrongly predicts it as a pH value of 3, although both prediction results are incorrect, the deviation of the former from the true value is more serious, and its loss should be higher. Through the design of the regression task, the loss function can give a greater error penalty according to the distance between the predicted value and the true value, thereby training the model more effectively and improving its performance in practical applications.
[0089] Therefore, an annealing exponential weighted mean square error loss function is proposed.
[0090]
[0091] Among them, AEW in AEW_MSE represents Annealing Exponential Weighted, MSE represents Mean-Square Error, α and β are weight influence parameters, which can be adjusted according to the actual scenario requirements; τ is the temperature coefficient, which gradually decreases as the model training progresses, n is the mini-batch size for each update during the gradient descent process, and i is the number of the training sample subset; y i is the predicted value of training sample i, is the true value of training sample i; exp(x) is e to the power of x, that is, e x , and e is the natural constant.
[0092] Step S52: Send the feature representations of all image patches to the optimized classification model for classification to obtain the optimized classification result;
[0093] It can be understood that this step effectively improves the accuracy and stability of classification by using the optimized classification model. The optimized model can more sensitively identify subtle color changes or regional differences, reducing the risks of misjudgment and missed judgment. By classifying all image patches, the system can globally evaluate the changes in the pH test strip without being limited to a certain part or a specific area.
[0094] Step S53: Based on the optimized classification result, the preset scoring rule, and the student's answer, perform scoring to obtain the scoring result.
[0095] It can be understood that this step effectively realizes the seamless connection from image analysis to student assessment by combining the classification results and scoring rules. This step ensures the automation and efficiency of the scoring process, reducing the errors and subjectivity of manual scoring. At the same time, by combining the student's response situation and classification results, the system can provide refined and personalized scoring, reflecting the specific performance of the student in the experimental operation, rather than just a single pH value score.
[0096] Embodiment 2:
[0097] As Figure 2 shown, this embodiment provides a scoring system for pH test strip readings. Refer to Figure 2 The system includes an acquisition unit 701, an identification unit 702, a clustering unit 703, a classification unit 704, and a scoring unit 705.
[0098] The acquisition unit 701 is used to acquire first information, where the first information is all image information during the experiment collected by the camera;
[0099] The identification unit 702 is used to send the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour;
[0100] The clustering unit 703 is used to send the second information to a preset clustering model for processing to obtain third information. The clustering model is a model for performing binary processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information, and the third information is pixel point information after at least one clustering process;
[0101] The classification unit 704 is used to send the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test strip color change center;
[0102] The scoring unit 705 is used to score the fourth information according to a preset scoring rule with the student's response to obtain fifth information. The fifth information is the score information of the pH test strip reading inspection points for each student.
[0103] It should be noted that regarding the system in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to this method, and will not be elaborated here.
[0104] Embodiment 3:
[0105] Corresponding to the above method embodiments, a scoring device for pH test strip readings is also provided in this embodiment. A scoring device for pH test strip readings described below can be correspondingly referred to in relation to a method for scoring pH test strip readings described above.
[0106] Figure 3 It is a block diagram of a scoring device 800 for pH test strip readings shown according to an exemplary embodiment. As Figure 3 shown, the scoring device 800 for pH test strip readings may include: a processor 801, a memory 802. The scoring device 800 for pH test strip readings may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0107] Among them, the processor 801 is used to control the overall operation of the pH test strip reading scoring device 800 to complete all or part of the steps in the above-mentioned pH test strip reading scoring method. The memory 802 is used to store various types of data to support the operation of the pH test strip reading scoring device 800. These data may include, for example, instructions for any application or method operating on the pH test strip reading scoring device 800, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, and so on. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. Among them, the screen may be a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, and the microphone is used to receive external audio signals. The received audio signals may be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the pH test strip reading scoring device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G or 5G, or a combination of one or more of them. Therefore, the corresponding communication component 805 may include: a Wi-Fi module, a Bluetooth module, an NFC module.
[0108] In an exemplary embodiment, the scoring device 800 for pH test strip readings may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components, and is used to execute the above-described method for scoring pH test strip readings.
[0109] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided. When the program instructions are executed by a processor, the steps of the above-described method for scoring pH test strip readings are implemented. For example, the computer-readable storage medium may be the above-described memory 802 including program instructions, and the above program instructions may be executed by the processor 801 of the scoring device 800 for pH test strip readings to complete the above-described method for scoring pH test strip readings.
[0110] Embodiment 4:
[0111] Corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment. A readable storage medium described below and a method for scoring pH test strip readings described above can be mutually referred to.
[0112] A readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the method for scoring pH test strip readings in the above method embodiment are implemented.
[0113] Specifically, the readable storage medium may be various readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.
[0114] The foregoing is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
[0115] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A scoring method for reading pH test strips, characterized in that, Including: Obtain first information, where the first information is all image information during the experiment collected by a camera; Send the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour; Send the second information to a preset clustering model for processing to obtain third information. The clustering model is a model for performing binarization processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information, and the third information is pixel point information after at least one clustering process; Send the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test paper color change center; Score the fourth information and the student's answer according to a preset scoring rule to obtain fifth information. The fifth information is the score information of the pH test paper reading inspection points for each student.
2. The scoring method for pH test strip readings according to claim 1, characterized in that , sending the first information to a preset image recognition model for processing to obtain second information, including: Convert the first information into at least two frames of images, perform edge detection on each frame of image to obtain the contour information of each experimental equipment; Based on the contour information of each experimental equipment, perform bounding box selection and name annotation to obtain a contour sample set of the experimental equipment; Divide the historical contour sample set of the preset experimental equipment into a training set, a test set, and a validation set, and input them into a target detection algorithm for training. Among them, according to the change trend of the loss function, adjust the learning rate and the number of iterations until the change value of the loss function is less than a preset threshold to obtain a trained picture recognition model; Input the contour sample set of the experimental equipment into the trained picture recognition model to obtain the name information and position information of the experimental equipment, and perform cropping based on the contour information, name information, and position information of each experimental equipment to obtain pictures of the experimental equipment.
3. The scoring method for pH test strip readings according to claim 1, characterized in that , sending the second information to a preset clustering model for processing to obtain third information, including: Extract pixel points from the pH test paper image and a preset color comparison card image in the cropped experimental equipment picture, perform binarization processing on the pixel points of the color change center area and the center area pixel points of the fourteen color blocks of the color comparison card image to obtain the pixel point information of the binarized experimental equipment image and the color comparison card image; Use the DBSCAN clustering model to perform clustering analysis on the pixel points of the binarized experimental equipment image to obtain at least one pixel point cluster, mark and call the pixel point cluster with the largest number of pixel points, and delete other pixel point clusters to obtain the filtered pixel points of the pH test paper color change center and the center pixel points of the fourteen color blocks of the color comparison card.
4. The scoring method for pH test strip readings according to claim 1, characterized in that , sending the third information to a preset classification model for processing to obtain fourth information, including: Divide the pH test paper image in the cropped experimental equipment picture into a preset number of image blocks of a preset size based on the pixel point information in the third information; Map all image patches to a vector space of a fixed dimension to obtain the embedding vectors corresponding to each image patch; Encode the embedding vectors corresponding to each image patch based on a Transformer encoder, and input the position encoding information of each image patch obtained by the encoding into a preset number of Transformer encoder layers for feature extraction. Each Transformer encoder layer includes a self-attention mechanism and a feed-forward neural network to obtain the feature representation of each image patch; Perform layer normalization on the feature representations of all image patches, and send the normalized feature representations to a classification head for classification to obtain a classification result.
5. A scoring system for pH test strip readings, characterized in that, Includes: An acquisition unit for acquiring first information, where the first information is all image information during an experiment collected by a camera; An identification unit for sending the first information to a preset image recognition model for processing to obtain second information. The image recognition model is a model for recognizing experimental equipment in the first information, and the second information includes at least one picture of the experimental equipment cropped according to the contour; A clustering unit for sending the second information to a preset clustering model for processing to obtain third information. The clustering model is a model for performing binarization processing and clustering analysis on the pixel points of the experimental equipment pictures in the second information, and the third information is pixel point information after at least one clustering process; A classification unit for sending the third information to a preset classification model for processing to obtain fourth information. The classification model is a model for classifying the third information, and the fourth information is the classification result of the third information. The classification result includes pH value information of at least one pH test paper color change center; A scoring unit for scoring the fourth information and the student's answer according to a preset scoring rule to obtain fifth information. The fifth information is the score information of each student's pH test paper reading inspection point.
6. The scoring system for pH test strip readings according to claim 5, characterized in that, The identification unit includes: A first identification subunit for converting the first information into at least two frames of images, performing edge detection on each frame of image to obtain the contour information of each experimental equipment; A second identification subunit for performing frame selection and name annotation based on the contour information of each experimental equipment to obtain a contour sample set of the experimental equipment; A third identification subunit for dividing the historical contour sample set of the preset experimental equipment into a training set, a test set, and a validation set, and inputting them into a target detection algorithm for training. According to the change trend of the loss function, adjust the learning rate and the number of iterations until the change value of the loss function is less than a preset threshold to obtain a trained picture recognition model; A fourth identification subunit for inputting the contour sample set of the experimental equipment into the trained picture recognition model to obtain the name information and position information of the experimental equipment, and performing cropping based on the contour information, name information, and position information of each experimental equipment to obtain pictures of the experimental equipment.
7. The scoring system for pH test strip readings according to claim 5, characterized in that, The clustering unit includes: The first clustering subunit is used to extract pixel points from the pH test paper image and the preset color comparison card image in the experimental equipment image obtained by cropping, perform binary processing on the pixel points of the color change center area and the pixel points of the center areas of the fourteen color blocks of the color comparison card image, and obtain the pixel point information of the binary experimental equipment image and the color comparison card image; The second clustering subunit is used to perform clustering analysis on the pixel points of the binary experimental equipment image using the DBSCAN clustering model, obtain at least one pixel point cluster, mark and call the pixel point cluster with the largest number of pixel points, and delete the other pixel point clusters, so as to obtain the filtered pixel points of the color change center of the pH test paper and the pixel points of the center of the fourteen color blocks of the color comparison card.
8. The scoring system for pH test strip readings according to claim 5, characterized in that, The classification unit includes: The first classification subunit is used to divide the pH test paper image in the experimental equipment image obtained by cropping into a preset number of image blocks of a preset size based on the pixel point information in the third information; The second classification subunit is used to map all the image blocks to a vector space of a fixed dimension to obtain the embedding vector corresponding to each image block; The third classification subunit is used to encode the embedding vector corresponding to each image block based on the Transformer encoder, and input the position encoding information of each image block obtained by encoding into a preset number of Transformer encoder layers for feature extraction, where each Transformer encoder layer includes a self-attention mechanism and a feed-forward neural network, so as to obtain the feature representation of each image block; The fourth classification subunit is used to perform layer normalization on the feature representations of all the image blocks, and send the normalized feature representations to the classification head for classification to obtain a classification result.
9. A scoring device for reading the pH test paper, characterized in that, It includes: A memory for storing computer programs; A processor, which is used to implement the steps of the pH test paper reading scoring method according to any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium, characterized in that: A computer program is stored on the readable storage medium, and when the computer program is executed by the processor, the steps of the pH test paper reading scoring method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Intelligent scoring experimental device and method for measuring pH value of to-be-measured solution through pH test paper
CN111189826A
Colour correction
CN111869193A
Method and system for ph test paper detection
CN114324316A
Color identification method and system for pH test paper detection
CN119169109A
System for identifying and developing food ingredients from natural sources by machine learning and database mining combined with empirical testing for a target function
US20220104515A1