Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Digit Recognizer (MNIST) — CNN (Kaggle)

This project trains a Convolutional Neural Network (CNN) on the Kaggle Digit Recognizer dataset (MNIST-like, 28×28 grayscale images) and generates a submission.csv file for Kaggle competition submission.

What this project does

  • Loads train.csv and test.csv from Kaggle input dataset
  • Preprocesses pixels (normalize to 0–1 and reshape to 28×28×1)
  • Splits data into train/validation
  • Trains a CNN using TensorFlow/Keras
  • Predicts digits (0–9) for the test set
  • Creates submission.csv in Kaggle working directory

Model Architecture (Baseline CNN)

  • Conv2D(32) → MaxPool
  • Conv2D(64) → MaxPool
  • Flatten → Dense(128) → Dropout(0.5)
  • Dense(10, softmax)

Advanced CNN (Model 2)

An advanced CNN is also included:

  • Multiple Conv blocks with BatchNormalization
  • Dropout regularization
  • EarlyStopping + ModelCheckpoint (best_advanced_cnn.h5)

Dataset

Kaggle: Digit Recognizer

  • train.csv: label + 784 pixel columns
  • test.csv: 784 pixel columns

How to Run (Kaggle Notebook)

  1. Open the notebook: digitdetector.ipynb
  2. Attach the Kaggle dataset: digit-recognizer
  3. Run all cells

After running, you will get:

  • submission.csv

Output

submission.csv format:

  • ImageId (1..N)
  • Label (predicted digit)

Requirements

See requirements.txt.

Notes

  • The notebook uses the Kaggle path:
    • /kaggle/input/digit-recognizer/train.csv
    • /kaggle/input/digit-recognizer/test.csv
  • For local run, you must download the dataset and update the paths.

License

MIT (recommended)

About

Built a machine learning model to classify handwritten digits using the MNIST dataset. Applied and compared algorithms like SVM, KNN, and neural networks to explore computer vision fundamentals and improve image classification accuracy.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages