-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automatically download checkpoints
- Loading branch information
1 parent
d3f9a58
commit f206331
Showing
3 changed files
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import os | ||
import torch | ||
import torch.nn as nn | ||
from pytorchcv.model_provider import get_model as ptcv_get_model | ||
|
||
|
||
def resattnet56(in_channels, num_classes, pretrained=True): | ||
def resattnet56(in_channels=3, num_classes=1000, pretrained=True): | ||
model = ptcv_get_model("resattnet56", pretrained=False) | ||
|
||
if pretrained is True: | ||
# load pretrained automatically | ||
pass | ||
|
||
state = torch.hub.load_state_dict_from_url( | ||
"https://github.com/phamquiluan/ResidualAttentionNetwork/releases/download/v0.1.0/resattnet56.pth" | ||
) | ||
model.load_state_dict(state["state_dict"]) | ||
model.output = nn.Linear(2048, num_classes) | ||
return model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters