Skip to content

SketchLogic is a Logic Circuit Metadata Detector powered by a custom-trained YOLO model and some cool wire detection algorithms

License

Notifications You must be signed in to change notification settings

ShahzaibAhmad05/SketchLogic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Circuit Metadata Detector

SketchLogic Banner

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!


Project Structure

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

Development & Testing

System Requirements:

Note: The term root directory refers to the main directory of the project. In this case, it would be the folder "SketchLogic".

Backend Setup:

Usage:

For this you’ll need your terminal open in the root directory:

  • In the terminal, start the backend (Flask API):
cd backend
python app.py

Testing:

Open 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.


Image

Frontend Setup:

Usage:

For this you’ll need your terminal open in the root directory:

  • In the terminal, start the frontend (using npm):
cd frontend
npm run dev

Testing:

For 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.


Image

Key Features

  • 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

Components

  • Custom YOLO model named SKELO used for gates detection
  • Wire Detection Algorithms for detecting wires
  • Backend API
  • React Frontend

Contributing

  • 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.


License

This code is Proprietary and Confidential. See LICENSE for more information.


Contact