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.
- Loads
train.csvandtest.csvfrom 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
- Conv2D(32) → MaxPool
- Conv2D(64) → MaxPool
- Flatten → Dense(128) → Dropout(0.5)
- Dense(10, softmax)
An advanced CNN is also included:
- Multiple Conv blocks with BatchNormalization
- Dropout regularization
- EarlyStopping + ModelCheckpoint (
best_advanced_cnn.h5)
Kaggle: Digit Recognizer
train.csv: label + 784 pixel columnstest.csv: 784 pixel columns
- Open the notebook:
digitdetector.ipynb - Attach the Kaggle dataset:
digit-recognizer - Run all cells
After running, you will get:
submission.csv✅
submission.csv format:
ImageId(1..N)Label(predicted digit)
See requirements.txt.
- 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.
MIT (recommended)