{"id":28264688,"url":"https://github.com/vansh-py04/convolution-net-from-scratch","last_synced_at":"2026-04-24T16:02:11.322Z","repository":{"id":292512341,"uuid":"981130380","full_name":"vansh-py04/Convolution-Net-from-Scratch","owner":"vansh-py04","description":"A minimal NumPy-based implementation of a 3-layer convolutional neural network (CNN) from scratch — including custom forward and backward passes for conv, ReLU, pooling, affine, and softmax layers. Perfect for learning how CNNs actually work under the hood.","archived":false,"fork":false,"pushed_at":"2025-05-20T05:38:12.000Z","size":278,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T08:48:47.359Z","etag":null,"topics":["backpropagation","cnn","computer-vision","convolutional-neural-networks","cs231n","cs231n-assignment","deep-learning","from-scratch","from-scratch-in-python","fully-connected-network","machine-learning","maxpool2d","nueral-networks","numpy","softmax","stanford-deep-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/vansh-py04.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,"zenodo":null}},"created_at":"2025-05-10T12:09:26.000Z","updated_at":"2025-05-20T05:38:15.000Z","dependencies_parsed_at":"2025-05-10T13:23:39.961Z","dependency_job_id":"fb4238b4-e144-4d28-a424-2c639ed305e9","html_url":"https://github.com/vansh-py04/Convolution-Net-from-Scratch","commit_stats":null,"previous_names":["vansh-py04/convolution-net-from-scratch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vansh-py04/Convolution-Net-from-Scratch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vansh-py04%2FConvolution-Net-from-Scratch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vansh-py04%2FConvolution-Net-from-Scratch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vansh-py04%2FConvolution-Net-from-Scratch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vansh-py04%2FConvolution-Net-from-Scratch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vansh-py04","download_url":"https://codeload.github.com/vansh-py04/Convolution-Net-from-Scratch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vansh-py04%2FConvolution-Net-from-Scratch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backpropagation","cnn","computer-vision","convolutional-neural-networks","cs231n","cs231n-assignment","deep-learning","from-scratch","from-scratch-in-python","fully-connected-network","machine-learning","maxpool2d","nueral-networks","numpy","softmax","stanford-deep-learning"],"created_at":"2025-05-20T09:11:07.733Z","updated_at":"2026-04-24T16:02:11.317Z","avatar_url":"https://github.com/vansh-py04.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 🧠 ThreeLayerConvNet\n\nA from-scratch implementation of a three-layer convolutional neural network (CNN) in NumPy with custom forward and backward passes for convolution, pooling, activation, affine layers, and softmax loss.\n\n## 🔧 Architecture\n\n    Input → Conv → ReLU → MaxPool(2x2) → Affine → ReLU → Affine → Softmax\n---\n\nThis minimal CNN supports:\n\n* Custom weight initialization\n\n* Naive forward/backward implementations (no deep learning libraries used)\n\n* Layer composability through modular design\n\n* Debugging-friendly shape printing for each major block\n\n---\n\n## 📁 Files Overview\n| File                     | Description                                                            |\n| ------------------------ | ---------------------------------------------------------------------- |\n| `CNN.py`                 | Defines the `ThreeLayerConvNet` class with full forward/backward logic |\n| `Conv2d.py`              | Naive 2D convolution forward and backward pass                         |\n| `ReLU.py`                | ReLU activation forward and backward pass                              |\n| `Maxpool.py`             | Naive 2x2 max pooling forward and backward                             |\n| `Affine_layer.py`        | Fully-connected (affine) layer logic                                   |\n| `Softmax_loss.py`        | Softmax loss and gradient implementation                               |\n| `Sandwich_layers.py`     | Helper functions for chaining layers: `conv-relu-pool`, `affine-relu`  |\n| `Implementation.ipynb` | Notebook demonstrating usage and testing of the network                |\n| `Images`                 | Test Images for out Convolution Layers                                 |  \n\nThe model can classify images of shape (3, 32, 32) into 10 classes. You can also plug it into datasets like CIFAR-10 (after appropriate preprocessing).\n\n---\n\n## 📌 Features\n\nNumPy-only: No TensorFlow/PyTorch/Keras used\n\nBackpropagation from scratch: Every layer implements its own gradient logic\n\nDebug output: Key print statements show internal shape flows\n\nExtensible design: Each component is modular and reusable\n\nThis repository is designed not just to use a CNN — but to help you learn how it actually works under the hood. Every major layer of a convolutional neural network has been manually implemented from scratch using just NumPy, with readable and modular Python code.\n\nHere’s how you can use this repo to gain a deep understanding of CNN fundamentals:\n\n# Study Each Layer in Isolation\nEach layer (e.g., convolution, ReLU, max-pooling, affine, softmax) is implemented in its own file:\n\n* Conv2d.py: Learn how convolutions apply filters using nested loops and stride/padding logic.\n\n* ReLU.py: Understand how non-linear activations shape model capacity.\n\n* Maxpool.py: Observe how spatial downsampling is performed via max-pooling.\n\n* Affine_layer.py: Explore fully-connected transformations using matrix reshaping and dot products.\n\n* Softmax_loss.py: Learn how classification loss and gradients are computed for training.\n\n## Clone the Repo\n    git clone https://github.com/vansh-py04/Convolution-Net-from-Scratch.git\n    cd ThreeLayerConvNet\n\n## 🙋‍♂️ Credits\n\nBuilt by [Yuganter Pratap](https://www.linkedin.com/in/yuganter-pratap-a3a719254/) — inspired by CS231n and DIY deep learning educational projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvansh-py04%2Fconvolution-net-from-scratch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvansh-py04%2Fconvolution-net-from-scratch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvansh-py04%2Fconvolution-net-from-scratch/lists"}