Intelligent simulation method, system and equipment based on freehand circuit identification
By generating a hand-drawn circuit dataset using an improved YOLOv9t model and DAG-CirSynth algorithm, and combining image processing and large language models, the system achieves automatic recognition and simulation of hand-drawn circuit diagrams. This solves the problem of poor adaptability of hand-drawn circuit diagram recognition technology, improves teaching efficiency and provides real-time feedback, and forms a fully automated system.
Patent Information
- Application Number
- CN202511754532.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-02-27
AI Technical Summary
Traditional hand-drawn circuit diagram recognition technology is poorly adapted to hand-drawn styles and lacks real-time simulation feedback, resulting in low teaching efficiency and a lack of fully automated systems.
An improved YOLOv9t model and DAG-CirSynth algorithm are used to generate a hand-drawn circuit dataset. Combined with an image processing module and a large language model, the automatic recognition and simulation feedback of hand-drawn circuit images are realized, and SPICE netlists are generated for circuit simulation.
It improves the accuracy and efficiency of hand-drawn circuit diagram recognition, provides real-time simulation feedback, reduces reliance on teaching resources, and enhances the interactivity and efficiency of e-education.
Smart Images

Figure CN121580931A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of electronic engineering, educational technology and artificial intelligence, specifically to intelligent simulation methods, systems and devices based on hand-drawn circuit recognition. Background Technology
[0002] In the field of electronic engineering education, hand-drawn circuit diagrams are a key teaching tool. However, traditional teaching methods have many shortcomings: first, teachers need to manually correct circuit diagrams, which is time-consuming and laborious; second, students lack real-time simulation feedback, making it difficult for them to quickly understand circuit principles; third, existing hand-drawn circuit recognition technologies have poor adaptability to different hand-drawn styles, especially for blurry lines and non-standard drawing styles; and fourth, there is a lack of a fully automated system from recognition to simulation. These problems limit the efficient application of hand-drawn circuit diagrams in electronic education, and there is an urgent need for an intelligent technology that can automatically recognize hand-drawn circuits and simulate them in real time to improve teaching efficiency and quality. To this end, this invention proposes an intelligent simulation method, system, and device based on hand-drawn circuit recognition. Summary of the Invention
[0003] The purpose of this invention is to provide an intelligent simulation method, system, and device based on hand-drawn circuit recognition, which can automatically identify components, generate netlists, and provide simulation feedback from students' hand-drawn circuit images, significantly improving the interactivity and efficiency of electronic education and reducing teaching costs.
[0004] According to a first aspect of the present invention, in order to achieve the above-mentioned objective, the present invention provides the following technical solution: an intelligent simulation method based on hand-drawn circuit recognition, specifically comprising the following steps: Receive hand-drawn circuit image data and preprocess the image data; A pre-built target detection model is used to detect components in the pre-processed hand-drawn circuit image and extract the detection results, which include component category, bounding box and orientation information. The pre-built image processing module performs Gaussian blurring, grayscale conversion, binarization, median filtering, and morphological closing operation on the detected hand-drawn circuit image to extract the connected regions and node information of each component. Based on the image detection results and the connected regions and node information of each element in the image, a SPICE netlist is generated using a large language model. The generated SPICE netlist is input into the SPICE simulation engine for circuit simulation, and simulation results are generated.
[0005] Furthermore, the target detection model is an improved YOLOv9t model, comprising: (1) Replace the RepNCSPELAN4 module in the backbone network of the YOLOv9t model with the C2f module; (2) A Learnable-Concat module is introduced into the Neck part of the YOLOv9t model to achieve adaptive adjustment of feature fusion through learnable weights. The fusion formula is as follows: in, is the weight coefficient of the i-th feature, with a value range of (0, 1); The i-th feature can learn weight parameters; is the i-th input feature vector or feature map; n is the total number of input features; Concat(⋅) represents the concatenation operation; F is the final feature representation after fusion.
[0006] Furthermore, it also includes dataset generation. A dataset of hand-drawn circuit images with directional annotations is automatically generated using the DAG-CirSynth algorithm for training the object detection model. The specific method is as follows: (1) Use the schemdraw library to build a circuit topology template and inject perturbation parameters through Matplotlib's xkcd style rendering. The perturbation parameters include perturbation amplitude scale, fluctuation period length and randomness. (2) Generate composite tags as follows: cls = Num_D × BaseClass + Eid, and extract the bounding box information in YOLO format; Where cls represents the component category number, BaseClass is the component base label, Num_D is the custom number, and Eid is the component orientation code.
[0007] Furthermore, the target detection model is trained using a dataset of hand-drawn circuit images, as detailed below: (41) The YOLOv9t model was pre-trained based on the HCIS-Dataset dataset, and the dataset was divided into training, validation and test sets in an 8:1:1 ratio; (42) During training, the input resolution is 640, the batch size is 16, the training is 30 epochs, the optimizer is SGD, and cosine annealing learning rate scheduling is combined. (43) The bounding box regression loss, target loss and classification loss are used as the overall loss function; (44) During the training process, mAP, Precision, Recall and loss curves are monitored in real time, and the model with the best mAP in the validation set is used as the final weight.
[0008] Furthermore, the specific processing flow of the image processing module is as follows: (1) Gaussian blur denoising: Use an 11×11 Gaussian kernel with σ=1.5 to perform Gaussian denoising on the image. The formula is: Where G(i,j) is the Gaussian filter kernel, I(x,y,c) represents the original image, and x, y, z represent the length, width, and number of channels, respectively. blur (x,y,c) is the image after Gaussian blurring; (2) Grayscale conversion: Convert the blurred image to grayscale space. The grayscale conversion formula is: Where R, G, and B represent the values of the three channels at pixel (x, y), respectively; (4) Binarization processing: Apply a fixed threshold inverse binarization operation to the grayscale image: ; (5) Median filtering, using 7 7. Remove salt and pepper noise from the kernel; (6) Morphological closing operation to repair broken lines and fill small gaps.
[0009] Furthermore, based on the image detection results and the connected regions and node information of each element in the image, a SPICE netlist is generated using a large language model, as follows: (1) Use a visual language model to extract handwritten parameters and combine them with node numbers to generate an initial netlist; (2) Input the user requirements and initial netlist, including the charging and discharging process of the simulated RC circuit, into the semantic analysis model and optimize the SPICE netlist; (3) The NgSPICE engine is called through the PySPICE library to perform simulation, and the waveform is generated and then input into the visual language model to obtain the analysis results.
[0010] According to a second aspect of the present invention, the present invention provides an intelligent simulation system based on hand-drawn circuit recognition, for implementing an intelligent simulation method based on hand-drawn circuit recognition described in the first aspect, comprising: The receiving module is used to receive hand-drawn circuit image data and preprocess the image data; The target detection module is used to detect components in the pre-processed hand-drawn circuit image using a pre-built target detection model and extract the detection results, which include component category, bounding box and orientation information. The image processing module is used to perform Gaussian blurring, grayscale conversion, binarization, median filtering and morphological closing operation on the detected hand-drawn circuit image through a pre-built image processing module, and extract the connected regions and node information of each component. The netlist generation module is used to generate a SPICE netlist based on the image detection results and the connected regions and node information of each element in the image, using a large language model. The simulation feedback module is used to drive the SPICE simulation engine to perform circuit simulation based on the generated SPICE netlist and generate simulation results.
[0011] Furthermore, the intelligent simulation system also includes an interactive Web platform module, specifically: (1) An interactive web platform is developed using the Streamlit framework, which ensures cross-device compatibility and provides a smooth user experience through responsive design; (2) The platform includes modules such as image uploading, component recognition, netlist generation, simulation waveform analysis and user requirement input, and supports real-time interaction and data visualization; According to a third aspect of the present invention, the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein when the processor loads and executes the computer program, it employs an intelligent simulation method based on hand-drawn circuit recognition as described in the first aspect.
[0012] According to a fourth aspect of the present invention, the present invention provides a storage medium containing computer-executable instructions, wherein the computer-executable instructions, when executed by a computer processor, are used to perform an intelligent simulation method based on hand-drawn circuit recognition described in the first aspect.
[0013] This invention has at least the following beneficial effects: (1) This invention improves processing efficiency and accuracy by directly extracting components and topology from hand-drawn circuit images. Compared with traditional methods that rely on manual correction and standardized tools, it significantly reduces the dependence on teaching resources and the burden of correction, enabling high-quality circuit verification in an educational environment. (2) This invention utilizes the improved YOLOv9t model and DAG-CirSynth algorithm for data generation and recognition, which can accurately handle non-standard hand-drawn styles, providing a new tool for circuit teaching. It is particularly suitable for classroom scenarios that require immediate feedback, greatly improving the accessibility and flexibility of simulation analysis, and helping to promote progress in the field of electronic education.
[0014] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the simulation method described in this invention; Figure 2 This is a schematic diagram of the improved YOLOv9t model architecture of the present invention; Figure 3 This is a schematic diagram of the Learnable-Concat module structure of the present invention; Figure 4 This is a rendering effect of plt.xkcd() in this invention; Figure 5 This is a schematic diagram of the circuit element categories in this invention; Figure 6 This is a flowchart of the image processing module of the present invention; Figure 7 This is a schematic diagram of the end-to-end circuit identification and analysis principle of the present invention; Figure 8 This is a user-in-use example diagram of the present invention; Figure 9 This is a schematic diagram illustrating the application scenario of the simulation system of this invention. Detailed Implementation
[0016] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0017] Example 1: Please see Figures 1-9 This invention provides a technical solution: an intelligent simulation method based on hand-drawn circuit recognition, comprising the following steps: S1. Receive hand-drawn circuit image data and preprocess the image data, including scaling and format conversion, to ensure that the image is compatible with the subsequent detection model; like Figure 4 As shown, this embodiment generates a simulated hand-drawn circuit diagram through the following steps: Original image drawing: First, use the SchemDraw tool to generate a standard circuit diagram as the basic image input; Enable hand-drawn style model: Call the drawing function plt.xkcd() to perform hand-drawn style conversion on the standard image, with the basic parameters set to (1, 150, 1) to obtain a hand-drawn style image; Digital style adjustment: Further distortion and deformation of circuit diagram lines by setting different parameters; S2. An improved YOLOv9t model is used to detect and locate components in hand-drawn circuit diagrams, as detailed below: (S2.1) Simplify the backbone network by replacing RepNCSPELAN4 with C2f modules to reduce the number of parameters and retain the AConv structure to stabilize channel conversion; (S2.2) A Learnable-Concat module is introduced into the Neck part of the YOLOv9t model to achieve adaptive adjustment of feature fusion through learnable weights. The fusion formula is as follows: in, is the weight coefficient of the i-th feature, with a value range of (0, 1); The i-th feature can learn weight parameters; is the i-th input feature vector or feature map; n is the total number of input features; Concat(⋅) represents the concatenation operation; F is the final feature representation after fusion; like Figure 2 As shown, the target detection model (improved YOLOv9t model) in this embodiment includes an input module, a backbone network, a feature pyramid network (FPN network), a path aggregation network (PAN network), and a YOLO detection head: Input module: Receives hand-drawn circuit images with a size of 640×640 as input; Backbone network: An improved C2f module replaces some convolutional layers to extract multi-scale features, outputting three feature maps at different resolutions: 80×80, 40×40, and 20×20. Feature Pyramid Network (FPN): Upsamples low-level features and fuses them with high-level features. It introduces a learnable concatenation module (L-Concat) to achieve better feature fusion. Path Aggregation Network (PAN): Downsamples high-level features and fuses them with low-level features. It also uses the Learnable-Concat module to enhance the combination of semantic and localization information. Yolo detector head: predicts based on fused multi-scale features and outputs the category, bounding box and orientation information of circuit components; Output: The circuit image predicted by the detection head is labeled, including component category, bounding box and orientation information; The bounding box refers to the rectangular area generated by the object detection model to locate each electrical component in a hand-drawn circuit image. It contains the spatial location and size information of the component and is used to determine the specific location of the component in the image. Orientation Information: refers to the orientation of electrical components in the image as identified by the target detection model. For example, the horizontal or vertical placement of resistors, the arrow direction of symbols such as diodes and transistors, and the triangle orientation of operational amplifiers. This information is used to distinguish different placement methods of similar components to ensure that the generated circuit topology is consistent with the actual circuit. Figure 3 The following is a schematic diagram of the structure of the Learnable-Concat module of this invention: The Learnable-Concat module proposed in this embodiment includes a weight normalization unit, a feature weighting unit, and a feature concatenation unit: Weight normalization unit: Input multi-path features (F0, F1) and their corresponding learnable weight parameters (W0, W1), generate weight coefficients (α0, α1) through normalization operation, ensuring that the weights of each channel are in the interval (0, 1) and the sum is 1; Feature weighting unit: The normalized weight coefficients (α0, α1) are applied to the corresponding features (F0, F1) to obtain the weighted feature representation; Feature splicing unit: splices the weighted features along the channel dimension to form the final fused feature output; S3. Generate a dataset using the DAG-CirSynth algorithm, as follows: Use the Schemdraw library to generate circuit topology templates, and inject scale (perturbation amplitude), length (fluctuation period), and randomness (random scaling) parameters into the XKCD engine to simulate a hand-drawn style; traverse the component combinations (720 types) to generate composite labels and YOLO bounding boxes, forming 4800 oriented labeled images to support model training; Specifically, the improved YOLOv9t model was trained using a dataset of hand-drawn circuit images, as follows: The improved YOLOv9t model used in this embodiment was trained based on the HCIS-Dataset (4800 images). The data was divided into training, validation, and test sets in an 8:1:1 ratio, using the YOLO annotation format. During training, the input resolution was 640, the batch size was 16, and the training lasted for 30 epochs. The optimizer was SGD, combined with cosine annealing for learning rate scheduling. Data augmentation included color perturbation (hue 0.015, saturation 0.7, brightness 0.4), translation (0.1), and Mosaic stitching (disabled in the later stages of training) to simulate the differences between hand-drawn and photographic work. The loss function consisted of bounding box regression loss (CIoU), targetability loss (BCEWithLogits), and classification loss (BCEWithLogits), with the total loss being the weighted sum of the three (consistent with traditional YOLOv9). During training, mAP, precision, recall, and loss curves were monitored in real time, and the model with the best mAP in the validation set was used as the final weight. S4. Using a pre-built image processing module, the detected hand-drawn circuit image is subjected to Gaussian blurring, grayscale conversion, binarization, median filtering, and morphological closing operations to extract the connected regions and node information of each component: like Figure 6 As shown, the specific processing flow of the image processing module is as follows: (S4.1) Gaussian blur denoising: Use an 11×11 Gaussian kernel with σ=1.5 to perform Gaussian denoising on the image. The formula is: Where G(i,j) is the Gaussian filter kernel, I(x,y,c) represents the original image, and x, y, z represent the length, width, and number of channels, respectively. blur (x,y,c) is the image after Gaussian blurring; (S4.2) Grayscale conversion: Convert the blurred image to grayscale space. The grayscale conversion formula is: Where R, G, and B represent the values of the three channels at pixel (x, y), respectively; (S4.3) Binarization processing: Apply a fixed threshold inverse binarization operation to the grayscale image. ; (S4.4) Median filtering, using 7 7. Remove salt and pepper noise from the kernel; (S4.5) Morphological closing operation: repairs broken lines and fills small gaps, such as... Figure 6 As shown, ensure the integrity of the connected components; S5. Based on the image detection results and the connected regions and node information of each element in the image, generate a SPICE netlist using a large language model, and drive NgSPICE simulation to generate simulation results, such as... Figure 7 As shown, the details are as follows: (S5.1) Use a visual language model (such as Doubao-1.5-thinking-vision-pro) to extract handwritten parameters (such as "10k") and combine them with node numbers to generate an initial netlist; (S5.2) Optimize the netlist by combining user requirements (such as “simulating the charging and discharging process of an RC circuit”) with the initial netlist input semantic analysis model (such as Doubao-Seed-1.6); (S5.3) The NgSPICE engine is called through the PySPICE library to perform simulation, generate waveforms, and then send them to the visual language model for analysis.
[0018] like Figure 5 As shown, this embodiment establishes a component library containing multiple types of basic electrical components and their different orientations, covering a total of 7 major categories and 21 tags, specifically including: Resistors: including horizontally placed resistors (R right) and vertically placed resistors (R up); Capacitors: include horizontally placed capacitors (C right) and vertically placed capacitors (C up); DC voltage source: Includes four placement directions: right-hand (V right), down-hand (V down), left-hand (V left), and up-hand (V up); Inductors: including horizontally placed inductors (L right) and vertically placed inductors (L up); Diodes: include four placement orientations: right-hand (D right), down-hand (D down), left-hand (D left), and up-hand (D up); DC current source: Includes four placement directions: right, down, left, and up; Transformers and MOSFETs: This category includes three types of symbols: transformer (T), two-winding transformer (DTDTS), and MOSFET (Mos). like Figure 8-9As shown, in practical applications, users draw circuit schematics with pen and paper, take photos, and upload them. The system first preprocesses the data to remove irrelevant backgrounds and then uses an improved YOLOv9t model to detect and identify circuit components, obtaining their positions and orientations to ensure accurate topology analysis. Subsequently, it automatically generates a SPICE netlist for simulation using a netlist generation algorithm and a large language model, and calls the simulation engine to obtain the circuit output waveform. Users can ask questions and obtain simulation analysis results through the interactive interface, achieving convenient circuit verification and learning support.
[0019] Example 2: This invention provides an intelligent simulation system based on hand-drawn circuit recognition, used to implement the intelligent simulation method based on hand-drawn circuit recognition described in Embodiment 1, comprising: The receiving module is used to receive hand-drawn circuit image data and preprocess the image data; The target detection module is used to detect components in the pre-processed hand-drawn circuit image using a pre-built target detection model and extract the detection results, which include component category, bounding box and orientation information. The image processing module is used to perform Gaussian blurring, grayscale conversion, binarization, median filtering and morphological closing operation on the detected hand-drawn circuit image through a pre-built image processing module, and extract the connected regions and node information of each component. The netlist generation module is used to generate a SPICE netlist based on the image detection results and the connected regions and node information of each element in the image, using a large language model. The simulation feedback module is used to drive the SPICE simulation engine to perform circuit simulation based on the generated SPICE netlist and generate simulation results.
[0020] Specifically, the aforementioned receiving module, target detection module, image processing module, netlist generation module, and simulation feedback module can be embedded into a computer processing system. The computer, based on the intelligent simulation method for hand-drawn circuit recognition provided above, calls upon each of the above modules to complete the simulation task; the above modules can perform operations according to the specific steps given in the method.
[0021] It should be noted that the division of the various modules in the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. These modules can be implemented entirely in software via processing elements, entirely in hardware, or partially in software via processing elements and partially in hardware. For example, the receiving module can be a separate processing element or integrated into a chip within the device. Alternatively, it can be stored as program code in the device's memory, invoked and executed by a processing element. The implementation of other modules is similar. Furthermore, these modules can be fully or partially integrated together or implemented independently. The processing element mentioned here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed through integrated logic circuits in the processor element or through software instructions.
[0022] For example, these modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). As another example, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together to form a system-on-a-chip (SOC).
[0023] Furthermore, the intelligent simulation system includes an interactive Web platform module.
[0024] Traditional simulation tools rely on standardized input, while this system achieves an educational closed loop through end-to-end automated processing of hand-drawn images. The web platform is based on the Streamlit framework, adopts a responsive design, and supports multi-device access; its modular layout includes an image upload area (real-time preview) and a simulation output area (interactive waveform charts), facilitating user operation and understanding.
[0025] Example 3: The present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor. When the processor loads and executes the computer program, it adopts the intelligent simulation method based on hand-drawn circuit recognition described in Embodiment 1.
[0026] It should be noted that the terminal device can be a computer device such as a desktop computer, a laptop computer, or a cloud server, and the terminal device includes, but is not limited to, a processor and a memory. For example, the terminal device may also include input / output devices, network access devices, and buses.
[0027] Furthermore, the processor can be a central processing unit (CPU). Of course, depending on the actual use, other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be used. The general-purpose processor can be a microprocessor or any conventional processor, etc., and this application does not limit it in this regard.
[0028] Example 4: The present invention provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the intelligent simulation method based on hand-drawn circuit recognition described in Embodiment 1.
[0029] The computer program can be stored in a computer-readable medium. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or certain middleware. The computer-readable medium includes any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the computer-readable medium includes, but is not limited to, the above-mentioned components.
[0030] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0031] For those skilled in the art, the specific meaning of the above terms in this invention can be understood according to the specific circumstances. When an element is referred to as being "assembled on," "mounted on," "fixed to," or "set on" another element, it may be directly on the other element or there may be an intermediate element present. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be an intermediate element present. The terms "vertical," "horizontal," "upper," "lower," "left," "right," and similar expressions used herein are for illustrative purposes only and do not represent the only possible embodiments.
[0032] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
[0033] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
Claims
1. An intelligent simulation method based on hand-drawn circuit recognition, characterized in that, Specifically, the following steps are included: Receive hand-drawn circuit image data and preprocess the image data; A pre-built target detection model is used to detect components in the pre-processed hand-drawn circuit image and extract the detection results, which include component category, bounding box and orientation information. The pre-built image processing module performs Gaussian blurring, grayscale conversion, binarization, median filtering, and morphological closing operation on the detected hand-drawn circuit image to extract the connected regions and node information of each component. Based on the image detection results and the connected regions and node information of each element in the image, a SPICE netlist is generated using a large language model. The generated SPICE netlist is input into the SPICE simulation engine for circuit simulation, generating simulation results.
2. The intelligent simulation method based on hand-drawn circuit recognition according to claim 1, characterized in that: The target detection model is an improved YOLOv9t model, including: (1) Replace the RepNCSPELAN4 module in the backbone network of the YOLOv9t model with the C2f module; (2) A Learnable-Concat module is introduced into the Neck part of the YOLOv9t model to achieve adaptive adjustment of feature fusion through learnable weights. The fusion formula is as follows: in, is the weight coefficient of the i-th feature, with a value range of (0, 1); The i-th feature can learn weight parameters; is the i-th input feature vector or feature map; n is the total number of input features; Concat(⋅) represents the concatenation operation; F is the final feature representation after fusion.
3. The intelligent simulation method based on hand-drawn circuit recognition according to claim 2, characterized in that: It also includes dataset generation, which uses the DAG-CirSynth algorithm to automatically generate a dataset of hand-drawn circuit images with directional annotations for training the object detection model. The specific method is as follows: (1) Use the schemdraw library to build a circuit topology template and inject perturbation parameters through Matplotlib's xkcd style rendering. The perturbation parameters include perturbation amplitude scale, fluctuation period length and randomness. (2) Generate composite tags as follows: cls = Num_D × BaseClass + Eid, and extract the bounding box information in YOLO format; Where cls represents the component category number, BaseClass is the component base label, Num_D is the custom number, and Eid is the component orientation code.
4. The intelligent simulation method based on hand-drawn circuit recognition according to claim 3, characterized in that: The target detection model is trained using a dataset of hand-drawn circuit images, as detailed below: (41) The YOLOv9t model was pre-trained based on the HCIS-Dataset dataset, and the dataset was divided into training, validation and test sets in an 8:1:1 ratio; (42) During training, the input resolution is 640, the batch size is 16, the training is 30 epochs, the optimizer is SGD, and cosine annealing learning rate scheduling is combined. (43) The bounding box regression loss, target loss and classification loss are used as the overall loss function; (44) During the training process, mAP, Precision, Recall and loss curves are monitored in real time, and the model with the best mAP in the validation set is used as the final weight.
5. The intelligent simulation method based on hand-drawn circuit recognition according to claim 4, characterized in that: The specific processing flow of the image processing module is as follows: (1) Gaussian blur denoising: Use an 11×11 Gaussian kernel with σ=1.5 to perform Gaussian denoising on the image. The formula is: Where G(i,j) is the Gaussian filter kernel, I(x,y,c) represents the original image, and x, y, z represent the length, width, and number of channels, respectively. blur (x,y,c) is the image after Gaussian blurring; (2) Grayscale conversion: Convert the blurred image to grayscale space. The grayscale conversion formula is: Where R, G, and B represent the values of the three channels at pixel (x, y), respectively; (4) Binarization processing: Apply a fixed threshold inverse binarization operation to the grayscale image: ; (5) Median filtering, using 7 7. Remove salt and pepper noise from the kernel; (6) Morphological closing operation to repair broken lines and fill small gaps.
6. The intelligent simulation method based on hand-drawn circuit recognition according to claim 5, characterized in that: Based on the image detection results and the connected regions and node information of each element in the image, a SPICE netlist is generated using a large language model, as follows: (1) Use a visual language model to extract handwritten parameters and combine them with node numbers to generate an initial netlist; (2) Input the user requirements and initial netlist, including the charging and discharging process of the simulated RC circuit, into the semantic analysis model and optimize the SPICE netlist; (3) The NgSPICE engine is called through the PySPICE library to perform simulation, and the waveform is generated and then input into the visual language model to obtain the analysis results.
7. An intelligent simulation system based on hand-drawn circuit recognition, used to implement the intelligent simulation method based on hand-drawn circuit recognition as described in any one of claims 1 to 6, characterized in that, include: The receiving module is used to receive hand-drawn circuit image data and preprocess the image data; The target detection module is used to detect components in the pre-processed hand-drawn circuit image using a pre-built target detection model and extract the detection results, which include component category, bounding box and orientation information. The image processing module is used to perform Gaussian blurring, grayscale conversion, binarization, median filtering and morphological closing operation on the detected hand-drawn circuit image through a pre-built image processing module, and extract the connected regions and node information of each component. The netlist generation module is used to generate a SPICE netlist based on the image detection results and the connected regions and node information of each element in the image, using a large language model. The simulation feedback module is used to drive the SPICE simulation engine to perform circuit simulation based on the generated SPICE netlist and generate simulation results.
8. The intelligent simulation system based on hand-drawn circuit recognition according to claim 7, characterized in that, The intelligent simulation system also includes an interactive web platform module, specifically: (1) An interactive web platform is developed using the Streamlit framework, which ensures cross-device compatibility and provides a smooth user experience through responsive design; (2) The platform includes modules such as image uploading, component recognition, netlist generation, simulation waveform analysis and user requirement input, and supports real-time interaction and data visualization.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor loads and executes the computer program, it employs an intelligent simulation method based on hand-drawn circuit recognition as described in any one of claims 1 to 6.
10. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform an intelligent simulation method based on hand-drawn circuit recognition as described in any one of claims 1 to 6.
Citation Information
Cited By
Analog circuit system block diagram assembly connection detection method
CN122024272A