Skip to content

Commit

Permalink
AlexNet implementation - in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaczan committed Feb 19, 2024
1 parent 9466d66 commit 91c3438
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ A collection of deep learning models implemented in PyTorch and PyTorch Lightnin

Hopefully each of them will get a dedicated blog post on my humble tech blog [maczan.pl](https://maczan.pl)

- [x] LeNet
- [ ] AlexNet
- [x] [LeNet](http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf)
- [ ] [AlexNet](https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf) 📝 in progress 📚
- [ ] VGG
- [ ] ResNet
- [ ] Inception
Expand Down
36 changes: 36 additions & 0 deletions src/models/components/alexnet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import torch
from torch import nn


class AlexNet(nn.Module):
"""
Paper: https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf
"""

def __init__(self):
super().__init__()

self.model = nn.Sequential(
nn.Conv2d(in_channels=224, out_channels=55, kernel_size=(11, 11), stride=4),
nn.ReLU(),
nn.MaxPool2d(kernel_size=(5, 5)),
#
nn.Conv2d(in_channels=55, out_channels=27, kernel_size=(5, 5)),
nn.ReLU(),
nn.MaxPool2d(kernel_size=(3, 3)),
#
nn.Conv2d(in_channels=55, out_channels=27, kernel_size=(5, 5)),
nn.ReLU(),
nn.MaxPool2d(kernel_size=(3, 3)),
#
nn.Conv2d(in_channels=55, out_channels=27, kernel_size=(5, 5)),
nn.ReLU(),
nn.MaxPool2d(kernel_size=(3, 3)),
#
nn.Conv2d(in_channels=55, out_channels=27, kernel_size=(5, 5)),
nn.ReLU(),
nn.MaxPool2d(kernel_size=(3, 3)),
#
nn.ReLU(),
nn.Linear(in_features=128, out_features=192),
)

0 comments on commit 91c3438

Please sign in to comment.