Electrical diagram component identification model training method
By conducting multiple iterative training on the electrical component recognition model, gradually adjusting the number of samples in the training set, the problem of sample imbalance in the training of the electrical component recognition model in the existing technology is solved, and faster model convergence and Higher recognition accuracy.
Patent Information
- Application Number
- CN202411108034.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2025-01-07
AI Technical Summary
There is a sample imbalance problem in the training of existing electrical graph components recognition models, which leads to slow training speed and is not easy to converge.
A complementary training method is adopted to improve the convergence speed of the model by performing multiple iterative training on the electrical graph component recognition model, and gradually adjust the number of samples in the training set until the accuracy of all training subsets is greater than the threshold, thereby improving the convergence speed of the model.
It effectively solves the impact of sample imbalance on the convergence speed of the model, makes the convergence speed faster, and improves the recognition accuracy of electrical graph components.
Smart Images

Figure CN119274191A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image recognition, and in particular to a method for training an electrical diagram component recognition model. Background Art
[0002] In order to quickly edit the electrical diagram after paperless processing, it is necessary to intelligently identify the electrical components in the electrical diagram. The accuracy of electrical diagram recognition directly affects the accuracy of subsequent reasoning solutions. The research on electrical diagram recognition technology is the intersection of the circuit analysis field and the pattern recognition field. In the development process of recent decades, most of them use image recognition methods in the field of computer vision.
[0003] However, in the training process of the supervised learning-based recognition model or unsupervised learning model currently used for electrical appliance diagram recognition, the model training is slow and difficult to converge due to the imbalance of samples in the training. Summary of the invention
[0004] In view of the defects of the prior art, the present invention provides a method for supplementing training samples for the unsupervised / supervised learning electrical diagram component recognition model, which solves the problem of the influence of sample imbalance in training on the model convergence speed, thereby making the model convergence speed faster.
[0005] In order to achieve the above object, the present invention proposes a method for training an electrical diagram component recognition model, comprising the following steps:
[0006] (1) Obtain sample images of all electrical components in multiple electrical diagrams as training sets;
[0007] (2) for an electrical diagram component recognition model, using the training set to train the electrical diagram component recognition model;
[0008] (2.1) For all the training set images l1, l2, ..., l x Perform classification, where x is the number of images in the training set, to obtain each training subset;
[0009] (2.2) For each of the training subsets, select 1 / m of the number of images of all the electrical components therein to form a training set for the first iteration; cluster the training set for the first iteration using the electrical component recognition model, and count the accuracy of each of the training subsets;
[0010] (2.3) For the training subset with the lowest accuracy, 2 / m of the number of images of all the electrical components in the training subset are selected next time, and 1 / m of the number of images of all the electrical components in the remaining training subsets are selected to form the training set for the next iteration, and the electrical component recognition model is used to cluster them, and the accuracy of each training subset is counted respectively;
[0011] (2.4) Repeat step (2.3) until the accuracy of all the training subsets is greater than the threshold, the model training is completed, and the trained electrical diagram component recognition model is obtained;
[0012] (3) Obtain an electrical diagram to be identified, and use the trained electrical diagram component identification model to perform component identification.
[0013] Furthermore, in the step (2.1), the number of sub-components and the number of strokes of components in the training set image are used to classify the components with the same number of sub-components and the same number of strokes as the components, thereby obtaining training subsets, which are respectively denoted as A ij , where i represents the number of subcomponents and j represents the number of component strokes.
[0014] Furthermore, the m is 20 or 30, and the threshold is 80%.
[0015] Furthermore, the electrical diagram component recognition model includes an unsupervised learning model or a supervised learning model.
[0016] Furthermore, the unsupervised learning model is a K-Means model; and the supervised learning model is a K nearest neighbor model.
[0017] The present invention also provides an electrical diagram component recognition model training device, comprising:
[0018] Training data acquisition module: used to acquire samples of all electrical components in multiple electrical diagrams, and perform preprocessing to obtain images of each of the electrical components as training sets;
[0019] A model training module, for training the electrical diagram component recognition model using the training set;
[0020] The recognition module is used to obtain the electrical diagram to be recognized and use the trained electrical diagram component recognition model to perform component recognition.
[0021] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed, the electrical diagram component recognition model training method as described above is implemented.
[0022] The present invention also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the electrical diagram component recognition model training method as described above when executing the computer program.
[0023] Beneficial effects of the present invention:
[0024] The present invention provides a method for identifying electrical components using supplementary training samples for an electrical component identification model, which can solve the problem of the influence of sample imbalance in training on the model convergence speed, thereby making the model convergence speed faster and better identifying electrical components. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the flow chart of the electrical diagram component recognition model training method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The present invention will be further explained below in conjunction with the accompanying drawings and embodiments.
[0027] like Figure 1 As shown, an embodiment of the present invention provides a method for training an electrical diagram component recognition model.
[0028] S101, obtaining sample images of all electrical components in a plurality of electrical diagrams as a training set;
[0029] Take screenshots of multiple electrical diagrams and completely capture images of each electrical component in the electrical diagrams as a training set.
[0030] S102, for an electrical diagram component recognition model, using the training set to train the electrical diagram component recognition model;
[0031] The electrical diagram component recognition model can be an unsupervised learning model or a supervised learning model. The unsupervised learning model includes the K-Means model, etc.; the supervised learning model includes the K nearest neighbor model, etc.
[0032] For the electrical diagram component recognition model based on the supervised learning model, all training set images need to be labeled, such as "switch".
[0033] The specific training process is as follows:
[0034] (1) For all training set images l1, l2, ..., l x Classification is performed, where x is the number of images in the training set, to obtain each training subset.
[0035] The training subsets can be divided by counting the number of sub-components and the number of component strokes in the training set image. Components with the same number of sub-components and component strokes are classified into one category to obtain each training subset, which is denoted as A ij , where i represents the number of subcomponents and j represents the number of strokes.
[0036] (2) For each training subset, select 1 / m of the number of images of all electrical components in it to form the training set of the first iteration; use the electrical component recognition model to cluster the training set of the first iteration, and based on the clustering results, calculate the accuracy of each training subset.
[0037] (3) For the training subset with the lowest accuracy, 2 / m of the number of images of all electrical components in the training subset is selected next time, and 1 / m of the number of images of all electrical components in the remaining training subsets are selected to form the training set for the next iteration. The electrical component recognition model is used to cluster them again, and the accuracy of each training subset is counted separately.
[0038] (4) Repeat step (3) until the accuracy of all training subsets is greater than the threshold. At this point, the model training is completed and a trained electrical diagram component recognition model is obtained.
[0039] Wherein: m is 20 or 30, and the threshold is 80%.
[0040] S103, obtaining an electrical diagram to be identified, and using the trained electrical diagram component identification model to perform component identification.
[0041] The embodiment of the present invention also provides an electrical diagram component recognition model training device, comprising:
[0042] Training data acquisition module: used to acquire samples of all electrical components in multiple electrical diagrams, and perform preprocessing to obtain images of each of the electrical components as training sets;
[0043] A model training module, for training the electrical diagram component recognition model using the training set;
[0044] The recognition module is used to obtain the electrical diagram to be recognized and use the trained electrical diagram component recognition model to perform component recognition.
[0045] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed, the electrical diagram component recognition model training method as described above is implemented.
[0046] An embodiment of the present invention also provides a computer device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electrical diagram component recognition model training method as described above is implemented.
[0047] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes. They can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to specific details.
Claims
1. A method for training an electrical diagram component recognition model, characterized in that: The steps include: (1) Obtain sample images of all electrical components in multiple electrical diagrams as training sets; (2) for an electrical diagram component recognition model, using the training set to train the electrical diagram component recognition model; (2.1) For all the training set images l1, l2, ..., l x Perform classification, where x is the number of images in the training set, to obtain each training subset; (2.2) For each of the training subsets, select 1 / m of the number of images of all the electrical components therein to form a training set for the first iteration; cluster the training set for the first iteration using the electrical component recognition model, and count the accuracy of each of the training subsets; (2.3) For the training subset with the lowest accuracy, 2 / m of the number of images of all the electrical components in the training subset are selected next time, and 1 / m of the number of images of all the electrical components in the remaining training subsets are selected to form the training set for the next iteration, and the electrical component recognition model is used to cluster them, and the accuracy of each training subset is counted respectively; (2.4) Repeat step (2.3) until the accuracy of all the training subsets is greater than the threshold, the model training is completed, and the trained electrical diagram component recognition model is obtained; (3) Obtain an electrical diagram to be identified, and use the trained electrical diagram component identification model to perform component identification.
2. The electrical diagram component recognition model training method according to claim 1, characterized in that: In the step (2.1), the number of sub-components and the number of strokes of components in the training set image are used to classify the components with the same number of sub-components and the same number of strokes as the components, thereby obtaining training subsets, which are respectively denoted as A ij , where i represents the number of subcomponents and j represents the number of component strokes.
3. The electrical diagram component recognition model training method according to claim 1, characterized in that: The m is 20 or 30, and the threshold is 80%.
4. The electrical diagram component recognition model training method according to claim 1, characterized in that: The electrical diagram component recognition model includes an unsupervised learning model or a supervised learning model.
5. The electrical diagram component recognition model training method according to claim 4, characterized in that: The unsupervised learning model includes a K-Means model; the supervised learning model includes a K nearest neighbor model.
6. An electrical diagram component recognition model training device, characterized in that: include: Training data acquisition module: used to acquire samples of all electrical components in multiple electrical diagrams, and perform preprocessing to obtain images of each of the electrical components as training sets; A model training module, for training the electrical diagram component recognition model using the training set; The recognition module is used to obtain the electrical diagram to be recognized and use the trained electrical diagram component recognition model to perform component recognition.
7. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed, the electrical diagram component recognition model training method according to any one of claims 1 to 5 is implemented.
8. A computer device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electrical diagram component recognition model training method described in any one of claims 1 to 5 is implemented.