KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
visudoku
★ 12
Open GitHub ↗
Solves a sudoku puzzle by looking at it
Download README (.md)
Explore Similar Repositories
vue-jsonld
:
Declarative JSON-LD Structured Data for Vue App . SSR supported
ivy-dynamic-rendering
:
Angular In Depth workshop on dynamic rendering in Ivy.
inkyphat_weather
:
python code to display current and near-term weather conditions on a an inky pHAT eInk screen
cookiecutter-django-api
:
Cookiecutter Django Api is a framework for jumpstarting production-ready Django projects quickly.
Unity-Water2D
:
Ejemplo de como crear agua procedura para 2D
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
visudoku
?
Download (.md)
# ViSudoku This is a visual sudoku solver. It takes a picture of a sudoku puzzle as input and then solves and prints the solution. The whole opencv workflow is explained in `visudoku.ipynb`. Training data (570 images) was generated by hand. Then, it was augmented in the following ways: - added black border of {1..4}px around the image to simulate smaller digits - removed black border of {1..4}px from the image to simulate larger digits - rotated {4, 8, 12, 16} degrees clockwise and anticlockwise to simulate weird orientations Digit recognition is done using K-Nearest Neighbours (knn). The final puzzle is solved by a cpp program (here as a submodule) which I wrote a few years ago. ## UPDATE! Now I have 1332 images, and a better model. The augmentation was limited to {1..2}px scaling and {4, 8} degrees rotation. It performs wayy better now! ## Screenshots <img src="./screens/Original.png" alt="Original" height="400px" /> <img src="./screens/Preprocessed.png" alt="After Preprocessing" height="400px" /> <img src="./screens/GettingTheBoundary.png" alt="Getting boundary of the puzzle" height="400px" /> <img src="./screens/ExtractingThePuzzle.png" alt="Extracting the puzzle" height="400px" /> <img src="./screens/GettingTheDigits.png" alt="Getting the digits" height="400px" /> <img src="./screens/DigitRecognition.png" alt="Digit recognition" height="400px" /> ### An example <img src="./screens/Final.png" alt="Another example" height="400px" /> ## Instructions ### Docker Make sure you have [docker](https://www.docker.com/) installed! You can either build the image yourself (takes a lot of time) or use the online one #### Build locally To get started, run ```sh ./setup.sh docker run -p <port>:8080 -d --name visudoku visudoku ``` #### Download built image Simply run ```sh docker run -p <port>:8080 -d --name visudoku yoogottamk/visudoku ``` You can check the app at the port you specified To stop/start the container, run ```sh docker stop/start visudoku ``` ### Normal Before anything else, please [create a python3 virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) and install the stuff in [requirements.txt](./requirements.txt) ```sh python3 -m venv venv . venv/bin/activate pip install -r requirements.txt ``` #### Please first follow the instructions given in [digit-recog](./digit-recog) ### Flask ```sh ./flask-setup.sh cd flask-app python server.py ``` You can check the app at [port 8080](http://localhost:8080) ### Jupyter *NOTE: You first need to install jupyter notebook/lab first* Run `jupyter notebook` and open `visudoku.ipynb`. You can either use the images given in `test-images`, or provide your own images, or even use the webcam. To use the webcam, you have to provide an invalid image pat. If you use the webcam, you have to press `c` when you want to capture the image. After getting the image, it will automatically solve and give the solution at the bottom. ## Aside This project began a year ago, I could only work on it in my vacations. #### winter'18 - Decided that I wanted to make something like this - Finished the opencv part (everything till digit extraction) - Got stuck at digit recognition. #### summer'19 - Took [a course on ml](https://www.coursera.org/learn/machine-learning) - Tried to make it recognize the digits, failed terribly - Realised that digit extraction is really bad, rewrote it - Wrote a [solarized-dark theme usercss](https://github.com/YoogottamK/jupyter-notebook-solarized-dark) for jupyter notebook and jupyterlab #### winter'19 - Tried digit recognition again, using a CNN, accuracy: 9% - Tried digit recognition using knn, accuracy: 99.69% - Put up all the pieces together ##### TODO: organize this in a better manner, create a better frontend, and tidy up the code