This project solves Sudoku puzzles from images using computer vision and deep learning. It involves digit recognition, grid extraction, and recursive solution algorithms. Users can upload a Sudoku image or take a photo, and the application returns the solved puzzle.
Data Source: The project relies on custom images of Sudoku grids and training data for digit recognition.
- Project Features
- Project Architecture
- Technologies Used
- Running the Application
- Project Structure
- Usage Examples
- Contact
- Computer Vision Grid Detection: Automatically detects and aligns the Sudoku grid from an image.
- Digit Recognition Model: Recognizes and classifies digits within the grid using a trained CNN model.
- Sudoku Solver: Solves the puzzle using a recursive backtracking algorithm.
- Interactive Interface: Displays results through an interactive Streamlit application.
Below is the high-level architecture of the project, including image acquisition, preprocessing, digit recognition, solution, and visualization stages.
- Image Acquisition: Users can upload or capture images of Sudoku puzzles.
- Preprocessing & Grid Detection: Applies computer vision techniques to detect and extract the Sudoku grid.
- Digit Recognition: Classifies each cell using a convolutional neural network.
- Solving Algorithm: Uses backtracking to fill in missing values in the Sudoku puzzle.
- Deployment: Displays the solved puzzle within a Streamlit application.
- Jupyter Notebooks: For data exploration and code testing.
- Python: Core programming language.
- OpenCV: For image processing and analysis.
- Streamlit: For creating an interactive web application.
- TensorFlow/Keras: For training the convolutional neural network.
- Pillow: For image handling and manipulation.
-
Clone the Repository:
- First, clone the repository to your local machine:
git clone https://github.com/Carlos93U/sudoku_vision.git cd sudoku_vision
- First, clone the repository to your local machine:
-
Install Dependencies:
- Install the required dependencies using
requirements.txt:pip install -r requirements.txt
- Install the required dependencies using
-
Run the Streamlit Application:
- Start the app locally:
streamlit run app/main.py
- Access the application in your web browser at
http://localhost:8501.
- Start the app locally:
The following is an overview of the main folders and files within the project.
sudoku_vision/
│
├── data/ # Stores image data for training and testing
│ ├── cells/ # Directory for storing cropped cell images
│ └── augmented_cells/ # Directory for storing augmented images
│
├── models/ # Saved models for digit recognition
│
├── docs/ # Project documentation
├── src/ # Source code for core functionalities
│ ├── preprocessing.py # Image preprocessing and grid extraction
│ ├── digit_recognition.py # Digit classification using CNN
│ ├── solver.py # Recursive backtracking Sudoku solver
│
├── app/ # Streamlit application files
│ └── main.py # Entry point for the Streamlit app
├── requirements.txt # List of dependencies
└── README.md # Project documentation
The application allows users to solve Sudoku puzzles from uploaded images, displaying the original puzzle and the solved puzzle side by side. You can try out the Sudoku Vision application live on Streamlit:
🔗 Launch the Sudoku Vision App on Streamlit
For any questions or feedback, please contact:
Juan C. Huillcas
Email: huillcas.juan3@gmail.com
LinkedIn: Juan C. Huillcas


