{"id":15009566,"url":"https://github.com/anujdutt9/handwritten-digit-recognition-using-deep-learning","last_synced_at":"2025-05-16T07:05:38.797Z","repository":{"id":15251071,"uuid":"77787784","full_name":"anujdutt9/Handwritten-Digit-Recognition-using-Deep-Learning","owner":"anujdutt9","description":"Handwritten Digit Recognition using Machine Learning and Deep Learning","archived":false,"fork":false,"pushed_at":"2025-03-11T16:34:43.000Z","size":14062,"stargazers_count":241,"open_issues_count":1,"forks_count":134,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-12T16:47:39.937Z","etag":null,"topics":["classification","convolutional-neural-networks","deep-learning","handwritten-digit-recognition","keras","knn","machine-learning","mnist-classification","python-3-5","random-forest","svm-model","tensorflow","theano"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anujdutt9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-01T16:58:08.000Z","updated_at":"2025-04-03T18:37:55.000Z","dependencies_parsed_at":"2025-03-29T14:14:06.736Z","dependency_job_id":null,"html_url":"https://github.com/anujdutt9/Handwritten-Digit-Recognition-using-Deep-Learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anujdutt9%2FHandwritten-Digit-Recognition-using-Deep-Learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anujdutt9%2FHandwritten-Digit-Recognition-using-Deep-Learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anujdutt9%2FHandwritten-Digit-Recognition-using-Deep-Learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anujdutt9%2FHandwritten-Digit-Recognition-using-Deep-Learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anujdutt9","download_url":"https://codeload.github.com/anujdutt9/Handwritten-Digit-Recognition-using-Deep-Learning/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485062,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","convolutional-neural-networks","deep-learning","handwritten-digit-recognition","keras","knn","machine-learning","mnist-classification","python-3-5","random-forest","svm-model","tensorflow","theano"],"created_at":"2024-09-24T19:26:40.438Z","updated_at":"2025-05-16T07:05:33.789Z","avatar_url":"https://github.com/anujdutt9.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Handwritten Digit Recognition using Machine Learning and Deep Learning\n\n## Published Paper \n\n[IJARCET-VOL-6-ISSUE-7-990-997](http://ijarcet.org/wp-content/uploads/IJARCET-VOL-6-ISSUE-7-990-997.pdf)\n\n# Requirements\n\n* Python 3.5 +\n* Scikit-Learn (latest version)\n* Numpy (+ mkl for Windows)\n* Matplotlib\n\n# Usage\n\n**1.** Download the four MNIST dataset files from this link:\n\n```\ncurl -O http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz\ncurl -O http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz\ncurl -O http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz\ncurl -O http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz\n```\n\n**Alternatively, you can download the [dataset from here](https://github.com/anujdutt9/Handwritten-Digit-Recognition-using-Deep-Learning/blob/master/dataset.zip), unzip the files and place them in the respected folders.**\n\n**2.** Unzip and place the files in the dataset folder inside the MNIST_Dataset_Loader folder under each ML Algorithm folder i.e :\n\n```\nKNN\n|_ MNIST_Dataset_Loader\n   |_ dataset\n      |_ train-images-idx3-ubyte\n      |_ train-labels-idx1-ubyte\n      |_ t10k-images-idx3-ubyte\n      |_ t10k-labels-idx1-ubyte\n```\n\nDo this for SVM and RFC folders and you should be good to go.\n\n**3.** To run the code, navigate to one of the directories for which you want to run the code using command prompt:\n\n```\ncd 1. K Nearest Neighbors/\n```\n\nand then run the file \"knn.py\" as follows:\n\n```\npython knn.py\n```\n\nor \n\n```\npython3 knn.py\n```\n\nThis will run the code and all the print statements will be logged into the \"summary.log\" file.\n\n**NOTE: If you want to see the output to print on the Command prompt, just comment out line 16, 17, 18, 106 and 107 and hence you will get all the prints on the screen.**\n\nAlternatively, you can also use PyCharm to run the code and run the \".py\" file in there.\n\nRepeat the steps for SVM and RFC code.\n\n**4.** To run the CNN code, you don't need to provide in the MNIST dataset as it'll be downloaded automatically.\n\nJust run the file as :\n\n```\npython CNN_MNIST.py\n```\n\nor\n\n```\npython3 CNN_MNIST.py\n```\n\nand it should run fine. \n\n**5.** If you want to save the CNN model weights after training, run the code with the following arguments:\n\n```\npython CNN_MNIST.py --save_model 1 --save_weights cnn_weights.hdf5\n```\n\nor \n\n```\npython3 CNN_MNIST.py --save_model 1 --save_weights cnn_weights.hdf5\n```\n\nand it should save the model weights in the same directory.\n\n**6.** To load the saved model weights and avoid the training time again, use the following command:\n\n```\npython CNN_MNIST.py --load_model 1 --save_weights cnn_weights.hdf5\n```\n\nor\n\n```\npython3 CNN_MNIST.py --load_model 1 --save_weights cnn_weights.hdf5\n```\n\nand it should load the model and show the Outputs.\n\n## Accuracy using Machine Learning Algorithms:\n\ni)\t K Nearest Neighbors: 96.67%\n\nii)\t SVM:\t97.91%\n\niii) Random Forest Classifier:\t96.82%\n\n\n## Accuracy using Deep Neural Networks:\n\ni)\tThree Layer Convolutional Neural Network using Tensorflow:\t99.70%\n\nii)\tThree Layer Convolutional Neural Network using Keras and Theano: 98.75%\n\n**All code written in Python 3.5. Code executed on Intel Xeon Processor / AWS EC2 Server.**\n\n## Video Link:\n```\nhttps://www.youtube.com/watch?v=7kpYpmw5FfE\n```\n\n## Test Images Classification Output:\n\n![Output a1](Outputs/output.png \"Output a1\")       \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanujdutt9%2Fhandwritten-digit-recognition-using-deep-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanujdutt9%2Fhandwritten-digit-recognition-using-deep-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanujdutt9%2Fhandwritten-digit-recognition-using-deep-learning/lists"}