Skip to content

Instantly share code, notes, and snippets.

@aliwaqas333
Created June 19, 2020 09:46
Show Gist options
  • Save aliwaqas333/fd8df09767fd4b1a137339ed4355ac89 to your computer and use it in GitHub Desktop.
Save aliwaqas333/fd8df09767fd4b1a137339ed4355ac89 to your computer and use it in GitHub Desktop.
model creation
class MaskDetection(ImageClassificationBase):
def __init__(self):
super().__init__()
self.network = nn.Sequential(
nn.Conv2d(3, 100, kernel_size=3, padding=1),
nn.ReLU(),
nn.Conv2d(100, 128, kernel_size=3, stride=1, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2), # output: 128 x 8 x 8
nn.Conv2d(128, 256, kernel_size=3, stride=1, padding=1),
nn.ReLU(),
nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1),
nn.ReLU(),
nn.MaxPool2d(2, 2), # output: 256 x 4 x 4
nn.Flatten(),
nn.Linear(160000, 512),
nn.ReLU(),
nn.Linear(512, 256),
nn.ReLU(),
nn.Linear(256, 2))
def forward(self, xb):
return self.network(xb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment