SketchLogic is a Circuit Metadata Detector that can detect logic gates, rotations, and wires from hand-drawn circuit sketches, export results as structured JSON and render a clean visualization.
It takes scanned jpg images of one (or more) Handdrawn circuits on a plain paper as input. (no lines on the paper)
Contributions are Welcome!
SketchLogic
├─ backend/
│ ├─ skelo/
│ │ ├─ __init__.py
│ │ ├─ circuit_parser.py
│ │ ├─ draw.py
│ │ ├─ inference.py
│ │ ├─ label.py
│ │ ├─ normalizer.py
│ │ ├─ SKELOv1.pt
│ │ └─ wires.py
│ ├─ app.py
│ ├─ downloads.py
│ ├─ README.md
│ └─ requirements.txt
├─ frontend/
│ ├─ public/
│ │ └─ vite.svg
│ ├─ src/
│ │ ├─ assets/
│ │ │ └─ react.svg
│ │ ├─ api.ts
│ │ ├─ App.css
│ │ ├─ App.tsx
│ │ ├─ index.css
│ │ ├─ main.tsx
│ │ └─ vite-env.d.ts
│ ├─ eslint.config.js
│ ├─ index.html
│ ├─ postcss.config.js
│ ├─ README.md
│ ├─ tailwind.config.js
│ └─ vite.config.ts
├─ CODE_OF_CONDUCT.md
├─ CONTRIBUTING.md
├─ LICENSE
├─ prerequisites.py
├─ README.md
├─ SECURITY.md
└─ testRun.py
- Python 3.9 or Higher -> Download here
- Node.js version 18 or Higher (includes npm) -> Download here
- MacOS, Linux, or Windows
Note: The term root directory refers to the main directory of the project. In this case, it would be the folder "SketchLogic".
- Refer to backend/README.md for instructions on setting up the backend.
For this you’ll need your terminal open in the root directory:
- In the terminal, start the backend (Flask API):
cd backend
python app.pyOpen another terminal in the root directory, and enter:
python testRun.py
Feel free to edit the test run script to try out the backend api.
- Refer to frontend/README.md for instructions on setting up the frontend.
For this you’ll need your terminal open in the root directory:
- In the terminal, start the frontend (using npm):
cd frontend
npm run devFor this, make sure the backend is already running on localhost:5000 by using the testRun.py script.
Open localhost:5173 on your browser to interact with the frontend.
- Detect logic gates from sketches
Supported: AND, OR, NOT, NAND, NOR, XOR, XNOR - Detect gate rotation (0°, 90°, 180°, 270°)
- Detect wires and return them as ordered XY polylines
- Export all components with coordinates in structured JSON
- Visualize the reconstructed circuit
- Accuracy: >80% accuracy on the above criteria
- Custom YOLO model named SKELO used for gates detection
- Wire Detection Algorithms for detecting wires
- Backend API
- React Frontend
-
Bug reports, suggestions, and PRs are absolutely WELCOME!
-
If you would like to collaborate, please contact the owner using the information provided in the Contact section.
This code is Proprietary and Confidential. See LICENSE for more information.
- LinkedIn: ShahzaibAhmad05
- Email: shahzaibahmad6789@gmail.com