From Image To Simulation An ANN-based Automatic Circuit Netlist Generator Img2Sim
From Image To Simulation An ANN-based Automatic Circuit Netlist Generator Img2Sim
Abstract—This study proposes an Artificial Neural Network netlist for a given circuit schematic in image format. To
(ANN) based netlist generator: Img2Sim. The tool acquires an this end, we proposes a novel CAD tool, Img2Sim, which
image of an electronic circuit, classifies the existing circuit is capable of generation of netlist from the photograph
elements, including active components (MOSFET, BJT, Op-Amp,
etc.), with at least 98% accuracy, and decides the circuit topology of the circuit. The developed tool admits an image of
and the connections with over 90% accuracy through a rule- the electronic circuit, classifies the circuit elements of the
based algorithm. Finally, it automatically yields a simulation- circuit with at least 98% accuracy, determines the circuit
ready netlist for the circuit of concern. It is worth noting that topology and the connections between these elements with
some CAD tools have been developed before; however, they have at least 90% accuracy with a rule-based algorithm, and
mostly focused on recognizing the circuit elements only and, to
our best knowledge, Img2Sim is the first CAD tool that creates finally yields the entire simulation-ready netlist. Img2Sim
the entire netlist for a given circuit in image format. is novel owing to (1) its ability to accurately detect active
Index Terms—Artificial Intelligence, Computer Vision, Circuit circuit components as well as the passive components, (2)
Simulation, Object Detection, Image Processing its unique algorithm ensuring high percentage of accuracy
whilst forming the node connection network for the first
I. I NTRODUCTION time in the literature, and (3) the user graphical user
Recently, artificial intelligence (AI) algorithms have been interface (GUI) enabling generation simulation-ready netlist
trending again thanks to the advances in computer hard- from circuit images instantly.
ware, so the number of AI-based applications has boomed The remainder of the paper is organised as follows. Sec-
over the last decade. AI-based algorithms have been widely tion II reviews the related works reported in the literature.
preferred in creating automated tools that facilitate the pro- The developed tool is introduced in Section III. The results
cesses by performing time-consuming tasks without human are discussed in Section IV. Finally, Section V concludes this
effort with high accuracy rates. Electronic circuit design paper.
process has also taken the advantage of AI, for example, II. R ELATED W ORKS
electronic design automation (EDA) tools have employed
AI algorithms from device/circuit modeling to circuit/layout Most of the studies on detection and analysis of cir-
synthesis tools for many years [1]–[4]. cuit elements have explored solutions to classify circuit
On the other hand, one of the most important prelim- elements by using different approaches, and there is no
inary tasks of the design process is to create a trusted well-equipped tool for automatically generating the entire
netlist for a given schematic. Conventionally, generation netlist from scratch in the literature. The task of creating the
of simulation-ready representation of circuits has been entire circuit netlist from an image is a quite challenging
manually performed by a designer. Besides, designers are process, where generation of true connection list may be
prone to make mistakes during the transfer of information a bottleneck especially considering the variety of analog
from the circuit schematic to the netlist. Further, it is circuit designs including a wide range of electronic circuit
quite difficult to detect the human-induced errors in a elements.
complicated circuit, in which even an overlooked small The study presented in [5] utilizes k-nearest neighbor-
error may substantially prolong this preliminary work. hood (KNN) algorithm to classify the target image that
is segmented by pixel distribution characteristics based
Several approaches have been proposed to automatize
on 3500 circuit element photographs. The developed algo-
the preparation of simulation-ready representation of cir-
rithm detects the circuit components with 93% accuracy.
cuits [5]–[10]. However, most of them have explored ad-
In [6], recognition of circuit elements was performed by
hoc techniques to recognize components of trivial circuits
using 2D dynamic programming technique, in which 451
including passive devices only. To our best knowledge, there
isolated symbols were used for training purposes while
is no matured tool that successfully generates the entire
more samples for training were obtained some geometrical
transformations to identify 10 different circuit elements.
978-1-6654-6703-2/22/$31.00 ©2022 IEEE The developed approach achieves over 90% recognition rate
Authorized licensed use limited to: Central China Normal University. Downloaded on November 04,2024 at 02:26:50 UTC from IEEE Xplore. Restrictions apply.
Figure 1: Sample from the circuit element recognition dataset.
for component recognition. In addition to these studies, Experts Group (JPEG) for images and text file (txt) for the
deep learning algorithms have been also employed for object coordinates in the image, the dataset is ready to
circuit element detection. To this end, analysis of hand be used in object detection model in order to analyze the
drawn circuits using deep learning architecture is presented circuit and detect all components existing in the image. For
in [7]. The proposed approach uses a Convolutional Neural the purpose of object detection, we exploited "You Only
Network (CNN) that classifies circuit elements with 95% Look Once Version Five (YOLOv5)" [11] owing to its ease
recognition rate. Similarly, a CNN based recognition of of use, high performance, and high speed. We achieved
hand-drawn circuits was proposed in [8]. A dataset with around 98% average recognition accuracy during object
863 images consisting of hand drawn circuits were used to classification with YOLOv5.
train the model that is able to estimate only 4 different
classes (resistor, capacitor, inductor, and current source)
with 84.41% accuracy. An ANN based approach for electrical
symbol detection was proposed in [9]. They used optical
character recognition (OCR) to define only the electrical
symbols in a hand-drawn circuit, in which the estimation
accuracy lies between 83%-85%. In [10], researchers devel-
oped an approach that can successfully detect digital circuit
elements and the structure of the circuit with an accuracy
ranged between 75%-95% using deep learning algorithms.
III. M ETHODOLOGY
A. Dataset
1554 circuit images derived from digital formats were
used to label 13 different circuit components. A dataset with Figure 2: Detection of the circuit elements.
11,500 labeled components (an average of 7.4 labels per
image) was formed. This dataset includes the components
tabulated in Table I. A sample of the collected images for C. Node Detection
the dataset is provided in Fig. 1. Nodes are the points in the circuit connecting at least
two different circuit elements and it is hard to detect con-
Table I: List of recognized circuit elements by Img2Sim. nections with conventional object detection models. The
Resistor Diode Power Supply proposed procedure for node detection is visually illustrated
Capacitor BJT Current Source in Fig. 3.
Inductor MOSFET DC Source To detect the nodes, wiring in the circuit must be identi-
Ground Op-Amp AC Source fied at first. To this end, we opted to the Hough Transform
Battery [12], which is a widely used and effective approach to
extract the features of an image, especially in line detection.
First, each detected line is separated into vertical and hor-
B. Circuit Element Recognition izontal components. This process is carried out by simply
Once file structures and bounding box annotations are comparing the acquired values by the Hough Transform.
prepared, where the file formats are Joint Photographic After transformation of the image, each identified line is
Authorized licensed use limited to: Central China Normal University. Downloaded on November 04,2024 at 02:26:50 UTC from IEEE Xplore. Restrictions apply.
Figure 4: a)Detection of the nodes in the circuit. b) Assign-
ment of numerical values read.
Authorized licensed use limited to: Central China Normal University. Downloaded on November 04,2024 at 02:26:50 UTC from IEEE Xplore. Restrictions apply.
Figure 5: Re-created schematics and corresponding netlists generated by Img2Sim.
network and self-biased common-source/drain amplifier) Comparator using Artificial Neural Networks.” International Journal
and generated netlists are provided in Fig. 5. As can be seen of Electrical & Computer Engineering (2088-8708), vol. 6, no. 1, 2016.
[2] Pan, Po-Cheng and Huang, Chien-Chia and Chen, Hung-Ming, “Late
from the results, all components and their values have been breaking results: An efficient learning-based approach for perfor-
successfully captured by the developed tool, where question mance exploration on analog and RF circuit synthesis,” in 2019 56th
marks represent non-valued components in the schematics. ACM/IEEE Design Automation Conference (DAC). IEEE, 2019, pp. 1–2.
[3] İslamoğlu, Gamze and Çakici, Tuğberk Oğulcan and Afacan, Engin
The comparison results of the developed tool with the and Dündar, Günhan, “Artificial neural network assisted analog IC
other approaches reported in the literature are given in Ta- sizing tool,” in 2019 16th International Conference on Synthesis, Mod-
ble II. According to the results, Img2Sim outperforms other eling, Analysis and Simulation Methods and Applications to Circuit
Design (SMACD). IEEE, 2019, pp. 9–12.
approaches in terms of component classification accuracy [4] Watson, Paul M and Gupta, Kuldip C, “Design and optimization of
(98%), whereas the approach presented in [5] can recognize CPW circuits using EM-ANN models for CPW components,” IEEE
the maximum number of components (35). Furthermore, Transactions on Microwave Theory and Techniques, vol. 45, no. 12,
pp. 2515–2523, 1997.
Img2Sim provides particular features of component value [5] Huoming, Zhang and Lixing, Shao, “Research on K nearest neighbor
detection and automatic netlist generation, which put it identification of hand-drawn circuit diagram,” in Journal of Physics:
considerably forward from the others. Also, it is worth Conference Series, vol. 1325, no. 1. IOP Publishing, 2019, p. 012233.
[6] Feng, Guihuan and Viard-Gaudin, Christian and Sun, Zhengxing,
noting that Img2Sim is the only tool that also exhibits a “On-line hand-drawn electric circuit diagram recognition using 2D
user-friendly GUI. dynamic programming,” Pattern Recognition, vol. 42, no. 12, pp. 3215–
3223, 2009.
V. C ONCLUSION [7] Wang, Haiyan and Pan, Tianhong and Ahsan, Mian Khuram, “Hand-
drawn electronic component recognition using deep learning algo-
In this study, Img2Sim, an ANN based automatic netlist rithm,” International Journal of Computer Applications in Technology,
generator tool, is presented. The proposed tool acquires vol. 62, no. 1, pp. 13–19, 2020.
[8] Günay, Mihriban and Köseoğlu, Murat and Yıldırım, Özal, “Clas-
the circuit schematic in image format, detects the circuit sification of hand-drawn basic circuit components using convolu-
components from given images with over 98% accuracy, tional neural networks,” in 2020 International Congress on Human-
determines the connections by detecting the lines and the Computer Interaction, Optimization and Robotic Applications (HORA).
IEEE, 2020, pp. 1–5.
nodes, extracts text and numerical values to assign them [9] Rabbani, Mahdi and Khoshkangini, Reza and Nagendraswamy, HS
to corresponding components, and ultimately generates a and Conti, Mauro, “Hand drawn optical circuit recognition,” Procedia
simulation-ready netlist of the circuit with 90% accuracy. Computer Science, vol. 84, pp. 41–48, 2016.
[10] Altun, Oğuz and Nooruldeen, Orhan, “SKETRACK: stroke-based
To our best knowledge, Img2Sim is the first application that recognition of online hand-drawn sketches of arrow-connected di-
generates the entire netlist for a given circuit from scratch. agrams and digital logic circuit diagrams,” Scientific Programming,
vol. 2019, 2019.
R EFERENCES [11] Jocher, Glenn and Nishimura, K and Mineeva, T and Vilariño, R,
“yolov5,” Code repository https://github. com/ultralytics/yolov5, 2020.
[1] Bhatia, Veepsa and Pandey, Neeta and Bhattacharyya, Asok, “Mod- [12] Hough, Paul VC, “Method and means for recognizing complex pat-
elling and Design of Inverter Threshold Quantization Based Current terns,” Dec. 18 1962, US Patent 3,069,654.
Authorized licensed use limited to: Central China Normal University. Downloaded on November 04,2024 at 02:26:50 UTC from IEEE Xplore. Restrictions apply.