This repository contains a PyTorch implementation of the ResNet-18 architectures, constructed entierly from scratch based on the original paper "Deep Residual Learning for Image Recognition" (He et al., 2016).
Unlike simply calling torchvision.models.resnet18, the goal of this project was to:
- Deeply understand the residual learning framework and the vanishing gradient problem.
- Manually implement the detailed architecture, including Residual Blocks and Skip Connections.
- Train and validate the model on a custom dataset to verify its performance.
The core idea of ResNet is to introduce a "shortcut connection" that skips one or more layers. This allows the network to fit a residual mapping
- Residual Block : Implemented the basic building block of ResNet-18 containing two 3x3 convolutions with Batch Normalization(BN) and ReLU.
-
Skip Connection : Solved the degradation problem in deep networks by adding the input
$x$ to the output of the stacked layers ($F(x) + x$ ). -
Architectures:
- Initial : 7x7 Conv, MaxPool
- 4 Layers of Residual Blocks (64, 128, 256, 512 channels)
- Final : Average Pool, Fully-Connected Layer
Due to the file size limit, the dataset files (train.tar, test.tar) are hosted on Google Drive. Please download them from the link below:
[Dataset Setup]
Since the dataset exceeds GitHub's file size limit, it is provided via Google Drive. Download train.tar and test.tar from the link below. Place the files in the dataset/ directory (or your project root). Unzip the files before running the code.
-
Test.tar [Download Dataset (Google Drive)] https://drive.google.com/file/d/1_xa8drDAsu2PPVzGyi5vIg2hWcB2NpML/view?usp=share_link
-
Train.tar [Download Dataset (Google Drive)] https://drive.google.com/file/d/17sZRr2BQ1-bT04kYuTcVx2vPUO4F53f2/view?usp=share_link