Instrument data recognition model construction method and device, electronic equipment and storage medium
By extracting instrument edge features through differential processing and invariant moment polynomials, and combining K-Means clustering, a recognition model adapted to multiple types of instruments is constructed, which solves the problem of poor adaptability of instrument data recognition models in existing technologies and achieves efficient and accurate instrument data recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI WATER CONSERVANCY RES INST
- Filing Date
- 2026-03-13
- Publication Date
- 2026-07-03
Smart Images

Figure CN122336727A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of instrument data recognition technology, and in particular to an instrument data recognition model construction method, apparatus, electronic device and storage medium. Background Technology
[0002] Instrument data recognition is a typical application of computer vision technology in industries such as industry, power, and chemical engineering. Its core objective is to acquire images of the instrument panel through image acquisition devices (cameras, webcams, etc.), and then use algorithms to extract key information such as pointer position, scale values, and numerical characters, ultimately automatically completing the quantitative output of instrument readings and replacing the inefficient mode of manual meter reading.
[0003] Existing instrument data recognition models heavily rely on manually designed feature rules and templates. Different models and ranges of instruments require parameter readjustment or the creation of dedicated templates, making them unsuitable for batch recognition of multiple types of instruments and resulting in high deployment costs. Furthermore, for instruments with multiple pointers, irregularly shaped scales (such as circular, sector, and linear mixed scales), and instruments with overlapping pointers, the feature matching logic of traditional methods may conflict, leading to a significant decrease in reading accuracy.
[0004] Therefore, it is necessary to develop a method for constructing an instrument data recognition model. Summary of the Invention
[0005] The present invention provides a method, apparatus, electronic device and storage medium for constructing an instrument data recognition model, which solves the problem of poor adaptability to different instruments in the prior art.
[0006] In a first aspect, embodiments of the present invention provide a method for constructing an instrument data recognition model, comprising: Acquire multiple instrument images, where each instrument image corresponds to a label that identifies the instrument data content; For each instrument image, a gradient map representing the pixel gradient value and gradient direction is obtained through differential processing, and the gradient map is processed by non-maximum suppression to obtain an edge feature map. The invariant moment vector of each edge feature map is extracted by invariant moment polynomial, and multiple edge feature maps are clustered by invariant moment vector to obtain multiple instrument image classes; A recognition model is constructed for each instrument image class. The edge feature maps in the instrument image class are input into the recognition model, and the recognition model is adjusted according to the output of the recognition model and the image label to obtain the instrument data recognition model.
[0007] In one possible implementation, for each instrument image, a gradient map representing pixel gradient values and gradient directions is obtained through differential processing, and the gradient map is processed using a non-maximum suppression method to obtain an edge feature map, including: For each instrument image, perform the following steps: The instrument images are processed by the horizontal and vertical difference operators respectively to obtain the horizontal difference map and the vertical difference map. The gradient map is constructed based on the horizontal difference map and the vertical difference map; For each pixel in the gradient map, find pixels within a preset radius that are in the gradient direction and in the opposite direction of the gradient, and take them as neighboring pixels; If a pixel value is greater than all its neighboring pixels, then the pixel value is retained. Otherwise, set the pixel value to zero.
[0008] In one possible implementation, constructing the gradient map based on the horizontal difference map and the vertical difference map includes: For each pixel, perform the following steps: Horizontal pixel values and vertical pixel values are extracted from the horizontal difference map and the vertical difference map, respectively; Based on the first formula, the horizontal pixel value, and the vertical pixel value, the gradient value and gradient direction are calculated, wherein the first formula is:
[0009] In the formula, The gradient value, For the gradient direction, It is the arctangent function. Vertical pixel values This represents the horizontal pixel value.
[0010] In one possible implementation, the extraction of the invariant moment vector of each edge feature map via invariant moment polynomials includes: For each edge feature map, perform the following steps: Obtain multiple orders and multiple repetitions, where the absolute value of the repetition is less than the order; The multiple orders and multiple repetitions are combined and arranged in a predetermined order to obtain a parameter queue; Convert the pixel coordinates of multiple pixels in the edge feature map into polar coordinates with a maximum polar axis of 1; Retrieve parameter combinations sequentially from the parameter queue, and perform the following steps after each retrieval: For each pixel in the edge feature map, determine the first feature value based on the parameter combination, pixel value, polar axis of the pixel value, and polar angle of the pixel value; Summing multiple first eigenvalues, the result is added as a vector element to the invariant moment vector.
[0011] In one possible implementation, determining the first feature value for each pixel in the edge feature map based on parameter combinations, pixel value, polar axis of the pixel value, and polar angle of the pixel value includes: The first feature value is determined based on the second formula, parameter combination, pixel value, polar axis of pixel value, and polar angle of pixel value, wherein the second formula is:
[0012] In the formula, The polar angle of the pixel value. The polar axis represents the pixel value. For the polar axis Polar angle is The first feature value of the pixel, Pi The order parameter of the parameter set to be processed. For the polar axis Polar angle is The pixel value of the pixel, These are the eigenvalues of the radial polynomial. It is a natural constant. The imaginary unit, This refers to the repeatability parameter in the parameter combination.
[0013] In one possible implementation, each instrument image corresponds to an instrument attribute representing the instrument type. The process involves clustering multiple edge feature maps using invariant moment vectors to obtain multiple instrument image classes, including: Get the number of the first cluster; Based on the first cluster count, multiple invariant moment vectors are clustered using the K-Means method to obtain multiple intermediate clusters of the first cluster count; For each intermediate class, a non-public instrument attribute check is performed to obtain the class purity index, which characterizes the degree of inconsistency of instrument attributes corresponding to invariant moment vectors in the class. If any of the multiple class purity indices is below a threshold, then the first cluster number is adjusted, and the process jumps to the step of clustering multiple invariant moment vectors using the K-Means method based on the first cluster number to obtain multiple intermediate classes of the first cluster number. Otherwise, for each intermediate class, delete the invariant moment vectors with inconsistent instrument attributes in the class to obtain the instrument image class.
[0014] In one possible implementation, adjusting the recognition model based on the output of the recognition model and the labels of the images to obtain the instrument data recognition model includes: Obtain the recognition model, which is constructed based on an artificial neural network; Each edge feature map in the instrument image class is pooled to obtain a pooled data block; Multiple pooled data blocks are input into the recognition model to obtain multiple model outputs; Based on the multiple model outputs and multiple image labels, the computational loss of the model is determined, where each image label corresponds to a pooled data block; If the calculated loss is greater than the loss threshold, then multiple parameters of the identification model are adjusted using the gradient descent method based on the calculated loss. Otherwise, the identification model will be used as the instrument data identification model.
[0015] In a second aspect, embodiments of the present invention provide an instrument data recognition model construction apparatus for implementing the instrument data recognition model construction method as described in the first aspect or any possible implementation thereof, the instrument data recognition model construction apparatus comprising: The instrument image acquisition module is used to acquire multiple instrument images, where each instrument image corresponds to a tag that identifies the instrument data content; The edge feature extraction module is used to obtain a gradient map representing the pixel gradient value and gradient direction for each instrument image through differential processing, and to process the gradient map through non-maximum suppression to obtain an edge feature map. The image clustering module is used to extract the invariant moment vector of each edge feature map through invariant moment polynomial, and to cluster multiple edge feature maps using the invariant moment vector to obtain multiple instrument image classes; as well as, The model building module is used to build a recognition model for each instrument image class. It inputs the edge feature map of the instrument image class into the recognition model and adjusts the recognition model according to the output of the recognition model and the label of the image to obtain the instrument data recognition model.
[0016] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor executes the computer program to implement the steps of the method as described in the first aspect or any possible implementation of the first aspect.
[0017] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect or any possible implementation thereof.
[0018] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: This invention discloses a method for constructing an instrument data recognition model. First, multiple instrument images are acquired, each corresponding to a label identifying the instrument data content. Then, for each instrument image, a gradient map representing pixel gradient values and directions is obtained through differential processing. This gradient map is then processed using non-maximum suppression to obtain an edge feature map. Next, invariant moment vectors are extracted from each edge feature map using invariant moment polynomials, and these invariant moment vectors are used to cluster multiple edge feature maps, resulting in multiple instrument image classes. Finally, a recognition model is constructed for each instrument image class. The edge feature maps from each instrument image class are input into the recognition model, and the model is adjusted based on its output and the image label to obtain the instrument data recognition model. This invention effectively extracts key edge features such as instrument outlines and scales through differential processing and non-maximum suppression, eliminating redundant information and improving feature recognition. It overcomes shooting interference by utilizing the translation, rotation, and scale invariance of invariant moments, and combines K-Means clustering and class purity optimization to achieve accurate classification and archiving of instruments, avoiding cross-category feature interference. Each category has its own dedicated model, optimizing the model training process to adapt to different instrument structural features, while improving model generalization ability and real-time performance. The entire process, through parameter optimization and iterative adjustments, adapts to interference in different working scenarios, ensuring stable and reliable instrument data recognition. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart of the instrument data recognition model construction method provided by the embodiments of the present invention; Figure 2 This is a schematic diagram of the nonmaximum suppression principle provided by the embodiments of the present invention; Figure 3 This is a functional block diagram of the instrument data recognition model construction device provided in the embodiments of the present invention; Figure 4This is a functional block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0021] In the following description, specific details such as particular system structures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0022] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.
[0023] The embodiments of the present invention will be described in detail below. These examples are implemented based on the technical solutions of the present invention, and detailed implementation methods and specific operation processes are given. However, the scope of protection of the present invention is not limited to the following embodiments.
[0024] Figure 1 A flowchart of the instrument data recognition model construction method provided for embodiments of the present invention.
[0025] like Figure 1 As shown, a flowchart illustrating the implementation of the instrument data recognition model construction method provided by the embodiments of the present invention is illustrated below: In step 101, multiple instrument images are acquired, wherein each instrument image corresponds to a label that identifies the instrument data content.
[0026] In step 102, for each instrument image, a gradient map representing the pixel gradient value and gradient direction is obtained through differential processing, and the gradient map is processed by non-maximum suppression to obtain an edge feature map.
[0027] In some implementations, for each instrument image, a gradient map representing pixel gradient values and gradient directions is obtained through differential processing, and the gradient map is processed using a non-maximum suppression method to obtain an edge feature map, including: For each instrument image, perform the following steps: The instrument images are processed by the horizontal and vertical difference operators respectively to obtain the horizontal difference map and the vertical difference map. The gradient map is constructed based on the horizontal difference map and the vertical difference map; For each pixel in the gradient map, find pixels within a preset radius that are in the gradient direction and in the opposite direction of the gradient, and take them as neighboring pixels; If a pixel value is greater than all its neighboring pixels, then the pixel value is retained. Otherwise, set the pixel value to zero.
[0028] In some implementations, constructing the gradient map based on the horizontal difference map and the vertical difference map includes: For each pixel, perform the following steps: Horizontal pixel values and vertical pixel values are extracted from the horizontal difference map and the vertical difference map, respectively; Based on the first formula, the horizontal pixel value, and the vertical pixel value, the gradient value and gradient direction are calculated, wherein the first formula is:
[0029] In the formula, The gradient value, For the gradient direction, It is the arctangent function. Vertical pixel values This represents the horizontal pixel value.
[0030] For example, image acquisition and tag association: First, multiple image data containing various types of instruments to be tested need to be acquired. The acquisition scene needs to cover the instrument's normal operating environment (such as different light intensities, different shooting angles, different background interference, etc.) to ensure the robustness of subsequent processing algorithms. Each acquired instrument image needs to correspond to a unique tag identifying the instrument data content. This tag is structured information and should include core data attributes such as the instrument display reading, unique number, measurement parameter type (such as pressure, temperature, flow rate, etc.), range, and accuracy level. The tag association method can be completed through manual annotation combined with image feature matching. Its core purpose is to establish a mapping relationship between image data, instrument display data, and actual parameter information, laying the foundation for subsequent image-based instrument data reading and verification.
[0031] Edge feature extraction preprocessing: For each acquired instrument image, pixel change features are mined through differential processing to obtain a gradient map representing pixel gradient values (reflecting the drastic degree of pixel grayscale change) and gradient direction (reflecting the trend direction of pixel grayscale change). Then, non-maximum suppression technology is used to refine the gradient map, removing redundant non-edge pixels, ultimately obtaining an accurate edge feature map. The edge feature map highlights key structural information such as the instrument's outline, scale lines, and pointers, serving as the core foundational data for subsequent instrument parameter identification.
[0032] Edge feature extraction is performed separately for each instrument image, following these steps: Difference operator operations: Horizontal and vertical difference operators are used to perform convolutional difference processing on the instrument image, resulting in horizontal and vertical difference images. The core function of the difference operators is to capture the magnitude of pixel grayscale value changes in a specific direction. The horizontal difference operator primarily detects vertical grayscale changes (such as the edges of the horizontal scale lines on the instrument), while the vertical difference operator primarily detects horizontal grayscale changes (such as the edges of the vertical scale lines and pointers on the instrument). In practical applications, classic difference operators such as the Sobel operator and the Prewitt operator can be used. These operators perform sliding convolution with the image using preset 3×3 or 5×5 convolution kernels, effectively suppressing random noise in the image and enhancing the sensitivity of grayscale change detection.
[0033] Gradient Map Construction: Based on the horizontal and vertical difference maps obtained in step 1, a complete gradient map is constructed by fusing the difference information from the two directions. Each pixel in the gradient map contains two key parameters: gradient value and gradient direction. These parameters comprehensively reflect the grayscale change characteristics of that pixel location, providing a core basis for subsequent edge detection.
[0034] Neighborhood pixel selection: For each pixel in the gradient map, a reasonable preset radius is set (usually determined based on the resolution of the instrument image and the size of the instrument structure, commonly 1-3 pixels). Within this radius, pixels with the same gradient direction as the current pixel and pixels with the opposite gradient direction are accurately located. These pixels are used as the neighboring reference pixels of the current pixel. The reason for selecting pixels with the gradient direction and the opposite direction as neighbors is that the gray-level changes at the image edges are directional, and edge points are usually local maxima points in the gradient direction. It is only necessary to perform neighborhood comparison in this direction to accurately determine whether it is an edge pixel.
[0035] Non-maximum suppression judgment: such as Figure 2 As shown, the gradient value of the current pixel 201 is compared one by one with the gradient values of all selected neighboring pixels (pixels marked with circular black dots) within a neighborhood radius 202. If the gradient value of the current pixel 201 is greater than the gradient values of all neighboring pixels, the pixel is determined to be a potential edge point, and its original gradient value is retained; if the gradient value of the current pixel is less than or equal to the gradient value of any neighboring pixel, the pixel is determined to be a non-edge point, and its gradient value is set to 0. Through this filtering process, redundant local maxima points in the gradient map can be effectively eliminated, making the edge contours more delicate and precise, and improving the accuracy of subsequent instrument structure recognition.
[0036] The specific implementation process of constructing the gradient map based on the horizontal and vertical difference maps requires performing the following steps individually for each pixel in the gradient map: Pixel value extraction: For the current pixel to be processed, based on its coordinate position in the image, extract the corresponding pixel grayscale value from the horizontal difference map as the horizontal pixel value (denoted as ). Extract the pixel grayscale value corresponding to the coordinates from the vertical difference map as the vertical pixel value (denoted as ). During the extraction process, it is necessary to ensure accurate coordinate matching to avoid errors in the correspondence of horizontal and vertical pixel values due to coordinate offset, which would affect the accuracy of gradient parameter calculation.
[0037] Gradient parameter calculation: based on extracted horizontal pixel values and vertical pixel values The gradient value of the current pixel is calculated using the first formula. ) and gradient direction ( The specific expression for the first formula is:
[0038] In the formula, The gradient value, For the gradient direction, It is the arctangent function. Vertical pixel values This represents the horizontal pixel value.
[0039] The detailed explanations of each parameter in the formula are as follows: This is the gradient value, and its magnitude directly reflects the degree of grayscale change at the current pixel position. The larger the value, the more drastic the grayscale change at that location, and the more likely it is to be the edge of the instrument. The gradient direction, i.e., the direction of the most drastic change in grayscale, has a value range of [value missing]. This can provide a directional basis for the selection of subsequent neighboring pixels; It is the arctangent function, used to calculate the gradient direction based on the pixel change rate in the horizontal and vertical directions; This is the pixel value of the current pixel in the vertical difference image, reflecting the magnitude of grayscale change of that pixel in the vertical direction; This represents the pixel value of the current pixel in the horizontal difference image, reflecting the magnitude of grayscale change of that pixel in the horizontal direction.
[0040] It should be noted that in the actual calculation process, if... In cases where there is no grayscale change in the horizontal direction, to avoid the error of division by zero, the gradient direction needs to be adjusted. With special processing, the gradient direction can be directly determined to be 90° (or (radians); if =0, then the gradient direction is determined to be 0° (or 0 radians).
[0041] In step 103, the invariant moment vector of each edge feature map is extracted by invariant moment polynomial, and multiple edge feature maps are clustered by invariant moment vector to obtain multiple instrument image classes.
[0042] In some implementations, the extraction of the invariant moment vector of each edge feature map via invariant moment polynomials includes: For each edge feature map, perform the following steps: Obtain multiple orders and multiple repetitions, where the absolute value of the repetition is less than the order; The multiple orders and multiple repetitions are combined and arranged in a predetermined order to obtain a parameter queue; Convert the pixel coordinates of multiple pixels in the edge feature map into polar coordinates with a maximum polar axis of 1; Retrieve parameter combinations sequentially from the parameter queue, and perform the following steps after each retrieval: For each pixel in the edge feature map, determine the first feature value based on the parameter combination, pixel value, polar axis of the pixel value, and polar angle of the pixel value; Summing multiple first eigenvalues, the result is added as a vector element to the invariant moment vector.
[0043] In some implementations, determining the first feature value for each pixel in the edge feature map based on parameter combinations, pixel value, polar axis of the pixel value, and polar angle of the pixel value includes: The first feature value is determined based on the second formula, parameter combination, pixel value, polar axis of pixel value, and polar angle of pixel value, wherein the second formula is:
[0044] In the formula, The polar angle of the pixel value. The polar axis represents the pixel value. For the polar axis Polar angle is The first feature value of the pixel, Pi The order parameter of the parameter set to be processed. For the polar axis Polar angle is The pixel value of the pixel, These are the eigenvalues of the radial polynomial. It is a natural constant. The imaginary unit, This refers to the repeatability parameter in the parameter combination.
[0045] In some implementations, each instrument image corresponds to an instrument attribute representing the instrument type. The step of clustering multiple edge feature maps using invariant moment vectors to obtain multiple instrument image classes includes: Get the number of the first cluster; Based on the first cluster count, multiple invariant moment vectors are clustered using the K-Means method to obtain multiple intermediate clusters of the first cluster count; For each intermediate class, a non-public instrument attribute check is performed to obtain the class purity index, which characterizes the degree of inconsistency of instrument attributes corresponding to invariant moment vectors in the class. If any of the multiple class purity indices is below a threshold, then the first cluster number is adjusted, and the process jumps to the step of clustering multiple invariant moment vectors using the K-Means method based on the first cluster number to obtain multiple intermediate classes of the first cluster number. Otherwise, for each intermediate class, delete the invariant moment vectors with inconsistent instrument attributes in the class to obtain the instrument image class.
[0046] For example, invariant moment feature extraction and clustering are performed as follows: After obtaining the edge feature maps of each instrument image, the invariant moment vector of each edge feature map is extracted using an invariant moment polynomial. Invariant moments are invariant to translation, rotation, and scale, effectively overcoming feature differences caused by factors such as image shooting angle deviation and distance variations, and accurately representing the essential structural features of different instruments. Subsequently, clustering analysis is performed based on the extracted multiple invariant moment vectors, grouping edge feature maps with similar structural features into one class, ultimately obtaining multiple instrument image classes. This achieves preliminary classification and archiving of the instruments, providing a classification foundation for subsequent accurate parameter identification of different types of instruments.
[0047] Extracting the invariant moment vector of each edge feature map using invariant moment polynomials is actually achieved by performing the following steps separately for each edge feature map: Parameter preset and filtering: First, determine the multiple orders used to extract invariant moments ( ) and multiple repetitions ( ) parameters. Among them, the order The order determines the complexity of the invariant moment polynomial. Higher orders can represent richer image details, but the computational cost also increases significantly. In practical applications, the order must be selected in conjunction with the complexity of the instrument structure (common order ranges from 0 to 4). Repeatability Its core function is to adjust the characteristic dimension of the polynomial, whose absolute value must be less than the corresponding order (i.e., This avoids polynomial degradation issues. Parameter selection needs to be verified through preliminary experiments to ensure that the selected parameter combinations can effectively distinguish the characteristics of different types of instruments.
[0048] Parameter combination and sorting: Combine multiple preset orders and multiple repetitions to form several groups. Parameter pairs. These parameter combinations are then arranged in a predetermined order to generate a parameter queue. The predetermined order usually follows the rule of "increasing order first, and increasing absolute value of repetition for the same order". For example, all repetition parameters of order 0 that meet the conditions are arranged first, then the parameters of order 1 are arranged, and so on, to ensure the orderliness and repeatability of the parameter extraction process, which is convenient for the subsequent standardization of feature vectors.
[0049] Coordinate system transformation: converting the Cartesian coordinates of each pixel in the edge feature map. Convert to polar coordinates And the maximum polar axis after transformation The values are uniformly normalized to 1. The core purpose of this transformation step is to leverage the adaptability of polar coordinates to rotational changes, further strengthening the rotational invariance of the invariant moment. Instrument images may be rotated at arbitrary angles during capture. After polar coordinate transformation, the pixel position description no longer relies on a fixed Cartesian coordinate system, but instead uses the image center (or instrument center) as the pole, better reflecting the circular or arc-shaped structure of instruments. During the coordinate transformation process, the polar coordinate pole must first be determined (usually by selecting the geometric center of the edge feature map, or by determining the instrument center through instrument contour detection). Then, the transformation is completed through the mapping relationship between Cartesian and polar coordinates, while simultaneously adjusting the polar axis. Normalization processing ( ), to eliminate the effects of scale changes.
[0050] Eigenvalue calculation and vector construction: Take each group sequentially from the parameter queue. For the parameter combination, perform the following operations: ① Traverse each pixel in the edge feature map, and based on the parameter combination and the pixel's grayscale value... Normalized polar axis and polar angle Calculate the first feature value corresponding to each pixel; ② Sum the first feature values of all pixels and use the summation result as a vector element; ③ Repeat the above process until all parameter combinations in the parameter queue have been processed. Arrange all the obtained vector elements in the order of the parameter queue to form the invariant moment vector of the edge feature map.
[0051] For each pixel in the edge feature map, the specific implementation of the first feature value is determined based on the parameter combination, pixel value, polar axis of the pixel value, and polar angle of the pixel value. This is calculated using the second formula. The complete expression and parameter description of the first formula are as follows:
[0052] In the formula, The polar angle of the pixel value. The polar axis represents the pixel value. For the polar axis Polar angle is The first feature value of the pixel, Pi The order parameter of the parameter set to be processed. For the polar axis Polar angle is The pixel value of the pixel. These are the eigenvalues of the radial polynomial. It is a natural constant. The imaginary unit, This refers to the repeatability parameter in the parameter combination.
[0053] The detailed explanations of each parameter in the formula are as follows: This is the first feature value of the current pixel. It is a complex number that contains both amplitude information (reflecting the intensity of the pixel feature) and phase information (reflecting the positional relationship of the pixel in polar coordinates). The order parameter of the current processing parameter combination determines the order of the radial polynomial; polar coordinates The grayscale value of the pixel at that location (i.e., the pixel value at that position in the edge feature map; the pixel value in the edge region is non-zero, and the pixel value in the non-edge region is 0). These are radial polynomial eigenvalues used to characterize the gray-level distribution of pixels along the polar axis; their expression is about... Polynomial summation, upper limit of summation Must meet and Check for parity (otherwise the summation term is empty and the radial polynomial value is 0) to ensure the validity of the polynomial; This is the repeatability parameter for the current processing parameter combination, used to adjust the feature dimension in the polar angle direction; The polar angle of a pixel (with a value range of [0, 2π)) reflects the angular position of the pixel relative to the pole. The normalized pixel polar axis (value range is [0,1]); For the iteration variable of the radial polynomial summation; These are alternating sign terms used to adjust the weights of different orders of the polynomial; Factorial operation represents the quantitative relationship of permutations and combinations.
[0054] This formula, by multiplying a radial polynomial with an angular complex exponential function and combining it with pixel grayscale values, achieves a multi-dimensional characterization of pixel spatial features, thus ensuring the discriminative power of subsequent invariant moment vectors.
[0055] If each instrument image corresponds to an instrument attribute representing the instrument type (different dial forms of pointer instruments, range of pointer instruments, digital instruments, etc.), then the above process of "clustering multiple edge feature maps using invariant moment vectors to obtain multiple instrument image classes" can be combined with instrument attributes for refined clustering. The specific implementation steps are as follows: Cluster number initialization: First, obtain the first cluster number. The initial value of this number can be initially set based on the known number of instrument types (for example, if it is known that the instruments to be processed contain 3 types, the first cluster number can be initially set to 3). Alternatively, the initial cluster number can be determined by unsupervised learning parameter selection methods such as the elbow rule and the profile coefficient method, combined with the distribution characteristics of the invariant moment vector, to ensure the rationality of the initial cluster number.
[0056] K-Means clustering operation: Based on the set initial cluster size, the K-Means clustering algorithm is used to cluster the invariant moment vectors corresponding to all edge feature maps. The specific process includes: ① Randomly select the first number of vectors from all invariant moment vectors as the initial cluster centers; ② Calculate the distance between each invariant moment vector and each initial cluster center (the common distance metric is Euclidean distance, which is the square root of the sum of the squares of the differences in each dimension of the vector), and assign the vector to the intermediate class corresponding to the nearest cluster center; ③ Calculate the mean of all vectors within each intermediate class and use this mean as the new cluster center; ④ Repeat steps ② and ③ until the change in cluster centers is less than the preset convergence threshold (e.g., 0.001) or the number of iterations reaches the preset upper limit (e.g., 100 times). At this point, multiple intermediate classes of the first cluster number are obtained.
[0057] Class purity index calculation: For each intermediate class, non-common instrument attribute checks are performed, that is, the instrument attribute types and quantities corresponding to all invariant moment vectors within the class are counted, and the class purity index is calculated.
[0058] The class purity index is used to quantitatively characterize the degree of inconsistency in the instrument attributes corresponding to invariant moment vectors within a class. It can be calculated as the ratio of the number of vectors corresponding to the most numerous instrument attribute within the class to the total number of vectors in the class (the closer the ratio is to 1, the higher the consistency of attributes within the class, and the higher the purity; the lower the ratio, the more instruments with different attributes exist within the class, and the lower the purity). For example, if an intermediate class has 100 vectors, of which 85 correspond to the "pointer table" attribute and 15 correspond to the "number table" attribute, then the purity index of this class is 0.85.
[0059] Clustering quantity adjustment and optimization: Compare the purity index of all intermediate clusters with a preset threshold (the threshold needs to be set according to the actual classification accuracy requirements, and a common value is 0.95). If there are intermediate clusters with a purity index lower than the threshold, it indicates that the current number of clusters is unreasonable (there may be too few clusters, causing instruments with different attributes to be grouped into one category). In this case, the number of the first cluster needs to be adjusted (if the purity is low and the number of clusters is small, increase the number of clusters; if the purity is low and the number of clusters is large, decrease the number of clusters), and the K-Means clustering operation should be re-executed.
[0060] Instrument image class determination: If the class purity index of all intermediate classes is greater than or equal to a preset threshold, it indicates that the consistency of instrument attributes within the class meets the requirements. At this point, for each intermediate class, invariant moment vectors that are inconsistent with the dominant instrument attribute (the most numerous attribute) within the class are deleted. The instrument images corresponding to the remaining invariant moment vectors constitute an instrument image class. Through this step, the instruments within each instrument image class ultimately belong to the same type, providing accurate classification data support for the subsequent design of parameter recognition algorithms for specific instrument types.
[0061] In step 104, a recognition model is constructed for each instrument image class. The edge feature map in the instrument image class is input into the recognition model, and the recognition model is adjusted according to the output of the recognition model and the label of the image to obtain the instrument data recognition model.
[0062] In some implementations, adjusting the recognition model based on the output of the recognition model and the labels of the images to obtain the instrument data recognition model includes: Obtain the recognition model, which is constructed based on an artificial neural network; Each edge feature map in the instrument image class is pooled to obtain a pooled data block; Multiple pooled data blocks are input into the recognition model to obtain multiple model outputs; Based on the multiple model outputs and multiple image labels, the computational loss of the model is determined, where each image label corresponds to a pooled data block; If the calculated loss is greater than the loss threshold, then multiple parameters of the identification model are adjusted using the gradient descent method based on the calculated loss. Otherwise, the identification model will be used as the instrument data identification model.
[0063] For example, based on the multiple instrument image classes obtained in the steps, a dedicated instrument data recognition model is constructed for each category. Since the structural features (such as scale distribution, pointer shape, and dial layout) of different categories of instruments vary significantly, constructing a dedicated model can avoid cross-category feature interference and greatly improve the accuracy and efficiency of instrument data recognition.
[0064] The specific process is as follows: the edge feature map in each instrument image class is used as the model input data, and the model is trained in combination with the label information of the corresponding image. By comparing the difference between the model output result and the real label, the model parameters are dynamically adjusted until the model performance meets the preset requirements, and finally a special instrument data recognition model adapted to each type of instrument is obtained.
[0065] The recognition model is adjusted based on its output and the image labels to obtain the specific implementation process of the instrument data recognition model. This process must be followed step-by-step to ensure the scientific rigor and effectiveness of the model training: Recognition Model Selection and Construction: First, a recognition model suitable for the instrument image recognition scenario is obtained. This model is built based on an Artificial Neural Network (ANN). A typical structure includes: Input layer: Receives preprocessed edge feature maps or subsequent pooling data blocks, with the input dimension strictly matching the size of the data block; Activation layer: Insert ReLU or GELU activation functions to introduce nonlinear feature mapping capabilities and solve the problem that linear models cannot fit complex instrument features; Fully connected layer: maps the high-dimensional features output by the convolutional layer into a one-dimensional feature vector, realizing feature integration and dimensionality reduction; Output layer: Outputs results based on the instrument recognition task type (for reading recognition, the output layer is a single neuron regression output; for multi-parameter classification recognition, the output layer is the number of neurons corresponding to the category, using Softmax activation to output the probability distribution). When building the model, the parameters of each layer (such as convolutional kernel weights and bias terms) need to be initialized. Initialization methods can include He initialization or Xavier initialization to ensure stable convergence during training.
[0066] Edge Feature Map Pooling: Pooling is performed on each edge feature map in the current instrument image class to generate pooled data blocks of uniform size. The core purpose of pooling is to reduce the spatial dimension of the feature map while preserving key edge features (such as the endpoints of scale lines and pointer edges), thereby reducing the computational cost and number of parameters in the model and suppressing overfitting. In practical applications, max pooling or average pooling is preferred. Max pooling is more suitable for preserving local salient features (adapting to the strong features of instrument edges), while average pooling is more suitable for preserving the smoothness of global features (adapting to the overall outline features of the dial). Pooling parameters need to be determined in conjunction with the resolution of the edge feature map: 2×2 or 3×3 pooling kernels are commonly used, with the stride set to be consistent with the size of the pooling kernel (to avoid feature overlap). If the feature map size cannot be divided evenly by the pooling kernel, zero padding can be used to ensure uniform output size. For example, if the input edge feature map size is 64×64, after processing with a 2×2 max pooling kernel and a stride of 2, a 32×32 pooling data block can be obtained, reducing the dimension to 1 / 4 of the original, effectively improving the efficiency of subsequent model training.
[0067] Model inference and output acquisition: Multiple pooled data blocks of the same instrument image type are divided into batches and sequentially input into the constructed recognition model to perform inference operations, obtaining multiple model output results corresponding one-to-one with the pooled data blocks. Before input, the pooled data blocks need to be standardized preprocessed: the pixel values of the data blocks are scaled to the range of [0,1] or [-1,1] (e.g., using a formula). To achieve normalization, the interference of different pixel value scale differences on model training is eliminated, accelerating parameter convergence. The format of the model output must strictly match the type of the instrument image label: if the label is numerical information such as the specific reading of the instrument (e.g., "1.5MPa", "25℃"), the model output is a continuous numerical value (regression task output); if the label is discrete information such as the category of instrument parameters (e.g., "normal", "out of range", "faulty"), the model output is the probability distribution vector corresponding to each category (classification task output). For example, for the pressure gauge reading recognition task, the model output can be "1.48MPa", forming a precise comparison basis with the label "1.5MPa".
[0068] Loss Calculation and Performance Evaluation: Based on the obtained output results of multiple models and corresponding meter image labels, the overall computational loss of the model is calculated to quantify the deviation between the model's prediction results and the true labels. The choice of loss function must strictly match the type of identification task. ① For regression tasks (such as reading recognition), the mean squared error (MSE) loss function is preferred, and the calculation formula is as follows: (in These are the model's predicted values. The actual label value. (where the sample size is the number of samples), this function can effectively penalize large prediction biases; ② For classification tasks (such as parameter category recognition), the cross-entropy loss function (such as categorical cross-entropy) should be preferred. The calculation formula is as follows: It can accurately characterize the difference between the predicted probability distribution and the true label distribution. The calculated loss value directly reflects the current performance level of the model: the larger the loss value, the greater the prediction bias and the worse the performance; the smaller the loss value, the closer the model prediction is to the reality and the better the performance.
[0069] Model parameter iterative adjustment and convergence determination: The calculated loss value is compared with the preset loss threshold to determine whether the model has met the convergence requirements. The setting of the loss threshold needs to be determined based on the accuracy requirements of the specific instrument recognition. For example, for high-precision pressure gauge recognition, the MSE loss threshold can be set to 0.001; for conventional temperature instrument recognition, the threshold can be relaxed to 0.01. If the calculated loss is greater than the loss threshold, it indicates that the model performance has not met the requirements, and iterative adjustments to multiple parameters of the recognition model (including convolutional kernel weights, fully connected layer weights, and bias terms of each layer) need to be made using gradient descent. ① Use the backpropagation algorithm to calculate the gradient of the loss function with respect to each model parameter, and clarify the direction of parameter adjustment (the gradient descent direction is the direction of loss reduction); ② Combine the preset learning rate (the initial learning rate is usually 0.001, which can be dynamically adjusted through a learning rate decay strategy, such as halving the learning rate every 10 iterations), according to the formula Update parameters (where) The original parameter value. For the updated parameter values, For learning rate, (the gradient value of the parameter). ③ Repeat the process of "pooling processing - model inference - loss calculation - parameter adjustment" until the calculated loss of the model is less than or equal to the loss threshold. If the calculated loss is less than or equal to the loss threshold, it means that the model performance has met the preset recognition accuracy requirements. At this time, stop parameter adjustment and use the currently trained recognition model as the exclusive instrument data recognition model for this instrument image class.
[0070] It should be further noted that, to further improve the generalization ability of the instrument data recognition model, regularization mechanisms (such as L1 regularization and L2 regularization) can be introduced during parameter adjustment to suppress overfitting. Simultaneously, the instrument image dataset is divided into a training set (70%–80%) and a validation set (20%–30%). After each round of parameter adjustment, the model performance is evaluated using the validation set. If the validation set loss continues to rise, training can be terminated early (early termination strategy) to avoid the model overfitting to training set noise. The resulting dedicated recognition models for each instrument image type can accurately identify the structural features of the corresponding instrument type, providing reliable model support for the automatic reading of instrument data in subsequent real-world scenarios.
[0071] When the model constructed in this invention is used (for instrument data recognition), the image is first processed by difference and non-maximum suppression. After processing, the edge map is then subjected to invariant moment feature extraction. The resulting invariant moment vector is then classified (selecting the closest previously clustered class). Based on the classification result, the corresponding model is used for recognition to obtain the instrument data.
[0072] As can be seen, the model of this invention significantly improves generalization and data recognition accuracy.
[0073] Furthermore, because this invention proposes invariant moment vector clustering, in some small target images—such as instrument images occupying only a small portion of the image, or an image containing multiple different types of instruments—image patches can be obtained by slicing or sliding to extract patches. Edge maps are then extracted from these patches to further obtain invariant moment vectors. Finally, the invariant moment vectors are compared with the previously obtained clustering classes to determine whether an image patch contains an instrument. As can be seen from the above description, the model constructed by this invention significantly improves the image adaptability in instrument data recognition.
[0074] The present invention discloses an implementation method for constructing an instrument data recognition model. First, multiple instrument images are acquired, each corresponding to a label identifying the instrument data content. Then, for each instrument image, a gradient map representing pixel gradient values and directions is obtained through differential processing. This gradient map is then processed using non-maximum suppression to obtain an edge feature map. Next, the invariant moment vector of each edge feature map is extracted using invariant moment polynomials, and the multiple edge feature maps are clustered using these invariant moment vectors to obtain multiple instrument image classes. Finally, a recognition model is constructed for each instrument image class. The edge feature maps from each instrument image class are input into the recognition model, and the model is adjusted based on its output and the image label to obtain the instrument data recognition model. This invention effectively extracts key edge features such as instrument outlines and scales through differential processing and non-maximum suppression, eliminating redundant information and improving feature recognition. It overcomes shooting interference by utilizing the translation, rotation, and scale invariance of invariant moments, and combines K-Means clustering and class purity optimization to achieve accurate classification and archiving of instruments, avoiding cross-category feature interference. Each category has its own dedicated model, optimizing the model training process to adapt to different instrument structural features, while improving model generalization ability and real-time performance. The entire process, through parameter optimization and iterative adjustments, adapts to interference in different working scenarios, ensuring stable and reliable instrument data recognition.
[0075] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0076] The following are embodiments of the apparatus of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.
[0077] Figure 3 This is a functional block diagram of the instrument data recognition model construction device provided in the embodiments of the present invention, with reference to... Figure 3 The instrument data recognition model building device includes: an instrument image acquisition module 301, an edge feature extraction module 302, an image clustering module 303, and a model building module 304, wherein: The instrument image acquisition module 301 is used to acquire multiple instrument images, wherein each instrument image corresponds to a tag that identifies the instrument data content; The edge feature extraction module 302 is used to obtain a gradient map representing the pixel gradient value and gradient direction for each instrument image through differential processing, and to process the gradient map through non-maximum suppression to obtain an edge feature map. Image clustering module 303 is used to extract the invariant moment vector of each edge feature map through invariant moment polynomial, and to cluster multiple edge feature maps through invariant moment vector to obtain multiple instrument image classes; The model building module 304 is used to build a recognition model for each instrument image class. It inputs the edge feature map in the instrument image class into the recognition model and adjusts the recognition model according to the output of the recognition model and the label of the image to obtain the instrument data recognition model.
[0078] Figure 4 This is a functional block diagram of the electronic device provided in an embodiment of the present invention. For example... Figure 4 As shown, the electronic device 4 of this embodiment includes a processor 400 and a memory 401, wherein the memory 401 stores a computer program 402 that can run on the processor 400. When the processor 400 executes the computer program 402, it implements the steps of the above-described instrument data recognition model construction methods and embodiments, for example... Figure 1 Steps 101 to 104 are shown.
[0079] For example, the computer program 402 may be divided into one or more modules / units, which are stored in the memory 401 and executed by the processor 400 to complete the present invention.
[0080] The electronic device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. The electronic device 4 may include, but is not limited to, a processor 400 and a memory 401. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or combine certain components, or different components. For example, electronic device 4 may also include input / output devices, network access devices, buses, etc.
[0081] The processor 400 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0082] The memory 401 can be an internal storage unit of the electronic device 4, such as a hard disk or memory. The memory 401 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory 401 can include both internal and external storage units of the electronic device 4. The memory 401 is used to store the computer program 402 and other programs and data required by the electronic device 4. The memory 401 can also be used to temporarily store data that has been output or will be output.
[0083] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the aforementioned method embodiments, and will not be repeated here.
[0084] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0085] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0086] In the embodiments provided by this invention, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0087] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0088] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0089] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various methods and apparatus embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0090] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for constructing an instrument data recognition model, characterized by, include: Acquire multiple instrument images, where each instrument image corresponds to a label that identifies the instrument data content; For each instrument image, a gradient map representing the pixel gradient value and gradient direction is obtained through differential processing, and the gradient map is processed by non-maximum suppression to obtain an edge feature map. The invariant moment vector of each edge feature map is extracted by invariant moment polynomial, and multiple edge feature maps are clustered by invariant moment vector to obtain multiple instrument image classes; A recognition model is constructed for each instrument image class. The edge feature maps in the instrument image class are input into the recognition model, and the recognition model is adjusted according to the output of the recognition model and the label of the image to obtain the instrument data recognition model. 2.The instrument data recognition model construction method according to claim 1, characterized in that, For each instrument image, a gradient map representing the pixel gradient value and gradient direction is obtained through differential processing. The gradient map is then processed using non-maximum suppression to obtain an edge feature map, including: For each instrument image, perform the following steps: The instrument images are processed by the horizontal and vertical difference operators respectively to obtain the horizontal difference map and the vertical difference map. The gradient map is constructed based on the horizontal difference map and the vertical difference map; For each pixel in the gradient map, find pixels within a preset radius that are in the gradient direction and in the opposite direction of the gradient, and take them as neighboring pixels; If a pixel value is greater than all its neighboring pixels, then the pixel value is retained. Otherwise, set the pixel value to zero. 3.The instrument data recognition model construction method of claim 2, wherein, The step of constructing the gradient map based on the horizontal difference map and the vertical difference map includes: For each pixel, perform the following steps: Horizontal pixel values and vertical pixel values are extracted from the horizontal difference map and the vertical difference map, respectively; Based on the first formula, the horizontal pixel value, and the vertical pixel value, the gradient value and gradient direction are calculated, wherein the first formula is: wherein is a gradient value, is a gradient direction, is an arctangent function, is a vertical pixel value, is a horizontal pixel value.
4. The instrument data recognition model construction method according to claim 1, characterized in that, The extraction of the invariant moment vector of each edge feature map using invariant moment polynomials includes: For each edge feature map, perform the following steps: Obtain multiple orders and multiple repetitions, where the absolute value of the repetition is less than the order; The multiple orders and multiple repetitions are combined and arranged in a predetermined order to obtain a parameter queue; Convert the pixel coordinates of multiple pixels in the edge feature map into polar coordinates with a maximum polar axis of 1; Retrieve parameter combinations sequentially from the parameter queue, and perform the following steps after each retrieval: For each pixel in the edge feature map, determine the first feature value based on the parameter combination, pixel value, polar axis of the pixel value, and polar angle of the pixel value; Summing multiple first eigenvalues, the result is added as a vector element to the invariant moment vector.
5. The instrument data recognition model construction method according to claim 4, characterized in that, For each pixel in the edge feature map, the first feature value is determined based on the parameter combination, pixel value, polar axis of the pixel value, and polar angle of the pixel value, including: The first feature value is determined based on the second formula, parameter combination, pixel value, polar axis of pixel value, and polar angle of pixel value, wherein the second formula is: In the formula, The polar angle of the pixel value. The polar axis represents the pixel value. For the polar axis Polar angle is The first feature value of the pixel, Pi The order parameter of the parameter set to be processed. For the polar axis Polar angle is The pixel value of the pixel. These are the eigenvalues of the radial polynomial. It is a natural constant. The imaginary unit, This refers to the repeatability parameter in the parameter combination.
6. The instrument data recognition model construction method according to claim 1, characterized in that, Each instrument image corresponds to an instrument attribute representing the instrument type. The process involves clustering multiple edge feature maps using invariant moment vectors to obtain multiple instrument image classes, including: Get the number of the first cluster; Based on the first cluster count, multiple invariant moment vectors are clustered using the K-Means clustering method to obtain multiple intermediate clusters of the first cluster count; For each intermediate class, a non-public instrument attribute check is performed to obtain the class purity index, which characterizes the degree of inconsistency of instrument attributes corresponding to invariant moment vectors in the class. If any of the multiple class purity indices is below a threshold, then the first cluster number is adjusted, and the process jumps to the step of clustering multiple invariant moment vectors using the K-Means method based on the first cluster number to obtain multiple intermediate classes of the first cluster number. Otherwise, for each intermediate class, delete the invariant moment vectors with inconsistent instrument attributes in the class to obtain the instrument image class.
7. The method for constructing an instrument data recognition model according to any one of claims 1-6, characterized in that, The step of adjusting the recognition model based on its output and the image labels to obtain the instrument data recognition model includes: Obtain the recognition model, which is constructed based on an artificial neural network; Each edge feature map in the instrument image class is pooled to obtain a pooled data block; Multiple pooled data blocks are input into the recognition model to obtain multiple model outputs; Based on the multiple model outputs and multiple image labels, the computational loss of the model is determined, where each image label corresponds to a pooled data block; If the calculated loss is greater than the loss threshold, then multiple parameters of the identification model are adjusted using the gradient descent method based on the calculated loss. Otherwise, the identification model will be used as the instrument data identification model.
8. An instrument data recognition model construction device, characterized in that, For implementing the instrument data recognition model construction method as described in any one of claims 1-7, the instrument data recognition model construction apparatus comprises: The instrument image acquisition module is used to acquire multiple instrument images, where each instrument image corresponds to a tag that identifies the instrument data content; The edge feature extraction module is used to obtain a gradient map representing the pixel gradient value and gradient direction for each instrument image through differential processing, and to process the gradient map through non-maximum suppression to obtain an edge feature map. The image clustering module is used to extract the invariant moment vector of each edge feature map through invariant moment polynomial, and to cluster multiple edge feature maps using the invariant moment vector to obtain multiple instrument image classes; as well as, The model building module is used to build a recognition model for each instrument image class. It inputs the edge feature map of the instrument image class into the recognition model and adjusts the recognition model according to the output of the recognition model and the label of the image to obtain the instrument data recognition model.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7 above.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7 above.