{"id":21872032,"url":"https://github.com/3outeille/cnnumpy","last_synced_at":"2026-03-02T09:32:30.716Z","repository":{"id":37640929,"uuid":"226107452","full_name":"3outeille/CNNumpy","owner":"3outeille","description":"A Numpy implementation of a Convolutional Neural Network: slow \u0026 fast (im2col/col2im).","archived":false,"fork":false,"pushed_at":"2023-07-06T22:00:25.000Z","size":34416,"stargazers_count":56,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T00:04:36.953Z","etag":null,"topics":["cnn","col2im","convolutional-neural-networks","im2col","numpy","python","python3"],"latest_commit_sha":null,"homepage":"https://3outeille.github.io/deep-learning/","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/3outeille.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}},"created_at":"2019-12-05T13:22:30.000Z","updated_at":"2025-03-05T20:53:39.000Z","dependencies_parsed_at":"2022-08-29T09:10:16.509Z","dependency_job_id":"4678165c-24c6-4953-842a-52f1fd54fb1c","html_url":"https://github.com/3outeille/CNNumpy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/3outeille/CNNumpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3outeille%2FCNNumpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3outeille%2FCNNumpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3outeille%2FCNNumpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3outeille%2FCNNumpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3outeille","download_url":"https://codeload.github.com/3outeille/CNNumpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3outeille%2FCNNumpy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29997213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cnn","col2im","convolutional-neural-networks","im2col","numpy","python","python3"],"created_at":"2024-11-28T06:18:22.418Z","updated_at":"2026-03-02T09:32:30.679Z","avatar_url":"https://github.com/3outeille.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"./img/logo.png\" hspace=\"20%\" width=\"60%\"\u003e\n\n## Introduction\n\n- **CNNumpy** is a Convolutional Neural Network written in pure Numpy (educational purpose only).\n- There are 2 implementation versions:\n    - Slow: The naive version with nested for loops.\n    - Fast: The im2col/col2im version.\n- The [slow implementation][slow-implementation] takes around **4 hours for 1 epoch** where the [fast implementation][fast-implementation] takes only **6 min for 1 epoch**.\n- For your information, with the same architecture using **Pytorch**, it will take around **1 min for 1 epoch**.\n- **For more details, here are my blog posts explaining in depth what's going on under the hood for each implementation ([slow][slow-blog] and [fast][fast-blog]).**\n- In the [`demo-cnnumpy-fast.ipynb`][demo-notebook] notebook, the im2col/col2im implementation can achieve an accuracy up to  **97.2% in 1 epoch (~6 min)**. Here are some results:\n\n\u003cimg src=\"./img/correct-classification.png\" hspace=\"20%\" width=\"50%\"\u003e\n\u003cimg src=\"./img/incorrect-classification.png\" hspace=\"20%\" width=\"50%\"\u003e\n\n\n## Installation\n\n- Create a virtual environment in the root folder using [virtualenv][virtualenv] and activate it.\n\n```bash\n# On Linux terminal, using virtualenv.\nvirtualenv myenv\n# Activate it.\nsource myenv/bin/activate\n```\n\n- Install **requirements.txt**.\n\n```bash\npip install -r requirements.txt\n# Tidy up the root folder.\npython3 setup.py clean\n```\n\n## Usage of demo notebooks\n\nTo play with the `demo-notebooks/` files, you need to make sure jupyter notebook can select your virtual environnment as a kernel.\n\n- Follow **\"Installation\"** instructions first and make sure your virtual environment is still activated.\n- Run the following line in the terminal.\n```bash\npython -m ipykernel install --user--name=myenv\n```\n- Run the notebook file **only from `demo_notebooks/`** and then select **Kernel \u003e Switch Kernel \u003e myenv**. You are now ready to go !\n\n\u003c!---\nVariables with links.\n--\u003e\n[slow-implementation]: https://github.com/3outeille/CNNumpy/tree/master/src/slow\n[fast-implementation]: https://github.com/3outeille/CNNumpy/tree/master/src/fast\n[slow-blog]: https://hackmd.io/@machine-learning/blog-post-cnnumpy-slow\n[fast-blog]: https://hackmd.io/@machine-learning/blog-post-cnnumpy-fast\n[demo-notebook]: https://github.com/3outeille/CNNumpy/blob/master/src/demo_notebooks/demo-cnnumpy-fast.ipynb\n[virtualenv]: https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3outeille%2Fcnnumpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3outeille%2Fcnnumpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3outeille%2Fcnnumpy/lists"}