Giter VIP home page Giter VIP logo

mnist-handwritten-digits-classification's Introduction

MNIST Digit Recognition

  • Simple neural network

  • Convolutional Neural Networks (CNN)

This repository contains code for training and evaluating a Neural Network model on the MNIST dataset to classify handwritten digits. The code is implemented using PyTorch, a popular deep learning framework.

MNIST Dataset

The MNIST dataset is a widely used benchmark dataset in the field of machine learning. It consists of a training set of 60,000 grayscale images of handwritten digits from 0 to 9, and a test set of 10,000 images. Each image is 28x28 pixels.

Requirements

To run the code, you need to have the following dependencies installed:

  • Python 3.x
  • PyTorch
  • torchvision
  • NumPy
  • Matplotlib

CNN Architecture :

flowchart TD;
    MNIST_PROJECT-->DOWNLOAD_DATASET;
    DOWNLOAD_DATASET-->PREPROCESSING;
    PREPROCESSING-->CNN_ARCHITECTURE_DESIGN;
    CNN_ARCHITECTURE_DESIGN-->MODEL_TRAINING_&_EVALUATION;
    MODEL_TRAINING_&_EVALUATION-->PREDICTION_ON_TESTSET;    
Loading

Model Architecture

Key Features:

CNN Architecture: The project utilizes a meticulously designed CNN architecture comprising convolutional layers, pooling layers, and fully connected layers. This architecture enables the model to extract intricate features from digit images, facilitating accurate classification.

The CNN model used in this code consists of two convolutional layers followed by fully connected layers. The architecture is as follows:


CNN (
  (L1): Sequential(
    (0): Conv2d(1, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (1): ReLU()
    (2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  )
  (L2): Sequential(
    (0): Conv2d(32, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (1): ReLU()
    (2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
  )
  (L3): Linear(in_features=1176, out_features=10, bias=True)
 
)

Data Preprocessing: The project employs essential data preprocessing techniques such as normalization and resizing to ensure optimal compatibility with the CNN model, enhancing its overall performance.

Model Training and Evaluation: The model undergoes rigorous training using the MNIST training dataset and is evaluated using the MNIST testing dataset. This evaluation process provides crucial insights into the model's performance metrics, including accuracy, precision, and recall.

Results

The trained model achieves high accuracy on the MNIST test set, as the accuracy plot indicates.

NN

Accuracy while training:~ 99%

Acurracy for test set :94.75957697088067

image

CNN

image

Accuracy while training:~ 99%

Acurracy for test set :96.93495976892923

mnist-handwritten-digits-classification's People

Contributors

coderhetal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.