{"id":17854793,"url":"https://github.com/yoyolicoris/building-nn-with-numpy","last_synced_at":"2026-04-29T00:05:04.903Z","repository":{"id":140051524,"uuid":"201612796","full_name":"yoyolicoris/building-nn-with-numpy","owner":"yoyolicoris","description":"numpy lenet implementation.","archived":false,"fork":false,"pushed_at":"2019-08-11T08:23:14.000Z","size":43,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T13:14:27.351Z","etag":null,"topics":["convolutional-neural-networks","deep-learning","deep-neural-networks","lenet-mnist","mnist-classification","numpy-tutorial","scipy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yoyolicoris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-10T10:06:21.000Z","updated_at":"2023-07-17T06:41:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"731a84c5-7fe6-484d-ae8c-70f3a6b0aa43","html_url":"https://github.com/yoyolicoris/building-nn-with-numpy","commit_stats":null,"previous_names":["yoyolicoris/building-nn-with-numpy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2Fbuilding-nn-with-numpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2Fbuilding-nn-with-numpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2Fbuilding-nn-with-numpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyolicoris%2Fbuilding-nn-with-numpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoyolicoris","download_url":"https://codeload.github.com/yoyolicoris/building-nn-with-numpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246858135,"owners_count":20845245,"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":["convolutional-neural-networks","deep-learning","deep-neural-networks","lenet-mnist","mnist-classification","numpy-tutorial","scipy"],"created_at":"2024-10-28T01:40:30.848Z","updated_at":"2026-04-29T00:05:04.835Z","avatar_url":"https://github.com/yoyolicoris.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Building NN with NumPy\n\nThis repo provide the minimum necessary code to build and train a CNN model from scratch using NumPy solely (basically I just trying to mimic what PyTorch framework do).\n\n3 layer and one loss function is implemented: **Conv2d**, **MaxPool2d**, **Linear** and **cross_entropy**. \nThey are heavily relied on `numpy.lib.stride_tricks.as_stride` function (Conv2d, MaxPool2d) and `scipy.sparse` matrix (MaxPool2d), \nand have almost the same functionality as their PyTorch version.\nYou can check out in the file [nn](nn.py).\n\n## Quick Start: MNIST classification with LeNet\n\nPlease download mnist dataset from [here](http://yann.lecun.com/exdb/mnist/).\n\n```\npython main.py /path/to/mnist/data\n```\nI got a 96.30% test accuracy, 97.61% training accuracy and final loss around 0.0772 on my laptop. \nIt took about 20 minutes to complete.\n\n![](loss_curve.png)\n\n## Requirements\n* NumPy\n* SciPy (for MaxPool2d)\n\nTo run the mnist example, some extra package need to install:\n* tqdm\n* matplotlib\n* Scikit-learn\n\n## Notes\nBecause I focusing on the core part of understanding neural network (forward and gradient back propagation...), the module reusability is limited \n(ex: you can't forward a module twice before backward the loss).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyolicoris%2Fbuilding-nn-with-numpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoyolicoris%2Fbuilding-nn-with-numpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyolicoris%2Fbuilding-nn-with-numpy/lists"}