neeru1207 / AI_Sudoku

GUI based Smart Sudoku Solver that tries to extract a sudoku puzzle from a photo and solve it
Creative Commons Zero v1.0 Universal
999 stars 153 forks source link
blob-detection cnn cnn-tensorflow cv2 digit-recognition-application digital-image-processing gui hough-line-transform hough-lines hough-transform image-processing image-segmentation knn-classification knn-classifier machine-learning opencv-python sudoku-grabber sudoku-solver tkinter-gui tkinter-python

AI_Sudoku

forthebadge made-with-python forthebadge cc-0

GUI Smart Sudoku Solver that tries to extract a sudoku puzzle from a photo and solve it.

Table Of Contents:

Installation

Usage

Working

ToDo

Contributing

Installation

  1. Download and install Python3 from here
  2. I recommend using virtualenv. Download virtualenv by opening a terminal and typing:
    pip install virtualenv
  3. Create a virtual environment with the name sudokuenv.

    • Windows
      virtualenv sudokuenv
      cd sudokuenv/Scripts
      activate
    • Linux:
      source sudokuenv/bin/activate
  4. Clone this repository, extract it if you downloaded a .zip or .tar file and cd into the cloned repository.

    • For Example:
      cd A:\AI_Sudoku-master
  5. Install the required packages by typing:

    pip install -r requirements.txt

    Usage

    • Before running the application, know that you can set the modeltype variable in Run.py to either "CNN" or "KNN" to choose the Convolutional Neural Network or the K Nearest Neighbours Algorithm for Recognition. By default it is set to "KNN" and I got a way higher accuracy using KNN itself, so I would recommend that you don't change it.
      '''Run this file to run the application'''
      from MainUI import MainUI
      from CNN import CNN
      from KNN import KNN
      import os
      # Change the model type variable value to "CNN" to use the Convolutional Neural Network
      # Change the model type variable value to "KNN" to use the K Nearest Neighbours Classifier
      modeltype = "KNN"
    • Type the below command to run the Application. You need to be connected to the Internet and it might take 5-10 minutes to create the knn.sav file so please wait patiently. This delay is only during the first run as once created, the application will use the local file
      python Run.py
    • The GUI Homepage that opens up as soon as you run the application.

Working

Image Preprocessing

Recognition

Convolutional Neural Network

Read about CNNs here

K Nearest Neighbours

Read about KNN here

ToDo

Contributing

Contributions are welcome :smile:

Pull requests

Just a few guidelines:

Issues

If you find any bugs/issues, raise an issue.