|
14 | 14 |
|
15 | 15 | </div> |
16 | 16 |
|
| 17 | +## Table of Contents |
| 18 | +- [Introduction](#introduction) |
| 19 | +- [Features](#features) |
| 20 | +- [Installation](#installation) |
| 21 | +- [Usage](#usage) |
| 22 | +- [Contributing](#contributing) |
| 23 | +- [License](#license) |
| 24 | +- [Contact](#contact) |
| 25 | +- [Project Structure](#project-structure) |
| 26 | + |
| 27 | +## Introduction |
| 28 | +CircuitNet aims to automate the conversion of hand-drawn circuit sketches into professional circuit diagrams using deep learning. The system combines traditional image processing for component detection with a CNN for classification, achieving 90% detection and 96.5% classification accuracy across 5 common circuit components. |
| 29 | + |
| 30 | +## Installation |
| 31 | +To install CircuitNet, follow these steps: |
| 32 | + |
| 33 | +1. Clone the repository: |
| 34 | + ```bash |
| 35 | + git clone https://github.com/aaanthonyyy/CircuitNet.git |
| 36 | + cd CircuitNet |
| 37 | + ``` |
| 38 | +3. Activate the virtual environment: |
| 39 | + ```bash |
| 40 | + python -m venv circuitnet |
| 41 | + source circuitnet/bin/activate |
| 42 | + ``` |
| 43 | +5. Install the dependencies: |
| 44 | + ```bash |
| 45 | + pip install -r requirements.txt |
| 46 | + ``` |
| 47 | + |
| 48 | + |
| 49 | +## License |
| 50 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 51 | + |
17 | 52 | ## Project Overview |
| 53 | +> [!INFO] |
| 54 | +> The project is divided into 3 main components: component detection, component classification, and circuit generation. The following sections provide an overview of each component. |
18 | 55 | <div align="center"> |
19 | 56 | <img src="https://user-images.githubusercontent.com/43044255/170146864-9e7f77e7-fd16-4c4e-9d26-26639a7e9c37.png" alt="Logo" width="600"/> |
20 | 57 | </div> |
| 58 | +<br/> |
21 | 59 |
|
22 | | -> A deep learning algorithm is proposed to automatically convert schematic sketches into circuit diagrams. The algorithm is promising, achieving a detection accuracy of 90% and a classification accuracy of 96.5%. |
| 60 | +### Dataset |
| 61 | +The dataset used in this project consists of 3,191 images (including augmented data). The original dataset was sourced from [mahmut-aksakalli/circuit_recognizer](https://github.com/mahmut-aksakalli/circuit_recognizer/blob/master/traindata.zip) and was further augmented to improve model performance. |
23 | 62 |
|
24 | | -<br/> |
25 | | -<br/> |
| 63 | +The dataset is located in the `dataset/` directory of this repository and includes: |
| 64 | +- Original circuit component images |
| 65 | +- Augmented variations of the original images |
| 66 | +- Additional handcrafted component images |
26 | 67 |
|
| 68 | +#### Extract the dataset: |
27 | 69 |
|
28 | | -### Component Segmentation |
| 70 | + ```bash |
| 71 | + cd dataset/ |
| 72 | + tar -xzvf circuit_dataset.tar.gz |
| 73 | + ``` |
| 74 | + |
| 75 | +### Notebooks |
| 76 | +- **neural_network.ipynb**: This notebook is where the neural network is trained to predict the circuit components. |
| 77 | +- **object_detection.ipynb**: This notebook covers the image processing algorithm used to detect circuit components. |
| 78 | +- **circuit_generation.ipynb**: This notebook takes the detected and classified components to generate an SVG/PNG of the circuit. |
| 79 | + |
| 80 | + |
| 81 | +### Component Classification |
29 | 82 | <div align="center"> |
30 | | - <img src="https://user-images.githubusercontent.com/43044255/170148823-b921898d-1d6a-457b-8dfa-ffa2ad8d0ea7.png" alt="Logo" width="600"/> |
| 83 | + <img src="https://user-images.githubusercontent.com/43044255/170149446-d57c13f0-3ab0-4542-86c9-8a7093d11627.png" alt="Logo" width="600"/> |
31 | 84 | <br/> |
32 | 85 | <br/> |
33 | 86 | </div> |
34 | | -There are a variety of feature detection algorithms possible, but we opted for traditional image processing techniques due to the inavailability of labeled data. |
35 | | - |
| 87 | +The component classification model was trained using a Convolutional Neural Network (CNN) with 5 classes: resistor, capacitor, inductor, voltage source, and current source. The model achieved an accuracy of 96.5% on the test set. |
36 | 88 | <br/> |
37 | 89 | <br/> |
38 | 90 |
|
39 | | -### Classification Architecture |
| 91 | +### Component Segmentation |
40 | 92 | <div align="center"> |
41 | | - <img src="https://user-images.githubusercontent.com/43044255/170149446-d57c13f0-3ab0-4542-86c9-8a7093d11627.png" alt="Logo" width="600"/> |
| 93 | + <img src="https://user-images.githubusercontent.com/43044255/170148823-b921898d-1d6a-457b-8dfa-ffa2ad8d0ea7.png" alt="Logo" width="600"/> |
42 | 94 | <br/> |
43 | 95 | <br/> |
44 | 96 | </div> |
| 97 | +There are a variety of feature detection algorithms possible, but we opted for traditional image processing techniques due to the inavailability of labeled data. |
| 98 | +<br/> |
| 99 | +<br/> |
45 | 100 |
|
| 101 | +### Circuit Generation |
46 | 102 |
|
47 | | -### Software Dependancies |
48 | | -This project was built using the following open-source libraries: |
| 103 | +The circuit generation pipeline transforms detected components into a complete circuit diagram through a three-stage process. First, the detected and classified components are processed to establish their spatial relationships and mapped to standardized circuit elements. Next, these processed components are used to automatically generate a JSON netlist that defines all component connections while preserving the original circuit topology. Finally, this netlist is rendered into an SVG circuit diagram using a rule-based placement system, which can then be exported to PNG format for easy visualization |
49 | 104 |
|
50 | | -* [Numpy](https://www.numpy.org/) is an array manipulation library, used for linear algebra, Fourier transform, and random number capabilities. |
51 | | -* [CV2](https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html) is a library for computer vision tasks. |
52 | | -* [Skimage](https://scikit-image.org/) is a library which supports image processing applications on python. |
53 | | -* [Matplotlib](https://matplotlib.org/) is a library which generates figures and provides graphical user interface toolkit. |
54 | | -* [Tensorflow](https://www.tensorflow.org/) is an end-to-end open source machine learning platform |
55 | | -* [SVG Schematic](https://github.com/KenKundert/svg_schematic) is a library to build a schematic using Python to instantiate and place the symbols and wires |
56 | | -* [Cairo SVG](https://cairosvg.org/) is a library for processing SVG in python |
57 | | - |
| 105 | + |
| 106 | +#### Acknowledgements |
| 107 | +I would like to express my sincere gratitude to Dr. Akash Pooransingh, my project supervisor, for his invaluable guidance, expertise and encouragement throughout this research project. His insights into machine learning applications in electrical engineering and consistent support were instrumental in bringing this project to fruition. |
0 commit comments